diff --git a/THIRD_PARTY_NOTICES b/THIRD_PARTY_NOTICES index 39b14c1e3..2aea1002a 100644 --- a/THIRD_PARTY_NOTICES +++ b/THIRD_PARTY_NOTICES @@ -30,7 +30,7 @@ COMPONENT INVENTORY - Go: github.com/grpc-ecosystem/grpc-gateway/v2 v2.31.0 - Go: github.com/klauspost/compress v1.20.3 - Go: github.com/klauspost/cpuid/v2 v2.4.0 -- Go: github.com/labstack/echo/v5 v5.4.0 +- Go: github.com/labstack/echo/v5 v5.4.2 - Go: github.com/mattn/go-isatty v0.0.24 - Go: github.com/mfridman/interpolate v0.0.2 - Go: github.com/modelcontextprotocol/go-sdk v1.8.0 @@ -290,7 +290,7 @@ COMPONENT INVENTORY - npm: which 2.0.2 (declared license: ISC) - npm: yaml 2.9.1 (declared license: ISC) - npm: zod 3.25.76 (declared license: MIT) -- npm: zod 4.6.5 (declared license: MIT) +- npm: zod 4.6.6 (declared license: MIT) - npm: zrender 6.1.0 (declared license: BSD-3-Clause) - npm: zwitch 2.0.4 (declared license: MIT) @@ -1635,7 +1635,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- Applies to ------------------------------------------------------------- -- Go: github.com/labstack/echo/v5 v5.4.0 / LICENSE +- Go: github.com/labstack/echo/v5 v5.4.2 / LICENSE ---------------------------------------------------------------------------- The MIT License (MIT) @@ -10582,7 +10582,7 @@ THIS SOFTWARE. --- Applies to ------------------------------------------------------------- - npm: zod 3.25.76 / LICENSE -- npm: zod 4.6.5 / LICENSE +- npm: zod 4.6.6 / LICENSE ---------------------------------------------------------------------------- MIT License diff --git a/go.mod b/go.mod index 028260213..0afa4258b 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/google/jsonschema-go v0.4.3 github.com/google/uuid v1.6.0 github.com/klauspost/compress v1.20.3 - github.com/labstack/echo/v5 v5.4.0 + github.com/labstack/echo/v5 v5.4.2 github.com/modelcontextprotocol/go-sdk v1.8.0 github.com/parquet-go/parquet-go v0.32.0 github.com/pressly/goose/v3 v3.29.0 diff --git a/go.sum b/go.sum index 128a4b69a..fc77d4f12 100644 --- a/go.sum +++ b/go.sum @@ -75,8 +75,8 @@ github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV91 github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v5 v5.4.0 h1:iY674460IvSmUcj7MziL3YrgyTClghz5BpdZoKiGxR4= -github.com/labstack/echo/v5 v5.4.0/go.mod h1:4iEGNQiPPZnkfYpNR/L6fINd3NLiGWUD5+eBotFALas= +github.com/labstack/echo/v5 v5.4.2 h1:6Jk4ur2Sc7R6vH3DflrvfWmyrf9xX0yosFKBn+/8nZA= +github.com/labstack/echo/v5 v5.4.2/go.mod h1:4iEGNQiPPZnkfYpNR/L6fINd3NLiGWUD5+eBotFALas= github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI= github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY= diff --git a/internal/mcp/apps/panels.html b/internal/mcp/apps/panels.html index d4068cc05..93bff935c 100644 --- a/internal/mcp/apps/panels.html +++ b/internal/mcp/apps/panels.html @@ -60,59 +60,59 @@ `,` -`];function KM(e,t){return t.type=e,t}function qM(e){return e.type===`section`}function JM(e){return qM(e)?pce:mce}function YM(e){if(qM(e)){var t=0,n=e.blocks.length,r=n>1||n>0&&!e.noHeader;return W(e.blocks,function(e){var n=YM(e);n>=t&&(t=n+ +(r&&(!n||qM(e)&&!e.noHeader)))}),t}return 0}function pce(e,t,n,r){var i=t.noHeader,a=hce(YM(t)),o=[],s=t.blocks||[];Hb(!s||G(s)),s||=[];var c=e.orderMode;if(t.sortBlocks&&c){s=s.slice();var l={valueAsc:`asc`,valueDesc:`desc`};if(Zb(l,c)){var u=new Xse(l[c],null);s.sort(function(e,t){return u.evaluate(e.sortParam,t.sortParam)})}else c===`seriesDesc`&&s.reverse()}W(s,function(n,i){var s=t.valueFormatter,c=JM(n)(s?U(U({},e),{valueFormatter:s}):e,n,i>0?a.html:0,r);c!=null&&o.push(c)});var d=e.renderMode===`richText`?o.join(a.richText):ZM(r,o.join(``),i?n:a.html);if(i)return d;var f=Sj(t.header,`ordinal`,e.useUTC),p=GM(r,e.renderMode).nameStyle,m=WM(r);return e.renderMode===`richText`?QM(e,f,p)+a.richText+d:ZM(r,`
`+PA(f)+`
`+d,n)}function mce(e,t,n,r){var i=e.renderMode,a=t.noName,o=t.noValue,s=!t.markerType,c=t.name,l=e.useUTC,u=t.valueFormatter||e.valueFormatter||function(e){return e=G(e)?e:[e],bb(e,function(e,t){return Sj(e,G(p)?p[t]:p,l)})};if(!(a&&o)){var d=s?``:e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||K.color.secondary,i),f=a?``:Sj(c,`ordinal`,l),p=t.valueType,m=o?[]:u(t.value,t.rawDataIndex),h=!s||!a,g=!s&&a,_=GM(r,i),v=_.nameStyle,y=_.valueStyle;return i===`richText`?(s?``:d)+(a?``:QM(e,f,v))+(o?``:vce(e,m,h,g,y)):ZM(r,(s?``:d)+(a?``:gce(f,!s,v))+(o?``:_ce(m,h,g,y)),n)}}function XM(e,t,n,r,i,a){if(e)return JM(e)({useUTC:i,renderMode:n,orderMode:r,markupStyleCreator:t,valueFormatter:e.valueFormatter},e,0,a)}function hce(e){return{html:dce[e],richText:fce[e]}}function ZM(e,t,n){var r=`
`,i=`margin: `+n+`px 0 0`,a=WM(e);return`
`+t+r+`
`}function gce(e,t,n){var r=t?`margin-left:2px`:``;return``+PA(e)+``}function _ce(e,t,n,r){var i=t?`float:right;margin-left:`+(n?`10px`:`20px`):``;return e=G(e)?e:[e],``+bb(e,function(e){return PA(e)}).join(`  `)+``}function QM(e,t,n){return e.markupStyleCreator.wrapRichTextStyle(t,n)}function vce(e,t,n,r,i){var a=[i],o=r?10:20;return n&&a.push({padding:[0,0,0,o],align:`right`}),e.markupStyleCreator.wrapRichTextStyle(G(t)?t.join(` `):t,a)}function yce(e,t){var n=e.getData().getItemVisual(t,`style`)[e.visualDrawType];return Ej(n)}function $M(e,t){return e.get(`padding`)??(t===`richText`?[8,10]:10)}var eN=function(){function e(){this.richTextStyles={},this._nextStyleNameId=Ax()}return e.prototype._generateStyleName=function(){return`__EC_aUTo_`+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(e,t,n){var r=n===`richText`?this._generateStyleName():null,i=Ese({color:t,type:e,renderMode:n,markerId:r});return Ob(i)?i:(this.richTextStyles[r]=i.style,i.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};G(t)?W(t,function(e){return U(n,e)}):U(n,t);var r=this._generateStyleName();return this.richTextStyles[r]=n,`{`+r+`|`+e+`}`},e}();function bce(e){var t=e.series,n=e.dataIndex,r=e.multipleSeries,i=t.getData(),a=i.mapDimensionsAll(`defaultedTooltip`),o=a.length,s=t.getRawValue(n),c=G(s),l=yce(t,n),u,d,f,p;if(o>1||c&&!o){var m=xce(s,t,n,a,l);u=m.inlineValues,d=m.inlineValueTypes,f=m.blocks,p=m.inlineValues[0]}else if(o){var h=i.getDimensionInfo(a[0]);p=u=SM(i,n,a[0]),d=h.type}else p=u=c?s[0]:s;var g=iS(t),_=g&&t.name||``,v=i.getName(n),y=r?_:v;return KM(`section`,{header:_,noHeader:r||!g,sortParam:p,blocks:[KM(`nameValue`,{markerType:`item`,markerColor:l,name:y,noName:!Ub(y),value:u,valueType:d,rawDataIndex:i.getRawIndex(n)})].concat(f||[])})}function xce(e,t,n,r,i){var a=t.getData(),o=xb(e,function(e,t,n){var r=a.getDimensionInfo(n);return e||=r&&r.tooltip!==!1&&r.displayName!=null},!1),s=[],c=[],l=[];r.length?W(r,function(e){u(SM(a,n,e),e)}):W(e,u);function u(e,t){var n=a.getDimensionInfo(t);n&&n.otherDims.tooltip!==!1&&(o?l.push(KM(`nameValue`,{markerType:`subItem`,markerColor:i,name:n.displayName,value:e,valueType:n.type})):(s.push(e),c.push(n.type)))}return{inlineValues:s,inlineValueTypes:c,blocks:l}}var tN=dS();function nN(e,t){return e.getName(t)||e.getId(t)}var rN=function(e){H(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=TM({count:Cce,reset:wce}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(tN(this).sourceManager=new lce(this)).prepareSource();var r=this.getInitialData(e,n);aN(r,this),this.dataTask.context.data=r,tN(this).dataBeforeProcessed=r,iN(this),this._initSelectedMapFromData(r)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=Bj(this),r=n?Hj(e):{},i=this.subType;Wj.hasClass(i)&&(i+=`Series`),hb(e,t.getTheme().get(this.subType)),hb(e,this.getDefaultOption()),Wx(e,`label`,[`show`]),this.fillDataTextStyle(e.data),n&&Vj(e,r,n)},t.prototype.mergeOption=function(e,t){e=hb(this.option,e,!0),this.fillDataTextStyle(e.data);var n=Bj(this);n&&Vj(this.option,e,n);var r=tN(this).sourceManager;r.dirty(),r.prepareSource();var i=this.getInitialData(e,t);aN(i,this),this.dataTask.dirty(),this.dataTask.context.data=i,tN(this).dataBeforeProcessed=i,iN(this),this._initSelectedMapFromData(i)},t.prototype.fillDataTextStyle=function(e){if(e&&!Nb(e))for(var t=[`show`],n=0;n=0&&u<0)&&(l=v,u=_,d=0),_===u&&(c[d++]=m))}return c.length=d,c},t.prototype.formatTooltip=function(e,t,n){return bce({series:this,dataIndex:e,multipleSeries:t})},t.prototype.isAnimationEnabled=function(){var e=this.ecModel;if($b.node&&!(e&&e.ssr))return!1;var t=this.getShallow(`animation`);return t&&this.getData().count()>this.getShallow(`animationThreshold`)&&(t=!1),!!t},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(e,t,n){var r=this.ecModel,i=Kj.prototype.getColorFromPalette.call(this,e,t,n);return i||=r.getColorFromPalette(e,t,n),i},t.prototype.coordDimToDataDim=function(e){return this.getRawData().mapDimensionsAll(e)},t.prototype.getProgressive=function(){return this.get(`progressive`)},t.prototype.getProgressiveThreshold=function(){return this.get(`progressiveThreshold`)},t.prototype.select=function(e,t){this._innerSelect(this.getData(t),e)},t.prototype.unselect=function(e,t){var n=this.option.selectedMap;if(n){var r=this.option.selectedMode,i=this.getData(t);if(r===`series`||n===`all`){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var a=0;a=0&&n.push(i)}return n},t.prototype.isSelected=function(e,t){var n=this.option.selectedMap;if(!n)return!1;var r=this.getData(t);return(n===`all`||n[nN(r,e)])&&!r.getItemModel(e).get([`select`,`disabled`])},t.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var e=this.option.universalTransition;return e?e===!0||e&&e.enabled:!1},t.prototype._innerSelect=function(e,t){var n,r,i=this.option,a=i.selectedMode,o=t.length;if(a&&o){if(a===`series`)i.selectedMap=`all`;else if(a===`multiple`){jb(i.selectedMap)||(i.selectedMap={});for(var s=i.selectedMap,c=0;c0&&this._innerSelect(e,t)}},t.registerClass=function(e){return Wj.registerClass(e)},t.protoInitialize=function(){var e=t.prototype;e.type=`series.__base__`,e.seriesIndex=0,e.ignoreStyleOnData=!1,e.hasSymbolVisual=!1,e.defaultSymbol=`circle`,e.visualStyleAccessPath=`itemStyle`,e.visualDrawType=`fill`}(),t}(Wj);vb(rN,CM),vb(rN,Kj),zS(rN,Wj);function iN(e){var t=e.name;iS(e)||(e.name=Sce(e)||t)}function Sce(e){var t=e.getRawData(),n=t.mapDimensionsAll(`seriesName`),r=[];return W(n,function(e){var n=t.getDimensionInfo(e);n.displayName&&r.push(n.displayName)}),r.join(` `)}function Cce(e){return e.model.getRawData().count()}function wce(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),Tce}function Tce(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function aN(e,t){W(oie(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(n){e.wrapMethod(n,Eb(Ece,t))})}function Ece(e,t){var n=oN(e);return n&&n.setOutputEnd((t||this).count()),t}function oN(e){var t=(e.ecModel||{}).scheduler,n=t&&t.getPipeline(e.uid);if(n){var r=n.currentTask;if(r){var i=r.agentStubMap;i&&(r=i.get(e.uid))}return r}}function sN(e){return e==null?0:e.length||1}function cN(e){return e}var lN=function(){function e(e,t,n,r,i,a){this._old=e,this._new=t,this._oldKeyGetter=n||cN,this._newKeyGetter=r||cN,this.context=i,this._diffModeMultiple=a===`multiple`}return e.prototype.add=function(e){return this._add=e,this},e.prototype.update=function(e){return this._update=e,this},e.prototype.updateManyToOne=function(e){return this._updateManyToOne=e,this},e.prototype.updateOneToMany=function(e){return this._updateOneToMany=e,this},e.prototype.updateManyToMany=function(e){return this._updateManyToMany=e,this},e.prototype.remove=function(e){return this._remove=e,this},e.prototype.execute=function(){this[this._diffModeMultiple?`_executeMultiple`:`_executeOneToOne`]()},e.prototype._executeOneToOne=function(){var e=this._old,t=this._new,n={},r=Array(e.length),i=Array(t.length);this._initIndexMap(e,null,r,`_oldKeyGetter`),this._initIndexMap(t,n,i,`_newKeyGetter`);for(var a=0;a1){var l=s.shift();s.length===1&&(n[o]=s[0]),this._update&&this._update(l,a)}else c===1?(n[o]=null,this._update&&this._update(s,a)):this._remove&&this._remove(a)}this._performRestAdd(i,n)},e.prototype._executeMultiple=function(){var e=this._old,t=this._new,n={},r={},i=[],a=[];this._initIndexMap(e,n,i,`_oldKeyGetter`),this._initIndexMap(t,r,a,`_newKeyGetter`);for(var o=0;o1&&d===1)this._updateManyToOne&&this._updateManyToOne(l,c),r[s]=null;else if(u===1&&d>1)this._updateOneToMany&&this._updateOneToMany(l,c),r[s]=null;else if(u===1&&d===1)this._update&&this._update(l,c),r[s]=null;else if(u>1&&d>1)this._updateManyToMany&&this._updateManyToMany(l,c),r[s]=null;else if(u>1)for(var f=0;f1)for(var o=0;oi&&(i+=uN);var p=Math.atan2(s,o);if(p<0&&(p+=uN),p>=r&&p<=i||p+uN>=r&&p+uN<=i)return c[0]=u,c[1]=d,l-n;var m=n*Math.cos(r)+e,h=n*Math.sin(r)+t,g=n*Math.cos(i)+e,_=n*Math.sin(i)+t,v=(m-o)*(m-o)+(h-s)*(h-s),y=(g-o)*(g-o)+(_-s)*(_-s);return v0){t=t/180*Math.PI,hN.fromArray(e[0]),gN.fromArray(e[1]),_N.fromArray(e[2]),hC.sub(vN,hN,gN),hC.sub(yN,_N,gN);var n=vN.len(),r=yN.len();if(!(n<.001||r<.001)){vN.scale(1/n),yN.scale(1/r);var i=vN.dot(yN);if(Math.cos(t)1&&hC.copy(SN,_N),SN.toArray(e[1])}}}}function CN(e,t,n,r){var i=n===`normal`,a=i?e:e.ensureState(n);a.ignore=t;var o=r.get(`smooth`);o=o===!0?.3:Math.max(+o,0)||0,a.shape=a.shape||{},a.shape.smooth=o;var s=r.getModel(`lineStyle`).getLineStyle();i?e.useStyle(s):a.style=s}function Nce(e,t){var n=t.smooth,r=t.points;if(r){if(e.moveTo(r[0][0],r[0][1]),n>0&&r.length>=3){var i=lC(r[0],r[1]),a=lC(r[1],r[2]);if(!i||!a){e.lineTo(r[1][0],r[1][1]),e.lineTo(r[2][0],r[2][1]);return}var o=Math.min(i,a)*n,s=dC([],r[1],r[0],o/i),c=dC([],r[1],r[2],o/a),l=dC([],s,c,.5);e.bezierCurveTo(s[0],s[1],s[0],s[1],l[0],l[1]),e.bezierCurveTo(c[0],c[1],c[0],c[1],r[2][0],r[2][1])}else for(var u=1;u0&&i&&S(-d/a,0,a);var g=e[0],_=e[a-1],v,y;b(),v<0&&C(-v,.8),y<0&&C(y,.8),b(),x(v,y,1),x(y,v,-1),b(),v<0&&w(-v),y<0&&w(y);function b(){v=g.rect[o]-n,y=r-_.rect[o]-_.rect[s]}function x(e,t,n){if(e<0){var r=Math.min(t,-e);if(r>0){S(r*n,0,a);var i=r+e;i<0&&C(-i*n,1)}else C(-e*n,1)}}function S(t,n,r){t!==0&&(u=!0);for(var i=n;i0)for(var c=0;c0;c--){var f=r[c-1]*d;S(-f,c,a)}}}function w(e){var t=e<0?-1:1;e=Math.abs(e);for(var n=Math.ceil(e/(a-1)),r=0;r0?S(n,0,r+1):S(-n,a-r-1,a),e-=n,e<=0)return}return u}function Bce(e){for(var t=0;t=0&&n.attr(i.oldLayoutSelect),_b(u,`emphasis`)>=0&&n.attr(i.oldLayoutEmphasis)),bk(n,c,t,s)}else if(n.attr(c),!yA(n).valueAnimation){var d=Rb(n.style.opacity,1);n.style.opacity=0,xk(n,{style:{opacity:d}},t,s)}if(i.oldLayout=c,n.states.select){var f=i.oldLayoutSelect={};BN(f,c,VN),BN(f,n.states.select,VN)}if(n.states.emphasis){var p=i.oldLayoutEmphasis={};BN(p,c,VN),BN(p,n.states.emphasis,VN)}Joe(n,s,l,t,t)}if(r&&!r.ignore&&!r.invisible){var i=zN(r),a=i.oldLayout,m={points:r.shape.points};a?(r.attr({shape:a}),bk(r,{shape:m},t)):(r.setShape(m),r.style.strokePercent=0,xk(r,{style:{strokePercent:1}},t)),i.oldLayout=m}},e}(),UN=dS();function WN(e){e.registerUpdateLifecycle(`series:beforeupdate`,function(e,t,n){var r=UN(t).labelManager;r||=UN(t).labelManager=new HN,r.clearLabels()}),e.registerUpdateLifecycle(`series:layoutlabels`,function(e,t,n){var r=UN(t).labelManager;W(n.updatedSeries,function(e){r.addLabelsOfSeries(t.getViewOfSeriesModel(e))}),r.updateLayoutConfig(t),r.layout(t),r.processLabelsOverall()})}var GN=wb({needTransform:1,normalize:1,scale:1,transformIn:1,transformOut:1,contain:1,getExtent:1,getExtentUnsafe:1,setExtent:1,setExtent2:1,getFilter:1,sanitize:1,getDefaultStartValue:1,freeze:1});function KN(e,t,n){var r;e||={};var i=HA();if(i){var a=i.createBreakScaleMapper(t,n);a.hasBreaks()&&(W(GN,function(t){a[t]&&(e[t]=Tb(a[t],a))}),r=a)}return r??$N(e,n),{brk:r,mapper:e}}function qN(e,t){W(GN,function(n){e[n]=t[n]})}function JN(e,t){e.freeze=Qb}function YN(e){return e.getExtentUnsafe(0,2)}function XN(e,t){return e.getExtentUnsafe(1,t)||e.getExtentUnsafe(0,t)}function ZN(e){var t=XN(e,3);return t[1]-t[0]}function QN(e){var t=e.getExtentUnsafe(0,3);return t[1]-t[0]}function $N(e,t){var n=e||{},r=[];return n._extents=r,r[0]=t?t.slice():CS(),U(n,eP),n}var eP={needTransform:function(){return!1},normalize:function(e){var t=this._extents[1]||this._extents[0];return t[1]===t[0]?.5:(e-t[0])/(t[1]-t[0])},scale:function(e){var t=this._extents[1]||this._extents[0];return e*(t[1]-t[0])+t[0]},transformIn:function(e){return e},transformOut:function(e){return e},contain:function(e){var t=XN(this,null);return e>=t[0]&&e<=t[1]},getExtent:function(){return this._extents[0].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){tP(this._extents,0,e,t)},setExtent2:function(e,t,n){var r=this._extents;r[e]||(r[e]=r[0].slice()),tP(r,e,t,n)},freeze:function(){}};function tP(e,t,n,r){OS(n,r)&&(e[t][0]=n,e[t][1]=r)}var nP=`expandAxisBreak`,rP=null;function iP(){return rP}var aP=function(){function e(){}return e.prototype.isBlank=function(){return this._isBlank},e.prototype.setBlank=function(e){this._isBlank=e},e}();BS(aP);var oP=0,sP=function(){function e(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++oP,this._onCollect=e.onCollect}return e.createByAxisModel=function(t){var n=t.option,r=n.data,i=r&&bb(r,cP);return new e({categories:i,needCollect:!i,deduplication:n.dedplication!==!1})},e.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},e.prototype.parseAndCollect=function(e){var t,n=this._needCollect;if(!Ob(e)&&!n)return e;if(n&&!this._deduplication)return t=this.categories.length,this.categories[t]=e,this._onCollect&&this._onCollect(e,t),t;var r=this._getOrCreateMap();return t=r.get(e),t??(n?(t=this.categories.length,this.categories[t]=e,r.set(e,t),this._onCollect&&this._onCollect(e,t)):t=NaN),t},e.prototype._getOrCreateMap=function(){return this._map||=Jb(this.categories)},e}();function cP(e){return jb(e)&&e.value!=null?e.value:e+``}function lP(e){return uP(e)||fP(e)}function uP(e){return e.type===`interval`}function dP(e){return e.type===`time`}function fP(e){return e.type===`log`}function pP(e){return e.type===`ordinal`}function mP(e){var t=Tx(e),n=cx(10,t),r=ax(e/n);return r?r===2?r=3:r===3?r=5:r*=2:r=1,mx(r*n,-t)}function hP(e){return gx(e)+2}function gP(e,t){return lx(e)/lx(t)}function _P(e,t,n){var r=n&&n.lookup;if(r){for(var i=0;i1&&a/o>2&&(i=Math.round(Math.ceil(i/o)*o)),i!==r[0]&&c(r[0],!0,!0);for(var s=i;s<=r[1];s+=o)c(s,!1,s===r[0]||s===r[1]);s-o!==r[1]&&c(r[1],!0,!0);function c(e,t,r){n({value:e,offInterval:t},r)}}var SP=function(e){H(t,e);function t(n){var r=e.call(this)||this;r.type=`ordinal`,r.parse=t.parse,qN(r,t.decoratedMethods);var i=n.ordinalMeta;i||=new sP({}),G(i)&&(i=new sP({categories:bb(i,function(e){return jb(e)?e.value:e})})),r._ordinalMeta=i;var a=KN(null,null,n.extent||[0,i.categories.length-1]);return r._mapper=a.mapper,JN(r,a.mapper),r}return t.parse=function(e){return e==null?e=NaN:Ob(e)?(e=this._ordinalMeta.getOrdinal(e),e??=NaN):e=ax(e),e},t.prototype.getTicks=function(){var e=[];return xP(this,0,function(t){e.push(t)}),e},t.prototype.getMinorTicks=function(e){},t.prototype.setSortInfo=function(e){if(e==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var t=e.ordinalNumbers,n=this._ordinalNumbersByTick=[],r=this._ticksByOrdinalNumber=[],i=0,a=this._ordinalMeta.categories.length,o=nx(a,t.length);i=0&&e=0&&e=0&&eo[0]&&mi[1]||!isFinite(p)||!isFinite(i[1]))break}else{if(m>f)break;p=nx(p,i[1]),m===f&&(p=i[1])}if(l.push({value:p}),p=mx(p+n,a),s){var h=s.calcNiceTickMultiple(p,d);h>=0&&(p=mx(p+h*n,a))}if(l.length>0&&p===l[l.length-1].value)break;if(l.length>u)return[]}var g=l.length?l[l.length-1].value:i[1];return r[1]>g&&l.push({value:e.expandToNicedExtent?mx(g+n,a):r[1]}),c&&o.pruneTicksByBreak(e.pruneByBreak,l,s.breaks,function(e){return e.value},t.interval,r),c&&e.breakTicks!==`none`&&o.addBreaksToTicks(l,s.breaks,r),l},t.prototype.getMinorTicks=function(e){return CP(this,e,WA(this),this._cfg.interval)},t.prototype.getLabel=function(e,t){if(e==null)return``;var n=t&&t.precision;return n==null?n=gx(e.value)||0:n===`auto`&&(n=this._cfg.intervalPrecision),yj(mx(e.value,n,!0))},t.type=`interval`,t}(aP);aP.registerClass(wP);var TP=function(e,t,n,r){for(;n>>1;e[i][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function AP(e){var t=30*YA;return e/=t,e>6?6:e>3?3:e>2?2:1}function jP(e){return e/=JA,e>12?12:e>6?6:e>3.5?4:e>2?2:1}function MP(e,t){return e/=t?qA:KA,e>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function NP(e){return rx(Ex(e,!0),1)}function PP(e,t,n){var r=Math.max(0,_b(ej,t)-1);return aj(new Date(e),ej[r],n).getTime()}function FP(e,t){var n=new Date(0);n[e](1);var r=n.getTime();n[e](1+t);var i=n.getTime()-r;return function(e,t){return Math.max(0,Math.round((t-e)/i))}}function IP(e,t,n,r,i,a){var o=yse,s=0;function c(e,t,n,i,o,c,l){for(var u=FP(o,e),d=t,f=new Date(d);d3e3));)if(f[o](f[i]()+e),d=f.getTime(),a){var p=a.calcNiceTickMultiple(d,u);p>0&&(f[o](f[i]()+p*e),d=f.getTime())}l.push({value:d,notAdd:d>r[1]})}function l(e,i,a){var o=[],s=!i.length;if(!OP(nj(e),r[0],r[1],n)){s&&(i=[{value:PP(r[0],e,n)},{value:r[1]}]);for(var l=0;l=r[0]&&u<=r[1]&&c(f,u,d,p,m,h,o),e===`year`&&a.length>1&&l===0&&a.unshift({value:a[0].value-f})}}for(var l=0;l=r[0]&&v<=r[1]&&f++)}var y=i/t;if(f>y*1.5&&p>y/1.5||(u.push(g),f>y||e===o[m]))break}d=[]}}for(var b=Sb(bb(u,function(e){return Sb(e,function(e){return e.value>=r[0]&&e.value<=r[1]&&!e.notAdd})}),function(e){return e.length>0}),x=b.length-1,S=[],m=0;mr[0])&&S.unshift({value:r[0],time:{level:0,upperTimeUnit:O,lowerTimeUnit:O},notNice:!0}),(!D||D.values&&(a=s);var c=DP.length,l=Math.min(TP(DP,a,0,c),c-1),u=DP[l][1],d=DP[Math.max(l-1,0)][0];e.setTimeInterval({approxInterval:a,interval:u,minLevelUnit:d})};aP.registerClass(EP);var RP=0,zP=1,BP=2,VP=function(e){H(t,e);function t(n){var r=e.call(this)||this;r.type=`log`,r.parse=wP.parse,r.base=n.logBase||10;var i=[],a=[],o=r._lookup={from:i,to:a};i[RP]=i[zP]=a[RP]=a[zP]=NaN,qN(r,t.mapperMethods);var s=HA(),c=n.breakOption,l={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(c,r,{noNegative:!0},BP,l),r.powStub=new wP({breakParsed:l.original}),r.intervalStub=new wP({breakParsed:l.transformed}),JN(r,r.intervalStub),r}return t.prototype.getTicks=function(e){var t=this.base,n=this.powStub,r=HA(),i=this.intervalStub,a={lookup:{from:i.getExtent(),to:n.getExtent()}};return bb(i.getTicks(e||{}),function(e){var i=e.value,o=_P(i,t,a),s;if(r){var c=r.getTicksBreakOutwardTransform(this,e,WA(n),this._lookup);c&&(s=c.vBreak,o=c.tickVal)}return{value:o,break:s}},this)},t.prototype.getMinorTicks=function(e){return CP(this,e,WA(this.powStub),this.intervalStub.getConfig().interval)},t.prototype.getLabel=function(e,t){return this.intervalStub.getLabel(e,t)},t.type=`log`,t.mapperMethods={needTransform:function(){return!0},normalize:function(e){return this.intervalStub.normalize(gP(e,this.base))},scale:function(e){return _P(this.intervalStub.scale(e),this.base,null)},transformIn:function(e,t){return e=gP(e,this.base),t&&t.depth===2?e:this.intervalStub.transformIn(e,t)},transformOut:function(e,t){var n=t?t.depth:null;return HP.depth=n,UP.lookup=this._lookup,_P(n===2?e:this.intervalStub.transformOut(e,HP),this.base,UP)},contain:function(e){return this.powStub.contain(e)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){if(!(!OS(t,n)||t<=0||n<=0)){var r=WP,i=WP;if(e===0){var a=this._lookup;r=a.to,i=a.from}this.powStub.setExtent2(e,r[RP]=t,r[zP]=n);var o=this.base;this.intervalStub.setExtent2(e,i[RP]=gP(t,o),i[zP]=gP(n,o))}},getFilter:function(){return{g:0}},sanitize:function(e,t){return OS(t[0],t[1])&&Nx(e)&&e<=0&&(e=t[0]),e},getDefaultStartValue:function(){return 1},getExtent:function(){return this.powStub.getExtent()},getExtentUnsafe:function(e,t){return t===null?this.powStub.getExtentUnsafe(e,null):this.intervalStub.getExtentUnsafe(e,t)}},t}(aP);aP.registerClass(VP);var HP={},UP={},WP=[],GP={value:1,category:1,time:1,log:1},KP=dS(),qP={float:`f`,int:`i`,ordinal:`o`,number:`n`,time:`t`},JP=function(){function e(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return e.prototype.isDimensionOmitted=function(){return this._dimOmitted},e.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||=ZP(this.source))},e.prototype.getSourceDimensionIndex=function(e){return Rb(this._dimNameMap.get(e),-1)},e.prototype.getSourceDimension=function(e){var t=this.source.dimensionsDefine;if(t)return t[e]},e.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,t=oM(this.source),n=!QP(e),r=``,i=[],a=0,o=0;a30}function $P(e,t,n){n||={};var r=n.byIndex,i=n.stackedCoordDimension,a,o,s;eF(t)?a=t:(o=t.schema,a=o.dimensions,s=t.store);var c=!!(e&&e.get(`stack`)),l,u,d,f,p=!0;function m(e){return e.type!==`ordinal`&&e.type!==`time`}if(W(a,function(e,t){Ob(e)&&(a[t]=e={name:e}),m(e)||(p=!1)}),W(a,function(e,t){c&&!e.isExtraCoord&&(!r&&!l&&e.ordinalMeta&&(l=e),!u&&m(e)&&(!p||e.coordDim!==`x`&&e.coordDim!==`angle`)&&(!i||i===e.coordDim)&&(u=e))}),u&&!r&&!l&&(r=!0),u){d=`__\0ecstackresult_`+e.id,f=`__\0ecstackedover_`+e.id,l&&(l.createInvertedIndices=!0);var h=u.coordDim,g=u.type,_=0;W(a,function(e){e.coordDim===h&&_++});var v={name:d,coordDim:h,coordDimIndex:_,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length},y={name:f,coordDim:f,coordDimIndex:_+1,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length+1};o?(s&&(v.storeDimIndex=s.ensureCalculationDimension(f,g),y.storeDimIndex=s.ensureCalculationDimension(d,g)),o.appendCalculationDimension(v),o.appendCalculationDimension(y)):(a.push(v),a.push(y))}return{stackedDimension:u&&u.name,stackedByDimension:l&&l.name,isStackedByIndex:r,stackedOverDimension:f,stackResultDimension:d}}function eF(e){return!YP(e.schema)}function tF(e,t){return!!t&&t===e.getCalculationInfo(`stackedDimension`)}function nF(e,t){return tF(e,t)?e.getCalculationInfo(`stackResultDimension`):t}var rF=dS();function iF(e){var t=e.get(`type`);return(t==null||!Zb(GP,t)&&!aP.getClass(t))&&(t=`value`),t}function aF(e,t,n){var r=HA(),i;switch(r&&(i=gF(e,t,n)),t){case`category`:return new SP({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:CS()});case`time`:return new EP({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get(`useUTC`),breakOption:i});case`log`:return new VP({logBase:e.get(`logBase`),breakOption:i});case`value`:return new wP({breakOption:i});default:return new((aP.getClass(t))||wP)({})}}function oF(e,t,n){var r=n?XN(e,null):e.getExtentUnsafe(0,null),i=r[0],a=r[1];return OS(i,a)?i===t||a===t?2:it?1:3:3}function sF(e){rF(e).noOnMyZero=!0}function cF(e){return rF(e).noOnMyZero}function lF(e){var t=e.getLabelModel().get(`formatter`);if(e.type===`time`){var n=bse(t);return function(t,r){return e.scale.getFormattedLabel(t,r,n)}}if(Ob(t))return function(n){var r=e.scale.getLabel(n);return t.replace(`{value}`,r??``)};if(Db(t)){if(e.type===`category`)return function(n,r){return t(uF(e,n),n.value-e.scale.getExtent()[0],null)};var r=HA();return function(n,i){var a=null;return r&&(a=r.makeAxisLabelFormatterParamBreak(a,n.break)),t(uF(e,n),i,a)}}return function(t){return e.scale.getLabel(t)}}function uF(e,t){var n=e.scale;return pP(n)?n.getLabel(t):t.value}function dF(e){return e.get(`interval`)??`auto`}function fF(e){return e.type===`category`&&dF(e.getLabelModel())===0}function pF(e,t){var n={};return W(e.mapDimensionsAll(t),function(t){n[nF(e,t)]=!0}),wb(n)}function mF(e){return e===`middle`||e===`center`}function hF(e){return e.getShallow(`show`)}function gF(e,t,n){var r=e.get(`breaks`,!0);if(r!=null)return!HA()||!n||!_F(t)?void 0:r}function _F(e){return e!==`category`}function vF(e,t,n,r,i,a){var o=fP(e),s=o?e.intervalStub:e;if(s.setExtent(r[0],r[1]),o){var c=e.powStub,l={depth:2},u=e.transformOut(r[0],l),d=e.transformOut(r[1],l),f=yP(n,r);t[0]&&!f[0]&&(u=i[0]),t[1]&&!f[1]&&(d=i[1]),c.setExtent(u,d)}s.setConfig(a)}function yF(e,t){return pP(e)?e.getRawOrdinalNumber(t.value):t.value}function bF(e,t){return pP(e)&&!!t.get(`boundaryGap`)}var xF=function(){function e(e){this.type=`cartesian`,this._dimList=[],this._axes={},this.name=e||``}return e.prototype.getAxis=function(e){return this._axes[e]},e.prototype.getAxes=function(){return bb(this._dimList,function(e){return this._axes[e]},this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),Sb(this.getAxes(),function(t){return t.scale.type===e})},e.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},e}(),SF={left:0,right:0,top:0,bottom:0},CF=[`25%`,`25%`],wF=`cartesian2d`,TF=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(t,n){var r=Hj(t.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),r&&t.outerBounds&&Vj(t.outerBounds,r)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&t.outerBounds&&Vj(this.option.outerBounds,t.outerBounds)},t.type=`grid`,t.dependencies=[`xAxis`,`yAxis`],t.layoutMode=`box`,t.defaultOption={show:!1,z:0,left:`15%`,top:65,right:`10%`,bottom:80,containLabel:!1,outerBoundsMode:`auto`,outerBounds:SF,outerBoundsContain:`all`,outerBoundsClampWidth:CF[0],outerBoundsClampHeight:CF[1],backgroundColor:K.color.transparent,borderWidth:1,borderColor:K.color.neutral30},t}(Wj),EF=[`x`,`y`];function DF(e){return(e.type===`interval`||e.type===`time`)&&!GA(e)}var OF=function(e){H(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=wF,t.dimensions=EF,t}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis(`x`).scale,t=this.getAxis(`y`).scale;if(DF(e)&&DF(t)){var n=XN(e,null),r=XN(t,null),i=this.dataToPoint([n[0],r[0]]),a=this.dataToPoint([n[1],r[1]]),o=n[1]-n[0],s=r[1]-r[0];if(o&&s){var c=(a[0]-i[0])/o,l=(a[1]-i[1])/s,u=i[0]-n[0]*c,d=i[1]-r[0]*l,f=this._transform=[c,0,0,l,u,d];this._invTransform=eC([],f)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale(`ordinal`)[0]||this.getAxesByScale(`time`)[0]||this.getAxis(`x`)},t.prototype.containPoint=function(e){var t=this.getAxis(`x`),n=this.getAxis(`y`);return t.contain(t.toLocalCoord(e[0]))&&n.contain(n.toLocalCoord(e[1]))},t.prototype.containData=function(e){return this.getAxis(`x`).containData(e[0])&&this.getAxis(`y`).containData(e[1])},t.prototype.containZone=function(e,t){var n=this.dataToPoint(e),r=this.dataToPoint(t),i=this.getArea(),a=new OC(n[0],n[1],r[0]-n[0],r[1]-n[1]);return i.intersect(a)},t.prototype.dataToPoint=function(e,t,n){n||=[];var r=e[0],i=e[1];if(this._transform&&r!=null&&isFinite(r)&&i!=null&&isFinite(i))return fC(n,e,this._transform);var a=this.getAxis(`x`),o=this.getAxis(`y`);return n[0]=a.toGlobalCoord(a.dataToCoord(r,t)),n[1]=o.toGlobalCoord(o.dataToCoord(i,t)),n},t.prototype.clampData=function(e,t){var n=this.getAxis(`x`).scale,r=this.getAxis(`y`).scale,i=n.getExtent(),a=r.getExtent(),o=n.parse(e[0]),s=r.parse(e[1]);return t||=[],t[0]=Math.min(Math.max(Math.min(i[0],i[1]),o),Math.max(i[0],i[1])),t[1]=Math.min(Math.max(Math.min(a[0],a[1]),s),Math.max(a[0],a[1])),t},t.prototype.pointToData=function(e,t,n){if(n||=[],this._invTransform)return fC(n,e,this._invTransform);var r=this.getAxis(`x`),i=this.getAxis(`y`);return n[0]=r.coordToData(r.toLocalCoord(e[0]),t),n[1]=i.coordToData(i.toLocalCoord(e[1]),t),n},t.prototype.getOtherAxis=function(e){return this.getAxis(e.dim===`x`?`y`:`x`)},t.prototype.getArea=function(e){e||=0;var t=this.getAxis(`x`).getGlobalExtent(),n=this.getAxis(`y`).getGlobalExtent(),r=Math.min(t[0],t[1])-e,i=Math.min(n[0],n[1])-e;return new OC(r,i,Math.max(t[0],t[1])-r+e,Math.max(n[0],n[1])-i+e)},t}(xF),kF=dS(),AF=dS(),jF={estimate:1,determine:2};function MF(e){return{out:{noPxChangeTryDetermine:[]},kind:e}}function NF(e,t){var n=e.getLabelModel().get(`customValues`);if(n){var r=e.scale;return{labels:bb(PF(n,r),function(t,n){return{formattedLabel:lF(e)(t,n),rawLabel:r.getLabel(t),tick:t}})}}return e.type===`category`?Wce(e,t):Kce(e)}function Uce(e,t,n){var r=e.scale,i=e.getTickModel().get(`customValues`);return i?{ticks:PF(i,r)}:e.type===`category`?Gce(e,t):{ticks:r.getTicks(n)}}function PF(e,t){var n=t.getExtent(),r=[];return W(e,function(e){e=t.parse(e),e>=n[0]&&e<=n[1]&&r.push(e)}),jS(r,xie,null),hx(r),bb(r,function(e){return{value:e}})}function Wce(e,t){var n=e.getLabelModel(),r=FF(e,n,t);return!n.get(`show`)||e.scale.isBlank()?{labels:[]}:r}function FF(e,t,n){var r=Jce(e),i=dF(t),a=n.kind===jF.estimate;if(!a){var o=LF(r,i);if(o)return o}var s,c;Db(i)?s=BF(e,i,!1):(c=i===`auto`?Yce(e,n):i,s=BF(e,c,!1));var l={labels:s,labelCategoryInterval:c};return a?n.out.noPxChangeTryDetermine.push(function(){return RF(r,i,l),!0}):RF(r,i,l),l}function Gce(e,t){var n=qce(e),r=dF(t),i=LF(n,r);if(i)return i;var a,o;if((!t.get(`show`)||e.scale.isBlank())&&(a=[]),Db(r))a=BF(e,r,!0);else if(r===`auto`){var s=FF(e,e.getLabelModel(),MF(jF.determine));o=s.labelCategoryInterval,a=bb(s.labels,function(e){return e.tick})}else o=r,a=BF(e,o,!0);return RF(n,r,{ticks:a,tickCategoryInterval:o})}function Kce(e){var t=e.scale.getTicks(),n=lF(e);return{labels:bb(t,function(t,r){return{formattedLabel:n(t,r),rawLabel:e.scale.getLabel(t),tick:t}})}}var qce=IF(`axisTick`),Jce=IF(`axisLabel`);function IF(e){return function(t){return AF(t)[e]||(AF(t)[e]={list:[]})}}function LF(e,t){for(var n=0;nu&&(l=Math.max(1,Math.floor(c/u)));for(var d=s[0],f=e.dataToCoord(d+1)-e.dataToCoord(d),p=Math.abs(f*Math.cos(a)),m=Math.abs(f*Math.sin(a)),h=0,g=0;d<=s[1];d+=l){var _=0,v=0,y=UC(i({value:d}),r.font,`center`,`top`);_=y.width*1.3,v=y.height*1.3,h=Math.max(h,_,7),g=Math.max(g,v,7)}var b=h/p,x=g/m;isNaN(b)&&(b=1/0),isNaN(x)&&(x=1/0);var S=Math.max(0,Math.floor(Math.min(b,x)));return n===jF.estimate?(t.out.noPxChangeTryDetermine.push(Tb(Zce,null,e,S,c)),S):zF(e,S,c)??S}function Zce(e,t,n){return zF(e,t,n)==null}function zF(e,t,n){var r=kF(e.model),i=e.getExtent(),a=r.lastAutoInterval,o=r.lastTickCount;if(a!=null&&o!=null&&Math.abs(a-t)<=1&&Math.abs(o-n)<=1&&a>t&&r.axisExtent0===i[0]&&r.axisExtent1===i[1])return a;r.lastTickCount=n,r.lastAutoInterval=t,r.axisExtent0=i[0],r.axisExtent1=i[1]}function Qce(e){var t=e.getLabelModel();return{axisRotate:e.getRotate?e.getRotate():e.isHorizontal&&!e.isHorizontal()?90:0,labelRotate:t.get(`rotate`)||0,font:t.getFont()}}function BF(e,t,n){var r=lF(e),i=e.scale,a=[],o=Db(t);return xP(i,o?0:t,function(e,s){var c=i.getLabel(e);if(o){var l=!!t(e.value,c);if(e.offInterval=!l,!l&&!s)return}a.push(n?e:{formattedLabel:r(e),rawLabel:c,tick:e})}),a}var VF=dS();function $ce(e){VF(e).prepare={}}function ele(e){VF(e).fullUpdate={}}function HF(e){return VF(e).prepare}function UF(e){return VF(e).fullUpdate}var tle=AS(),WF=dS(),nle=dS();function GF(e,t){var n=e.model,r=WF(UF(n.ecModel)).keyed,i=r&&r.get(t);return i&&i.get(n.uid)}function rle(e,t){return qF(GF(e,t))}function ile(e,t){var n=[];return KF(e.model.ecModel,function(e){for(var r=0;r0?(t>o&&(o=t),a=!1):t===-2&&(a=!0))}),Nx(n)&&n>0&&Nx(o)?(e.w=r/n*o,e.w2=o):a&&(e.w=r*ule,e.w2=e.w*n/r)}var nI=[0,1],ple=function(){function e(e,t,n){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=n||[0,0]}return e.prototype.contain=function(e){var t=this._extent,n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]);return e>=n&&e<=r},e.prototype.containData=function(e){return this.scale.contain(this.scale.parse(e))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(e,t){var n=this._extent;n[0]=e,n[1]=t},e.prototype.dataToCoord=function(e,t){var n=this.scale;return e=n.normalize(n.parse(e)),dx(e,nI,rI(this),t)},e.prototype.coordToData=function(e,t){var n=dx(e,rI(this),nI,t);return this.scale.scale(n)},e.prototype.pointToData=function(e,t){},e.prototype.getTicksCoords=function(e){e||={};var t=e.tickModel||this.getTickModel(),n=bb(Uce(this,t,{breakTicks:e.breakTicks,pruneByBreak:e.pruneByBreak}).ticks,function(e){return{coord:this.dataToCoord(yF(this.scale,e)),tick:e}},this),r=t.get(`alignWithLabel`),i=mle(this,n,r);return bb(n,function(e){return{coord:e.coord,tickValue:e.tick.value,onBand:i}})},e.prototype.getMinorTicksCoords=function(){if(pP(this.scale))return[];var e=this.model.getModel(`minorTick`).get(`splitNumber`);return e>0&&e<100||(e=5),bb(this.scale.getMinorTicks(e),function(e){return bb(e,function(e){return{coord:this.dataToCoord(e),tickValue:e}},this)},this)},e.prototype.getViewLabels=function(e){return e||=MF(jF.determine),NF(this,e).labels},e.prototype.getLabelModel=function(){return this.model.getModel(`axisLabel`)},e.prototype.getTickModel=function(){return this.model.getModel(`axisTick`)},e.prototype.getBandWidth=function(){return tI(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(e){return e||=MF(jF.determine),Xce(this,e)},e}();function rI(e){var t=e.getExtent();if(e.onBand){var n=(t[1]-t[0])/e.scale.count()/2;t[0]+=n,t[1]-=n}return t}function mle(e,t,n){var r=t.length;if(!e.onBand||n||!r)return!1;var i=tI(e).w;if(!i)return!1;W(t,function(e){e.coord-=i/2});var a=e.scale.getExtent(),o=t[r-1];return o.tick.offInterval&&t.pop(),t.push({coord:o.coord+i,tick:{value:a[1]+1}}),!0}var hle=function(e){H(t,e);function t(t,n,r,i,a){var o=e.call(this,t,n,r)||this;return o.index=0,o.type=i||`value`,o.position=a||`bottom`,o}return t.prototype.isHorizontal=function(){var e=this.position;return e===`top`||e===`bottom`},t.prototype.getGlobalExtent=function(e){var t=this.getExtent();return t[0]=this.toGlobalCoord(t[0]),t[1]=this.toGlobalCoord(t[1]),e&&t[0]>t[1]&&t.reverse(),t},t.prototype.pointToData=function(e,t){return this.coordToData(this.toLocalCoord(e[this.dim===`x`?0:1]),t)},t.prototype.setCategorySortInfo=function(e){if(this.type!==`category`)return!1;this.model.option.categorySortInfo=e,this.scale.setSortInfo(e)},t}(ple),gle=BE.extend({type:`triangle`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r+a),e.lineTo(n-i,r+a),e.closePath()}}),_le={line:nk,rect:eD,roundRect:eD,square:eD,circle:RO,diamond:BE.extend({type:`diamond`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r),e.lineTo(n,r+a),e.lineTo(n-i,r),e.closePath()}}),pin:BE.extend({type:`pin`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.x,r=t.y,i=t.width/5*3,a=Math.max(i,t.height),o=i/2,s=o*o/(a-o),c=r-a+o+s,l=Math.asin(s/o),u=Math.cos(l)*o,d=Math.sin(l),f=Math.cos(l),p=o*.6,m=o*.7;e.moveTo(n-u,c+s),e.arc(n,c,o,Math.PI-l,Math.PI*2+l),e.bezierCurveTo(n+u-d*p,c+s+f*p,n,r-m,n,r),e.bezierCurveTo(n,r-m,n-u+d*p,c+s+f*p,n-u,c+s),e.closePath()}}),arrow:BE.extend({type:`arrow`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.height,r=t.width,i=t.x,a=t.y,o=r/3*2;e.moveTo(i,a),e.lineTo(i+o,a+n),e.lineTo(i,a+n/4*3),e.lineTo(i-o,a+n),e.lineTo(i,a),e.closePath()}}),triangle:gle},vle={line:function(e,t,n,r,i){i.x1=e,i.y1=t+r/2,i.x2=e+n,i.y2=t+r/2},rect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r},roundRect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r,i.r=Math.min(n,r)/4},square:function(e,t,n,r,i){var a=Math.min(n,r);i.x=e,i.y=t,i.width=a,i.height=a},circle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.r=Math.min(n,r)/2},diamond:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r},pin:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},arrow:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},triangle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r}},iI={};W(_le,function(e,t){iI[t]=new e});var yle=BE.extend({type:`symbol`,shape:{symbolType:``,x:0,y:0,width:0,height:0},calculateTextPosition:function(e,t,n){var r=JC(e,t,n),i=this.shape;return i&&i.symbolType===`pin`&&t.position===`inside`&&(r.y=n.y+n.height*.4),r},buildPath:function(e,t,n){var r=t.symbolType;if(r!==`none`){var i=iI[r];i||=(r=`rect`,iI[r]),vle[r](t.x,t.y,t.width,t.height,i.shape),i.buildPath(e,i.shape,n)}}});function ble(e,t){if(this.type!==`image`){var n=this.style;this.__isEmptyBrush?(n.stroke=e,n.fill=t||K.color.neutral00,n.lineWidth=2):this.shape.symbolType===`line`?n.stroke=e:n.fill=e,this.markRedraw()}}function aI(e,t,n,r,i,a,o){var s=e.indexOf(`empty`)===0;s&&(e=e.substr(5,1).toLowerCase()+e.substr(6));var c=e.indexOf(`image://`)===0?Nk(e.slice(8),new OC(t,n,r,i),o?`center`:`cover`):e.indexOf(`path://`)===0?Mk(e.slice(7),{},new OC(t,n,r,i),o?`center`:`cover`):new yle({shape:{symbolType:e,x:t,y:n,width:r,height:i}});return c.__isEmptyBrush=s,c.setColor=ble,a&&c.setColor(a),c}function oI(e){return G(e)||(e=[+e,+e]),[e[0]||0,e[1]||0]}function sI(e,t){if(e!=null)return G(e)||(e=[e,e]),[fx(e[0],t[0])||0,fx(Rb(e[1],e[0]),t[1])||0]}var cI=Math.PI,xle=[[1,2,1,2],[5,3,5,3],[8,3,8,3]],Sle=[[0,1,0,1],[0,3,0,3],[0,3,0,3]],lI=dS(),uI=dS(),dI=function(){function e(e){this.recordMap={},this.resolveAxisNameOverlap=e}return e.prototype.ensureRecord=function(e){var t=e.axis.dim,n=e.componentIndex,r=this.recordMap,i=r[t]||(r[t]=[]);return i[n]||(i[n]={ready:{}})},e}();function Cle(e,t,n,r){var i=n.axis,a=t.ensureRecord(n),o=[],s,c=TI(e.axisName)&&mF(e.nameLocation);W(r,function(e){var t=kN(e);if(t&&!t.label.ignore){o.push(t);var n=a.transGroup;c&&(n.transform?eC(fI,n.transform):YS(fI),t.transform&&ZS(fI,fI,t.transform),OC.copy(pI,t.localRect),pI.applyTransform(fI),s?s.union(pI):OC.copy(s=new OC(0,0,0,0),pI))}});var l=Math.abs(a.dirVec.x)>.1?`x`:`y`,u=a.transGroup[l];if(o.sort(function(e,t){return Math.abs(e.label[l]-u)-Math.abs(t.label[l]-u)}),c&&s){var d=i.getExtent(),f=Math.min(d[0],d[1]),p=Math.max(d[0],d[1])-f;s.union(new OC(f,0,p,1))}a.stOccupiedRect=s,a.labelInfoList=o}var fI=JS(),pI=new OC(0,0,0,0),mI=function(e,t,n,r,i,a){if(mF(e.nameLocation)){var o=a.stOccupiedRect;o&&hI(Rce({},o,a.transGroup.transform),r,i)}else gI(a.labelInfoList,a.dirVec,r,i)};function hI(e,t,n){var r=new hC;FN(e,t,r,{direction:Math.atan2(n.y,n.x),bidirectional:!1,touchThreshold:.05})&&zce(t,r)}function gI(e,t,n,r){for(var i=hC.dot(r,t)>=0,a=0,o=e.length;a0?`top`:`bottom`,i=`center`):xx(r-cI)?(a=n>0?`bottom`:`top`,i=`center`):(a=`middle`,i=r>0&&r0?`right`:`left`:n>0?`left`:`right`),{rotation:r,textAlign:i,textVerticalAlign:a}},e.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+`Index`]=e.componentIndex,t},e.isLabelSilent=function(e){var t=e.get(`tooltip`);return e.get(`silent`)||!(e.get(`triggerEvent`)||t&&t.show)},e}(),wle=[`axisLine`,`axisTickLabelEstimate`,`axisTickLabelDetermine`,`axisName`],Tle={axisLine:function(e,t,n,r,i,a,o){var s=r.get([`axisLine`,`show`]);if(s===`auto`&&(s=!0,e.raw.axisLineAutoShow!=null&&(s=!!e.raw.axisLineAutoShow)),s){var c=r.axis.getExtent(),l=a.transform,u=[c[0],0],d=[c[1],0],f=u[0]>d[0];l&&(fC(u,u,l),fC(d,d,l));var p=U({lineCap:`round`},r.getModel([`axisLine`,`lineStyle`]).getLineStyle()),m={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:p};if(r.get([`axisLine`,`breakLine`])&&GA(r.axis.scale))iP().buildAxisBreakLine(r,i,a,m);else{var h=new nk(U({shape:{x1:u[0],y1:u[1],x2:d[0],y2:d[1]}},m));Ik(h.shape,h.style.lineWidth),h.anid=`line`,i.add(h)}var g=r.get([`axisLine`,`symbol`]);if(g!=null){var _=r.get([`axisLine`,`symbolSize`]);Ob(g)&&(g=[g,g]),(Ob(_)||Ab(_))&&(_=[_,_]);var v=sI(r.get([`axisLine`,`symbolOffset`])||0,_),y=_[0],b=_[1];W([{rotate:e.rotation+Math.PI/2,offset:v[0],r:0},{rotate:e.rotation-Math.PI/2,offset:v[1],r:Math.sqrt((u[0]-d[0])*(u[0]-d[0])+(u[1]-d[1])*(u[1]-d[1]))}],function(t,n){if(g[n]!==`none`&&g[n]!=null){var r=aI(g[n],-y/2,-b/2,y,b,p.stroke,!0),a=t.r+t.offset,o=f?d:u;r.attr({rotation:t.rotate,x:o[0]+a*Math.cos(e.rotation),y:o[1]-a*Math.sin(e.rotation),silent:!0,z2:11}),i.add(r)}})}}},axisTickLabelEstimate:function(e,t,n,r,i,a,o,s){xI(t,i,s)&&vI(e,t,n,r,i,a,o,jF.estimate)},axisTickLabelDetermine:function(e,t,n,r,i,a,o,s){xI(t,i,s)&&vI(e,t,n,r,i,a,o,jF.determine);var c=kle(e,i,a,r);Ole(e,t.labelLayoutList,c),Ale(e,i,a,r,e.tickDirection)},axisName:function(e,t,n,r,i,a,o,s){var c=n.ensureRecord(r);t.nameEl&&=(i.remove(t.nameEl),c.nameLayout=c.nameLocation=null);var l=e.axisName;if(TI(l)){var u=e.nameLocation,d=e.nameDirection,f=r.getModel(`nameTextStyle`),p=r.get(`nameGap`)||0,m=r.axis.getExtent(),h=r.axis.inverse?-1:1,g=new hC(0,0),_=new hC(0,0);u===`start`?(g.x=m[0]-h*p,_.x=-h):u===`end`?(g.x=m[1]+h*p,_.x=h):(g.x=(m[0]+m[1])/2,g.y=e.labelOffset+d*p,_.y=d);var v=JS();_.transform($S(v,v,e.rotation));var y=r.get(`nameRotate`);y!=null&&(y=y*cI/180);var b,x;mF(u)?b=_I.innerTextLayout(e.rotation,y??e.rotation,d):(b=Ele(e.rotation,u,y||0,m),x=e.raw.axisNameAvailableWidth,x!=null&&(x=Math.abs(x/Math.sin(b.rotation)),!isFinite(x)&&(x=null)));var S=f.getFont(),C=r.get(`nameTruncate`,!0)||{},w=C.ellipsis,T=Lb(e.raw.nameTruncateMaxWidth,C.maxWidth,x),E=s.nameMarginLevel||0,D=new aD({x:g.x,y:g.y,rotation:b.rotation,silent:_I.isLabelSilent(r),style:fA(f,{text:l,font:S,overflow:`truncate`,width:T,ellipsis:w,fill:f.getTextColor()||r.get([`axisLine`,`lineStyle`,`color`]),align:f.get(`align`)||b.textAlign,verticalAlign:f.get(`verticalAlign`)||b.textVerticalAlign}),z2:1});if(Xk({el:D,componentModel:r,itemName:l}),D.__fullText=l,D.anid=`name`,r.get(`triggerEvent`)){var O=_I.makeAxisEventDataBase(r);O.targetType=`axisName`,O.name=l,yD(D).eventData=O}a.add(D),D.updateTransform(),t.nameEl=D;var k=c.nameLayout=kN({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:mF(u)?xle[E]:Sle[E]});if(c.nameLocation=u,i.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&k){var A=n.ensureRecord(r);n.resolveAxisNameOverlap(e,n,r,k,_,A)}}}};function vI(e,t,n,r,i,a,o,s){SI(t)||jle(e,t,i,s,r,o);var c=t.labelLayoutList;Mle(e,r,c,a),Fle(r,e.rotation,c);var l=e.optionHideOverlap;Dle(r,c,l),l&&PN(Sb(c,function(e){return e&&!e.label.ignore})),Cle(e,n,r,c)}function Ele(e,t,n,r){var i=bx(n-e),a,o,s=r[0]>r[1],c=t===`start`&&!s||t!==`start`&&s;return xx(i-cI/2)?(o=c?`bottom`:`top`,a=`center`):xx(i-cI*1.5)?(o=c?`top`:`bottom`,a=`center`):(o=`middle`,a=icI/2?c?`left`:`right`:c?`right`:`left`),{rotation:i,textAlign:a,textVerticalAlign:o}}function Dle(e,t,n){var r=e.axis,i=e.get([`axisLabel`,`customValues`]);if(fF(r))return;function a(e,a,o){var s=kN(t[a]),c=kN(t[o]),l=r.scale;if(s&&c){if(e==null){if(!n&&i)return;var u=lI(s.label).labelInfo.tick;if(dP(l)&&u.notNice||pP(l)&&u.offInterval){yI(s.label);return}}if(e===!1||s.suggestIgnore){yI(s.label);return}if(c.suggestIgnore){yI(c.label);return}var d=.1;if(!n){var f=[0,0,0,0];s=jN({marginForce:f},s),c=jN({marginForce:f},c)}FN(s,c,null,{touchThreshold:d})&&yI(e?c.label:s.label)}}var o=e.get([`axisLabel`,`showMinLabel`]),s=e.get([`axisLabel`,`showMaxLabel`]),c=t.length;a(o,0,1),a(s,c-1,c-2)}function Ole(e,t,n){e.showMinorTicks||W(t,function(e){if(e&&e.label.ignore)for(var t=0;t0&&u[1]>0&&!d[0]&&(u[0]=0),u[0]<0&&u[1]<0&&!d[1]&&(u[1]=0));var y=!1;u[0]>u[1]&&(u.reverse(),y=!0);var b=kI(e,t.get(`startValue`,!0)),x=b!=null;!Nx(b)&&r&&(b=e.getDefaultStartValue?e.getDefaultStartValue():0),Nx(b)&&(x||!_||v)&&(bu[1]&&!d[1]&&(u[1]=b,d[1]=!0)),OI(this._i={scale:e,dataMM:l,noZoomEffMM:u,zoomMM:[],fixMM:d,zoomFixMM:[!1,!1],startValue:b,isBlank:g,incl0:v,tggAxInv:y,ctnShp:i},u)}return e.prototype.makeNoZoom=function(){return this._i.noZoomEffMM.slice()},e.prototype.makeFinal=function(){var e=this._i,t=e.zoomMM,n=e.noZoomEffMM,r=e.zoomFixMM,i=e.fixMM,a={fixMM:i,zoomFixMM:r,isBlank:e.isBlank,incl0:e.incl0,tggAxInv:e.tggAxInv,ctnShp:e.ctnShp,effMM:n.slice()},o=a.effMM;return t[0]!=null&&(o[0]=t[0],i[0]=r[0]=!0),t[1]!=null&&(o[1]=t[1],i[1]=r[1]=!0),OI(e,o),a},e.prototype.makeRenderInfo=function(){return{startValue:this._i.startValue}},e.prototype.setZoomMM=function(e,t){this._i.zoomMM[e]=t},e}();function OI(e,t){var n=e.scale,r=e.dataMM;n.sanitize&&(t[0]=n.sanitize(t[0],r),t[1]=n.sanitize(t[1],r),kS(t))}function kI(e,t){return t==null?null:Ib(t)?NaN:e.parse(t)}function Ule(e,t){var n;if(pP(e))n=[0,0];else{var r=t.get(`boundaryGap`);typeof r==`boolean`&&(r=null),n=G(r)?r:[r,r]}return[AI(n[0]),AI(n[1])]}function AI(e){return qC(typeof e==`boolean`?0:e,1)||0}function jI(e){var t=Vle(e.scale);return t.extent||=CS(),t}function Wle(e,t){jI(e).dimIdxInCoord=t.get(e.dim)}function MI(e,t){var n=e.scale,r=e.model,i=e.dim;n.rawExtentInfo||Gle(n,e,i,r,t)}function Gle(e,t,n,r,i){var a=jI(t),o=a.extent,s=!1;ale(t,function(r){if(r.boxCoordinateSystem){var i=Aj(r).coord,c=a.dimIdxInCoord;if(c>=0&&G(i)){var l=i[c];l!=null&&!G(l)&&wS(o,e.parse(l))}}else if(r.coordinateSystem){var u=r.getData();if(u){var d=e.getFilter?e.getFilter():null;W(pF(u,n),function(e){_ie(o,u.getApproximateExtent(e,d))})}r.__requireStartValue&&r.__requireStartValue(t)&&(s=!0)}});var c=Jle(e,t,r);NI(e,new DI(e,r,o,s,c),i),a.extent=null}function Kle(e,t){var n=e.scale;NI(n,new DI(n,e.model,t,!1,!1),Hle)}function NI(e,t,n){e.rawExtentInfo=t,t.from=n}function qle(e,t){PI.set(e,t)}var PI=Jb();function FI(e,t,n,r,i){e.rawExtentInfo||Kle({scale:e,model:t},i||CS());var a=e.rawExtentInfo.makeFinal(),o=a.effMM;return e.setExtent(o[0],o[1]),e.setBlank(a.isBlank),r&&a.tggAxInv&&n&&!n.get(`legacyMinMaxDontInverseAxis`)&&(r.inverse=!r.inverse),a}function Jle(e,t,n){var r=bF(e,n),i=n.get(`containShape`,!0);if(i==null&&!r&&(i=!0),!i)return!1;var a=!1;return XF(t,function(e){a=!!PI.get(e)||a}),a}function Yle(e,t,n,r){if(n.ctnShp){var i;if(XF(e,function(t){var n=PI.get(t);if(n){var a=n(e,r);a&&(i||=[0,0],TS(i,a[0]),ES(i,a[1]),sF(e))}}),i){var a=t.getExtent();if(pP(t))e.onBand||t.setExtent2(1,nx(a[0],a[0]+i[0]),rx(a[1],a[1]+i[1]));else{var o=a.slice();n.zoomFixMM[0]||(o[0]=nx(o[0],t.transformOut(t.transformIn(o[0],null)+i[0],null))),n.zoomFixMM[1]||(o[1]=rx(o[1],t.transformOut(t.transformIn(o[1],null)+i[1],null))),(o[0]a[1])&&t.setExtent2(1,o[0],o[1])}}}}function Xle(e,t){var n=e.scale,r=e.model,i=FI(n,r,r.ecModel,e,null),a=fP(n),o=fP(t)?t.intervalStub:t,s=a?n.intervalStub:n,c=n.base,l=o.getTicks(),u=o.getTicks({expandToNicedExtent:!0}),d=l.length-1,f,p,m;if(d===1)f=p=0,m=1;else if(d===2){var h=ix(l[0].value-l[1].value),g=ix(l[1].value-l[2].value);f=p=0,h===g?m=2:(m=1,h=C[1])return!0})):b[1]?(T=C[1],A(function(){if(P(),k=mx(O-E*m,D),j(),w<=C[0])return!0})):A(function(){k=mx(sx(C[0]/E)*E,D),O=mx(ox(C[1]/E)*E,D);var e=ax((O-k)/E);if(e<=m){var t=m-e,n=void 0,r=i.incl0||a;if(r&&C[0]===0)n=[0,t];else if(r&&C[1]===0)n=[t,0];else{var o=ox(t/2);n=t%2==0?[o,o]:w+T=C[1])return!0}})}vF(n,b,S,[w,T],x,{interval:E,intervalCount:m,intervalPrecision:D,niceExtent:[k,O]})}function II(e,t){var n=fP(e),r=n?e.intervalStub:e,i=t.fixMinMax||[],a=n?e.getExtent():null,o=r.getExtent(),s=vP(o,i,t.rawExtentResult);r.setExtent(s[0],s[1]),s=r.getExtent();var c=n?Qle(r,t):Zle(r,t),l=c.intervalPrecision,u=c.interval,d=t.userInterval;d!=null&&(c.interval=d,c.intervalPrecision=hP(d)),i[0]||(s[0]=mx(ox(s[0]/u)*u,l)),i[1]||(s[1]=mx(sx(s[1]/u)*u,l)),d!=null&&(c.niceExtent=s.slice()),vF(e,i,o,s,a,c)}function Zle(e,t){var n=bP(t.splitNumber,5),r=QN(e),i=t.minInterval,a=t.maxInterval,o=Ex(r/n,!0);i!=null&&oa&&(o=a);var s=hP(o),c=e.getExtent(),l=[mx(sx(c[0]/o)*o,s),mx(ox(c[1]/o)*o,s)];return{interval:o,intervalPrecision:s,niceExtent:l}}function Qle(e,t){var n=bP(t.splitNumber,10),r=e.getExtent(),i=QN(e),a=rx(Cx(i),1);n/i*a<=.5&&(a*=10);var o=hP(a),s=[mx(sx(r[0]/a)*a,o),mx(ox(r[1]/a)*a,o)];return{intervalPrecision:o,interval:a,niceExtent:s}}function LI(e){var t=e.scale,n=e.model,r=n.axis,i=n.ecModel;$le(t,n,r,i,null)}function $le(e,t,n,r,i){var a=FI(e,t,r,n,i),o=uP(e)||dP(e);eue(e,{splitNumber:t.get(`splitNumber`),fixMinMax:a.fixMM,userInterval:t.get(`interval`),minInterval:o?t.get(`minInterval`):null,maxInterval:o?t.get(`maxInterval`):null,rawExtentResult:a}),n&&r&&Yle(n,e,a,r)}function eue(e,t){tue[e.type](e,t)}var tue={interval:II,log:II,time:LP,ordinal:Qb},RI=[[3,1],[0,2]],nue=function(){function e(e,t,n){this.type=`grid`,this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=EF,this._initCartesian(e,t,n),this.model=e}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(e,t){var n=this._axesMap;W(this._axesList,function(e){MI(e,1);var t=e.scale;pP(t)&&t.setSortInfo(e.model.get(`categorySortInfo`))});function r(e){for(var t=wb(e),n=[],r=t.length-1;r>=0;r--){var i=e[+t[r]];i.__alignTo?n.push(i):LI(i)}W(n,function(e){iue(e,e.__alignTo)?LI(e):Xle(e,e.__alignTo.scale)})}r(n.x),r(n.y);var i={};W(n.x,function(e){zI(n,`y`,e,i)}),W(n.y,function(e){zI(n,`x`,e,i)}),this.resize(this.model,t)},e.prototype.resize=function(e,t,n){var r=Rj(e,t),i=this._rect=Ij(e.getBoxLayoutParams(),r.refContainer),a=this._axesMap,o=this._coordsList,s=e.get(`containLabel`);if(HI(a,i),!n){var c=oue(i,o,a,s,t),l=void 0;if(s)WI?(WI(this._axesList,i),HI(a,i)):l=GI(i.clone(),`axisLabel`,null,i,a,c,r);else{var u=sue(e,i,r),d=u.outerBoundsRect,f=u.parsedOuterBoundsContain,p=u.outerBoundsClamp;d&&(l=GI(d,f,p,i,a,c,r))}KI(i,a,jF.determine,null,l,r),W(this._coordsList,function(e){e.calcAffineTransform()})}},e.prototype.getAxis=function(e,t){var n=this._axesMap[e];if(n!=null)return n[t||0]},e.prototype.getAxes=function(){return this._axesList.slice()},e.prototype.getCartesian=function(e,t){if(e!=null&&t!=null){var n=`x`+e+`y`+t;return this._coordsMap[n]}jb(e)&&(t=e.yAxisIndex,e=e.xAxisIndex);for(var r=0,i=this._coordsList;r=0;i--){var a=e[+t[i]];lP(a.scale)&&gF(a.model,a.type,!0)==null&&(a.model.get(`alignTicks`)&&a.model.get(`interval`)==null?r.push(a):n=a)}n||=r.pop(),n&&W(r,function(e){e.__alignTo=n})}function iue(e,t){return GA(e.scale)||GA(t.scale)||t.scale.getTicks().length<2}function aue(e,t){var n=e.getExtent(),r=n[0]+n[1];e.toGlobalCoord=e.dim===`x`?function(e){return e+t}:function(e){return r-e+t},e.toLocalCoord=e.dim===`x`?function(e){return e-t}:function(e){return r-e+t}}function HI(e,t){W(e.x,function(e){return UI(e,t.x,t.width)}),W(e.y,function(e){return UI(e,t.y,t.height)})}function UI(e,t,n){var r=[0,n],i=+!!e.inverse;e.setExtent(r[i],r[1-i]),aue(e,t)}var WI;function GI(e,t,n,r,i,a,o){KI(r,i,jF.estimate,t,!1,o);var s=[0,0,0,0];l(0),l(1),u(r,0,NaN),u(r,1,NaN);var c=Cb(s,function(e){return e>0})==null;return qk(r,s,!0,!0,n),HI(i,r),c;function l(e){W(i[Ok[e]],function(t){if(hF(t.model)){var n=a.ensureRecord(t.model),r=n.labelInfoList;if(r)for(var i=0;i0&&!Ib(t)&&t>1e-4&&(e/=t),e}}function oue(e,t,n,r,i){var a=new dI(cue);return W(n,function(n){return W(n,function(n){if(hF(n.model)){var o=!r;n.axisBuilder=Rle(e,t,n.model,i,a,o)}})}),a}function KI(e,t,n,r,i,a){var o=n===jF.determine;W(t,function(t){return W(t,function(t){hF(t.model)&&(zle(t.axisBuilder,e,t.model),t.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:i}))})});var s={x:0,y:0};c(0),c(1);function c(t){s[Ok[1-t]]=e[kk[t]]<=a.refContainer[kk[t]]*.5?0:1-t==1?2:1}W(t,function(e,t){return W(e,function(e){hF(e.model)&&((r===`all`||o)&&e.axisBuilder.build({axisName:!0},{nameMarginLevel:s[t]}),o&&e.axisBuilder.build({axisLine:!0}))})})}function sue(e,t,n){var r,i=e.get(`outerBoundsMode`,!0);i===`same`?r=t.clone():(i==null||i===`auto`)&&(r=Ij(e.get(`outerBounds`,!0)||SF,n.refContainer));var a=e.get(`outerBoundsContain`,!0),o=a==null||a===`auto`||_b([`all`,`axisLabel`],a)<0?`all`:a,s=[px(Rb(e.get(`outerBoundsClampWidth`,!0),CF[0]),t.width),px(Rb(e.get(`outerBoundsClampHeight`,!0),CF[1]),t.height)];return{outerBoundsRect:r,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var cue=function(e,t,n,r,i,a){var o=n.axis.dim===`x`?`y`:`x`;mI(e,t,n,r,i,a),mF(e.nameLocation)||W(t.recordMap[o],function(e){e&&e.labelInfoList&&e.dirVec&&gI(e.labelInfoList,e.dirVec,r,i)})},qI=function(){function e(e,t){this.target=e,this.topTarget=t&&t.topTarget}return e}(),lue=function(){function e(e){this.handler=e,e.on(`mousedown`,this._dragStart,this),e.on(`mousemove`,this._drag,this),e.on(`mouseup`,this._dragEnd,this)}return e.prototype._dragStart=function(e){for(var t=e.target;t&&!t.draggable;)t=t.parent||t.__hostTarget;t&&(this._draggingTarget=t,t.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new qI(t,e),`dragstart`,e.event))},e.prototype._drag=function(e){var t=this._draggingTarget;if(t){var n=e.offsetX,r=e.offsetY,i=n-this._x,a=r-this._y;this._x=n,this._y=r,t.drift(i,a,e),this.handler.dispatchToElement(new qI(t,e),`drag`,e.event);var o=this.handler.findHover(n,r,t).target,s=this._dropTarget;this._dropTarget=o,t!==o&&(s&&o!==s&&this.handler.dispatchToElement(new qI(s,e),`dragleave`,e.event),o&&o!==s&&this.handler.dispatchToElement(new qI(o,e),`dragenter`,e.event))}},e.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new qI(t,e),`dragend`,e.event),this._dropTarget&&this.handler.dispatchToElement(new qI(this._dropTarget,e),`drop`,e.event),this._draggingTarget=null,this._dropTarget=null},e}(),uue=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,JI=[],due=$b.browser.firefox&&+$b.browser.version.split(`.`)[0]<39;function YI(e,t,n,r){return n||={},r?XI(e,t,n):due&&t.layerX!=null&&t.layerX!==t.offsetX?(n.zrX=t.layerX,n.zrY=t.layerY):t.offsetX==null?XI(e,t,n):(n.zrX=t.offsetX,n.zrY=t.offsetY),n}function XI(e,t,n){if($b.domSupported&&e.getBoundingClientRect){var r=t.clientX,i=t.clientY;if(NA(e)){var a=e.getBoundingClientRect();n.zrX=r-a.left,n.zrY=i-a.top;return}if(MA(JI,e,r,i)){n.zrX=JI[0],n.zrY=JI[1];return}}n.zrX=n.zrY=0}function ZI(e){return e||window.event}function QI(e,t,n){if(t=ZI(t),t.zrX!=null)return t;var r=t.type;if(r&&r.indexOf(`touch`)>=0){var i=r===`touchend`?t.changedTouches[0]:t.targetTouches[0];i&&YI(e,i,t,n)}else{YI(e,t,t,n);var a=fue(t);t.zrDelta=a?a/120:-(t.detail||0)/3}var o=t.button;return t.which==null&&o!==void 0&&uue.test(t.type)&&(t.which=o&1?1:o&2?3:o&4?2:0),t}function fue(e){var t=e.wheelDelta;if(t)return t;var n=e.deltaX,r=e.deltaY;if(n==null||r==null)return t;var i=Math.abs(r===0?n:r),a=r>0?-1:r<0?1:n>0?-1:1;return 3*i*a}function $I(e,t,n,r){e.addEventListener(t,n,r)}function pue(e,t,n,r){e.removeEventListener(t,n,r)}var eL=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function tL(e){return e.which===2||e.which===3}var mue=function(){function e(){this._track=[]}return e.prototype.recognize=function(e,t,n){return this._doTrack(e,t,n),this._recognize(e)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(e,t,n){var r=e.touches;if(r){for(var i={points:[],touches:[],target:t,event:e},a=0,o=r.length;a1&&r&&r.length>1){var a=nL(r)/nL(i);!isFinite(a)&&(a=1),t.pinchScale=a;var o=hue(r);return t.pinchX=o[0],t.pinchY=o[1],{type:`pinch`,target:e[0].target,event:t}}}}},iL=`silent`;function gue(e,t,n){return{type:e,event:n,target:t.target,topTarget:t.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:_ue}}function _ue(){eL(this.event)}var vue=function(e){H(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.handler=null,t}return t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(kT),aL=function(){function e(e,t){this.x=e,this.y=t}return e}(),yue=[`click`,`dblclick`,`mousewheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],oL=new OC(0,0,0,0),sL=function(e){H(t,e);function t(t,n,r,i,a){var o=e.call(this)||this;return o._hovered=new aL(0,0),o.storage=t,o.painter=n,o.painterRoot=i,o._pointerSize=a,r||=new vue,o.proxy=null,o.setHandlerProxy(r),o._draggingMgr=new lue(o),o}return t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(W(yue,function(t){e.on&&e.on(t,this[t],this)},this),e.handler=this),this.proxy=e},t.prototype.mousemove=function(e){var t=e.zrX,n=e.zrY,r=lL(this,t,n),i=this._hovered,a=i.target;a&&!a.__zr&&(i=this.findHover(i.x,i.y),a=i.target);var o=this._hovered=r?new aL(t,n):this.findHover(t,n),s=o.target,c=this.proxy;c.setCursor&&c.setCursor(s?s.cursor:`default`),a&&s!==a&&this.dispatchToElement(i,`mouseout`,e),this.dispatchToElement(o,`mousemove`,e),s&&s!==a&&this.dispatchToElement(o,`mouseover`,e)},t.prototype.mouseout=function(e){var t=e.zrEventControl;t!==`only_globalout`&&this.dispatchToElement(this._hovered,`mouseout`,e),t!==`no_globalout`&&this.trigger(`globalout`,{type:`globalout`,event:e})},t.prototype.resize=function(){this._hovered=new aL(0,0)},t.prototype.dispatch=function(e,t){var n=this[e];n&&n.call(this,t)},t.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},t.prototype.setCursorStyle=function(e){var t=this.proxy;t.setCursor&&t.setCursor(e)},t.prototype.dispatchToElement=function(e,t,n){e||={};var r=e.target;if(!(r&&r.silent)){for(var i=`on`+t,a=gue(t,e,n);r&&(r[i]&&(a.cancelBubble=!!r[i].call(r,a)),r.trigger(t,a),r=r.__hostTarget?r.__hostTarget:r.parent,!a.cancelBubble););a.cancelBubble||(this.trigger(t,a),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(e){typeof e[i]==`function`&&e[i].call(e,a),e.trigger&&e.trigger(t,a)}))}},t.prototype.findHover=function(e,t,n){var r=this.storage.getDisplayList(),i=new aL(e,t);if(cL(r,i,e,t,n),this._pointerSize&&!i.target){for(var a=[],o=this._pointerSize,s=o/2,c=new OC(e-s,t-s,o,o),l=r.length-1;l>=0;l--){var u=r[l];u!==n&&!u.ignore&&!u.ignoreCoarsePointer&&(!u.parent||!u.parent.ignoreCoarsePointer)&&(oL.copy(u.getBoundingRect()),u.transform&&oL.applyTransform(u.transform),oL.intersect(c)&&a.push(u))}if(a.length){for(var d=4,f=Math.PI/12,p=Math.PI*2,m=0;m4)return;this._downPoint=null}this.dispatchToElement(a,e,t)}});function bue(e,t,n){if(e[e.rectHover?`rectContain`:`contain`](t,n)){for(var r=e,i=void 0,a=!1;r;){if(r.ignoreClip&&(a=!0),!a){var o=r.getClipPath();if(o&&!o.contain(t,n))return!1}r.silent&&(i=!0);var s=r.__hostTarget;r=s?r.ignoreHostSilent?null:s:r.parent}return!i||iL}return!1}function cL(e,t,n,r,i){for(var a=e.length-1;a>=0;a--){var o=e[a],s=void 0;if(o!==i&&!o.ignore&&(s=bue(o,n,r))&&(!t.topTarget&&(t.topTarget=o),s!==iL)){t.target=o;break}}}function lL(e,t,n){var r=e.painter;return t<0||t>r.getWidth()||n<0||n>r.getHeight()}var uL=32,dL=7;function xue(e){for(var t=0;e>=uL;)t|=e&1,e>>=1;return e+t}function fL(e,t,n,r){var i=t+1;if(i===n)return 1;if(r(e[i++],e[t])<0){for(;i=0;)i++;return i-t}function Sue(e,t,n){for(n--;t>>1,i(a,e[c])<0?s=c:o=c+1;var l=r-o;switch(l){case 3:e[o+3]=e[o+2];case 2:e[o+2]=e[o+1];case 1:e[o+1]=e[o];break;default:for(;l>0;)e[o+l]=e[o+l-1],l--}e[o]=a}}function mL(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])>0){for(s=r-i;c0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}else{for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}for(o++;o>>1);a(e,t[n+u])>0?o=u+1:c=u}return c}function hL(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])<0){for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}else{for(s=r-i;c=0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}for(o++;o>>1);a(e,t[n+u])<0?c=u:o=u+1}return c}function Cue(e,t){var n=dL,r,i,a=0,o=[];r=[],i=[];function s(e,t){r[a]=e,i[a]=t,a+=1}function c(){for(;a>1;){var e=a-2;if(e>=1&&i[e-1]<=i[e]+i[e+1]||e>=2&&i[e-2]<=i[e]+i[e-1])i[e-1]i[e+1])break;u(e)}}function l(){for(;a>1;){var e=a-2;e>0&&i[e-1]=dL||m>=dL);if(h)break;f<0&&(f=0),f+=2}if(n=f,n<1&&(n=1),i===1){for(c=0;c=0;c--)e[p+c]=e[f+c];e[d]=o[u];return}for(var m=n;;){var h=0,g=0,_=!1;do if(t(o[u],e[l])<0){if(e[d--]=e[l--],h++,g=0,--i===0){_=!0;break}}else if(e[d--]=o[u--],g++,h=0,--s===1){_=!0;break}while((h|g)=0;c--)e[p+c]=e[f+c];if(i===0){_=!0;break}}if(e[d--]=o[u--],--s===1){_=!0;break}if(g=s-mL(e[l],o,0,s,s-1,t),g!==0){for(d-=g,u-=g,s-=g,p=d+1,f=u+1,c=0;c=dL||g>=dL);if(_)break;m<0&&(m=0),m+=2}if(n=m,n<1&&(n=1),s===1){for(d-=i,l-=i,p=d+1,f=l+1,c=i-1;c>=0;c--)e[p+c]=e[f+c];e[d]=o[u]}else if(s===0)throw Error();else for(f=d-(s-1),c=0;cs&&(c=s),pL(e,n,n+c,n+a,t),a=c}o.pushRun(n,a),o.mergeRuns(),i-=a,n+=a}while(i!==0);o.forceMergeRuns()}}var _L=!1;function vL(){_L||(_L=!0,console.warn(`z / z2 / zlevel of displayable is invalid, which may cause unexpected errors`))}function yL(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var wue=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=yL}return e.prototype.traverse=function(e,t){for(var n=0;n=0&&this._roots.splice(r,1)},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),bL=$b.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};function xL(){return new Date().getTime()}var Tue=function(e){H(t,e);function t(t){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,t||={},n.stage=t.stage||{},n}return t.prototype.addClip=function(e){e.animation&&this.removeClip(e),this._head?(this._tail.next=e,e.prev=this._tail,e.next=null,this._tail=e):this._head=this._tail=e,e.animation=this},t.prototype.addAnimator=function(e){e.animation=this;var t=e.getClip();t&&this.addClip(t)},t.prototype.removeClip=function(e){if(e.animation){var t=e.prev,n=e.next;t?t.next=n:this._head=n,n?n.prev=t:this._tail=t,e.next=e.prev=e.animation=null}},t.prototype.removeAnimator=function(e){var t=e.getClip();t&&this.removeClip(t),e.animation=null},t.prototype.update=function(e){for(var t=xL()-this._pausedTime,n=t-this._time,r=this._head;r;){var i=r.next;r.step(t,n)?(r.ondestroy(),this.removeClip(r),r=i):r=i}this._time=t,e||(this.trigger(`frame`,n),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var e=this;this._running=!0;function t(){e._running&&(bL(t),!e._paused&&e.update())}bL(t)},t.prototype.start=function(){this._running||(this._time=xL(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||=(this._pauseStart=xL(),!0)},t.prototype.resume=function(){this._paused&&=(this._pausedTime+=xL()-this._pauseStart,!1)},t.prototype.clear=function(){for(var e=this._head;e;){var t=e.next;e.prev=e.next=e.animation=null,e=t}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(e,t){t||={},this.start();var n=new OT(e,t.loop);return this.addAnimator(n),n},t}(kT),Eue=300,SL=$b.domSupported,CL=(function(){var e=[`click`,`dblclick`,`mousewheel`,`wheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],t=[`touchstart`,`touchend`,`touchmove`],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1};return{mouse:e,touch:t,pointer:bb(e,function(e){var t=e.replace(`mouse`,`pointer`);return n.hasOwnProperty(t)?t:e})}})(),wL={mouse:[`mousemove`,`mouseup`],pointer:[`pointermove`,`pointerup`]},TL=!1;function EL(e){var t=e.pointerType;return t===`pen`||t===`touch`}function Due(e){e.touching=!0,e.touchTimer!=null&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}function DL(e){e&&(e.zrByTouch=!0)}function Oue(e,t){return QI(e.dom,new kue(e,t),!0)}function OL(e,t){for(var n=t,r=!1;n&&n.nodeType!==9&&!(r=n.domBelongToZr||n!==t&&n===e.painterRoot);)n=n.parentNode;return r}var kue=function(){function e(e,t){this.stopPropagation=Qb,this.stopImmediatePropagation=Qb,this.preventDefault=Qb,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return e}(),kL={mousedown:function(e){e=QI(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger(`mousedown`,e)},mousemove:function(e){e=QI(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger(`mousemove`,e)},mouseup:function(e){e=QI(this.dom,e),this.__togglePointerCapture(!1),this.trigger(`mouseup`,e)},mouseout:function(e){e=QI(this.dom,e);var t=e.toElement||e.relatedTarget;OL(this,t)||(this.__pointerCapturing&&(e.zrEventControl=`no_globalout`),this.trigger(`mouseout`,e))},wheel:function(e){TL=!0,e=QI(this.dom,e),this.trigger(`mousewheel`,e)},mousewheel:function(e){TL||(e=QI(this.dom,e),this.trigger(`mousewheel`,e))},touchstart:function(e){e=QI(this.dom,e),DL(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,`start`),kL.mousemove.call(this,e),kL.mousedown.call(this,e)},touchmove:function(e){e=QI(this.dom,e),DL(e),this.handler.processGesture(e,`change`),kL.mousemove.call(this,e)},touchend:function(e){e=QI(this.dom,e),DL(e),this.handler.processGesture(e,`end`),kL.mouseup.call(this,e),+new Date-this.__lastTouchMoment0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||this._refresh({animUpdate:!1,refresh:!1,refreshHover:!0})},e.prototype.resize=function(e){this._disposed||(e||={},this.painter.resize(e.width,e.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},e.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},e.prototype.on=function(e,t,n){return this._disposed||this.handler.on(e,t,n),this},e.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},e.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},e.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t=0;o--)r[o]&&!aS(r[o])?a=!0:(r[o]=null,!a&&i--);r.length=i,e[n]=r}}),delete e[GL],e},t.prototype.setTheme=function(e){this._theme=new TA(e),this._resetOption(`recreate`,null)},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(e){this._payload=e},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(e,t){var n=this._componentsMap.get(e);if(n){var r=n[t||0];if(r)return r;if(t==null){for(var i=0;i=t:n===`max`?e<=t:e===t}function Jue(e,t){return e.join(`,`)===t.join(`,`)}var XL=W,ZL=jb,QL=[`areaStyle`,`lineStyle`,`nodeStyle`,`linkStyle`,`chordStyle`,`label`,`labelLine`];function $L(e){var t=e&&e.itemStyle;if(t)for(var n=0,r=QL.length;n0?e[n-1].seriesModel:null)}),ide(e))})}function ide(e){W(e,function(t,n){var r=[],i=[NaN,NaN],a=[t.stackResultDimension,t.stackedOverDimension],o=t.data,s=t.isStackedByIndex,c=t.seriesModel.get(`stackStrategy`)||`samesign`;o.modify(a,function(a,l,u){var d=o.get(t.stackedDimension,u);if(isNaN(d))return i;var f,p;s?p=o.getRawIndex(u):f=o.get(t.stackedByDimension,u);for(var m=NaN,h=n-1;h>=0;h--){var g=e[h];if(s||(p=g.data.rawIndexOf(g.stackedByDimension,f)),p>=0){var _=g.data.getByRawIndex(g.stackResultDimension,p);if(c===`all`||c===`positive`&&_>0||c===`negative`&&_<0||c===`samesign`&&d>=0&&_>0||c===`samesign`&&d<=0&&_<0){d=vx(d,_),m=_;break}}}return r[0]=d,r[1]=m,r})})}var pR=function(){function e(){this.group=new LO,this.uid=EA(`viewComponent`)}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,r){},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,r){},e.prototype.updateLayout=function(e,t,n,r){},e.prototype.updateVisual=function(e,t,n,r){},e.prototype.toggleBlurSeries=function(e,t,n){},e.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},e}();RS(pR),BS(pR);function mR(){var e=dS();return function(t){var n=e(t),r=t.pipelineContext,i=!!n.large,a=!!n.progressiveRender,o=n.large=!!(r&&r.large),s=n.progressiveRender=!!(r&&r.progressiveRender);return(i!==o||a!==s)&&`reset`}}var hR=dS(),ade=mR(),gR=function(){function e(){this.group=new LO,this.uid=EA(`viewChart`),this.renderTask=TM({plan:ode,reset:sde}),this.renderTask.context={view:this}}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,r){},e.prototype.highlight=function(e,t,n,r){var i=e.getData(r&&r.dataType);i&&vR(i,r,`emphasis`)},e.prototype.downplay=function(e,t,n,r){var i=e.getData(r&&r.dataType);i&&vR(i,r,`normal`)},e.prototype.remove=function(e,t){this.group.removeAll()},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,r){this.render(e,t,n,r)},e.prototype.updateVisual=function(e,t,n,r){this.render(e,t,n,r)},e.prototype.eachRendered=function(e){Qk(this.group,e)},e.markUpdateMethod=function(e,t){hR(e).updateMethod=t},e.protoInitialize=function(){var t=e.prototype;t.type=`chart`}(),e}();function _R(e,t,n){e&&xO(e)&&(t===`emphasis`?iO:aO)(e,n)}function vR(e,t,n){var r=uS(e,t),i=t&&t.highlightKey!=null?eoe(t.highlightKey):null;r==null?e.eachItemGraphicEl(function(e){_R(e,n,i)}):W(Ux(r),function(t){_R(e.getItemGraphicEl(t),n,i)})}RS(gR,[`dispose`]),BS(gR);function ode(e){return ade(e.model)}function sde(e){var t=e.model,n=e.ecModel,r=e.api,i=e.payload,a=t.pipelineContext.progressiveRender,o=e.view,s=i&&hR(i).updateMethod,c=a?`incrementalPrepareRender`:s&&o[s]?s:`render`;return c!==`render`&&o[c](t,n,r,i),cde[c]}var cde={incrementalPrepareRender:{progress:function(e,t){t.view.incrementalRender(e,t.model,t.ecModel,t.api,t.payload)}},render:{forceFirstProgress:!0,progress:function(e,t){t.view.render(t.model,t.ecModel,t.api,t.payload)}}},yR=`\0__throttleOriginMethod`,bR=`\0__throttleRate`,xR=`\0__throttleType`;function SR(e,t,n){var r,i=0,a=0,o=null,s,c,l,u;t||=0;function d(){a=new Date().getTime(),o=null,e.apply(c,l||[])}var f=function(){var e=[...arguments];r=new Date().getTime(),c=this,l=e;var f=u||t,p=u||n;u=null,s=r-(p?i:a)-f,clearTimeout(o),p?o=setTimeout(d,f):s>=0?d():o=setTimeout(d,-s),i=r};return f.clear=function(){o&&=(clearTimeout(o),null)},f.debounceNextCall=function(e){u=e},f}function CR(e,t,n,r){var i=e[t];if(i){var a=i[yR]||i,o=i[xR];if(i[bR]!==n||o!==r){if(n==null||!r)return e[t]=a;i=e[t]=SR(a,n,r===`debounce`),i[yR]=a,i[xR]=r,i[bR]=n}return i}}function wR(e,t){var n=e[t];n&&n[yR]&&(n.clear&&n.clear(),e[t]=n[yR])}var TR=dS(),ER={itemStyle:VS(wA,!0),lineStyle:VS(CA,!0)},lde={lineStyle:`stroke`,itemStyle:`fill`};function DR(e,t){return e.visualStyleMapper||ER[t]||(console.warn(`Unknown style type '`+t+`'.`),ER.itemStyle)}function OR(e,t){return e.visualDrawType||lde[t]||(console.warn(`Unknown style type '`+t+`'.`),`fill`)}var ude={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=e.getModel(r),a=DR(e,r)(i),o=i.getShallow(`decal`);o&&(n.setVisual(`decal`,o),o.dirty=!0);var s=OR(e,r),c=a[s],l=Db(c)?c:null,u=a.fill===`auto`||a.stroke===`auto`;if(!a[s]||l||u){var d=e.getColorFromPalette(e.name,null,t.getSeriesCount());a[s]||(a[s]=d,n.setVisual(`colorFromPalette`,!0)),a.fill=a.fill===`auto`||Db(a.fill)?d:a.fill,a.stroke=a.stroke===`auto`||Db(a.stroke)?d:a.stroke}if(n.setVisual(`style`,a),n.setVisual(`drawType`,s),!t.isSeriesFiltered(e)&&l)return n.setVisual(`colorFromPalette`,!1),{dataEach:function(t,n){var r=e.getDataParams(n),i=U({},a);i[s]=l(r),t.setItemVisual(n,`style`,i)}}}},kR=new TA,dde={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=DR(e,r),a=n.getVisual(`drawType`);return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[r]){kR.option=n[r];var o=i(kR);U(e.ensureUniqueItemVisual(t,`style`),o),kR.option.decal&&(e.setItemVisual(t,`decal`,kR.option.decal),kR.option.decal.dirty=!0),a in o&&e.setItemVisual(t,`colorFromPalette`,!1)}}:null}}}},fde={performRawSeries:!0,overallReset:function(e){var t=Jb();e.eachSeries(function(e){if(!e.isColorBySeries()){var n=e.type+`-`+e.getColorBy();TR(e).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(e){if(!e.isColorBySeries()){var t=e.getRawData(),n={},r=e.getData(),i=TR(e).scope,a=OR(e,e.visualStyleAccessPath||`itemStyle`);r.each(function(e){var t=r.getRawIndex(e);n[t]=e}),t.each(function(o){var s=n[o];if(r.getItemVisual(s,`colorFromPalette`)){var c=r.ensureUniqueItemVisual(s,`style`),l=t.getName(o)||o+``,u=t.count();c[a]=e.getColorFromPalette(l,i,u)}})}})}},AR=Math.PI;function pde(e,t){t||={},gb(t,{text:`loading`,textColor:K.color.primary,fontSize:12,fontWeight:`normal`,fontStyle:`normal`,fontFamily:`sans-serif`,maskColor:`rgba(255,255,255,0.8)`,showSpinner:!0,color:K.color.theme[0],spinnerRadius:10,lineWidth:5,zlevel:0});var n=new LO,r=new eD({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});n.add(r);var i=new aD({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),a=new eD({style:{fill:`none`},textContent:i,textConfig:{position:`right`,distance:10},zlevel:t.zlevel,z:10001});n.add(a);var o;return t.showSpinner&&(o=new ok({shape:{startAngle:-AR/2,endAngle:-AR/2+.1,r:t.spinnerRadius},style:{stroke:t.color,lineCap:`round`,lineWidth:t.lineWidth},zlevel:t.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:AR*3/2}).start(`circularInOut`),o.animateShape(!0).when(1e3,{startAngle:AR*3/2}).delay(300).start(`circularInOut`),n.add(o)),n.resize=function(){var n=i.getBoundingRect().width,s=t.showSpinner?t.spinnerRadius:0,c=(e.getWidth()-s*2-(t.showSpinner&&n?10:0)-n)/2-(t.showSpinner&&n?0:5+n/2)+(t.showSpinner?0:n/2)+(n?0:s),l=e.getHeight()/2;t.showSpinner&&o.setShape({cx:c,cy:l}),a.setShape({x:c-s,y:l-s,width:s*2,height:s*2}),r.setShape({x:0,y:0,width:e.getWidth(),height:e.getHeight()})},n.resize(),n}var jR=function(){function e(e,t,n,r){this._stageTaskMap=Jb(),this.ecInstance=e,this.api=t,n=this._dataProcessorHandlers=n.slice(),r=this._visualHandlers=r.slice(),this._allHandlers=n.concat(r)}return e.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each(function(e){var t=e.overallTask;t&&t.dirty()})},e.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var n=this._pipelineMap.get(e.__pipeline.id),r=n.context,i=!t&&n.progressiveEnabled&&(!r||r.progressiveRender)&&e.__idxInPipeline>n.blockIndex?n.step:null,a=r&&r.modDataCount;return{step:i,modBy:a==null?null:Math.ceil(a/i),modDataCount:a}}},e.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},e.prototype.updateStreamModes=function(e,t){var n=this._pipelineMap.get(e.uid);e.pipelineContext=n.context=e.__preparePipelineContext?e.__preparePipelineContext(t,n):NS(e,t,n)},e.prototype.restorePipelines=function(e,t){var n=this,r=n._pipelineMap=Jb();t.eachSeries(function(t){var i=e.painter.type===`canvas`&&t.getProgressive(),a=t.uid;r.set(a,{id:a,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),n._pipe(t,t.dataTask)})},e.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),n=this.api;W(this._allHandlers,function(r){var i=e.get(r.uid)||e.set(r.uid,{});Hb(!(r.reset&&r.overallReset),``),r.reset&&this._createSeriesStageTask(r,i,t,n),r.overallReset&&this._createOverallStageTask(r,i,t,n)},this)},e.prototype.prepareView=function(e,t,n,r){var i=e.renderTask,a=i.context;a.model=t,a.ecModel=n,a.api=r,i.__block=!e.incrementalPrepareRender,this._pipe(t,i)},e.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},e.prototype.performVisualTasks=function(e,t,n){this._performStageTasks(this._visualHandlers,e,t,n)},e.prototype._performStageTasks=function(e,t,n,r){r||={};var i=!1,a=this;W(e,function(e,s){if(!(r.visualType&&r.visualType!==e.visualType)){var c=a._stageTaskMap.get(e.uid),l=c.seriesTaskMap,u=c.overallTask;if(u){var d,f=u.agentStubMap;f.each(function(e){o(r,e)&&(e.dirty(),d=!0)}),d&&u.dirty(),a.updatePayload(u,n);var p=a.getPerformArgs(u,r.block);f.each(function(e){e.perform(p)}),u.perform(p)&&(i=!0)}else l&&l.each(function(s,c){o(r,s)&&s.dirty();var l=a.getPerformArgs(s,r.block);l.skip=!e.performRawSeries&&t.isSeriesFiltered(s.context.model),a.updatePayload(s,n),s.perform(l)&&(i=!0)})}});function o(e,t){return e.setDirty&&(!e.dirtyMap||e.dirtyMap.get(t.__pipeline.id))}this.unfinished=i||this.unfinished},e.prototype.performSeriesTasks=function(e){var t;e.eachSeries(function(e){t=e.dataTask.perform()||t}),this.unfinished=t||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each(function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)})},e.prototype.updatePayload=function(e,t){t!==`remain`&&(e.context.payload=t)},e.prototype._createSeriesStageTask=function(e,t,n,r){var i=this,a=t.seriesTaskMap,o=t.seriesTaskMap=Jb(),s=e.seriesType,c=e.getTargetSeries;e.createOnAllSeries?n.eachRawSeries(l):s?n.eachRawSeriesByType(s,l):c&&c(n,r).each(l);function l(t){var s=t.uid,c=o.set(s,a&&a.get(s)||TM({plan:vde,reset:yde,count:xde}));c.context={model:t,ecModel:n,api:r,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:i},i._pipe(t,c)}},e.prototype._createOverallStageTask=function(e,t,n,r){var i=this,a=t.overallTask=t.overallTask||TM({reset:mde});a.context={ecModel:n,api:r,overallReset:e.overallReset,scheduler:i};var o=a.agentStubMap,s=a.agentStubMap=Jb(),c=e.seriesType,l=e.getTargetSeries,u=e.dirtyOnOverallProgress,d=!1;Hb(!e.createOnAllSeries,``),c?n.eachRawSeriesByType(c,f):l?l(n,r).each(f):W(n.getSeries(),f);function f(e){var t=e.uid,n=s.set(t,o&&o.get(t)||(d=!0,TM({reset:hde,onDirty:_de})));n.context={model:e,dirtyOnOverallProgress:u},n.agent=a,n.__block=u,i._pipe(e,n)}d&&a.dirty()},e.prototype._pipe=function(e,t){var n=e.uid,r=this._pipelineMap.get(n);!r.head&&(r.head=t),r.tail&&r.tail.pipe(t),r.tail=t,t.__idxInPipeline=r.count++,t.__pipeline=r},e.wrapStageHandler=function(e,t){return Db(e)&&(e={overallReset:e,seriesType:Sde(e)}),e.uid=EA(`stageHandler`),t&&(e.visualType=t),e},e}();function mde(e){e.overallReset(e.ecModel,e.api,e.payload)}function hde(e){return e.dirtyOnOverallProgress&&gde}function gde(){this.agent.dirty(),this.getDownstream().dirty()}function _de(){this.agent&&this.agent.dirty()}function vde(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function yde(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Ux(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?bb(t,function(e,t){return MR(t)}):bde}var bde=MR(0);function MR(e){return function(t,n){var r=n.data,i=n.resetDefines[e];if(i&&i.dataEach)for(var a=t.start;a0&&u===i.length-l.length){var d=i.slice(0,u);d!==`data`&&(t.mainType=d,t[l.toLowerCase()]=e,s=!0)}}o.hasOwnProperty(i)&&(n[i]=e,s=!0),s||(r[i]=e)})}return{cptQuery:t,dataQuery:n,otherQuery:r}},e.prototype.filter=function(e,t){var n=this.eventInfo;if(!n)return!0;var r=n.targetEl,i=n.packedEvent,a=n.model,o=n.view;if(!a||!o)return!0;var s=t.cptQuery,c=t.dataQuery;return l(s,a,`mainType`)&&l(s,a,`subType`)&&l(s,a,`index`,`componentIndex`)&&l(s,a,`name`)&&l(s,a,`id`)&&l(c,i,`name`)&&l(c,i,`dataIndex`)&&l(c,i,`dataType`)&&(!o.filterForExposedEvent||o.filterForExposedEvent(e,t.otherQuery,r,i));function l(e,t,n,r){return e[n]==null||t[r||n]===e[n]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),HR=[`symbol`,`symbolSize`,`symbolRotate`,`symbolOffset`],UR=HR.concat([`symbolKeepAspect`]),wde={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData();if(e.legendIcon&&n.setVisual(`legendIcon`,e.legendIcon),!e.hasSymbolVisual)return;for(var r={},i={},a=!1,o=0;o=0&&QR(c)?c:.5,e.createRadialGradient(o,s,0,o,s,c)}function $R(e,t,n){for(var r=t.type===`radial`?Fde(e,t,n):Pde(e,t,n),i=t.colorStops,a=0;a0)?null:e===`dashed`?[4*t,2*t]:e===`dotted`?[t]:Ab(e)?[e]:G(e)?e:null}function nz(e){var t=e.style,n=t.lineDash&&t.lineWidth>0&&Lde(t.lineDash,t.lineWidth),r=t.lineDashOffset;if(n){var i=t.strokeNoScale&&e.getLineScale?e.getLineScale():1;i&&i!==1&&(n=bb(n,function(e){return e/i}),r/=i)}return[n,r]}var Rde=new DE(!0);function rz(e){var t=e.stroke;return!(t==null||t===`none`||!(e.lineWidth>0))}function iz(e){return typeof e==`string`&&e!==`none`}function az(e){var t=e.fill;return t!=null&&t!==`none`}function oz(e,t){if(t.fillOpacity!=null&&t.fillOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.fillOpacity*t.opacity,e.fill(),e.globalAlpha=n}else e.fill()}function sz(e,t){if(t.strokeOpacity!=null&&t.strokeOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.strokeOpacity*t.opacity,e.stroke(),e.globalAlpha=n}else e.stroke()}function cz(e,t,n){var r=GS(t.image,t.__image,n);if(qS(r)){var i=e.createPattern(r,t.repeat||`repeat`);if(typeof DOMMatrix==`function`&&i&&i.setTransform){var a=new DOMMatrix;a.translateSelf(t.x||0,t.y||0),a.rotateSelf(0,0,(t.rotation||0)*sie),a.scaleSelf(t.scaleX||1,t.scaleY||1),i.setTransform(a)}return i}}function zde(e,t,n,r,i){var a,o=rz(n),s=az(n),c=n.strokePercent,l=c<1,u=!t.path;(!t.silent||l)&&u&&t.createPathProxy();var d=t.path||Rde,f=t.__dirty;if(!r){var p=n.fill,m=n.stroke,h=s&&!!p.colorStops,g=o&&!!m.colorStops,_=s&&!!p.image,v=o&&!!m.image,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0;(h||g)&&(C=t.getBoundingRect()),h&&(y=f?$R(e,p,C):t.__canvasFillGradient,t.__canvasFillGradient=y),g&&(b=f?$R(e,m,C):t.__canvasStrokeGradient,t.__canvasStrokeGradient=b),_&&(x=f||!t.__canvasFillPattern?cz(e,p,t):t.__canvasFillPattern,t.__canvasFillPattern=x),v&&(S=f||!t.__canvasStrokePattern?cz(e,m,t):t.__canvasStrokePattern,t.__canvasStrokePattern=S),h?e.fillStyle=y:_&&(x?e.fillStyle=x:s=!1),g?e.strokeStyle=b:v&&(S?e.strokeStyle=S:o=!1)}var w=t.getGlobalScale();d.setScale(w[0],w[1],t.segmentIgnoreThreshold);var T,E;e.setLineDash&&n.lineDash&&(a=nz(t),T=a[0],E=a[1]);var D=!0;(u||f&4)&&(d.setDPR(e.dpr),l?d.setContext(null):(d.setContext(e),D=!1),d.reset(),t.buildPath(d,t.shape,r),d.toStatic(),t.pathUpdated()),D&&d.rebuildPath(e,l?c:1),T&&(e.setLineDash(T),e.lineDashOffset=E),r?(i.batchFill=s,i.batchStroke=o):n.strokeFirst?(o&&sz(e,n),s&&oz(e,n)):(s&&oz(e,n),o&&sz(e,n)),T&&e.setLineDash([])}function Bde(e,t,n){var r=t.__image=GS(n.image,t.__image,t,t.onload);if(r&&qS(r)){var i=n.x||0,a=n.y||0,o=t.getWidth(),s=t.getHeight(),c=r.width/r.height;if(o==null&&s!=null?o=s*c:s==null&&o!=null?s=o/c:o==null&&s==null&&(o=r.width,s=r.height),n.sWidth&&n.sHeight){var l=n.sx||0,u=n.sy||0;e.drawImage(r,l,u,n.sWidth,n.sHeight,i,a,o,s)}else if(n.sx&&n.sy){var l=n.sx,u=n.sy,d=o-l,f=s-u;e.drawImage(r,l,u,d,f,i,a,o,s)}else e.drawImage(r,i,a,o,s)}}function Vde(e,t,n){var r,i=n.text;if(i!=null&&(i+=``),i){e.font=n.font||`12px sans-serif`,e.textAlign=n.textAlign,e.textBaseline=n.textBaseline;var a=void 0,o=void 0;e.setLineDash&&n.lineDash&&(r=nz(t),a=r[0],o=r[1]),a&&(e.setLineDash(a),e.lineDashOffset=o),n.strokeFirst?(rz(n)&&e.strokeText(i,n.x,n.y),az(n)&&e.fillText(i,n.x,n.y)):(az(n)&&e.fillText(i,n.x,n.y),rz(n)&&e.strokeText(i,n.x,n.y)),a&&e.setLineDash([])}}var lz=[`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`],uz=[[`lineCap`,`butt`],[`lineJoin`,`miter`],[`miterLimit`,10]];function dz(e,t,n,r,i){var a=!1;if(!r&&(n||={},t===n))return!1;if(r||t.opacity!==n.opacity){vz(e,i),a=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?qT.opacity:o}(r||t.blend!==n.blend)&&(a||=(vz(e,i),!0),e.globalCompositeOperation=t.blend||qT.blend);for(var s=0;s0&&e.unfinished);e.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(e,t,n){if(!this[Fz]){if(this._disposed){this.id;return}var r,i,a;if(jb(t)&&(n=t.lazyUpdate,r=t.silent,i=t.replaceMerge,a=t.transition,t=t.notMerge),this[Fz]=!0,dB(this),!this._model||t){var o=new Wue(this._api),s=this._theme,c=this._model=new KL;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:i},vB);var l={seriesTransition:a,optionChanged:!0};if(n)this[Lz]={silent:r,updateParams:l},this[Fz]=!1,this.getZr().wakeUp();else{try{qz(this),Xz.update.call(this,null,l)}catch(e){throw this[Lz]=null,this[Fz]=!1,e}this._ssr||this._zr.flush(),this[Lz]=null,this[Fz]=!1,eB.call(this,r),tB.call(this,r)}}},t.prototype.setTheme=function(e,t){if(!this[Fz]){if(this._disposed){this.id;return}var n=this._model;if(n){var r=t&&t.silent,i=null;this[Lz]&&(r??=this[Lz].silent,i=this[Lz].updateParams,this[Lz]=null),this[Fz]=!0,dB(this);try{this._updateTheme(e),n.setTheme(this._theme),qz(this),Xz.update.call(this,{type:`setTheme`},i)}catch(e){throw this[Fz]=!1,e}this[Fz]=!1,eB.call(this,r),tB.call(this,r)}}},t.prototype._updateTheme=function(e){Ob(e)&&(e=bB[e]),e&&(e=mb(e),e&&fR(e,!0),this._theme=e)},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||$b.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(e){return this.renderToCanvas(e)},t.prototype.renderToCanvas=function(e){return e||={},this._zr.painter.getRenderedCanvas({backgroundColor:e.backgroundColor||this._model.get(`backgroundColor`),pixelRatio:e.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(e){return e||={},this._zr.painter.renderToString({useViewBox:e.useViewBox})},t.prototype.getSvgDataURL=function(){var e=this._zr;return W(e.storage.getDisplayList(),function(e){e.stopAnimation(null,!0)}),e.painter.toDataURL()},t.prototype.getDataURL=function(e){if(this._disposed){this.id;return}e||={};var t=e.excludeComponents,n=this._model,r=[],i=this;W(t,function(e){n.eachComponent({mainType:e},function(e){var t=i._componentsMap[e.__viewId];t.group.ignore||(r.push(t),t.group.ignore=!0)})});var a=this._zr.painter.getType()===`svg`?this.getSvgDataURL():this.renderToCanvas(e).toDataURL(`image/`+(e&&e.type||`png`));return W(r,function(e){e.group.ignore=!1}),a},t.prototype.getConnectedDataURL=function(e){if(this._disposed){this.id;return}var t=e.type===`svg`,n=this.group,r=Math.min,i=Math.max,a=1/0;if(CB[n]){var o=a,s=a,c=-a,l=-a,u=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();W(SB,function(a,d){if(a.group===n){var f=t?a.getZr().painter.getSvgDom().innerHTML:a.renderToCanvas(mb(e)),p=a.getDom().getBoundingClientRect();o=r(p.left,o),s=r(p.top,s),c=i(p.right,c),l=i(p.bottom,l),u.push({dom:f,left:p.left,top:p.top})}}),o*=d,s*=d,c*=d,l*=d;var f=c-o,p=l-s,m=nb.createCanvas(),h=IL(m,{renderer:t?`svg`:`canvas`});if(h.resize({width:f,height:p}),t){var g=``;return W(u,function(e){var t=e.left-o,n=e.top-s;g+=``+e.dom+``}),h.painter.getSvgRoot().innerHTML=g,e.connectedBackgroundColor&&h.painter.setBackgroundColor(e.connectedBackgroundColor),h.refreshImmediately(),h.painter.toDataURL()}return e.connectedBackgroundColor&&h.add(new eD({shape:{x:0,y:0,width:f,height:p},style:{fill:e.connectedBackgroundColor}})),W(u,function(e){var t=new KE({style:{x:e.left*d-o,y:e.top*d-s,image:e.dom}});h.add(t)}),h.refreshImmediately(),m.toDataURL(`image/`+(e&&e.type||`png`))}return this.getDataURL(e)},t.prototype.convertToPixel=function(e,t,n){return Zz(this,`convertToPixel`,e,t,n)},t.prototype.convertToLayout=function(e,t,n){return Zz(this,`convertToLayout`,e,t,n)},t.prototype.convertFromPixel=function(e,t,n){return Zz(this,`convertFromPixel`,e,t,n)},t.prototype.containPixel=function(e,t){if(this._disposed){this.id;return}var n=this._model,r;return W(pS(n,e),function(e,n){n.indexOf(`Models`)>=0&&W(e,function(e){var i=e.coordinateSystem;if(i&&i.containPoint)r||=!!i.containPoint(t);else if(n===`seriesModels`){var a=this._chartsMap[e.__viewId];a&&a.containPoint&&(r||=a.containPoint(t,e))}},this)},this),!!r},t.prototype.getVisual=function(e,t){var n=this._model,r=pS(n,e,{defaultMainType:`series`}),i=r.seriesModel.getData(),a=r.hasOwnProperty(`dataIndexInside`)?r.dataIndexInside:r.hasOwnProperty(`dataIndex`)?i.indexOfRawIndex(r.dataIndex):null;return a==null?GR(i,t):WR(i,a,t)},t.prototype.getViewOfComponentModel=function(e){return this._componentsMap[e.__viewId]},t.prototype.getViewOfSeriesModel=function(e){return this._chartsMap[e.__viewId]},t.prototype._initEvents=function(){var e=this;W(dfe,function(t){var n=function(n){var r=e.getModel(),i=n.target,a;if(t===`globalout`?a={}:i&&JR(i,function(e){var t=yD(e);if(t&&t.dataIndex!=null){var n=t.dataModel||r.getSeriesByIndex(t.seriesIndex);return a=n&&n.getDataParams(t.dataIndex,t.dataType,i)||{},!0}if(t.eventData)return a=U({},t.eventData),!0},!0),a){var o=a.componentType,s=a.componentIndex;(o===`markLine`||o===`markPoint`||o===`markArea`)&&(o=`series`,s=a.seriesIndex);var c=o&&s!=null&&r.getComponent(o,s),l=c&&e[c.mainType===`series`?`_chartsMap`:`_componentsMap`][c.__viewId];a.event=n,a.type=t,e._$eventProcessor.eventInfo={targetEl:i,packedEvent:a,model:c,view:l},e.trigger(t,a)}};n.zrEventfulCallAtLast=!0,e._zr.on(t,n,e)});var t=this._messageCenter;W(gB,function(n,r){t.on(r,function(t){e.trigger(r,t)})}),Ede(t,this,this._api)},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0,this.getDom()&&yS(this.getDom(),wB,``);var e=this,t=e._api,n=e._model;W(e._componentsViews,function(e){e.dispose(n,t)}),W(e._chartsViews,function(e){e.dispose(n,t)}),e._zr.dispose(),e._dom=e._model=e._chartsMap=e._componentsMap=e._chartsViews=e._componentsViews=e._scheduler=e._api=e._zr=e._throttledZrFlush=e._theme=e._coordSysMgr=e._messageCenter=null,delete SB[e.id]},t.prototype.resize=function(e){if(!this[Fz]){if(this._disposed){this.id;return}this._zr.resize(e);var t=this._model;if(this._loadingFX&&this._loadingFX.resize(),t){var n=t.resetOption(`media`),r=e&&e.silent;this[Lz]&&(r??=this[Lz].silent,n=!0,this[Lz]=null),this[Fz]=!0,dB(this);try{n&&qz(this),Xz.update.call(this,{type:`resize`,animation:U({duration:0},e&&e.animation)})}catch(e){throw this[Fz]=!1,e}this[Fz]=!1,eB.call(this,r),tB.call(this,r)}}},t.prototype.showLoading=function(e,t){if(this._disposed){this.id;return}if(jb(e)&&(t=e,e=``),e||=`default`,this.hideLoading(),xB[e]){var n=xB[e](this._api,t),r=this._zr;this._loadingFX=n,r.add(n)}},t.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},t.prototype.makeActionFromEvent=function(e){var t=U({},e);return t.type=hB[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed){this.id;return}if(jb(t)||(t={silent:!!t}),mB[e.type]&&this._model){if(this[Fz]){this._pendingActions.push(e);return}var n=t.silent;$z.call(this,e,n);var r=t.flush;r?this._zr.flush():r!==!1&&$b.browser.weChat&&this._throttledZrFlush(),eB.call(this,n),tB.call(this,n)}},t.prototype.updateLabelLayout=function(){YR.trigger(`series:layoutlabels`,this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed){this.id;return}var t=e.seriesIndex;this.getModel().getSeriesByIndex(t).appendData(e),this._scheduler.unfinished=!0,this.getZr().wakeUp()},t.internalField=function(){qz=function(e){$ce(e._model);var t=e._scheduler;t.restorePipelines(e._zr,e._model),t.prepareStageTasks(),Jz(e,!0),Jz(e,!1),t.plan()},Jz=function(e,t){for(var n=e._model,r=e._scheduler,i=t?e._componentsViews:e._chartsViews,a=t?e._componentsMap:e._chartsMap,o=e._zr,s=e._api,c=0;cRb(t.get(`hoverLayerThreshold`),BL.hoverLayerThreshold)&&!$b.node&&!$b.worker;(e._usingTHL||a)&&(t.eachSeries(function(t){if(!t.preventUsingHoverLayer){var n=e._chartsMap[t.__viewId];n.__alive&&n.eachRendered(function(e){var t=e.states.emphasis;t&&t.hoverLayer!==2&&(t.hoverLayer=+!!a)})}}),e._usingTHL=a)}}function a(e,t){var n=e.get(`blendMode`)||null;t.eachRendered(function(e){e.isGroup||(e.style.blend=n)})}function o(e,t){if(!e.preventAutoZ){var n=rA(e);t.eachRendered(function(e){return iA(e,n.z,n.zlevel),!0})}}function s(e,t){t.eachRendered(function(e){if(!Sk(e)){var t=e.getTextContent(),n=e.getTextGuideLine();e.stateTransition&&=null,t&&t.stateTransition&&(t.stateTransition=null),n&&n.stateTransition&&(n.stateTransition=null),e.hasState()?(e.prevStates=e.currentStates,e.clearStates()):e.prevStates&&=null}})}function c(e,t){var n=e.getModel(`stateAnimation`),i=e.isAnimationEnabled(),a=n.get(`duration`),o=a>0?{duration:a,delay:n.get(`delay`),easing:n.get(`easing`)}:null;t.eachRendered(function(e){if(e.states&&e.states.emphasis){if(Sk(e))return;if(e instanceof BE&&toe(e),e.__dirty){var t=e.prevStates;t&&e.useStates(t)}if(i){e.stateTransition=o;var n=e.getTextContent(),a=e.getTextGuideLine();n&&(n.stateTransition=o),a&&(a.stateTransition=o)}e.__dirty&&r(e)}})}sB=function(e){return new(function(t){H(n,t);function n(){return t!==null&&t.apply(this,arguments)||this}return n.prototype.getCoordinateSystems=function(){return e._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(t){for(;t;){var n=t.__ecComponentInfo;if(n!=null)return e._model.getComponent(n.mainType,n.index);t=t.parent}},n.prototype.enterEmphasis=function(t,n){iO(t,n),lB(e)},n.prototype.leaveEmphasis=function(t,n){aO(t,n),lB(e)},n.prototype.enterBlur=function(t){oO(t),lB(e)},n.prototype.leaveBlur=function(t){sO(t),lB(e)},n.prototype.enterSelect=function(t){cO(t),lB(e)},n.prototype.leaveSelect=function(t){lO(t),lB(e)},n.prototype.getModel=function(){return e.getModel()},n.prototype.getViewOfComponentModel=function(t){return e.getViewOfComponentModel(t)},n.prototype.getViewOfSeriesModel=function(t){return e.getViewOfSeriesModel(t)},n.prototype.getECUpdateCycleVersion=function(){return e[Iz]},n.prototype.usingTHL=function(){return e._usingTHL},n}(AD))(e)},cB=function(e){function t(e,t){for(var n=0;n=0)){jB.push(n);var o=jR.wrapStageHandler(n,i);o.__prio=t,o.__raw=n,e.push(o)}}function NB(e,t){xB[e]=t}function Sfe(e,t,n){var r=Ode(`registerMap`);r&&r(e,t,n)}var Cfe=rce;AB(jz,ude),AB(Nz,dde),AB(Nz,fde),AB(jz,wde),AB(Nz,Tde),AB(Pz,Yde),EB(fR),DB($de,nde),NB(`default`,pde),kB({type:RD,event:RD,update:RD},Qb),kB({type:zD,event:zD,update:zD},Qb),kB({type:BD,event:UD,update:BD,action:Qb,refineEvent:PB,publishNonRefinedEvent:!0}),kB({type:VD,event:UD,update:VD,action:Qb,refineEvent:PB,publishNonRefinedEvent:!0}),kB({type:HD,event:UD,update:HD,action:Qb,refineEvent:PB,publishNonRefinedEvent:!0});function PB(e,t,n,r){return{eventContent:{selected:Xae(n),isFromClick:t.isFromClick||!1}}}TB(`default`,{}),TB(`dark`,VR);var FB=[],wfe={registerPreprocessor:EB,registerProcessor:DB,registerPostInit:vfe,registerPostUpdate:yfe,registerUpdateLifecycle:OB,registerAction:kB,registerCoordinateSystem:bfe,registerLayout:xfe,registerVisual:AB,registerTransform:Cfe,registerLoading:NB,registerMap:Sfe,registerImpl:Dde,PRIORITY:cfe,ComponentModel:Wj,ComponentView:pR,SeriesModel:rN,ChartView:gR,registerComponentModel:function(e){Wj.registerClass(e)},registerComponentView:function(e){pR.registerClass(e)},registerSeriesModel:function(e){rN.registerClass(e)},registerChartView:function(e){gR.registerClass(e)},registerCustomSeries:function(e,t){kde(e,t)},registerSubTypeDefaulter:function(e,t){Wj.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){Iue(e,t)}};function IB(e){if(G(e)){W(e,function(e){IB(e)});return}_b(FB,e)>=0||(FB.push(e),Db(e)&&(e={install:e}),e.install(wfe))}var Tfe=function(){function e(e,t){this._encode=e,this._schema=t}return e.prototype.get=function(){return{fullDimensions:this._getFullDimensionNames(),encode:this._encode}},e.prototype._getFullDimensionNames=function(){return this._cachedDimNames||=this._schema?this._schema.makeOutputDimensionNames():[],this._cachedDimNames},e}();function Efe(e,t){var n={},r=n.encode={},i=Jb(),a=[],o=[],s={};W(e.dimensions,function(t){var n=e.getDimensionInfo(t),c=n.coordDim;if(c){var l=n.coordDimIndex;LB(r,c)[l]=t,n.isExtraCoord||(i.set(c,1),Ofe(n.type)&&(a[0]=t),LB(s,c)[l]=e.getDimensionIndex(n.name)),n.defaultTooltip&&o.push(t)}xD.each(function(e,t){var i=LB(r,t),a=n.otherDims[t];a!=null&&a!==!1&&(i[a]=n.name)})});var c=[],l={};i.each(function(e,t){var n=r[t];l[t]=n[0],c=c.concat(n)}),n.dataDimsOnCoord=c,n.dataDimIndicesOnCoord=bb(c,function(t){return e.getDimensionInfo(t).storeDimIndex}),n.encodeFirstDimNotExtra=l;var u=r.label;u&&u.length&&(a=u.slice());var d=r.tooltip;return d&&d.length?o=d.slice():o.length||(o=a.slice()),r.defaultedLabel=a,r.defaultedTooltip=o,n.userOutput=new Tfe(s,t),n}function LB(e,t){return e.hasOwnProperty(t)||(e[t]=[]),e[t]}function Dfe(e){return e===`category`?`ordinal`:e===`time`?`time`:`float`}function Ofe(e){return e!==`ordinal`&&e!==`time`}var RB=function(){function e(e){this.otherDims={},e!=null&&U(this,e)}return e}(),zB=jb,BB=bb,kfe=typeof Int32Array>`u`?Array:Int32Array,Afe=`e\0\0`,VB=-1,jfe=[`hasItemOption`,`_nameList`,`_idList`,`_invertedIndicesMap`,`_dimSummary`,`userOutput`,`_rawData`,`_dimValueGetter`,`_nameDimIdx`,`_idDimIdx`,`_nameRepeatCount`],Mfe=[`_approximateExtent`],HB,UB,WB,GB,KB,qB,JB,YB=function(){function e(e,t){this.type=`list`,this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=[`cloneShallow`,`downSample`,`minmaxDownSample`,`lttbDownSample`,`map`],this.CHANGABLE_METHODS=[`filterSelf`,`selectRange`],this.DOWNSAMPLE_METHODS=[`downSample`,`minmaxDownSample`,`lttbDownSample`];var n,r=!1;YP(e)?(n=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(r=!0,n=e),n||=[`x`,`y`];for(var i={},a=[],o={},s=!1,c={},l=0;l=t)){var n=this._store.getProvider();this._updateOrdinalMeta();var r=this._nameList,i=this._idList;if(n.getSource().sourceFormat===`original`&&!n.pure)for(var a=[],o=e;o0},e.prototype.ensureUniqueItemVisual=function(e,t){var n=this._itemVisuals,r=n[e];r||=n[e]={};var i=r[t];return i??(i=this.getVisual(t),G(i)?i=i.slice():zB(i)&&(i=U({},i)),r[t]=i),i},e.prototype.setItemVisual=function(e,t,n){var r=this._itemVisuals[e]||{};this._itemVisuals[e]=r,zB(t)?U(r,t):r[t]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(e,t){zB(e)?U(this._layout,e):this._layout[e]=t},e.prototype.getLayout=function(e){return this._layout[e]},e.prototype.getItemLayout=function(e){return this._itemLayouts[e]},e.prototype.setItemLayout=function(e,t,n){this._itemLayouts[e]=n?U(this._itemLayouts[e]||{},t):t},e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},e.prototype.setItemGraphicEl=function(e,t){bD(this.hostModel&&this.hostModel.seriesIndex,this.dataType,e,t),this._graphicEls[e]=t},e.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},e.prototype.eachItemGraphicEl=function(e,t){W(this._graphicEls,function(n,r){n&&e&&e.call(t,n,r)})},e.prototype.cloneShallow=function(t){return t||=new e(this._schema?this._schema:BB(this.dimensions,this._getDimInfo,this),this.hostModel),KB(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(e,t){var n=this[e];Db(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var e=n.apply(this,arguments);return t.apply(this,[e].concat(Bb(arguments)))})},e.internalField=function(){HB=function(e){var t=e._invertedIndicesMap;W(t,function(n,r){var i=e._dimInfos[r],a=i.ordinalMeta,o=e._store;if(a){n=t[r]=new kfe(a.categories.length);for(var s=0;s1&&(s+=`__ec__`+l),r[t]=s}}}(),e}();function Nfe(e,t){eM(e)||(e=nM(e)),t||={};var n=t.coordDimensions||[],r=t.dimensionsDefine||e.dimensionsDefine||[],i=Jb(),a=[],o=Pfe(e,n,r,t.dimensionsCount),s=t.canOmitUnusedDimensions&&QP(o),c=r===e.dimensionsDefine,l=c?ZP(e):XP(r),u=t.encodeDefine;!u&&t.encodeDefaulter&&(u=t.encodeDefaulter(e,o));for(var d=Jb(u),f=new MM(o),p=0;p0&&(e.name+=t-1)}),new JP({source:e,dimensions:a,fullDimensionCount:o,dimensionOmitted:s})}function Pfe(e,t,n,r){var i=Math.max(e.dimensionsDetectedCount||1,t.length,n.length,r||0);return W(t,function(e){var t;jb(e)&&(t=e.dimsDef)&&(i=Math.max(i,t.length))}),i}function Ffe(e,t,n){if(n||t.hasKey(e)){for(var r=0;t.hasKey(e+r);)r++;e+=r}return t.set(e,!0),e}var Ife=function(){function e(e){this.coordSysDims=[],this.axisMap=Jb(),this.categoryAxisMap=Jb(),this.coordSysName=e}return e}();function Lfe(e){var t=e.get(`coordinateSystem`),n=new Ife(t),r=Rfe[t];if(r)return r(e,n,n.axisMap,n.categoryAxisMap),n}var Rfe={cartesian2d:function(e,t,n,r){var i=e.getReferringComponents(`xAxis`,hS).models[0],a=e.getReferringComponents(`yAxis`,hS).models[0];t.coordSysDims=[`x`,`y`],n.set(`x`,i),n.set(`y`,a),XB(i)&&(r.set(`x`,i),t.firstCategoryDimIndex=0),XB(a)&&(r.set(`y`,a),t.firstCategoryDimIndex??=1)},singleAxis:function(e,t,n,r){var i=e.getReferringComponents(`singleAxis`,hS).models[0];t.coordSysDims=[`single`],n.set(`single`,i),XB(i)&&(r.set(`single`,i),t.firstCategoryDimIndex=0)},polar:function(e,t,n,r){var i=e.getReferringComponents(`polar`,hS).models[0],a=i.findAxisModel(`radiusAxis`),o=i.findAxisModel(`angleAxis`);t.coordSysDims=[`radius`,`angle`],n.set(`radius`,a),n.set(`angle`,o),XB(a)&&(r.set(`radius`,a),t.firstCategoryDimIndex=0),XB(o)&&(r.set(`angle`,o),t.firstCategoryDimIndex??=1)},geo:function(e,t,n,r){t.coordSysDims=[`lng`,`lat`]},parallel:function(e,t,n,r){var i=e.ecModel,a=i.getComponent(`parallel`,e.get(`parallelIndex`)),o=t.coordSysDims=a.dimensions.slice();W(a.parallelAxisIndex,function(e,a){var s=i.getComponent(`parallelAxis`,e),c=o[a];n.set(c,s),XB(s)&&(r.set(c,s),t.firstCategoryDimIndex??=a)})},matrix:function(e,t,n,r){var i=e.getReferringComponents(`matrix`,hS).models[0];t.coordSysDims=[`x`,`y`];var a=i.getDimensionModel(`x`),o=i.getDimensionModel(`y`);n.set(`x`,a),n.set(`y`,o),r.set(`x`,a),r.set(`y`,o)}};function XB(e){return e.get(`type`)===`category`}function zfe(e,t){var n=e.get(`coordinateSystem`),r=kj.get(n),i;return t&&t.coordSysDims&&(i=bb(t.coordSysDims,function(e){var n={name:e},r=t.axisMap.get(e);return r&&(n.type=Dfe(r.get(`type`))),n})),i||=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||[`x`,`y`],i}function Bfe(e,t,n){var r,i;return n&&W(e,function(e,a){var o=e.coordDim,s=n.categoryAxisMap.get(o);s&&(r??=a,e.ordinalMeta=s.getOrdinalMeta(),t&&(e.createInvertedIndices=!0)),e.otherDims.itemName!=null&&(i=!0)}),!i&&r!=null&&(e[r].otherDims.itemName=0),r}function ZB(e,t,n){n||={};var r=t.getSourceManager(),i,a=!1;e?(a=!0,i=nM(e)):(i=r.getSource(),a=i.sourceFormat===SD);var o=Lfe(t),s=zfe(t,o),c=n.useEncodeDefaulter,l=Db(c)?c:c?Eb(Rse,s,t):null,u={coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:l,canOmitUnusedDimensions:!a},d=Nfe(i,u),f=Bfe(d.dimensions,n.createInvertedIndices,o),p=a?null:r.getSharedDataStore(d),m=$P(t,{schema:d,store:p}),h=new YB(d,t);h.setCalculationInfo(m);var g=f!=null&&Vfe(i)?function(e,t,n,r){return r===f?n:this.defaultDimValueGetter(e,t,n,r)}:null;return h.hasItemOption=!1,h.initData(a?i:p,null,g),h}function Vfe(e){if(e.sourceFormat===`original`)return!G(Kx(Hfe(e.data||[])))}function Hfe(e){for(var t=0;tthis.getProgressiveThreshold()?this.id:``},t.type=`series.scatter`,t.dependencies=[`grid`,`polar`,`geo`,`singleAxis`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:K.color.primary}},universalTransition:{divideShape:`clone`}},t}(rN);function QB(e,t){var n=e.mapDimensionsAll(`defaultedLabel`),r=n.length;if(r===1){var i=SM(e,t,n[0]);return i==null?null:i+``}if(r){for(var a=[],o=0;o=0&&r.push(t[a])}return r.join(` `)}var eV=function(e){H(t,e);function t(t,n,r,i){var a=e.call(this)||this;return a.updateData(t,n,r,i),a}return t.prototype._createSymbol=function(e,t,n,r,i,a){this.removeAll();var o=aI(e,-1,-1,2,2,null,a);o.attr({z2:Rb(i,100),culling:!0,scaleX:r[0]/2,scaleY:r[1]/2}),o.drift=Wfe,this._symbolType=e,this.add(o)},t.prototype.stopSymbolAnimation=function(e){this.childAt(0).stopAnimation(null,e)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){iO(this.childAt(0))},t.prototype.downplay=function(){aO(this.childAt(0))},t.prototype.setZ=function(e,t){var n=this.childAt(0);n.zlevel=e,n.z=t},t.prototype.setDraggable=function(e,t){var n=this.childAt(0);n.draggable=e,n.cursor=!t&&e?`move`:n.cursor},t.prototype.updateData=function(e,n,r,i){this.silent=!1;var a=e.getItemVisual(n,`symbol`)||`circle`,o=e.hostModel,s=t.getSymbolSize(e,n),c=t.getSymbolZ2(e,n),l=a!==this._symbolType,u=i&&i.disableAnimation;if(l){var d=e.getItemVisual(n,`symbolKeepAspect`);this._createSymbol(a,e,n,s,c,d)}else{var f=this.childAt(0);f.silent=!1;var p={scaleX:s[0]/2,scaleY:s[1]/2};u?f.attr(p):bk(f,p,o,n),Ek(f)}if(this._updateCommon(e,n,s,r,i),l){var f=this.childAt(0);if(!u){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:f.style.opacity}};f.scaleX=f.scaleY=0,f.style.opacity=0,xk(f,p,o,n)}}u&&this.childAt(0).stopAnimation(`leave`)},t.prototype._updateCommon=function(e,t,n,r,i){var a=this.childAt(0),o=e.hostModel,s,c,l,u,d,f,p,m,h;if(r&&(s=r.emphasisItemStyle,c=r.blurItemStyle,l=r.selectItemStyle,u=r.focus,d=r.blurScope,p=r.labelStatesModels,m=r.hoverScale,h=r.cursorStyle,f=r.emphasisDisabled),!r||e.hasItemOption){var g=r&&r.itemModel?r.itemModel:e.getItemModel(t),_=g.getModel(`emphasis`);s=_.getModel(`itemStyle`).getItemStyle(),l=g.getModel([`select`,`itemStyle`]).getItemStyle(),c=g.getModel([`blur`,`itemStyle`]).getItemStyle(),u=_.get(`focus`),d=_.get(`blurScope`),f=_.get(`disabled`),p=dA(g),m=_.getShallow(`scale`),h=g.getShallow(`cursor`)}var v=e.getItemVisual(t,`symbolRotate`);a.attr(`rotation`,(v||0)*Math.PI/180||0);var y=sI(e.getItemVisual(t,`symbolOffset`),n);y&&(a.x=y[0],a.y=y[1]),h&&a.attr(`cursor`,h);var b=e.getItemVisual(t,`style`),x=b.fill;if(a instanceof KE){var S=a.style;a.useStyle(U({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else a.__isEmptyBrush?a.useStyle(U({},b)):a.useStyle(b),a.style.decal=null,a.setColor(x,i&&i.symbolInnerColor),a.style.strokeNoScale=!0;var C=e.getItemVisual(t,`liftZ`),w=this._z2;C==null?w!=null&&(a.z2=w,this._z2=null):w??(this._z2=a.z2,a.z2+=C);var T=i&&i.useNameLabel;uA(a,p,{labelFetcher:o,labelDataIndex:t,defaultText:E,inheritColor:x,defaultOpacity:b.opacity});function E(t){return T?e.getName(t):QB(e,t)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var D=a.ensureState(`emphasis`);D.style=s,a.ensureState(`select`).style=l,a.ensureState(`blur`).style=c;var O=m==null||m===!0?Math.max(1.1,3/this._sizeY):isFinite(m)&&m>0?+m:1;D.scaleX=this._sizeX*O,D.scaleY=this._sizeY*O,this.setSymbolScale(1),_O(this,u,d,f)},t.prototype.setSymbolScale=function(e){this.scaleX=this.scaleY=e},t.prototype.fadeOut=function(e,t,n){var r=this.childAt(0),i=yD(this).dataIndex,a=n&&n.animation;if(this.silent=r.silent=!0,n&&n.fadeLabel){var o=r.getTextContent();o&&Ck(o,{style:{opacity:0}},t,{dataIndex:i,removeOpt:a,cb:function(){r.removeTextContent()}})}else r.removeTextContent();Ck(r,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:i,cb:e,removeOpt:a})},t.getSymbolSize=function(e,t){return oI(e.getItemVisual(t,`symbolSize`))},t.getSymbolZ2=function(e,t){return e.getItemVisual(t,`z2`)},t}(LO);function Wfe(e,t){this.parent.drift(e,t)}function tV(e,t,n,r){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(r&&r.isIgnore&&r.isIgnore(n))&&!(r&&r.clipShape&&!r.clipShape.contain(t[0],t[1]))&&e.getItemVisual(n,`symbol`)!==`none`}function nV(e){return e!=null&&!jb(e)&&(e={isIgnore:e}),e||{}}function rV(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{emphasisItemStyle:n.getModel(`itemStyle`).getItemStyle(),blurItemStyle:t.getModel([`blur`,`itemStyle`]).getItemStyle(),selectItemStyle:t.getModel([`select`,`itemStyle`]).getItemStyle(),focus:n.get(`focus`),blurScope:n.get(`blurScope`),emphasisDisabled:n.get(`disabled`),hoverScale:n.get(`scale`),labelStatesModels:dA(t),cursorStyle:t.get(`cursor`)}}function iV(e,t,n,r,i,a,o){var s=new e(t,n,r,i);return s.setPosition(a),t.setItemGraphicEl(n,s),o.add(s),s}var aV=function(){function e(e){this.group=new LO,this._SymbolCtor=e||eV}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=nV(t);var n=this.group,r=e.hostModel,i=this._data,a=this._SymbolCtor,o=t.disableAnimation,s=this._seriesScope=rV(e),c={disableAnimation:o},l=t.getSymbolPoint||function(t){return e.getItemLayout(t)};i||n.removeAll(),e.diff(i).add(function(r){var i=l(r);tV(e,i,r,t)&&iV(a,e,r,s,c,i,n)}).update(function(u,d){var f=i.getItemGraphicEl(d),p=l(u);if(!tV(e,p,u,t)){n.remove(f);return}var m=e.getItemVisual(u,`symbol`)||`circle`,h=f&&f.getSymbolType&&f.getSymbolType();if(!f||h&&h!==m)n.remove(f),f=new a(e,u,s,c),f.setPosition(p);else{f.updateData(e,u,s,c);var g={x:p[0],y:p[1]};o?f.attr(g):bk(f,g,r)}n.add(f),e.setItemGraphicEl(u,f)}).remove(function(e){var t=i.getItemGraphicEl(e);t&&t.fadeOut(function(){n.remove(t)},r)}).execute(),this._getSymbolPoint=l,this._data=e},e.prototype.updateLayout=function(e){var t=this._data;if(t)for(var n=this,r=t.getStore(),i=0,a=r.count();i=0;s--){var c=s*2,l=r[c]-a/2,u=r[c+1]-o/2;if(e>=l&&t>=u&&e<=l+a&&t<=u+o)return s}return-1},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),r=this.getBoundingRect();return e=n[0],t=n[1],r.contain(e,t)?(this.hoverDataIdx=this.findDataIndex(e,t))>=0:(this.hoverDataIdx=-1,!1)},t.prototype.getBoundingRect=function(){var e=this._rect;if(!e){for(var t=this.shape,n=t.points,r=t.size,i=r[0],a=r[1],o=1/0,s=1/0,c=-1/0,l=-1/0,u=0;u=0&&(c.dataIndex=n+(e.startIndex||0))})},e.prototype.remove=function(){this._clear()},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),Jfe=typeof Float32Array<`u`?Float32Array:void 0,Yfe=typeof Float64Array<`u`?Float64Array:void 0;function sV(e){return cV({ctor:Jfe},e).arr}function cV(e,t){var n=e.arr,r=e.ctor;if(t>yx&&(t=yx),!n||e.typed&&n.length=0||e===t}function ope(e){var t=bV(e);if(t){var n=t.axisPointerModel,r=t.axis.scale,i=n.option,a=n.get(`status`),o=n.get(`value`);o!=null&&(o=r.parse(o));var s=xV(n);a??(i.status=s?`show`:`hide`);var c=r.getExtent();(o==null||o>c[1])&&(o=c[1]),o-1&&(s.style.stroke=s.style.fill,s.style.fill=K.color.neutral00,s.style.lineWidth=2),t},t.type=`series.line`,t.dependencies=[`grid`,`polar`],t.defaultOption={z:3,coordinateSystem:`cartesian2d`,legendHoverLink:!0,clip:!0,label:{position:`top`},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:`solid`},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:`emptyCircle`,symbolSize:6,symbolRotate:null,showSymbol:!0,showAllSymbol:`auto`,connectNulls:!1,sampling:`none`,animationEasing:`linear`,progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:`clone`},triggerLineEvent:!1,triggerEvent:!1},t}(rN);function AV(e,t,n){var r=e.getBaseAxis(),i=e.getOtherAxis(r),a=gpe(i,n),o=r.dim,s=i.dim,c=t.mapDimension(s),l=t.mapDimension(o),u=+(s===`x`||s===`radius`),d=bb(e.dimensions,function(e){return t.mapDimension(e)}),f=!1,p=t.getCalculationInfo(`stackResultDimension`);return tF(t,d[0])&&(f=!0,d[0]=p),tF(t,d[1])&&(f=!0,d[1]=p),{dataDimsForPoint:d,valueStart:a,valueAxisDim:s,baseAxisDim:o,stacked:!!f,valueDim:c,baseDim:l,baseDataOffset:u,stackedOverDimension:t.getCalculationInfo(`stackedOverDimension`)}}function gpe(e,t){var n=0,r=e.scale.getExtent();return t===`start`?n=r[0]:t===`end`?n=r[1]:Ab(t)&&!isNaN(t)?n=t:r[0]>0?n=r[0]:r[1]<0&&(n=r[1]),n}function jV(e,t,n,r){var i=NaN;e.stacked&&(i=n.get(n.getCalculationInfo(`stackedOverDimension`),r)),isNaN(i)&&(i=e.valueStart);var a=e.baseDataOffset,o=[];return o[a]=n.get(e.baseDim,r),o[1-a]=i,t.dataToPoint(o)}function MV(e,t){return!isFinite(e)||!isFinite(t)}function _pe(e,t){var n=[];return t.diff(e).add(function(e){n.push({cmd:`+`,idx:e})}).update(function(e,t){n.push({cmd:`=`,idx:t,idx1:e})}).remove(function(e){n.push({cmd:`-`,idx:e})}).execute(),n}function vpe(e,t,n,r,i,a,o,s){for(var c=_pe(e,t),l=[],u=[],d=[],f=[],p=[],m=[],h=[],g=AV(i,t,o),_=e.getLayout(`points`)||[],v=t.getLayout(`points`)||[],y=0;y=i||h<0)break;if(MV(_,v)){if(c){h+=a;continue}break}if(h===n)e[a>0?`moveTo`:`lineTo`](_,v),d=_,f=v;else{var y=_-l,b=v-u;if(y*y+b*b<.5){h+=a;continue}if(o>0){for(var x=h+a,S=t[x*2],C=t[x*2+1];S===_&&C===v&&g=r||MV(S,C))p=_,m=v;else{E=S-l,D=C-u;var A=_-l,j=S-_,M=v-u,N=C-v,P=void 0,F=void 0;if(s===`x`){P=Math.abs(A),F=Math.abs(j);var ee=E>0?1:-1;p=_-ee*P*o,m=v,O=_+ee*F*o,k=v}else if(s===`y`){P=Math.abs(M),F=Math.abs(N);var I=D>0?1:-1;p=_,m=v-I*P*o,O=_,k=v+I*F*o}else P=Math.sqrt(A*A+M*M),F=Math.sqrt(j*j+N*N),T=F/(F+P),p=_-E*o*(1-T),m=v-D*o*(1-T),O=_+E*o*T,k=v+D*o*T,O=NV(O,PV(S,_)),k=NV(k,PV(C,v)),O=PV(O,NV(S,_)),k=PV(k,NV(C,v)),E=O-_,D=k-v,p=_-E*P/F,m=v-D*P/F,p=NV(p,PV(l,_)),m=NV(m,PV(u,v)),p=PV(p,NV(l,_)),m=PV(m,NV(u,v)),E=_-p,D=v-m,O=_+E*F/P,k=v+D*F/P}e.bezierCurveTo(d,f,p,m,_,v),d=O,f=k}else e.lineTo(_,v)}l=_,u=v,h+=a}return g}var IV=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),ype=function(e){H(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polyline`,n}return t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new IV},t.prototype.buildPath=function(e,t){var n=t.points,r=0,i=n.length/2;if(t.connectNulls){for(;i>0&&MV(n[i*2-2],n[i*2-1]);i--);for(;r=0){var _=o?(d-a)*g+a:(u-i)*g+i;return o?[e,_]:[_,e]}i=u,a=d;break;case r.C:u=n[c++],d=n[c++],f=n[c++],p=n[c++],m=n[c++],h=n[c++];var v=o?Nw(i,u,f,m,e,s):Nw(a,d,p,h,e,s);if(v>0)for(var y=0;y=0){var _=o?jw(a,d,p,h,b):jw(i,u,f,m,b);return o?[e,_]:[_,e]}}i=m,a=h}}},t}(BE),bpe=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(IV),xpe=function(e){H(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polygon`,n}return t.prototype.getDefaultShape=function(){return new bpe},t.prototype.buildPath=function(e,t){var n=t.points,r=t.stackedOnPoints,i=0,a=n.length/2,o=t.smoothMonotone;if(t.connectNulls){for(;a>0&&MV(n[a*2-2],n[a*2-1]);a--);for(;i=0,a=e.fill||K.color.neutral99;UV(r,t);var o=r.textFill==null;return i?o&&(r.textFill=n.insideFill||K.color.neutral00,!r.textStroke&&n.insideStroke&&(r.textStroke=n.insideStroke),!r.textStroke&&(r.textStroke=a),r.textStrokeWidth??=2):(o&&(r.textFill=e.fill||n.outsideFill||K.color.neutral00),!r.textStroke&&n.outsideStroke&&(r.textStroke=n.outsideStroke)),r.text=t.text,r.rich=t.rich,W(t.rich,function(e){UV(e,e)}),r}function UV(e,t){t&&(Zb(t,`fill`)&&(e.textFill=t.fill),Zb(t,`stroke`)&&(e.textStroke=t.fill),Zb(t,`lineWidth`)&&(e.textStrokeWidth=t.lineWidth),Zb(t,`font`)&&(e.font=t.font),Zb(t,`fontStyle`)&&(e.fontStyle=t.fontStyle),Zb(t,`fontWeight`)&&(e.fontWeight=t.fontWeight),Zb(t,`fontSize`)&&(e.fontSize=t.fontSize),Zb(t,`fontFamily`)&&(e.fontFamily=t.fontFamily),Zb(t,`align`)&&(e.textAlign=t.align),Zb(t,`verticalAlign`)&&(e.textVerticalAlign=t.verticalAlign),Zb(t,`lineHeight`)&&(e.textLineHeight=t.lineHeight),Zb(t,`width`)&&(e.textWidth=t.width),Zb(t,`height`)&&(e.textHeight=t.height),Zb(t,`backgroundColor`)&&(e.textBackgroundColor=t.backgroundColor),Zb(t,`padding`)&&(e.textPadding=t.padding),Zb(t,`borderColor`)&&(e.textBorderColor=t.borderColor),Zb(t,`borderWidth`)&&(e.textBorderWidth=t.borderWidth),Zb(t,`borderRadius`)&&(e.textBorderRadius=t.borderRadius),Zb(t,`shadowColor`)&&(e.textBoxShadowColor=t.shadowColor),Zb(t,`shadowBlur`)&&(e.textBoxShadowBlur=t.shadowBlur),Zb(t,`shadowOffsetX`)&&(e.textBoxShadowOffsetX=t.shadowOffsetX),Zb(t,`shadowOffsetY`)&&(e.textBoxShadowOffsetY=t.shadowOffsetY),Zb(t,`textShadowColor`)&&(e.textShadowColor=t.textShadowColor),Zb(t,`textShadowBlur`)&&(e.textShadowBlur=t.textShadowBlur),Zb(t,`textShadowOffsetX`)&&(e.textShadowOffsetX=t.textShadowOffsetX),Zb(t,`textShadowOffsetY`)&&(e.textShadowOffsetY=t.textShadowOffsetY))}function WV(e,t){if(e.length===t.length){for(var n=0;nt){a?n.push(o(a,c,t)):i&&n.push(o(i,c,0),o(i,c,t));break}else i&&=(n.push(o(i,c,0)),null),n.push(c),a=c}return n}function wpe(e,t,n){var r=e.getVisual(`visualMeta`);if(r&&r.length&&e.count()&&t.type===`cartesian2d`){for(var i,a,o=r.length-1;o>=0;o--){var s=e.getDimensionInfo(r[o].dimension);if(i=s&&s.coordDim,i===`x`||i===`y`){a=r[o];break}}if(a){var c=t.getAxis(i),l=bb(a.stops,function(e){return{coord:c.toGlobalCoord(c.dataToCoord(e.value)),color:e.color}}),u=l.length,d=a.outerColors.slice();u&&l[0].coord>l[u-1].coord&&(l.reverse(),d.reverse());var f=Cpe(l,i===`x`?n.getWidth():n.getHeight()),p=f.length;if(!p&&u)return l[0].coord<0?d[1]?d[1]:l[u-1].color:d[0]?d[0]:l[0].color;var m=10,h=f[0].coord-m,g=f[p-1].coord+m,_=g-h;if(_<.001)return`transparent`;W(f,function(e){e.offset=(e.coord-h)/_}),f.push({offset:p?f[p-1].offset:.5,color:d[1]||`transparent`}),f.unshift({offset:p?f[0].offset:.5,color:d[0]||`transparent`});var v=new lk(0,0,0,0,f,!0);return v[i]=h,v[i+`2`]=g,v}}}function Tpe(e,t,n){var r=e.get(`showAllSymbol`),i=r===`auto`;if(!r||i){var a=n.getAxesByScale(`ordinal`)[0];if(a&&!(i&&Epe(a,t))){var o=t.mapDimension(a.dim),s={};return W(a.getViewLabels(),function(e){e.tick.offInterval||(s[yF(a.scale,e.tick)]=1)}),function(e){return!s.hasOwnProperty(t.get(o,e))}}}}function Epe(e,t){var n=e.getExtent(),r=Math.abs(n[1]-n[0])/e.scale.count();isNaN(r)&&(r=0);for(var i=t.count(),a=Math.max(1,Math.round(i/5)),o=0;or)return!1;return!0}function Dpe(e){for(var t=e.length/2;t>0&&MV(e[t*2-2],e[t*2-1]);t--);return t-1}function YV(e,t){return[e[t*2],e[t*2+1]]}function Ope(e,t,n){for(var r=e.length/2,i=n===`x`?0:1,a,o,s=0,c=-1,l=0;l=t||a>=t&&o<=t){c=l;break}s=l,a=o}return{range:[s,c],t:(t-a)/(o-a)}}function XV(e){if(e.get([`endLabel`,`show`]))return!0;for(var t=0;t0&&e.get([`emphasis`,`lineStyle`,`width`])===`bolder`){var M=f.getState(`emphasis`).style;M.lineWidth=+f.style.lineWidth+1}yD(f).seriesIndex=e.seriesIndex,_O(f,k,A,j);var N=qV(e.get(`smooth`)),P=e.get(`smoothMonotone`);if(f.setShape({smooth:N,smoothMonotone:P,connectNulls:x}),p){var F=a.getCalculationInfo(`stackedOnSeries`),ee=0;p.useStyle(gb(s.getAreaStyle(),{fill:E,opacity:.7,lineJoin:`bevel`,decal:a.getVisual(`style`).decal})),F&&(ee=qV(F.get(`smooth`))),p.setShape({smooth:N,stackedOnSmooth:ee,smoothMonotone:P,connectNulls:x}),yO(p,e,`areaStyle`),yD(p).seriesIndex=e.seriesIndex,_O(p,k,A,j)}var I=this._changePolyState;a.eachItemGraphicEl(function(e){e&&(e.onHoverStateChange=I)}),this._polyline.onHoverStateChange=I,this._data=a,this._coordSys=r,this._stackedOnPoints=y,this._points=c,this._step=w,this._valueOrigin=_;var te=e.get(`triggerEvent`),L=e.get(`triggerLineEvent`),ne=L===!0||te===!0||te===`line`,re=L===!0||te===!0||te===`area`;this.packEventData(e,f,ne),p&&this.packEventData(e,p,re)},t.prototype.packEventData=function(e,t,n){yD(t).eventData=n?{componentType:`series`,componentSubType:`line`,componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:`line`,selfType:t===this._polygon?`area`:`line`}:null},t.prototype.highlight=function(e,t,n,r){var i=e.getData(),a=uS(i,r);if(this._changePolyState(`emphasis`),!(a instanceof Array)&&a!=null&&a>=0){var o=i.getLayout(`points`),s=i.getItemGraphicEl(a);if(!s){var c=o[a*2],l=o[a*2+1];if(MV(c,l)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,l))return;var u=e.get(`zlevel`)||0,d=e.get(`z`)||0;s=new eV(i,a),s.x=c,s.y=l,s.setZ(u,d);var f=s.getSymbolPath().getTextContent();f&&(f.zlevel=u,f.z=d,f.z2=this._polyline.z2+1),s.__temp=!0,i.setItemGraphicEl(a,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else gR.prototype.highlight.call(this,e,t,n,r)},t.prototype.downplay=function(e,t,n,r){var i=e.getData(),a=uS(i,r);if(this._changePolyState(`normal`),a!=null&&a>=0){var o=i.getItemGraphicEl(a);o&&(o.__temp?(i.setItemGraphicEl(a,null),this.group.remove(o)):o.downplay())}else gR.prototype.downplay.call(this,e,t,n,r)},t.prototype._changePolyState=function(e){var t=this._polygon;$D(this._polyline,e),t&&$D(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new ype({shape:{points:e},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(t),this._polyline=t,t},t.prototype._newPolygon=function(e,t){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new xpe({shape:{points:e,stackedOnPoints:t},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},t.prototype._initSymbolLabelAnimation=function(e,t,n){var r,i,a=t.getBaseAxis(),o=a.inverse;t.type===`cartesian2d`?(r=a.isHorizontal(),i=!1):t.type===`polar`&&(r=a.dim===`angle`,i=!0);var s=e.hostModel,c=s.get(`animationDuration`);Db(c)&&(c=c(null));var l=s.get(`animationDelay`)||0,u=Db(l)?l(null):l;e.eachItemGraphicEl(function(e,a){var s=e;if(s){var d=[e.x,e.y],f=void 0,p=void 0,m=void 0;if(n){if(i){var h=n,g=t.pointToCoord(d);r?(f=h.startAngle,p=h.endAngle,m=-g[1]/180*Math.PI):(f=h.r0,p=h.r,m=g[0])}else{var _=n;r?(f=_.x,p=_.x+_.width,m=e.x):(f=_.y+_.height,p=_.y,m=e.y)}}var v=p===f?0:(m-f)/(p-f);o&&(v=1-v);var y=Db(l)?l(a):c*v+u,b=s.getSymbolPath(),x=b.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:y}),x&&x.animateFrom({style:{opacity:0}},{duration:300,delay:y}),b.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(e,t,n){var r=e.getModel(`endLabel`);if(XV(e)){var i=e.getData(),a=this._polyline,o=i.getLayout(`points`);if(!o){a.removeTextContent(),this._endLabel=null;return}var s=this._endLabel;s||(s=this._endLabel=new aD({z2:200}),s.ignoreClip=!0,a.setTextContent(this._endLabel),a.disableLabelAnimation=!0);var c=Dpe(o);c>=0&&(uA(a,dA(e,`endLabel`),{inheritColor:n,labelFetcher:e,labelDataIndex:c,defaultText:function(e,t,n){return n==null?QB(i,e):$B(i,n)},enableTextSetter:!0},kpe(r,t)),a.textConfig.position=null)}else this._endLabel&&=(this._polyline.removeTextContent(),null)},t.prototype._endLabelOnDuring=function(e,t,n,r,i,a,o){var s=this._endLabel,c=this._polyline;if(s){e<1&&r.originalX==null&&(r.originalX=s.x,r.originalY=s.y);var l=n.getLayout(`points`),u=n.hostModel,d=u.get(`connectNulls`),f=a.get(`precision`),p=a.get(`distance`)||0,m=o.getBaseAxis(),h=m.isHorizontal(),g=m.inverse,_=t.shape,v=g?h?_.x:_.y+_.height:h?_.x+_.width:_.y,y=(h?p:0)*(g?-1:1),b=(h?0:-p)*(g?-1:1),x=h?`x`:`y`,S=Ope(l,v,x),C=S.range,w=C[1]-C[0],T=void 0;if(w>=1){if(w>1&&!d){var E=YV(l,C[0]);s.attr({x:E[0]+y,y:E[1]+b}),i&&(T=u.getRawValue(C[0]))}else{var E=c.getPointOn(v,x);E&&s.attr({x:E[0]+y,y:E[1]+b});var D=u.getRawValue(C[0]),O=u.getRawValue(C[1]);i&&(T=SS(n,f,D,O,S.t))}r.lastFrameIndex=C[0]}else{var k=e===1||r.lastFrameIndex>0?C[0]:0,E=YV(l,k);i&&(T=u.getRawValue(k)),s.attr({x:E[0]+y,y:E[1]+b})}if(i){var A=yA(s);typeof A.setLabelText==`function`&&A.setLabelText(T)}}},t.prototype._doUpdateAnimation=function(e,t,n,r,i,a,o){var s=this._polyline,c=this._polygon,l=e.hostModel,u=vpe(this._data,e,this._stackedOnPoints,t,this._coordSys,n,this._valueOrigin,a),d=u.current,f=u.stackedOnCurrent,p=u.next,m=u.stackedOnNext;if(i&&(f=JV(u.stackedOnCurrent,u.current,n,i,o),d=JV(u.current,null,n,i,o),m=JV(u.stackedOnNext,u.next,n,i,o),p=JV(u.next,null,n,i,o)),KV(d,p)>3e3||c&&KV(f,m)>3e3){s.stopAnimation(),s.setShape({points:p}),c&&(c.stopAnimation(),c.setShape({points:p,stackedOnPoints:m}));return}s.shape.__points=u.current,s.shape.points=d;var h={shape:{points:p}};u.current!==d&&(h.shape.__points=u.next),s.stopAnimation(),bk(s,h,l),c&&(c.setShape({points:d,stackedOnPoints:f}),c.stopAnimation(),bk(c,{shape:{stackedOnPoints:m}},l),s.shape.points!==c.shape.points&&(c.shape.points=s.shape.points));for(var g=[],_=u.status,v=0;v<_.length;v++)if(_[v].cmd===`=`){var y=e.getItemGraphicEl(_[v].idx1);y&&g.push({el:y,ptIdx:v})}s.animators&&s.animators.length&&s.animators[0].during(function(){c&&c.dirtyShape();for(var e=s.shape.__points,t=0;tt&&(t=e[n]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,n=0;n10&&a.type===`cartesian2d`&&i){var s=a.getBaseAxis(),c=a.getOtherAxis(s),l=s.getExtent(),u=n.getDevicePixelRatio(),d=Math.abs(l[1]-l[0])*(u||1),f=Math.round(o/d);if(isFinite(f)&&f>1){i===`lttb`?e.setData(r.lttbDownSample(r.mapDimension(c.dim),1/f)):i===`minmax`&&e.setData(r.minmaxDownSample(r.mapDimension(c.dim),1/f));var p=void 0;Ob(i)?p=jpe[i]:Db(i)&&(p=i),p&&e.setData(r.downSample(r.mapDimension(c.dim),1/f,p,Mpe))}}}}}function Npe(e){e.registerChartView(Ape),e.registerSeriesModel(hpe),e.registerLayout(lV(`line`,!0)),e.registerVisual({seriesType:`line`,reset:function(e){var t=e.getData(),n=e.getModel(`lineStyle`).getLineStyle();n&&!n.stroke&&(n.stroke=t.getVisual(`style`).fill),t.setVisual(`legendLineStyle`,n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,QV(`line`))}function Ppe(){cle(`liPosMinGap`,Fpe)}function Fpe(e,t,n){var r=Jb(),i=n.serUids,a=n.liPosMinGap,o,s=t.axis,c=s.scale,l=c.needTransform(),u=c.getFilter?c.getFilter():null,d=OM(u);function f(n){YF(e,t.sers,function(e){var t=e.getRawData(),r=t.getDimensionIndex(t.mapDimension(s.dim));r>=0&&n(r,e,t.getStore())})}var p=0;if(f(function(e,t,n){r.set(t.uid,1),(!i||!i.hasKey(t.uid))&&(o=!0),p+=n.count()}),(!i||i.keys().length!==r.keys().length)&&(o=!0),!o&&a!=null){t.liPosMinGap=a;return}cV($V,p);var m=0;f(function(e,t,n){for(var r=0,i=n.count();r0&&v0?-2:-1,n.serUids=r}var $V=cV({ctor:Yfe},50);function Ipe(e){return function(t,n){var r=tI(t,{fromStat:{key:e}});if(Nx(r.w2))return[-r.w2/2,r.w2/2]}}function eH(e,t){return e+`|&`+t}function Lpe(e){return Ppe(),{liPosMinGap:!pP(e.scale)}}function Rpe(e,t,n,r){lle(e,{key:t,seriesType:n,coordSysType:r,getMetrics:Lpe})}function zpe(e){return e.scale.rawExtentInfo.makeRenderInfo().startValue}var Bpe=AS(),tH=`__ec_stack_`;function nH(e){return e.get(`stack`)||tH+e.seriesIndex}function Vpe(e){if(pP(e.axis.scale)){for(var t=tI(e.axis),n=[],r=0;ro&&(o=a),o!==u&&(t.width=o,n-=o+l*o,r--)}}),u=(n-c)/(r+(r-1)*l),u=rx(u,0);var d=0,f;W(o,function(e){var t=s[e];t.width||=u,f=t,d+=t.width*(1+l)}),f&&(d-=f.width*l);var p={},m=-d/2;return W(o,function(e){var n=s[e];p[e]=p[e]||{bandWidth:t,offset:m,width:n.width},m+=n.width*(1+l)}),p}function Wpe(e){return{seriesType:e,overallReset:function(t){var n=eH(e,wF);ole(t,n,function(t){var r=Hpe(t,e);JF(t,n,function(e){var t=r.columnMap[nH(e)];e.getData().setLayout({bandWidth:t.bandWidth,offset:t.offset,size:t.width})})})}}}function Gpe(e){return{seriesType:e,plan:mR(),reset:function(e){if(Ile(e)){var t=e.getData(),n=e.coordinateSystem,r=n.getBaseAxis(),i=n.getOtherAxis(r),a=t.getDimensionIndex(t.mapDimension(i.dim)),o=t.getDimensionIndex(t.mapDimension(r.dim)),s=e.get(`showBackground`,!0),c=t.mapDimension(i.dim),l=t.getCalculationInfo(`stackResultDimension`),u=tF(t,c)&&!!t.getCalculationInfo(`stackedOnSeries`),d=i.isHorizontal(),f=i.toGlobalCoord(i.dataToCoord(zpe(i))),p=iH(e),m=e.get(`barMinHeight`)||0,h=l&&t.getDimensionIndex(l),g=t.getLayout(`size`),_=t.getLayout(`offset`);return{progress:function(e,t){for(var r=e.count,i=p&&sV(r*3),c=p&&s&&sV(r*3),l=p&&sV(r),v=n.master.getRect(),y=d?v.width:v.height,b,x=t.getStore(),S=0;(b=e.next())!=null;){var C=x.get(u?h:a,b),w=x.get(o,b),T=f,E=void 0;u&&(E=+C-x.get(a,b));var D=void 0,O=void 0,k=void 0,A=void 0;if(d){var j=n.dataToPoint([C,w]);u&&(T=n.dataToPoint([E,w])[0]),D=T,O=j[1]+_,k=j[0]-T,A=g,ix(k)s){u=(p+l)/2;break}f===1&&(d=m-r[0].tickValue)}u??(l?l&&(u=r[r.length-1].coord):u=r[0].coord),a[n]=e.toGlobalCoord(u)}});else{var o=this.getData(),s=o.getLayout(`offset`),c=o.getLayout(`size`),l=+!r.getBaseAxis().isHorizontal();a[l]+=s+c/2}return a}return[NaN,NaN]},t.prototype.__requireStartValue=function(e){return this.getBaseAxis()!==e},t.type=`series.__base_bar__`,t.defaultOption={z:2,coordinateSystem:`cartesian2d`,legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:`mod`,defaultBarGap:`10%`},t}(rN);rN.registerClass(aH);var Jpe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(){return ZB(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get(`realtimeSort`,!0)||null})},t.prototype.getProgressive=function(){return this.get(`large`)?this.get(`progressive`):!1},t.prototype.__preparePipelineContext=function(e,t){var n=NS(this,e,t);return n.progressiveRender&&(n.large=!0),n},t.prototype.brushSelector=function(e,t,n){return n.rect(t.getItemLayout(e))},t.type=`series.bar`,t.dependencies=[`grid`,`polar`],t.defaultOption=DA(aH.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:`rgba(180, 180, 180, 0.2)`,borderColor:null,borderWidth:0,borderType:`solid`,borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:K.color.primary,borderWidth:2}},realtimeSort:!1}),t}(aH),Ype=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),oH=function(e){H(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`sausage`,n}return t.prototype.getDefaultShape=function(){return new Ype},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.max(t.r0||0,0),a=Math.max(t.r,0),o=(a-i)*.5,s=i+o,c=t.startAngle,l=t.endAngle,u=t.clockwise,d=Math.PI*2,f=u?l-cMath.PI/2&&ua)return!0;a=l}return!1},t.prototype._isOrderDifferentInView=function(e,t){for(var n=t.scale,r=n.getExtent(),i=Math.max(0,r[0]),a=Math.min(r[1],n.getOrdinalMeta().categories.length-1);i<=a;++i)if(e.ordinalNumbers[i]!==n.getRawOrdinalNumber(i))return!0},t.prototype._updateSortWithinSameData=function(e,t,n,r){if(this._isOrderChangedWithinSameData(e,t,n)){var i=this._dataSort(e,n,t);this._isOrderDifferentInView(i,n)&&(this._removeOnRenderedListener(r),r.dispatchAction({type:`changeAxisOrder`,componentType:n.dim+`Axis`,axisId:n.index,sortInfo:i}))}},t.prototype._dispatchInitSort=function(e,t,n){var r=t.baseAxis,i=this._dataSort(e,r,function(n){return e.get(e.mapDimension(t.otherAxis.dim),n)});n.dispatchAction({type:`changeAxisOrder`,componentType:r.dim+`Axis`,isInitSort:!0,axisId:r.index,sortInfo:i})},t.prototype.remove=function(e,t){this._clear(this._model),this._removeOnRenderedListener(t)},t.prototype.dispose=function(e,t){this._removeOnRenderedListener(t)},t.prototype._removeOnRenderedListener=function(e){this._onRendered&&=(e.getZr().off(`rendered`,this._onRendered),null)},t.prototype._clear=function(e){var t=this.group,n=this._data;e&&e.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(t){Tk(t,e,yD(t).dataIndex)})):t.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=`bar`,t}(gR),dH={cartesian2d:function(e,t){var n=t.width<0?-1:1,r=t.height<0?-1:1;n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height);var i=e.x+e.width,a=e.y+e.height,o=lH(t.x,e.x),s=uH(t.x+t.width,i),c=lH(t.y,e.y),l=uH(t.y+t.height,a),u=si?s:o,t.y=d&&c>a?l:c,t.width=u?0:s-o,t.height=d?0:l-c,n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height),u||d},polar:function(e,t){var n=t.r0<=t.r?1:-1;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}var i=uH(t.r,e.r),a=lH(t.r0,e.r0);t.r=i,t.r0=a;var o=i-a<0;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}return o}},fH={cartesian2d:function(e,t,n,r,i,a,o,s,c){var l=new eD({shape:U({},r),z2:1});if(l.__dataIndex=n,l.name=`item`,a){var u=l.shape,d=i?`height`:`width`;u[d]=0}return l},polar:function(e,t,n,r,i,a,o,s,c){var l=!i&&c?oH:ZO,u=new l({shape:r,z2:1});if(u.name=`item`,u.calculateTextPosition=Xpe(_H(i),{isRoundCap:l===oH}),a){var d=u.shape,f=i?`r`:`endAngle`,p={};d[f]=i?r.r0:r.startAngle,p[f]=r[f],(s?bk:xk)(u,{shape:p},a)}return u}};function eme(e,t){var n=e.get(`realtimeSort`,!0),r=t.getBaseAxis();if(n&&r.type===`category`&&t.type===`cartesian2d`)return{baseAxis:r,otherAxis:t.getOtherAxis(r)}}function pH(e,t,n,r,i,a,o,s){var c,l;a?(l={x:r.x,width:r.width},c={y:r.y,height:r.height}):(l={y:r.y,height:r.height},c={x:r.x,width:r.width}),s||(o?bk:xk)(n,{shape:c},t,i,null);var u=t?e.baseAxis.model:null;(o?bk:xk)(n,{shape:l},u,i)}function mH(e,t){for(var n=0;n0?1:-1,o=r.height>0?1:-1;return{x:r.x+a*i/2,y:r.y+o*i/2,width:r.width-a*i,height:r.height-o*i}},polar:function(e,t,n){var r=e.getItemLayout(t);return{cx:r.cx,cy:r.cy,r0:r.r0,r:r.r,startAngle:r.startAngle,endAngle:r.endAngle,clockwise:r.clockwise}}};function rme(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function _H(e){return function(e){var t=e?`Arc`:`Angle`;return function(e){switch(e){case`start`:case`insideStart`:case`end`:case`insideEnd`:return e+t;default:return e}}}(e)}function vH(e,t,n,r,i,a,o,s){var c=t.getItemVisual(n,`style`);if(!s){var l=r.get([`itemStyle`,`borderRadius`])||0;e.setShape(`r`,l)}else if(!a.get(`roundCap`)){var u=e.shape;U(u,Qpe(r.getModel(`itemStyle`),u,!0)),e.setShape(u)}e.useStyle(c);var d=r.getShallow(`cursor`);d&&e.attr(`cursor`,d);var f=s?o?i.r>=i.r0?`endArc`:`startArc`:i.endAngle>=i.startAngle?`endAngle`:`startAngle`:o?cme(i,a.coordinateSystem):lme(i,a.coordinateSystem),p=dA(r);uA(e,p,{labelFetcher:a,labelDataIndex:n,defaultText:QB(a.getData(),n),inheritColor:c.fill,defaultOpacity:c.opacity,defaultOutsidePosition:f});var m=e.getTextContent();if(s&&m){var h=r.get([`label`,`position`]);e.textConfig.inside=h===`middle`||null,Zpe(e,h===`outside`?f:h,_H(o),r.get([`label`,`rotate`]))}qoe(m,p,a.getRawValue(n),function(e){return $B(t,e)});var g=r.getModel([`emphasis`]);_O(e,g.get(`focus`),g.get(`blurScope`),g.get(`disabled`)),yO(e,r),rme(i)&&(e.style.fill=`none`,e.style.stroke=`none`,W(e.states,function(e){e.style&&(e.style.fill=e.style.stroke=`none`)}))}function ime(e,t){var n=e.get([`itemStyle`,`borderColor`]);if(!n||n===`none`)return 0;var r=e.get([`itemStyle`,`borderWidth`])||0,i=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),a=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(r,i,a)}var ame=function(){function e(){}return e}(),yH=function(e){H(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`largeBar`,n}return t.prototype.getDefaultShape=function(){return new ame},t.prototype.buildPath=function(e,t){for(var n=t.points,r=this.baseDimIdx,i=1-this.baseDimIdx,a=[],o=[],s=this.barWidth,c=0;c=0?n:null},30,!1);function ome(e,t,n){for(var r=e.baseDimIdx,i=1-r,a=e.shape.points,o=e.largeDataIndices,s=[],c=[],l=e.barWidth,u=0,d=a.length/3;u=s[0]&&t<=s[0]+c[0]&&n>=s[1]&&n<=s[1]+c[1])return o[u]}return-1}function SH(e,t,n){if(LV(n,`cartesian2d`)){var r=t,i=n.getArea();return{x:e?r.x:i.x,y:e?i.y:r.y,width:e?r.width:i.width,height:e?i.height:r.height}}var i=n.getArea(),a=t;return{cx:i.cx,cy:i.cy,r0:e?i.r0:a.r0,r:e?i.r:a.r,startAngle:e?a.startAngle:0,endAngle:e?a.endAngle:Math.PI*2}}function sme(e,t,n){return new(e.type===`polar`?ZO:eD)({shape:SH(t,n,e),silent:!0,z2:0})}function cme(e,t){return e.height===0?t.getOtherAxis(t.getBaseAxis()).inverse?`bottom`:`top`:e.height>0?`bottom`:`top`}function lme(e,t){return e.width===0?t.getOtherAxis(t.getBaseAxis()).inverse?`left`:`right`:e.width>=0?`right`:`left`}function ume(e){e.registerChartView($pe),e.registerSeriesModel(Jpe),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Wpe(`bar`)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,Gpe(`bar`)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,QV(`bar`)),e.registerAction({type:`changeAxisOrder`,event:`changeAxisOrder`,update:`update`},function(e,t){var n=e.componentType||`series`;t.eachComponent({mainType:n,query:e},function(t){e.sortInfo&&t.axis.setCategorySortInfo(e.sortInfo)})}),qpe(e)}var CH=dS();function dme(e,t,n){CH(e)[t]=n}function fme(e,t,n){var r=CH(e);r[t]===n&&(r[t]=null)}function wH(e,t){return!!CH(e)[t]}kB({type:`takeGlobalCursor`,event:`globalCursorTaken`,update:`update`},Qb);var pme={axisPointer:1,tooltip:1,brush:1};function TH(e,t,n){var r=t.getComponentByElement(e.topTarget);if(!r||r===n||pme.hasOwnProperty(r.mainType))return!1;var i=r.coordinateSystem;if(!i||i.model===n)return!1;var a=rA(r),o=rA(n);return!((a.zlevel-o.zlevel||a.z-o.z)<=0)}var mme=function(e){H(t,e);function t(t){var n=e.call(this)||this;n._zr=t;var r=Tb(n._mousedownHandler,n),i=Tb(n._mousemoveHandler,n),a=Tb(n._mouseupHandler,n),o=Tb(n._mousewheelHandler,n),s=Tb(n._pinchHandler,n);return n.enable=function(e,n){var c=n.zInfo,l=rA(c.component),u=l.z,d=l.zlevel,f={component:c.component,z:u,zlevel:d,z2:Rb(c.z2,-1/0)},p=U({},n.triggerInfo);this._opt=gb(U({},n),{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0,zInfoParsed:f,triggerInfo:p,cursorGrab:`grab`,cursorGrabbing:`grabbing`}),e??=!0,(!this._enabled||this._controlType!==e)&&(this.disable(),this._enabled=!0,(e===!0||e===`move`||e===`pan`)&&(OH(t,`mousedown`,r,f),OH(t,`mousemove`,i,f),OH(t,`mouseup`,a,f)),(e===!0||e===`scale`||e===`zoom`)&&(OH(t,`mousewheel`,o,f),OH(t,`pinch`,s,f)))},n.disable=function(){this._enabled&&(this._enabled=!1,kH(t,`mousedown`,r),kH(t,`mousemove`,i),kH(t,`mouseup`,a),kH(t,`mousewheel`,o),kH(t,`pinch`,s))},n}return t.prototype.isDragging=function(){return this._dragging},t.prototype.isPinching=function(){return this._pinching},t.prototype._checkPointer=function(e,t,n){var r=this._opt,i=r.zInfoParsed;if(TH(e,r.api,i.component))return!1;var a=r.triggerInfo,o=a.roamTrigger,s=!1;return o===`global`&&(s=!0),s||=a.isInSelf(e,t,n),s&&a.isInClip&&!a.isInClip(e,t,n)&&(s=!1),s},t.prototype._decideCursorStyle=function(e,t,n,r){var i=e.target;if(!i&&this._checkPointer(e,t,n))return this._opt.cursorGrab;if(r)return i&&i.cursor||`default`},t.prototype.dispose=function(){this.disable()},t.prototype._mousedownHandler=function(e){if(!(tL(e)||EH(e))){for(var t=e.target;t;){if(t.draggable)return;t=t.__hostTarget||t.parent}var n=e.offsetX,r=e.offsetY;this._checkPointer(e,n,r)&&(this._x=n,this._y=r,this._dragging=!0)}},t.prototype._mousemoveHandler=function(e){var t=this._zr;if(!(e.gestureEvent===`pinch`||wH(t,`globalPan`)||EH(e))){var n=e.offsetX,r=e.offsetY;if(!this._dragging||!jH(`moveOnMouseMove`,e,this._opt)){var i=this._decideCursorStyle(e,n,r,!1);i&&t.setCursorStyle(i);return}t.setCursorStyle(this._opt.cursorGrabbing);var a=this._x,o=this._y,s=n-a,c=r-o;this._x=n,this._y=r,this._opt.preventDefaultMouseMove&&eL(e.event),e.__ecRoamConsumed=!0,AH(this,`pan`,`moveOnMouseMove`,e,{dx:s,dy:c,oldX:a,oldY:o,newX:n,newY:r,isAvailableBehavior:null})}},t.prototype._mouseupHandler=function(e){if(!EH(e)){var t=this._zr;if(!tL(e)){this._dragging=!1;var n=this._decideCursorStyle(e,e.offsetX,e.offsetY,!0);n&&t.setCursorStyle(n)}}},t.prototype._mousewheelHandler=function(e){if(!EH(e)){var t=jH(`zoomOnMouseWheel`,e,this._opt),n=jH(`moveOnMouseWheel`,e,this._opt),r=e.wheelDelta,i=Math.abs(r),a=e.offsetX,o=e.offsetY;if(r!==0&&(t||n)){if(t){var s=i>3?1.4:i>1?1.2:1.1,c=r>0?s:1/s;this._checkTriggerMoveZoom(this,`zoom`,`zoomOnMouseWheel`,e,{scale:c,originX:a,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(r),u=(r>0?1:-1)*(l>3?.4:l>1?.15:.05);this._checkTriggerMoveZoom(this,`scrollMove`,`moveOnMouseWheel`,e,{scrollDelta:u,originX:a,originY:o,isAvailableBehavior:null})}}}},t.prototype._pinchHandler=function(e){if(!(wH(this._zr,`globalPan`)||EH(e))){var t=e.pinchScale>1?1.1:1/1.1;this._checkTriggerMoveZoom(this,`zoom`,null,e,{scale:t,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})}},t.prototype._checkTriggerMoveZoom=function(e,t,n,r,i){e._checkPointer(r,i.originX,i.originY)&&(eL(r.event),r.__ecRoamConsumed=!0,AH(e,t,n,r,i))},t}(kT);function EH(e){return e.__ecRoamConsumed}var hme=dS();function DH(e){var t=hme(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function OH(e,t,n,r){for(var i=DH(e).roam,a=i[t]=i[t]||[],o=0;o=0;a--)r[a]??(delete n[t[a]],t.pop())}function VH(e,t){var n=e.visual,r=[];jb(n)?RH(n,function(e){r.push(e)}):n!=null&&r.push(n),!t&&r.length===1&&!{color:1,symbol:1}.hasOwnProperty(e.type)&&(r[1]=r[0]),YH(e,r)}function HH(e){return{applyVisual:function(t,n,r){var i=this.mapValueToVisual(t);r(`color`,e(n(`color`),i))},_normalizedToVisual:qH([0,1])}}function UH(e){var t=this.option.visual;return t[Math.round(dx(e,[0,1],[0,t.length-1],!0))]||{}}function WH(e){return function(t,n,r){r(e,this.mapValueToVisual(t))}}function GH(e){var t=this.option.visual;return t[this.option.loop&&e!==zH?e%t.length:e]}function KH(){return this.option.visual[0]}function qH(e){return{linear:function(t){return dx(t,e,this.option.visual,!0)},category:GH,piecewise:function(t,n){var r=JH.call(this,n);return r??=dx(t,e,this.option.visual,!0),r},fixed:KH}}function JH(e){var t=this.option,n=t.pieceList;if(t.hasSpecialVisual){var r=n[BH.findPieceIndex(e,n)];if(r&&r.visual)return r.visual[this.type]}}function YH(e,t){return e.visual=t,e.type===`color`&&(e.parsedVisual=bb(t,function(e){return tT(e)||[0,0,0,1]})),t}var Eme={linear:function(e){return dx(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,n=BH.findPieceIndex(e,t,!0);if(n!=null)return dx(n,[0,t.length-1],[0,1],!0)},category:function(e){return(this.option.categories?this.option.categoryMap[e]:e)??zH},fixed:Qb};function XH(e,t,n){return e?t<=n:t0&&(y[0]=-y[0],y[1]=-y[1]);var x=v[0]<0?-1:1;if(r.__position!==`start`&&r.__position!==`end`){var S=-Math.atan2(v[1],v[0]);l[0].8?`left`:u[0]<-.8?`right`:`center`,p=u[1]>.8?`top`:u[1]<-.8?`bottom`:`middle`;break;case`start`:r.x=-u[0]*h+c[0],r.y=-u[1]*g+c[1],f=u[0]>.8?`right`:u[0]<-.8?`left`:`center`,p=u[1]>.8?`bottom`:u[1]<-.8?`top`:`middle`;break;case`insideStartTop`:case`insideStart`:case`insideStartBottom`:r.x=h*x+c[0],r.y=c[1]+C,f=v[0]<0?`right`:`left`,r.originX=-h*x,r.originY=-C;break;case`insideMiddleTop`:case`insideMiddle`:case`insideMiddleBottom`:case`middle`:r.x=b[0],r.y=b[1]+C,f=`center`,r.originY=-C;break;case`insideEndTop`:case`insideEnd`:case`insideEndBottom`:r.x=-h*x+l[0],r.y=l[1]+C,f=v[0]>=0?`right`:`left`,r.originX=h*x,r.originY=-C}r.scaleX=r.scaleY=i,r.setStyle({verticalAlign:r.__verticalAlign||p,align:r.__align||f})}},t}(LO),Ame=function(){function e(e){this.group=new LO,this._LineCtor=e||kme}return e.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var n=this,r=n.group,i=n._lineData;n._lineData=e,i||r.removeAll();var a=oU(e);e.diff(i).add(function(n){t._doAdd(e,n,a)}).update(function(n,r){t._doUpdate(i,e,r,n,a)}).remove(function(e){r.remove(i.getItemGraphicEl(e))}).execute()},e.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl(function(t,n){t.updateLayout(e,n)},this)},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=oU(e),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t,n){this._progressiveEls=[];function r(e){!e.isGroup&&!jme(e)&&(e.incremental=n,e.ensureState(`emphasis`).hoverLayer=2)}for(var i=e.start;i0}function oU(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{lineStyle:t.getModel(`lineStyle`).getLineStyle(),emphasisLineStyle:n.getModel([`lineStyle`]).getLineStyle(),blurLineStyle:t.getModel([`blur`,`lineStyle`]).getLineStyle(),selectLineStyle:t.getModel([`select`,`lineStyle`]).getLineStyle(),emphasisDisabled:n.get(`disabled`),blurScope:n.get(`blurScope`),focus:n.get(`focus`),labelStatesModels:dA(t)}}function sU(e){return isNaN(e[0])||isNaN(e[1])}function cU(e){return e&&!sU(e[0])&&!sU(e[1])}function lU(e,t,n,r,i,a){e||=0;var o=vx(n[1],-n[0]);if(i!=null&&(i=dU(i,[0,o])),a!=null&&(a=Math.max(a,i??0)),r===`all`){var s=Math.abs(vx(t[1],-t[0]));s=dU(s,[0,o]),i=a=dU(s,[i,a]),r=0}t[0]=dU(t[0],n),t[1]=dU(t[1],n);var c=uU(t,r);t[r]+=e;var l=i||0,u=n.slice();c.sign<0?u[0]=vx(u[0],l):u[1]=vx(u[1],-l),t[r]=dU(t[r],u);var d=uU(t,r);return i!=null&&(d.sign!==c.sign||d.spana&&(t[1-r]=vx(t[r],d.sign*a)),t}function uU(e,t){var n=e[t]-e[1-t];return{span:Math.abs(n),sign:n>0?-1:n<0?1:t?-1:1}}function dU(e,t){return Math.min(t[1]==null?1/0:t[1],Math.max(t[0]==null?-1/0:t[0],e))}var fU=!0,pU=Math.min,mU=Math.max,Mme=Math.pow,Nme=1e4,Pme=6,Fme=6,hU=`globalPan`,Ime={w:[0,0],e:[0,1],n:[1,0],s:[1,1]},Lme={w:`ew`,e:`ew`,n:`ns`,s:`ns`,ne:`nesw`,sw:`nesw`,nw:`nwse`,se:`nwse`},gU={brushStyle:{lineWidth:2,stroke:K.color.backgroundTint,fill:K.color.borderTint},transformable:!0,brushMode:`single`,removeOnClick:!1},Rme=0,_U=function(e){H(t,e);function t(t){var n=e.call(this)||this;return n._track=[],n._covers=[],n._handlers={},n._zr=t,n.group=new LO,n._uid=`brushController_`+Rme++,W(Gme,function(e,t){this._handlers[t]=Tb(e,this)},n),n}return t.prototype.enableBrush=function(e){return this._brushType&&this._doDisableBrush(),e.brushType&&this._doEnableBrush(e),this},t.prototype._doEnableBrush=function(e){var t=this._zr;this._enableGlobalPan||dme(t,hU,this._uid),W(this._handlers,function(e,n){t.on(n,e)}),this._brushType=e.brushType,this._brushOption=hb(mb(gU),e,!0)},t.prototype._doDisableBrush=function(){var e=this._zr;fme(e,hU,this._uid),W(this._handlers,function(t,n){e.off(n,t)}),this._brushType=this._brushOption=null},t.prototype.setPanels=function(e){if(e&&e.length){var t=this._panels={};W(e,function(e){t[e.panelId]=mb(e)})}else this._panels=null;return this},t.prototype.mount=function(e){e||={},this._enableGlobalPan=e.enableGlobalPan;var t=this.group;return this._zr.add(t),t.attr({x:e.x||0,y:e.y||0,rotation:e.rotation||0,scaleX:e.scaleX||1,scaleY:e.scaleY||1}),this._transform=t.getLocalTransform(),this},t.prototype.updateCovers=function(e){e=bb(e,function(e){return hb(mb(gU),e,!0)});var t=`\0-brush-index-`,n=this._covers,r=this._covers=[],i=this,a=this._creatingCover;return new lN(n,e,s,o).add(c).update(c).remove(l).execute(),this;function o(e,n){return(e.id==null?t+n:e.id)+`-`+e.brushType}function s(e,t){return o(e.__brushOption,t)}function c(t,o){var s=e[t];o!=null&&n[o]===a?r[t]=n[o]:SU(i,r[t]=o==null?yU(i,vU(i,s)):(n[o].__brushOption=s,n[o]))}function l(e){n[e]!==a&&i.group.remove(n[e])}},t.prototype.unmount=function(){return this.enableBrush(!1),EU(this),this._zr.remove(this.group),this},t.prototype.dispose=function(){this.unmount(),this.off()},t}(kT);function vU(e,t){var n=WU[t.brushType].createCover(e,t);return n.__brushOption=t,xU(n,t),e.group.add(n),n}function yU(e,t){var n=CU(t);return n.endCreating&&(n.endCreating(e,t),xU(t,t.__brushOption)),t}function bU(e,t){var n=t.__brushOption;CU(t).updateCoverShape(e,t,n.range,n)}function xU(e,t){var n=t.z;n??=Nme,e.traverse(function(e){e.z=n,e.z2=n})}function SU(e,t){CU(t).updateCommon(e,t),bU(e,t)}function CU(e){return WU[e.__brushOption.brushType]}function wU(e,t,n){var r=e._panels;if(!r)return fU;var i,a=e._transform;return W(r,function(e){e.isTargetByCursor(t,n,a)&&(i=e)}),i}function TU(e,t){var n=e._panels;if(!n)return fU;var r=t.__brushOption.panelId;return r==null?fU:n[r]}function EU(e){var t=e._covers,n=t.length;return W(t,function(t){e.group.remove(t)},e),t.length=0,!!n}function DU(e,t){var n=bb(e._covers,function(e){var t=e.__brushOption,n=mb(t.range);return{brushType:t.brushType,panelId:t.panelId,range:n}});e.trigger(`brush`,{areas:n,isEnd:!!t.isEnd,removeOnClick:!!t.removeOnClick})}function zme(e){var t=e._track;if(!t.length)return!1;var n=t[t.length-1],r=t[0],i=n[0]-r[0],a=n[1]-r[1];return Mme(i*i+a*a,.5)>Pme}function OU(e){var t=e.length-1;return t<0&&(t=0),[e[0],e[t]]}function kU(e,t,n,r){var i=new LO;return i.add(new eD({name:`main`,style:NU(n),silent:!0,draggable:!0,cursor:`move`,drift:Eb(IU,e,t,i,[`n`,`s`,`w`,`e`]),ondragend:Eb(DU,t,{isEnd:!0})})),W(r,function(n){i.add(new eD({name:n.join(``),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:Eb(IU,e,t,i,n),ondragend:Eb(DU,t,{isEnd:!0})}))}),i}function AU(e,t,n,r){var i=r.brushStyle.lineWidth||0,a=mU(i,Fme),o=n[0][0],s=n[1][0],c=o-i/2,l=s-i/2,u=n[0][1],d=n[1][1],f=u-a+i/2,p=d-a+i/2,m=u-o,h=d-s,g=m+i,_=h+i;MU(e,t,`main`,o,s,m,h),r.transformable&&(MU(e,t,`w`,c,l,a,_),MU(e,t,`e`,f,l,a,_),MU(e,t,`n`,c,l,g,a),MU(e,t,`s`,c,p,g,a),MU(e,t,`nw`,c,l,a,a),MU(e,t,`ne`,f,l,a,a),MU(e,t,`sw`,c,p,a,a),MU(e,t,`se`,f,p,a,a))}function jU(e,t){var n=t.__brushOption,r=n.transformable,i=t.childAt(0);i.useStyle(NU(n)),i.attr({silent:!r,cursor:r?`move`:`default`}),W([[`w`],[`e`],[`n`],[`s`],[`s`,`e`],[`s`,`w`],[`n`,`e`],[`n`,`w`]],function(n){var i=t.childOfName(n.join(``)),a=n.length===1?FU(e,n[0]):Vme(e,n);i&&i.attr({silent:!r,invisible:!r,cursor:r?Lme[a]+`-resize`:null})})}function MU(e,t,n,r,i,a,o){var s=t.childOfName(n);s&&s.setShape(Ume(RU(e,t,[[r,i],[r+a,i+o]])))}function NU(e){return gb({strokeNoScale:!0},e.brushStyle)}function PU(e,t,n,r){var i=[pU(e,n),pU(t,r)],a=[mU(e,n),mU(t,r)];return[[i[0],a[0]],[i[1],a[1]]]}function Bme(e){return Lk(e.group)}function FU(e,t){return{left:`w`,right:`e`,top:`n`,bottom:`s`}[zk({w:`left`,e:`right`,n:`top`,s:`bottom`}[t],Bme(e))]}function Vme(e,t){var n=[FU(e,t[0]),FU(e,t[1])];return(n[0]===`e`||n[0]===`w`)&&n.reverse(),n.join(``)}function IU(e,t,n,r,i,a){var o=n.__brushOption,s=e.toRectRange(o.range),c=LU(t,i,a);W(r,function(e){var t=Ime[e];s[t[0]][t[1]]+=c[t[0]]}),o.range=e.fromRectRange(PU(s[0][0],s[1][0],s[0][1],s[1][1])),SU(t,n),DU(t,{isEnd:!1})}function Hme(e,t,n,r){var i=t.__brushOption.range,a=LU(e,n,r);W(i,function(e){e[0]+=a[0],e[1]+=a[1]}),SU(e,t),DU(e,{isEnd:!1})}function LU(e,t,n){var r=e.group,i=r.transformCoordToLocal(t,n),a=r.transformCoordToLocal(0,0);return[i[0]-a[0],i[1]-a[1]]}function RU(e,t,n){var r=TU(e,t);return r&&r!==fU?r.clipPath(n,e._transform):mb(n)}function Ume(e){var t=pU(e[0][0],e[1][0]),n=pU(e[0][1],e[1][1]),r=mU(e[0][0],e[1][0]),i=mU(e[0][1],e[1][1]);return{x:t,y:n,width:r-t,height:i-n}}function Wme(e,t,n){if(e._brushType&&!Kme(e,t.offsetX,t.offsetY)){var r=e._zr,i=e._covers,a=wU(e,t,n);if(!e._dragging)for(var o=0;or.getWidth()||n<0||n>r.getHeight()}var WU={lineX:GU(0),lineY:GU(1),rect:{createCover:function(e,t){function n(e){return e}return kU({toRectRange:n,fromRectRange:n},e,t,[[`w`],[`e`],[`n`],[`s`],[`s`,`e`],[`s`,`w`],[`n`,`e`],[`n`,`w`]])},getCreatingRange:function(e){var t=OU(e);return PU(t[1][0],t[1][1],t[0][0],t[0][1])},updateCoverShape:function(e,t,n,r){AU(e,t,n,r)},updateCommon:jU,contain:BU},polygon:{createCover:function(e,t){var n=new LO;return n.add(new tk({name:`main`,style:NU(t),silent:!0})),n},getCreatingRange:function(e){return e},endCreating:function(e,t){t.remove(t.childAt(0)),t.add(new ek({name:`main`,draggable:!0,drift:Eb(Hme,e,t),ondragend:Eb(DU,e,{isEnd:!0})}))},updateCoverShape:function(e,t,n,r){t.childAt(0).setShape({points:RU(e,t,n)})},updateCommon:jU,contain:BU}};function GU(e){return{createCover:function(t,n){return kU({toRectRange:function(t){var n=[t,[0,100]];return e&&n.reverse(),n},fromRectRange:function(t){return t[e]}},t,n,[[[`w`],[`e`]],[[`n`],[`s`]]][e])},getCreatingRange:function(t){var n=OU(t);return[pU(n[0][e],n[1][e]),mU(n[0][e],n[1][e])]},updateCoverShape:function(t,n,r,i){var a,o=TU(t,n);if(o!==fU&&o.getLinearBrushOtherExtent)a=o.getLinearBrushOtherExtent(e);else{var s=t._zr;a=[0,[s.getWidth(),s.getHeight()][1-e]]}var c=[r,a];e&&c.reverse(),AU(t,n,c,i)},updateCommon:jU,contain:BU}}function qme(e){return e=KU(e),function(t){return Hk(t,e)}}function Jme(e,t){return e=KU(e),function(n){var r=t??n,i=r?e.width:e.height,a=r?e.x:e.y;return[a,a+(i||0)]}}function Yme(e,t,n){var r=KU(e);return function(e,i){return r.contain(i[0],i[1])&&!TH(e,t,n)}}function KU(e){return OC.create(e)}var Xme=256,Zme=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=nb.createCanvas();this.canvas=e}return e.prototype.update=function(e,t,n,r,i,a){var o=this._getBrush(),s=this._getGradient(i,`inRange`),c=this._getGradient(i,`outOfRange`),l=this.pointSize+this.blurSize,u=this.canvas,d=u.getContext(`2d`),f=e.length;u.width=t,u.height=n;for(var p=0;p0){var E=a(v)?s:c;v>0&&(v=v*w+C),b[x++]=E[T],b[x++]=E[T+1],b[x++]=E[T+2],b[x++]=E[T+3]*v*256}else x+=4}return d.putImageData(y,0,0),u},e.prototype._getBrush=function(){var e=this._brushCanvas||=nb.createCanvas(),t=this.pointSize+this.blurSize,n=t*2;e.width=n,e.height=n;var r=e.getContext(`2d`);return r.clearRect(0,0,n,n),r.shadowOffsetX=n,r.shadowBlur=this.blurSize,r.shadowColor=K.color.neutral99,r.beginPath(),r.arc(-t,t,this.pointSize,0,Math.PI*2,!0),r.closePath(),r.fill(),e},e.prototype._getGradient=function(e,t){for(var n=this._gradientPixels,r=n[t]||(n[t]=new Uint8ClampedArray(1024)),i=[0,0,0,0],a=0,o=0;o<256;o++)e[t](o/255,!0,i),r[a++]=i[0],r[a++]=i[1],r[a++]=i[2],r[a++]=i[3];return r},e}();function Qme(e,t,n){var r=e[1]-e[0];t=bb(t,function(t){return{interval:[(t.interval[0]-e[0])/r,(t.interval[1]-e[0])/r]}});var i=t.length,a=0;return function(e){for(var r=a;r=0;r--){var o=t[r].interval;if(o[0]<=e&&e<=o[1]){a=r;break}}return r>=0&&r=t[0]&&e<=t[1]}}var ehe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r;t.eachComponent(`visualMap`,function(t){t.eachTargetSeries(function(n){n===e&&(r=t)})}),this._progressiveEls=null,this.group.removeAll();var i=e.coordinateSystem;i.type===`cartesian2d`||i.type===`calendar`||i.type===`matrix`?this._renderOnGridLike(e,n,0,e.getData().count()):RV(i)&&this._renderOnGeo(i,e,r,n)},t.prototype.incrementalPrepareRender=function(e,t,n){this.group.removeAll()},t.prototype.incrementalRender=function(e,t,n,r){var i=t.coordinateSystem;i&&(RV(i)?this.render(t,n,r):(this._progressiveEls=[],this._renderOnGridLike(t,r,e.start,e.end,!0)))},t.prototype.eachRendered=function(e){Qk(this._progressiveEls||this.group,e)},t.prototype._renderOnGridLike=function(e,t,n,r,i){var a=e.coordinateSystem,o=LV(a,`cartesian2d`),s=LV(a,`matrix`),c,l,u,d;if(o){var f=a.getAxis(`x`),p=a.getAxis(`y`);c=tI(f).w+.5,l=tI(p).w+.5,u=f.scale.getExtent(),d=p.scale.getExtent()}for(var m=this.group,h=e.getData(),g=e.getModel([`emphasis`,`itemStyle`]).getItemStyle(),_=e.getModel([`blur`,`itemStyle`]).getItemStyle(),v=e.getModel([`select`,`itemStyle`]).getItemStyle(),y=e.get([`itemStyle`,`borderRadius`]),b=dA(e),x=e.getModel(`emphasis`),S=x.get(`focus`),C=x.get(`blurScope`),w=x.get(`disabled`),T=o||s?[h.mapDimension(`x`),h.mapDimension(`y`),h.mapDimension(`value`)]:[h.mapDimension(`time`),h.mapDimension(`value`)],E=n;Eu[1]||Ad[1])continue;var j=a.dataToPoint([k,A]);D=new eD({shape:{x:j[0]-c/2,y:j[1]-l/2,width:c,height:l},style:O})}else if(s){var M=a.dataToLayout([h.get(T[0],E),h.get(T[1],E)]).rect;if(Ib(M.x))continue;D=new eD({z2:1,shape:M,style:O})}else{if(isNaN(h.get(T[1],E)))continue;var N=a.dataToLayout([h.get(T[0],E)]),M=N.contentRect||N.rect;if(Ib(M.x)||Ib(M.y))continue;D=new eD({z2:1,shape:M,style:O})}if(h.hasItemOption){var P=h.getItemModel(E),F=P.getModel(`emphasis`);g=F.getModel(`itemStyle`).getItemStyle(),_=P.getModel([`blur`,`itemStyle`]).getItemStyle(),v=P.getModel([`select`,`itemStyle`]).getItemStyle(),y=P.get([`itemStyle`,`borderRadius`]),S=F.get(`focus`),C=F.get(`blurScope`),w=F.get(`disabled`),b=dA(P)}D.shape.r=y;var ee=e.getRawValue(E),I=`-`;ee&&ee[2]!=null&&(I=ee[2]+``),uA(D,b,{labelFetcher:e,labelDataIndex:E,defaultOpacity:O.opacity,defaultText:I}),D.ensureState(`emphasis`).style=g,D.ensureState(`blur`).style=_,D.ensureState(`select`).style=v,_O(D,S,C,w),D.incremental=MS(e,i),i&&(D.states.emphasis.hoverLayer=2),m.add(D),h.setItemGraphicEl(E,D),this._progressiveEls&&this._progressiveEls.push(D)}},t.prototype._renderOnGeo=function(e,t,n,r){var i=n.targetVisuals.inRange,a=n.targetVisuals.outOfRange,o=t.getData(),s=this._hmLayer||this._hmLayer||new Zme;s.blurSize=t.get(`blurSize`),s.pointSize=t.get(`pointSize`),s.minOpacity=t.get(`minOpacity`),s.maxOpacity=t.get(`maxOpacity`);var c=e.getViewRect().clone(),l=e.getRoamTransform();c.applyTransform(l);var u=Math.max(c.x,0),d=Math.max(c.y,0),f=Math.min(c.width+c.x,r.getWidth()),p=Math.min(c.height+c.y,r.getHeight()),m=f-u,h=p-d,g=[o.mapDimension(`lng`),o.mapDimension(`lat`),o.mapDimension(`value`)],_=o.mapArray(g,function(t,n,r){var i=e.dataToPoint([t,n]);return i[0]-=u,i[1]-=d,i.push(r),i}),v=n.getExtent(),y=n.type===`visualMap.continuous`?$me(v,n.option.range):Qme(v,n.getPieceList(),n.option.selected);s.update(_,m,h,i.color.getNormalizer(),{inRange:i.color.getColorMapper(),outOfRange:a.color.getColorMapper()},y);var b=new KE({style:{width:m,height:h,x:u,y:d,image:s.canvas},silent:!0});this.group.add(b)},t.type=`heatmap`,t}(gR),the=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(e,t){return ZB(null,this,{generateCoord:`value`})},t.prototype.preventIncremental=function(){var e=kj.get(this.get(`coordinateSystem`));if(e&&e.dimensions)return e.dimensions[0]===`lng`&&e.dimensions[1]===`lat`},t.type=`series.heatmap`,t.dependencies=[`grid`,`geo`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:K.color.primary}}},t}(rN);function nhe(e){e.registerChartView(ehe),e.registerSeriesModel(the)}var qU={color:`fill`,borderColor:`stroke`},rhe={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},JU=dS(),ihe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.optionUpdated=function(){this.currentZLevel=this.get(`zlevel`,!0),this.currentZ=this.get(`z`,!0)},t.prototype.getInitialData=function(e,t){return ZB(null,this)},t.prototype.getDataParams=function(t,n,r){var i=e.prototype.getDataParams.call(this,t,n);return r&&(i.info=JU(r).info),i},t.type=`series.custom`,t.dependencies=[`grid`,`polar`,`geo`,`singleAxis`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,legendHoverLink:!0,clip:!1},t}(rN);function ahe(e,t){return t||=[0,0],bb([`x`,`y`],function(n,r){var i=this.getAxis(n),a=t[r],o=e[r]/2;return i.type===`category`?tI(i).w:Math.abs(i.dataToCoord(a-o)-i.dataToCoord(a+o))},this)}function ohe(e){var t=e.master.getRect();return{coordSys:{type:`cartesian2d`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t){return e.dataToPoint(t)},size:Tb(ahe,e)}}}function she(e,t){return t||=[0,0],bb([0,1],function(n){var r=t[n],i=e[n]/2,a=[],o=[];return a[n]=r-i,o[n]=r+i,a[1-n]=o[1-n]=t[1-n],Math.abs(this.dataToPoint(a)[n]-this.dataToPoint(o)[n])},this)}function che(e){var t=e.view,n=t.getBoundingRect();return{coordSys:{type:`geo`,x:n.x,y:n.y,width:n.width,height:n.height,zoom:xme(t)},api:{coord:function(t){return e.dataToPoint(t)},size:Tb(she,e)}}}function lhe(e,t){var n=this.getAxis(),r=t instanceof Array?t[0]:t,i=(e instanceof Array?e[0]:e)/2;return n.type===`category`?tI(n).w:Math.abs(n.dataToCoord(r-i)-n.dataToCoord(r+i))}function uhe(e){var t=e.getRect();return{coordSys:{type:`singleAxis`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t){return e.dataToPoint(t)},size:Tb(lhe,e)}}}function dhe(e,t){return t||=[0,0],bb([`Radius`,`Angle`],function(n,r){var i=`get`+n+`Axis`,a=this[i](),o=t[r],s=e[r]/2,c=a.type===`category`?tI(a).w:Math.abs(a.dataToCoord(o-s)-a.dataToCoord(o+s));return n===`Angle`&&(c=c*Math.PI/180),c},this)}function fhe(e){var t=e.getRadiusAxis(),n=e.getAngleAxis(),r=t.getExtent();return r[0]>r[1]&&r.reverse(),{coordSys:{type:`polar`,cx:e.cx,cy:e.cy,r:r[1],r0:r[0]},api:{coord:function(r){var i=t.dataToRadius(r[0]),a=n.dataToAngle(r[1]),o=e.coordToPoint([i,a]);return o.push(i,a*Math.PI/180),o},size:Tb(dhe,e)}}}function phe(e){var t=e.getRect(),n=e.getRangeInfo();return{coordSys:{type:`calendar`,x:t.x,y:t.y,width:t.width,height:t.height,cellWidth:e.getCellWidth(),cellHeight:e.getCellHeight(),rangeInfo:{start:n.start,end:n.end,weeks:n.weeks,dayCount:n.allDay}},api:{coord:function(t,n){return e.dataToPoint(t,n)},layout:function(t,n){return e.dataToLayout(t,n)}}}}function mhe(e){var t=e.getRect();return{coordSys:{type:`matrix`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t,n){return e.dataToPoint(t,n)},layout:function(t,n){return e.dataToLayout(t,n)}}}}var YU={position:[`x`,`y`],scale:[`scaleX`,`scaleY`],origin:[`originX`,`originY`]},XU=wb(YU);xb(_w,function(e,t){return e[t]=1,e},{}),_w.join(`, `);var ZU=[``,`style`,`shape`,`extra`],QU=dS();function $U(e,t,n,r,i){var a=e+`Animation`,o=vk(e,r,i)||{},s=QU(t).userDuring;return o.duration>0&&(o.during=s?Tb(yhe,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),U(o,n[a]),o}function eW(e,t,n,r){r||={};var i=r.dataIndex,a=r.isInit,o=r.clearStyle,s=n.isAnimationEnabled(),c=QU(e),l=t.style;c.userDuring=t.during;var u={},d={};if(xhe(e,t,d),e.type===`compound`)for(var f=e.shape.paths,p=t.shape.paths,m=0;m0&&e.animateFrom(g,_)}else ghe(e,t,i||0,n,u)}tW(e,t),l?e.dirty():e.markRedraw()}function tW(e,t){for(var n=QU(e).leaveToProps,r=0;r0&&e.animateFrom(i,a)}}function _he(e,t){Zb(t,`silent`)&&(e.silent=t.silent),Zb(t,`ignore`)&&(e.ignore=t.ignore),e instanceof XT&&Zb(t,`invisible`)&&(e.invisible=t.invisible),e instanceof BE&&Zb(t,`autoBatch`)&&(e.autoBatch=t.autoBatch)}var iW={},vhe={setTransform:function(e,t){return iW.el[e]=t,this},getTransform:function(e){return iW.el[e]},setShape:function(e,t){var n=iW.el,r=n.shape||={};return r[e]=t,n.dirtyShape&&n.dirtyShape(),this},getShape:function(e){var t=iW.el.shape;if(t)return t[e]},setStyle:function(e,t){var n=iW.el,r=n.style;return r&&(r[e]=t,n.dirtyStyle&&n.dirtyStyle()),this},getStyle:function(e){var t=iW.el.style;if(t)return t[e]},setExtra:function(e,t){var n=iW.el.extra||(iW.el.extra={});return n[e]=t,this},getExtra:function(e){var t=iW.el.extra;if(t)return t[e]}};function yhe(){var e=this,t=e.el;if(t){var n=QU(t).userDuring,r=e.userDuring;if(n!==r){e.el=e.userDuring=null;return}iW.el=t,r(vhe)}}function aW(e,t,n,r){var i=n[e];if(i){var a=t[e],o;if(a){var s=n.transition,c=i.transition;if(c){if(!o&&(o=r[e]={}),rW(c))U(o,a);else for(var l=Ux(c),u=0;u=0){!o&&(o=r[e]={});for(var p=wb(a),u=0;u=0)){var f=e.getAnimationStyleProps(),p=f?f.style:null;if(p){!a&&(a=r.style={});for(var m=wb(n),l=0;l=0?t.getStore().get(i,n):void 0}var a=t.get(r.name,n),o=r&&r.ordinalMeta;return o?o.categories[a]:a}function C(n,r){r??=u;var i=t.getItemVisual(r,`style`),a=i&&i.fill,o=i&&i.opacity,s=y(r,dW).getItemStyle();a!=null&&(s.fill=a),o!=null&&(s.opacity=o);var c={inheritColor:Ob(a)?a:K.color.neutral99},l=b(r,dW),d=fA(l,null,c,!1,!0);d.text=l.getShallow(`show`)?Rb(e.getFormattedLabel(r,dW),QB(t,r)):null;var f=pA(l,c,!1);return E(n,s),s=HV(s,d,f),n&&T(s,n),s.legacy=!0,s}function w(n,r){r??=u;var i=y(r,uW).getItemStyle(),a=b(r,uW),o=fA(a,null,null,!0,!0);o.text=a.getShallow(`show`)?zb(e.getFormattedLabel(r,uW),e.getFormattedLabel(r,dW),QB(t,r)):null;var s=pA(a,null,!0);return E(n,i),i=HV(i,o,s),n&&T(i,n),i.legacy=!0,i}function T(e,t){for(var n in t)Zb(t,n)&&(e[n]=t[n])}function E(e,t){e&&(e.textFill&&(t.textFill=e.textFill),e.textPosition&&(t.textPosition=e.textPosition))}function D(e,n){if(n??=u,Zb(qU,e)){var r=t.getItemVisual(n,`style`);return r?r[qU[e]]:null}if(Zb(rhe,e))return t.getItemVisual(n,e)}function O(e){if(o.type===`cartesian2d`)return Vpe(gb({axis:o.getBaseAxis()},e))}function k(){return n.getCurrentSeriesIndices()}function A(e){return vA(e,n)}}function TW(e){var t={};return W(e.dimensions,function(n){var r=e.getDimensionInfo(n);if(!r.isExtraCoord){var i=r.coordDim,a=t[i]=t[i]||[];a[r.coordDimIndex]=e.getDimensionIndex(n)}}),t}function EW(e,t,n,r,i,a,o){if(!r){a.remove(t);return}var s=DW(e,t,n,r,i,a);return s&&o.setItemGraphicEl(n,s),s&&_O(s,r.focus,r.blurScope,r.emphasisDisabled),s}function DW(e,t,n,r,i,a){var o=-1,s=t;t&&OW(t,r,i)&&(o=_b(a.childrenRef(),t),t=null);var c=!t,l=t;l?l.clearStates():(l=bW(r),s&&Ohe(s,l)),r.morph===!1?l.disableMorphing=!0:l.disableMorphing&&(l.disableMorphing=!1),r.tooltipDisabled&&(l.tooltipDisabled=!0),_W.normal.cfg=_W.normal.conOpt=_W.emphasis.cfg=_W.emphasis.conOpt=_W.blur.cfg=_W.blur.conOpt=_W.select.cfg=_W.select.conOpt=null,_W.isLegacy=!1,AW(l,n,r,i,c,_W),kW(l,n,r,i,c),xW(e,l,n,r,_W,i,c),Zb(r,`info`)&&(JU(l).info=r.info);for(var u=0;u=0?a.replaceAt(l,o):a.add(l),l}function OW(e,t,n){var r=JU(e),i=t.type,a=t.shape,o=t.style;return n.isUniversalTransitionEnabled()||i!=null&&i!==r.customGraphicType||i===`path`&&VW(a)&&BW(a)!==r.customPathData||i===`image`&&Zb(o,`image`)&&o.image!==r.customImagePath}function kW(e,t,n,r,i){var a=n.clipPath;if(a===!1)e&&e.getClipPath()&&e.removeClipPath();else if(a){var o=e.getClipPath();o&&OW(o,a,r)&&(o=null),o||(o=bW(a),e.setClipPath(o)),xW(null,o,t,a,null,r,i)}}function AW(e,t,n,r,i,a){if(!(e.isGroup||e.type===`compoundPath`)){jW(n,null,a),jW(n,uW,a);var o=a.normal.conOpt,s=a.emphasis.conOpt,c=a.blur.conOpt,l=a.select.conOpt;if(o!=null||s!=null||l!=null||c!=null){var u=e.getTextContent();if(o===!1)u&&e.removeTextContent();else{o=a.normal.conOpt=o||{type:`text`},u?u.clearStates():(u=bW(o),e.setTextContent(u)),xW(null,u,t,o,null,r,i);for(var d=o&&o.style,f=0;f=u;p--)FW(t,t.childAt(p),i)}}function FW(e,t,n){t&&nW(t,JU(e).option,n)}function IW(e){new lN(e.oldChildren,e.newChildren,LW,LW,e).add(RW).update(RW).remove(zW).execute()}function LW(e,t){return(e&&e.name)??Ehe+t}function RW(e,t){var n=this.context,r=e==null?null:n.newChildren[e],i=t==null?null:n.oldChildren[t];DW(n.api,i,n.dataIndex,r,n.seriesModel,n.group)}function zW(e){var t=this.context,n=t.oldChildren[e];n&&nW(n,JU(n).option,t.seriesModel)}function BW(e){return e&&(e.pathData||e.d)}function VW(e){return e&&(Zb(e,`pathData`)||Zb(e,`d`))}function HW(e){e.registerChartView(khe),e.registerSeriesModel(ihe)}var UW=dS(),WW=mb,GW=Tb,KW=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(e,t,n,r){var i=t.get(`value`),a=t.get(`status`);if(this._axisModel=e,this._axisPointerModel=t,this._api=n,r||this._lastValue!==i||this._lastStatus!==a){this._lastValue=i,this._lastStatus=a;var o=this._group,s=this._handle;if(!a||a===`hide`){o&&o.hide(),s&&s.hide();return}o&&o.show(),s&&s.show();var c={};this.makeElOption(c,i,e,t,n);var l=c.graphicKey;l!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=l;var u=this._moveAnimation=this.determineAnimation(e,t);if(!o)o=this._group=new LO,this.createPointerEl(o,c,e,t),this.createLabelEl(o,c,e,t),n.getZr().add(o);else{var d=Eb(qW,t,u);this.updatePointerEl(o,c,d),this.updateLabelEl(o,c,d,t)}ZW(o,t,!0),this._renderHandle(i)}},e.prototype.remove=function(e){this.clear(e)},e.prototype.dispose=function(e){this.clear(e)},e.prototype.determineAnimation=function(e,t){var n=t.get(`animation`),r=e.axis,i=r.type===`category`,a=t.get(`snap`);if(!a&&!i)return!1;if(n===`auto`||n==null){var o=this.animationThreshold;if(i&&tI(r).w>o)return!0;if(a){var s=bV(e).seriesDataCount,c=r.getExtent();return Math.abs(c[0]-c[1])/s>o}return!1}return n===!0},e.prototype.makeElOption=function(e,t,n,r,i){},e.prototype.createPointerEl=function(e,t,n,r){var i=t.pointer;if(i){var a=UW(e).pointerEl=new joe[i.type](WW(t.pointer));e.add(a)}},e.prototype.createLabelEl=function(e,t,n,r){if(t.label){var i=UW(e).labelEl=new aD(WW(t.label));e.add(i),YW(i,r)}},e.prototype.updatePointerEl=function(e,t,n){var r=UW(e).pointerEl;r&&t.pointer&&(r.setStyle(t.pointer.style),n(r,{shape:t.pointer.shape}))},e.prototype.updateLabelEl=function(e,t,n,r){var i=UW(e).labelEl;i&&(i.setStyle(t.label.style),n(i,{x:t.label.x,y:t.label.y}),YW(i,r))},e.prototype._renderHandle=function(e){if(!this._dragging&&this.updateHandleTransform){var t=this._axisPointerModel,n=this._api.getZr(),r=this._handle,i=t.getModel(`handle`),a=t.get(`status`);if(!i.get(`show`)||!a||a===`hide`){r&&n.remove(r),this._handle=null;return}var o;this._handle||(o=!0,r=this._handle=Uk(i.get(`icon`),{cursor:`move`,draggable:!0,onmousemove:function(e){eL(e.event)},onmousedown:GW(this._onHandleDragMove,this,0,0),drift:GW(this._onHandleDragMove,this),ondragend:GW(this._onHandleDragEnd,this)}),n.add(r)),ZW(r,t,!1),r.setStyle(i.getItemStyle(null,[`color`,`borderColor`,`borderWidth`,`opacity`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`]));var s=i.get(`size`);G(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,CR(this,`_doDispatchAxisPointer`,i.get(`throttle`)||0,`fixRate`),this._moveHandleToValue(e,o)}},e.prototype._moveHandleToValue=function(e,t){qW(this._axisPointerModel,!t&&this._moveAnimation,this._handle,XW(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(e,t){var n=this._handle;if(n){this._dragging=!0;var r=this.updateHandleTransform(XW(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=r,n.stopAnimation(),n.attr(XW(r)),UW(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){if(this._handle){var e=this._payloadInfo,t=this._axisModel;this._api.dispatchAction({type:`updateAxisPointer`,x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,axesInfo:[{axisDim:t.axis.dim,axisIndex:t.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get(`value`);this._moveHandleToValue(e),this._api.dispatchAction({type:`hideTip`})}},e.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),n=this._group,r=this._handle;t&&n&&(this._lastGraphicKey=null,n&&t.remove(n),r&&t.remove(r),this._group=null,this._handle=null,this._payloadInfo=null),wR(this,`_doDispatchAxisPointer`)},e.prototype.doClear=function(){},e.prototype.buildLabel=function(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}},e}();function qW(e,t,n,r){JW(UW(n).lastProp,r)||(UW(n).lastProp=r,t?bk(n,r,e):(n.stopAnimation(),n.attr(r)))}function JW(e,t){if(jb(e)&&jb(t)){var n=!0;return W(t,function(t,r){n&&=JW(e[r],t)}),!!n}return e===t}function YW(e,t){e[t.get([`label`,`show`])?`show`:`hide`]()}function XW(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function ZW(e,t,n){var r=t.get(`z`),i=t.get(`zlevel`);e&&e.traverse(function(e){e.type!==`group`&&(r!=null&&(e.z=r),i!=null&&(e.zlevel=i),e.silent=n)})}function QW(e){var t=e.get(`type`),n=e.getModel(t+`Style`),r;return t===`line`?(r=n.getLineStyle(),r.fill=null):t===`shadow`&&(r=n.getAreaStyle(),r.stroke=null),r}function $W(e,t,n,r,i){var a=tG(n.get(`value`),t.axis,t.ecModel,n.get(`seriesDataIndices`),{precision:n.get([`label`,`precision`]),formatter:n.get([`label`,`formatter`])}),o=n.getModel(`label`),s=xj(o.get(`padding`)||0),c=o.getFont(),l=UC(a,c),u=i.position,d=l.width+s[1]+s[3],f=l.height+s[0]+s[2],p=i.align;p===`right`&&(u[0]-=d),p===`center`&&(u[0]-=d/2);var m=i.verticalAlign;m===`bottom`&&(u[1]-=f),m===`middle`&&(u[1]-=f/2),eG(u,d,f,r);var h=o.get(`backgroundColor`);(!h||h===`auto`)&&(h=t.get([`axisLine`,`lineStyle`,`color`])),e.label={x:u[0],y:u[1],style:fA(o,{text:a,font:c,fill:o.getTextColor(),padding:s,backgroundColor:h}),z2:10}}function eG(e,t,n,r){var i=r.getWidth(),a=r.getHeight();e[0]=Math.min(e[0]+t,i)-t,e[1]=Math.min(e[1]+n,a)-n,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function tG(e,t,n,r,i){e=t.scale.parse(e);var a=t.scale.getLabel({value:e},{precision:i.precision}),o=i.formatter;if(o){var s={value:uF(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};W(r,function(e){var t=n.getSeriesByIndex(e.seriesIndex),r=e.dataIndexInside,i=t&&t.getDataParams(r);i&&s.seriesData.push(i)}),Ob(o)?a=o.replace(`{value}`,a):Db(o)&&(a=o(s))}return a}function nG(e,t,n){var r=JS();return $S(r,r,n.rotation),QS(r,r,n.position),Rk([e.dataToCoord(t),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],r)}function rG(e,t,n,r,i,a){var o=_I.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=i.get([`label`,`margin`]),$W(t,r,i,a,{position:nG(r.axis,e,n),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function iG(e,t,n){return n||=0,{x1:e[n],y1:e[1-n],x2:t[n],y2:t[1-n]}}function aG(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}}function oG(e,t,n){return tI(e,{fromStat:{sers:bb(t,function(e){return n.getSeriesByIndex(e.seriesIndex)})},min:1}).w}function sG(e,t,n){return[rx(nx(t[0],t[1]),e-n/2),nx(e+n/2,rx(t[0],t[1]))]}var cG=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(e,t,n,r,i){var a=n.axis,o=a.grid,s=r.get(`type`),c=a.getGlobalExtent(),l=lG(o,a).getOtherAxis(a).getGlobalExtent(),u=a.toGlobalCoord(a.dataToCoord(t,!0));if(s&&s!==`none`){var d=QW(r),f=uG[s](a,u,c,l,r.get(`seriesDataIndices`),r.ecModel);f.style=d,e.graphicKey=f.type,e.pointer=f}rG(t,e,EI(o.getRect(),n),n,r,i)},t.prototype.getHandleTransform=function(e,t,n){var r=EI(t.axis.grid.getRect(),t,{labelInside:!1});r.labelMargin=n.get([`handle`,`margin`]);var i=nG(t.axis,e,r);return{x:i[0],y:i[1],rotation:r.rotation+(r.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(e,t,n,r){var i=n.axis,a=i.grid,o=i.getGlobalExtent(!0),s=lG(a,i).getOtherAxis(i).getGlobalExtent(),c=i.dim===`x`?0:1,l=[e.x,e.y];l[c]+=t[c],l[c]=nx(o[1],l[c]),l[c]=rx(o[0],l[c]);var u=(s[1]+s[0])/2,d=[u,u];return d[c]=l[c],{x:l[0],y:l[1],rotation:e.rotation,cursorPoint:d,tooltipOption:[{verticalAlign:`middle`},{align:`center`}][c]}},t}(KW);function lG(e,t){var n={};return n[t.dim+`AxisIndex`]=t.index,e.getCartesian(n)}var uG={line:function(e,t,n,r){return{type:`Line`,subPixelOptimize:!0,shape:iG([t,r[0]],[t,r[1]],dG(e))}},shadow:function(e,t,n,r,i,a){var o=oG(e,i,a),s=r[1]-r[0],c=sG(t,n,o),l=c[0],u=c[1];return{type:`Rect`,shape:aG([l,r[0]],[u-l,s],dG(e))}}};function dG(e){return e.dim===`x`?0:1}var fG=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`axisPointer`,t.defaultOption={show:`auto`,z:50,type:`line`,snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:K.color.border,width:1,type:`dashed`},shadowStyle:{color:K.color.shadowTint},label:{show:!0,formatter:null,precision:`auto`,margin:3,color:K.color.neutral00,padding:[5,7,5,7],backgroundColor:K.color.accent60,borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:`M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z`,size:45,margin:50,color:K.color.accent40,throttle:40}},t}(Wj),pG=dS(),mG=W;function hG(e,t,n){if(!$b.node){var r=t.getZr();pG(r).records||(pG(r).records={}),gG(r,t);var i=pG(r).records[e]||(pG(r).records[e]={});i.handler=n}}function gG(e,t){if(pG(e).initialized)return;pG(e).initialized=!0,n(`click`,Eb(yG,`click`)),n(`mousemove`,Eb(yG,`mousemove`)),n(`mousewheel`,Eb(yG,`mousewheel`)),n(`globalout`,vG);function n(n,r){e.on(n,function(n){var i=bG(t);mG(pG(e).records,function(e){e&&r(e,n,i.dispatchAction)}),_G(i.pendings,t)})}}function _G(e,t){var n=e.showTip.length,r=e.hideTip.length,i;n?i=e.showTip[n-1]:r&&(i=e.hideTip[r-1]),i&&(i.dispatchAction=null,t.dispatchAction(i))}function vG(e,t,n){e.handler(`leave`,null,n)}function yG(e,t,n,r){t.handler(e,n,r)}function bG(e){var t={showTip:[],hideTip:[]},n=function(r){var i=t[r.type];i?i.push(r):(r.dispatchAction=n,e.dispatchAction(r))};return{dispatchAction:n,pendings:t}}function xG(e,t){if(!$b.node){var n=t.getZr();(pG(n).records||{})[e]&&(pG(n).records[e]=null)}}var SG=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r=t.getComponent(`tooltip`),i=e.get(`triggerOn`)||r&&r.get(`triggerOn`)||`mousemove|click|mousewheel`;hG(`axisPointer`,n,function(e,t,n){i!==`none`&&(e===`leave`||i.indexOf(e)>=0)&&n({type:`updateAxisPointer`,currTrigger:e,x:t&&t.offsetX,y:t&&t.offsetY})})},t.prototype.remove=function(e,t){xG(`axisPointer`,t)},t.prototype.dispose=function(e,t){xG(`axisPointer`,t)},t.type=`axisPointer`,t}(pR);function CG(e,t){var n=[],r=e.seriesIndex,i;if(r==null||!(i=t.getSeriesByIndex(r)))return{point:[]};var a=i.getData(),o=uS(a,e);if(o==null||o<0||G(o))return{point:[]};var s=a.getItemGraphicEl(o),c=i.coordinateSystem;if(i.getTooltipPosition)n=i.getTooltipPosition(o)||[];else if(c&&c.dataToPoint){if(e.isStacked){var l=c.getBaseAxis(),u=c.getOtherAxis(l).dim,d=l.dim,f=+(u===`x`||u===`radius`),p=a.mapDimension(d),m=[];m[f]=a.get(p,o),m[1-f]=a.get(a.getCalculationInfo(`stackResultDimension`),o),n=c.dataToPoint(m)||[]}else n=c.dataToPoint(a.getValues(bb(c.dimensions,function(e){return a.mapDimension(e)}),o))||[]}else if(s){var h=s.getBoundingRect().clone();h.applyTransform(s.transform),n=[h.x+h.width/2,h.y+h.height/2]}return{point:n,el:s}}var wG=dS();function TG(e,t,n){var r=e.currTrigger,i=[e.x,e.y],a=e,o=e.dispatchAction||Tb(n.dispatchAction,n),s=t.getComponent(`axisPointer`).coordSysAxesInfo;if(s){FG(i)&&(i=CG({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},t).point);var c=FG(i),l=a.axesInfo,u=s.axesInfo,d=r===`leave`||FG(i),f={},p={},m={list:[],map:{}},h={showPointer:Eb(OG,p),showTooltip:Eb(kG,m)};W(s.coordSysMap,function(e,t){var n=c||e.containPoint(i);W(s.coordSysAxesInfo[t],function(e,t){var r=e.axis,a=NG(l,e);if(!d&&n&&(!l||a)){var o=a&&a.value;o==null&&!c&&(o=r.pointToData(i)),o!=null&&EG(e,o,h,!1,f)}})});var g={};return W(u,function(e,t){var n=e.linkGroup;n&&!p[t]&&W(n.axesInfo,function(t,r){var i=p[r];if(t!==e&&i){var a=i.value;n.mapper&&(a=e.axis.scale.parse(n.mapper(a,PG(t),PG(e)))),g[e.key]=a}})}),W(g,function(e,t){EG(u[t],e,h,!0,f)}),AG(p,u,f),jG(m,i,e,o),MG(u,o,n),f}}function EG(e,t,n,r,i){var a=e.axis;if(!a.scale.isBlank()&&a.containData(t)){if(!e.involveSeries){n.showPointer(e,t);return}var o=DG(t,e),s=o.payloadBatch,c=o.snapToValue;s[0]&&i.seriesIndex==null&&U(i,s[0]),!r&&e.snap&&a.containData(c)&&c!=null&&(t=c),n.showPointer(e,t,s),n.showTooltip(e,o,c)}}function DG(e,t){var n=t.axis,r=n.dim,i=e,a=[],o=Number.MAX_VALUE,s=-1;return W(t.seriesModels,function(t,c){var l=t.getData().mapDimensionsAll(r),u,d;if(t.getAxisTooltipData){var f=t.getAxisTooltipData(l,e,n);d=f.dataIndices,u=f.nestestValue}else{if(d=t.indicesOfNearest(r,l[0],e,n.type===`category`?.5:null),!d.length)return;u=t.getData().get(l[0],d[0])}if(Nx(u)){var p=e-u,m=Math.abs(p);m<=o&&((m=0&&s<0)&&(o=m,s=p,i=u,a.length=0),W(d,function(e){a.push({seriesIndex:t.seriesIndex,dataIndexInside:e,dataIndex:t.getData().getRawIndex(e)})}))}}),{payloadBatch:a,snapToValue:i}}function OG(e,t,n,r){e[t.key]={value:n,payloadBatch:r}}function kG(e,t,n,r){var i=n.payloadBatch,a=t.axis,o=a.model,s=t.axisPointerModel;if(t.triggerTooltip&&i.length){var c=t.coordSys.model,l=SV(c),u=e.map[l];u||(u=e.map[l]={coordSysId:c.id,coordSysIndex:c.componentIndex,coordSysType:c.type,coordSysMainType:c.mainType,dataByAxis:[]},e.list.push(u)),u.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:r,valueLabelOpt:{precision:s.get([`label`,`precision`]),formatter:s.get([`label`,`formatter`])},seriesDataIndices:i.slice()})}}function AG(e,t,n){var r=n.axesInfo=[];W(t,function(t,n){var i=t.axisPointerModel.option,a=e[n];a?(!t.useHandle&&(i.status=`show`),i.value=a.value,i.seriesDataIndices=(a.payloadBatch||[]).slice()):!t.useHandle&&(i.status=`hide`),i.status===`show`&&r.push({axisDim:t.axis.dim,axisIndex:t.axis.model.componentIndex,value:i.value})})}function jG(e,t,n,r){if(FG(t)||!e.list.length){r({type:`hideTip`});return}var i=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};r({type:`showTip`,escapeConnect:!0,x:t[0],y:t[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:i.dataIndexInside,dataIndex:i.dataIndex,seriesIndex:i.seriesIndex,dataByCoordSys:e.list})}function MG(e,t,n){var r=n.getZr(),i=`axisPointerLastHighlights`,a=wG(r)[i]||{},o=wG(r)[i]={};W(e,function(e,t){var n=e.axisPointerModel.option;n.status===`show`&&e.triggerEmphasis&&W(n.seriesDataIndices,function(e){o[e.seriesIndex+`|`+e.dataIndex]=e})});var s=[],c=[];function l(e){return{seriesIndex:e.seriesIndex,dataIndex:e.dataIndex}}W(a,function(e,t){!o[t]&&c.push(l(e))}),W(o,function(e,t){!a[t]&&s.push(l(e))}),c.length&&n.dispatchAction({type:`downplay`,escapeConnect:!0,notBlur:!0,batch:c}),s.length&&n.dispatchAction({type:`highlight`,escapeConnect:!0,notBlur:!0,batch:s})}function NG(e,t){for(var n=0;n<(e||[]).length;n++){var r=e[n];if(t.axis.dim===r.axisDim&&t.axis.model.componentIndex===r.axisIndex)return r}}function PG(e){var t=e.axis.model,n={},r=n.axisDim=e.axis.dim;return n.axisIndex=n[r+`AxisIndex`]=t.componentIndex,n.axisName=n[r+`AxisName`]=t.name,n.axisId=n[r+`AxisId`]=t.id,n}function FG(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function IG(e){wV.registerAxisPointerClass(`CartesianAxisPointer`,cG),e.registerComponentModel(fG),e.registerComponentView(SG),e.registerPreprocessor(function(e){if(e){(!e.axisPointer||e.axisPointer.length===0)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!G(t)&&(e.axisPointer.link=[t])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,{overallReset:function(e,t){e.getComponent(`axisPointer`).coordSysAxesInfo=tpe(e,t)}}),e.registerAction({type:`updateAxisPointer`,event:`updateAxisPointer`,update:`:updateAxisPointer`},TG)}function LG(e){IB(kV),IB(IG)}function RG(e,t){var n=e.existing;if(t.id=e.keyInfo.id,!t.type&&n&&(t.type=n.type),t.parentId==null){var r=t.parentOption;r?t.parentId=r.id:n&&(t.parentId=n.parentId)}t.parentOption=null}function zG(e,t){var n;return W(t,function(t){e[t]!=null&&e[t]!==`auto`&&(n=!0)}),n}function BG(e,t,n){var r=U({},n),i=e[t],a=n.$action||`merge`;a===`merge`?i?(hb(i,r,!0),Vj(i,r,{ignoreSize:!0}),Uj(n,i),UG(n,i),UG(n,i,`shape`),UG(n,i,`style`),UG(n,i,`extra`),n.clipPath=i.clipPath):e[t]=r:a===`replace`?e[t]=r:a===`remove`&&i&&(e[t]=null)}var VG=[`transition`,`enterFrom`,`leaveTo`],HG=VG.concat([`enterAnimation`,`updateAnimation`,`leaveAnimation`]);function UG(e,t,n){if(n&&(!e[n]&&t[n]&&(e[n]={}),e=e[n],t=t[n]),e&&t)for(var r=n?VG:HG,i=0;i=0;c--){var l=n[c],u=rS(l.id,null),d=u==null?null:i.get(u);if(d){var f=d.parent,h=qG(f),g=f===r?{width:a,height:o}:{width:h.width,height:h.height},_={},v=zj(d,l,g,null,{hv:l.hv,boundingMode:l.bounding},_);if(!qG(d).isNew&&v){for(var y=l.transition,b={},x=0;x=0)?b[S]=C:d[S]=C}bk(d,b,e,0)}else d.attr(_)}}},t.prototype._clear=function(){var e=this,t=this._elMap;t.each(function(n){ZG(n,qG(n).option,t,e._lastGraphicModel)}),this._elMap=Jb()},t.prototype.dispose=function(){this._clear()},t.type=`graphic`,t}(pR);function YG(e){var t=new(Zb(KG,e)?KG[e]:jk(e))({});return qG(t).type=e,t}function XG(e,t,n,r){var i=YG(n);return t.add(i),r.set(e,i),qG(i).id=e,qG(i).isNew=!0,i}function ZG(e,t,n,r){e&&e.parent&&(e.type===`group`&&e.traverse(function(e){ZG(e,t,n,r)}),nW(e,t,r),n.removeKey(qG(e).id))}function QG(e,t,n,r){e.isGroup||W([[`cursor`,XT.prototype.cursor],[`zlevel`,r||0],[`z`,n||0],[`z2`,0]],function(n){var r=n[0];Zb(t,r)?e[r]=Rb(t[r],n[1]):e[r]??(e[r]=n[1])}),W(wb(t),function(n){if(n.indexOf(`on`)===0){var r=t[n];e[n]=Db(r)?r:null}}),Zb(t,`draggable`)&&(e.draggable=t.draggable),t.name!=null&&(e.name=t.name),t.id!=null&&(e.id=t.id)}function $G(e){return e=U({},e),W([`id`,`parentId`,`$action`,`hv`,`bounding`,`textContent`,`clipPath`].concat(Mj),function(t){delete e[t]}),e}function eK(e,t,n){var r=yD(e).eventData;!e.silent&&!e.ignore&&!r&&(r=yD(e).eventData={componentType:`graphic`,componentIndex:t.componentIndex,name:e.name}),r&&(r.info=n.info)}function tK(e){e.registerComponentModel(GG),e.registerComponentView(JG),e.registerPreprocessor(function(e){var t=e.graphic;G(t)?e.graphic=!t[0]||!t[0].elements?[{elements:t}]:[e.graphic[0]]:t&&!t.elements&&(e.graphic=[{elements:[t]}])})}var nK=[`x`,`y`,`radius`,`angle`,`single`],rK=dS(),iK=[`cartesian2d`,`polar`,`singleAxis`];function aK(e){return _b(iK,e.get(`coordinateSystem`))>=0}function oK(e){return e+`Axis`}function sK(e,t){var n=Jb(),r=[],i=Jb();e.eachComponent({mainType:`dataZoom`,query:t},function(e){i.get(e.uid)||s(e)});var a;do a=!1,e.eachComponent(`dataZoom`,o);while(a);function o(e){!i.get(e.uid)&&c(e)&&(s(e),a=!0)}function s(e){i.set(e.uid,!0),r.push(e),l(e)}function c(e){var t=!1;return e.eachTargetAxis(function(e,r){var i=n.get(e);i&&i[r]&&(t=!0)}),t}function l(e){e.eachTargetAxis(function(e,t){(n.get(e)||n.set(e,[]))[t]=!0})}return r}function cK(e){var t=e.ecModel,n={infoList:[],infoMap:Jb()};return e.eachTargetAxis(function(e,r){var i=t.getComponent(oK(e),r);if(i){var a=i.getCoordSysModel();if(a){var o=a.uid,s=n.infoMap.get(o);s||(s={model:a,axisModels:[]},n.infoList.push(s),n.infoMap.set(o,s)),s.axisModels.push(i)}}}),n}function lK(e){var t=rK(HF(e));return t.axisProxyMap||=Jb()}function uK(e){if(e)return lK(e.ecModel).get(e.uid)}function dK(e,t){lK(e.ecModel).set(e.uid,t)}function fK(e,t){var n=t.getAxisModel().axis.__alignTo;return n&&e.getAxisProxy(n.dim,n.model.componentIndex)?uK(n.model):null}var pK=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},e}(),mK=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=[`percent`,`percent`],n}return t.prototype.init=function(e,t,n){var r=hK(e);this.settledOption=r,this.mergeDefaultAndTheme(e,n),this._doInit(r)},t.prototype.mergeOption=function(e){var t=hK(e);hb(this.option,e,!0),hb(this.settledOption,t,!0),this._doInit(t)},t.prototype._doInit=function(e){var t=this.option;this._setDefaultThrottle(e),this._updateRangeUse(e);var n=this.settledOption;W([[`start`,`startValue`],[`end`,`endValue`]],function(e,r){this._rangePropMode[r]===`value`&&(t[e[0]]=n[e[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var e=this.get(`orient`,!0),t=this._targetAxisInfoMap=Jb();this._fillSpecifiedTargetAxis(t)?this._orient=e||this._makeAutoOrientByTargetAxis():(this._orient=e||`horizontal`,this._fillAutoTargetAxisByOrient(t,this._orient)),this._noTarget=!0,t.each(function(e){e.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(e){var t=!1;return W(nK,function(n){var r=this.getReferringComponents(oK(n),gS);if(r.specified){t=!0;var i=new pK;W(r.models,function(e){i.add(e.componentIndex)}),e.set(n,i)}},this),t},t.prototype._fillAutoTargetAxisByOrient=function(e,t){var n=this.ecModel,r=!0;if(r){var i=t===`vertical`?`y`:`x`,a=n.findComponents({mainType:i+`Axis`});o(a,i)}if(r){var a=n.findComponents({mainType:`singleAxis`,filter:function(e){return e.get(`orient`,!0)===t}});o(a,`single`)}function o(t,n){var i=t[0];if(i){var a=new pK;if(a.add(i.componentIndex),e.set(n,a),r=!1,n===`x`||n===`y`){var o=i.getReferringComponents(`grid`,hS).models[0];o&&W(t,function(e){i.componentIndex!==e.componentIndex&&o===e.getReferringComponents(`grid`,hS).models[0]&&a.add(e.componentIndex)})}}}r&&W(nK,function(t){if(r){var i=n.findComponents({mainType:oK(t),filter:function(e){return e.get(`type`,!0)===`category`}});if(i[0]){var a=new pK;a.add(i[0].componentIndex),e.set(t,a),r=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var e;return this.eachTargetAxis(function(t){!e&&(e=t)},this),e===`y`?`vertical`:`horizontal`},t.prototype._setDefaultThrottle=function(e){if(e.hasOwnProperty(`throttle`)&&(this._autoThrottle=!1),this._autoThrottle){var t=this.ecModel.option;this.option.throttle=t.animation&&t.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(e){var t=this._rangePropMode,n=this.get(`rangeMode`);W([[`start`,`startValue`],[`end`,`endValue`]],function(r,i){var a=e[r[0]]!=null,o=e[r[1]]!=null;a&&!o?t[i]=`percent`:!a&&o?t[i]=`value`:n?t[i]=n[i]:a&&(t[i]=`percent`)})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var e;return this.eachTargetAxis(function(t,n){e??=this.ecModel.getComponent(oK(t),n)},this),e},t.prototype.eachTargetAxis=function(e,t){this._targetAxisInfoMap.each(function(n,r){W(n.indexList,function(n){e.call(t,r,n)})})},t.prototype.getAxisProxy=function(e,t){return uK(this.getAxisModel(e,t))},t.prototype.getAxisModel=function(e,t){var n=this._targetAxisInfoMap.get(e);if(n&&n.indexMap[t])return this.ecModel.getComponent(oK(e),t)},t.prototype.setRawRange=function(e){var t=this.option,n=this.settledOption;W([[`start`,`startValue`],[`end`,`endValue`]],function(r){(e[r[0]]!=null||e[r[1]]!=null)&&(t[r[0]]=n[r[0]]=e[r[0]],t[r[1]]=n[r[1]]=e[r[1]])},this),this._updateRangeUse(e)},t.prototype.setCalculatedRange=function(e){var t=this.option;W([`start`,`startValue`,`end`,`endValue`],function(n){t[n]=e[n]})},t.prototype.getPercentRange=function(){var e=this.findRepresentativeAxisProxy();if(e)return e.getWindow().percent},t.prototype.getValueRange=function(e,t){if(e==null&&t==null){var n=this.findRepresentativeAxisProxy();if(n)return n.getWindow().value}else return this.getAxisProxy(e,t).getWindow().value},t.prototype.findRepresentativeAxisProxy=function(e){if(e)return uK(e);for(var t,n=this._targetAxisInfoMap.keys(),r=0;ra[1];if(u&&!d&&!f)return!0;u&&(i=!0),d&&(t=!0),f&&(n=!0)}return i&&t&&n})}else W(r,function(n){if(i===`empty`)e.setData(t=t.map(n,function(e){return o(e)?e:NaN}));else{var r={};r[n]=a,t.selectRange(r)}});W(r,function(e){t.setApproximateExtent(a,e)})}});function o(e){return e>=a[0]&&e<=a[1]}},e.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,n=this._extent;W([`min`,`max`],function(r){var i=t.get(r+`Span`),a=t.get(r+`ValueSpan`);a!=null&&(a=this.getAxisModel().axis.scale.parse(a)),a==null?i!=null&&(a=dx(i,[0,100],n,!0)-n[0]):i=dx(n[0]+a,n,[0,100],!0),e[r+`Span`]=i,e[r+`ValueSpan`]=a},this)},e}(),bK={dirtyOnOverallProgress:!0,getTargetSeries:function(e){function t(t){e.eachComponent(`dataZoom`,function(n){n.eachTargetAxis(function(r,i){t(r,i,e.getComponent(oK(r),i),n)})})}var n=[];t(function(t,r,i,a){if(!uK(i)){var o=new yK(t,r,a,e);n.push(o),dK(i,o)}});var r=Jb();return W(n,function(e){W(e.getTargetSeriesModels(),function(e){r.set(e.uid,e)})}),r},overallReset:function(e,t){e.eachComponent(`dataZoom`,function(e){var n=[];e.eachTargetAxis(function(t,r){var i=e.getAxisProxy(t,r),a=fK(e,i);a?n.push([i,a]):i.reset(e,null)}),W(n,function(t){t[0].reset(e,t[1].getWindow().percentInverted)}),e.eachTargetAxis(function(n,r){e.getAxisProxy(n,r).filterData(e,t)})}),e.eachComponent(`dataZoom`,function(e){var t=e.findRepresentativeAxisProxy();if(t){var n=t.getWindow(),r=n.percent,i=n.value;e.setCalculatedRange({start:r[0],end:r[1],startValue:i[0],endValue:i[1]})}})}};function xK(e){e.registerAction(`dataZoom`,function(e,t){W(sK(t,e),function(t){t.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var SK=AS();function CK(e){SK(e,function(){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,bK),xK(e),e.registerSubTypeDefaulter(`dataZoom`,function(){return`slider`})})}function wK(e){e.registerComponentModel(gK),e.registerComponentView(vK),CK(e)}var TK=function(){function e(){}return e}(),EK={};function DK(e,t){EK[e]=t}function OK(e){return EK[e]}var kK=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(t,n,r){var i=r.getTheme().get(`toolbox`),a=i?i.feature:null;a&&(this._themeFeatureOption=U({},a),i.feature={}),e.prototype.init.call(this,t,n,r),a&&(i.feature=a)},t.prototype.optionUpdated=function(){W(this.option.feature,function(e,t){var n=this._themeFeatureOption,r=OK(t);r&&(r.getDefaultOption&&(r.defaultOption=r.getDefaultOption(this.ecModel)),n&&n[t]&&(hb(e,n[t]),n[t]=null),hb(e,r.defaultOption))},this)},t.type=`toolbox`,t.layoutMode={type:`box`,ignoreSize:!0},t.defaultOption={show:!0,z:6,orient:`horizontal`,left:`right`,top:`top`,backgroundColor:`transparent`,borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:K.size.m,itemSize:15,itemGap:K.size.s,showTitle:!0,iconStyle:{borderColor:K.color.accent50,color:`none`},emphasis:{iconStyle:{borderColor:K.color.accent70}},tooltip:{show:!1,position:`bottom`}},t}(Wj);function AK(e,t){var n=xj(t.get(`padding`)),r=t.getItemStyle([`color`,`opacity`]);return r.fill=t.get(`backgroundColor`),new eD({shape:{x:e.x-n[3],y:e.y-n[0],width:e.width+n[1]+n[3],height:e.height+n[0]+n[2],r:t.get(`borderRadius`)},style:r,silent:!0,z2:-1})}var jK=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(e,t,n,r){var i=this.group;if(i.removeAll(),!e.get(`show`))return;var a=+e.get(`itemSize`),o=e.get(`orient`)===`vertical`,s=e.get(`feature`)||{},c=this._features||=Jb(),l=[];W(s,function(e,t){l.push(t)}),new lN(this._featureNames||[],l).add(u).update(u).remove(Eb(u,null)).execute(),this._featureNames=Sb(l,function(e){return c.hasKey(e)});function u(i,a){var o=i!=null&&a==null,u=i!=null&&a!=null,f=i==null,p=o||u?l[i]:l[a],m=s[p],h=o||u?new TA(m,e,t):null,g=h&&h.get(`show`),_;if(o){if(!g)return;if(MK(p))_={onclick:h.option.onclick,featureName:p};else{var v=OK(p);if(!v)return;_=new v}c.set(p,_)}else _=c.get(p);if(f||!g){NK(_)&&_.dispose&&_.dispose(t,n),c.removeKey(p);return}r&&r.newTitle!=null&&r.featureName===p&&(m.title=r.newTitle),o&&(_.uid=EA(`toolbox-feature`)),_.model=h,_.ecModel=t,_.api=n,d(h,_,p),h.setIconStatus=function(e,t){var n=this.option,r=this.iconPaths;n.iconStatus=n.iconStatus||{},n.iconStatus[e]=t,r[e]&&(t===`emphasis`?iO:aO)(r[e])},NK(_)&&_.render&&_.render(h,t,n,r)}function d(r,s,c){var l=r.getModel(`iconStyle`),u=r.getModel([`emphasis`,`iconStyle`]),d=s instanceof TK&&s.getIcons?s.getIcons():r.get(`icon`),f=r.get(`title`)||{},p,m;Ob(d)?(p={},p[c]=d):p=d,Ob(f)?(m={},m[c]=f):m=f;var h=r.iconPaths={};W(p,function(c,d){var f=Uk(c,{},{x:-a/2,y:-a/2,width:a,height:a});f.setStyle(l.getItemStyle());var p=f.ensureState(`emphasis`);p.style=u.getItemStyle();var g=new aD({style:{text:m[d],align:u.get(`textAlign`),borderRadius:u.get(`textBorderRadius`),padding:u.get(`textPadding`),fill:null,font:vA({fontStyle:u.get(`textFontStyle`),fontFamily:u.get(`textFontFamily`),fontSize:u.get(`textFontSize`),fontWeight:u.get(`textFontWeight`)},t)},ignore:!0});f.setTextContent(g),Xk({el:f,componentModel:e,itemName:d,formatterParamsExtra:{title:m[d]}}),f.__title=m[d],f.on(`mouseover`,function(){var t=u.getItemStyle(),r=o?e.get(`right`)==null&&e.get(`left`)!==`right`?`right`:`left`:e.get(`bottom`)==null&&e.get(`top`)!==`bottom`?`bottom`:`top`;g.setStyle({fill:u.get(`textFill`)||t.fill||t.stroke||K.color.neutral99,backgroundColor:u.get(`textBackgroundColor`)}),f.setTextConfig({position:u.get(`textPosition`)||r}),g.ignore=!e.get(`showTitle`),n.enterEmphasis(this)}).on(`mouseout`,function(){r.get([`iconStatus`,d])!==`emphasis`&&n.leaveEmphasis(this),g.hide()}),(r.get([`iconStatus`,d])===`emphasis`?iO:aO)(f),i.add(f),f.on(`click`,Tb(s.onclick,s,t,n,d)),h[d]=f})}var f=Rj(e,n).refContainer,p=e.getBoxLayoutParams(),m=e.get(`padding`),h=Ij(p,f,m);Fj(e.get(`orient`),i,e.get(`itemGap`),h.width,h.height),zj(i,p,f,m),i.add(AK(i.getBoundingRect(),e)),o||i.eachChild(function(e){var t=e.__title,r=e.ensureState(`emphasis`),o=r.textConfig||={},s=e.getTextContent(),c=s&&s.ensureState(`emphasis`);if(c&&!Db(c)&&t){var l=c.style||={},u=UC(t,aD.makeFont(l)),d=e.x+i.x,f=e.y+i.y+a,p=!1;f+u.height>n.getHeight()&&(o.position=`top`,p=!0);var m=p?-5-u.height:a+10;d+u.width/2>n.getWidth()?(o.position=[`100%`,m],l.align=`right`):d-u.width/2<0&&(o.position=[0,m],l.align=`left`)}})},t.prototype.updateView=function(e,t,n,r){W(this._features,function(e){e&&e instanceof TK&&e.updateView&&e.updateView(e.model,t,n,r)})},t.prototype.dispose=function(e,t){W(this._features,function(n){n&&n instanceof TK&&n.dispose&&n.dispose(e,t)})},t.type=`toolbox`,t}(pR);function MK(e){return e.indexOf(`my`)===0}function NK(e){return e instanceof TK}var PK=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(e,t){var n=this.model,r=n.get(`name`)||e.get(`title.0.text`)||`echarts`,i=t.getZr().painter.getType()===`svg`,a=i?`svg`:n.get(`type`,!0)||`png`,o=t.getConnectedDataURL({type:a,backgroundColor:n.get(`backgroundColor`,!0)||e.get(`backgroundColor`)||K.color.neutral00,connectedBackgroundColor:n.get(`connectedBackgroundColor`),excludeComponents:n.get(`excludeComponents`),pixelRatio:n.get(`pixelRatio`)}),s=$b.browser;if(typeof MouseEvent==`function`&&(s.newEdge||!s.ie&&!s.edge)){var c=document.createElement(`a`);c.download=r+`.`+a,c.target=`_blank`,c.href=o;var l=new MouseEvent(`click`,{view:document.defaultView,bubbles:!0,cancelable:!1});c.dispatchEvent(l)}else if(window.navigator.msSaveOrOpenBlob||i){var u=o.split(`,`),d=u[0].indexOf(`base64`)>-1,f=i?decodeURIComponent(u[1]):u[1];d&&(f=window.atob(f));var p=r+`.`+a;if(window.navigator.msSaveOrOpenBlob){for(var m=f.length,h=new Uint8Array(m);m--;)h[m]=f.charCodeAt(m);var g=new Blob([h]);window.navigator.msSaveOrOpenBlob(g,p)}else{var _=document.createElement(`iframe`);document.body.appendChild(_);var v=_.contentWindow,y=v.document;y.open(`image/svg+xml`,`replace`),y.write(f),y.close(),v.focus(),y.execCommand(`SaveAs`,!0,p),document.body.removeChild(_)}}else{var b=n.get(`lang`),x=``,S=window.open();S.document.write(x),S.document.title=r}},t.getDefaultOption=function(e){return{show:!0,icon:`M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0`,title:e.getLocaleModel().get([`toolbox`,`saveAsImage`,`title`]),type:`png`,connectedBackgroundColor:K.color.neutral00,name:``,excludeComponents:[`toolbox`],lang:e.getLocaleModel().get([`toolbox`,`saveAsImage`,`lang`])}},t}(TK),FK=`__ec_magicType_stack__`,IK=[[`line`,`bar`],[`stack`]],LK=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getIcons=function(){var e=this.model,t=e.get(`icon`),n={};return W(e.get(`type`),function(e){t[e]&&(n[e]=t[e])}),n},t.getDefaultOption=function(e){return{show:!0,type:[],icon:{line:`M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4`,bar:`M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7`,stack:`M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z`},title:e.getLocaleModel().get([`toolbox`,`magicType`,`title`]),option:{},seriesIndex:{}}},t.prototype.onclick=function(e,t,n){var r=this.model,i=r.get([`seriesIndex`,n]);if(RK[n]){var a={series:[]};W(IK,function(e){_b(e,n)>=0&&W(e,function(e){r.setIconStatus(e,`normal`)})}),r.setIconStatus(n,`emphasis`),e.eachComponent({mainType:`series`,query:i==null?null:{seriesIndex:i}},function(e){var t=e.subType,i=e.id,o=RK[n](t,i,e,r);o&&(gb(o,e.option),a.series.push(o));var s=e.coordinateSystem;if(s&&s.type===`cartesian2d`&&(n===`line`||n===`bar`)){var c=s.getAxesByScale(`ordinal`)[0];if(c){var l=c.dim+`Axis`,u=e.getReferringComponents(l,hS).models[0].componentIndex;a[l]=a[l]||[];for(var d=0;d<=u;d++)a[l][u]=a[l][u]||{};a[l][u].boundaryGap=n===`bar`}}});var o,s=n;n===`stack`&&(o=hb({stack:r.option.title.tiled,tiled:r.option.title.stack},r.option.title),r.get([`iconStatus`,n])!==`emphasis`&&(s=`tiled`)),t.dispatchAction({type:`changeMagicType`,currentType:s,newOption:a,newTitle:o,featureName:`magicType`})}},t}(TK),RK={line:function(e,t,n,r){if(e===`bar`)return hb({id:t,type:`line`,data:n.get(`data`),stack:n.get(`stack`),markPoint:n.get(`markPoint`),markLine:n.get(`markLine`)},r.get([`option`,`line`])||{},!0)},bar:function(e,t,n,r){if(e===`line`)return hb({id:t,type:`bar`,data:n.get(`data`),stack:n.get(`stack`),markPoint:n.get(`markPoint`),markLine:n.get(`markLine`)},r.get([`option`,`bar`])||{},!0)},stack:function(e,t,n,r){var i=n.get(`stack`)===FK;if(e===`line`||e===`bar`)return r.setIconStatus(`stack`,i?`normal`:`emphasis`),hb({id:t,stack:i?``:FK},r.get([`option`,`stack`])||{},!0)}};kB({type:`changeMagicType`,event:`magicTypeChanged`,update:`prepareAndUpdate`},function(e,t){t.mergeOption(e.newOption)});var zK=Array(60).join(`-`),BK=` `;function VK(e){var t={},n=[],r=[];return e.eachRawSeries(function(e){var i=e.coordinateSystem;if(i&&(i.type===`cartesian2d`||i.type===`polar`)){var a=i.getBaseAxis();if(a.type===`category`){var o=Ble(a);t[o]||(t[o]={categoryAxis:a,valueAxis:i.getOtherAxis(a),series:[]},r.push({axisDim:a.dim,axisIndex:a.index})),t[o].series.push(e)}else n.push(e)}else n.push(e)}),{seriesGroupByCategoryAxis:t,other:n,meta:r}}function HK(e){var t=[];return W(e,function(e,n){var r=e.categoryAxis,i=e.valueAxis.dim,a=[` `].concat(bb(e.series,function(e){return e.name})),o=[r.model.getCategories()];W(e.series,function(e){var t=e.getRawData();o.push(e.getRawData().mapArray(t.mapDimension(i),function(e){return e}))});for(var s=[a.join(BK)],c=0;c1||n>0&&!e.noHeader;return W(e.blocks,function(e){var n=YM(e);n>=t&&(t=n+ +(r&&(!n||qM(e)&&!e.noHeader)))}),t}return 0}function pce(e,t,n,r){var i=t.noHeader,a=hce(YM(t)),o=[],s=t.blocks||[];Hb(!s||G(s)),s||=[];var c=e.orderMode;if(t.sortBlocks&&c){s=s.slice();var l={valueAsc:`asc`,valueDesc:`desc`};if(Zb(l,c)){var u=new Xse(l[c],null);s.sort(function(e,t){return u.evaluate(e.sortParam,t.sortParam)})}else c===`seriesDesc`&&s.reverse()}W(s,function(n,i){var s=t.valueFormatter,c=JM(n)(s?U(U({},e),{valueFormatter:s}):e,n,i>0?a.html:0,r);c!=null&&o.push(c)});var d=e.renderMode===`richText`?o.join(a.richText):ZM(r,o.join(``),i?n:a.html);if(i)return d;var f=Sj(t.header,`ordinal`,e.useUTC),p=GM(r,e.renderMode).nameStyle,m=WM(r);return e.renderMode===`richText`?QM(e,f,p)+a.richText+d:ZM(r,`
`+PA(f)+`
`+d,n)}function mce(e,t,n,r){var i=e.renderMode,a=t.noName,o=t.noValue,s=!t.markerType,c=t.name,l=e.useUTC,u=t.valueFormatter||e.valueFormatter||function(e){return e=G(e)?e:[e],bb(e,function(e,t){return Sj(e,G(p)?p[t]:p,l)})};if(!(a&&o)){var d=s?``:e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||K.color.secondary,i),f=a?``:Sj(c,`ordinal`,l),p=t.valueType,m=o?[]:u(t.value,t.rawDataIndex),h=!s||!a,g=!s&&a,_=GM(r,i),v=_.nameStyle,y=_.valueStyle;return i===`richText`?(s?``:d)+(a?``:QM(e,f,v))+(o?``:vce(e,m,h,g,y)):ZM(r,(s?``:d)+(a?``:gce(f,!s,v))+(o?``:_ce(m,h,g,y)),n)}}function XM(e,t,n,r,i,a){if(e)return JM(e)({useUTC:i,renderMode:n,orderMode:r,markupStyleCreator:t,valueFormatter:e.valueFormatter},e,0,a)}function hce(e){return{html:dce[e],richText:fce[e]}}function ZM(e,t,n){var r=`
`,i=`margin: `+n+`px 0 0`,a=WM(e);return`
`+t+r+`
`}function gce(e,t,n){var r=t?`margin-left:2px`:``;return``+PA(e)+``}function _ce(e,t,n,r){var i=t?`float:right;margin-left:`+(n?`10px`:`20px`):``;return e=G(e)?e:[e],``+bb(e,function(e){return PA(e)}).join(`  `)+``}function QM(e,t,n){return e.markupStyleCreator.wrapRichTextStyle(t,n)}function vce(e,t,n,r,i){var a=[i],o=r?10:20;return n&&a.push({padding:[0,0,0,o],align:`right`}),e.markupStyleCreator.wrapRichTextStyle(G(t)?t.join(` `):t,a)}function yce(e,t){var n=e.getData().getItemVisual(t,`style`)[e.visualDrawType];return Ej(n)}function $M(e,t){return e.get(`padding`)??(t===`richText`?[8,10]:10)}var eN=function(){function e(){this.richTextStyles={},this._nextStyleNameId=Ax()}return e.prototype._generateStyleName=function(){return`__EC_aUTo_`+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(e,t,n){var r=n===`richText`?this._generateStyleName():null,i=Ese({color:t,type:e,renderMode:n,markerId:r});return Ob(i)?i:(this.richTextStyles[r]=i.style,i.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};G(t)?W(t,function(e){return U(n,e)}):U(n,t);var r=this._generateStyleName();return this.richTextStyles[r]=n,`{`+r+`|`+e+`}`},e}();function bce(e){var t=e.series,n=e.dataIndex,r=e.multipleSeries,i=t.getData(),a=i.mapDimensionsAll(`defaultedTooltip`),o=a.length,s=t.getRawValue(n),c=G(s),l=yce(t,n),u,d,f,p;if(o>1||c&&!o){var m=xce(s,t,n,a,l);u=m.inlineValues,d=m.inlineValueTypes,f=m.blocks,p=m.inlineValues[0]}else if(o){var h=i.getDimensionInfo(a[0]);p=u=SM(i,n,a[0]),d=h.type}else p=u=c?s[0]:s;var g=iS(t),_=g&&t.name||``,v=i.getName(n),y=r?_:v;return KM(`section`,{header:_,noHeader:r||!g,sortParam:p,blocks:[KM(`nameValue`,{markerType:`item`,markerColor:l,name:y,noName:!Ub(y),value:u,valueType:d,rawDataIndex:i.getRawIndex(n)})].concat(f||[])})}function xce(e,t,n,r,i){var a=t.getData(),o=xb(e,function(e,t,n){var r=a.getDimensionInfo(n);return e||=r&&r.tooltip!==!1&&r.displayName!=null},!1),s=[],c=[],l=[];r.length?W(r,function(e){u(SM(a,n,e),e)}):W(e,u);function u(e,t){var n=a.getDimensionInfo(t);n&&n.otherDims.tooltip!==!1&&(o?l.push(KM(`nameValue`,{markerType:`subItem`,markerColor:i,name:n.displayName,value:e,valueType:n.type})):(s.push(e),c.push(n.type)))}return{inlineValues:s,inlineValueTypes:c,blocks:l}}var tN=dS();function nN(e,t){return e.getName(t)||e.getId(t)}var rN=function(e){H(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=TM({count:Cce,reset:wce}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(tN(this).sourceManager=new lce(this)).prepareSource();var r=this.getInitialData(e,n);aN(r,this),this.dataTask.context.data=r,tN(this).dataBeforeProcessed=r,iN(this),this._initSelectedMapFromData(r)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=Bj(this),r=n?Hj(e):{},i=this.subType;Wj.hasClass(i)&&(i+=`Series`),hb(e,t.getTheme().get(this.subType)),hb(e,this.getDefaultOption()),Wx(e,`label`,[`show`]),this.fillDataTextStyle(e.data),n&&Vj(e,r,n)},t.prototype.mergeOption=function(e,t){e=hb(this.option,e,!0),this.fillDataTextStyle(e.data);var n=Bj(this);n&&Vj(this.option,e,n);var r=tN(this).sourceManager;r.dirty(),r.prepareSource();var i=this.getInitialData(e,t);aN(i,this),this.dataTask.dirty(),this.dataTask.context.data=i,tN(this).dataBeforeProcessed=i,iN(this),this._initSelectedMapFromData(i)},t.prototype.fillDataTextStyle=function(e){if(e&&!Nb(e))for(var t=[`show`],n=0;n=0&&u<0)&&(l=v,u=_,d=0),_===u&&(c[d++]=m))}return c.length=d,c},t.prototype.formatTooltip=function(e,t,n){return bce({series:this,dataIndex:e,multipleSeries:t})},t.prototype.isAnimationEnabled=function(){var e=this.ecModel;if($b.node&&!(e&&e.ssr))return!1;var t=this.getShallow(`animation`);return t&&this.getData().count()>this.getShallow(`animationThreshold`)&&(t=!1),!!t},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(e,t,n){var r=this.ecModel,i=Kj.prototype.getColorFromPalette.call(this,e,t,n);return i||=r.getColorFromPalette(e,t,n),i},t.prototype.coordDimToDataDim=function(e){return this.getRawData().mapDimensionsAll(e)},t.prototype.getProgressive=function(){return this.get(`progressive`)},t.prototype.getProgressiveThreshold=function(){return this.get(`progressiveThreshold`)},t.prototype.select=function(e,t){this._innerSelect(this.getData(t),e)},t.prototype.unselect=function(e,t){var n=this.option.selectedMap;if(n){var r=this.option.selectedMode,i=this.getData(t);if(r===`series`||n===`all`){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var a=0;a=0&&n.push(i)}return n},t.prototype.isSelected=function(e,t){var n=this.option.selectedMap;if(!n)return!1;var r=this.getData(t);return(n===`all`||n[nN(r,e)])&&!r.getItemModel(e).get([`select`,`disabled`])},t.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var e=this.option.universalTransition;return e?e===!0||e&&e.enabled:!1},t.prototype._innerSelect=function(e,t){var n,r,i=this.option,a=i.selectedMode,o=t.length;if(a&&o){if(a===`series`)i.selectedMap=`all`;else if(a===`multiple`){jb(i.selectedMap)||(i.selectedMap={});for(var s=i.selectedMap,c=0;c0&&this._innerSelect(e,t)}},t.registerClass=function(e){return Wj.registerClass(e)},t.protoInitialize=function(){var e=t.prototype;e.type=`series.__base__`,e.seriesIndex=0,e.ignoreStyleOnData=!1,e.hasSymbolVisual=!1,e.defaultSymbol=`circle`,e.visualStyleAccessPath=`itemStyle`,e.visualDrawType=`fill`}(),t}(Wj);vb(rN,CM),vb(rN,Kj),zS(rN,Wj);function iN(e){var t=e.name;iS(e)||(e.name=Sce(e)||t)}function Sce(e){var t=e.getRawData(),n=t.mapDimensionsAll(`seriesName`),r=[];return W(n,function(e){var n=t.getDimensionInfo(e);n.displayName&&r.push(n.displayName)}),r.join(` `)}function Cce(e){return e.model.getRawData().count()}function wce(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),Tce}function Tce(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function aN(e,t){W(oie(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(n){e.wrapMethod(n,Eb(Ece,t))})}function Ece(e,t){var n=oN(e);return n&&n.setOutputEnd((t||this).count()),t}function oN(e){var t=(e.ecModel||{}).scheduler,n=t&&t.getPipeline(e.uid);if(n){var r=n.currentTask;if(r){var i=r.agentStubMap;i&&(r=i.get(e.uid))}return r}}function sN(e){return e==null?0:e.length||1}function cN(e){return e}var lN=function(){function e(e,t,n,r,i,a){this._old=e,this._new=t,this._oldKeyGetter=n||cN,this._newKeyGetter=r||cN,this.context=i,this._diffModeMultiple=a===`multiple`}return e.prototype.add=function(e){return this._add=e,this},e.prototype.update=function(e){return this._update=e,this},e.prototype.updateManyToOne=function(e){return this._updateManyToOne=e,this},e.prototype.updateOneToMany=function(e){return this._updateOneToMany=e,this},e.prototype.updateManyToMany=function(e){return this._updateManyToMany=e,this},e.prototype.remove=function(e){return this._remove=e,this},e.prototype.execute=function(){this[this._diffModeMultiple?`_executeMultiple`:`_executeOneToOne`]()},e.prototype._executeOneToOne=function(){var e=this._old,t=this._new,n={},r=Array(e.length),i=Array(t.length);this._initIndexMap(e,null,r,`_oldKeyGetter`),this._initIndexMap(t,n,i,`_newKeyGetter`);for(var a=0;a1){var l=s.shift();s.length===1&&(n[o]=s[0]),this._update&&this._update(l,a)}else c===1?(n[o]=null,this._update&&this._update(s,a)):this._remove&&this._remove(a)}this._performRestAdd(i,n)},e.prototype._executeMultiple=function(){var e=this._old,t=this._new,n={},r={},i=[],a=[];this._initIndexMap(e,n,i,`_oldKeyGetter`),this._initIndexMap(t,r,a,`_newKeyGetter`);for(var o=0;o1&&d===1)this._updateManyToOne&&this._updateManyToOne(l,c),r[s]=null;else if(u===1&&d>1)this._updateOneToMany&&this._updateOneToMany(l,c),r[s]=null;else if(u===1&&d===1)this._update&&this._update(l,c),r[s]=null;else if(u>1&&d>1)this._updateManyToMany&&this._updateManyToMany(l,c),r[s]=null;else if(u>1)for(var f=0;f1)for(var o=0;oi&&(i+=uN);var p=Math.atan2(s,o);if(p<0&&(p+=uN),p>=r&&p<=i||p+uN>=r&&p+uN<=i)return c[0]=u,c[1]=d,l-n;var m=n*Math.cos(r)+e,h=n*Math.sin(r)+t,g=n*Math.cos(i)+e,_=n*Math.sin(i)+t,v=(m-o)*(m-o)+(h-s)*(h-s),y=(g-o)*(g-o)+(_-s)*(_-s);return v0){t=t/180*Math.PI,hN.fromArray(e[0]),gN.fromArray(e[1]),_N.fromArray(e[2]),hC.sub(vN,hN,gN),hC.sub(yN,_N,gN);var n=vN.len(),r=yN.len();if(!(n<.001||r<.001)){vN.scale(1/n),yN.scale(1/r);var i=vN.dot(yN);if(Math.cos(t)1&&hC.copy(SN,_N),SN.toArray(e[1])}}}}function CN(e,t,n,r){var i=n===`normal`,a=i?e:e.ensureState(n);a.ignore=t;var o=r.get(`smooth`);o=o===!0?.3:Math.max(+o,0)||0,a.shape=a.shape||{},a.shape.smooth=o;var s=r.getModel(`lineStyle`).getLineStyle();i?e.useStyle(s):a.style=s}function Nce(e,t){var n=t.smooth,r=t.points;if(r){if(e.moveTo(r[0][0],r[0][1]),n>0&&r.length>=3){var i=lC(r[0],r[1]),a=lC(r[1],r[2]);if(!i||!a){e.lineTo(r[1][0],r[1][1]),e.lineTo(r[2][0],r[2][1]);return}var o=Math.min(i,a)*n,s=dC([],r[1],r[0],o/i),c=dC([],r[1],r[2],o/a),l=dC([],s,c,.5);e.bezierCurveTo(s[0],s[1],s[0],s[1],l[0],l[1]),e.bezierCurveTo(c[0],c[1],c[0],c[1],r[2][0],r[2][1])}else for(var u=1;u0&&i&&S(-d/a,0,a);var g=e[0],_=e[a-1],v,y;b(),v<0&&C(-v,.8),y<0&&C(y,.8),b(),x(v,y,1),x(y,v,-1),b(),v<0&&w(-v),y<0&&w(y);function b(){v=g.rect[o]-n,y=r-_.rect[o]-_.rect[s]}function x(e,t,n){if(e<0){var r=Math.min(t,-e);if(r>0){S(r*n,0,a);var i=r+e;i<0&&C(-i*n,1)}else C(-e*n,1)}}function S(t,n,r){t!==0&&(u=!0);for(var i=n;i0)for(var c=0;c0;c--){var f=r[c-1]*d;S(-f,c,a)}}}function w(e){var t=e<0?-1:1;e=Math.abs(e);for(var n=Math.ceil(e/(a-1)),r=0;r0?S(n,0,r+1):S(-n,a-r-1,a),e-=n,e<=0)return}return u}function Bce(e){for(var t=0;t=0&&n.attr(i.oldLayoutSelect),_b(u,`emphasis`)>=0&&n.attr(i.oldLayoutEmphasis)),bk(n,c,t,s)}else if(n.attr(c),!yA(n).valueAnimation){var d=Rb(n.style.opacity,1);n.style.opacity=0,xk(n,{style:{opacity:d}},t,s)}if(i.oldLayout=c,n.states.select){var f=i.oldLayoutSelect={};BN(f,c,VN),BN(f,n.states.select,VN)}if(n.states.emphasis){var p=i.oldLayoutEmphasis={};BN(p,c,VN),BN(p,n.states.emphasis,VN)}Joe(n,s,l,t,t)}if(r&&!r.ignore&&!r.invisible){var i=zN(r),a=i.oldLayout,m={points:r.shape.points};a?(r.attr({shape:a}),bk(r,{shape:m},t)):(r.setShape(m),r.style.strokePercent=0,xk(r,{style:{strokePercent:1}},t)),i.oldLayout=m}},e}(),UN=dS();function WN(e){e.registerUpdateLifecycle(`series:beforeupdate`,function(e,t,n){var r=UN(t).labelManager;r||=UN(t).labelManager=new HN,r.clearLabels()}),e.registerUpdateLifecycle(`series:layoutlabels`,function(e,t,n){var r=UN(t).labelManager;W(n.updatedSeries,function(e){r.addLabelsOfSeries(t.getViewOfSeriesModel(e))}),r.updateLayoutConfig(t),r.layout(t),r.processLabelsOverall()})}var GN=wb({needTransform:1,normalize:1,scale:1,transformIn:1,transformOut:1,contain:1,getExtent:1,getExtentUnsafe:1,setExtent:1,setExtent2:1,getFilter:1,sanitize:1,getDefaultStartValue:1,freeze:1});function KN(e,t,n){var r;e||={};var i=HA();if(i){var a=i.createBreakScaleMapper(t,n);a.hasBreaks()&&(W(GN,function(t){a[t]&&(e[t]=Tb(a[t],a))}),r=a)}return r??$N(e,n),{brk:r,mapper:e}}function qN(e,t){W(GN,function(n){e[n]=t[n]})}function JN(e,t){e.freeze=Qb}function YN(e){return e.getExtentUnsafe(0,2)}function XN(e,t){return e.getExtentUnsafe(1,t)||e.getExtentUnsafe(0,t)}function ZN(e){var t=XN(e,3);return t[1]-t[0]}function QN(e){var t=e.getExtentUnsafe(0,3);return t[1]-t[0]}function $N(e,t){var n=e||{},r=[];return n._extents=r,r[0]=t?t.slice():CS(),U(n,eP),n}var eP={needTransform:function(){return!1},normalize:function(e){var t=this._extents[1]||this._extents[0];return t[1]===t[0]?.5:(e-t[0])/(t[1]-t[0])},scale:function(e){var t=this._extents[1]||this._extents[0];return e*(t[1]-t[0])+t[0]},transformIn:function(e){return e},transformOut:function(e){return e},contain:function(e){var t=XN(this,null);return e>=t[0]&&e<=t[1]},getExtent:function(){return this._extents[0].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){tP(this._extents,0,e,t)},setExtent2:function(e,t,n){var r=this._extents;r[e]||(r[e]=r[0].slice()),tP(r,e,t,n)},freeze:function(){}};function tP(e,t,n,r){OS(n,r)&&(e[t][0]=n,e[t][1]=r)}var nP=`expandAxisBreak`,rP=null;function iP(){return rP}var aP=function(){function e(){}return e.prototype.isBlank=function(){return this._isBlank},e.prototype.setBlank=function(e){this._isBlank=e},e}();BS(aP);var oP=0,sP=function(){function e(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++oP,this._onCollect=e.onCollect}return e.createByAxisModel=function(t){var n=t.option,r=n.data,i=r&&bb(r,cP);return new e({categories:i,needCollect:!i,deduplication:n.dedplication!==!1})},e.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},e.prototype.parseAndCollect=function(e){var t,n=this._needCollect;if(!Ob(e)&&!n)return e;if(n&&!this._deduplication)return t=this.categories.length,this.categories[t]=e,this._onCollect&&this._onCollect(e,t),t;var r=this._getOrCreateMap();return t=r.get(e),t??(n?(t=this.categories.length,this.categories[t]=e,r.set(e,t),this._onCollect&&this._onCollect(e,t)):t=NaN),t},e.prototype._getOrCreateMap=function(){return this._map||=Jb(this.categories)},e}();function cP(e){return jb(e)&&e.value!=null?e.value:e+``}function lP(e){return uP(e)||fP(e)}function uP(e){return e.type===`interval`}function dP(e){return e.type===`time`}function fP(e){return e.type===`log`}function pP(e){return e.type===`ordinal`}function mP(e){var t=Tx(e),n=cx(10,t),r=ax(e/n);return r?r===2?r=3:r===3?r=5:r*=2:r=1,mx(r*n,-t)}function hP(e){return gx(e)+2}function gP(e,t){return lx(e)/lx(t)}function _P(e,t,n){var r=n&&n.lookup;if(r){for(var i=0;i1&&a/o>2&&(i=Math.round(Math.ceil(i/o)*o)),i!==r[0]&&c(r[0],!0,!0);for(var s=i;s<=r[1];s+=o)c(s,!1,s===r[0]||s===r[1]);s-o!==r[1]&&c(r[1],!0,!0);function c(e,t,r){n({value:e,offInterval:t},r)}}var SP=function(e){H(t,e);function t(n){var r=e.call(this)||this;r.type=`ordinal`,r.parse=t.parse,qN(r,t.decoratedMethods);var i=n.ordinalMeta;i||=new sP({}),G(i)&&(i=new sP({categories:bb(i,function(e){return jb(e)?e.value:e})})),r._ordinalMeta=i;var a=KN(null,null,n.extent||[0,i.categories.length-1]);return r._mapper=a.mapper,JN(r,a.mapper),r}return t.parse=function(e){return e==null?e=NaN:Ob(e)?(e=this._ordinalMeta.getOrdinal(e),e??=NaN):e=ax(e),e},t.prototype.getTicks=function(){var e=[];return xP(this,0,function(t){e.push(t)}),e},t.prototype.getMinorTicks=function(e){},t.prototype.setSortInfo=function(e){if(e==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var t=e.ordinalNumbers,n=this._ordinalNumbersByTick=[],r=this._ticksByOrdinalNumber=[],i=0,a=this._ordinalMeta.categories.length,o=nx(a,t.length);i=0&&e=0&&e=0&&eo[0]&&mi[1]||!isFinite(p)||!isFinite(i[1]))break}else{if(m>f)break;p=nx(p,i[1]),m===f&&(p=i[1])}if(l.push({value:p}),p=mx(p+n,a),s){var h=s.calcNiceTickMultiple(p,d);h>=0&&(p=mx(p+h*n,a))}if(l.length>0&&p===l[l.length-1].value)break;if(l.length>u)return[]}var g=l.length?l[l.length-1].value:i[1];return r[1]>g&&l.push({value:e.expandToNicedExtent?mx(g+n,a):r[1]}),c&&o.pruneTicksByBreak(e.pruneByBreak,l,s.breaks,function(e){return e.value},t.interval,r),c&&e.breakTicks!==`none`&&o.addBreaksToTicks(l,s.breaks,r),l},t.prototype.getMinorTicks=function(e){return CP(this,e,WA(this),this._cfg.interval)},t.prototype.getLabel=function(e,t){if(e==null)return``;var n=t&&t.precision;return n==null?n=gx(e.value)||0:n===`auto`&&(n=this._cfg.intervalPrecision),yj(mx(e.value,n,!0))},t.type=`interval`,t}(aP);aP.registerClass(wP);var TP=function(e,t,n,r){for(;n>>1;e[i][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function AP(e){var t=30*YA;return e/=t,e>6?6:e>3?3:e>2?2:1}function jP(e){return e/=JA,e>12?12:e>6?6:e>3.5?4:e>2?2:1}function MP(e,t){return e/=t?qA:KA,e>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function NP(e){return rx(Ex(e,!0),1)}function PP(e,t,n){var r=Math.max(0,_b(ej,t)-1);return aj(new Date(e),ej[r],n).getTime()}function FP(e,t){var n=new Date(0);n[e](1);var r=n.getTime();n[e](1+t);var i=n.getTime()-r;return function(e,t){return Math.max(0,Math.round((t-e)/i))}}function IP(e,t,n,r,i,a){var o=yse,s=0;function c(e,t,n,i,o,c,l){for(var u=FP(o,e),d=t,f=new Date(d);d3e3));)if(f[o](f[i]()+e),d=f.getTime(),a){var p=a.calcNiceTickMultiple(d,u);p>0&&(f[o](f[i]()+p*e),d=f.getTime())}l.push({value:d,notAdd:d>r[1]})}function l(e,i,a){var o=[],s=!i.length;if(!OP(nj(e),r[0],r[1],n)){s&&(i=[{value:PP(r[0],e,n)},{value:r[1]}]);for(var l=0;l=r[0]&&u<=r[1]&&c(f,u,d,p,m,h,o),e===`year`&&a.length>1&&l===0&&a.unshift({value:a[0].value-f})}}for(var l=0;l=r[0]&&v<=r[1]&&f++)}var y=i/t;if(f>y*1.5&&p>y/1.5||(u.push(g),f>y||e===o[m]))break}d=[]}}for(var b=Sb(bb(u,function(e){return Sb(e,function(e){return e.value>=r[0]&&e.value<=r[1]&&!e.notAdd})}),function(e){return e.length>0}),x=b.length-1,S=[],m=0;mr[0])&&S.unshift({value:r[0],time:{level:0,upperTimeUnit:O,lowerTimeUnit:O},notNice:!0}),(!D||D.values&&(a=s);var c=DP.length,l=Math.min(TP(DP,a,0,c),c-1),u=DP[l][1],d=DP[Math.max(l-1,0)][0];e.setTimeInterval({approxInterval:a,interval:u,minLevelUnit:d})};aP.registerClass(EP);var RP=0,zP=1,BP=2,VP=function(e){H(t,e);function t(n){var r=e.call(this)||this;r.type=`log`,r.parse=wP.parse,r.base=n.logBase||10;var i=[],a=[],o=r._lookup={from:i,to:a};i[RP]=i[zP]=a[RP]=a[zP]=NaN,qN(r,t.mapperMethods);var s=HA(),c=n.breakOption,l={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(c,r,{noNegative:!0},BP,l),r.powStub=new wP({breakParsed:l.original}),r.intervalStub=new wP({breakParsed:l.transformed}),JN(r,r.intervalStub),r}return t.prototype.getTicks=function(e){var t=this.base,n=this.powStub,r=HA(),i=this.intervalStub,a={lookup:{from:i.getExtent(),to:n.getExtent()}};return bb(i.getTicks(e||{}),function(e){var i=e.value,o=_P(i,t,a),s;if(r){var c=r.getTicksBreakOutwardTransform(this,e,WA(n),this._lookup);c&&(s=c.vBreak,o=c.tickVal)}return{value:o,break:s}},this)},t.prototype.getMinorTicks=function(e){return CP(this,e,WA(this.powStub),this.intervalStub.getConfig().interval)},t.prototype.getLabel=function(e,t){return this.intervalStub.getLabel(e,t)},t.type=`log`,t.mapperMethods={needTransform:function(){return!0},normalize:function(e){return this.intervalStub.normalize(gP(e,this.base))},scale:function(e){return _P(this.intervalStub.scale(e),this.base,null)},transformIn:function(e,t){return e=gP(e,this.base),t&&t.depth===2?e:this.intervalStub.transformIn(e,t)},transformOut:function(e,t){var n=t?t.depth:null;return HP.depth=n,UP.lookup=this._lookup,_P(n===2?e:this.intervalStub.transformOut(e,HP),this.base,UP)},contain:function(e){return this.powStub.contain(e)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){if(!(!OS(t,n)||t<=0||n<=0)){var r=WP,i=WP;if(e===0){var a=this._lookup;r=a.to,i=a.from}this.powStub.setExtent2(e,r[RP]=t,r[zP]=n);var o=this.base;this.intervalStub.setExtent2(e,i[RP]=gP(t,o),i[zP]=gP(n,o))}},getFilter:function(){return{g:0}},sanitize:function(e,t){return OS(t[0],t[1])&&Nx(e)&&e<=0&&(e=t[0]),e},getDefaultStartValue:function(){return 1},getExtent:function(){return this.powStub.getExtent()},getExtentUnsafe:function(e,t){return t===null?this.powStub.getExtentUnsafe(e,null):this.intervalStub.getExtentUnsafe(e,t)}},t}(aP);aP.registerClass(VP);var HP={},UP={},WP=[],GP={value:1,category:1,time:1,log:1},KP=dS(),qP={float:`f`,int:`i`,ordinal:`o`,number:`n`,time:`t`},JP=function(){function e(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return e.prototype.isDimensionOmitted=function(){return this._dimOmitted},e.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||=ZP(this.source))},e.prototype.getSourceDimensionIndex=function(e){return Rb(this._dimNameMap.get(e),-1)},e.prototype.getSourceDimension=function(e){var t=this.source.dimensionsDefine;if(t)return t[e]},e.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,t=oM(this.source),n=!QP(e),r=``,i=[],a=0,o=0;a30}function $P(e,t,n){n||={};var r=n.byIndex,i=n.stackedCoordDimension,a,o,s;eF(t)?a=t:(o=t.schema,a=o.dimensions,s=t.store);var c=!!(e&&e.get(`stack`)),l,u,d,f,p=!0;function m(e){return e.type!==`ordinal`&&e.type!==`time`}if(W(a,function(e,t){Ob(e)&&(a[t]=e={name:e}),m(e)||(p=!1)}),W(a,function(e,t){c&&!e.isExtraCoord&&(!r&&!l&&e.ordinalMeta&&(l=e),!u&&m(e)&&(!p||e.coordDim!==`x`&&e.coordDim!==`angle`)&&(!i||i===e.coordDim)&&(u=e))}),u&&!r&&!l&&(r=!0),u){d=`__\0ecstackresult_`+e.id,f=`__\0ecstackedover_`+e.id,l&&(l.createInvertedIndices=!0);var h=u.coordDim,g=u.type,_=0;W(a,function(e){e.coordDim===h&&_++});var v={name:d,coordDim:h,coordDimIndex:_,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length},y={name:f,coordDim:f,coordDimIndex:_+1,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length+1};o?(s&&(v.storeDimIndex=s.ensureCalculationDimension(f,g),y.storeDimIndex=s.ensureCalculationDimension(d,g)),o.appendCalculationDimension(v),o.appendCalculationDimension(y)):(a.push(v),a.push(y))}return{stackedDimension:u&&u.name,stackedByDimension:l&&l.name,isStackedByIndex:r,stackedOverDimension:f,stackResultDimension:d}}function eF(e){return!YP(e.schema)}function tF(e,t){return!!t&&t===e.getCalculationInfo(`stackedDimension`)}function nF(e,t){return tF(e,t)?e.getCalculationInfo(`stackResultDimension`):t}var rF=dS();function iF(e){var t=e.get(`type`);return(t==null||!Zb(GP,t)&&!aP.getClass(t))&&(t=`value`),t}function aF(e,t,n){var r=HA(),i;switch(r&&(i=gF(e,t,n)),t){case`category`:return new SP({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:CS()});case`time`:return new EP({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get(`useUTC`),breakOption:i});case`log`:return new VP({logBase:e.get(`logBase`),breakOption:i});case`value`:return new wP({breakOption:i});default:return new((aP.getClass(t))||wP)({})}}function oF(e,t,n){var r=n?XN(e,null):e.getExtentUnsafe(0,null),i=r[0],a=r[1];return OS(i,a)?i===t||a===t?2:it?1:3:3}function sF(e){rF(e).noOnMyZero=!0}function cF(e){return rF(e).noOnMyZero}function lF(e){var t=e.getLabelModel().get(`formatter`);if(e.type===`time`){var n=bse(t);return function(t,r){return e.scale.getFormattedLabel(t,r,n)}}if(Ob(t))return function(n){var r=e.scale.getLabel(n);return t.replace(`{value}`,r??``)};if(Db(t)){if(e.type===`category`)return function(n,r){return t(uF(e,n),n.value-e.scale.getExtent()[0],null)};var r=HA();return function(n,i){var a=null;return r&&(a=r.makeAxisLabelFormatterParamBreak(a,n.break)),t(uF(e,n),i,a)}}return function(t){return e.scale.getLabel(t)}}function uF(e,t){var n=e.scale;return pP(n)?n.getLabel(t):t.value}function dF(e){return e.get(`interval`)??`auto`}function fF(e){return e.type===`category`&&dF(e.getLabelModel())===0}function pF(e,t){var n={};return W(e.mapDimensionsAll(t),function(t){n[nF(e,t)]=!0}),wb(n)}function mF(e){return e===`middle`||e===`center`}function hF(e){return e.getShallow(`show`)}function gF(e,t,n){var r=e.get(`breaks`,!0);if(r!=null)return!HA()||!n||!_F(t)?void 0:r}function _F(e){return e!==`category`}function vF(e,t,n,r,i,a){var o=fP(e),s=o?e.intervalStub:e;if(s.setExtent(r[0],r[1]),o){var c=e.powStub,l={depth:2},u=e.transformOut(r[0],l),d=e.transformOut(r[1],l),f=yP(n,r);t[0]&&!f[0]&&(u=i[0]),t[1]&&!f[1]&&(d=i[1]),c.setExtent(u,d)}s.setConfig(a)}function yF(e,t){return pP(e)?e.getRawOrdinalNumber(t.value):t.value}function bF(e,t){return pP(e)&&!!t.get(`boundaryGap`)}var xF=function(){function e(e){this.type=`cartesian`,this._dimList=[],this._axes={},this.name=e||``}return e.prototype.getAxis=function(e){return this._axes[e]},e.prototype.getAxes=function(){return bb(this._dimList,function(e){return this._axes[e]},this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),Sb(this.getAxes(),function(t){return t.scale.type===e})},e.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},e}(),SF={left:0,right:0,top:0,bottom:0},CF=[`25%`,`25%`],wF=`cartesian2d`,TF=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(t,n){var r=Hj(t.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),r&&t.outerBounds&&Vj(t.outerBounds,r)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&t.outerBounds&&Vj(this.option.outerBounds,t.outerBounds)},t.type=`grid`,t.dependencies=[`xAxis`,`yAxis`],t.layoutMode=`box`,t.defaultOption={show:!1,z:0,left:`15%`,top:65,right:`10%`,bottom:80,containLabel:!1,outerBoundsMode:`auto`,outerBounds:SF,outerBoundsContain:`all`,outerBoundsClampWidth:CF[0],outerBoundsClampHeight:CF[1],backgroundColor:K.color.transparent,borderWidth:1,borderColor:K.color.neutral30},t}(Wj),EF=[`x`,`y`];function DF(e){return(e.type===`interval`||e.type===`time`)&&!GA(e)}var OF=function(e){H(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=wF,t.dimensions=EF,t}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis(`x`).scale,t=this.getAxis(`y`).scale;if(DF(e)&&DF(t)){var n=XN(e,null),r=XN(t,null),i=this.dataToPoint([n[0],r[0]]),a=this.dataToPoint([n[1],r[1]]),o=n[1]-n[0],s=r[1]-r[0];if(o&&s){var c=(a[0]-i[0])/o,l=(a[1]-i[1])/s,u=i[0]-n[0]*c,d=i[1]-r[0]*l,f=this._transform=[c,0,0,l,u,d];this._invTransform=eC([],f)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale(`ordinal`)[0]||this.getAxesByScale(`time`)[0]||this.getAxis(`x`)},t.prototype.containPoint=function(e){var t=this.getAxis(`x`),n=this.getAxis(`y`);return t.contain(t.toLocalCoord(e[0]))&&n.contain(n.toLocalCoord(e[1]))},t.prototype.containData=function(e){return this.getAxis(`x`).containData(e[0])&&this.getAxis(`y`).containData(e[1])},t.prototype.containZone=function(e,t){var n=this.dataToPoint(e),r=this.dataToPoint(t),i=this.getArea(),a=new OC(n[0],n[1],r[0]-n[0],r[1]-n[1]);return i.intersect(a)},t.prototype.dataToPoint=function(e,t,n){n||=[];var r=e[0],i=e[1];if(this._transform&&r!=null&&isFinite(r)&&i!=null&&isFinite(i))return fC(n,e,this._transform);var a=this.getAxis(`x`),o=this.getAxis(`y`);return n[0]=a.toGlobalCoord(a.dataToCoord(r,t)),n[1]=o.toGlobalCoord(o.dataToCoord(i,t)),n},t.prototype.clampData=function(e,t){var n=this.getAxis(`x`).scale,r=this.getAxis(`y`).scale,i=n.getExtent(),a=r.getExtent(),o=n.parse(e[0]),s=r.parse(e[1]);return t||=[],t[0]=Math.min(Math.max(Math.min(i[0],i[1]),o),Math.max(i[0],i[1])),t[1]=Math.min(Math.max(Math.min(a[0],a[1]),s),Math.max(a[0],a[1])),t},t.prototype.pointToData=function(e,t,n){if(n||=[],this._invTransform)return fC(n,e,this._invTransform);var r=this.getAxis(`x`),i=this.getAxis(`y`);return n[0]=r.coordToData(r.toLocalCoord(e[0]),t),n[1]=i.coordToData(i.toLocalCoord(e[1]),t),n},t.prototype.getOtherAxis=function(e){return this.getAxis(e.dim===`x`?`y`:`x`)},t.prototype.getArea=function(e){e||=0;var t=this.getAxis(`x`).getGlobalExtent(),n=this.getAxis(`y`).getGlobalExtent(),r=Math.min(t[0],t[1])-e,i=Math.min(n[0],n[1])-e;return new OC(r,i,Math.max(t[0],t[1])-r+e,Math.max(n[0],n[1])-i+e)},t}(xF),kF=dS(),AF=dS(),jF={estimate:1,determine:2};function MF(e){return{out:{noPxChangeTryDetermine:[]},kind:e}}function NF(e,t){var n=e.getLabelModel().get(`customValues`);if(n){var r=e.scale;return{labels:bb(PF(n,r),function(t,n){return{formattedLabel:lF(e)(t,n),rawLabel:r.getLabel(t),tick:t}})}}return e.type===`category`?Wce(e,t):Kce(e)}function Uce(e,t,n){var r=e.scale,i=e.getTickModel().get(`customValues`);return i?{ticks:PF(i,r)}:e.type===`category`?Gce(e,t):{ticks:r.getTicks(n)}}function PF(e,t){var n=t.getExtent(),r=[];return W(e,function(e){e=t.parse(e),e>=n[0]&&e<=n[1]&&r.push(e)}),jS(r,xie,null),hx(r),bb(r,function(e){return{value:e}})}function Wce(e,t){var n=e.getLabelModel(),r=FF(e,n,t);return!n.get(`show`)||e.scale.isBlank()?{labels:[]}:r}function FF(e,t,n){var r=Jce(e),i=dF(t),a=n.kind===jF.estimate;if(!a){var o=LF(r,i);if(o)return o}var s,c;Db(i)?s=BF(e,i,!1):(c=i===`auto`?Yce(e,n):i,s=BF(e,c,!1));var l={labels:s,labelCategoryInterval:c};return a?n.out.noPxChangeTryDetermine.push(function(){return RF(r,i,l),!0}):RF(r,i,l),l}function Gce(e,t){var n=qce(e),r=dF(t),i=LF(n,r);if(i)return i;var a,o;if((!t.get(`show`)||e.scale.isBlank())&&(a=[]),Db(r))a=BF(e,r,!0);else if(r===`auto`){var s=FF(e,e.getLabelModel(),MF(jF.determine));o=s.labelCategoryInterval,a=bb(s.labels,function(e){return e.tick})}else o=r,a=BF(e,o,!0);return RF(n,r,{ticks:a,tickCategoryInterval:o})}function Kce(e){var t=e.scale.getTicks(),n=lF(e);return{labels:bb(t,function(t,r){return{formattedLabel:n(t,r),rawLabel:e.scale.getLabel(t),tick:t}})}}var qce=IF(`axisTick`),Jce=IF(`axisLabel`);function IF(e){return function(t){return AF(t)[e]||(AF(t)[e]={list:[]})}}function LF(e,t){for(var n=0;nu&&(l=Math.max(1,Math.floor(c/u)));for(var d=s[0],f=e.dataToCoord(d+1)-e.dataToCoord(d),p=Math.abs(f*Math.cos(a)),m=Math.abs(f*Math.sin(a)),h=0,g=0;d<=s[1];d+=l){var _=0,v=0,y=UC(i({value:d}),r.font,`center`,`top`);_=y.width*1.3,v=y.height*1.3,h=Math.max(h,_,7),g=Math.max(g,v,7)}var b=h/p,x=g/m;isNaN(b)&&(b=1/0),isNaN(x)&&(x=1/0);var S=Math.max(0,Math.floor(Math.min(b,x)));return n===jF.estimate?(t.out.noPxChangeTryDetermine.push(Tb(Zce,null,e,S,c)),S):zF(e,S,c)??S}function Zce(e,t,n){return zF(e,t,n)==null}function zF(e,t,n){var r=kF(e.model),i=e.getExtent(),a=r.lastAutoInterval,o=r.lastTickCount;if(a!=null&&o!=null&&Math.abs(a-t)<=1&&Math.abs(o-n)<=1&&a>t&&r.axisExtent0===i[0]&&r.axisExtent1===i[1])return a;r.lastTickCount=n,r.lastAutoInterval=t,r.axisExtent0=i[0],r.axisExtent1=i[1]}function Qce(e){var t=e.getLabelModel();return{axisRotate:e.getRotate?e.getRotate():e.isHorizontal&&!e.isHorizontal()?90:0,labelRotate:t.get(`rotate`)||0,font:t.getFont()}}function BF(e,t,n){var r=lF(e),i=e.scale,a=[],o=Db(t);return xP(i,o?0:t,function(e,s){var c=i.getLabel(e);if(o){var l=!!t(e.value,c);if(e.offInterval=!l,!l&&!s)return}a.push(n?e:{formattedLabel:r(e),rawLabel:c,tick:e})}),a}var VF=dS();function $ce(e){VF(e).prepare={}}function ele(e){VF(e).fullUpdate={}}function HF(e){return VF(e).prepare}function UF(e){return VF(e).fullUpdate}var tle=AS(),WF=dS(),nle=dS();function GF(e,t){var n=e.model,r=WF(UF(n.ecModel)).keyed,i=r&&r.get(t);return i&&i.get(n.uid)}function rle(e,t){return qF(GF(e,t))}function ile(e,t){var n=[];return KF(e.model.ecModel,function(e){for(var r=0;r0?(t>o&&(o=t),a=!1):t===-2&&(a=!0))}),Nx(n)&&n>0&&Nx(o)?(e.w=r/n*o,e.w2=o):a&&(e.w=r*ule,e.w2=e.w*n/r)}var nI=[0,1],ple=function(){function e(e,t,n){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=n||[0,0]}return e.prototype.contain=function(e){var t=this._extent,n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]);return e>=n&&e<=r},e.prototype.containData=function(e){return this.scale.contain(this.scale.parse(e))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(e,t){var n=this._extent;n[0]=e,n[1]=t},e.prototype.dataToCoord=function(e,t){var n=this.scale;return e=n.normalize(n.parse(e)),dx(e,nI,rI(this),t)},e.prototype.coordToData=function(e,t){var n=dx(e,rI(this),nI,t);return this.scale.scale(n)},e.prototype.pointToData=function(e,t){},e.prototype.getTicksCoords=function(e){e||={};var t=e.tickModel||this.getTickModel(),n=bb(Uce(this,t,{breakTicks:e.breakTicks,pruneByBreak:e.pruneByBreak}).ticks,function(e){return{coord:this.dataToCoord(yF(this.scale,e)),tick:e}},this),r=t.get(`alignWithLabel`),i=mle(this,n,r);return bb(n,function(e){return{coord:e.coord,tickValue:e.tick.value,onBand:i}})},e.prototype.getMinorTicksCoords=function(){if(pP(this.scale))return[];var e=this.model.getModel(`minorTick`).get(`splitNumber`);return e>0&&e<100||(e=5),bb(this.scale.getMinorTicks(e),function(e){return bb(e,function(e){return{coord:this.dataToCoord(e),tickValue:e}},this)},this)},e.prototype.getViewLabels=function(e){return e||=MF(jF.determine),NF(this,e).labels},e.prototype.getLabelModel=function(){return this.model.getModel(`axisLabel`)},e.prototype.getTickModel=function(){return this.model.getModel(`axisTick`)},e.prototype.getBandWidth=function(){return tI(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(e){return e||=MF(jF.determine),Xce(this,e)},e}();function rI(e){var t=e.getExtent();if(e.onBand){var n=(t[1]-t[0])/e.scale.count()/2;t[0]+=n,t[1]-=n}return t}function mle(e,t,n){var r=t.length;if(!e.onBand||n||!r)return!1;var i=tI(e).w;if(!i)return!1;W(t,function(e){e.coord-=i/2});var a=e.scale.getExtent(),o=t[r-1];return o.tick.offInterval&&t.pop(),t.push({coord:o.coord+i,tick:{value:a[1]+1}}),!0}var hle=function(e){H(t,e);function t(t,n,r,i,a){var o=e.call(this,t,n,r)||this;return o.index=0,o.type=i||`value`,o.position=a||`bottom`,o}return t.prototype.isHorizontal=function(){var e=this.position;return e===`top`||e===`bottom`},t.prototype.getGlobalExtent=function(e){var t=this.getExtent();return t[0]=this.toGlobalCoord(t[0]),t[1]=this.toGlobalCoord(t[1]),e&&t[0]>t[1]&&t.reverse(),t},t.prototype.pointToData=function(e,t){return this.coordToData(this.toLocalCoord(e[this.dim===`x`?0:1]),t)},t.prototype.setCategorySortInfo=function(e){if(this.type!==`category`)return!1;this.model.option.categorySortInfo=e,this.scale.setSortInfo(e)},t}(ple),gle=BE.extend({type:`triangle`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r+a),e.lineTo(n-i,r+a),e.closePath()}}),_le={line:nk,rect:eD,roundRect:eD,square:eD,circle:RO,diamond:BE.extend({type:`diamond`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r),e.lineTo(n,r+a),e.lineTo(n-i,r),e.closePath()}}),pin:BE.extend({type:`pin`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.x,r=t.y,i=t.width/5*3,a=Math.max(i,t.height),o=i/2,s=o*o/(a-o),c=r-a+o+s,l=Math.asin(s/o),u=Math.cos(l)*o,d=Math.sin(l),f=Math.cos(l),p=o*.6,m=o*.7;e.moveTo(n-u,c+s),e.arc(n,c,o,Math.PI-l,Math.PI*2+l),e.bezierCurveTo(n+u-d*p,c+s+f*p,n,r-m,n,r),e.bezierCurveTo(n,r-m,n-u+d*p,c+s+f*p,n-u,c+s),e.closePath()}}),arrow:BE.extend({type:`arrow`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.height,r=t.width,i=t.x,a=t.y,o=r/3*2;e.moveTo(i,a),e.lineTo(i+o,a+n),e.lineTo(i,a+n/4*3),e.lineTo(i-o,a+n),e.lineTo(i,a),e.closePath()}}),triangle:gle},vle={line:function(e,t,n,r,i){i.x1=e,i.y1=t+r/2,i.x2=e+n,i.y2=t+r/2},rect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r},roundRect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r,i.r=Math.min(n,r)/4},square:function(e,t,n,r,i){var a=Math.min(n,r);i.x=e,i.y=t,i.width=a,i.height=a},circle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.r=Math.min(n,r)/2},diamond:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r},pin:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},arrow:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},triangle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r}},iI={};W(_le,function(e,t){iI[t]=new e});var yle=BE.extend({type:`symbol`,shape:{symbolType:``,x:0,y:0,width:0,height:0},calculateTextPosition:function(e,t,n){var r=JC(e,t,n),i=this.shape;return i&&i.symbolType===`pin`&&t.position===`inside`&&(r.y=n.y+n.height*.4),r},buildPath:function(e,t,n){var r=t.symbolType;if(r!==`none`){var i=iI[r];i||=(r=`rect`,iI[r]),vle[r](t.x,t.y,t.width,t.height,i.shape),i.buildPath(e,i.shape,n)}}});function ble(e,t){if(this.type!==`image`){var n=this.style;this.__isEmptyBrush?(n.stroke=e,n.fill=t||K.color.neutral00,n.lineWidth=2):this.shape.symbolType===`line`?n.stroke=e:n.fill=e,this.markRedraw()}}function aI(e,t,n,r,i,a,o){var s=e.indexOf(`empty`)===0;s&&(e=e.substr(5,1).toLowerCase()+e.substr(6));var c=e.indexOf(`image://`)===0?Nk(e.slice(8),new OC(t,n,r,i),o?`center`:`cover`):e.indexOf(`path://`)===0?Mk(e.slice(7),{},new OC(t,n,r,i),o?`center`:`cover`):new yle({shape:{symbolType:e,x:t,y:n,width:r,height:i}});return c.__isEmptyBrush=s,c.setColor=ble,a&&c.setColor(a),c}function oI(e){return G(e)||(e=[+e,+e]),[e[0]||0,e[1]||0]}function sI(e,t){if(e!=null)return G(e)||(e=[e,e]),[fx(e[0],t[0])||0,fx(Rb(e[1],e[0]),t[1])||0]}var cI=Math.PI,xle=[[1,2,1,2],[5,3,5,3],[8,3,8,3]],Sle=[[0,1,0,1],[0,3,0,3],[0,3,0,3]],lI=dS(),uI=dS(),dI=function(){function e(e){this.recordMap={},this.resolveAxisNameOverlap=e}return e.prototype.ensureRecord=function(e){var t=e.axis.dim,n=e.componentIndex,r=this.recordMap,i=r[t]||(r[t]=[]);return i[n]||(i[n]={ready:{}})},e}();function Cle(e,t,n,r){var i=n.axis,a=t.ensureRecord(n),o=[],s,c=TI(e.axisName)&&mF(e.nameLocation);W(r,function(e){var t=kN(e);if(t&&!t.label.ignore){o.push(t);var n=a.transGroup;c&&(n.transform?eC(fI,n.transform):YS(fI),t.transform&&ZS(fI,fI,t.transform),OC.copy(pI,t.localRect),pI.applyTransform(fI),s?s.union(pI):OC.copy(s=new OC(0,0,0,0),pI))}});var l=Math.abs(a.dirVec.x)>.1?`x`:`y`,u=a.transGroup[l];if(o.sort(function(e,t){return Math.abs(e.label[l]-u)-Math.abs(t.label[l]-u)}),c&&s){var d=i.getExtent(),f=Math.min(d[0],d[1]),p=Math.max(d[0],d[1])-f;s.union(new OC(f,0,p,1))}a.stOccupiedRect=s,a.labelInfoList=o}var fI=JS(),pI=new OC(0,0,0,0),mI=function(e,t,n,r,i,a){if(mF(e.nameLocation)){var o=a.stOccupiedRect;o&&hI(Rce({},o,a.transGroup.transform),r,i)}else gI(a.labelInfoList,a.dirVec,r,i)};function hI(e,t,n){var r=new hC;FN(e,t,r,{direction:Math.atan2(n.y,n.x),bidirectional:!1,touchThreshold:.05})&&zce(t,r)}function gI(e,t,n,r){for(var i=hC.dot(r,t)>=0,a=0,o=e.length;a0?`top`:`bottom`,i=`center`):xx(r-cI)?(a=n>0?`bottom`:`top`,i=`center`):(a=`middle`,i=r>0&&r0?`right`:`left`:n>0?`left`:`right`),{rotation:r,textAlign:i,textVerticalAlign:a}},e.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+`Index`]=e.componentIndex,t},e.isLabelSilent=function(e){var t=e.get(`tooltip`);return e.get(`silent`)||!(e.get(`triggerEvent`)||t&&t.show)},e}(),wle=[`axisLine`,`axisTickLabelEstimate`,`axisTickLabelDetermine`,`axisName`],Tle={axisLine:function(e,t,n,r,i,a,o){var s=r.get([`axisLine`,`show`]);if(s===`auto`&&(s=!0,e.raw.axisLineAutoShow!=null&&(s=!!e.raw.axisLineAutoShow)),s){var c=r.axis.getExtent(),l=a.transform,u=[c[0],0],d=[c[1],0],f=u[0]>d[0];l&&(fC(u,u,l),fC(d,d,l));var p=U({lineCap:`round`},r.getModel([`axisLine`,`lineStyle`]).getLineStyle()),m={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:p};if(r.get([`axisLine`,`breakLine`])&&GA(r.axis.scale))iP().buildAxisBreakLine(r,i,a,m);else{var h=new nk(U({shape:{x1:u[0],y1:u[1],x2:d[0],y2:d[1]}},m));Ik(h.shape,h.style.lineWidth),h.anid=`line`,i.add(h)}var g=r.get([`axisLine`,`symbol`]);if(g!=null){var _=r.get([`axisLine`,`symbolSize`]);Ob(g)&&(g=[g,g]),(Ob(_)||Ab(_))&&(_=[_,_]);var v=sI(r.get([`axisLine`,`symbolOffset`])||0,_),y=_[0],b=_[1];W([{rotate:e.rotation+Math.PI/2,offset:v[0],r:0},{rotate:e.rotation-Math.PI/2,offset:v[1],r:Math.sqrt((u[0]-d[0])*(u[0]-d[0])+(u[1]-d[1])*(u[1]-d[1]))}],function(t,n){if(g[n]!==`none`&&g[n]!=null){var r=aI(g[n],-y/2,-b/2,y,b,p.stroke,!0),a=t.r+t.offset,o=f?d:u;r.attr({rotation:t.rotate,x:o[0]+a*Math.cos(e.rotation),y:o[1]-a*Math.sin(e.rotation),silent:!0,z2:11}),i.add(r)}})}}},axisTickLabelEstimate:function(e,t,n,r,i,a,o,s){xI(t,i,s)&&vI(e,t,n,r,i,a,o,jF.estimate)},axisTickLabelDetermine:function(e,t,n,r,i,a,o,s){xI(t,i,s)&&vI(e,t,n,r,i,a,o,jF.determine);var c=kle(e,i,a,r);Ole(e,t.labelLayoutList,c),Ale(e,i,a,r,e.tickDirection)},axisName:function(e,t,n,r,i,a,o,s){var c=n.ensureRecord(r);t.nameEl&&=(i.remove(t.nameEl),c.nameLayout=c.nameLocation=null);var l=e.axisName;if(TI(l)){var u=e.nameLocation,d=e.nameDirection,f=r.getModel(`nameTextStyle`),p=r.get(`nameGap`)||0,m=r.axis.getExtent(),h=r.axis.inverse?-1:1,g=new hC(0,0),_=new hC(0,0);u===`start`?(g.x=m[0]-h*p,_.x=-h):u===`end`?(g.x=m[1]+h*p,_.x=h):(g.x=(m[0]+m[1])/2,g.y=e.labelOffset+d*p,_.y=d);var v=JS();_.transform($S(v,v,e.rotation));var y=r.get(`nameRotate`);y!=null&&(y=y*cI/180);var b,x;mF(u)?b=_I.innerTextLayout(e.rotation,y??e.rotation,d):(b=Ele(e.rotation,u,y||0,m),x=e.raw.axisNameAvailableWidth,x!=null&&(x=Math.abs(x/Math.sin(b.rotation)),!isFinite(x)&&(x=null)));var S=f.getFont(),C=r.get(`nameTruncate`,!0)||{},w=C.ellipsis,T=Lb(e.raw.nameTruncateMaxWidth,C.maxWidth,x),E=s.nameMarginLevel||0,D=new aD({x:g.x,y:g.y,rotation:b.rotation,silent:_I.isLabelSilent(r),style:fA(f,{text:l,font:S,overflow:`truncate`,width:T,ellipsis:w,fill:f.getTextColor()||r.get([`axisLine`,`lineStyle`,`color`]),align:f.get(`align`)||b.textAlign,verticalAlign:f.get(`verticalAlign`)||b.textVerticalAlign}),z2:1});if(Xk({el:D,componentModel:r,itemName:l}),D.__fullText=l,D.anid=`name`,r.get(`triggerEvent`)){var O=_I.makeAxisEventDataBase(r);O.targetType=`axisName`,O.name=l,yD(D).eventData=O}a.add(D),D.updateTransform(),t.nameEl=D;var k=c.nameLayout=kN({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:mF(u)?xle[E]:Sle[E]});if(c.nameLocation=u,i.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&k){var A=n.ensureRecord(r);n.resolveAxisNameOverlap(e,n,r,k,_,A)}}}};function vI(e,t,n,r,i,a,o,s){SI(t)||jle(e,t,i,s,r,o);var c=t.labelLayoutList;Mle(e,r,c,a),Fle(r,e.rotation,c);var l=e.optionHideOverlap;Dle(r,c,l),l&&PN(Sb(c,function(e){return e&&!e.label.ignore})),Cle(e,n,r,c)}function Ele(e,t,n,r){var i=bx(n-e),a,o,s=r[0]>r[1],c=t===`start`&&!s||t!==`start`&&s;return xx(i-cI/2)?(o=c?`bottom`:`top`,a=`center`):xx(i-cI*1.5)?(o=c?`top`:`bottom`,a=`center`):(o=`middle`,a=icI/2?c?`left`:`right`:c?`right`:`left`),{rotation:i,textAlign:a,textVerticalAlign:o}}function Dle(e,t,n){var r=e.axis,i=e.get([`axisLabel`,`customValues`]);if(fF(r))return;function a(e,a,o){var s=kN(t[a]),c=kN(t[o]),l=r.scale;if(s&&c){if(e==null){if(!n&&i)return;var u=lI(s.label).labelInfo.tick;if(dP(l)&&u.notNice||pP(l)&&u.offInterval){yI(s.label);return}}if(e===!1||s.suggestIgnore){yI(s.label);return}if(c.suggestIgnore){yI(c.label);return}var d=.1;if(!n){var f=[0,0,0,0];s=jN({marginForce:f},s),c=jN({marginForce:f},c)}FN(s,c,null,{touchThreshold:d})&&yI(e?c.label:s.label)}}var o=e.get([`axisLabel`,`showMinLabel`]),s=e.get([`axisLabel`,`showMaxLabel`]),c=t.length;a(o,0,1),a(s,c-1,c-2)}function Ole(e,t,n){e.showMinorTicks||W(t,function(e){if(e&&e.label.ignore)for(var t=0;t0&&u[1]>0&&!d[0]&&(u[0]=0),u[0]<0&&u[1]<0&&!d[1]&&(u[1]=0));var y=!1;u[0]>u[1]&&(u.reverse(),y=!0);var b=kI(e,t.get(`startValue`,!0)),x=b!=null;!Nx(b)&&r&&(b=e.getDefaultStartValue?e.getDefaultStartValue():0),Nx(b)&&(x||!_||v)&&(bu[1]&&!d[1]&&(u[1]=b,d[1]=!0)),OI(this._i={scale:e,dataMM:l,noZoomEffMM:u,zoomMM:[],fixMM:d,zoomFixMM:[!1,!1],startValue:b,isBlank:g,incl0:v,tggAxInv:y,ctnShp:i},u)}return e.prototype.makeNoZoom=function(){return this._i.noZoomEffMM.slice()},e.prototype.makeFinal=function(){var e=this._i,t=e.zoomMM,n=e.noZoomEffMM,r=e.zoomFixMM,i=e.fixMM,a={fixMM:i,zoomFixMM:r,isBlank:e.isBlank,incl0:e.incl0,tggAxInv:e.tggAxInv,ctnShp:e.ctnShp,effMM:n.slice()},o=a.effMM;return t[0]!=null&&(o[0]=t[0],i[0]=r[0]=!0),t[1]!=null&&(o[1]=t[1],i[1]=r[1]=!0),OI(e,o),a},e.prototype.makeRenderInfo=function(){return{startValue:this._i.startValue}},e.prototype.setZoomMM=function(e,t){this._i.zoomMM[e]=t},e}();function OI(e,t){var n=e.scale,r=e.dataMM;n.sanitize&&(t[0]=n.sanitize(t[0],r),t[1]=n.sanitize(t[1],r),kS(t))}function kI(e,t){return t==null?null:Ib(t)?NaN:e.parse(t)}function Ule(e,t){var n;if(pP(e))n=[0,0];else{var r=t.get(`boundaryGap`);typeof r==`boolean`&&(r=null),n=G(r)?r:[r,r]}return[AI(n[0]),AI(n[1])]}function AI(e){return qC(typeof e==`boolean`?0:e,1)||0}function jI(e){var t=Vle(e.scale);return t.extent||=CS(),t}function Wle(e,t){jI(e).dimIdxInCoord=t.get(e.dim)}function MI(e,t){var n=e.scale,r=e.model,i=e.dim;n.rawExtentInfo||Gle(n,e,i,r,t)}function Gle(e,t,n,r,i){var a=jI(t),o=a.extent,s=!1;ale(t,function(r){if(r.boxCoordinateSystem){var i=Aj(r).coord,c=a.dimIdxInCoord;if(c>=0&&G(i)){var l=i[c];l!=null&&!G(l)&&wS(o,e.parse(l))}}else if(r.coordinateSystem){var u=r.getData();if(u){var d=e.getFilter?e.getFilter():null;W(pF(u,n),function(e){_ie(o,u.getApproximateExtent(e,d))})}r.__requireStartValue&&r.__requireStartValue(t)&&(s=!0)}});var c=Jle(e,t,r);NI(e,new DI(e,r,o,s,c),i),a.extent=null}function Kle(e,t){var n=e.scale;NI(n,new DI(n,e.model,t,!1,!1),Hle)}function NI(e,t,n){e.rawExtentInfo=t,t.from=n}function qle(e,t){PI.set(e,t)}var PI=Jb();function FI(e,t,n,r,i){e.rawExtentInfo||Kle({scale:e,model:t},i||CS());var a=e.rawExtentInfo.makeFinal(),o=a.effMM;return e.setExtent(o[0],o[1]),e.setBlank(a.isBlank),r&&a.tggAxInv&&n&&!n.get(`legacyMinMaxDontInverseAxis`)&&(r.inverse=!r.inverse),a}function Jle(e,t,n){var r=bF(e,n),i=n.get(`containShape`,!0);if(i==null&&!r&&(i=!0),!i)return!1;var a=!1;return XF(t,function(e){a=!!PI.get(e)||a}),a}function Yle(e,t,n,r){if(n.ctnShp){var i;if(XF(e,function(t){var n=PI.get(t);if(n){var a=n(e,r);a&&(i||=[0,0],TS(i,a[0]),ES(i,a[1]),sF(e))}}),i){var a=t.getExtent();if(pP(t))e.onBand||t.setExtent2(1,nx(a[0],a[0]+i[0]),rx(a[1],a[1]+i[1]));else{var o=a.slice();n.zoomFixMM[0]||(o[0]=nx(o[0],t.transformOut(t.transformIn(o[0],null)+i[0],null))),n.zoomFixMM[1]||(o[1]=rx(o[1],t.transformOut(t.transformIn(o[1],null)+i[1],null))),(o[0]a[1])&&t.setExtent2(1,o[0],o[1])}}}}function Xle(e,t){var n=e.scale,r=e.model,i=FI(n,r,r.ecModel,e,null),a=fP(n),o=fP(t)?t.intervalStub:t,s=a?n.intervalStub:n,c=n.base,l=o.getTicks(),u=o.getTicks({expandToNicedExtent:!0}),d=l.length-1,f,p,m;if(d===1)f=p=0,m=1;else if(d===2){var h=ix(l[0].value-l[1].value),g=ix(l[1].value-l[2].value);f=p=0,h===g?m=2:(m=1,h=C[1])return!0})):b[1]?(T=C[1],A(function(){if(P(),k=mx(O-E*m,D),j(),w<=C[0])return!0})):A(function(){k=mx(sx(C[0]/E)*E,D),O=mx(ox(C[1]/E)*E,D);var e=ax((O-k)/E);if(e<=m){var t=m-e,n=void 0,r=i.incl0||a;if(r&&C[0]===0)n=[0,t];else if(r&&C[1]===0)n=[t,0];else{var o=ox(t/2);n=t%2==0?[o,o]:w+T=C[1])return!0}})}vF(n,b,S,[w,T],x,{interval:E,intervalCount:m,intervalPrecision:D,niceExtent:[k,O]})}function II(e,t){var n=fP(e),r=n?e.intervalStub:e,i=t.fixMinMax||[],a=n?e.getExtent():null,o=r.getExtent(),s=vP(o,i,t.rawExtentResult);r.setExtent(s[0],s[1]),s=r.getExtent();var c=n?Qle(r,t):Zle(r,t),l=c.intervalPrecision,u=c.interval,d=t.userInterval;d!=null&&(c.interval=d,c.intervalPrecision=hP(d)),i[0]||(s[0]=mx(ox(s[0]/u)*u,l)),i[1]||(s[1]=mx(sx(s[1]/u)*u,l)),d!=null&&(c.niceExtent=s.slice()),vF(e,i,o,s,a,c)}function Zle(e,t){var n=bP(t.splitNumber,5),r=QN(e),i=t.minInterval,a=t.maxInterval,o=Ex(r/n,!0);i!=null&&oa&&(o=a);var s=hP(o),c=e.getExtent(),l=[mx(sx(c[0]/o)*o,s),mx(ox(c[1]/o)*o,s)];return{interval:o,intervalPrecision:s,niceExtent:l}}function Qle(e,t){var n=bP(t.splitNumber,10),r=e.getExtent(),i=QN(e),a=rx(Cx(i),1);n/i*a<=.5&&(a*=10);var o=hP(a),s=[mx(sx(r[0]/a)*a,o),mx(ox(r[1]/a)*a,o)];return{intervalPrecision:o,interval:a,niceExtent:s}}function LI(e){var t=e.scale,n=e.model,r=n.axis,i=n.ecModel;$le(t,n,r,i,null)}function $le(e,t,n,r,i){var a=FI(e,t,r,n,i),o=uP(e)||dP(e);eue(e,{splitNumber:t.get(`splitNumber`),fixMinMax:a.fixMM,userInterval:t.get(`interval`),minInterval:o?t.get(`minInterval`):null,maxInterval:o?t.get(`maxInterval`):null,rawExtentResult:a}),n&&r&&Yle(n,e,a,r)}function eue(e,t){tue[e.type](e,t)}var tue={interval:II,log:II,time:LP,ordinal:Qb},RI=[[3,1],[0,2]],nue=function(){function e(e,t,n){this.type=`grid`,this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=EF,this._initCartesian(e,t,n),this.model=e}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(e,t){var n=this._axesMap;W(this._axesList,function(e){MI(e,1);var t=e.scale;pP(t)&&t.setSortInfo(e.model.get(`categorySortInfo`))});function r(e){for(var t=wb(e),n=[],r=t.length-1;r>=0;r--){var i=e[+t[r]];i.__alignTo?n.push(i):LI(i)}W(n,function(e){iue(e,e.__alignTo)?LI(e):Xle(e,e.__alignTo.scale)})}r(n.x),r(n.y);var i={};W(n.x,function(e){zI(n,`y`,e,i)}),W(n.y,function(e){zI(n,`x`,e,i)}),this.resize(this.model,t)},e.prototype.resize=function(e,t,n){var r=Rj(e,t),i=this._rect=Ij(e.getBoxLayoutParams(),r.refContainer),a=this._axesMap,o=this._coordsList,s=e.get(`containLabel`);if(HI(a,i),!n){var c=oue(i,o,a,s,t),l=void 0;if(s)WI?(WI(this._axesList,i),HI(a,i)):l=GI(i.clone(),`axisLabel`,null,i,a,c,r);else{var u=sue(e,i,r),d=u.outerBoundsRect,f=u.parsedOuterBoundsContain,p=u.outerBoundsClamp;d&&(l=GI(d,f,p,i,a,c,r))}KI(i,a,jF.determine,null,l,r),W(this._coordsList,function(e){e.calcAffineTransform()})}},e.prototype.getAxis=function(e,t){var n=this._axesMap[e];if(n!=null)return n[t||0]},e.prototype.getAxes=function(){return this._axesList.slice()},e.prototype.getCartesian=function(e,t){if(e!=null&&t!=null){var n=`x`+e+`y`+t;return this._coordsMap[n]}jb(e)&&(t=e.yAxisIndex,e=e.xAxisIndex);for(var r=0,i=this._coordsList;r=0;i--){var a=e[+t[i]];lP(a.scale)&&gF(a.model,a.type,!0)==null&&(a.model.get(`alignTicks`)&&a.model.get(`interval`)==null?r.push(a):n=a)}n||=r.pop(),n&&W(r,function(e){e.__alignTo=n})}function iue(e,t){return GA(e.scale)||GA(t.scale)||t.scale.getTicks().length<2}function aue(e,t){var n=e.getExtent(),r=n[0]+n[1];e.toGlobalCoord=e.dim===`x`?function(e){return e+t}:function(e){return r-e+t},e.toLocalCoord=e.dim===`x`?function(e){return e-t}:function(e){return r-e+t}}function HI(e,t){W(e.x,function(e){return UI(e,t.x,t.width)}),W(e.y,function(e){return UI(e,t.y,t.height)})}function UI(e,t,n){var r=[0,n],i=+!!e.inverse;e.setExtent(r[i],r[1-i]),aue(e,t)}var WI;function GI(e,t,n,r,i,a,o){KI(r,i,jF.estimate,t,!1,o);var s=[0,0,0,0];l(0),l(1),u(r,0,NaN),u(r,1,NaN);var c=Cb(s,function(e){return e>0})==null;return qk(r,s,!0,!0,n),HI(i,r),c;function l(e){W(i[Ok[e]],function(t){if(hF(t.model)){var n=a.ensureRecord(t.model),r=n.labelInfoList;if(r)for(var i=0;i0&&!Ib(t)&&t>1e-4&&(e/=t),e}}function oue(e,t,n,r,i){var a=new dI(cue);return W(n,function(n){return W(n,function(n){if(hF(n.model)){var o=!r;n.axisBuilder=Rle(e,t,n.model,i,a,o)}})}),a}function KI(e,t,n,r,i,a){var o=n===jF.determine;W(t,function(t){return W(t,function(t){hF(t.model)&&(zle(t.axisBuilder,e,t.model),t.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:i}))})});var s={x:0,y:0};c(0),c(1);function c(t){s[Ok[1-t]]=e[kk[t]]<=a.refContainer[kk[t]]*.5?0:1-t==1?2:1}W(t,function(e,t){return W(e,function(e){hF(e.model)&&((r===`all`||o)&&e.axisBuilder.build({axisName:!0},{nameMarginLevel:s[t]}),o&&e.axisBuilder.build({axisLine:!0}))})})}function sue(e,t,n){var r,i=e.get(`outerBoundsMode`,!0);i===`same`?r=t.clone():(i==null||i===`auto`)&&(r=Ij(e.get(`outerBounds`,!0)||SF,n.refContainer));var a=e.get(`outerBoundsContain`,!0),o=a==null||a===`auto`||_b([`all`,`axisLabel`],a)<0?`all`:a,s=[px(Rb(e.get(`outerBoundsClampWidth`,!0),CF[0]),t.width),px(Rb(e.get(`outerBoundsClampHeight`,!0),CF[1]),t.height)];return{outerBoundsRect:r,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var cue=function(e,t,n,r,i,a){var o=n.axis.dim===`x`?`y`:`x`;mI(e,t,n,r,i,a),mF(e.nameLocation)||W(t.recordMap[o],function(e){e&&e.labelInfoList&&e.dirVec&&gI(e.labelInfoList,e.dirVec,r,i)})},qI=function(){function e(e,t){this.target=e,this.topTarget=t&&t.topTarget}return e}(),lue=function(){function e(e){this.handler=e,e.on(`mousedown`,this._dragStart,this),e.on(`mousemove`,this._drag,this),e.on(`mouseup`,this._dragEnd,this)}return e.prototype._dragStart=function(e){for(var t=e.target;t&&!t.draggable;)t=t.parent||t.__hostTarget;t&&(this._draggingTarget=t,t.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new qI(t,e),`dragstart`,e.event))},e.prototype._drag=function(e){var t=this._draggingTarget;if(t){var n=e.offsetX,r=e.offsetY,i=n-this._x,a=r-this._y;this._x=n,this._y=r,t.drift(i,a,e),this.handler.dispatchToElement(new qI(t,e),`drag`,e.event);var o=this.handler.findHover(n,r,t).target,s=this._dropTarget;this._dropTarget=o,t!==o&&(s&&o!==s&&this.handler.dispatchToElement(new qI(s,e),`dragleave`,e.event),o&&o!==s&&this.handler.dispatchToElement(new qI(o,e),`dragenter`,e.event))}},e.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new qI(t,e),`dragend`,e.event),this._dropTarget&&this.handler.dispatchToElement(new qI(this._dropTarget,e),`drop`,e.event),this._draggingTarget=null,this._dropTarget=null},e}(),uue=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,JI=[],due=$b.browser.firefox&&+$b.browser.version.split(`.`)[0]<39;function YI(e,t,n,r){return n||={},r?XI(e,t,n):due&&t.layerX!=null&&t.layerX!==t.offsetX?(n.zrX=t.layerX,n.zrY=t.layerY):t.offsetX==null?XI(e,t,n):(n.zrX=t.offsetX,n.zrY=t.offsetY),n}function XI(e,t,n){if($b.domSupported&&e.getBoundingClientRect){var r=t.clientX,i=t.clientY;if(NA(e)){var a=e.getBoundingClientRect();n.zrX=r-a.left,n.zrY=i-a.top;return}if(MA(JI,e,r,i)){n.zrX=JI[0],n.zrY=JI[1];return}}n.zrX=n.zrY=0}function ZI(e){return e||window.event}function QI(e,t,n){if(t=ZI(t),t.zrX!=null)return t;var r=t.type;if(r&&r.indexOf(`touch`)>=0){var i=r===`touchend`?t.changedTouches[0]:t.targetTouches[0];i&&YI(e,i,t,n)}else{YI(e,t,t,n);var a=fue(t);t.zrDelta=a?a/120:-(t.detail||0)/3}var o=t.button;return t.which==null&&o!==void 0&&uue.test(t.type)&&(t.which=o&1?1:o&2?3:o&4?2:0),t}function fue(e){var t=e.wheelDelta;if(t)return t;var n=e.deltaX,r=e.deltaY;if(n==null||r==null)return t;var i=Math.abs(r===0?n:r),a=r>0?-1:r<0?1:n>0?-1:1;return 3*i*a}function $I(e,t,n,r){e.addEventListener(t,n,r)}function pue(e,t,n,r){e.removeEventListener(t,n,r)}var eL=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function tL(e){return e.which===2||e.which===3}var mue=function(){function e(){this._track=[]}return e.prototype.recognize=function(e,t,n){return this._doTrack(e,t,n),this._recognize(e)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(e,t,n){var r=e.touches;if(r){for(var i={points:[],touches:[],target:t,event:e},a=0,o=r.length;a1&&r&&r.length>1){var a=nL(r)/nL(i);!isFinite(a)&&(a=1),t.pinchScale=a;var o=hue(r);return t.pinchX=o[0],t.pinchY=o[1],{type:`pinch`,target:e[0].target,event:t}}}}},iL=`silent`;function gue(e,t,n){return{type:e,event:n,target:t.target,topTarget:t.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:_ue}}function _ue(){eL(this.event)}var vue=function(e){H(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.handler=null,t}return t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(kT),aL=function(){function e(e,t){this.x=e,this.y=t}return e}(),yue=[`click`,`dblclick`,`mousewheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],oL=new OC(0,0,0,0),sL=function(e){H(t,e);function t(t,n,r,i,a){var o=e.call(this)||this;return o._hovered=new aL(0,0),o.storage=t,o.painter=n,o.painterRoot=i,o._pointerSize=a,r||=new vue,o.proxy=null,o.setHandlerProxy(r),o._draggingMgr=new lue(o),o}return t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(W(yue,function(t){e.on&&e.on(t,this[t],this)},this),e.handler=this),this.proxy=e},t.prototype.mousemove=function(e){var t=e.zrX,n=e.zrY,r=lL(this,t,n),i=this._hovered,a=i.target;a&&!a.__zr&&(i=this.findHover(i.x,i.y),a=i.target);var o=this._hovered=r?new aL(t,n):this.findHover(t,n),s=o.target,c=this.proxy;c.setCursor&&c.setCursor(s?s.cursor:`default`),a&&s!==a&&this.dispatchToElement(i,`mouseout`,e),this.dispatchToElement(o,`mousemove`,e),s&&s!==a&&this.dispatchToElement(o,`mouseover`,e)},t.prototype.mouseout=function(e){var t=e.zrEventControl;t!==`only_globalout`&&this.dispatchToElement(this._hovered,`mouseout`,e),t!==`no_globalout`&&this.trigger(`globalout`,{type:`globalout`,event:e})},t.prototype.resize=function(){this._hovered=new aL(0,0)},t.prototype.dispatch=function(e,t){var n=this[e];n&&n.call(this,t)},t.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},t.prototype.setCursorStyle=function(e){var t=this.proxy;t.setCursor&&t.setCursor(e)},t.prototype.dispatchToElement=function(e,t,n){e||={};var r=e.target;if(!(r&&r.silent)){for(var i=`on`+t,a=gue(t,e,n);r&&(r[i]&&(a.cancelBubble=!!r[i].call(r,a)),r.trigger(t,a),r=r.__hostTarget?r.__hostTarget:r.parent,!a.cancelBubble););a.cancelBubble||(this.trigger(t,a),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(e){typeof e[i]==`function`&&e[i].call(e,a),e.trigger&&e.trigger(t,a)}))}},t.prototype.findHover=function(e,t,n){var r=this.storage.getDisplayList(),i=new aL(e,t);if(cL(r,i,e,t,n),this._pointerSize&&!i.target){for(var a=[],o=this._pointerSize,s=o/2,c=new OC(e-s,t-s,o,o),l=r.length-1;l>=0;l--){var u=r[l];u!==n&&!u.ignore&&!u.ignoreCoarsePointer&&(!u.parent||!u.parent.ignoreCoarsePointer)&&(oL.copy(u.getBoundingRect()),u.transform&&oL.applyTransform(u.transform),oL.intersect(c)&&a.push(u))}if(a.length){for(var d=4,f=Math.PI/12,p=Math.PI*2,m=0;m4)return;this._downPoint=null}this.dispatchToElement(a,e,t)}});function bue(e,t,n){if(e[e.rectHover?`rectContain`:`contain`](t,n)){for(var r=e,i=void 0,a=!1;r;){if(r.ignoreClip&&(a=!0),!a){var o=r.getClipPath();if(o&&!o.contain(t,n))return!1}r.silent&&(i=!0);var s=r.__hostTarget;r=s?r.ignoreHostSilent?null:s:r.parent}return!i||iL}return!1}function cL(e,t,n,r,i){for(var a=e.length-1;a>=0;a--){var o=e[a],s=void 0;if(o!==i&&!o.ignore&&(s=bue(o,n,r))&&(!t.topTarget&&(t.topTarget=o),s!==iL)){t.target=o;break}}}function lL(e,t,n){var r=e.painter;return t<0||t>r.getWidth()||n<0||n>r.getHeight()}var uL=32,dL=7;function xue(e){for(var t=0;e>=uL;)t|=e&1,e>>=1;return e+t}function fL(e,t,n,r){var i=t+1;if(i===n)return 1;if(r(e[i++],e[t])<0){for(;i=0;)i++;return i-t}function Sue(e,t,n){for(n--;t>>1,i(a,e[c])<0?s=c:o=c+1;var l=r-o;switch(l){case 3:e[o+3]=e[o+2];case 2:e[o+2]=e[o+1];case 1:e[o+1]=e[o];break;default:for(;l>0;)e[o+l]=e[o+l-1],l--}e[o]=a}}function mL(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])>0){for(s=r-i;c0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}else{for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}for(o++;o>>1);a(e,t[n+u])>0?o=u+1:c=u}return c}function hL(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])<0){for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}else{for(s=r-i;c=0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}for(o++;o>>1);a(e,t[n+u])<0?c=u:o=u+1}return c}function Cue(e,t){var n=dL,r,i,a=0,o=[];r=[],i=[];function s(e,t){r[a]=e,i[a]=t,a+=1}function c(){for(;a>1;){var e=a-2;if(e>=1&&i[e-1]<=i[e]+i[e+1]||e>=2&&i[e-2]<=i[e]+i[e-1])i[e-1]i[e+1])break;u(e)}}function l(){for(;a>1;){var e=a-2;e>0&&i[e-1]=dL||m>=dL);if(h)break;f<0&&(f=0),f+=2}if(n=f,n<1&&(n=1),i===1){for(c=0;c=0;c--)e[p+c]=e[f+c];e[d]=o[u];return}for(var m=n;;){var h=0,g=0,_=!1;do if(t(o[u],e[l])<0){if(e[d--]=e[l--],h++,g=0,--i===0){_=!0;break}}else if(e[d--]=o[u--],g++,h=0,--s===1){_=!0;break}while((h|g)=0;c--)e[p+c]=e[f+c];if(i===0){_=!0;break}}if(e[d--]=o[u--],--s===1){_=!0;break}if(g=s-mL(e[l],o,0,s,s-1,t),g!==0){for(d-=g,u-=g,s-=g,p=d+1,f=u+1,c=0;c=dL||g>=dL);if(_)break;m<0&&(m=0),m+=2}if(n=m,n<1&&(n=1),s===1){for(d-=i,l-=i,p=d+1,f=l+1,c=i-1;c>=0;c--)e[p+c]=e[f+c];e[d]=o[u]}else if(s===0)throw Error();else for(f=d-(s-1),c=0;cs&&(c=s),pL(e,n,n+c,n+a,t),a=c}o.pushRun(n,a),o.mergeRuns(),i-=a,n+=a}while(i!==0);o.forceMergeRuns()}}var _L=!1;function vL(){_L||(_L=!0,console.warn(`z / z2 / zlevel of displayable is invalid, which may cause unexpected errors`))}function yL(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var wue=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=yL}return e.prototype.traverse=function(e,t){for(var n=0;n=0&&this._roots.splice(r,1)},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),bL=$b.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};function xL(){return new Date().getTime()}var Tue=function(e){H(t,e);function t(t){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,t||={},n.stage=t.stage||{},n}return t.prototype.addClip=function(e){e.animation&&this.removeClip(e),this._head?(this._tail.next=e,e.prev=this._tail,e.next=null,this._tail=e):this._head=this._tail=e,e.animation=this},t.prototype.addAnimator=function(e){e.animation=this;var t=e.getClip();t&&this.addClip(t)},t.prototype.removeClip=function(e){if(e.animation){var t=e.prev,n=e.next;t?t.next=n:this._head=n,n?n.prev=t:this._tail=t,e.next=e.prev=e.animation=null}},t.prototype.removeAnimator=function(e){var t=e.getClip();t&&this.removeClip(t),e.animation=null},t.prototype.update=function(e){for(var t=xL()-this._pausedTime,n=t-this._time,r=this._head;r;){var i=r.next;r.step(t,n)?(r.ondestroy(),this.removeClip(r),r=i):r=i}this._time=t,e||(this.trigger(`frame`,n),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var e=this;this._running=!0;function t(){e._running&&(bL(t),!e._paused&&e.update())}bL(t)},t.prototype.start=function(){this._running||(this._time=xL(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||=(this._pauseStart=xL(),!0)},t.prototype.resume=function(){this._paused&&=(this._pausedTime+=xL()-this._pauseStart,!1)},t.prototype.clear=function(){for(var e=this._head;e;){var t=e.next;e.prev=e.next=e.animation=null,e=t}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(e,t){t||={},this.start();var n=new OT(e,t.loop);return this.addAnimator(n),n},t}(kT),Eue=300,SL=$b.domSupported,CL=(function(){var e=[`click`,`dblclick`,`mousewheel`,`wheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],t=[`touchstart`,`touchend`,`touchmove`],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1};return{mouse:e,touch:t,pointer:bb(e,function(e){var t=e.replace(`mouse`,`pointer`);return n.hasOwnProperty(t)?t:e})}})(),wL={mouse:[`mousemove`,`mouseup`],pointer:[`pointermove`,`pointerup`]},TL=!1;function EL(e){var t=e.pointerType;return t===`pen`||t===`touch`}function Due(e){e.touching=!0,e.touchTimer!=null&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}function DL(e){e&&(e.zrByTouch=!0)}function Oue(e,t){return QI(e.dom,new kue(e,t),!0)}function OL(e,t){for(var n=t,r=!1;n&&n.nodeType!==9&&!(r=n.domBelongToZr||n!==t&&n===e.painterRoot);)n=n.parentNode;return r}var kue=function(){function e(e,t){this.stopPropagation=Qb,this.stopImmediatePropagation=Qb,this.preventDefault=Qb,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return e}(),kL={mousedown:function(e){e=QI(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger(`mousedown`,e)},mousemove:function(e){e=QI(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger(`mousemove`,e)},mouseup:function(e){e=QI(this.dom,e),this.__togglePointerCapture(!1),this.trigger(`mouseup`,e)},mouseout:function(e){e=QI(this.dom,e);var t=e.toElement||e.relatedTarget;OL(this,t)||(this.__pointerCapturing&&(e.zrEventControl=`no_globalout`),this.trigger(`mouseout`,e))},wheel:function(e){TL=!0,e=QI(this.dom,e),this.trigger(`mousewheel`,e)},mousewheel:function(e){TL||(e=QI(this.dom,e),this.trigger(`mousewheel`,e))},touchstart:function(e){e=QI(this.dom,e),DL(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,`start`),kL.mousemove.call(this,e),kL.mousedown.call(this,e)},touchmove:function(e){e=QI(this.dom,e),DL(e),this.handler.processGesture(e,`change`),kL.mousemove.call(this,e)},touchend:function(e){e=QI(this.dom,e),DL(e),this.handler.processGesture(e,`end`),kL.mouseup.call(this,e),+new Date-this.__lastTouchMoment0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||this._refresh({animUpdate:!1,refresh:!1,refreshHover:!0})},e.prototype.resize=function(e){this._disposed||(e||={},this.painter.resize(e.width,e.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},e.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},e.prototype.on=function(e,t,n){return this._disposed||this.handler.on(e,t,n),this},e.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},e.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},e.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t=0;o--)r[o]&&!aS(r[o])?a=!0:(r[o]=null,!a&&i--);r.length=i,e[n]=r}}),delete e[GL],e},t.prototype.setTheme=function(e){this._theme=new TA(e),this._resetOption(`recreate`,null)},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(e){this._payload=e},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(e,t){var n=this._componentsMap.get(e);if(n){var r=n[t||0];if(r)return r;if(t==null){for(var i=0;i=t:n===`max`?e<=t:e===t}function Jue(e,t){return e.join(`,`)===t.join(`,`)}var XL=W,ZL=jb,QL=[`areaStyle`,`lineStyle`,`nodeStyle`,`linkStyle`,`chordStyle`,`label`,`labelLine`];function $L(e){var t=e&&e.itemStyle;if(t)for(var n=0,r=QL.length;n0?e[n-1].seriesModel:null)}),ide(e))})}function ide(e){W(e,function(t,n){var r=[],i=[NaN,NaN],a=[t.stackResultDimension,t.stackedOverDimension],o=t.data,s=t.isStackedByIndex,c=t.seriesModel.get(`stackStrategy`)||`samesign`;o.modify(a,function(a,l,u){var d=o.get(t.stackedDimension,u);if(isNaN(d))return i;var f,p;s?p=o.getRawIndex(u):f=o.get(t.stackedByDimension,u);for(var m=NaN,h=n-1;h>=0;h--){var g=e[h];if(s||(p=g.data.rawIndexOf(g.stackedByDimension,f)),p>=0){var _=g.data.getByRawIndex(g.stackResultDimension,p);if(c===`all`||c===`positive`&&_>0||c===`negative`&&_<0||c===`samesign`&&d>=0&&_>0||c===`samesign`&&d<=0&&_<0){d=vx(d,_),m=_;break}}}return r[0]=d,r[1]=m,r})})}var pR=function(){function e(){this.group=new LO,this.uid=EA(`viewComponent`)}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,r){},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,r){},e.prototype.updateLayout=function(e,t,n,r){},e.prototype.updateVisual=function(e,t,n,r){},e.prototype.toggleBlurSeries=function(e,t,n){},e.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},e}();RS(pR),BS(pR);function mR(){var e=dS();return function(t){var n=e(t),r=t.pipelineContext,i=!!n.large,a=!!n.progressiveRender,o=n.large=!!(r&&r.large),s=n.progressiveRender=!!(r&&r.progressiveRender);return(i!==o||a!==s)&&`reset`}}var hR=dS(),ade=mR(),gR=function(){function e(){this.group=new LO,this.uid=EA(`viewChart`),this.renderTask=TM({plan:ode,reset:sde}),this.renderTask.context={view:this}}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,r){},e.prototype.highlight=function(e,t,n,r){var i=e.getData(r&&r.dataType);i&&vR(i,r,`emphasis`)},e.prototype.downplay=function(e,t,n,r){var i=e.getData(r&&r.dataType);i&&vR(i,r,`normal`)},e.prototype.remove=function(e,t){this.group.removeAll()},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,r){this.render(e,t,n,r)},e.prototype.updateVisual=function(e,t,n,r){this.render(e,t,n,r)},e.prototype.eachRendered=function(e){Qk(this.group,e)},e.markUpdateMethod=function(e,t){hR(e).updateMethod=t},e.protoInitialize=function(){var t=e.prototype;t.type=`chart`}(),e}();function _R(e,t,n){e&&xO(e)&&(t===`emphasis`?iO:aO)(e,n)}function vR(e,t,n){var r=uS(e,t),i=t&&t.highlightKey!=null?eoe(t.highlightKey):null;r==null?e.eachItemGraphicEl(function(e){_R(e,n,i)}):W(Ux(r),function(t){_R(e.getItemGraphicEl(t),n,i)})}RS(gR,[`dispose`]),BS(gR);function ode(e){return ade(e.model)}function sde(e){var t=e.model,n=e.ecModel,r=e.api,i=e.payload,a=t.pipelineContext.progressiveRender,o=e.view,s=i&&hR(i).updateMethod,c=a?`incrementalPrepareRender`:s&&o[s]?s:`render`;return c!==`render`&&o[c](t,n,r,i),cde[c]}var cde={incrementalPrepareRender:{progress:function(e,t){t.view.incrementalRender(e,t.model,t.ecModel,t.api,t.payload)}},render:{forceFirstProgress:!0,progress:function(e,t){t.view.render(t.model,t.ecModel,t.api,t.payload)}}},yR=`\0__throttleOriginMethod`,bR=`\0__throttleRate`,xR=`\0__throttleType`;function SR(e,t,n){var r,i=0,a=0,o=null,s,c,l,u;t||=0;function d(){a=new Date().getTime(),o=null,e.apply(c,l||[])}var f=function(){var e=[...arguments];r=new Date().getTime(),c=this,l=e;var f=u||t,p=u||n;u=null,s=r-(p?i:a)-f,clearTimeout(o),p?o=setTimeout(d,f):s>=0?d():o=setTimeout(d,-s),i=r};return f.clear=function(){o&&=(clearTimeout(o),null)},f.debounceNextCall=function(e){u=e},f}function CR(e,t,n,r){var i=e[t];if(i){var a=i[yR]||i,o=i[xR];if(i[bR]!==n||o!==r){if(n==null||!r)return e[t]=a;i=e[t]=SR(a,n,r===`debounce`),i[yR]=a,i[xR]=r,i[bR]=n}return i}}function wR(e,t){var n=e[t];n&&n[yR]&&(n.clear&&n.clear(),e[t]=n[yR])}var TR=dS(),ER={itemStyle:VS(wA,!0),lineStyle:VS(CA,!0)},lde={lineStyle:`stroke`,itemStyle:`fill`};function DR(e,t){return e.visualStyleMapper||ER[t]||(console.warn(`Unknown style type '`+t+`'.`),ER.itemStyle)}function OR(e,t){return e.visualDrawType||lde[t]||(console.warn(`Unknown style type '`+t+`'.`),`fill`)}var ude={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=e.getModel(r),a=DR(e,r)(i),o=i.getShallow(`decal`);o&&(n.setVisual(`decal`,o),o.dirty=!0);var s=OR(e,r),c=a[s],l=Db(c)?c:null,u=a.fill===`auto`||a.stroke===`auto`;if(!a[s]||l||u){var d=e.getColorFromPalette(e.name,null,t.getSeriesCount());a[s]||(a[s]=d,n.setVisual(`colorFromPalette`,!0)),a.fill=a.fill===`auto`||Db(a.fill)?d:a.fill,a.stroke=a.stroke===`auto`||Db(a.stroke)?d:a.stroke}if(n.setVisual(`style`,a),n.setVisual(`drawType`,s),!t.isSeriesFiltered(e)&&l)return n.setVisual(`colorFromPalette`,!1),{dataEach:function(t,n){var r=e.getDataParams(n),i=U({},a);i[s]=l(r),t.setItemVisual(n,`style`,i)}}}},kR=new TA,dde={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=DR(e,r),a=n.getVisual(`drawType`);return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[r]){kR.option=n[r];var o=i(kR);U(e.ensureUniqueItemVisual(t,`style`),o),kR.option.decal&&(e.setItemVisual(t,`decal`,kR.option.decal),kR.option.decal.dirty=!0),a in o&&e.setItemVisual(t,`colorFromPalette`,!1)}}:null}}}},fde={performRawSeries:!0,overallReset:function(e){var t=Jb();e.eachSeries(function(e){if(!e.isColorBySeries()){var n=e.type+`-`+e.getColorBy();TR(e).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(e){if(!e.isColorBySeries()){var t=e.getRawData(),n={},r=e.getData(),i=TR(e).scope,a=OR(e,e.visualStyleAccessPath||`itemStyle`);r.each(function(e){var t=r.getRawIndex(e);n[t]=e}),t.each(function(o){var s=n[o];if(r.getItemVisual(s,`colorFromPalette`)){var c=r.ensureUniqueItemVisual(s,`style`),l=t.getName(o)||o+``,u=t.count();c[a]=e.getColorFromPalette(l,i,u)}})}})}},AR=Math.PI;function pde(e,t){t||={},gb(t,{text:`loading`,textColor:K.color.primary,fontSize:12,fontWeight:`normal`,fontStyle:`normal`,fontFamily:`sans-serif`,maskColor:`rgba(255,255,255,0.8)`,showSpinner:!0,color:K.color.theme[0],spinnerRadius:10,lineWidth:5,zlevel:0});var n=new LO,r=new eD({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});n.add(r);var i=new aD({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),a=new eD({style:{fill:`none`},textContent:i,textConfig:{position:`right`,distance:10},zlevel:t.zlevel,z:10001});n.add(a);var o;return t.showSpinner&&(o=new ok({shape:{startAngle:-AR/2,endAngle:-AR/2+.1,r:t.spinnerRadius},style:{stroke:t.color,lineCap:`round`,lineWidth:t.lineWidth},zlevel:t.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:AR*3/2}).start(`circularInOut`),o.animateShape(!0).when(1e3,{startAngle:AR*3/2}).delay(300).start(`circularInOut`),n.add(o)),n.resize=function(){var n=i.getBoundingRect().width,s=t.showSpinner?t.spinnerRadius:0,c=(e.getWidth()-s*2-(t.showSpinner&&n?10:0)-n)/2-(t.showSpinner&&n?0:5+n/2)+(t.showSpinner?0:n/2)+(n?0:s),l=e.getHeight()/2;t.showSpinner&&o.setShape({cx:c,cy:l}),a.setShape({x:c-s,y:l-s,width:s*2,height:s*2}),r.setShape({x:0,y:0,width:e.getWidth(),height:e.getHeight()})},n.resize(),n}var jR=function(){function e(e,t,n,r){this._stageTaskMap=Jb(),this.ecInstance=e,this.api=t,n=this._dataProcessorHandlers=n.slice(),r=this._visualHandlers=r.slice(),this._allHandlers=n.concat(r)}return e.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each(function(e){var t=e.overallTask;t&&t.dirty()})},e.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var n=this._pipelineMap.get(e.__pipeline.id),r=n.context,i=!t&&n.progressiveEnabled&&(!r||r.progressiveRender)&&e.__idxInPipeline>n.blockIndex?n.step:null,a=r&&r.modDataCount;return{step:i,modBy:a==null?null:Math.ceil(a/i),modDataCount:a}}},e.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},e.prototype.updateStreamModes=function(e,t){var n=this._pipelineMap.get(e.uid);e.pipelineContext=n.context=e.__preparePipelineContext?e.__preparePipelineContext(t,n):NS(e,t,n)},e.prototype.restorePipelines=function(e,t){var n=this,r=n._pipelineMap=Jb();t.eachSeries(function(t){var i=e.painter.type===`canvas`&&t.getProgressive(),a=t.uid;r.set(a,{id:a,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),n._pipe(t,t.dataTask)})},e.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),n=this.api;W(this._allHandlers,function(r){var i=e.get(r.uid)||e.set(r.uid,{});Hb(!(r.reset&&r.overallReset),``),r.reset&&this._createSeriesStageTask(r,i,t,n),r.overallReset&&this._createOverallStageTask(r,i,t,n)},this)},e.prototype.prepareView=function(e,t,n,r){var i=e.renderTask,a=i.context;a.model=t,a.ecModel=n,a.api=r,i.__block=!e.incrementalPrepareRender,this._pipe(t,i)},e.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},e.prototype.performVisualTasks=function(e,t,n){this._performStageTasks(this._visualHandlers,e,t,n)},e.prototype._performStageTasks=function(e,t,n,r){r||={};var i=!1,a=this;W(e,function(e,s){if(!(r.visualType&&r.visualType!==e.visualType)){var c=a._stageTaskMap.get(e.uid),l=c.seriesTaskMap,u=c.overallTask;if(u){var d,f=u.agentStubMap;f.each(function(e){o(r,e)&&(e.dirty(),d=!0)}),d&&u.dirty(),a.updatePayload(u,n);var p=a.getPerformArgs(u,r.block);f.each(function(e){e.perform(p)}),u.perform(p)&&(i=!0)}else l&&l.each(function(s,c){o(r,s)&&s.dirty();var l=a.getPerformArgs(s,r.block);l.skip=!e.performRawSeries&&t.isSeriesFiltered(s.context.model),a.updatePayload(s,n),s.perform(l)&&(i=!0)})}});function o(e,t){return e.setDirty&&(!e.dirtyMap||e.dirtyMap.get(t.__pipeline.id))}this.unfinished=i||this.unfinished},e.prototype.performSeriesTasks=function(e){var t;e.eachSeries(function(e){t=e.dataTask.perform()||t}),this.unfinished=t||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each(function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)})},e.prototype.updatePayload=function(e,t){t!==`remain`&&(e.context.payload=t)},e.prototype._createSeriesStageTask=function(e,t,n,r){var i=this,a=t.seriesTaskMap,o=t.seriesTaskMap=Jb(),s=e.seriesType,c=e.getTargetSeries;e.createOnAllSeries?n.eachRawSeries(l):s?n.eachRawSeriesByType(s,l):c&&c(n,r).each(l);function l(t){var s=t.uid,c=o.set(s,a&&a.get(s)||TM({plan:vde,reset:yde,count:xde}));c.context={model:t,ecModel:n,api:r,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:i},i._pipe(t,c)}},e.prototype._createOverallStageTask=function(e,t,n,r){var i=this,a=t.overallTask=t.overallTask||TM({reset:mde});a.context={ecModel:n,api:r,overallReset:e.overallReset,scheduler:i};var o=a.agentStubMap,s=a.agentStubMap=Jb(),c=e.seriesType,l=e.getTargetSeries,u=e.dirtyOnOverallProgress,d=!1;Hb(!e.createOnAllSeries,``),c?n.eachRawSeriesByType(c,f):l?l(n,r).each(f):W(n.getSeries(),f);function f(e){var t=e.uid,n=s.set(t,o&&o.get(t)||(d=!0,TM({reset:hde,onDirty:_de})));n.context={model:e,dirtyOnOverallProgress:u},n.agent=a,n.__block=u,i._pipe(e,n)}d&&a.dirty()},e.prototype._pipe=function(e,t){var n=e.uid,r=this._pipelineMap.get(n);!r.head&&(r.head=t),r.tail&&r.tail.pipe(t),r.tail=t,t.__idxInPipeline=r.count++,t.__pipeline=r},e.wrapStageHandler=function(e,t){return Db(e)&&(e={overallReset:e,seriesType:Sde(e)}),e.uid=EA(`stageHandler`),t&&(e.visualType=t),e},e}();function mde(e){e.overallReset(e.ecModel,e.api,e.payload)}function hde(e){return e.dirtyOnOverallProgress&&gde}function gde(){this.agent.dirty(),this.getDownstream().dirty()}function _de(){this.agent&&this.agent.dirty()}function vde(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function yde(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Ux(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?bb(t,function(e,t){return MR(t)}):bde}var bde=MR(0);function MR(e){return function(t,n){var r=n.data,i=n.resetDefines[e];if(i&&i.dataEach)for(var a=t.start;a0&&u===i.length-l.length){var d=i.slice(0,u);d!==`data`&&(t.mainType=d,t[l.toLowerCase()]=e,s=!0)}}o.hasOwnProperty(i)&&(n[i]=e,s=!0),s||(r[i]=e)})}return{cptQuery:t,dataQuery:n,otherQuery:r}},e.prototype.filter=function(e,t){var n=this.eventInfo;if(!n)return!0;var r=n.targetEl,i=n.packedEvent,a=n.model,o=n.view;if(!a||!o)return!0;var s=t.cptQuery,c=t.dataQuery;return l(s,a,`mainType`)&&l(s,a,`subType`)&&l(s,a,`index`,`componentIndex`)&&l(s,a,`name`)&&l(s,a,`id`)&&l(c,i,`name`)&&l(c,i,`dataIndex`)&&l(c,i,`dataType`)&&(!o.filterForExposedEvent||o.filterForExposedEvent(e,t.otherQuery,r,i));function l(e,t,n,r){return e[n]==null||t[r||n]===e[n]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),HR=[`symbol`,`symbolSize`,`symbolRotate`,`symbolOffset`],UR=HR.concat([`symbolKeepAspect`]),wde={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData();if(e.legendIcon&&n.setVisual(`legendIcon`,e.legendIcon),!e.hasSymbolVisual)return;for(var r={},i={},a=!1,o=0;o=0&&QR(c)?c:.5,e.createRadialGradient(o,s,0,o,s,c)}function $R(e,t,n){for(var r=t.type===`radial`?Fde(e,t,n):Pde(e,t,n),i=t.colorStops,a=0;a0)?null:e===`dashed`?[4*t,2*t]:e===`dotted`?[t]:Ab(e)?[e]:G(e)?e:null}function nz(e){var t=e.style,n=t.lineDash&&t.lineWidth>0&&Lde(t.lineDash,t.lineWidth),r=t.lineDashOffset;if(n){var i=t.strokeNoScale&&e.getLineScale?e.getLineScale():1;i&&i!==1&&(n=bb(n,function(e){return e/i}),r/=i)}return[n,r]}var Rde=new DE(!0);function rz(e){var t=e.stroke;return!(t==null||t===`none`||!(e.lineWidth>0))}function iz(e){return typeof e==`string`&&e!==`none`}function az(e){var t=e.fill;return t!=null&&t!==`none`}function oz(e,t){if(t.fillOpacity!=null&&t.fillOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.fillOpacity*t.opacity,e.fill(),e.globalAlpha=n}else e.fill()}function sz(e,t){if(t.strokeOpacity!=null&&t.strokeOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.strokeOpacity*t.opacity,e.stroke(),e.globalAlpha=n}else e.stroke()}function cz(e,t,n){var r=GS(t.image,t.__image,n);if(qS(r)){var i=e.createPattern(r,t.repeat||`repeat`);if(typeof DOMMatrix==`function`&&i&&i.setTransform){var a=new DOMMatrix;a.translateSelf(t.x||0,t.y||0),a.rotateSelf(0,0,(t.rotation||0)*sie),a.scaleSelf(t.scaleX||1,t.scaleY||1),i.setTransform(a)}return i}}function zde(e,t,n,r,i){var a,o=rz(n),s=az(n),c=n.strokePercent,l=c<1,u=!t.path;(!t.silent||l)&&u&&t.createPathProxy();var d=t.path||Rde,f=t.__dirty;if(!r){var p=n.fill,m=n.stroke,h=s&&!!p.colorStops,g=o&&!!m.colorStops,_=s&&!!p.image,v=o&&!!m.image,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0;(h||g)&&(C=t.getBoundingRect()),h&&(y=f?$R(e,p,C):t.__canvasFillGradient,t.__canvasFillGradient=y),g&&(b=f?$R(e,m,C):t.__canvasStrokeGradient,t.__canvasStrokeGradient=b),_&&(x=f||!t.__canvasFillPattern?cz(e,p,t):t.__canvasFillPattern,t.__canvasFillPattern=x),v&&(S=f||!t.__canvasStrokePattern?cz(e,m,t):t.__canvasStrokePattern,t.__canvasStrokePattern=S),h?e.fillStyle=y:_&&(x?e.fillStyle=x:s=!1),g?e.strokeStyle=b:v&&(S?e.strokeStyle=S:o=!1)}var w=t.getGlobalScale();d.setScale(w[0],w[1],t.segmentIgnoreThreshold);var T,E;e.setLineDash&&n.lineDash&&(a=nz(t),T=a[0],E=a[1]);var D=!0;(u||f&4)&&(d.setDPR(e.dpr),l?d.setContext(null):(d.setContext(e),D=!1),d.reset(),t.buildPath(d,t.shape,r),d.toStatic(),t.pathUpdated()),D&&d.rebuildPath(e,l?c:1),T&&(e.setLineDash(T),e.lineDashOffset=E),r?(i.batchFill=s,i.batchStroke=o):n.strokeFirst?(o&&sz(e,n),s&&oz(e,n)):(s&&oz(e,n),o&&sz(e,n)),T&&e.setLineDash([])}function Bde(e,t,n){var r=t.__image=GS(n.image,t.__image,t,t.onload);if(r&&qS(r)){var i=n.x||0,a=n.y||0,o=t.getWidth(),s=t.getHeight(),c=r.width/r.height;if(o==null&&s!=null?o=s*c:s==null&&o!=null?s=o/c:o==null&&s==null&&(o=r.width,s=r.height),n.sWidth&&n.sHeight){var l=n.sx||0,u=n.sy||0;e.drawImage(r,l,u,n.sWidth,n.sHeight,i,a,o,s)}else if(n.sx&&n.sy){var l=n.sx,u=n.sy,d=o-l,f=s-u;e.drawImage(r,l,u,d,f,i,a,o,s)}else e.drawImage(r,i,a,o,s)}}function Vde(e,t,n){var r,i=n.text;if(i!=null&&(i+=``),i){e.font=n.font||`12px sans-serif`,e.textAlign=n.textAlign,e.textBaseline=n.textBaseline;var a=void 0,o=void 0;e.setLineDash&&n.lineDash&&(r=nz(t),a=r[0],o=r[1]),a&&(e.setLineDash(a),e.lineDashOffset=o),n.strokeFirst?(rz(n)&&e.strokeText(i,n.x,n.y),az(n)&&e.fillText(i,n.x,n.y)):(az(n)&&e.fillText(i,n.x,n.y),rz(n)&&e.strokeText(i,n.x,n.y)),a&&e.setLineDash([])}}var lz=[`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`],uz=[[`lineCap`,`butt`],[`lineJoin`,`miter`],[`miterLimit`,10]];function dz(e,t,n,r,i){var a=!1;if(!r&&(n||={},t===n))return!1;if(r||t.opacity!==n.opacity){vz(e,i),a=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?qT.opacity:o}(r||t.blend!==n.blend)&&(a||=(vz(e,i),!0),e.globalCompositeOperation=t.blend||qT.blend);for(var s=0;s0&&e.unfinished);e.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(e,t,n){if(!this[Fz]){if(this._disposed){this.id;return}var r,i,a;if(jb(t)&&(n=t.lazyUpdate,r=t.silent,i=t.replaceMerge,a=t.transition,t=t.notMerge),this[Fz]=!0,dB(this),!this._model||t){var o=new Wue(this._api),s=this._theme,c=this._model=new KL;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:i},vB);var l={seriesTransition:a,optionChanged:!0};if(n)this[Lz]={silent:r,updateParams:l},this[Fz]=!1,this.getZr().wakeUp();else{try{qz(this),Xz.update.call(this,null,l)}catch(e){throw this[Lz]=null,this[Fz]=!1,e}this._ssr||this._zr.flush(),this[Lz]=null,this[Fz]=!1,eB.call(this,r),tB.call(this,r)}}},t.prototype.setTheme=function(e,t){if(!this[Fz]){if(this._disposed){this.id;return}var n=this._model;if(n){var r=t&&t.silent,i=null;this[Lz]&&(r??=this[Lz].silent,i=this[Lz].updateParams,this[Lz]=null),this[Fz]=!0,dB(this);try{this._updateTheme(e),n.setTheme(this._theme),qz(this),Xz.update.call(this,{type:`setTheme`},i)}catch(e){throw this[Fz]=!1,e}this[Fz]=!1,eB.call(this,r),tB.call(this,r)}}},t.prototype._updateTheme=function(e){Ob(e)&&(e=bB[e]),e&&(e=mb(e),e&&fR(e,!0),this._theme=e)},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||$b.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(e){return this.renderToCanvas(e)},t.prototype.renderToCanvas=function(e){return e||={},this._zr.painter.getRenderedCanvas({backgroundColor:e.backgroundColor||this._model.get(`backgroundColor`),pixelRatio:e.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(e){return e||={},this._zr.painter.renderToString({useViewBox:e.useViewBox})},t.prototype.getSvgDataURL=function(){var e=this._zr;return W(e.storage.getDisplayList(),function(e){e.stopAnimation(null,!0)}),e.painter.toDataURL()},t.prototype.getDataURL=function(e){if(this._disposed){this.id;return}e||={};var t=e.excludeComponents,n=this._model,r=[],i=this;W(t,function(e){n.eachComponent({mainType:e},function(e){var t=i._componentsMap[e.__viewId];t.group.ignore||(r.push(t),t.group.ignore=!0)})});var a=this._zr.painter.getType()===`svg`?this.getSvgDataURL():this.renderToCanvas(e).toDataURL(`image/`+(e&&e.type||`png`));return W(r,function(e){e.group.ignore=!1}),a},t.prototype.getConnectedDataURL=function(e){if(this._disposed){this.id;return}var t=e.type===`svg`,n=this.group,r=Math.min,i=Math.max,a=1/0;if(CB[n]){var o=a,s=a,c=-a,l=-a,u=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();W(SB,function(a,d){if(a.group===n){var f=t?a.getZr().painter.getSvgDom().innerHTML:a.renderToCanvas(mb(e)),p=a.getDom().getBoundingClientRect();o=r(p.left,o),s=r(p.top,s),c=i(p.right,c),l=i(p.bottom,l),u.push({dom:f,left:p.left,top:p.top})}}),o*=d,s*=d,c*=d,l*=d;var f=c-o,p=l-s,m=nb.createCanvas(),h=IL(m,{renderer:t?`svg`:`canvas`});if(h.resize({width:f,height:p}),t){var g=``;return W(u,function(e){var t=e.left-o,n=e.top-s;g+=``+e.dom+``}),h.painter.getSvgRoot().innerHTML=g,e.connectedBackgroundColor&&h.painter.setBackgroundColor(e.connectedBackgroundColor),h.refreshImmediately(),h.painter.toDataURL()}return e.connectedBackgroundColor&&h.add(new eD({shape:{x:0,y:0,width:f,height:p},style:{fill:e.connectedBackgroundColor}})),W(u,function(e){var t=new KE({style:{x:e.left*d-o,y:e.top*d-s,image:e.dom}});h.add(t)}),h.refreshImmediately(),m.toDataURL(`image/`+(e&&e.type||`png`))}return this.getDataURL(e)},t.prototype.convertToPixel=function(e,t,n){return Zz(this,`convertToPixel`,e,t,n)},t.prototype.convertToLayout=function(e,t,n){return Zz(this,`convertToLayout`,e,t,n)},t.prototype.convertFromPixel=function(e,t,n){return Zz(this,`convertFromPixel`,e,t,n)},t.prototype.containPixel=function(e,t){if(this._disposed){this.id;return}var n=this._model,r;return W(pS(n,e),function(e,n){n.indexOf(`Models`)>=0&&W(e,function(e){var i=e.coordinateSystem;if(i&&i.containPoint)r||=!!i.containPoint(t);else if(n===`seriesModels`){var a=this._chartsMap[e.__viewId];a&&a.containPoint&&(r||=a.containPoint(t,e))}},this)},this),!!r},t.prototype.getVisual=function(e,t){var n=this._model,r=pS(n,e,{defaultMainType:`series`}),i=r.seriesModel.getData(),a=r.hasOwnProperty(`dataIndexInside`)?r.dataIndexInside:r.hasOwnProperty(`dataIndex`)?i.indexOfRawIndex(r.dataIndex):null;return a==null?GR(i,t):WR(i,a,t)},t.prototype.getViewOfComponentModel=function(e){return this._componentsMap[e.__viewId]},t.prototype.getViewOfSeriesModel=function(e){return this._chartsMap[e.__viewId]},t.prototype._initEvents=function(){var e=this;W(dfe,function(t){var n=function(n){var r=e.getModel(),i=n.target,a;if(t===`globalout`?a={}:i&&JR(i,function(e){var t=yD(e);if(t&&t.dataIndex!=null){var n=t.dataModel||r.getSeriesByIndex(t.seriesIndex);return a=n&&n.getDataParams(t.dataIndex,t.dataType,i)||{},!0}if(t.eventData)return a=U({},t.eventData),!0},!0),a){var o=a.componentType,s=a.componentIndex;(o===`markLine`||o===`markPoint`||o===`markArea`)&&(o=`series`,s=a.seriesIndex);var c=o&&s!=null&&r.getComponent(o,s),l=c&&e[c.mainType===`series`?`_chartsMap`:`_componentsMap`][c.__viewId];a.event=n,a.type=t,e._$eventProcessor.eventInfo={targetEl:i,packedEvent:a,model:c,view:l},e.trigger(t,a)}};n.zrEventfulCallAtLast=!0,e._zr.on(t,n,e)});var t=this._messageCenter;W(gB,function(n,r){t.on(r,function(t){e.trigger(r,t)})}),Ede(t,this,this._api)},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0,this.getDom()&&yS(this.getDom(),wB,``);var e=this,t=e._api,n=e._model;W(e._componentsViews,function(e){e.dispose(n,t)}),W(e._chartsViews,function(e){e.dispose(n,t)}),e._zr.dispose(),e._dom=e._model=e._chartsMap=e._componentsMap=e._chartsViews=e._componentsViews=e._scheduler=e._api=e._zr=e._throttledZrFlush=e._theme=e._coordSysMgr=e._messageCenter=null,delete SB[e.id]},t.prototype.resize=function(e){if(!this[Fz]){if(this._disposed){this.id;return}this._zr.resize(e);var t=this._model;if(this._loadingFX&&this._loadingFX.resize(),t){var n=t.resetOption(`media`),r=e&&e.silent;this[Lz]&&(r??=this[Lz].silent,n=!0,this[Lz]=null),this[Fz]=!0,dB(this);try{n&&qz(this),Xz.update.call(this,{type:`resize`,animation:U({duration:0},e&&e.animation)})}catch(e){throw this[Fz]=!1,e}this[Fz]=!1,eB.call(this,r),tB.call(this,r)}}},t.prototype.showLoading=function(e,t){if(this._disposed){this.id;return}if(jb(e)&&(t=e,e=``),e||=`default`,this.hideLoading(),xB[e]){var n=xB[e](this._api,t),r=this._zr;this._loadingFX=n,r.add(n)}},t.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},t.prototype.makeActionFromEvent=function(e){var t=U({},e);return t.type=hB[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed){this.id;return}if(jb(t)||(t={silent:!!t}),mB[e.type]&&this._model){if(this[Fz]){this._pendingActions.push(e);return}var n=t.silent;$z.call(this,e,n);var r=t.flush;r?this._zr.flush():r!==!1&&$b.browser.weChat&&this._throttledZrFlush(),eB.call(this,n),tB.call(this,n)}},t.prototype.updateLabelLayout=function(){YR.trigger(`series:layoutlabels`,this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed){this.id;return}var t=e.seriesIndex;this.getModel().getSeriesByIndex(t).appendData(e),this._scheduler.unfinished=!0,this.getZr().wakeUp()},t.internalField=function(){qz=function(e){$ce(e._model);var t=e._scheduler;t.restorePipelines(e._zr,e._model),t.prepareStageTasks(),Jz(e,!0),Jz(e,!1),t.plan()},Jz=function(e,t){for(var n=e._model,r=e._scheduler,i=t?e._componentsViews:e._chartsViews,a=t?e._componentsMap:e._chartsMap,o=e._zr,s=e._api,c=0;cRb(t.get(`hoverLayerThreshold`),BL.hoverLayerThreshold)&&!$b.node&&!$b.worker;(e._usingTHL||a)&&(t.eachSeries(function(t){if(!t.preventUsingHoverLayer){var n=e._chartsMap[t.__viewId];n.__alive&&n.eachRendered(function(e){var t=e.states.emphasis;t&&t.hoverLayer!==2&&(t.hoverLayer=+!!a)})}}),e._usingTHL=a)}}function a(e,t){var n=e.get(`blendMode`)||null;t.eachRendered(function(e){e.isGroup||(e.style.blend=n)})}function o(e,t){if(!e.preventAutoZ){var n=rA(e);t.eachRendered(function(e){return iA(e,n.z,n.zlevel),!0})}}function s(e,t){t.eachRendered(function(e){if(!Sk(e)){var t=e.getTextContent(),n=e.getTextGuideLine();e.stateTransition&&=null,t&&t.stateTransition&&(t.stateTransition=null),n&&n.stateTransition&&(n.stateTransition=null),e.hasState()?(e.prevStates=e.currentStates,e.clearStates()):e.prevStates&&=null}})}function c(e,t){var n=e.getModel(`stateAnimation`),i=e.isAnimationEnabled(),a=n.get(`duration`),o=a>0?{duration:a,delay:n.get(`delay`),easing:n.get(`easing`)}:null;t.eachRendered(function(e){if(e.states&&e.states.emphasis){if(Sk(e))return;if(e instanceof BE&&toe(e),e.__dirty){var t=e.prevStates;t&&e.useStates(t)}if(i){e.stateTransition=o;var n=e.getTextContent(),a=e.getTextGuideLine();n&&(n.stateTransition=o),a&&(a.stateTransition=o)}e.__dirty&&r(e)}})}sB=function(e){return new(function(t){H(n,t);function n(){return t!==null&&t.apply(this,arguments)||this}return n.prototype.getCoordinateSystems=function(){return e._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(t){for(;t;){var n=t.__ecComponentInfo;if(n!=null)return e._model.getComponent(n.mainType,n.index);t=t.parent}},n.prototype.enterEmphasis=function(t,n){iO(t,n),lB(e)},n.prototype.leaveEmphasis=function(t,n){aO(t,n),lB(e)},n.prototype.enterBlur=function(t){oO(t),lB(e)},n.prototype.leaveBlur=function(t){sO(t),lB(e)},n.prototype.enterSelect=function(t){cO(t),lB(e)},n.prototype.leaveSelect=function(t){lO(t),lB(e)},n.prototype.getModel=function(){return e.getModel()},n.prototype.getViewOfComponentModel=function(t){return e.getViewOfComponentModel(t)},n.prototype.getViewOfSeriesModel=function(t){return e.getViewOfSeriesModel(t)},n.prototype.getECUpdateCycleVersion=function(){return e[Iz]},n.prototype.usingTHL=function(){return e._usingTHL},n}(AD))(e)},cB=function(e){function t(e,t){for(var n=0;n=0)){jB.push(n);var o=jR.wrapStageHandler(n,i);o.__prio=t,o.__raw=n,e.push(o)}}function NB(e,t){xB[e]=t}function Sfe(e,t,n){var r=Ode(`registerMap`);r&&r(e,t,n)}var Cfe=rce;AB(jz,ude),AB(Nz,dde),AB(Nz,fde),AB(jz,wde),AB(Nz,Tde),AB(Pz,Yde),EB(fR),DB($de,nde),NB(`default`,pde),kB({type:RD,event:RD,update:RD},Qb),kB({type:zD,event:zD,update:zD},Qb),kB({type:BD,event:UD,update:BD,action:Qb,refineEvent:PB,publishNonRefinedEvent:!0}),kB({type:VD,event:UD,update:VD,action:Qb,refineEvent:PB,publishNonRefinedEvent:!0}),kB({type:HD,event:UD,update:HD,action:Qb,refineEvent:PB,publishNonRefinedEvent:!0});function PB(e,t,n,r){return{eventContent:{selected:Xae(n),isFromClick:t.isFromClick||!1}}}TB(`default`,{}),TB(`dark`,VR);var FB=[],wfe={registerPreprocessor:EB,registerProcessor:DB,registerPostInit:vfe,registerPostUpdate:yfe,registerUpdateLifecycle:OB,registerAction:kB,registerCoordinateSystem:bfe,registerLayout:xfe,registerVisual:AB,registerTransform:Cfe,registerLoading:NB,registerMap:Sfe,registerImpl:Dde,PRIORITY:cfe,ComponentModel:Wj,ComponentView:pR,SeriesModel:rN,ChartView:gR,registerComponentModel:function(e){Wj.registerClass(e)},registerComponentView:function(e){pR.registerClass(e)},registerSeriesModel:function(e){rN.registerClass(e)},registerChartView:function(e){gR.registerClass(e)},registerCustomSeries:function(e,t){kde(e,t)},registerSubTypeDefaulter:function(e,t){Wj.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){Iue(e,t)}};function IB(e){if(G(e)){W(e,function(e){IB(e)});return}_b(FB,e)>=0||(FB.push(e),Db(e)&&(e={install:e}),e.install(wfe))}var Tfe=function(){function e(e,t){this._encode=e,this._schema=t}return e.prototype.get=function(){return{fullDimensions:this._getFullDimensionNames(),encode:this._encode}},e.prototype._getFullDimensionNames=function(){return this._cachedDimNames||=this._schema?this._schema.makeOutputDimensionNames():[],this._cachedDimNames},e}();function Efe(e,t){var n={},r=n.encode={},i=Jb(),a=[],o=[],s={};W(e.dimensions,function(t){var n=e.getDimensionInfo(t),c=n.coordDim;if(c){var l=n.coordDimIndex;LB(r,c)[l]=t,n.isExtraCoord||(i.set(c,1),Ofe(n.type)&&(a[0]=t),LB(s,c)[l]=e.getDimensionIndex(n.name)),n.defaultTooltip&&o.push(t)}xD.each(function(e,t){var i=LB(r,t),a=n.otherDims[t];a!=null&&a!==!1&&(i[a]=n.name)})});var c=[],l={};i.each(function(e,t){var n=r[t];l[t]=n[0],c=c.concat(n)}),n.dataDimsOnCoord=c,n.dataDimIndicesOnCoord=bb(c,function(t){return e.getDimensionInfo(t).storeDimIndex}),n.encodeFirstDimNotExtra=l;var u=r.label;u&&u.length&&(a=u.slice());var d=r.tooltip;return d&&d.length?o=d.slice():o.length||(o=a.slice()),r.defaultedLabel=a,r.defaultedTooltip=o,n.userOutput=new Tfe(s,t),n}function LB(e,t){return e.hasOwnProperty(t)||(e[t]=[]),e[t]}function Dfe(e){return e===`category`?`ordinal`:e===`time`?`time`:`float`}function Ofe(e){return e!==`ordinal`&&e!==`time`}var RB=function(){function e(e){this.otherDims={},e!=null&&U(this,e)}return e}(),zB=jb,BB=bb,kfe=typeof Int32Array>`u`?Array:Int32Array,Afe=`e\0\0`,VB=-1,jfe=[`hasItemOption`,`_nameList`,`_idList`,`_invertedIndicesMap`,`_dimSummary`,`userOutput`,`_rawData`,`_dimValueGetter`,`_nameDimIdx`,`_idDimIdx`,`_nameRepeatCount`],Mfe=[`_approximateExtent`],HB,UB,WB,GB,KB,qB,JB,YB=function(){function e(e,t){this.type=`list`,this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=[`cloneShallow`,`downSample`,`minmaxDownSample`,`lttbDownSample`,`map`],this.CHANGABLE_METHODS=[`filterSelf`,`selectRange`],this.DOWNSAMPLE_METHODS=[`downSample`,`minmaxDownSample`,`lttbDownSample`];var n,r=!1;YP(e)?(n=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(r=!0,n=e),n||=[`x`,`y`];for(var i={},a=[],o={},s=!1,c={},l=0;l=t)){var n=this._store.getProvider();this._updateOrdinalMeta();var r=this._nameList,i=this._idList;if(n.getSource().sourceFormat===`original`&&!n.pure)for(var a=[],o=e;o0},e.prototype.ensureUniqueItemVisual=function(e,t){var n=this._itemVisuals,r=n[e];r||=n[e]={};var i=r[t];return i??(i=this.getVisual(t),G(i)?i=i.slice():zB(i)&&(i=U({},i)),r[t]=i),i},e.prototype.setItemVisual=function(e,t,n){var r=this._itemVisuals[e]||{};this._itemVisuals[e]=r,zB(t)?U(r,t):r[t]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(e,t){zB(e)?U(this._layout,e):this._layout[e]=t},e.prototype.getLayout=function(e){return this._layout[e]},e.prototype.getItemLayout=function(e){return this._itemLayouts[e]},e.prototype.setItemLayout=function(e,t,n){this._itemLayouts[e]=n?U(this._itemLayouts[e]||{},t):t},e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},e.prototype.setItemGraphicEl=function(e,t){bD(this.hostModel&&this.hostModel.seriesIndex,this.dataType,e,t),this._graphicEls[e]=t},e.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},e.prototype.eachItemGraphicEl=function(e,t){W(this._graphicEls,function(n,r){n&&e&&e.call(t,n,r)})},e.prototype.cloneShallow=function(t){return t||=new e(this._schema?this._schema:BB(this.dimensions,this._getDimInfo,this),this.hostModel),KB(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(e,t){var n=this[e];Db(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var e=n.apply(this,arguments);return t.apply(this,[e].concat(Bb(arguments)))})},e.internalField=function(){HB=function(e){var t=e._invertedIndicesMap;W(t,function(n,r){var i=e._dimInfos[r],a=i.ordinalMeta,o=e._store;if(a){n=t[r]=new kfe(a.categories.length);for(var s=0;s1&&(s+=`__ec__`+l),r[t]=s}}}(),e}();function Nfe(e,t){eM(e)||(e=nM(e)),t||={};var n=t.coordDimensions||[],r=t.dimensionsDefine||e.dimensionsDefine||[],i=Jb(),a=[],o=Pfe(e,n,r,t.dimensionsCount),s=t.canOmitUnusedDimensions&&QP(o),c=r===e.dimensionsDefine,l=c?ZP(e):XP(r),u=t.encodeDefine;!u&&t.encodeDefaulter&&(u=t.encodeDefaulter(e,o));for(var d=Jb(u),f=new MM(o),p=0;p0&&(e.name+=t-1)}),new JP({source:e,dimensions:a,fullDimensionCount:o,dimensionOmitted:s})}function Pfe(e,t,n,r){var i=Math.max(e.dimensionsDetectedCount||1,t.length,n.length,r||0);return W(t,function(e){var t;jb(e)&&(t=e.dimsDef)&&(i=Math.max(i,t.length))}),i}function Ffe(e,t,n){if(n||t.hasKey(e)){for(var r=0;t.hasKey(e+r);)r++;e+=r}return t.set(e,!0),e}var Ife=function(){function e(e){this.coordSysDims=[],this.axisMap=Jb(),this.categoryAxisMap=Jb(),this.coordSysName=e}return e}();function Lfe(e){var t=e.get(`coordinateSystem`),n=new Ife(t),r=Rfe[t];if(r)return r(e,n,n.axisMap,n.categoryAxisMap),n}var Rfe={cartesian2d:function(e,t,n,r){var i=e.getReferringComponents(`xAxis`,hS).models[0],a=e.getReferringComponents(`yAxis`,hS).models[0];t.coordSysDims=[`x`,`y`],n.set(`x`,i),n.set(`y`,a),XB(i)&&(r.set(`x`,i),t.firstCategoryDimIndex=0),XB(a)&&(r.set(`y`,a),t.firstCategoryDimIndex??=1)},singleAxis:function(e,t,n,r){var i=e.getReferringComponents(`singleAxis`,hS).models[0];t.coordSysDims=[`single`],n.set(`single`,i),XB(i)&&(r.set(`single`,i),t.firstCategoryDimIndex=0)},polar:function(e,t,n,r){var i=e.getReferringComponents(`polar`,hS).models[0],a=i.findAxisModel(`radiusAxis`),o=i.findAxisModel(`angleAxis`);t.coordSysDims=[`radius`,`angle`],n.set(`radius`,a),n.set(`angle`,o),XB(a)&&(r.set(`radius`,a),t.firstCategoryDimIndex=0),XB(o)&&(r.set(`angle`,o),t.firstCategoryDimIndex??=1)},geo:function(e,t,n,r){t.coordSysDims=[`lng`,`lat`]},parallel:function(e,t,n,r){var i=e.ecModel,a=i.getComponent(`parallel`,e.get(`parallelIndex`)),o=t.coordSysDims=a.dimensions.slice();W(a.parallelAxisIndex,function(e,a){var s=i.getComponent(`parallelAxis`,e),c=o[a];n.set(c,s),XB(s)&&(r.set(c,s),t.firstCategoryDimIndex??=a)})},matrix:function(e,t,n,r){var i=e.getReferringComponents(`matrix`,hS).models[0];t.coordSysDims=[`x`,`y`];var a=i.getDimensionModel(`x`),o=i.getDimensionModel(`y`);n.set(`x`,a),n.set(`y`,o),r.set(`x`,a),r.set(`y`,o)}};function XB(e){return e.get(`type`)===`category`}function zfe(e,t){var n=e.get(`coordinateSystem`),r=kj.get(n),i;return t&&t.coordSysDims&&(i=bb(t.coordSysDims,function(e){var n={name:e},r=t.axisMap.get(e);return r&&(n.type=Dfe(r.get(`type`))),n})),i||=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||[`x`,`y`],i}function Bfe(e,t,n){var r,i;return n&&W(e,function(e,a){var o=e.coordDim,s=n.categoryAxisMap.get(o);s&&(r??=a,e.ordinalMeta=s.getOrdinalMeta(),t&&(e.createInvertedIndices=!0)),e.otherDims.itemName!=null&&(i=!0)}),!i&&r!=null&&(e[r].otherDims.itemName=0),r}function ZB(e,t,n){n||={};var r=t.getSourceManager(),i,a=!1;e?(a=!0,i=nM(e)):(i=r.getSource(),a=i.sourceFormat===SD);var o=Lfe(t),s=zfe(t,o),c=n.useEncodeDefaulter,l=Db(c)?c:c?Eb(Rse,s,t):null,u={coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:l,canOmitUnusedDimensions:!a},d=Nfe(i,u),f=Bfe(d.dimensions,n.createInvertedIndices,o),p=a?null:r.getSharedDataStore(d),m=$P(t,{schema:d,store:p}),h=new YB(d,t);h.setCalculationInfo(m);var g=f!=null&&Vfe(i)?function(e,t,n,r){return r===f?n:this.defaultDimValueGetter(e,t,n,r)}:null;return h.hasItemOption=!1,h.initData(a?i:p,null,g),h}function Vfe(e){if(e.sourceFormat===`original`)return!G(Kx(Hfe(e.data||[])))}function Hfe(e){for(var t=0;tthis.getProgressiveThreshold()?this.id:``},t.type=`series.scatter`,t.dependencies=[`grid`,`polar`,`geo`,`singleAxis`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:K.color.primary}},universalTransition:{divideShape:`clone`}},t}(rN);function QB(e,t){var n=e.mapDimensionsAll(`defaultedLabel`),r=n.length;if(r===1){var i=SM(e,t,n[0]);return i==null?null:i+``}if(r){for(var a=[],o=0;o=0&&r.push(t[a])}return r.join(` `)}var eV=function(e){H(t,e);function t(t,n,r,i){var a=e.call(this)||this;return a.updateData(t,n,r,i),a}return t.prototype._createSymbol=function(e,t,n,r,i,a){this.removeAll();var o=aI(e,-1,-1,2,2,null,a);o.attr({z2:Rb(i,100),culling:!0,scaleX:r[0]/2,scaleY:r[1]/2}),o.drift=Wfe,this._symbolType=e,this.add(o)},t.prototype.stopSymbolAnimation=function(e){this.childAt(0).stopAnimation(null,e)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){iO(this.childAt(0))},t.prototype.downplay=function(){aO(this.childAt(0))},t.prototype.setZ=function(e,t){var n=this.childAt(0);n.zlevel=e,n.z=t},t.prototype.setDraggable=function(e,t){var n=this.childAt(0);n.draggable=e,n.cursor=!t&&e?`move`:n.cursor},t.prototype.updateData=function(e,n,r,i){this.silent=!1;var a=e.getItemVisual(n,`symbol`)||`circle`,o=e.hostModel,s=t.getSymbolSize(e,n),c=t.getSymbolZ2(e,n),l=a!==this._symbolType,u=i&&i.disableAnimation;if(l){var d=e.getItemVisual(n,`symbolKeepAspect`);this._createSymbol(a,e,n,s,c,d)}else{var f=this.childAt(0);f.silent=!1;var p={scaleX:s[0]/2,scaleY:s[1]/2};u?f.attr(p):bk(f,p,o,n),Ek(f)}if(this._updateCommon(e,n,s,r,i),l){var f=this.childAt(0);if(!u){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:f.style.opacity}};f.scaleX=f.scaleY=0,f.style.opacity=0,xk(f,p,o,n)}}u&&this.childAt(0).stopAnimation(`leave`)},t.prototype._updateCommon=function(e,t,n,r,i){var a=this.childAt(0),o=e.hostModel,s,c,l,u,d,f,p,m,h;if(r&&(s=r.emphasisItemStyle,c=r.blurItemStyle,l=r.selectItemStyle,u=r.focus,d=r.blurScope,p=r.labelStatesModels,m=r.hoverScale,h=r.cursorStyle,f=r.emphasisDisabled),!r||e.hasItemOption){var g=r&&r.itemModel?r.itemModel:e.getItemModel(t),_=g.getModel(`emphasis`);s=_.getModel(`itemStyle`).getItemStyle(),l=g.getModel([`select`,`itemStyle`]).getItemStyle(),c=g.getModel([`blur`,`itemStyle`]).getItemStyle(),u=_.get(`focus`),d=_.get(`blurScope`),f=_.get(`disabled`),p=dA(g),m=_.getShallow(`scale`),h=g.getShallow(`cursor`)}var v=e.getItemVisual(t,`symbolRotate`);a.attr(`rotation`,(v||0)*Math.PI/180||0);var y=sI(e.getItemVisual(t,`symbolOffset`),n);y&&(a.x=y[0],a.y=y[1]),h&&a.attr(`cursor`,h);var b=e.getItemVisual(t,`style`),x=b.fill;if(a instanceof KE){var S=a.style;a.useStyle(U({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else a.__isEmptyBrush?a.useStyle(U({},b)):a.useStyle(b),a.style.decal=null,a.setColor(x,i&&i.symbolInnerColor),a.style.strokeNoScale=!0;var C=e.getItemVisual(t,`liftZ`),w=this._z2;C==null?w!=null&&(a.z2=w,this._z2=null):w??(this._z2=a.z2,a.z2+=C);var T=i&&i.useNameLabel;uA(a,p,{labelFetcher:o,labelDataIndex:t,defaultText:E,inheritColor:x,defaultOpacity:b.opacity});function E(t){return T?e.getName(t):QB(e,t)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var D=a.ensureState(`emphasis`);D.style=s,a.ensureState(`select`).style=l,a.ensureState(`blur`).style=c;var O=m==null||m===!0?Math.max(1.1,3/this._sizeY):isFinite(m)&&m>0?+m:1;D.scaleX=this._sizeX*O,D.scaleY=this._sizeY*O,this.setSymbolScale(1),_O(this,u,d,f)},t.prototype.setSymbolScale=function(e){this.scaleX=this.scaleY=e},t.prototype.fadeOut=function(e,t,n){var r=this.childAt(0),i=yD(this).dataIndex,a=n&&n.animation;if(this.silent=r.silent=!0,n&&n.fadeLabel){var o=r.getTextContent();o&&Ck(o,{style:{opacity:0}},t,{dataIndex:i,removeOpt:a,cb:function(){r.removeTextContent()}})}else r.removeTextContent();Ck(r,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:i,cb:e,removeOpt:a})},t.getSymbolSize=function(e,t){return oI(e.getItemVisual(t,`symbolSize`))},t.getSymbolZ2=function(e,t){return e.getItemVisual(t,`z2`)},t}(LO);function Wfe(e,t){this.parent.drift(e,t)}function tV(e,t,n,r){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(r&&r.isIgnore&&r.isIgnore(n))&&!(r&&r.clipShape&&!r.clipShape.contain(t[0],t[1]))&&e.getItemVisual(n,`symbol`)!==`none`}function nV(e){return e!=null&&!jb(e)&&(e={isIgnore:e}),e||{}}function rV(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{emphasisItemStyle:n.getModel(`itemStyle`).getItemStyle(),blurItemStyle:t.getModel([`blur`,`itemStyle`]).getItemStyle(),selectItemStyle:t.getModel([`select`,`itemStyle`]).getItemStyle(),focus:n.get(`focus`),blurScope:n.get(`blurScope`),emphasisDisabled:n.get(`disabled`),hoverScale:n.get(`scale`),labelStatesModels:dA(t),cursorStyle:t.get(`cursor`)}}function iV(e,t,n,r,i,a,o){var s=new e(t,n,r,i);return s.setPosition(a),t.setItemGraphicEl(n,s),o.add(s),s}var aV=function(){function e(e){this.group=new LO,this._SymbolCtor=e||eV}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=nV(t);var n=this.group,r=e.hostModel,i=this._data,a=this._SymbolCtor,o=t.disableAnimation,s=this._seriesScope=rV(e),c={disableAnimation:o},l=t.getSymbolPoint||function(t){return e.getItemLayout(t)};i||n.removeAll(),e.diff(i).add(function(r){var i=l(r);tV(e,i,r,t)&&iV(a,e,r,s,c,i,n)}).update(function(u,d){var f=i.getItemGraphicEl(d),p=l(u);if(!tV(e,p,u,t)){n.remove(f);return}var m=e.getItemVisual(u,`symbol`)||`circle`,h=f&&f.getSymbolType&&f.getSymbolType();if(!f||h&&h!==m)n.remove(f),f=new a(e,u,s,c),f.setPosition(p);else{f.updateData(e,u,s,c);var g={x:p[0],y:p[1]};o?f.attr(g):bk(f,g,r)}n.add(f),e.setItemGraphicEl(u,f)}).remove(function(e){var t=i.getItemGraphicEl(e);t&&t.fadeOut(function(){n.remove(t)},r)}).execute(),this._getSymbolPoint=l,this._data=e},e.prototype.updateLayout=function(e){var t=this._data;if(t)for(var n=this,r=t.getStore(),i=0,a=r.count();i=0;s--){var c=s*2,l=r[c]-a/2,u=r[c+1]-o/2;if(e>=l&&t>=u&&e<=l+a&&t<=u+o)return s}return-1},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),r=this.getBoundingRect();return e=n[0],t=n[1],r.contain(e,t)?(this.hoverDataIdx=this.findDataIndex(e,t))>=0:(this.hoverDataIdx=-1,!1)},t.prototype.getBoundingRect=function(){var e=this._rect;if(!e){for(var t=this.shape,n=t.points,r=t.size,i=r[0],a=r[1],o=1/0,s=1/0,c=-1/0,l=-1/0,u=0;u=0&&(c.dataIndex=n+(e.startIndex||0))})},e.prototype.remove=function(){this._clear()},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),Jfe=typeof Float32Array<`u`?Float32Array:void 0,Yfe=typeof Float64Array<`u`?Float64Array:void 0;function sV(e){return cV({ctor:Jfe},e).arr}function cV(e,t){var n=e.arr,r=e.ctor;if(t>yx&&(t=yx),!n||e.typed&&n.length=0||e===t}function ope(e){var t=bV(e);if(t){var n=t.axisPointerModel,r=t.axis.scale,i=n.option,a=n.get(`status`),o=n.get(`value`);o!=null&&(o=r.parse(o));var s=xV(n);a??(i.status=s?`show`:`hide`);var c=r.getExtent();(o==null||o>c[1])&&(o=c[1]),o-1&&(s.style.stroke=s.style.fill,s.style.fill=K.color.neutral00,s.style.lineWidth=2),t},t.type=`series.line`,t.dependencies=[`grid`,`polar`],t.defaultOption={z:3,coordinateSystem:`cartesian2d`,legendHoverLink:!0,clip:!0,label:{position:`top`},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:`solid`},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:`emptyCircle`,symbolSize:6,symbolRotate:null,showSymbol:!0,showAllSymbol:`auto`,connectNulls:!1,sampling:`none`,animationEasing:`linear`,progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:`clone`},triggerLineEvent:!1,triggerEvent:!1},t}(rN);function AV(e,t,n){var r=e.getBaseAxis(),i=e.getOtherAxis(r),a=gpe(i,n),o=r.dim,s=i.dim,c=t.mapDimension(s),l=t.mapDimension(o),u=+(s===`x`||s===`radius`),d=bb(e.dimensions,function(e){return t.mapDimension(e)}),f=!1,p=t.getCalculationInfo(`stackResultDimension`);return tF(t,d[0])&&(f=!0,d[0]=p),tF(t,d[1])&&(f=!0,d[1]=p),{dataDimsForPoint:d,valueStart:a,valueAxisDim:s,baseAxisDim:o,stacked:!!f,valueDim:c,baseDim:l,baseDataOffset:u,stackedOverDimension:t.getCalculationInfo(`stackedOverDimension`)}}function gpe(e,t){var n=0,r=e.scale.getExtent();return t===`start`?n=r[0]:t===`end`?n=r[1]:Ab(t)&&!isNaN(t)?n=t:r[0]>0?n=r[0]:r[1]<0&&(n=r[1]),n}function jV(e,t,n,r){var i=NaN;e.stacked&&(i=n.get(n.getCalculationInfo(`stackedOverDimension`),r)),isNaN(i)&&(i=e.valueStart);var a=e.baseDataOffset,o=[];return o[a]=n.get(e.baseDim,r),o[1-a]=i,t.dataToPoint(o)}function MV(e,t){return!isFinite(e)||!isFinite(t)}function _pe(e,t){var n=[];return t.diff(e).add(function(e){n.push({cmd:`+`,idx:e})}).update(function(e,t){n.push({cmd:`=`,idx:t,idx1:e})}).remove(function(e){n.push({cmd:`-`,idx:e})}).execute(),n}function vpe(e,t,n,r,i,a,o,s){for(var c=_pe(e,t),l=[],u=[],d=[],f=[],p=[],m=[],h=[],g=AV(i,t,o),_=e.getLayout(`points`)||[],v=t.getLayout(`points`)||[],y=0;y=i||h<0)break;if(MV(_,v)){if(c){h+=a;continue}break}if(h===n)e[a>0?`moveTo`:`lineTo`](_,v),d=_,f=v;else{var y=_-l,b=v-u;if(y*y+b*b<.5){h+=a;continue}if(o>0){for(var x=h+a,S=t[x*2],C=t[x*2+1];S===_&&C===v&&g=r||MV(S,C))p=_,m=v;else{E=S-l,D=C-u;var A=_-l,j=S-_,M=v-u,N=C-v,P=void 0,F=void 0;if(s===`x`){P=Math.abs(A),F=Math.abs(j);var ee=E>0?1:-1;p=_-ee*P*o,m=v,O=_+ee*F*o,k=v}else if(s===`y`){P=Math.abs(M),F=Math.abs(N);var I=D>0?1:-1;p=_,m=v-I*P*o,O=_,k=v+I*F*o}else P=Math.sqrt(A*A+M*M),F=Math.sqrt(j*j+N*N),T=F/(F+P),p=_-E*o*(1-T),m=v-D*o*(1-T),O=_+E*o*T,k=v+D*o*T,O=NV(O,PV(S,_)),k=NV(k,PV(C,v)),O=PV(O,NV(S,_)),k=PV(k,NV(C,v)),E=O-_,D=k-v,p=_-E*P/F,m=v-D*P/F,p=NV(p,PV(l,_)),m=NV(m,PV(u,v)),p=PV(p,NV(l,_)),m=PV(m,NV(u,v)),E=_-p,D=v-m,O=_+E*F/P,k=v+D*F/P}e.bezierCurveTo(d,f,p,m,_,v),d=O,f=k}else e.lineTo(_,v)}l=_,u=v,h+=a}return g}var IV=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),ype=function(e){H(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polyline`,n}return t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new IV},t.prototype.buildPath=function(e,t){var n=t.points,r=0,i=n.length/2;if(t.connectNulls){for(;i>0&&MV(n[i*2-2],n[i*2-1]);i--);for(;r=0){var _=o?(d-a)*g+a:(u-i)*g+i;return o?[e,_]:[_,e]}i=u,a=d;break;case r.C:u=n[c++],d=n[c++],f=n[c++],p=n[c++],m=n[c++],h=n[c++];var v=o?Nw(i,u,f,m,e,s):Nw(a,d,p,h,e,s);if(v>0)for(var y=0;y=0){var _=o?jw(a,d,p,h,b):jw(i,u,f,m,b);return o?[e,_]:[_,e]}}i=m,a=h}}},t}(BE),bpe=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(IV),xpe=function(e){H(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polygon`,n}return t.prototype.getDefaultShape=function(){return new bpe},t.prototype.buildPath=function(e,t){var n=t.points,r=t.stackedOnPoints,i=0,a=n.length/2,o=t.smoothMonotone;if(t.connectNulls){for(;a>0&&MV(n[a*2-2],n[a*2-1]);a--);for(;i=0,a=e.fill||K.color.neutral99;UV(r,t);var o=r.textFill==null;return i?o&&(r.textFill=n.insideFill||K.color.neutral00,!r.textStroke&&n.insideStroke&&(r.textStroke=n.insideStroke),!r.textStroke&&(r.textStroke=a),r.textStrokeWidth??=2):(o&&(r.textFill=e.fill||n.outsideFill||K.color.neutral00),!r.textStroke&&n.outsideStroke&&(r.textStroke=n.outsideStroke)),r.text=t.text,r.rich=t.rich,W(t.rich,function(e){UV(e,e)}),r}function UV(e,t){t&&(Zb(t,`fill`)&&(e.textFill=t.fill),Zb(t,`stroke`)&&(e.textStroke=t.fill),Zb(t,`lineWidth`)&&(e.textStrokeWidth=t.lineWidth),Zb(t,`font`)&&(e.font=t.font),Zb(t,`fontStyle`)&&(e.fontStyle=t.fontStyle),Zb(t,`fontWeight`)&&(e.fontWeight=t.fontWeight),Zb(t,`fontSize`)&&(e.fontSize=t.fontSize),Zb(t,`fontFamily`)&&(e.fontFamily=t.fontFamily),Zb(t,`align`)&&(e.textAlign=t.align),Zb(t,`verticalAlign`)&&(e.textVerticalAlign=t.verticalAlign),Zb(t,`lineHeight`)&&(e.textLineHeight=t.lineHeight),Zb(t,`width`)&&(e.textWidth=t.width),Zb(t,`height`)&&(e.textHeight=t.height),Zb(t,`backgroundColor`)&&(e.textBackgroundColor=t.backgroundColor),Zb(t,`padding`)&&(e.textPadding=t.padding),Zb(t,`borderColor`)&&(e.textBorderColor=t.borderColor),Zb(t,`borderWidth`)&&(e.textBorderWidth=t.borderWidth),Zb(t,`borderRadius`)&&(e.textBorderRadius=t.borderRadius),Zb(t,`shadowColor`)&&(e.textBoxShadowColor=t.shadowColor),Zb(t,`shadowBlur`)&&(e.textBoxShadowBlur=t.shadowBlur),Zb(t,`shadowOffsetX`)&&(e.textBoxShadowOffsetX=t.shadowOffsetX),Zb(t,`shadowOffsetY`)&&(e.textBoxShadowOffsetY=t.shadowOffsetY),Zb(t,`textShadowColor`)&&(e.textShadowColor=t.textShadowColor),Zb(t,`textShadowBlur`)&&(e.textShadowBlur=t.textShadowBlur),Zb(t,`textShadowOffsetX`)&&(e.textShadowOffsetX=t.textShadowOffsetX),Zb(t,`textShadowOffsetY`)&&(e.textShadowOffsetY=t.textShadowOffsetY))}function WV(e,t){if(e.length===t.length){for(var n=0;nt){a?n.push(o(a,c,t)):i&&n.push(o(i,c,0),o(i,c,t));break}else i&&=(n.push(o(i,c,0)),null),n.push(c),a=c}return n}function wpe(e,t,n){var r=e.getVisual(`visualMeta`);if(r&&r.length&&e.count()&&t.type===`cartesian2d`){for(var i,a,o=r.length-1;o>=0;o--){var s=e.getDimensionInfo(r[o].dimension);if(i=s&&s.coordDim,i===`x`||i===`y`){a=r[o];break}}if(a){var c=t.getAxis(i),l=bb(a.stops,function(e){return{coord:c.toGlobalCoord(c.dataToCoord(e.value)),color:e.color}}),u=l.length,d=a.outerColors.slice();u&&l[0].coord>l[u-1].coord&&(l.reverse(),d.reverse());var f=Cpe(l,i===`x`?n.getWidth():n.getHeight()),p=f.length;if(!p&&u)return l[0].coord<0?d[1]?d[1]:l[u-1].color:d[0]?d[0]:l[0].color;var m=10,h=f[0].coord-m,g=f[p-1].coord+m,_=g-h;if(_<.001)return`transparent`;W(f,function(e){e.offset=(e.coord-h)/_}),f.push({offset:p?f[p-1].offset:.5,color:d[1]||`transparent`}),f.unshift({offset:p?f[0].offset:.5,color:d[0]||`transparent`});var v=new lk(0,0,0,0,f,!0);return v[i]=h,v[i+`2`]=g,v}}}function Tpe(e,t,n){var r=e.get(`showAllSymbol`),i=r===`auto`;if(!r||i){var a=n.getAxesByScale(`ordinal`)[0];if(a&&!(i&&Epe(a,t))){var o=t.mapDimension(a.dim),s={};return W(a.getViewLabels(),function(e){e.tick.offInterval||(s[yF(a.scale,e.tick)]=1)}),function(e){return!s.hasOwnProperty(t.get(o,e))}}}}function Epe(e,t){var n=e.getExtent(),r=Math.abs(n[1]-n[0])/e.scale.count();isNaN(r)&&(r=0);for(var i=t.count(),a=Math.max(1,Math.round(i/5)),o=0;or)return!1;return!0}function Dpe(e){for(var t=e.length/2;t>0&&MV(e[t*2-2],e[t*2-1]);t--);return t-1}function YV(e,t){return[e[t*2],e[t*2+1]]}function Ope(e,t,n){for(var r=e.length/2,i=n===`x`?0:1,a,o,s=0,c=-1,l=0;l=t||a>=t&&o<=t){c=l;break}s=l,a=o}return{range:[s,c],t:(t-a)/(o-a)}}function XV(e){if(e.get([`endLabel`,`show`]))return!0;for(var t=0;t0&&e.get([`emphasis`,`lineStyle`,`width`])===`bolder`){var M=f.getState(`emphasis`).style;M.lineWidth=+f.style.lineWidth+1}yD(f).seriesIndex=e.seriesIndex,_O(f,k,A,j);var N=qV(e.get(`smooth`)),P=e.get(`smoothMonotone`);if(f.setShape({smooth:N,smoothMonotone:P,connectNulls:x}),p){var F=a.getCalculationInfo(`stackedOnSeries`),ee=0;p.useStyle(gb(s.getAreaStyle(),{fill:E,opacity:.7,lineJoin:`bevel`,decal:a.getVisual(`style`).decal})),F&&(ee=qV(F.get(`smooth`))),p.setShape({smooth:N,stackedOnSmooth:ee,smoothMonotone:P,connectNulls:x}),yO(p,e,`areaStyle`),yD(p).seriesIndex=e.seriesIndex,_O(p,k,A,j)}var I=this._changePolyState;a.eachItemGraphicEl(function(e){e&&(e.onHoverStateChange=I)}),this._polyline.onHoverStateChange=I,this._data=a,this._coordSys=r,this._stackedOnPoints=y,this._points=c,this._step=w,this._valueOrigin=_;var te=e.get(`triggerEvent`),L=e.get(`triggerLineEvent`),ne=L===!0||te===!0||te===`line`,re=L===!0||te===!0||te===`area`;this.packEventData(e,f,ne),p&&this.packEventData(e,p,re)},t.prototype.packEventData=function(e,t,n){yD(t).eventData=n?{componentType:`series`,componentSubType:`line`,componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:`line`,selfType:t===this._polygon?`area`:`line`}:null},t.prototype.highlight=function(e,t,n,r){var i=e.getData(),a=uS(i,r);if(this._changePolyState(`emphasis`),!(a instanceof Array)&&a!=null&&a>=0){var o=i.getLayout(`points`),s=i.getItemGraphicEl(a);if(!s){var c=o[a*2],l=o[a*2+1];if(MV(c,l)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,l))return;var u=e.get(`zlevel`)||0,d=e.get(`z`)||0;s=new eV(i,a),s.x=c,s.y=l,s.setZ(u,d);var f=s.getSymbolPath().getTextContent();f&&(f.zlevel=u,f.z=d,f.z2=this._polyline.z2+1),s.__temp=!0,i.setItemGraphicEl(a,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else gR.prototype.highlight.call(this,e,t,n,r)},t.prototype.downplay=function(e,t,n,r){var i=e.getData(),a=uS(i,r);if(this._changePolyState(`normal`),a!=null&&a>=0){var o=i.getItemGraphicEl(a);o&&(o.__temp?(i.setItemGraphicEl(a,null),this.group.remove(o)):o.downplay())}else gR.prototype.downplay.call(this,e,t,n,r)},t.prototype._changePolyState=function(e){var t=this._polygon;$D(this._polyline,e),t&&$D(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new ype({shape:{points:e},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(t),this._polyline=t,t},t.prototype._newPolygon=function(e,t){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new xpe({shape:{points:e,stackedOnPoints:t},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},t.prototype._initSymbolLabelAnimation=function(e,t,n){var r,i,a=t.getBaseAxis(),o=a.inverse;t.type===`cartesian2d`?(r=a.isHorizontal(),i=!1):t.type===`polar`&&(r=a.dim===`angle`,i=!0);var s=e.hostModel,c=s.get(`animationDuration`);Db(c)&&(c=c(null));var l=s.get(`animationDelay`)||0,u=Db(l)?l(null):l;e.eachItemGraphicEl(function(e,a){var s=e;if(s){var d=[e.x,e.y],f=void 0,p=void 0,m=void 0;if(n){if(i){var h=n,g=t.pointToCoord(d);r?(f=h.startAngle,p=h.endAngle,m=-g[1]/180*Math.PI):(f=h.r0,p=h.r,m=g[0])}else{var _=n;r?(f=_.x,p=_.x+_.width,m=e.x):(f=_.y+_.height,p=_.y,m=e.y)}}var v=p===f?0:(m-f)/(p-f);o&&(v=1-v);var y=Db(l)?l(a):c*v+u,b=s.getSymbolPath(),x=b.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:y}),x&&x.animateFrom({style:{opacity:0}},{duration:300,delay:y}),b.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(e,t,n){var r=e.getModel(`endLabel`);if(XV(e)){var i=e.getData(),a=this._polyline,o=i.getLayout(`points`);if(!o){a.removeTextContent(),this._endLabel=null;return}var s=this._endLabel;s||(s=this._endLabel=new aD({z2:200}),s.ignoreClip=!0,a.setTextContent(this._endLabel),a.disableLabelAnimation=!0);var c=Dpe(o);c>=0&&(uA(a,dA(e,`endLabel`),{inheritColor:n,labelFetcher:e,labelDataIndex:c,defaultText:function(e,t,n){return n==null?QB(i,e):$B(i,n)},enableTextSetter:!0},kpe(r,t)),a.textConfig.position=null)}else this._endLabel&&=(this._polyline.removeTextContent(),null)},t.prototype._endLabelOnDuring=function(e,t,n,r,i,a,o){var s=this._endLabel,c=this._polyline;if(s){e<1&&r.originalX==null&&(r.originalX=s.x,r.originalY=s.y);var l=n.getLayout(`points`),u=n.hostModel,d=u.get(`connectNulls`),f=a.get(`precision`),p=a.get(`distance`)||0,m=o.getBaseAxis(),h=m.isHorizontal(),g=m.inverse,_=t.shape,v=g?h?_.x:_.y+_.height:h?_.x+_.width:_.y,y=(h?p:0)*(g?-1:1),b=(h?0:-p)*(g?-1:1),x=h?`x`:`y`,S=Ope(l,v,x),C=S.range,w=C[1]-C[0],T=void 0;if(w>=1){if(w>1&&!d){var E=YV(l,C[0]);s.attr({x:E[0]+y,y:E[1]+b}),i&&(T=u.getRawValue(C[0]))}else{var E=c.getPointOn(v,x);E&&s.attr({x:E[0]+y,y:E[1]+b});var D=u.getRawValue(C[0]),O=u.getRawValue(C[1]);i&&(T=SS(n,f,D,O,S.t))}r.lastFrameIndex=C[0]}else{var k=e===1||r.lastFrameIndex>0?C[0]:0,E=YV(l,k);i&&(T=u.getRawValue(k)),s.attr({x:E[0]+y,y:E[1]+b})}if(i){var A=yA(s);typeof A.setLabelText==`function`&&A.setLabelText(T)}}},t.prototype._doUpdateAnimation=function(e,t,n,r,i,a,o){var s=this._polyline,c=this._polygon,l=e.hostModel,u=vpe(this._data,e,this._stackedOnPoints,t,this._coordSys,n,this._valueOrigin,a),d=u.current,f=u.stackedOnCurrent,p=u.next,m=u.stackedOnNext;if(i&&(f=JV(u.stackedOnCurrent,u.current,n,i,o),d=JV(u.current,null,n,i,o),m=JV(u.stackedOnNext,u.next,n,i,o),p=JV(u.next,null,n,i,o)),KV(d,p)>3e3||c&&KV(f,m)>3e3){s.stopAnimation(),s.setShape({points:p}),c&&(c.stopAnimation(),c.setShape({points:p,stackedOnPoints:m}));return}s.shape.__points=u.current,s.shape.points=d;var h={shape:{points:p}};u.current!==d&&(h.shape.__points=u.next),s.stopAnimation(),bk(s,h,l),c&&(c.setShape({points:d,stackedOnPoints:f}),c.stopAnimation(),bk(c,{shape:{stackedOnPoints:m}},l),s.shape.points!==c.shape.points&&(c.shape.points=s.shape.points));for(var g=[],_=u.status,v=0;v<_.length;v++)if(_[v].cmd===`=`){var y=e.getItemGraphicEl(_[v].idx1);y&&g.push({el:y,ptIdx:v})}s.animators&&s.animators.length&&s.animators[0].during(function(){c&&c.dirtyShape();for(var e=s.shape.__points,t=0;tt&&(t=e[n]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,n=0;n10&&a.type===`cartesian2d`&&i){var s=a.getBaseAxis(),c=a.getOtherAxis(s),l=s.getExtent(),u=n.getDevicePixelRatio(),d=Math.abs(l[1]-l[0])*(u||1),f=Math.round(o/d);if(isFinite(f)&&f>1){i===`lttb`?e.setData(r.lttbDownSample(r.mapDimension(c.dim),1/f)):i===`minmax`&&e.setData(r.minmaxDownSample(r.mapDimension(c.dim),1/f));var p=void 0;Ob(i)?p=jpe[i]:Db(i)&&(p=i),p&&e.setData(r.downSample(r.mapDimension(c.dim),1/f,p,Mpe))}}}}}function Npe(e){e.registerChartView(Ape),e.registerSeriesModel(hpe),e.registerLayout(lV(`line`,!0)),e.registerVisual({seriesType:`line`,reset:function(e){var t=e.getData(),n=e.getModel(`lineStyle`).getLineStyle();n&&!n.stroke&&(n.stroke=t.getVisual(`style`).fill),t.setVisual(`legendLineStyle`,n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,QV(`line`))}function Ppe(){cle(`liPosMinGap`,Fpe)}function Fpe(e,t,n){var r=Jb(),i=n.serUids,a=n.liPosMinGap,o,s=t.axis,c=s.scale,l=c.needTransform(),u=c.getFilter?c.getFilter():null,d=OM(u);function f(n){YF(e,t.sers,function(e){var t=e.getRawData(),r=t.getDimensionIndex(t.mapDimension(s.dim));r>=0&&n(r,e,t.getStore())})}var p=0;if(f(function(e,t,n){r.set(t.uid,1),(!i||!i.hasKey(t.uid))&&(o=!0),p+=n.count()}),(!i||i.keys().length!==r.keys().length)&&(o=!0),!o&&a!=null){t.liPosMinGap=a;return}cV($V,p);var m=0;f(function(e,t,n){for(var r=0,i=n.count();r0&&v0?-2:-1,n.serUids=r}var $V=cV({ctor:Yfe},50);function Ipe(e){return function(t,n){var r=tI(t,{fromStat:{key:e}});if(Nx(r.w2))return[-r.w2/2,r.w2/2]}}function eH(e,t){return e+`|&`+t}function Lpe(e){return Ppe(),{liPosMinGap:!pP(e.scale)}}function Rpe(e,t,n,r){lle(e,{key:t,seriesType:n,coordSysType:r,getMetrics:Lpe})}function zpe(e){return e.scale.rawExtentInfo.makeRenderInfo().startValue}var Bpe=AS(),tH=`__ec_stack_`;function nH(e){return e.get(`stack`)||tH+e.seriesIndex}function Vpe(e){if(pP(e.axis.scale)){for(var t=tI(e.axis),n=[],r=0;ro&&(o=a),o!==u&&(t.width=o,n-=o+l*o,r--)}}),u=(n-c)/(r+(r-1)*l),u=rx(u,0);var d=0,f;W(o,function(e){var t=s[e];t.width||=u,f=t,d+=t.width*(1+l)}),f&&(d-=f.width*l);var p={},m=-d/2;return W(o,function(e){var n=s[e];p[e]=p[e]||{bandWidth:t,offset:m,width:n.width},m+=n.width*(1+l)}),p}function Wpe(e){return{seriesType:e,overallReset:function(t){var n=eH(e,wF);ole(t,n,function(t){var r=Hpe(t,e);JF(t,n,function(e){var t=r.columnMap[nH(e)];e.getData().setLayout({bandWidth:t.bandWidth,offset:t.offset,size:t.width})})})}}}function Gpe(e){return{seriesType:e,plan:mR(),reset:function(e){if(Ile(e)){var t=e.getData(),n=e.coordinateSystem,r=n.getBaseAxis(),i=n.getOtherAxis(r),a=t.getDimensionIndex(t.mapDimension(i.dim)),o=t.getDimensionIndex(t.mapDimension(r.dim)),s=e.get(`showBackground`,!0),c=t.mapDimension(i.dim),l=t.getCalculationInfo(`stackResultDimension`),u=tF(t,c)&&!!t.getCalculationInfo(`stackedOnSeries`),d=i.isHorizontal(),f=i.toGlobalCoord(i.dataToCoord(zpe(i))),p=iH(e),m=e.get(`barMinHeight`)||0,h=l&&t.getDimensionIndex(l),g=t.getLayout(`size`),_=t.getLayout(`offset`);return{progress:function(e,t){for(var r=e.count,i=p&&sV(r*3),c=p&&s&&sV(r*3),l=p&&sV(r),v=n.master.getRect(),y=d?v.width:v.height,b,x=t.getStore(),S=0;(b=e.next())!=null;){var C=x.get(u?h:a,b),w=x.get(o,b),T=f,E=void 0;u&&(E=+C-x.get(a,b));var D=void 0,O=void 0,k=void 0,A=void 0;if(d){var j=n.dataToPoint([C,w]);u&&(T=n.dataToPoint([E,w])[0]),D=T,O=j[1]+_,k=j[0]-T,A=g,ix(k)s){u=(p+l)/2;break}f===1&&(d=m-r[0].tickValue)}u??(l?l&&(u=r[r.length-1].coord):u=r[0].coord),a[n]=e.toGlobalCoord(u)}});else{var o=this.getData(),s=o.getLayout(`offset`),c=o.getLayout(`size`),l=+!r.getBaseAxis().isHorizontal();a[l]+=s+c/2}return a}return[NaN,NaN]},t.prototype.__requireStartValue=function(e){return this.getBaseAxis()!==e},t.type=`series.__base_bar__`,t.defaultOption={z:2,coordinateSystem:`cartesian2d`,legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:`mod`,defaultBarGap:`10%`},t}(rN);rN.registerClass(aH);var Jpe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(){return ZB(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get(`realtimeSort`,!0)||null})},t.prototype.getProgressive=function(){return this.get(`large`)?this.get(`progressive`):!1},t.prototype.__preparePipelineContext=function(e,t){var n=NS(this,e,t);return n.progressiveRender&&(n.large=!0),n},t.prototype.brushSelector=function(e,t,n){return n.rect(t.getItemLayout(e))},t.type=`series.bar`,t.dependencies=[`grid`,`polar`],t.defaultOption=DA(aH.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:`rgba(180, 180, 180, 0.2)`,borderColor:null,borderWidth:0,borderType:`solid`,borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:K.color.primary,borderWidth:2}},realtimeSort:!1}),t}(aH),Ype=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),oH=function(e){H(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`sausage`,n}return t.prototype.getDefaultShape=function(){return new Ype},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.max(t.r0||0,0),a=Math.max(t.r,0),o=(a-i)*.5,s=i+o,c=t.startAngle,l=t.endAngle,u=t.clockwise,d=Math.PI*2,f=u?l-cMath.PI/2&&ua)return!0;a=l}return!1},t.prototype._isOrderDifferentInView=function(e,t){for(var n=t.scale,r=n.getExtent(),i=Math.max(0,r[0]),a=Math.min(r[1],n.getOrdinalMeta().categories.length-1);i<=a;++i)if(e.ordinalNumbers[i]!==n.getRawOrdinalNumber(i))return!0},t.prototype._updateSortWithinSameData=function(e,t,n,r){if(this._isOrderChangedWithinSameData(e,t,n)){var i=this._dataSort(e,n,t);this._isOrderDifferentInView(i,n)&&(this._removeOnRenderedListener(r),r.dispatchAction({type:`changeAxisOrder`,componentType:n.dim+`Axis`,axisId:n.index,sortInfo:i}))}},t.prototype._dispatchInitSort=function(e,t,n){var r=t.baseAxis,i=this._dataSort(e,r,function(n){return e.get(e.mapDimension(t.otherAxis.dim),n)});n.dispatchAction({type:`changeAxisOrder`,componentType:r.dim+`Axis`,isInitSort:!0,axisId:r.index,sortInfo:i})},t.prototype.remove=function(e,t){this._clear(this._model),this._removeOnRenderedListener(t)},t.prototype.dispose=function(e,t){this._removeOnRenderedListener(t)},t.prototype._removeOnRenderedListener=function(e){this._onRendered&&=(e.getZr().off(`rendered`,this._onRendered),null)},t.prototype._clear=function(e){var t=this.group,n=this._data;e&&e.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(t){Tk(t,e,yD(t).dataIndex)})):t.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=`bar`,t}(gR),dH={cartesian2d:function(e,t){var n=t.width<0?-1:1,r=t.height<0?-1:1;n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height);var i=e.x+e.width,a=e.y+e.height,o=lH(t.x,e.x),s=uH(t.x+t.width,i),c=lH(t.y,e.y),l=uH(t.y+t.height,a),u=si?s:o,t.y=d&&c>a?l:c,t.width=u?0:s-o,t.height=d?0:l-c,n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height),u||d},polar:function(e,t){var n=t.r0<=t.r?1:-1;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}var i=uH(t.r,e.r),a=lH(t.r0,e.r0);t.r=i,t.r0=a;var o=i-a<0;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}return o}},fH={cartesian2d:function(e,t,n,r,i,a,o,s,c){var l=new eD({shape:U({},r),z2:1});if(l.__dataIndex=n,l.name=`item`,a){var u=l.shape,d=i?`height`:`width`;u[d]=0}return l},polar:function(e,t,n,r,i,a,o,s,c){var l=!i&&c?oH:ZO,u=new l({shape:r,z2:1});if(u.name=`item`,u.calculateTextPosition=Xpe(_H(i),{isRoundCap:l===oH}),a){var d=u.shape,f=i?`r`:`endAngle`,p={};d[f]=i?r.r0:r.startAngle,p[f]=r[f],(s?bk:xk)(u,{shape:p},a)}return u}};function eme(e,t){var n=e.get(`realtimeSort`,!0),r=t.getBaseAxis();if(n&&r.type===`category`&&t.type===`cartesian2d`)return{baseAxis:r,otherAxis:t.getOtherAxis(r)}}function pH(e,t,n,r,i,a,o,s){var c,l;a?(l={x:r.x,width:r.width},c={y:r.y,height:r.height}):(l={y:r.y,height:r.height},c={x:r.x,width:r.width}),s||(o?bk:xk)(n,{shape:c},t,i,null);var u=t?e.baseAxis.model:null;(o?bk:xk)(n,{shape:l},u,i)}function mH(e,t){for(var n=0;n0?1:-1,o=r.height>0?1:-1;return{x:r.x+a*i/2,y:r.y+o*i/2,width:r.width-a*i,height:r.height-o*i}},polar:function(e,t,n){var r=e.getItemLayout(t);return{cx:r.cx,cy:r.cy,r0:r.r0,r:r.r,startAngle:r.startAngle,endAngle:r.endAngle,clockwise:r.clockwise}}};function rme(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function _H(e){return function(e){var t=e?`Arc`:`Angle`;return function(e){switch(e){case`start`:case`insideStart`:case`end`:case`insideEnd`:return e+t;default:return e}}}(e)}function vH(e,t,n,r,i,a,o,s){var c=t.getItemVisual(n,`style`);if(!s){var l=r.get([`itemStyle`,`borderRadius`])||0;e.setShape(`r`,l)}else if(!a.get(`roundCap`)){var u=e.shape;U(u,Qpe(r.getModel(`itemStyle`),u,!0)),e.setShape(u)}e.useStyle(c);var d=r.getShallow(`cursor`);d&&e.attr(`cursor`,d);var f=s?o?i.r>=i.r0?`endArc`:`startArc`:i.endAngle>=i.startAngle?`endAngle`:`startAngle`:o?cme(i,a.coordinateSystem):lme(i,a.coordinateSystem),p=dA(r);uA(e,p,{labelFetcher:a,labelDataIndex:n,defaultText:QB(a.getData(),n),inheritColor:c.fill,defaultOpacity:c.opacity,defaultOutsidePosition:f});var m=e.getTextContent();if(s&&m){var h=r.get([`label`,`position`]);e.textConfig.inside=h===`middle`||null,Zpe(e,h===`outside`?f:h,_H(o),r.get([`label`,`rotate`]))}qoe(m,p,a.getRawValue(n),function(e){return $B(t,e)});var g=r.getModel([`emphasis`]);_O(e,g.get(`focus`),g.get(`blurScope`),g.get(`disabled`)),yO(e,r),rme(i)&&(e.style.fill=`none`,e.style.stroke=`none`,W(e.states,function(e){e.style&&(e.style.fill=e.style.stroke=`none`)}))}function ime(e,t){var n=e.get([`itemStyle`,`borderColor`]);if(!n||n===`none`)return 0;var r=e.get([`itemStyle`,`borderWidth`])||0,i=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),a=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(r,i,a)}var ame=function(){function e(){}return e}(),yH=function(e){H(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`largeBar`,n}return t.prototype.getDefaultShape=function(){return new ame},t.prototype.buildPath=function(e,t){for(var n=t.points,r=this.baseDimIdx,i=1-this.baseDimIdx,a=[],o=[],s=this.barWidth,c=0;c=0?n:null},30,!1);function ome(e,t,n){for(var r=e.baseDimIdx,i=1-r,a=e.shape.points,o=e.largeDataIndices,s=[],c=[],l=e.barWidth,u=0,d=a.length/3;u=s[0]&&t<=s[0]+c[0]&&n>=s[1]&&n<=s[1]+c[1])return o[u]}return-1}function SH(e,t,n){if(LV(n,`cartesian2d`)){var r=t,i=n.getArea();return{x:e?r.x:i.x,y:e?i.y:r.y,width:e?r.width:i.width,height:e?i.height:r.height}}var i=n.getArea(),a=t;return{cx:i.cx,cy:i.cy,r0:e?i.r0:a.r0,r:e?i.r:a.r,startAngle:e?a.startAngle:0,endAngle:e?a.endAngle:Math.PI*2}}function sme(e,t,n){return new(e.type===`polar`?ZO:eD)({shape:SH(t,n,e),silent:!0,z2:0})}function cme(e,t){return e.height===0?t.getOtherAxis(t.getBaseAxis()).inverse?`bottom`:`top`:e.height>0?`bottom`:`top`}function lme(e,t){return e.width===0?t.getOtherAxis(t.getBaseAxis()).inverse?`left`:`right`:e.width>=0?`right`:`left`}function ume(e){e.registerChartView($pe),e.registerSeriesModel(Jpe),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Wpe(`bar`)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,Gpe(`bar`)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,QV(`bar`)),e.registerAction({type:`changeAxisOrder`,event:`changeAxisOrder`,update:`update`},function(e,t){var n=e.componentType||`series`;t.eachComponent({mainType:n,query:e},function(t){e.sortInfo&&t.axis.setCategorySortInfo(e.sortInfo)})}),qpe(e)}var CH=dS();function dme(e,t,n){CH(e)[t]=n}function fme(e,t,n){var r=CH(e);r[t]===n&&(r[t]=null)}function wH(e,t){return!!CH(e)[t]}kB({type:`takeGlobalCursor`,event:`globalCursorTaken`,update:`update`},Qb);var pme={axisPointer:1,tooltip:1,brush:1};function TH(e,t,n){var r=t.getComponentByElement(e.topTarget);if(!r||r===n||pme.hasOwnProperty(r.mainType))return!1;var i=r.coordinateSystem;if(!i||i.model===n)return!1;var a=rA(r),o=rA(n);return!((a.zlevel-o.zlevel||a.z-o.z)<=0)}var mme=function(e){H(t,e);function t(t){var n=e.call(this)||this;n._zr=t;var r=Tb(n._mousedownHandler,n),i=Tb(n._mousemoveHandler,n),a=Tb(n._mouseupHandler,n),o=Tb(n._mousewheelHandler,n),s=Tb(n._pinchHandler,n);return n.enable=function(e,n){var c=n.zInfo,l=rA(c.component),u=l.z,d=l.zlevel,f={component:c.component,z:u,zlevel:d,z2:Rb(c.z2,-1/0)},p=U({},n.triggerInfo);this._opt=gb(U({},n),{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0,zInfoParsed:f,triggerInfo:p,cursorGrab:`grab`,cursorGrabbing:`grabbing`}),e??=!0,(!this._enabled||this._controlType!==e)&&(this.disable(),this._enabled=!0,(e===!0||e===`move`||e===`pan`)&&(OH(t,`mousedown`,r,f),OH(t,`mousemove`,i,f),OH(t,`mouseup`,a,f)),(e===!0||e===`scale`||e===`zoom`)&&(OH(t,`mousewheel`,o,f),OH(t,`pinch`,s,f)))},n.disable=function(){this._enabled&&(this._enabled=!1,kH(t,`mousedown`,r),kH(t,`mousemove`,i),kH(t,`mouseup`,a),kH(t,`mousewheel`,o),kH(t,`pinch`,s))},n}return t.prototype.isDragging=function(){return this._dragging},t.prototype.isPinching=function(){return this._pinching},t.prototype._checkPointer=function(e,t,n){var r=this._opt,i=r.zInfoParsed;if(TH(e,r.api,i.component))return!1;var a=r.triggerInfo,o=a.roamTrigger,s=!1;return o===`global`&&(s=!0),s||=a.isInSelf(e,t,n),s&&a.isInClip&&!a.isInClip(e,t,n)&&(s=!1),s},t.prototype._decideCursorStyle=function(e,t,n,r){var i=e.target;if(!i&&this._checkPointer(e,t,n))return this._opt.cursorGrab;if(r)return i&&i.cursor||`default`},t.prototype.dispose=function(){this.disable()},t.prototype._mousedownHandler=function(e){if(!(tL(e)||EH(e))){for(var t=e.target;t;){if(t.draggable)return;t=t.__hostTarget||t.parent}var n=e.offsetX,r=e.offsetY;this._checkPointer(e,n,r)&&(this._x=n,this._y=r,this._dragging=!0)}},t.prototype._mousemoveHandler=function(e){var t=this._zr;if(!(e.gestureEvent===`pinch`||wH(t,`globalPan`)||EH(e))){var n=e.offsetX,r=e.offsetY;if(!this._dragging||!jH(`moveOnMouseMove`,e,this._opt)){var i=this._decideCursorStyle(e,n,r,!1);i&&t.setCursorStyle(i);return}t.setCursorStyle(this._opt.cursorGrabbing);var a=this._x,o=this._y,s=n-a,c=r-o;this._x=n,this._y=r,this._opt.preventDefaultMouseMove&&eL(e.event),e.__ecRoamConsumed=!0,AH(this,`pan`,`moveOnMouseMove`,e,{dx:s,dy:c,oldX:a,oldY:o,newX:n,newY:r,isAvailableBehavior:null})}},t.prototype._mouseupHandler=function(e){if(!EH(e)){var t=this._zr;if(!tL(e)){this._dragging=!1;var n=this._decideCursorStyle(e,e.offsetX,e.offsetY,!0);n&&t.setCursorStyle(n)}}},t.prototype._mousewheelHandler=function(e){if(!EH(e)){var t=jH(`zoomOnMouseWheel`,e,this._opt),n=jH(`moveOnMouseWheel`,e,this._opt),r=e.wheelDelta,i=Math.abs(r),a=e.offsetX,o=e.offsetY;if(r!==0&&(t||n)){if(t){var s=i>3?1.4:i>1?1.2:1.1,c=r>0?s:1/s;this._checkTriggerMoveZoom(this,`zoom`,`zoomOnMouseWheel`,e,{scale:c,originX:a,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(r),u=(r>0?1:-1)*(l>3?.4:l>1?.15:.05);this._checkTriggerMoveZoom(this,`scrollMove`,`moveOnMouseWheel`,e,{scrollDelta:u,originX:a,originY:o,isAvailableBehavior:null})}}}},t.prototype._pinchHandler=function(e){if(!(wH(this._zr,`globalPan`)||EH(e))){var t=e.pinchScale>1?1.1:1/1.1;this._checkTriggerMoveZoom(this,`zoom`,null,e,{scale:t,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})}},t.prototype._checkTriggerMoveZoom=function(e,t,n,r,i){e._checkPointer(r,i.originX,i.originY)&&(eL(r.event),r.__ecRoamConsumed=!0,AH(e,t,n,r,i))},t}(kT);function EH(e){return e.__ecRoamConsumed}var hme=dS();function DH(e){var t=hme(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function OH(e,t,n,r){for(var i=DH(e).roam,a=i[t]=i[t]||[],o=0;o=0;a--)r[a]??(delete n[t[a]],t.pop())}function VH(e,t){var n=e.visual,r=[];jb(n)?RH(n,function(e){r.push(e)}):n!=null&&r.push(n),!t&&r.length===1&&!{color:1,symbol:1}.hasOwnProperty(e.type)&&(r[1]=r[0]),YH(e,r)}function HH(e){return{applyVisual:function(t,n,r){var i=this.mapValueToVisual(t);r(`color`,e(n(`color`),i))},_normalizedToVisual:qH([0,1])}}function UH(e){var t=this.option.visual;return t[Math.round(dx(e,[0,1],[0,t.length-1],!0))]||{}}function WH(e){return function(t,n,r){r(e,this.mapValueToVisual(t))}}function GH(e){var t=this.option.visual;return t[this.option.loop&&e!==zH?e%t.length:e]}function KH(){return this.option.visual[0]}function qH(e){return{linear:function(t){return dx(t,e,this.option.visual,!0)},category:GH,piecewise:function(t,n){var r=JH.call(this,n);return r??=dx(t,e,this.option.visual,!0),r},fixed:KH}}function JH(e){var t=this.option,n=t.pieceList;if(t.hasSpecialVisual){var r=n[BH.findPieceIndex(e,n)];if(r&&r.visual)return r.visual[this.type]}}function YH(e,t){return e.visual=t,e.type===`color`&&(e.parsedVisual=bb(t,function(e){return tT(e)||[0,0,0,1]})),t}var Eme={linear:function(e){return dx(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,n=BH.findPieceIndex(e,t,!0);if(n!=null)return dx(n,[0,t.length-1],[0,1],!0)},category:function(e){return(this.option.categories?this.option.categoryMap[e]:e)??zH},fixed:Qb};function XH(e,t,n){return e?t<=n:t0&&(y[0]=-y[0],y[1]=-y[1]);var x=v[0]<0?-1:1;if(r.__position!==`start`&&r.__position!==`end`){var S=-Math.atan2(v[1],v[0]);l[0].8?`left`:u[0]<-.8?`right`:`center`,p=u[1]>.8?`top`:u[1]<-.8?`bottom`:`middle`;break;case`start`:r.x=-u[0]*h+c[0],r.y=-u[1]*g+c[1],f=u[0]>.8?`right`:u[0]<-.8?`left`:`center`,p=u[1]>.8?`bottom`:u[1]<-.8?`top`:`middle`;break;case`insideStartTop`:case`insideStart`:case`insideStartBottom`:r.x=h*x+c[0],r.y=c[1]+C,f=v[0]<0?`right`:`left`,r.originX=-h*x,r.originY=-C;break;case`insideMiddleTop`:case`insideMiddle`:case`insideMiddleBottom`:case`middle`:r.x=b[0],r.y=b[1]+C,f=`center`,r.originY=-C;break;case`insideEndTop`:case`insideEnd`:case`insideEndBottom`:r.x=-h*x+l[0],r.y=l[1]+C,f=v[0]>=0?`right`:`left`,r.originX=h*x,r.originY=-C}r.scaleX=r.scaleY=i,r.setStyle({verticalAlign:r.__verticalAlign||p,align:r.__align||f})}},t}(LO),Ame=function(){function e(e){this.group=new LO,this._LineCtor=e||kme}return e.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var n=this,r=n.group,i=n._lineData;n._lineData=e,i||r.removeAll();var a=oU(e);e.diff(i).add(function(n){t._doAdd(e,n,a)}).update(function(n,r){t._doUpdate(i,e,r,n,a)}).remove(function(e){r.remove(i.getItemGraphicEl(e))}).execute()},e.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl(function(t,n){t.updateLayout(e,n)},this)},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=oU(e),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t,n){this._progressiveEls=[];function r(e){!e.isGroup&&!jme(e)&&(e.incremental=n,e.ensureState(`emphasis`).hoverLayer=2)}for(var i=e.start;i0}function oU(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{lineStyle:t.getModel(`lineStyle`).getLineStyle(),emphasisLineStyle:n.getModel([`lineStyle`]).getLineStyle(),blurLineStyle:t.getModel([`blur`,`lineStyle`]).getLineStyle(),selectLineStyle:t.getModel([`select`,`lineStyle`]).getLineStyle(),emphasisDisabled:n.get(`disabled`),blurScope:n.get(`blurScope`),focus:n.get(`focus`),labelStatesModels:dA(t)}}function sU(e){return isNaN(e[0])||isNaN(e[1])}function cU(e){return e&&!sU(e[0])&&!sU(e[1])}function lU(e,t,n,r,i,a){e||=0;var o=vx(n[1],-n[0]);if(i!=null&&(i=dU(i,[0,o])),a!=null&&(a=Math.max(a,i??0)),r===`all`){var s=Math.abs(vx(t[1],-t[0]));s=dU(s,[0,o]),i=a=dU(s,[i,a]),r=0}t[0]=dU(t[0],n),t[1]=dU(t[1],n);var c=uU(t,r);t[r]+=e;var l=i||0,u=n.slice();c.sign<0?u[0]=vx(u[0],l):u[1]=vx(u[1],-l),t[r]=dU(t[r],u);var d=uU(t,r);return i!=null&&(d.sign!==c.sign||d.spana&&(t[1-r]=vx(t[r],d.sign*a)),t}function uU(e,t){var n=e[t]-e[1-t];return{span:Math.abs(n),sign:n>0?-1:n<0?1:t?-1:1}}function dU(e,t){return Math.min(t[1]==null?1/0:t[1],Math.max(t[0]==null?-1/0:t[0],e))}var fU=!0,pU=Math.min,mU=Math.max,Mme=Math.pow,Nme=1e4,Pme=6,Fme=6,hU=`globalPan`,Ime={w:[0,0],e:[0,1],n:[1,0],s:[1,1]},Lme={w:`ew`,e:`ew`,n:`ns`,s:`ns`,ne:`nesw`,sw:`nesw`,nw:`nwse`,se:`nwse`},gU={brushStyle:{lineWidth:2,stroke:K.color.backgroundTint,fill:K.color.borderTint},transformable:!0,brushMode:`single`,removeOnClick:!1},Rme=0,_U=function(e){H(t,e);function t(t){var n=e.call(this)||this;return n._track=[],n._covers=[],n._handlers={},n._zr=t,n.group=new LO,n._uid=`brushController_`+Rme++,W(Gme,function(e,t){this._handlers[t]=Tb(e,this)},n),n}return t.prototype.enableBrush=function(e){return this._brushType&&this._doDisableBrush(),e.brushType&&this._doEnableBrush(e),this},t.prototype._doEnableBrush=function(e){var t=this._zr;this._enableGlobalPan||dme(t,hU,this._uid),W(this._handlers,function(e,n){t.on(n,e)}),this._brushType=e.brushType,this._brushOption=hb(mb(gU),e,!0)},t.prototype._doDisableBrush=function(){var e=this._zr;fme(e,hU,this._uid),W(this._handlers,function(t,n){e.off(n,t)}),this._brushType=this._brushOption=null},t.prototype.setPanels=function(e){if(e&&e.length){var t=this._panels={};W(e,function(e){t[e.panelId]=mb(e)})}else this._panels=null;return this},t.prototype.mount=function(e){e||={},this._enableGlobalPan=e.enableGlobalPan;var t=this.group;return this._zr.add(t),t.attr({x:e.x||0,y:e.y||0,rotation:e.rotation||0,scaleX:e.scaleX||1,scaleY:e.scaleY||1}),this._transform=t.getLocalTransform(),this},t.prototype.updateCovers=function(e){e=bb(e,function(e){return hb(mb(gU),e,!0)});var t=`\0-brush-index-`,n=this._covers,r=this._covers=[],i=this,a=this._creatingCover;return new lN(n,e,s,o).add(c).update(c).remove(l).execute(),this;function o(e,n){return(e.id==null?t+n:e.id)+`-`+e.brushType}function s(e,t){return o(e.__brushOption,t)}function c(t,o){var s=e[t];o!=null&&n[o]===a?r[t]=n[o]:SU(i,r[t]=o==null?yU(i,vU(i,s)):(n[o].__brushOption=s,n[o]))}function l(e){n[e]!==a&&i.group.remove(n[e])}},t.prototype.unmount=function(){return this.enableBrush(!1),EU(this),this._zr.remove(this.group),this},t.prototype.dispose=function(){this.unmount(),this.off()},t}(kT);function vU(e,t){var n=WU[t.brushType].createCover(e,t);return n.__brushOption=t,xU(n,t),e.group.add(n),n}function yU(e,t){var n=CU(t);return n.endCreating&&(n.endCreating(e,t),xU(t,t.__brushOption)),t}function bU(e,t){var n=t.__brushOption;CU(t).updateCoverShape(e,t,n.range,n)}function xU(e,t){var n=t.z;n??=Nme,e.traverse(function(e){e.z=n,e.z2=n})}function SU(e,t){CU(t).updateCommon(e,t),bU(e,t)}function CU(e){return WU[e.__brushOption.brushType]}function wU(e,t,n){var r=e._panels;if(!r)return fU;var i,a=e._transform;return W(r,function(e){e.isTargetByCursor(t,n,a)&&(i=e)}),i}function TU(e,t){var n=e._panels;if(!n)return fU;var r=t.__brushOption.panelId;return r==null?fU:n[r]}function EU(e){var t=e._covers,n=t.length;return W(t,function(t){e.group.remove(t)},e),t.length=0,!!n}function DU(e,t){var n=bb(e._covers,function(e){var t=e.__brushOption,n=mb(t.range);return{brushType:t.brushType,panelId:t.panelId,range:n}});e.trigger(`brush`,{areas:n,isEnd:!!t.isEnd,removeOnClick:!!t.removeOnClick})}function zme(e){var t=e._track;if(!t.length)return!1;var n=t[t.length-1],r=t[0],i=n[0]-r[0],a=n[1]-r[1];return Mme(i*i+a*a,.5)>Pme}function OU(e){var t=e.length-1;return t<0&&(t=0),[e[0],e[t]]}function kU(e,t,n,r){var i=new LO;return i.add(new eD({name:`main`,style:NU(n),silent:!0,draggable:!0,cursor:`move`,drift:Eb(IU,e,t,i,[`n`,`s`,`w`,`e`]),ondragend:Eb(DU,t,{isEnd:!0})})),W(r,function(n){i.add(new eD({name:n.join(``),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:Eb(IU,e,t,i,n),ondragend:Eb(DU,t,{isEnd:!0})}))}),i}function AU(e,t,n,r){var i=r.brushStyle.lineWidth||0,a=mU(i,Fme),o=n[0][0],s=n[1][0],c=o-i/2,l=s-i/2,u=n[0][1],d=n[1][1],f=u-a+i/2,p=d-a+i/2,m=u-o,h=d-s,g=m+i,_=h+i;MU(e,t,`main`,o,s,m,h),r.transformable&&(MU(e,t,`w`,c,l,a,_),MU(e,t,`e`,f,l,a,_),MU(e,t,`n`,c,l,g,a),MU(e,t,`s`,c,p,g,a),MU(e,t,`nw`,c,l,a,a),MU(e,t,`ne`,f,l,a,a),MU(e,t,`sw`,c,p,a,a),MU(e,t,`se`,f,p,a,a))}function jU(e,t){var n=t.__brushOption,r=n.transformable,i=t.childAt(0);i.useStyle(NU(n)),i.attr({silent:!r,cursor:r?`move`:`default`}),W([[`w`],[`e`],[`n`],[`s`],[`s`,`e`],[`s`,`w`],[`n`,`e`],[`n`,`w`]],function(n){var i=t.childOfName(n.join(``)),a=n.length===1?FU(e,n[0]):Vme(e,n);i&&i.attr({silent:!r,invisible:!r,cursor:r?Lme[a]+`-resize`:null})})}function MU(e,t,n,r,i,a,o){var s=t.childOfName(n);s&&s.setShape(Ume(RU(e,t,[[r,i],[r+a,i+o]])))}function NU(e){return gb({strokeNoScale:!0},e.brushStyle)}function PU(e,t,n,r){var i=[pU(e,n),pU(t,r)],a=[mU(e,n),mU(t,r)];return[[i[0],a[0]],[i[1],a[1]]]}function Bme(e){return Lk(e.group)}function FU(e,t){return{left:`w`,right:`e`,top:`n`,bottom:`s`}[zk({w:`left`,e:`right`,n:`top`,s:`bottom`}[t],Bme(e))]}function Vme(e,t){var n=[FU(e,t[0]),FU(e,t[1])];return(n[0]===`e`||n[0]===`w`)&&n.reverse(),n.join(``)}function IU(e,t,n,r,i,a){var o=n.__brushOption,s=e.toRectRange(o.range),c=LU(t,i,a);W(r,function(e){var t=Ime[e];s[t[0]][t[1]]+=c[t[0]]}),o.range=e.fromRectRange(PU(s[0][0],s[1][0],s[0][1],s[1][1])),SU(t,n),DU(t,{isEnd:!1})}function Hme(e,t,n,r){var i=t.__brushOption.range,a=LU(e,n,r);W(i,function(e){e[0]+=a[0],e[1]+=a[1]}),SU(e,t),DU(e,{isEnd:!1})}function LU(e,t,n){var r=e.group,i=r.transformCoordToLocal(t,n),a=r.transformCoordToLocal(0,0);return[i[0]-a[0],i[1]-a[1]]}function RU(e,t,n){var r=TU(e,t);return r&&r!==fU?r.clipPath(n,e._transform):mb(n)}function Ume(e){var t=pU(e[0][0],e[1][0]),n=pU(e[0][1],e[1][1]),r=mU(e[0][0],e[1][0]),i=mU(e[0][1],e[1][1]);return{x:t,y:n,width:r-t,height:i-n}}function Wme(e,t,n){if(e._brushType&&!Kme(e,t.offsetX,t.offsetY)){var r=e._zr,i=e._covers,a=wU(e,t,n);if(!e._dragging)for(var o=0;or.getWidth()||n<0||n>r.getHeight()}var WU={lineX:GU(0),lineY:GU(1),rect:{createCover:function(e,t){function n(e){return e}return kU({toRectRange:n,fromRectRange:n},e,t,[[`w`],[`e`],[`n`],[`s`],[`s`,`e`],[`s`,`w`],[`n`,`e`],[`n`,`w`]])},getCreatingRange:function(e){var t=OU(e);return PU(t[1][0],t[1][1],t[0][0],t[0][1])},updateCoverShape:function(e,t,n,r){AU(e,t,n,r)},updateCommon:jU,contain:BU},polygon:{createCover:function(e,t){var n=new LO;return n.add(new tk({name:`main`,style:NU(t),silent:!0})),n},getCreatingRange:function(e){return e},endCreating:function(e,t){t.remove(t.childAt(0)),t.add(new ek({name:`main`,draggable:!0,drift:Eb(Hme,e,t),ondragend:Eb(DU,e,{isEnd:!0})}))},updateCoverShape:function(e,t,n,r){t.childAt(0).setShape({points:RU(e,t,n)})},updateCommon:jU,contain:BU}};function GU(e){return{createCover:function(t,n){return kU({toRectRange:function(t){var n=[t,[0,100]];return e&&n.reverse(),n},fromRectRange:function(t){return t[e]}},t,n,[[[`w`],[`e`]],[[`n`],[`s`]]][e])},getCreatingRange:function(t){var n=OU(t);return[pU(n[0][e],n[1][e]),mU(n[0][e],n[1][e])]},updateCoverShape:function(t,n,r,i){var a,o=TU(t,n);if(o!==fU&&o.getLinearBrushOtherExtent)a=o.getLinearBrushOtherExtent(e);else{var s=t._zr;a=[0,[s.getWidth(),s.getHeight()][1-e]]}var c=[r,a];e&&c.reverse(),AU(t,n,c,i)},updateCommon:jU,contain:BU}}function qme(e){return e=KU(e),function(t){return Hk(t,e)}}function Jme(e,t){return e=KU(e),function(n){var r=t??n,i=r?e.width:e.height,a=r?e.x:e.y;return[a,a+(i||0)]}}function Yme(e,t,n){var r=KU(e);return function(e,i){return r.contain(i[0],i[1])&&!TH(e,t,n)}}function KU(e){return OC.create(e)}var Xme=256,Zme=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=nb.createCanvas();this.canvas=e}return e.prototype.update=function(e,t,n,r,i,a){var o=this._getBrush(),s=this._getGradient(i,`inRange`),c=this._getGradient(i,`outOfRange`),l=this.pointSize+this.blurSize,u=this.canvas,d=u.getContext(`2d`),f=e.length;u.width=t,u.height=n;for(var p=0;p0){var E=a(v)?s:c;v>0&&(v=v*w+C),b[x++]=E[T],b[x++]=E[T+1],b[x++]=E[T+2],b[x++]=E[T+3]*v*256}else x+=4}return d.putImageData(y,0,0),u},e.prototype._getBrush=function(){var e=this._brushCanvas||=nb.createCanvas(),t=this.pointSize+this.blurSize,n=t*2;e.width=n,e.height=n;var r=e.getContext(`2d`);return r.clearRect(0,0,n,n),r.shadowOffsetX=n,r.shadowBlur=this.blurSize,r.shadowColor=K.color.neutral99,r.beginPath(),r.arc(-t,t,this.pointSize,0,Math.PI*2,!0),r.closePath(),r.fill(),e},e.prototype._getGradient=function(e,t){for(var n=this._gradientPixels,r=n[t]||(n[t]=new Uint8ClampedArray(1024)),i=[0,0,0,0],a=0,o=0;o<256;o++)e[t](o/255,!0,i),r[a++]=i[0],r[a++]=i[1],r[a++]=i[2],r[a++]=i[3];return r},e}();function Qme(e,t,n){var r=e[1]-e[0];t=bb(t,function(t){return{interval:[(t.interval[0]-e[0])/r,(t.interval[1]-e[0])/r]}});var i=t.length,a=0;return function(e){for(var r=a;r=0;r--){var o=t[r].interval;if(o[0]<=e&&e<=o[1]){a=r;break}}return r>=0&&r=t[0]&&e<=t[1]}}var ehe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r;t.eachComponent(`visualMap`,function(t){t.eachTargetSeries(function(n){n===e&&(r=t)})}),this._progressiveEls=null,this.group.removeAll();var i=e.coordinateSystem;i.type===`cartesian2d`||i.type===`calendar`||i.type===`matrix`?this._renderOnGridLike(e,n,0,e.getData().count()):RV(i)&&this._renderOnGeo(i,e,r,n)},t.prototype.incrementalPrepareRender=function(e,t,n){this.group.removeAll()},t.prototype.incrementalRender=function(e,t,n,r){var i=t.coordinateSystem;i&&(RV(i)?this.render(t,n,r):(this._progressiveEls=[],this._renderOnGridLike(t,r,e.start,e.end,!0)))},t.prototype.eachRendered=function(e){Qk(this._progressiveEls||this.group,e)},t.prototype._renderOnGridLike=function(e,t,n,r,i){var a=e.coordinateSystem,o=LV(a,`cartesian2d`),s=LV(a,`matrix`),c,l,u,d;if(o){var f=a.getAxis(`x`),p=a.getAxis(`y`);c=tI(f).w+.5,l=tI(p).w+.5,u=f.scale.getExtent(),d=p.scale.getExtent()}for(var m=this.group,h=e.getData(),g=e.getModel([`emphasis`,`itemStyle`]).getItemStyle(),_=e.getModel([`blur`,`itemStyle`]).getItemStyle(),v=e.getModel([`select`,`itemStyle`]).getItemStyle(),y=e.get([`itemStyle`,`borderRadius`]),b=dA(e),x=e.getModel(`emphasis`),S=x.get(`focus`),C=x.get(`blurScope`),w=x.get(`disabled`),T=o||s?[h.mapDimension(`x`),h.mapDimension(`y`),h.mapDimension(`value`)]:[h.mapDimension(`time`),h.mapDimension(`value`)],E=n;Eu[1]||Ad[1])continue;var j=a.dataToPoint([k,A]);D=new eD({shape:{x:j[0]-c/2,y:j[1]-l/2,width:c,height:l},style:O})}else if(s){var M=a.dataToLayout([h.get(T[0],E),h.get(T[1],E)]).rect;if(Ib(M.x))continue;D=new eD({z2:1,shape:M,style:O})}else{if(isNaN(h.get(T[1],E)))continue;var N=a.dataToLayout([h.get(T[0],E)]),M=N.contentRect||N.rect;if(Ib(M.x)||Ib(M.y))continue;D=new eD({z2:1,shape:M,style:O})}if(h.hasItemOption){var P=h.getItemModel(E),F=P.getModel(`emphasis`);g=F.getModel(`itemStyle`).getItemStyle(),_=P.getModel([`blur`,`itemStyle`]).getItemStyle(),v=P.getModel([`select`,`itemStyle`]).getItemStyle(),y=P.get([`itemStyle`,`borderRadius`]),S=F.get(`focus`),C=F.get(`blurScope`),w=F.get(`disabled`),b=dA(P)}D.shape.r=y;var ee=e.getRawValue(E),I=`-`;ee&&ee[2]!=null&&(I=ee[2]+``),uA(D,b,{labelFetcher:e,labelDataIndex:E,defaultOpacity:O.opacity,defaultText:I}),D.ensureState(`emphasis`).style=g,D.ensureState(`blur`).style=_,D.ensureState(`select`).style=v,_O(D,S,C,w),D.incremental=MS(e,i),i&&(D.states.emphasis.hoverLayer=2),m.add(D),h.setItemGraphicEl(E,D),this._progressiveEls&&this._progressiveEls.push(D)}},t.prototype._renderOnGeo=function(e,t,n,r){var i=n.targetVisuals.inRange,a=n.targetVisuals.outOfRange,o=t.getData(),s=this._hmLayer||this._hmLayer||new Zme;s.blurSize=t.get(`blurSize`),s.pointSize=t.get(`pointSize`),s.minOpacity=t.get(`minOpacity`),s.maxOpacity=t.get(`maxOpacity`);var c=e.getViewRect().clone(),l=e.getRoamTransform();c.applyTransform(l);var u=Math.max(c.x,0),d=Math.max(c.y,0),f=Math.min(c.width+c.x,r.getWidth()),p=Math.min(c.height+c.y,r.getHeight()),m=f-u,h=p-d,g=[o.mapDimension(`lng`),o.mapDimension(`lat`),o.mapDimension(`value`)],_=o.mapArray(g,function(t,n,r){var i=e.dataToPoint([t,n]);return i[0]-=u,i[1]-=d,i.push(r),i}),v=n.getExtent(),y=n.type===`visualMap.continuous`?$me(v,n.option.range):Qme(v,n.getPieceList(),n.option.selected);s.update(_,m,h,i.color.getNormalizer(),{inRange:i.color.getColorMapper(),outOfRange:a.color.getColorMapper()},y);var b=new KE({style:{width:m,height:h,x:u,y:d,image:s.canvas},silent:!0});this.group.add(b)},t.type=`heatmap`,t}(gR),the=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(e,t){return ZB(null,this,{generateCoord:`value`})},t.prototype.preventIncremental=function(){var e=kj.get(this.get(`coordinateSystem`));if(e&&e.dimensions)return e.dimensions[0]===`lng`&&e.dimensions[1]===`lat`},t.type=`series.heatmap`,t.dependencies=[`grid`,`geo`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:K.color.primary}}},t}(rN);function nhe(e){e.registerChartView(ehe),e.registerSeriesModel(the)}var qU={color:`fill`,borderColor:`stroke`},rhe={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},JU=dS(),ihe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.optionUpdated=function(){this.currentZLevel=this.get(`zlevel`,!0),this.currentZ=this.get(`z`,!0)},t.prototype.getInitialData=function(e,t){return ZB(null,this)},t.prototype.getDataParams=function(t,n,r){var i=e.prototype.getDataParams.call(this,t,n);return r&&(i.info=JU(r).info),i},t.type=`series.custom`,t.dependencies=[`grid`,`polar`,`geo`,`singleAxis`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,legendHoverLink:!0,clip:!1},t}(rN);function ahe(e,t){return t||=[0,0],bb([`x`,`y`],function(n,r){var i=this.getAxis(n),a=t[r],o=e[r]/2;return i.type===`category`?tI(i).w:Math.abs(i.dataToCoord(a-o)-i.dataToCoord(a+o))},this)}function ohe(e){var t=e.master.getRect();return{coordSys:{type:`cartesian2d`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t){return e.dataToPoint(t)},size:Tb(ahe,e)}}}function she(e,t){return t||=[0,0],bb([0,1],function(n){var r=t[n],i=e[n]/2,a=[],o=[];return a[n]=r-i,o[n]=r+i,a[1-n]=o[1-n]=t[1-n],Math.abs(this.dataToPoint(a)[n]-this.dataToPoint(o)[n])},this)}function che(e){var t=e.view,n=t.getBoundingRect();return{coordSys:{type:`geo`,x:n.x,y:n.y,width:n.width,height:n.height,zoom:xme(t)},api:{coord:function(t){return e.dataToPoint(t)},size:Tb(she,e)}}}function lhe(e,t){var n=this.getAxis(),r=t instanceof Array?t[0]:t,i=(e instanceof Array?e[0]:e)/2;return n.type===`category`?tI(n).w:Math.abs(n.dataToCoord(r-i)-n.dataToCoord(r+i))}function uhe(e){var t=e.getRect();return{coordSys:{type:`singleAxis`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t){return e.dataToPoint(t)},size:Tb(lhe,e)}}}function dhe(e,t){return t||=[0,0],bb([`Radius`,`Angle`],function(n,r){var i=`get`+n+`Axis`,a=this[i](),o=t[r],s=e[r]/2,c=a.type===`category`?tI(a).w:Math.abs(a.dataToCoord(o-s)-a.dataToCoord(o+s));return n===`Angle`&&(c=c*Math.PI/180),c},this)}function fhe(e){var t=e.getRadiusAxis(),n=e.getAngleAxis(),r=t.getExtent();return r[0]>r[1]&&r.reverse(),{coordSys:{type:`polar`,cx:e.cx,cy:e.cy,r:r[1],r0:r[0]},api:{coord:function(r){var i=t.dataToRadius(r[0]),a=n.dataToAngle(r[1]),o=e.coordToPoint([i,a]);return o.push(i,a*Math.PI/180),o},size:Tb(dhe,e)}}}function phe(e){var t=e.getRect(),n=e.getRangeInfo();return{coordSys:{type:`calendar`,x:t.x,y:t.y,width:t.width,height:t.height,cellWidth:e.getCellWidth(),cellHeight:e.getCellHeight(),rangeInfo:{start:n.start,end:n.end,weeks:n.weeks,dayCount:n.allDay}},api:{coord:function(t,n){return e.dataToPoint(t,n)},layout:function(t,n){return e.dataToLayout(t,n)}}}}function mhe(e){var t=e.getRect();return{coordSys:{type:`matrix`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t,n){return e.dataToPoint(t,n)},layout:function(t,n){return e.dataToLayout(t,n)}}}}var YU={position:[`x`,`y`],scale:[`scaleX`,`scaleY`],origin:[`originX`,`originY`]},XU=wb(YU);xb(_w,function(e,t){return e[t]=1,e},{}),_w.join(`, `);var ZU=[``,`style`,`shape`,`extra`],QU=dS();function $U(e,t,n,r,i){var a=e+`Animation`,o=vk(e,r,i)||{},s=QU(t).userDuring;return o.duration>0&&(o.during=s?Tb(yhe,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),U(o,n[a]),o}function eW(e,t,n,r){r||={};var i=r.dataIndex,a=r.isInit,o=r.clearStyle,s=n.isAnimationEnabled(),c=QU(e),l=t.style;c.userDuring=t.during;var u={},d={};if(xhe(e,t,d),e.type===`compound`)for(var f=e.shape.paths,p=t.shape.paths,m=0;m0&&e.animateFrom(g,_)}else ghe(e,t,i||0,n,u)}tW(e,t),l?e.dirty():e.markRedraw()}function tW(e,t){for(var n=QU(e).leaveToProps,r=0;r0&&e.animateFrom(i,a)}}function _he(e,t){Zb(t,`silent`)&&(e.silent=t.silent),Zb(t,`ignore`)&&(e.ignore=t.ignore),e instanceof XT&&Zb(t,`invisible`)&&(e.invisible=t.invisible),e instanceof BE&&Zb(t,`autoBatch`)&&(e.autoBatch=t.autoBatch)}var iW={},vhe={setTransform:function(e,t){return iW.el[e]=t,this},getTransform:function(e){return iW.el[e]},setShape:function(e,t){var n=iW.el,r=n.shape||={};return r[e]=t,n.dirtyShape&&n.dirtyShape(),this},getShape:function(e){var t=iW.el.shape;if(t)return t[e]},setStyle:function(e,t){var n=iW.el,r=n.style;return r&&(r[e]=t,n.dirtyStyle&&n.dirtyStyle()),this},getStyle:function(e){var t=iW.el.style;if(t)return t[e]},setExtra:function(e,t){var n=iW.el.extra||(iW.el.extra={});return n[e]=t,this},getExtra:function(e){var t=iW.el.extra;if(t)return t[e]}};function yhe(){var e=this,t=e.el;if(t){var n=QU(t).userDuring,r=e.userDuring;if(n!==r){e.el=e.userDuring=null;return}iW.el=t,r(vhe)}}function aW(e,t,n,r){var i=n[e];if(i){var a=t[e],o;if(a){var s=n.transition,c=i.transition;if(c){if(!o&&(o=r[e]={}),rW(c))U(o,a);else for(var l=Ux(c),u=0;u=0){!o&&(o=r[e]={});for(var p=wb(a),u=0;u=0)){var f=e.getAnimationStyleProps(),p=f?f.style:null;if(p){!a&&(a=r.style={});for(var m=wb(n),l=0;l=0?t.getStore().get(i,n):void 0}var a=t.get(r.name,n),o=r&&r.ordinalMeta;return o?o.categories[a]:a}function C(n,r){r??=u;var i=t.getItemVisual(r,`style`),a=i&&i.fill,o=i&&i.opacity,s=y(r,dW).getItemStyle();a!=null&&(s.fill=a),o!=null&&(s.opacity=o);var c={inheritColor:Ob(a)?a:K.color.neutral99},l=b(r,dW),d=fA(l,null,c,!1,!0);d.text=l.getShallow(`show`)?Rb(e.getFormattedLabel(r,dW),QB(t,r)):null;var f=pA(l,c,!1);return E(n,s),s=HV(s,d,f),n&&T(s,n),s.legacy=!0,s}function w(n,r){r??=u;var i=y(r,uW).getItemStyle(),a=b(r,uW),o=fA(a,null,null,!0,!0);o.text=a.getShallow(`show`)?zb(e.getFormattedLabel(r,uW),e.getFormattedLabel(r,dW),QB(t,r)):null;var s=pA(a,null,!0);return E(n,i),i=HV(i,o,s),n&&T(i,n),i.legacy=!0,i}function T(e,t){for(var n in t)Zb(t,n)&&(e[n]=t[n])}function E(e,t){e&&(e.textFill&&(t.textFill=e.textFill),e.textPosition&&(t.textPosition=e.textPosition))}function D(e,n){if(n??=u,Zb(qU,e)){var r=t.getItemVisual(n,`style`);return r?r[qU[e]]:null}if(Zb(rhe,e))return t.getItemVisual(n,e)}function O(e){if(o.type===`cartesian2d`)return Vpe(gb({axis:o.getBaseAxis()},e))}function k(){return n.getCurrentSeriesIndices()}function A(e){return vA(e,n)}}function wW(e){var t={};return W(e.dimensions,function(n){var r=e.getDimensionInfo(n);if(!r.isExtraCoord){var i=r.coordDim,a=t[i]=t[i]||[];a[r.coordDimIndex]=e.getDimensionIndex(n)}}),t}function TW(e,t,n,r,i,a,o){if(!r){a.remove(t);return}var s=EW(e,t,n,r,i,a);return s&&o.setItemGraphicEl(n,s),s&&_O(s,r.focus,r.blurScope,r.emphasisDisabled),s}function EW(e,t,n,r,i,a){var o=-1,s=t;t&&DW(t,r,i)&&(o=_b(a.childrenRef(),t),t=null);var c=!t,l=t;l?l.clearStates():(l=bW(r),s&&Ohe(s,l)),r.morph===!1?l.disableMorphing=!0:l.disableMorphing&&(l.disableMorphing=!1),r.tooltipDisabled&&(l.tooltipDisabled=!0),_W.normal.cfg=_W.normal.conOpt=_W.emphasis.cfg=_W.emphasis.conOpt=_W.blur.cfg=_W.blur.conOpt=_W.select.cfg=_W.select.conOpt=null,_W.isLegacy=!1,kW(l,n,r,i,c,_W),OW(l,n,r,i,c),xW(e,l,n,r,_W,i,c),Zb(r,`info`)&&(JU(l).info=r.info);for(var u=0;u=0?a.replaceAt(l,o):a.add(l),l}function DW(e,t,n){var r=JU(e),i=t.type,a=t.shape,o=t.style;return n.isUniversalTransitionEnabled()||i!=null&&i!==r.customGraphicType||i===`path`&&BW(a)&&zW(a)!==r.customPathData||i===`image`&&Zb(o,`image`)&&o.image!==r.customImagePath}function OW(e,t,n,r,i){var a=n.clipPath;if(a===!1)e&&e.getClipPath()&&e.removeClipPath();else if(a){var o=e.getClipPath();o&&DW(o,a,r)&&(o=null),o||(o=bW(a),e.setClipPath(o)),xW(null,o,t,a,null,r,i)}}function kW(e,t,n,r,i,a){if(!(e.isGroup||e.type===`compoundPath`)){AW(n,null,a),AW(n,uW,a);var o=a.normal.conOpt,s=a.emphasis.conOpt,c=a.blur.conOpt,l=a.select.conOpt;if(o!=null||s!=null||l!=null||c!=null){var u=e.getTextContent();if(o===!1)u&&e.removeTextContent();else{o=a.normal.conOpt=o||{type:`text`},u?u.clearStates():(u=bW(o),e.setTextContent(u)),xW(null,u,t,o,null,r,i);for(var d=o&&o.style,f=0;f=u;p--)PW(t,t.childAt(p),i)}}function PW(e,t,n){t&&nW(t,JU(e).option,n)}function FW(e){new lN(e.oldChildren,e.newChildren,IW,IW,e).add(LW).update(LW).remove(RW).execute()}function IW(e,t){return(e&&e.name)??Ehe+t}function LW(e,t){var n=this.context,r=e==null?null:n.newChildren[e],i=t==null?null:n.oldChildren[t];EW(n.api,i,n.dataIndex,r,n.seriesModel,n.group)}function RW(e){var t=this.context,n=t.oldChildren[e];n&&nW(n,JU(n).option,t.seriesModel)}function zW(e){return e&&(e.pathData||e.d)}function BW(e){return e&&(Zb(e,`pathData`)||Zb(e,`d`))}function VW(e){e.registerChartView(khe),e.registerSeriesModel(ihe)}var HW=dS(),UW=mb,WW=Tb,GW=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(e,t,n,r){var i=t.get(`value`),a=t.get(`status`);if(this._axisModel=e,this._axisPointerModel=t,this._api=n,r||this._lastValue!==i||this._lastStatus!==a){this._lastValue=i,this._lastStatus=a;var o=this._group,s=this._handle;if(!a||a===`hide`){o&&o.hide(),s&&s.hide();return}o&&o.show(),s&&s.show();var c={};this.makeElOption(c,i,e,t,n);var l=c.graphicKey;l!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=l;var u=this._moveAnimation=this.determineAnimation(e,t);if(!o)o=this._group=new LO,this.createPointerEl(o,c,e,t),this.createLabelEl(o,c,e,t),n.getZr().add(o);else{var d=Eb(KW,t,u);this.updatePointerEl(o,c,d),this.updateLabelEl(o,c,d,t)}XW(o,t,!0),this._renderHandle(i)}},e.prototype.remove=function(e){this.clear(e)},e.prototype.dispose=function(e){this.clear(e)},e.prototype.determineAnimation=function(e,t){var n=t.get(`animation`),r=e.axis,i=r.type===`category`,a=t.get(`snap`);if(!a&&!i)return!1;if(n===`auto`||n==null){var o=this.animationThreshold;if(i&&tI(r).w>o)return!0;if(a){var s=bV(e).seriesDataCount,c=r.getExtent();return Math.abs(c[0]-c[1])/s>o}return!1}return n===!0},e.prototype.makeElOption=function(e,t,n,r,i){},e.prototype.createPointerEl=function(e,t,n,r){var i=t.pointer;if(i){var a=HW(e).pointerEl=new joe[i.type](UW(t.pointer));e.add(a)}},e.prototype.createLabelEl=function(e,t,n,r){if(t.label){var i=HW(e).labelEl=new aD(UW(t.label));e.add(i),JW(i,r)}},e.prototype.updatePointerEl=function(e,t,n){var r=HW(e).pointerEl;r&&t.pointer&&(r.setStyle(t.pointer.style),n(r,{shape:t.pointer.shape}))},e.prototype.updateLabelEl=function(e,t,n,r){var i=HW(e).labelEl;i&&(i.setStyle(t.label.style),n(i,{x:t.label.x,y:t.label.y}),JW(i,r))},e.prototype._renderHandle=function(e){if(!this._dragging&&this.updateHandleTransform){var t=this._axisPointerModel,n=this._api.getZr(),r=this._handle,i=t.getModel(`handle`),a=t.get(`status`);if(!i.get(`show`)||!a||a===`hide`){r&&n.remove(r),this._handle=null;return}var o;this._handle||(o=!0,r=this._handle=Uk(i.get(`icon`),{cursor:`move`,draggable:!0,onmousemove:function(e){eL(e.event)},onmousedown:WW(this._onHandleDragMove,this,0,0),drift:WW(this._onHandleDragMove,this),ondragend:WW(this._onHandleDragEnd,this)}),n.add(r)),XW(r,t,!1),r.setStyle(i.getItemStyle(null,[`color`,`borderColor`,`borderWidth`,`opacity`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`]));var s=i.get(`size`);G(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,CR(this,`_doDispatchAxisPointer`,i.get(`throttle`)||0,`fixRate`),this._moveHandleToValue(e,o)}},e.prototype._moveHandleToValue=function(e,t){KW(this._axisPointerModel,!t&&this._moveAnimation,this._handle,YW(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(e,t){var n=this._handle;if(n){this._dragging=!0;var r=this.updateHandleTransform(YW(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=r,n.stopAnimation(),n.attr(YW(r)),HW(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){if(this._handle){var e=this._payloadInfo,t=this._axisModel;this._api.dispatchAction({type:`updateAxisPointer`,x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,axesInfo:[{axisDim:t.axis.dim,axisIndex:t.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get(`value`);this._moveHandleToValue(e),this._api.dispatchAction({type:`hideTip`})}},e.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),n=this._group,r=this._handle;t&&n&&(this._lastGraphicKey=null,n&&t.remove(n),r&&t.remove(r),this._group=null,this._handle=null,this._payloadInfo=null),wR(this,`_doDispatchAxisPointer`)},e.prototype.doClear=function(){},e.prototype.buildLabel=function(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}},e}();function KW(e,t,n,r){qW(HW(n).lastProp,r)||(HW(n).lastProp=r,t?bk(n,r,e):(n.stopAnimation(),n.attr(r)))}function qW(e,t){if(jb(e)&&jb(t)){var n=!0;return W(t,function(t,r){n&&=qW(e[r],t)}),!!n}return e===t}function JW(e,t){e[t.get([`label`,`show`])?`show`:`hide`]()}function YW(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function XW(e,t,n){var r=t.get(`z`),i=t.get(`zlevel`);e&&e.traverse(function(e){e.type!==`group`&&(r!=null&&(e.z=r),i!=null&&(e.zlevel=i),e.silent=n)})}function ZW(e){var t=e.get(`type`),n=e.getModel(t+`Style`),r;return t===`line`?(r=n.getLineStyle(),r.fill=null):t===`shadow`&&(r=n.getAreaStyle(),r.stroke=null),r}function QW(e,t,n,r,i){var a=eG(n.get(`value`),t.axis,t.ecModel,n.get(`seriesDataIndices`),{precision:n.get([`label`,`precision`]),formatter:n.get([`label`,`formatter`])}),o=n.getModel(`label`),s=xj(o.get(`padding`)||0),c=o.getFont(),l=UC(a,c),u=i.position,d=l.width+s[1]+s[3],f=l.height+s[0]+s[2],p=i.align;p===`right`&&(u[0]-=d),p===`center`&&(u[0]-=d/2);var m=i.verticalAlign;m===`bottom`&&(u[1]-=f),m===`middle`&&(u[1]-=f/2),$W(u,d,f,r);var h=o.get(`backgroundColor`);(!h||h===`auto`)&&(h=t.get([`axisLine`,`lineStyle`,`color`])),e.label={x:u[0],y:u[1],style:fA(o,{text:a,font:c,fill:o.getTextColor(),padding:s,backgroundColor:h}),z2:10}}function $W(e,t,n,r){var i=r.getWidth(),a=r.getHeight();e[0]=Math.min(e[0]+t,i)-t,e[1]=Math.min(e[1]+n,a)-n,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function eG(e,t,n,r,i){e=t.scale.parse(e);var a=t.scale.getLabel({value:e},{precision:i.precision}),o=i.formatter;if(o){var s={value:uF(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};W(r,function(e){var t=n.getSeriesByIndex(e.seriesIndex),r=e.dataIndexInside,i=t&&t.getDataParams(r);i&&s.seriesData.push(i)}),Ob(o)?a=o.replace(`{value}`,a):Db(o)&&(a=o(s))}return a}function tG(e,t,n){var r=JS();return $S(r,r,n.rotation),QS(r,r,n.position),Rk([e.dataToCoord(t),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],r)}function nG(e,t,n,r,i,a){var o=_I.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=i.get([`label`,`margin`]),QW(t,r,i,a,{position:tG(r.axis,e,n),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function rG(e,t,n){return n||=0,{x1:e[n],y1:e[1-n],x2:t[n],y2:t[1-n]}}function iG(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}}function aG(e,t,n){return tI(e,{fromStat:{sers:bb(t,function(e){return n.getSeriesByIndex(e.seriesIndex)})},min:1}).w}function oG(e,t,n){return[rx(nx(t[0],t[1]),e-n/2),nx(e+n/2,rx(t[0],t[1]))]}var sG=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(e,t,n,r,i){var a=n.axis,o=a.grid,s=r.get(`type`),c=a.getGlobalExtent(),l=cG(o,a).getOtherAxis(a).getGlobalExtent(),u=a.toGlobalCoord(a.dataToCoord(t,!0));if(s&&s!==`none`){var d=ZW(r),f=lG[s](a,u,c,l,r.get(`seriesDataIndices`),r.ecModel);f.style=d,e.graphicKey=f.type,e.pointer=f}nG(t,e,EI(o.getRect(),n),n,r,i)},t.prototype.getHandleTransform=function(e,t,n){var r=EI(t.axis.grid.getRect(),t,{labelInside:!1});r.labelMargin=n.get([`handle`,`margin`]);var i=tG(t.axis,e,r);return{x:i[0],y:i[1],rotation:r.rotation+(r.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(e,t,n,r){var i=n.axis,a=i.grid,o=i.getGlobalExtent(!0),s=cG(a,i).getOtherAxis(i).getGlobalExtent(),c=i.dim===`x`?0:1,l=[e.x,e.y];l[c]+=t[c],l[c]=nx(o[1],l[c]),l[c]=rx(o[0],l[c]);var u=(s[1]+s[0])/2,d=[u,u];return d[c]=l[c],{x:l[0],y:l[1],rotation:e.rotation,cursorPoint:d,tooltipOption:[{verticalAlign:`middle`},{align:`center`}][c]}},t}(GW);function cG(e,t){var n={};return n[t.dim+`AxisIndex`]=t.index,e.getCartesian(n)}var lG={line:function(e,t,n,r){return{type:`Line`,subPixelOptimize:!0,shape:rG([t,r[0]],[t,r[1]],uG(e))}},shadow:function(e,t,n,r,i,a){var o=aG(e,i,a),s=r[1]-r[0],c=oG(t,n,o),l=c[0],u=c[1];return{type:`Rect`,shape:iG([l,r[0]],[u-l,s],uG(e))}}};function uG(e){return e.dim===`x`?0:1}var dG=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`axisPointer`,t.defaultOption={show:`auto`,z:50,type:`line`,snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:K.color.border,width:1,type:`dashed`},shadowStyle:{color:K.color.shadowTint},label:{show:!0,formatter:null,precision:`auto`,margin:3,color:K.color.neutral00,padding:[5,7,5,7],backgroundColor:K.color.accent60,borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:`M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z`,size:45,margin:50,color:K.color.accent40,throttle:40}},t}(Wj),fG=dS(),pG=W;function mG(e,t,n){if(!$b.node){var r=t.getZr();fG(r).records||(fG(r).records={}),hG(r,t);var i=fG(r).records[e]||(fG(r).records[e]={});i.handler=n}}function hG(e,t){if(fG(e).initialized)return;fG(e).initialized=!0,n(`click`,Eb(vG,`click`)),n(`mousemove`,Eb(vG,`mousemove`)),n(`mousewheel`,Eb(vG,`mousewheel`)),n(`globalout`,_G);function n(n,r){e.on(n,function(n){var i=yG(t);pG(fG(e).records,function(e){e&&r(e,n,i.dispatchAction)}),gG(i.pendings,t)})}}function gG(e,t){var n=e.showTip.length,r=e.hideTip.length,i;n?i=e.showTip[n-1]:r&&(i=e.hideTip[r-1]),i&&(i.dispatchAction=null,t.dispatchAction(i))}function _G(e,t,n){e.handler(`leave`,null,n)}function vG(e,t,n,r){t.handler(e,n,r)}function yG(e){var t={showTip:[],hideTip:[]},n=function(r){var i=t[r.type];i?i.push(r):(r.dispatchAction=n,e.dispatchAction(r))};return{dispatchAction:n,pendings:t}}function bG(e,t){if(!$b.node){var n=t.getZr();(fG(n).records||{})[e]&&(fG(n).records[e]=null)}}var xG=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r=t.getComponent(`tooltip`),i=e.get(`triggerOn`)||r&&r.get(`triggerOn`)||`mousemove|click|mousewheel`;mG(`axisPointer`,n,function(e,t,n){i!==`none`&&(e===`leave`||i.indexOf(e)>=0)&&n({type:`updateAxisPointer`,currTrigger:e,x:t&&t.offsetX,y:t&&t.offsetY})})},t.prototype.remove=function(e,t){bG(`axisPointer`,t)},t.prototype.dispose=function(e,t){bG(`axisPointer`,t)},t.type=`axisPointer`,t}(pR);function SG(e,t){var n=[],r=e.seriesIndex,i;if(r==null||!(i=t.getSeriesByIndex(r)))return{point:[]};var a=i.getData(),o=uS(a,e);if(o==null||o<0||G(o))return{point:[]};var s=a.getItemGraphicEl(o),c=i.coordinateSystem;if(i.getTooltipPosition)n=i.getTooltipPosition(o)||[];else if(c&&c.dataToPoint){if(e.isStacked){var l=c.getBaseAxis(),u=c.getOtherAxis(l).dim,d=l.dim,f=+(u===`x`||u===`radius`),p=a.mapDimension(d),m=[];m[f]=a.get(p,o),m[1-f]=a.get(a.getCalculationInfo(`stackResultDimension`),o),n=c.dataToPoint(m)||[]}else n=c.dataToPoint(a.getValues(bb(c.dimensions,function(e){return a.mapDimension(e)}),o))||[]}else if(s){var h=s.getBoundingRect().clone();h.applyTransform(s.transform),n=[h.x+h.width/2,h.y+h.height/2]}return{point:n,el:s}}var CG=dS();function wG(e,t,n){var r=e.currTrigger,i=[e.x,e.y],a=e,o=e.dispatchAction||Tb(n.dispatchAction,n),s=t.getComponent(`axisPointer`).coordSysAxesInfo;if(s){PG(i)&&(i=SG({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},t).point);var c=PG(i),l=a.axesInfo,u=s.axesInfo,d=r===`leave`||PG(i),f={},p={},m={list:[],map:{}},h={showPointer:Eb(DG,p),showTooltip:Eb(OG,m)};W(s.coordSysMap,function(e,t){var n=c||e.containPoint(i);W(s.coordSysAxesInfo[t],function(e,t){var r=e.axis,a=MG(l,e);if(!d&&n&&(!l||a)){var o=a&&a.value;o==null&&!c&&(o=r.pointToData(i)),o!=null&&TG(e,o,h,!1,f)}})});var g={};return W(u,function(e,t){var n=e.linkGroup;n&&!p[t]&&W(n.axesInfo,function(t,r){var i=p[r];if(t!==e&&i){var a=i.value;n.mapper&&(a=e.axis.scale.parse(n.mapper(a,NG(t),NG(e)))),g[e.key]=a}})}),W(g,function(e,t){TG(u[t],e,h,!0,f)}),kG(p,u,f),AG(m,i,e,o),jG(u,o,n),f}}function TG(e,t,n,r,i){var a=e.axis;if(!a.scale.isBlank()&&a.containData(t)){if(!e.involveSeries){n.showPointer(e,t);return}var o=EG(t,e),s=o.payloadBatch,c=o.snapToValue;s[0]&&i.seriesIndex==null&&U(i,s[0]),!r&&e.snap&&a.containData(c)&&c!=null&&(t=c),n.showPointer(e,t,s),n.showTooltip(e,o,c)}}function EG(e,t){var n=t.axis,r=n.dim,i=e,a=[],o=Number.MAX_VALUE,s=-1;return W(t.seriesModels,function(t,c){var l=t.getData().mapDimensionsAll(r),u,d;if(t.getAxisTooltipData){var f=t.getAxisTooltipData(l,e,n);d=f.dataIndices,u=f.nestestValue}else{if(d=t.indicesOfNearest(r,l[0],e,n.type===`category`?.5:null),!d.length)return;u=t.getData().get(l[0],d[0])}if(Nx(u)){var p=e-u,m=Math.abs(p);m<=o&&((m=0&&s<0)&&(o=m,s=p,i=u,a.length=0),W(d,function(e){a.push({seriesIndex:t.seriesIndex,dataIndexInside:e,dataIndex:t.getData().getRawIndex(e)})}))}}),{payloadBatch:a,snapToValue:i}}function DG(e,t,n,r){e[t.key]={value:n,payloadBatch:r}}function OG(e,t,n,r){var i=n.payloadBatch,a=t.axis,o=a.model,s=t.axisPointerModel;if(t.triggerTooltip&&i.length){var c=t.coordSys.model,l=SV(c),u=e.map[l];u||(u=e.map[l]={coordSysId:c.id,coordSysIndex:c.componentIndex,coordSysType:c.type,coordSysMainType:c.mainType,dataByAxis:[]},e.list.push(u)),u.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:r,valueLabelOpt:{precision:s.get([`label`,`precision`]),formatter:s.get([`label`,`formatter`])},seriesDataIndices:i.slice()})}}function kG(e,t,n){var r=n.axesInfo=[];W(t,function(t,n){var i=t.axisPointerModel.option,a=e[n];a?(!t.useHandle&&(i.status=`show`),i.value=a.value,i.seriesDataIndices=(a.payloadBatch||[]).slice()):!t.useHandle&&(i.status=`hide`),i.status===`show`&&r.push({axisDim:t.axis.dim,axisIndex:t.axis.model.componentIndex,value:i.value})})}function AG(e,t,n,r){if(PG(t)||!e.list.length){r({type:`hideTip`});return}var i=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};r({type:`showTip`,escapeConnect:!0,x:t[0],y:t[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:i.dataIndexInside,dataIndex:i.dataIndex,seriesIndex:i.seriesIndex,dataByCoordSys:e.list})}function jG(e,t,n){var r=n.getZr(),i=`axisPointerLastHighlights`,a=CG(r)[i]||{},o=CG(r)[i]={};W(e,function(e,t){var n=e.axisPointerModel.option;n.status===`show`&&e.triggerEmphasis&&W(n.seriesDataIndices,function(e){o[e.seriesIndex+`|`+e.dataIndex]=e})});var s=[],c=[];function l(e){return{seriesIndex:e.seriesIndex,dataIndex:e.dataIndex}}W(a,function(e,t){!o[t]&&c.push(l(e))}),W(o,function(e,t){!a[t]&&s.push(l(e))}),c.length&&n.dispatchAction({type:`downplay`,escapeConnect:!0,notBlur:!0,batch:c}),s.length&&n.dispatchAction({type:`highlight`,escapeConnect:!0,notBlur:!0,batch:s})}function MG(e,t){for(var n=0;n<(e||[]).length;n++){var r=e[n];if(t.axis.dim===r.axisDim&&t.axis.model.componentIndex===r.axisIndex)return r}}function NG(e){var t=e.axis.model,n={},r=n.axisDim=e.axis.dim;return n.axisIndex=n[r+`AxisIndex`]=t.componentIndex,n.axisName=n[r+`AxisName`]=t.name,n.axisId=n[r+`AxisId`]=t.id,n}function PG(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function FG(e){wV.registerAxisPointerClass(`CartesianAxisPointer`,sG),e.registerComponentModel(dG),e.registerComponentView(xG),e.registerPreprocessor(function(e){if(e){(!e.axisPointer||e.axisPointer.length===0)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!G(t)&&(e.axisPointer.link=[t])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,{overallReset:function(e,t){e.getComponent(`axisPointer`).coordSysAxesInfo=tpe(e,t)}}),e.registerAction({type:`updateAxisPointer`,event:`updateAxisPointer`,update:`:updateAxisPointer`},wG)}function IG(e){IB(kV),IB(FG)}function LG(e,t){var n=e.existing;if(t.id=e.keyInfo.id,!t.type&&n&&(t.type=n.type),t.parentId==null){var r=t.parentOption;r?t.parentId=r.id:n&&(t.parentId=n.parentId)}t.parentOption=null}function RG(e,t){var n;return W(t,function(t){e[t]!=null&&e[t]!==`auto`&&(n=!0)}),n}function zG(e,t,n){var r=U({},n),i=e[t],a=n.$action||`merge`;a===`merge`?i?(hb(i,r,!0),Vj(i,r,{ignoreSize:!0}),Uj(n,i),HG(n,i),HG(n,i,`shape`),HG(n,i,`style`),HG(n,i,`extra`),n.clipPath=i.clipPath):e[t]=r:a===`replace`?e[t]=r:a===`remove`&&i&&(e[t]=null)}var BG=[`transition`,`enterFrom`,`leaveTo`],VG=BG.concat([`enterAnimation`,`updateAnimation`,`leaveAnimation`]);function HG(e,t,n){if(n&&(!e[n]&&t[n]&&(e[n]={}),e=e[n],t=t[n]),e&&t)for(var r=n?BG:VG,i=0;i=0;c--){var l=n[c],u=rS(l.id,null),d=u==null?null:i.get(u);if(d){var f=d.parent,h=KG(f),g=f===r?{width:a,height:o}:{width:h.width,height:h.height},_={},v=zj(d,l,g,null,{hv:l.hv,boundingMode:l.bounding},_);if(!KG(d).isNew&&v){for(var y=l.transition,b={},x=0;x=0)?b[S]=C:d[S]=C}bk(d,b,e,0)}else d.attr(_)}}},t.prototype._clear=function(){var e=this,t=this._elMap;t.each(function(n){XG(n,KG(n).option,t,e._lastGraphicModel)}),this._elMap=Jb()},t.prototype.dispose=function(){this._clear()},t.type=`graphic`,t}(pR);function JG(e){var t=new(Zb(GG,e)?GG[e]:jk(e))({});return KG(t).type=e,t}function YG(e,t,n,r){var i=JG(n);return t.add(i),r.set(e,i),KG(i).id=e,KG(i).isNew=!0,i}function XG(e,t,n,r){e&&e.parent&&(e.type===`group`&&e.traverse(function(e){XG(e,t,n,r)}),nW(e,t,r),n.removeKey(KG(e).id))}function ZG(e,t,n,r){e.isGroup||W([[`cursor`,XT.prototype.cursor],[`zlevel`,r||0],[`z`,n||0],[`z2`,0]],function(n){var r=n[0];Zb(t,r)?e[r]=Rb(t[r],n[1]):e[r]??(e[r]=n[1])}),W(wb(t),function(n){if(n.indexOf(`on`)===0){var r=t[n];e[n]=Db(r)?r:null}}),Zb(t,`draggable`)&&(e.draggable=t.draggable),t.name!=null&&(e.name=t.name),t.id!=null&&(e.id=t.id)}function QG(e){return e=U({},e),W([`id`,`parentId`,`$action`,`hv`,`bounding`,`textContent`,`clipPath`].concat(Mj),function(t){delete e[t]}),e}function $G(e,t,n){var r=yD(e).eventData;!e.silent&&!e.ignore&&!r&&(r=yD(e).eventData={componentType:`graphic`,componentIndex:t.componentIndex,name:e.name}),r&&(r.info=n.info)}function eK(e){e.registerComponentModel(WG),e.registerComponentView(qG),e.registerPreprocessor(function(e){var t=e.graphic;G(t)?e.graphic=!t[0]||!t[0].elements?[{elements:t}]:[e.graphic[0]]:t&&!t.elements&&(e.graphic=[{elements:[t]}])})}var tK=[`x`,`y`,`radius`,`angle`,`single`],nK=dS(),rK=[`cartesian2d`,`polar`,`singleAxis`];function iK(e){return _b(rK,e.get(`coordinateSystem`))>=0}function aK(e){return e+`Axis`}function oK(e,t){var n=Jb(),r=[],i=Jb();e.eachComponent({mainType:`dataZoom`,query:t},function(e){i.get(e.uid)||s(e)});var a;do a=!1,e.eachComponent(`dataZoom`,o);while(a);function o(e){!i.get(e.uid)&&c(e)&&(s(e),a=!0)}function s(e){i.set(e.uid,!0),r.push(e),l(e)}function c(e){var t=!1;return e.eachTargetAxis(function(e,r){var i=n.get(e);i&&i[r]&&(t=!0)}),t}function l(e){e.eachTargetAxis(function(e,t){(n.get(e)||n.set(e,[]))[t]=!0})}return r}function sK(e){var t=e.ecModel,n={infoList:[],infoMap:Jb()};return e.eachTargetAxis(function(e,r){var i=t.getComponent(aK(e),r);if(i){var a=i.getCoordSysModel();if(a){var o=a.uid,s=n.infoMap.get(o);s||(s={model:a,axisModels:[]},n.infoList.push(s),n.infoMap.set(o,s)),s.axisModels.push(i)}}}),n}function cK(e){var t=nK(HF(e));return t.axisProxyMap||=Jb()}function lK(e){if(e)return cK(e.ecModel).get(e.uid)}function uK(e,t){cK(e.ecModel).set(e.uid,t)}function dK(e,t){var n=t.getAxisModel().axis.__alignTo;return n&&e.getAxisProxy(n.dim,n.model.componentIndex)?lK(n.model):null}var fK=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},e}(),pK=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=[`percent`,`percent`],n}return t.prototype.init=function(e,t,n){var r=mK(e);this.settledOption=r,this.mergeDefaultAndTheme(e,n),this._doInit(r)},t.prototype.mergeOption=function(e){var t=mK(e);hb(this.option,e,!0),hb(this.settledOption,t,!0),this._doInit(t)},t.prototype._doInit=function(e){var t=this.option;this._setDefaultThrottle(e),this._updateRangeUse(e);var n=this.settledOption;W([[`start`,`startValue`],[`end`,`endValue`]],function(e,r){this._rangePropMode[r]===`value`&&(t[e[0]]=n[e[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var e=this.get(`orient`,!0),t=this._targetAxisInfoMap=Jb();this._fillSpecifiedTargetAxis(t)?this._orient=e||this._makeAutoOrientByTargetAxis():(this._orient=e||`horizontal`,this._fillAutoTargetAxisByOrient(t,this._orient)),this._noTarget=!0,t.each(function(e){e.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(e){var t=!1;return W(tK,function(n){var r=this.getReferringComponents(aK(n),gS);if(r.specified){t=!0;var i=new fK;W(r.models,function(e){i.add(e.componentIndex)}),e.set(n,i)}},this),t},t.prototype._fillAutoTargetAxisByOrient=function(e,t){var n=this.ecModel,r=!0;if(r){var i=t===`vertical`?`y`:`x`,a=n.findComponents({mainType:i+`Axis`});o(a,i)}if(r){var a=n.findComponents({mainType:`singleAxis`,filter:function(e){return e.get(`orient`,!0)===t}});o(a,`single`)}function o(t,n){var i=t[0];if(i){var a=new fK;if(a.add(i.componentIndex),e.set(n,a),r=!1,n===`x`||n===`y`){var o=i.getReferringComponents(`grid`,hS).models[0];o&&W(t,function(e){i.componentIndex!==e.componentIndex&&o===e.getReferringComponents(`grid`,hS).models[0]&&a.add(e.componentIndex)})}}}r&&W(tK,function(t){if(r){var i=n.findComponents({mainType:aK(t),filter:function(e){return e.get(`type`,!0)===`category`}});if(i[0]){var a=new fK;a.add(i[0].componentIndex),e.set(t,a),r=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var e;return this.eachTargetAxis(function(t){!e&&(e=t)},this),e===`y`?`vertical`:`horizontal`},t.prototype._setDefaultThrottle=function(e){if(e.hasOwnProperty(`throttle`)&&(this._autoThrottle=!1),this._autoThrottle){var t=this.ecModel.option;this.option.throttle=t.animation&&t.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(e){var t=this._rangePropMode,n=this.get(`rangeMode`);W([[`start`,`startValue`],[`end`,`endValue`]],function(r,i){var a=e[r[0]]!=null,o=e[r[1]]!=null;a&&!o?t[i]=`percent`:!a&&o?t[i]=`value`:n?t[i]=n[i]:a&&(t[i]=`percent`)})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var e;return this.eachTargetAxis(function(t,n){e??=this.ecModel.getComponent(aK(t),n)},this),e},t.prototype.eachTargetAxis=function(e,t){this._targetAxisInfoMap.each(function(n,r){W(n.indexList,function(n){e.call(t,r,n)})})},t.prototype.getAxisProxy=function(e,t){return lK(this.getAxisModel(e,t))},t.prototype.getAxisModel=function(e,t){var n=this._targetAxisInfoMap.get(e);if(n&&n.indexMap[t])return this.ecModel.getComponent(aK(e),t)},t.prototype.setRawRange=function(e){var t=this.option,n=this.settledOption;W([[`start`,`startValue`],[`end`,`endValue`]],function(r){(e[r[0]]!=null||e[r[1]]!=null)&&(t[r[0]]=n[r[0]]=e[r[0]],t[r[1]]=n[r[1]]=e[r[1]])},this),this._updateRangeUse(e)},t.prototype.setCalculatedRange=function(e){var t=this.option;W([`start`,`startValue`,`end`,`endValue`],function(n){t[n]=e[n]})},t.prototype.getPercentRange=function(){var e=this.findRepresentativeAxisProxy();if(e)return e.getWindow().percent},t.prototype.getValueRange=function(e,t){if(e==null&&t==null){var n=this.findRepresentativeAxisProxy();if(n)return n.getWindow().value}else return this.getAxisProxy(e,t).getWindow().value},t.prototype.findRepresentativeAxisProxy=function(e){if(e)return lK(e);for(var t,n=this._targetAxisInfoMap.keys(),r=0;ra[1];if(u&&!d&&!f)return!0;u&&(i=!0),d&&(t=!0),f&&(n=!0)}return i&&t&&n})}else W(r,function(n){if(i===`empty`)e.setData(t=t.map(n,function(e){return o(e)?e:NaN}));else{var r={};r[n]=a,t.selectRange(r)}});W(r,function(e){t.setApproximateExtent(a,e)})}});function o(e){return e>=a[0]&&e<=a[1]}},e.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,n=this._extent;W([`min`,`max`],function(r){var i=t.get(r+`Span`),a=t.get(r+`ValueSpan`);a!=null&&(a=this.getAxisModel().axis.scale.parse(a)),a==null?i!=null&&(a=dx(i,[0,100],n,!0)-n[0]):i=dx(n[0]+a,n,[0,100],!0),e[r+`Span`]=i,e[r+`ValueSpan`]=a},this)},e}(),yK={dirtyOnOverallProgress:!0,getTargetSeries:function(e){function t(t){e.eachComponent(`dataZoom`,function(n){n.eachTargetAxis(function(r,i){t(r,i,e.getComponent(aK(r),i),n)})})}var n=[];t(function(t,r,i,a){if(!lK(i)){var o=new vK(t,r,a,e);n.push(o),uK(i,o)}});var r=Jb();return W(n,function(e){W(e.getTargetSeriesModels(),function(e){r.set(e.uid,e)})}),r},overallReset:function(e,t){e.eachComponent(`dataZoom`,function(e){var n=[];e.eachTargetAxis(function(t,r){var i=e.getAxisProxy(t,r),a=dK(e,i);a?n.push([i,a]):i.reset(e,null)}),W(n,function(t){t[0].reset(e,t[1].getWindow().percentInverted)}),e.eachTargetAxis(function(n,r){e.getAxisProxy(n,r).filterData(e,t)})}),e.eachComponent(`dataZoom`,function(e){var t=e.findRepresentativeAxisProxy();if(t){var n=t.getWindow(),r=n.percent,i=n.value;e.setCalculatedRange({start:r[0],end:r[1],startValue:i[0],endValue:i[1]})}})}};function bK(e){e.registerAction(`dataZoom`,function(e,t){W(oK(t,e),function(t){t.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var xK=AS();function SK(e){xK(e,function(){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,yK),bK(e),e.registerSubTypeDefaulter(`dataZoom`,function(){return`slider`})})}function CK(e){e.registerComponentModel(hK),e.registerComponentView(_K),SK(e)}var wK=function(){function e(){}return e}(),TK={};function EK(e,t){TK[e]=t}function DK(e){return TK[e]}var OK=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(t,n,r){var i=r.getTheme().get(`toolbox`),a=i?i.feature:null;a&&(this._themeFeatureOption=U({},a),i.feature={}),e.prototype.init.call(this,t,n,r),a&&(i.feature=a)},t.prototype.optionUpdated=function(){W(this.option.feature,function(e,t){var n=this._themeFeatureOption,r=DK(t);r&&(r.getDefaultOption&&(r.defaultOption=r.getDefaultOption(this.ecModel)),n&&n[t]&&(hb(e,n[t]),n[t]=null),hb(e,r.defaultOption))},this)},t.type=`toolbox`,t.layoutMode={type:`box`,ignoreSize:!0},t.defaultOption={show:!0,z:6,orient:`horizontal`,left:`right`,top:`top`,backgroundColor:`transparent`,borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:K.size.m,itemSize:15,itemGap:K.size.s,showTitle:!0,iconStyle:{borderColor:K.color.accent50,color:`none`},emphasis:{iconStyle:{borderColor:K.color.accent70}},tooltip:{show:!1,position:`bottom`}},t}(Wj);function kK(e,t){var n=xj(t.get(`padding`)),r=t.getItemStyle([`color`,`opacity`]);return r.fill=t.get(`backgroundColor`),new eD({shape:{x:e.x-n[3],y:e.y-n[0],width:e.width+n[1]+n[3],height:e.height+n[0]+n[2],r:t.get(`borderRadius`)},style:r,silent:!0,z2:-1})}var AK=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(e,t,n,r){var i=this.group;if(i.removeAll(),!e.get(`show`))return;var a=+e.get(`itemSize`),o=e.get(`orient`)===`vertical`,s=e.get(`feature`)||{},c=this._features||=Jb(),l=[];W(s,function(e,t){l.push(t)}),new lN(this._featureNames||[],l).add(u).update(u).remove(Eb(u,null)).execute(),this._featureNames=Sb(l,function(e){return c.hasKey(e)});function u(i,a){var o=i!=null&&a==null,u=i!=null&&a!=null,f=i==null,p=o||u?l[i]:l[a],m=s[p],h=o||u?new TA(m,e,t):null,g=h&&h.get(`show`),_;if(o){if(!g)return;if(jK(p))_={onclick:h.option.onclick,featureName:p};else{var v=DK(p);if(!v)return;_=new v}c.set(p,_)}else _=c.get(p);if(f||!g){MK(_)&&_.dispose&&_.dispose(t,n),c.removeKey(p);return}r&&r.newTitle!=null&&r.featureName===p&&(m.title=r.newTitle),o&&(_.uid=EA(`toolbox-feature`)),_.model=h,_.ecModel=t,_.api=n,d(h,_,p),h.setIconStatus=function(e,t){var n=this.option,r=this.iconPaths;n.iconStatus=n.iconStatus||{},n.iconStatus[e]=t,r[e]&&(t===`emphasis`?iO:aO)(r[e])},MK(_)&&_.render&&_.render(h,t,n,r)}function d(r,s,c){var l=r.getModel(`iconStyle`),u=r.getModel([`emphasis`,`iconStyle`]),d=s instanceof wK&&s.getIcons?s.getIcons():r.get(`icon`),f=r.get(`title`)||{},p,m;Ob(d)?(p={},p[c]=d):p=d,Ob(f)?(m={},m[c]=f):m=f;var h=r.iconPaths={};W(p,function(c,d){var f=Uk(c,{},{x:-a/2,y:-a/2,width:a,height:a});f.setStyle(l.getItemStyle());var p=f.ensureState(`emphasis`);p.style=u.getItemStyle();var g=new aD({style:{text:m[d],align:u.get(`textAlign`),borderRadius:u.get(`textBorderRadius`),padding:u.get(`textPadding`),fill:null,font:vA({fontStyle:u.get(`textFontStyle`),fontFamily:u.get(`textFontFamily`),fontSize:u.get(`textFontSize`),fontWeight:u.get(`textFontWeight`)},t)},ignore:!0});f.setTextContent(g),Xk({el:f,componentModel:e,itemName:d,formatterParamsExtra:{title:m[d]}}),f.__title=m[d],f.on(`mouseover`,function(){var t=u.getItemStyle(),r=o?e.get(`right`)==null&&e.get(`left`)!==`right`?`right`:`left`:e.get(`bottom`)==null&&e.get(`top`)!==`bottom`?`bottom`:`top`;g.setStyle({fill:u.get(`textFill`)||t.fill||t.stroke||K.color.neutral99,backgroundColor:u.get(`textBackgroundColor`)}),f.setTextConfig({position:u.get(`textPosition`)||r}),g.ignore=!e.get(`showTitle`),n.enterEmphasis(this)}).on(`mouseout`,function(){r.get([`iconStatus`,d])!==`emphasis`&&n.leaveEmphasis(this),g.hide()}),(r.get([`iconStatus`,d])===`emphasis`?iO:aO)(f),i.add(f),f.on(`click`,Tb(s.onclick,s,t,n,d)),h[d]=f})}var f=Rj(e,n).refContainer,p=e.getBoxLayoutParams(),m=e.get(`padding`),h=Ij(p,f,m);Fj(e.get(`orient`),i,e.get(`itemGap`),h.width,h.height),zj(i,p,f,m),i.add(kK(i.getBoundingRect(),e)),o||i.eachChild(function(e){var t=e.__title,r=e.ensureState(`emphasis`),o=r.textConfig||={},s=e.getTextContent(),c=s&&s.ensureState(`emphasis`);if(c&&!Db(c)&&t){var l=c.style||={},u=UC(t,aD.makeFont(l)),d=e.x+i.x,f=e.y+i.y+a,p=!1;f+u.height>n.getHeight()&&(o.position=`top`,p=!0);var m=p?-5-u.height:a+10;d+u.width/2>n.getWidth()?(o.position=[`100%`,m],l.align=`right`):d-u.width/2<0&&(o.position=[0,m],l.align=`left`)}})},t.prototype.updateView=function(e,t,n,r){W(this._features,function(e){e&&e instanceof wK&&e.updateView&&e.updateView(e.model,t,n,r)})},t.prototype.dispose=function(e,t){W(this._features,function(n){n&&n instanceof wK&&n.dispose&&n.dispose(e,t)})},t.type=`toolbox`,t}(pR);function jK(e){return e.indexOf(`my`)===0}function MK(e){return e instanceof wK}var NK=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(e,t){var n=this.model,r=n.get(`name`)||e.get(`title.0.text`)||`echarts`,i=t.getZr().painter.getType()===`svg`,a=i?`svg`:n.get(`type`,!0)||`png`,o=t.getConnectedDataURL({type:a,backgroundColor:n.get(`backgroundColor`,!0)||e.get(`backgroundColor`)||K.color.neutral00,connectedBackgroundColor:n.get(`connectedBackgroundColor`),excludeComponents:n.get(`excludeComponents`),pixelRatio:n.get(`pixelRatio`)}),s=$b.browser;if(typeof MouseEvent==`function`&&(s.newEdge||!s.ie&&!s.edge)){var c=document.createElement(`a`);c.download=r+`.`+a,c.target=`_blank`,c.href=o;var l=new MouseEvent(`click`,{view:document.defaultView,bubbles:!0,cancelable:!1});c.dispatchEvent(l)}else if(window.navigator.msSaveOrOpenBlob||i){var u=o.split(`,`),d=u[0].indexOf(`base64`)>-1,f=i?decodeURIComponent(u[1]):u[1];d&&(f=window.atob(f));var p=r+`.`+a;if(window.navigator.msSaveOrOpenBlob){for(var m=f.length,h=new Uint8Array(m);m--;)h[m]=f.charCodeAt(m);var g=new Blob([h]);window.navigator.msSaveOrOpenBlob(g,p)}else{var _=document.createElement(`iframe`);document.body.appendChild(_);var v=_.contentWindow,y=v.document;y.open(`image/svg+xml`,`replace`),y.write(f),y.close(),v.focus(),y.execCommand(`SaveAs`,!0,p),document.body.removeChild(_)}}else{var b=n.get(`lang`),x=``,S=window.open();S.document.write(x),S.document.title=r}},t.getDefaultOption=function(e){return{show:!0,icon:`M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0`,title:e.getLocaleModel().get([`toolbox`,`saveAsImage`,`title`]),type:`png`,connectedBackgroundColor:K.color.neutral00,name:``,excludeComponents:[`toolbox`],lang:e.getLocaleModel().get([`toolbox`,`saveAsImage`,`lang`])}},t}(wK),PK=`__ec_magicType_stack__`,FK=[[`line`,`bar`],[`stack`]],IK=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getIcons=function(){var e=this.model,t=e.get(`icon`),n={};return W(e.get(`type`),function(e){t[e]&&(n[e]=t[e])}),n},t.getDefaultOption=function(e){return{show:!0,type:[],icon:{line:`M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4`,bar:`M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7`,stack:`M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z`},title:e.getLocaleModel().get([`toolbox`,`magicType`,`title`]),option:{},seriesIndex:{}}},t.prototype.onclick=function(e,t,n){var r=this.model,i=r.get([`seriesIndex`,n]);if(LK[n]){var a={series:[]};W(FK,function(e){_b(e,n)>=0&&W(e,function(e){r.setIconStatus(e,`normal`)})}),r.setIconStatus(n,`emphasis`),e.eachComponent({mainType:`series`,query:i==null?null:{seriesIndex:i}},function(e){var t=e.subType,i=e.id,o=LK[n](t,i,e,r);o&&(gb(o,e.option),a.series.push(o));var s=e.coordinateSystem;if(s&&s.type===`cartesian2d`&&(n===`line`||n===`bar`)){var c=s.getAxesByScale(`ordinal`)[0];if(c){var l=c.dim+`Axis`,u=e.getReferringComponents(l,hS).models[0].componentIndex;a[l]=a[l]||[];for(var d=0;d<=u;d++)a[l][u]=a[l][u]||{};a[l][u].boundaryGap=n===`bar`}}});var o,s=n;n===`stack`&&(o=hb({stack:r.option.title.tiled,tiled:r.option.title.stack},r.option.title),r.get([`iconStatus`,n])!==`emphasis`&&(s=`tiled`)),t.dispatchAction({type:`changeMagicType`,currentType:s,newOption:a,newTitle:o,featureName:`magicType`})}},t}(wK),LK={line:function(e,t,n,r){if(e===`bar`)return hb({id:t,type:`line`,data:n.get(`data`),stack:n.get(`stack`),markPoint:n.get(`markPoint`),markLine:n.get(`markLine`)},r.get([`option`,`line`])||{},!0)},bar:function(e,t,n,r){if(e===`line`)return hb({id:t,type:`bar`,data:n.get(`data`),stack:n.get(`stack`),markPoint:n.get(`markPoint`),markLine:n.get(`markLine`)},r.get([`option`,`bar`])||{},!0)},stack:function(e,t,n,r){var i=n.get(`stack`)===PK;if(e===`line`||e===`bar`)return r.setIconStatus(`stack`,i?`normal`:`emphasis`),hb({id:t,stack:i?``:PK},r.get([`option`,`stack`])||{},!0)}};kB({type:`changeMagicType`,event:`magicTypeChanged`,update:`prepareAndUpdate`},function(e,t){t.mergeOption(e.newOption)});var RK=Array(60).join(`-`),zK=` `;function BK(e){var t={},n=[],r=[];return e.eachRawSeries(function(e){var i=e.coordinateSystem;if(i&&(i.type===`cartesian2d`||i.type===`polar`)){var a=i.getBaseAxis();if(a.type===`category`){var o=Ble(a);t[o]||(t[o]={categoryAxis:a,valueAxis:i.getOtherAxis(a),series:[]},r.push({axisDim:a.dim,axisIndex:a.index})),t[o].series.push(e)}else n.push(e)}else n.push(e)}),{seriesGroupByCategoryAxis:t,other:n,meta:r}}function VK(e){var t=[];return W(e,function(e,n){var r=e.categoryAxis,i=e.valueAxis.dim,a=[` `].concat(bb(e.series,function(e){return e.name})),o=[r.model.getCategories()];W(e.series,function(e){var t=e.getRawData();o.push(e.getRawData().mapArray(t.mapDimension(i),function(e){return e}))});for(var s=[a.join(zK)],c=0;c=0)return!0}var qK=RegExp(`[`+BK+`]+`,`g`);function JK(e){for(var t=e.split(/\n+/g),n=GK(t.shift()).split(qK),r=[],i=bb(n,function(e){return{name:e,data:[]}}),a=0;a=0&&!n[i][r];i--);if(i<0){var a=e.queryComponents({mainType:`dataZoom`,subType:`select`,id:r})[0];if(a){var o=a.getPercentRange();n[0][r]={dataZoomId:r,start:o[0],end:o[1]}}}}),n.push(t)}function nq(e){var t=aq(e),n=t[t.length-1];t.length>1&&t.pop();var r={};return $K(n,function(e,n){for(var i=t.length-1;i>=0;i--)if(e=t[i][n],e){r[n]=e;break}}),r}function rq(e){eq(e).snapshots=null}function iq(e){return aq(e).length}function aq(e){var t=eq(e);return t.snapshots||=[{}],t.snapshots}var oq=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(e,t){rq(e),t.dispatchAction({type:`restore`,from:this.uid})},t.getDefaultOption=function(e){return{show:!0,icon:`M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5`,title:e.getLocaleModel().get([`toolbox`,`restore`,`title`])}},t}(TK);kB({type:`restore`,event:`restore`,update:`prepareAndUpdate`},function(e,t){t.resetOption(`recreate`)});var sq=[`grid`,`xAxis`,`yAxis`,`geo`,`graph`,`polar`,`radiusAxis`,`angleAxis`,`bmap`],cq=function(){function e(e,t,n){var r=this;this._targetInfoList=[];var i=uq(t,e);W(dq,function(e,t){(!n||!n.include||_b(n.include,t)>=0)&&e(i,r._targetInfoList)})}return e.prototype.setOutputRanges=function(e,t){return this.matchOutputRanges(e,t,function(e,t,n){if((e.coordRanges||=[]).push(t),!e.coordRange){e.coordRange=t;var r=mq[e.brushType](0,n,t);e.__rangeOffset={offset:gq[e.brushType](r.values,e.range,[1,1]),xyMinMax:r.xyMinMax}}}),e},e.prototype.matchOutputRanges=function(e,t,n){W(e,function(e){var r=this.findTargetInfo(e,t);r&&r!==!0&&W(r.coordSyses,function(r){n(e,mq[e.brushType](1,r,e.range,!0).values,r,t)})},this)},e.prototype.setInputRanges=function(e,t){W(e,function(e){var n=this.findTargetInfo(e,t);if(e.range=e.range||[],n&&n!==!0){e.panelId=n.panelId;var r=mq[e.brushType](0,n.coordSys,e.coordRange),i=e.__rangeOffset;e.range=i?gq[e.brushType](r.values,i.offset,vq(r.xyMinMax,i.xyMinMax)):r.values}},this)},e.prototype.makePanelOpts=function(e,t){return bb(this._targetInfoList,function(n){var r=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:t?t(n):null,clipPath:qme(r),isTargetByCursor:Yme(r,e,n.coordSysModel),getLinearBrushOtherExtent:Jme(r)}})},e.prototype.controlSeries=function(e,t,n){var r=this.findTargetInfo(e,n);return r===!0||r&&_b(r.coordSyses,t.coordinateSystem)>=0},e.prototype.findTargetInfo=function(e,t){for(var n=this._targetInfoList,r=uq(t,e),i=0;ie[1]&&e.reverse(),e}function uq(e,t){return pS(e,t,{includeMainTypes:sq})}var dq={grid:function(e,t){var n=e.xAxisModels,r=e.yAxisModels,i=e.gridModels,a=Jb(),o={},s={};(n||r||i)&&(W(n,function(e){var t=e.axis.grid.model;a.set(t.id,t),o[t.id]=!0}),W(r,function(e){var t=e.axis.grid.model;a.set(t.id,t),s[t.id]=!0}),W(i,function(e){a.set(e.id,e),o[e.id]=!0,s[e.id]=!0}),a.each(function(e){var i=e.coordinateSystem,a=[];W(i.getCartesians(),function(e,t){(_b(n,e.getAxis(`x`).model)>=0||_b(r,e.getAxis(`y`).model)>=0)&&a.push(e)}),t.push({panelId:`grid--`+e.id,gridModel:e,coordSysModel:e,coordSys:a[0],coordSyses:a,getPanelRect:pq.grid,xAxisDeclared:o[e.id],yAxisDeclared:s[e.id]})}))},geo:function(e,t){W(e.geoModels,function(e){var n=e.coordinateSystem;t.push({panelId:`geo--`+e.id,geoModel:e,coordSysModel:e,coordSys:n,coordSyses:[n],getPanelRect:pq.geo})})}},fq=[function(e,t){var n=e.xAxisModel,r=e.yAxisModel,i=e.gridModel;return!i&&n&&(i=n.axis.grid.model),!i&&r&&(i=r.axis.grid.model),i&&i===t.gridModel},function(e,t){var n=e.geoModel;return n&&n===t.geoModel}],pq={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys.view,t=IH(null,e);return MC(t,t,bme(null,e)),t}},mq={lineX:Eb(hq,0),lineY:Eb(hq,1),rect:function(e,t,n,r){var i=e?t.pointToData([n[0][0],n[1][0]],r):t.dataToPoint([n[0][0],n[1][0]],r),a=e?t.pointToData([n[0][1],n[1][1]],r):t.dataToPoint([n[0][1],n[1][1]],r),o=[lq([i[0],a[0]]),lq([i[1],a[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,n,r){var i=[CS(),CS()];return{values:bb(n,function(n){var a=e?t.pointToData(n,r):t.dataToPoint(n,r);return i[0][0]=Math.min(i[0][0],a[0]),i[1][0]=Math.min(i[1][0],a[1]),i[0][1]=Math.max(i[0][1],a[0]),i[1][1]=Math.max(i[1][1],a[1]),a}),xyMinMax:i}}};function hq(e,t,n,r){var i=n.getAxis([`x`,`y`][e]),a=lq(bb([0,1],function(e){return t?i.coordToData(i.toLocalCoord(r[e]),!0):i.toGlobalCoord(i.dataToCoord(r[e]))})),o=[];return o[e]=a,o[1-e]=[NaN,NaN],{values:a,xyMinMax:o}}var gq={lineX:Eb(_q,0),lineY:Eb(_q,1),rect:function(e,t,n){return[[e[0][0]-n[0]*t[0][0],e[0][1]-n[0]*t[0][1]],[e[1][0]-n[1]*t[1][0],e[1][1]-n[1]*t[1][1]]]},polygon:function(e,t,n){return bb(e,function(e,r){return[e[0]-n[0]*t[r][0],e[1]-n[1]*t[r][1]]})}};function _q(e,t,n,r){return[t[0]-r[e]*n[0],t[1]-r[e]*n[1]]}function vq(e,t){var n=yq(e),r=yq(t),i=[n[0]/r[0],n[1]/r[1]];return isNaN(i[0])&&(i[0]=1),isNaN(i[1])&&(i[1]=1),i}function yq(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var bq=W,xq=oS(`toolbox-dataZoom_`),Sq={x:`width`,y:`height`},Cq=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(e,t,n,r){this._brushController||(this._brushController=new _U(n.getZr()),this._brushController.on(`brush`,Tb(this._onBrush,this)).mount()),Dq(e,t,this,r,n),Eq(e,t)},t.prototype.onclick=function(e,t,n){wq[n].call(this)},t.prototype.dispose=function(e,t){this._brushController&&this._brushController.dispose()},t.prototype._onBrush=function(e){var t=e.areas;if(!e.isEnd||!t.length)return;var n={},r=this.ecModel;this._brushController.updateCovers([]),new cq(Tq(this.model),r,{include:[`grid`]}).matchOutputRanges(t,r,function(e,t,n){if(n.type===`cartesian2d`){var r=n.master.getRect().clone(),a=e.brushType;a===`rect`?(i(`x`,n,r,t[0]),i(`y`,n,r,t[1])):i({lineX:`x`,lineY:`y`}[a],n,r,t)}}),tq(r,n),this._dispatchZoomAction(n);function i(e,t,i,o){var s=t.getAxis(e),c=s.model,l=a(e,c,r),u=l.findRepresentativeAxisProxy(c).getMinMaxSpan(),d=s.scale.getExtent();(u.minValueSpan!=null||u.maxValueSpan!=null)&&(o=lU(0,o.slice(),d,0,u.minValueSpan,u.maxValueSpan));var f=_x(d,i[Sq[e]],.5);l&&(n[l.id]={dataZoomId:l.id,startValue:isFinite(f)?mx(o[0],f):o[0],endValue:isFinite(f)?mx(o[1],f):o[1]})}function a(e,t,n){var r;return n.eachComponent({mainType:`dataZoom`,subType:`select`},function(n){n.getAxisModel(e,t.componentIndex)&&(r=n)}),r}},t.prototype._dispatchZoomAction=function(e){var t=[];bq(e,function(e,n){t.push(mb(e))}),t.length&&this.api.dispatchAction({type:`dataZoom`,from:this.uid,batch:t})},t.getDefaultOption=function(e){return{show:!0,filterMode:`filter`,icon:{zoom:`M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1`,back:`M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26`},title:e.getLocaleModel().get([`toolbox`,`dataZoom`,`title`]),brushStyle:{borderWidth:0,color:K.color.backgroundTint}}},t}(TK),wq={zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:`takeGlobalCursor`,key:`dataZoomSelect`,dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(nq(this.ecModel))}};function Tq(e){var t={xAxisIndex:e.get(`xAxisIndex`,!0),yAxisIndex:e.get(`yAxisIndex`,!0),xAxisId:e.get(`xAxisId`,!0),yAxisId:e.get(`yAxisId`,!0)};return t.xAxisIndex==null&&t.xAxisId==null&&(t.xAxisIndex=`all`),t.yAxisIndex==null&&t.yAxisId==null&&(t.yAxisIndex=`all`),t}function Eq(e,t){e.setIconStatus(`back`,iq(t)>1?`emphasis`:`normal`)}function Dq(e,t,n,r,i){var a=n._isZoomActive;r&&r.type===`takeGlobalCursor`&&(a=r.key===`dataZoomSelect`&&r.dataZoomSelectActive),n._isZoomActive=a,e.setIconStatus(`zoom`,a?`emphasis`:`normal`);var o=new cq(Tq(e),t,{include:[`grid`]}).makePanelOpts(i,function(e){return e.xAxisDeclared&&!e.yAxisDeclared?`lineX`:!e.xAxisDeclared&&e.yAxisDeclared?`lineY`:`rect`});n._brushController.setPanels(o).enableBrush(a&&o.length?{brushType:`auto`,brushStyle:e.getModel(`brushStyle`).getItemStyle()}:!1)}Rue(`dataZoom`,function(e){var t=e.getComponent(`toolbox`,0),n=[`feature`,`dataZoom`];if(!t||t.get(n)==null)return;var r=t.getModel(n),i=[],a=pS(e,Tq(r));bq(a.xAxisModels,function(e){return o(e,`xAxis`,`xAxisIndex`)}),bq(a.yAxisModels,function(e){return o(e,`yAxis`,`yAxisIndex`)});function o(e,t,n){var a=e.componentIndex,o={type:`select`,$fromToolbox:!0,filterMode:r.get(`filterMode`,!0)||`filter`,id:xq+t+a};o[n]=a,i.push(o)}return i});function Oq(e){e.registerComponentModel(kK),e.registerComponentView(jK),DK(`saveAsImage`,PK),DK(`magicType`,LK),DK(`dataView`,ZK),DK(`dataZoom`,Cq),DK(`restore`,oq),IB(wK)}var kq=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`tooltip`,t.dependencies=[`axisPointer`],t.defaultOption={z:60,show:!0,showContent:!0,trigger:`item`,triggerOn:`mousemove|click|mousewheel`,alwaysShowContent:!1,renderMode:`auto`,confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:K.color.neutral00,shadowBlur:10,shadowColor:`rgba(0, 0, 0, .2)`,shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:K.color.border,padding:null,extraCssText:``,axisPointer:{type:`line`,axis:`auto`,animation:`auto`,animationDurationUpdate:200,animationEasingUpdate:`exponentialOut`,crossStyle:{color:K.color.borderShade,width:1,type:`dashed`,textStyle:{}}},textStyle:{color:K.color.tertiary,fontSize:14}},t}(Wj);function Aq(e){var t=e.get(`confine`);return t==null?e.get(`renderMode`)===`richText`:!!t}function jq(e){if($b.domSupported){for(var t=document.documentElement.style,n=0,r=e.length;n-1?(s+=`top:50%`,c+=`translateY(-50%) rotate(`+(l=a===`left`?-225:-45)+`deg)`):(s+=`left:50%`,c+=`translateX(-50%) rotate(`+(l=a===`top`?225:45)+`deg)`);var u=l*Math.PI/180,d=o+i,f=d*Math.abs(Math.cos(u))+d*Math.abs(Math.sin(u)),p=Math.round(((f-Math.SQRT2*i)/2+Math.SQRT2*i-(f-d)/2)*100)/100;s+=`;`+a+`:-`+p+`px`;var m=t+` solid `+i+`px;`;return`
`}function Vq(e,t,n){var r=`cubic-bezier(0.23,1,0.32,1)`,i=``,a=``;return n&&(i=` `+e/2+`s `+r,a=`opacity`+i+`,visibility`+i),t||(i=` `+e+`s `+r,a+=(a.length?`,`:``)+($b.transformSupported?``+Lq+i:`,left`+i+`,top`+i)),Iq+`:`+a}function Hq(e,t,n){var r=e.toFixed(0)+`px`,i=t.toFixed(0)+`px`;if(!$b.transformSupported)return n?`top:`+i+`;left:`+r+`;`:[[`top`,i],[`left`,r]];var a=$b.transform3dSupported,o=`translate`+(a?`3d`:``)+`(`+r+`,`+i+(a?`,0`:``)+`)`;return n?`top:0;left:0;`+Lq+`:`+o+`;`:[[`top`,0],[`left`,0],[Mq,o]]}function Uq(e){var t=[],n=e.get(`fontSize`),r=e.getTextColor();r&&t.push(`color:`+r),t.push(`font:`+e.getFont());var i=Rb(e.get(`lineHeight`),Math.round(n*3/2));n&&t.push(`line-height:`+i+`px`);var a=e.get(`textShadowColor`),o=e.get(`textShadowBlur`)||0,s=e.get(`textShadowOffsetX`)||0,c=e.get(`textShadowOffsetY`)||0;return a&&o&&t.push(`text-shadow:`+s+`px `+c+`px `+o+`px `+a),W([`decoration`,`align`],function(n){var r=e.get(n);r&&t.push(`text-`+n+`:`+r)}),t.join(`;`)}function Wq(e,t,n,r){var i=[],a=e.get(`transitionDuration`),o=e.get(`backgroundColor`),s=e.get(`shadowBlur`),c=e.get(`shadowColor`),l=e.get(`shadowOffsetX`),u=e.get(`shadowOffsetY`),d=e.getModel(`textStyle`),f=$M(e,`html`),p=l+`px `+u+`px `+s+`px `+c;return i.push(`box-shadow:`+p),t&&a>0&&i.push(Vq(a,n,r)),o&&i.push(`background-color:`+o),W([`width`,`color`,`radius`],function(t){var n=`border-`+t,r=bj(n),a=e.get(r);a!=null&&i.push(n+`:`+a+(t===`color`?``:`px`))}),i.push(Uq(d)),f!=null&&i.push(`padding:`+xj(f).join(`px `)+`px`),i.join(`;`)+`;`}function Gq(e,t,n,r,i){var a=t&&t.painter;if(n){var o=a&&a.getViewportRoot();o&&ase(e,o,n,r,i)}else{e[0]=r,e[1]=i;var s=a&&a.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var Kq=function(){function e(e,t){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,$b.wxa)return null;var n=document.createElement(`div`);n.domBelongToZr=!0,this.el=n;var r=this._zr=e.getZr(),i=t.appendTo,a=i&&(Ob(i)?document.querySelector(i):Pb(i)?i:Db(i)&&i(e.getDom()));Gq(this._styleCoord,r,a,e.getWidth()/2,e.getHeight()/2),(a||e.getDom()).appendChild(n),this._api=e,this._container=a;var o=this;n.onmouseenter=function(){o._enterable&&(clearTimeout(o._hideTimeout),o._show=!0),o._inContent=!0},n.onmousemove=function(e){if(e||=window.event,!o._enterable){var t=r.handler;QI(r.painter.getViewportRoot(),e,!0),t.dispatch(`mousemove`,e)}},n.onmouseleave=function(){o._inContent=!1,o._enterable&&o._show&&o.hideLater(o._hideDelay)}}return e.prototype.update=function(e){if(!this._container){var t=this._api.getDom(),n=Fq(t,`position`),r=t.style;r.position!==`absolute`&&n!==`absolute`&&(r.position=`relative`)}var i=e.get(`alwaysShowContent`);i&&this._moveIfResized(),this._alwaysShowContent=i,this._enableDisplayTransition=e.get(`displayTransition`)&&e.get(`transitionDuration`)>0,this.el.className=e.get(`className`)||``},e.prototype.show=function(e,t){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,r=n.style,i=this._styleCoord;n.innerHTML?r.cssText=Rq+Wq(e,!this._firstShow,this._longHide,this._enableDisplayTransition)+Hq(i[0],i[1],!0)+(`border-color:`+Ej(t)+`;`)+(e.get(`extraCssText`)||``)+(`;pointer-events:`+(this._enterable?`auto`:`none`)):r.display=`none`,this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(e,t,n,r,i){var a=this.el;if(e==null){a.innerHTML=``;return}var o=``;if(Ob(i)&&n.get(`trigger`)===`item`&&!Aq(n)&&(o=Bq(n,r,i)),Ob(e))a.innerHTML=e+o;else if(e){a.innerHTML=``,G(e)||(e=[e]);for(var s=0;s=0?this._tryShow(n,r):t===`leave`&&this._hide(r))},this))},t.prototype._keepShow=function(){var e=this._tooltipModel,t=this._ecModel,n=this._api,r=e.get(`triggerOn`);if(e.get(`trigger`)!==`axis`&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&r!==`none`&&r!==`click`){var i=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&i.manuallyShowTip(e,t,n,{x:i._lastX,y:i._lastY,dataByCoordSys:i._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(e,t,n,r){if(r.from!==this.uid&&!$b.node&&n.getDom()){var i=eJ(r,n);this._ticket=``;var a=r.dataByCoordSys,o=aJ(r,t,n);if(o){var s=o.el.getBoundingRect().clone();s.applyTransform(o.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:o.el,position:r.position,positionDefault:`bottom`},i)}else if(r.tooltip&&r.x!=null&&r.y!=null){var c=Zq;c.x=r.x,c.y=r.y,c.update(),yD(c).tooltipConfig={name:null,option:r.tooltip},this._tryShow({offsetX:r.x,offsetY:r.y,target:c},i)}else if(a)this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,dataByCoordSys:a,tooltipOption:r.tooltipOption},i);else if(r.seriesIndex!=null){if(this._manuallyAxisShowTip(e,t,n,r))return;var l=CG(r,t),u=l.point[0],d=l.point[1];u!=null&&d!=null&&this._tryShow({offsetX:u,offsetY:d,target:l.el,position:r.position,positionDefault:`bottom`},i)}else r.x!=null&&r.y!=null&&(n.dispatchAction({type:`updateAxisPointer`,x:r.x,y:r.y}),this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,target:n.getZr().findHover(r.x,r.y).target},i))}},t.prototype.manuallyHideTip=function(e,t,n,r){var i=this._tooltipContent;this._tooltipModel&&i.hideLater(this._tooltipModel.get(`hideDelay`)),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,r.from!==this.uid&&this._hide(eJ(r,n))},t.prototype._manuallyAxisShowTip=function(e,t,n,r){var i=r.seriesIndex,a=r.dataIndex,o=t.getComponent(`axisPointer`).coordSysAxesInfo;if(i!=null&&a!=null&&o!=null){var s=t.getSeriesByIndex(i);if(s&&$q([s.getData().getItemModel(a),s,(s.coordinateSystem||{}).model],this._tooltipModel).get(`trigger`)===`axis`)return n.dispatchAction({type:`updateAxisPointer`,seriesIndex:i,dataIndex:a,position:r.position}),!0}},t.prototype._tryShow=function(e,t){var n=e.target;if(this._tooltipModel){this._lastX=e.offsetX,this._lastY=e.offsetY;var r=e.dataByCoordSys;if(r&&r.length)this._showAxisTooltip(r,e);else if(n){if(yD(n).ssrType===`legend`)return;this._lastDataByCoordSys=null,this._cbParamsList=null;var i,a;JR(n,function(e){if(e.tooltipDisabled)return i=a=null,!0;i||a||(yD(e).dataIndex==null?yD(e).tooltipConfig!=null&&(a=e):i=e)},!0),i?this._showSeriesItemTooltip(e,i,t):a?this._showComponentItemTooltip(e,a,t):this._hide(t)}else this._lastDataByCoordSys=null,this._cbParamsList=null,this._hide(t)}},t.prototype._showOrMove=function(e,t){var n=e.get(`showDelay`);t=Tb(t,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(t,n):t()},t.prototype._showAxisTooltip=function(e,t){var n=this._ecModel,r=this._tooltipModel,i=[t.offsetX,t.offsetY],a=$q([t.tooltipOption],r),o=this._renderMode,s=[],c=KM(`section`,{blocks:[],noHeader:!0}),l=[],u=new eN;W(e,function(e){W(e.dataByAxis,function(e){var t=n.getComponent(e.axisDim+`Axis`,e.axisIndex),i=e.value,a=t.axis,d=a.scale.parse(i);if(t&&i!=null){var f=tG(i,a,n,e.seriesDataIndices,e.valueLabelOpt),p=KM(`section`,{header:f,noHeader:!Ub(f),sortBlocks:!0,blocks:[]});c.blocks.push(p),W(e.seriesDataIndices,function(i){var a=n.getSeriesByIndex(i.seriesIndex),c=i.dataIndexInside,m=a.getDataParams(c);if(!(m.dataIndex<0)){m.axisDim=e.axisDim,m.axisIndex=e.axisIndex,m.axisType=e.axisType,m.axisId=e.axisId,m.axisValue=uF(t.axis,{value:d}),m.axisValueLabel=f,m.marker=u.makeTooltipMarker(`item`,Ej(m.color),o);var h=wM(a.formatTooltip(c,!0,null)),g=h.frag;if(g){var _=$q([a],r).get(`valueFormatter`);p.blocks.push(_?U({valueFormatter:_},g):g)}h.text&&l.push(h.text),s.push(m)}})}})}),c.blocks.reverse(),l.reverse();var d=t.position,f=XM(c,u,o,a.get(`order`),n.get(`useUTC`),a.get(`textStyle`));f&&l.unshift(f);var p=o===`richText`?` +`),meta:t.meta}}function WK(e){return e.replace(/^\s\s*/,``).replace(/\s\s*$/,``)}function GK(e){if(e.slice(0,e.indexOf(` +`)).indexOf(zK)>=0)return!0}var KK=RegExp(`[`+zK+`]+`,`g`);function qK(e){for(var t=e.split(/\n+/g),n=WK(t.shift()).split(KK),r=[],i=bb(n,function(e){return{name:e,data:[]}}),a=0;a=0&&!n[i][r];i--);if(i<0){var a=e.queryComponents({mainType:`dataZoom`,subType:`select`,id:r})[0];if(a){var o=a.getPercentRange();n[0][r]={dataZoomId:r,start:o[0],end:o[1]}}}}),n.push(t)}function tq(e){var t=iq(e),n=t[t.length-1];t.length>1&&t.pop();var r={};return QK(n,function(e,n){for(var i=t.length-1;i>=0;i--)if(e=t[i][n],e){r[n]=e;break}}),r}function nq(e){$K(e).snapshots=null}function rq(e){return iq(e).length}function iq(e){var t=$K(e);return t.snapshots||=[{}],t.snapshots}var aq=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(e,t){nq(e),t.dispatchAction({type:`restore`,from:this.uid})},t.getDefaultOption=function(e){return{show:!0,icon:`M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5`,title:e.getLocaleModel().get([`toolbox`,`restore`,`title`])}},t}(wK);kB({type:`restore`,event:`restore`,update:`prepareAndUpdate`},function(e,t){t.resetOption(`recreate`)});var oq=[`grid`,`xAxis`,`yAxis`,`geo`,`graph`,`polar`,`radiusAxis`,`angleAxis`,`bmap`],sq=function(){function e(e,t,n){var r=this;this._targetInfoList=[];var i=lq(t,e);W(uq,function(e,t){(!n||!n.include||_b(n.include,t)>=0)&&e(i,r._targetInfoList)})}return e.prototype.setOutputRanges=function(e,t){return this.matchOutputRanges(e,t,function(e,t,n){if((e.coordRanges||=[]).push(t),!e.coordRange){e.coordRange=t;var r=pq[e.brushType](0,n,t);e.__rangeOffset={offset:hq[e.brushType](r.values,e.range,[1,1]),xyMinMax:r.xyMinMax}}}),e},e.prototype.matchOutputRanges=function(e,t,n){W(e,function(e){var r=this.findTargetInfo(e,t);r&&r!==!0&&W(r.coordSyses,function(r){n(e,pq[e.brushType](1,r,e.range,!0).values,r,t)})},this)},e.prototype.setInputRanges=function(e,t){W(e,function(e){var n=this.findTargetInfo(e,t);if(e.range=e.range||[],n&&n!==!0){e.panelId=n.panelId;var r=pq[e.brushType](0,n.coordSys,e.coordRange),i=e.__rangeOffset;e.range=i?hq[e.brushType](r.values,i.offset,_q(r.xyMinMax,i.xyMinMax)):r.values}},this)},e.prototype.makePanelOpts=function(e,t){return bb(this._targetInfoList,function(n){var r=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:t?t(n):null,clipPath:qme(r),isTargetByCursor:Yme(r,e,n.coordSysModel),getLinearBrushOtherExtent:Jme(r)}})},e.prototype.controlSeries=function(e,t,n){var r=this.findTargetInfo(e,n);return r===!0||r&&_b(r.coordSyses,t.coordinateSystem)>=0},e.prototype.findTargetInfo=function(e,t){for(var n=this._targetInfoList,r=lq(t,e),i=0;ie[1]&&e.reverse(),e}function lq(e,t){return pS(e,t,{includeMainTypes:oq})}var uq={grid:function(e,t){var n=e.xAxisModels,r=e.yAxisModels,i=e.gridModels,a=Jb(),o={},s={};(n||r||i)&&(W(n,function(e){var t=e.axis.grid.model;a.set(t.id,t),o[t.id]=!0}),W(r,function(e){var t=e.axis.grid.model;a.set(t.id,t),s[t.id]=!0}),W(i,function(e){a.set(e.id,e),o[e.id]=!0,s[e.id]=!0}),a.each(function(e){var i=e.coordinateSystem,a=[];W(i.getCartesians(),function(e,t){(_b(n,e.getAxis(`x`).model)>=0||_b(r,e.getAxis(`y`).model)>=0)&&a.push(e)}),t.push({panelId:`grid--`+e.id,gridModel:e,coordSysModel:e,coordSys:a[0],coordSyses:a,getPanelRect:fq.grid,xAxisDeclared:o[e.id],yAxisDeclared:s[e.id]})}))},geo:function(e,t){W(e.geoModels,function(e){var n=e.coordinateSystem;t.push({panelId:`geo--`+e.id,geoModel:e,coordSysModel:e,coordSys:n,coordSyses:[n],getPanelRect:fq.geo})})}},dq=[function(e,t){var n=e.xAxisModel,r=e.yAxisModel,i=e.gridModel;return!i&&n&&(i=n.axis.grid.model),!i&&r&&(i=r.axis.grid.model),i&&i===t.gridModel},function(e,t){var n=e.geoModel;return n&&n===t.geoModel}],fq={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys.view,t=IH(null,e);return MC(t,t,bme(null,e)),t}},pq={lineX:Eb(mq,0),lineY:Eb(mq,1),rect:function(e,t,n,r){var i=e?t.pointToData([n[0][0],n[1][0]],r):t.dataToPoint([n[0][0],n[1][0]],r),a=e?t.pointToData([n[0][1],n[1][1]],r):t.dataToPoint([n[0][1],n[1][1]],r),o=[cq([i[0],a[0]]),cq([i[1],a[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,n,r){var i=[CS(),CS()];return{values:bb(n,function(n){var a=e?t.pointToData(n,r):t.dataToPoint(n,r);return i[0][0]=Math.min(i[0][0],a[0]),i[1][0]=Math.min(i[1][0],a[1]),i[0][1]=Math.max(i[0][1],a[0]),i[1][1]=Math.max(i[1][1],a[1]),a}),xyMinMax:i}}};function mq(e,t,n,r){var i=n.getAxis([`x`,`y`][e]),a=cq(bb([0,1],function(e){return t?i.coordToData(i.toLocalCoord(r[e]),!0):i.toGlobalCoord(i.dataToCoord(r[e]))})),o=[];return o[e]=a,o[1-e]=[NaN,NaN],{values:a,xyMinMax:o}}var hq={lineX:Eb(gq,0),lineY:Eb(gq,1),rect:function(e,t,n){return[[e[0][0]-n[0]*t[0][0],e[0][1]-n[0]*t[0][1]],[e[1][0]-n[1]*t[1][0],e[1][1]-n[1]*t[1][1]]]},polygon:function(e,t,n){return bb(e,function(e,r){return[e[0]-n[0]*t[r][0],e[1]-n[1]*t[r][1]]})}};function gq(e,t,n,r){return[t[0]-r[e]*n[0],t[1]-r[e]*n[1]]}function _q(e,t){var n=vq(e),r=vq(t),i=[n[0]/r[0],n[1]/r[1]];return isNaN(i[0])&&(i[0]=1),isNaN(i[1])&&(i[1]=1),i}function vq(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var yq=W,bq=oS(`toolbox-dataZoom_`),xq={x:`width`,y:`height`},Sq=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(e,t,n,r){this._brushController||(this._brushController=new _U(n.getZr()),this._brushController.on(`brush`,Tb(this._onBrush,this)).mount()),Eq(e,t,this,r,n),Tq(e,t)},t.prototype.onclick=function(e,t,n){Cq[n].call(this)},t.prototype.dispose=function(e,t){this._brushController&&this._brushController.dispose()},t.prototype._onBrush=function(e){var t=e.areas;if(!e.isEnd||!t.length)return;var n={},r=this.ecModel;this._brushController.updateCovers([]),new sq(wq(this.model),r,{include:[`grid`]}).matchOutputRanges(t,r,function(e,t,n){if(n.type===`cartesian2d`){var r=n.master.getRect().clone(),a=e.brushType;a===`rect`?(i(`x`,n,r,t[0]),i(`y`,n,r,t[1])):i({lineX:`x`,lineY:`y`}[a],n,r,t)}}),eq(r,n),this._dispatchZoomAction(n);function i(e,t,i,o){var s=t.getAxis(e),c=s.model,l=a(e,c,r),u=l.findRepresentativeAxisProxy(c).getMinMaxSpan(),d=s.scale.getExtent();(u.minValueSpan!=null||u.maxValueSpan!=null)&&(o=lU(0,o.slice(),d,0,u.minValueSpan,u.maxValueSpan));var f=_x(d,i[xq[e]],.5);l&&(n[l.id]={dataZoomId:l.id,startValue:isFinite(f)?mx(o[0],f):o[0],endValue:isFinite(f)?mx(o[1],f):o[1]})}function a(e,t,n){var r;return n.eachComponent({mainType:`dataZoom`,subType:`select`},function(n){n.getAxisModel(e,t.componentIndex)&&(r=n)}),r}},t.prototype._dispatchZoomAction=function(e){var t=[];yq(e,function(e,n){t.push(mb(e))}),t.length&&this.api.dispatchAction({type:`dataZoom`,from:this.uid,batch:t})},t.getDefaultOption=function(e){return{show:!0,filterMode:`filter`,icon:{zoom:`M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1`,back:`M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26`},title:e.getLocaleModel().get([`toolbox`,`dataZoom`,`title`]),brushStyle:{borderWidth:0,color:K.color.backgroundTint}}},t}(wK),Cq={zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:`takeGlobalCursor`,key:`dataZoomSelect`,dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(tq(this.ecModel))}};function wq(e){var t={xAxisIndex:e.get(`xAxisIndex`,!0),yAxisIndex:e.get(`yAxisIndex`,!0),xAxisId:e.get(`xAxisId`,!0),yAxisId:e.get(`yAxisId`,!0)};return t.xAxisIndex==null&&t.xAxisId==null&&(t.xAxisIndex=`all`),t.yAxisIndex==null&&t.yAxisId==null&&(t.yAxisIndex=`all`),t}function Tq(e,t){e.setIconStatus(`back`,rq(t)>1?`emphasis`:`normal`)}function Eq(e,t,n,r,i){var a=n._isZoomActive;r&&r.type===`takeGlobalCursor`&&(a=r.key===`dataZoomSelect`&&r.dataZoomSelectActive),n._isZoomActive=a,e.setIconStatus(`zoom`,a?`emphasis`:`normal`);var o=new sq(wq(e),t,{include:[`grid`]}).makePanelOpts(i,function(e){return e.xAxisDeclared&&!e.yAxisDeclared?`lineX`:!e.xAxisDeclared&&e.yAxisDeclared?`lineY`:`rect`});n._brushController.setPanels(o).enableBrush(a&&o.length?{brushType:`auto`,brushStyle:e.getModel(`brushStyle`).getItemStyle()}:!1)}Rue(`dataZoom`,function(e){var t=e.getComponent(`toolbox`,0),n=[`feature`,`dataZoom`];if(!t||t.get(n)==null)return;var r=t.getModel(n),i=[],a=pS(e,wq(r));yq(a.xAxisModels,function(e){return o(e,`xAxis`,`xAxisIndex`)}),yq(a.yAxisModels,function(e){return o(e,`yAxis`,`yAxisIndex`)});function o(e,t,n){var a=e.componentIndex,o={type:`select`,$fromToolbox:!0,filterMode:r.get(`filterMode`,!0)||`filter`,id:bq+t+a};o[n]=a,i.push(o)}return i});function Dq(e){e.registerComponentModel(OK),e.registerComponentView(AK),EK(`saveAsImage`,NK),EK(`magicType`,IK),EK(`dataView`,XK),EK(`dataZoom`,Sq),EK(`restore`,aq),IB(CK)}var Oq=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`tooltip`,t.dependencies=[`axisPointer`],t.defaultOption={z:60,show:!0,showContent:!0,trigger:`item`,triggerOn:`mousemove|click|mousewheel`,alwaysShowContent:!1,renderMode:`auto`,confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:K.color.neutral00,shadowBlur:10,shadowColor:`rgba(0, 0, 0, .2)`,shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:K.color.border,padding:null,extraCssText:``,axisPointer:{type:`line`,axis:`auto`,animation:`auto`,animationDurationUpdate:200,animationEasingUpdate:`exponentialOut`,crossStyle:{color:K.color.borderShade,width:1,type:`dashed`,textStyle:{}}},textStyle:{color:K.color.tertiary,fontSize:14}},t}(Wj);function kq(e){var t=e.get(`confine`);return t==null?e.get(`renderMode`)===`richText`:!!t}function Aq(e){if($b.domSupported){for(var t=document.documentElement.style,n=0,r=e.length;n-1?(s+=`top:50%`,c+=`translateY(-50%) rotate(`+(l=a===`left`?-225:-45)+`deg)`):(s+=`left:50%`,c+=`translateX(-50%) rotate(`+(l=a===`top`?225:45)+`deg)`);var u=l*Math.PI/180,d=o+i,f=d*Math.abs(Math.cos(u))+d*Math.abs(Math.sin(u)),p=Math.round(((f-Math.SQRT2*i)/2+Math.SQRT2*i-(f-d)/2)*100)/100;s+=`;`+a+`:-`+p+`px`;var m=t+` solid `+i+`px;`;return`
`}function Bq(e,t,n){var r=`cubic-bezier(0.23,1,0.32,1)`,i=``,a=``;return n&&(i=` `+e/2+`s `+r,a=`opacity`+i+`,visibility`+i),t||(i=` `+e+`s `+r,a+=(a.length?`,`:``)+($b.transformSupported?``+Iq+i:`,left`+i+`,top`+i)),Fq+`:`+a}function Vq(e,t,n){var r=e.toFixed(0)+`px`,i=t.toFixed(0)+`px`;if(!$b.transformSupported)return n?`top:`+i+`;left:`+r+`;`:[[`top`,i],[`left`,r]];var a=$b.transform3dSupported,o=`translate`+(a?`3d`:``)+`(`+r+`,`+i+(a?`,0`:``)+`)`;return n?`top:0;left:0;`+Iq+`:`+o+`;`:[[`top`,0],[`left`,0],[jq,o]]}function Hq(e){var t=[],n=e.get(`fontSize`),r=e.getTextColor();r&&t.push(`color:`+r),t.push(`font:`+e.getFont());var i=Rb(e.get(`lineHeight`),Math.round(n*3/2));n&&t.push(`line-height:`+i+`px`);var a=e.get(`textShadowColor`),o=e.get(`textShadowBlur`)||0,s=e.get(`textShadowOffsetX`)||0,c=e.get(`textShadowOffsetY`)||0;return a&&o&&t.push(`text-shadow:`+s+`px `+c+`px `+o+`px `+a),W([`decoration`,`align`],function(n){var r=e.get(n);r&&t.push(`text-`+n+`:`+r)}),t.join(`;`)}function Uq(e,t,n,r){var i=[],a=e.get(`transitionDuration`),o=e.get(`backgroundColor`),s=e.get(`shadowBlur`),c=e.get(`shadowColor`),l=e.get(`shadowOffsetX`),u=e.get(`shadowOffsetY`),d=e.getModel(`textStyle`),f=$M(e,`html`),p=l+`px `+u+`px `+s+`px `+c;return i.push(`box-shadow:`+p),t&&a>0&&i.push(Bq(a,n,r)),o&&i.push(`background-color:`+o),W([`width`,`color`,`radius`],function(t){var n=`border-`+t,r=bj(n),a=e.get(r);a!=null&&i.push(n+`:`+a+(t===`color`?``:`px`))}),i.push(Hq(d)),f!=null&&i.push(`padding:`+xj(f).join(`px `)+`px`),i.join(`;`)+`;`}function Wq(e,t,n,r,i){var a=t&&t.painter;if(n){var o=a&&a.getViewportRoot();o&&ase(e,o,n,r,i)}else{e[0]=r,e[1]=i;var s=a&&a.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var Gq=function(){function e(e,t){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,$b.wxa)return null;var n=document.createElement(`div`);n.domBelongToZr=!0,this.el=n;var r=this._zr=e.getZr(),i=t.appendTo,a=i&&(Ob(i)?document.querySelector(i):Pb(i)?i:Db(i)&&i(e.getDom()));Wq(this._styleCoord,r,a,e.getWidth()/2,e.getHeight()/2),(a||e.getDom()).appendChild(n),this._api=e,this._container=a;var o=this;n.onmouseenter=function(){o._enterable&&(clearTimeout(o._hideTimeout),o._show=!0),o._inContent=!0},n.onmousemove=function(e){if(e||=window.event,!o._enterable){var t=r.handler;QI(r.painter.getViewportRoot(),e,!0),t.dispatch(`mousemove`,e)}},n.onmouseleave=function(){o._inContent=!1,o._enterable&&o._show&&o.hideLater(o._hideDelay)}}return e.prototype.update=function(e){if(!this._container){var t=this._api.getDom(),n=Pq(t,`position`),r=t.style;r.position!==`absolute`&&n!==`absolute`&&(r.position=`relative`)}var i=e.get(`alwaysShowContent`);i&&this._moveIfResized(),this._alwaysShowContent=i,this._enableDisplayTransition=e.get(`displayTransition`)&&e.get(`transitionDuration`)>0,this.el.className=e.get(`className`)||``},e.prototype.show=function(e,t){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,r=n.style,i=this._styleCoord;n.innerHTML?r.cssText=Lq+Uq(e,!this._firstShow,this._longHide,this._enableDisplayTransition)+Vq(i[0],i[1],!0)+(`border-color:`+Ej(t)+`;`)+(e.get(`extraCssText`)||``)+(`;pointer-events:`+(this._enterable?`auto`:`none`)):r.display=`none`,this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(e,t,n,r,i){var a=this.el;if(e==null){a.innerHTML=``;return}var o=``;if(Ob(i)&&n.get(`trigger`)===`item`&&!kq(n)&&(o=zq(n,r,i)),Ob(e))a.innerHTML=e+o;else if(e){a.innerHTML=``,G(e)||(e=[e]);for(var s=0;s=0?this._tryShow(n,r):t===`leave`&&this._hide(r))},this))},t.prototype._keepShow=function(){var e=this._tooltipModel,t=this._ecModel,n=this._api,r=e.get(`triggerOn`);if(e.get(`trigger`)!==`axis`&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&r!==`none`&&r!==`click`){var i=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&i.manuallyShowTip(e,t,n,{x:i._lastX,y:i._lastY,dataByCoordSys:i._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(e,t,n,r){if(r.from!==this.uid&&!$b.node&&n.getDom()){var i=$q(r,n);this._ticket=``;var a=r.dataByCoordSys,o=iJ(r,t,n);if(o){var s=o.el.getBoundingRect().clone();s.applyTransform(o.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:o.el,position:r.position,positionDefault:`bottom`},i)}else if(r.tooltip&&r.x!=null&&r.y!=null){var c=Xq;c.x=r.x,c.y=r.y,c.update(),yD(c).tooltipConfig={name:null,option:r.tooltip},this._tryShow({offsetX:r.x,offsetY:r.y,target:c},i)}else if(a)this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,dataByCoordSys:a,tooltipOption:r.tooltipOption},i);else if(r.seriesIndex!=null){if(this._manuallyAxisShowTip(e,t,n,r))return;var l=SG(r,t),u=l.point[0],d=l.point[1];u!=null&&d!=null&&this._tryShow({offsetX:u,offsetY:d,target:l.el,position:r.position,positionDefault:`bottom`},i)}else r.x!=null&&r.y!=null&&(n.dispatchAction({type:`updateAxisPointer`,x:r.x,y:r.y}),this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,target:n.getZr().findHover(r.x,r.y).target},i))}},t.prototype.manuallyHideTip=function(e,t,n,r){var i=this._tooltipContent;this._tooltipModel&&i.hideLater(this._tooltipModel.get(`hideDelay`)),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,r.from!==this.uid&&this._hide($q(r,n))},t.prototype._manuallyAxisShowTip=function(e,t,n,r){var i=r.seriesIndex,a=r.dataIndex,o=t.getComponent(`axisPointer`).coordSysAxesInfo;if(i!=null&&a!=null&&o!=null){var s=t.getSeriesByIndex(i);if(s&&Qq([s.getData().getItemModel(a),s,(s.coordinateSystem||{}).model],this._tooltipModel).get(`trigger`)===`axis`)return n.dispatchAction({type:`updateAxisPointer`,seriesIndex:i,dataIndex:a,position:r.position}),!0}},t.prototype._tryShow=function(e,t){var n=e.target;if(this._tooltipModel){this._lastX=e.offsetX,this._lastY=e.offsetY;var r=e.dataByCoordSys;if(r&&r.length)this._showAxisTooltip(r,e);else if(n){if(yD(n).ssrType===`legend`)return;this._lastDataByCoordSys=null,this._cbParamsList=null;var i,a;JR(n,function(e){if(e.tooltipDisabled)return i=a=null,!0;i||a||(yD(e).dataIndex==null?yD(e).tooltipConfig!=null&&(a=e):i=e)},!0),i?this._showSeriesItemTooltip(e,i,t):a?this._showComponentItemTooltip(e,a,t):this._hide(t)}else this._lastDataByCoordSys=null,this._cbParamsList=null,this._hide(t)}},t.prototype._showOrMove=function(e,t){var n=e.get(`showDelay`);t=Tb(t,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(t,n):t()},t.prototype._showAxisTooltip=function(e,t){var n=this._ecModel,r=this._tooltipModel,i=[t.offsetX,t.offsetY],a=Qq([t.tooltipOption],r),o=this._renderMode,s=[],c=KM(`section`,{blocks:[],noHeader:!0}),l=[],u=new eN;W(e,function(e){W(e.dataByAxis,function(e){var t=n.getComponent(e.axisDim+`Axis`,e.axisIndex),i=e.value,a=t.axis,d=a.scale.parse(i);if(t&&i!=null){var f=eG(i,a,n,e.seriesDataIndices,e.valueLabelOpt),p=KM(`section`,{header:f,noHeader:!Ub(f),sortBlocks:!0,blocks:[]});c.blocks.push(p),W(e.seriesDataIndices,function(i){var a=n.getSeriesByIndex(i.seriesIndex),c=i.dataIndexInside,m=a.getDataParams(c);if(!(m.dataIndex<0)){m.axisDim=e.axisDim,m.axisIndex=e.axisIndex,m.axisType=e.axisType,m.axisId=e.axisId,m.axisValue=uF(t.axis,{value:d}),m.axisValueLabel=f,m.marker=u.makeTooltipMarker(`item`,Ej(m.color),o);var h=wM(a.formatTooltip(c,!0,null)),g=h.frag;if(g){var _=Qq([a],r).get(`valueFormatter`);p.blocks.push(_?U({valueFormatter:_},g):g)}h.text&&l.push(h.text),s.push(m)}})}})}),c.blocks.reverse(),l.reverse();var d=t.position,f=XM(c,u,o,a.get(`order`),n.get(`useUTC`),a.get(`textStyle`));f&&l.unshift(f);var p=o===`richText`?` -`:`
`,m=l.join(p);this._showOrMove(a,function(){this._updateContentNotChangedOnAxis(e,s)?this._updatePosition(a,d,i[0],i[1],this._tooltipContent,s):this._showTooltipContent(a,m,s,Math.random()+``,i[0],i[1],d,null,u)})},t.prototype._showSeriesItemTooltip=function(e,t,n){var r=this._ecModel,i=yD(t),a=i.seriesIndex,o=r.getSeriesByIndex(a),s=i.dataModel||o,c=i.dataIndex,l=i.dataType,u=s.getData(l),d=this._renderMode,f=e.positionDefault,p=$q([u.getItemModel(c),s,o&&(o.coordinateSystem||{}).model],this._tooltipModel,f?{position:f}:null),m=p.get(`trigger`);if(m==null||m===`item`){var h=s.getDataParams(c,l),g=new eN;h.marker=g.makeTooltipMarker(`item`,Ej(h.color),d);var _=wM(s.formatTooltip(c,!1,l)),v=p.get(`order`),y=p.get(`valueFormatter`),b=_.frag,x=b?XM(y?U({valueFormatter:y},b):b,g,d,v,r.get(`useUTC`),p.get(`textStyle`)):_.text,S=`item_`+s.name+`_`+c;this._showOrMove(p,function(){this._showTooltipContent(p,x,h,S,e.offsetX,e.offsetY,e.position,e.target,g)}),n({type:`showTip`,dataIndexInside:c,dataIndex:u.getRawIndex(c),seriesIndex:a,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,t,n){var r=this._renderMode===`html`,i=yD(t),a=i.tooltipConfig.option||{},o=a.encodeHTMLContent;if(Ob(a)){var s=a;a={content:s,formatter:s},o=!0}o&&r&&a.content&&(a=mb(a),a.content=PA(a.content));var c=[a],l=this._ecModel.getComponent(i.componentMainType,i.componentIndex);l&&c.push(l),c.push({formatter:a.content});var u=e.positionDefault,d=$q(c,this._tooltipModel,u?{position:u}:null),f=d.get(`content`),p=Math.random()+``,m=new eN;this._showOrMove(d,function(){var n=mb(d.get(`formatterParams`)||{});this._showTooltipContent(d,f,n,p,e.offsetX,e.offsetY,e.position,t,m)}),n({type:`showTip`,from:this.uid})},t.prototype._showTooltipContent=function(e,t,n,r,i,a,o,s,c){if(this._ticket=``,e.get(`showContent`)&&e.get(`show`)){var l=this._tooltipContent;l.setEnterable(e.get(`enterable`));var u=e.get(`formatter`);o||=e.get(`position`);var d=t,f=this._getNearestPoint([i,a],n,e.get(`trigger`),e.get(`borderColor`),e.get(`defaultBorderColor`,!0)).color;if(u){if(Ob(u)){var p=e.ecModel.get(`useUTC`),m=G(n)?n[0]:n,h=m&&m.axisType&&m.axisType.indexOf(`time`)>=0;d=u,h&&(d=rj(m.axisValue,d,p)),d=Tj(d,n,!0)}else if(Db(u)){var g=Tb(function(t,r){t===this._ticket&&(l.setContent(r,c,e,f,o),this._updatePosition(e,o,i,a,l,n,s))},this);this._ticket=r,d=u(n,r,g)}else d=u}l.setContent(d,c,e,f,o),l.show(e,f),this._updatePosition(e,o,i,a,l,n,s)}},t.prototype._getNearestPoint=function(e,t,n,r,i){if(n===`axis`||G(t))return{color:r||i};if(!G(t))return{color:r||t.color||t.borderColor}},t.prototype._updatePosition=function(e,t,n,r,i,a,o){var s=this._api.getWidth(),c=this._api.getHeight();t||=e.get(`position`);var l=i.getSize(),u=e.get(`align`),d=e.get(`verticalAlign`),f=o&&o.getBoundingRect().clone();if(o&&f.applyTransform(o.transform),Db(t)&&(t=t([n,r],a,i.el,f,{viewSize:[s,c],contentSize:l.slice()})),G(t))n=fx(t[0],s),r=fx(t[1],c);else if(jb(t)){var p=t;p.width=l[0],p.height=l[1];var m=Ij(p,{width:s,height:c});n=m.x,r=m.y,u=null,d=null}else if(Ob(t)&&o){var h=rJ(t,f,l,e.get(`borderWidth`));n=h[0],r=h[1]}else{var h=tJ(n,r,i,s,c,u?null:20,d?null:20);n=h[0],r=h[1]}if(u&&(n-=iJ(u)?l[0]/2:u===`right`?l[0]:0),d&&(r-=iJ(d)?l[1]/2:d===`bottom`?l[1]:0),Aq(e)){var h=nJ(n,r,i,s,c);n=h[0],r=h[1]}i.moveTo(n,r)},t.prototype._updateContentNotChangedOnAxis=function(e,t){var n=this._lastDataByCoordSys,r=this._cbParamsList,i=!!n&&n.length===e.length;return i&&W(n,function(n,a){var o=n.dataByAxis||[],s=(e[a]||{}).dataByAxis||[];i&&=o.length===s.length,i&&W(o,function(e,n){var a=s[n]||{},o=e.seriesDataIndices||[],c=a.seriesDataIndices||[];i=i&&e.value===a.value&&e.axisType===a.axisType&&e.axisId===a.axisId&&o.length===c.length,i&&W(o,function(e,t){var n=c[t];i=i&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex}),r&&W(e.seriesDataIndices,function(e){var n=e.seriesIndex,a=t[n],o=r[n];a&&o&&o.data!==a.data&&(i=!1)})})}),this._lastDataByCoordSys=e,this._cbParamsList=t,!!i},t.prototype._hide=function(e){this._lastDataByCoordSys=null,this._cbParamsList=null,e({type:`hideTip`,from:this.uid})},t.prototype.dispose=function(e,t){!$b.node&&t.getDom()&&(wR(this,`_updatePosition`),this._tooltipContent.dispose(),xG(`itemTooltip`,t),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type=`tooltip`,t}(pR);function $q(e,t,n){var r=t.ecModel,i;n?(i=new TA(n,r,r),i=new TA(t.option,i,r)):i=t;for(var a=e.length-1;a>=0;a--){var o=e[a];o&&(o instanceof TA&&(o=o.get(`tooltip`,!0)),Ob(o)&&(o={formatter:o}),o&&(i=new TA(o,i,r)))}return i}function eJ(e,t){return e.dispatchAction||Tb(t.dispatchAction,t)}function tJ(e,t,n,r,i,a,o){var s=n.getSize(),c=s[0],l=s[1];return a!=null&&(e+c+a+2>r?e-=c+a:e+=a),o!=null&&(t+l+o>i?t-=l+o:t+=o),[e,t]}function nJ(e,t,n,r,i){var a=n.getSize(),o=a[0],s=a[1];return e=Math.min(e+o,r)-o,t=Math.min(t+s,i)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function rJ(e,t,n,r){var i=n[0],a=n[1],o=Math.ceil(Math.SQRT2*r)+8,s=0,c=0,l=t.width,u=t.height;switch(e){case`inside`:s=t.x+l/2-i/2,c=t.y+u/2-a/2;break;case`top`:s=t.x+l/2-i/2,c=t.y-a-o;break;case`bottom`:s=t.x+l/2-i/2,c=t.y+u+o;break;case`left`:s=t.x-i-o,c=t.y+u/2-a/2;break;case`right`:s=t.x+l+o,c=t.y+u/2-a/2}return[s,c]}function iJ(e){return e===`center`||e===`middle`}function aJ(e,t,n){var r=mS(e).queryOptionMap,i=r.keys()[0];if(i&&i!==`series`){var a=_S(t,i,r.get(i),{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];if(a){var o=n.getViewOfComponentModel(a),s;if(o.group.traverse(function(t){var n=yD(t).tooltipConfig;if(n&&n.name===e.name)return s=t,!0}),s)return{componentMainType:i,componentIndex:a.componentIndex,el:s}}}}function oJ(e){IB(IG),e.registerComponentModel(kq),e.registerComponentView(Qq),e.registerAction({type:`showTip`,event:`showTip`,update:`tooltip:manuallyShowTip`},Qb),e.registerAction({type:`hideTip`,event:`hideTip`,update:`tooltip:manuallyHideTip`},Qb)}var sJ=[`rect`,`polygon`,`keep`,`clear`];function cJ(e,t){var n=Ux(e?e.brush:[]);if(n.length){var r=[];W(n,function(e){var t=e.hasOwnProperty(`toolbox`)?e.toolbox:[];t instanceof Array&&(r=r.concat(t))});var i=e&&e.toolbox;G(i)&&(i=i[0]),i||(i={feature:{}},e.toolbox=[i]);var a=i.feature||(i.feature={}),o=a.brush||={},s=o.type||=[];s.push.apply(s,r),jS(s,function(e){return e+``},null),t&&!s.length&&s.push.apply(s,sJ)}}var lJ=W;function uJ(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function dJ(e,t,n){var r={};return lJ(t,function(t){var a=r[t]=i();lJ(e[t],function(e,r){if(BH.isValidType(r)){var i={type:r,visual:e};n&&n(i,t),a[r]=new BH(i),r===`opacity`&&(i=mb(i),i.type=`colorAlpha`,a.__hidden.__alphaForOpacity=new BH(i))}})}),r;function i(){var e=function(){};return e.prototype.__hidden=e.prototype,new e}}function fJ(e,t,n){var r;W(n,function(e){t.hasOwnProperty(e)&&uJ(t[e])&&(r=!0)}),r&&W(n,function(n){t.hasOwnProperty(n)&&uJ(t[n])?e[n]=mb(t[n]):delete e[n]})}function pJ(e,t,n,r,i,a){var o={};W(e,function(e){o[e]=BH.prepareVisualTypes(t[e])});var s;function c(e){return WR(n,s,e)}function l(e,t){KR(n,s,e,t)}a==null?n.each(u):n.each([a],u);function u(e,u){s=a==null?e:u;var d=n.getRawDataItem(s);if(!(d&&d.visualMap===!1))for(var f=r.call(i,e),p=t[f],m=o[f],h=0,g=m.length;ht[0][1]&&(t[0][1]=a[0]),a[1]t[1][1]&&(t[1][1]=a[1])}return t&&AJ(t)}};function AJ(e){return new OC(e[0][0],e[1][0],e[0][1]-e[0][0],e[1][1]-e[1][0])}var jhe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(e,t){this.ecModel=e,this.api=t,this.model,(this._brushController=new _U(t.getZr())).on(`brush`,Tb(this._onBrush,this)).mount()},t.prototype.render=function(e,t,n,r){this.model=e,this._updateController(e,t,n,r)},t.prototype.updateTransform=function(e,t,n,r){SJ(t),this._updateController(e,t,n,r)},t.prototype.updateVisual=function(e,t,n,r){this.updateTransform(e,t,n,r)},t.prototype.updateView=function(e,t,n,r){this._updateController(e,t,n,r)},t.prototype._updateController=function(e,t,n,r){(!r||r.$from!==e.id)&&this._brushController.setPanels(e.brushTargetManager.makePanelOpts(n)).enableBrush(e.brushOption).updateCovers(e.areas.slice())},t.prototype.dispose=function(){this._brushController.dispose()},t.prototype._onBrush=function(e){var t=this.model.id,n=this.model.brushTargetManager.setOutputRanges(e.areas,this.ecModel);(!e.isEnd||e.removeOnClick)&&this.api.dispatchAction({type:`brush`,brushId:t,areas:mb(n),$from:t}),e.isEnd&&this.api.dispatchAction({type:`brushEnd`,brushId:t,areas:mb(n),$from:t})},t.type=`brush`,t}(pR),Mhe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.areas=[],n.brushOption={},n}return t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&fJ(n,e,[`inBrush`,`outOfBrush`]);var r=n.inBrush=n.inBrush||{};n.outOfBrush=n.outOfBrush||{color:this.option.defaultOutOfBrushColor},r.hasOwnProperty(`liftZ`)||(r.liftZ=5)},t.prototype.setAreas=function(e){e&&(this.areas=bb(e,function(e){return jJ(this.option,e)},this))},t.prototype.setBrushOption=function(e){this.brushOption=jJ(this.option,e),this.brushType=this.brushOption.brushType},t.type=`brush`,t.dependencies=[`geo`,`grid`,`xAxis`,`yAxis`,`parallel`,`series`],t.defaultOption={seriesIndex:`all`,brushType:`rect`,brushMode:`single`,transformable:!0,brushStyle:{borderWidth:1,color:K.color.backgroundTint,borderColor:K.color.borderTint},throttleType:`fixRate`,throttleDelay:0,removeOnClick:!0,z:1e4,defaultOutOfBrushColor:K.color.disabled},t}(Wj);function jJ(e,t){return hb({brushType:e.brushType,brushMode:e.brushMode,transformable:e.transformable,brushStyle:new TA(e.brushStyle).getItemStyle(),removeOnClick:e.removeOnClick,z:e.z},t,!0)}var Nhe=[`rect`,`polygon`,`lineX`,`lineY`,`keep`,`clear`],Phe=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(e,t,n){var r,i,a;t.eachComponent({mainType:`brush`},function(e){r=e.brushType,i=e.brushOption.brushMode||`single`,a||=!!e.areas.length}),this._brushType=r,this._brushMode=i,W(e.get(`type`,!0),function(t){e.setIconStatus(t,(t===`keep`?i===`multiple`:t===`clear`?a:t===r)?`emphasis`:`normal`)})},t.prototype.updateView=function(e,t,n){this.render(e,t,n)},t.prototype.getIcons=function(){var e=this.model,t=e.get(`icon`,!0),n={};return W(e.get(`type`,!0),function(e){t[e]&&(n[e]=t[e])}),n},t.prototype.onclick=function(e,t,n){var r=this._brushType,i=this._brushMode;n===`clear`?(t.dispatchAction({type:`axisAreaSelect`,intervals:[]}),t.dispatchAction({type:`brush`,command:`clear`,areas:[]})):t.dispatchAction({type:`takeGlobalCursor`,key:`brush`,brushOption:{brushType:n===`keep`?r:r!==n&&n,brushMode:n===`keep`?i===`multiple`?`single`:`multiple`:i}})},t.getDefaultOption=function(e){return{show:!0,type:Nhe.slice(),icon:{rect:`M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13`,polygon:`M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2`,lineX:`M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4`,lineY:`M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4`,keep:`M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z`,clear:`M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2`},title:e.getLocaleModel().get([`toolbox`,`brush`,`title`])}},t}(TK);function Fhe(e){e.registerComponentView(jhe),e.registerComponentModel(Mhe),e.registerPreprocessor(cJ),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,CJ),e.registerAction({type:`brush`,event:`brush`,update:`updateVisual`},function(e,t){t.eachComponent({mainType:`brush`,query:e},function(t){t.setAreas(e.areas)})}),e.registerAction({type:`brushSelect`,event:`brushSelected`,update:`none`},Qb),e.registerAction({type:`brushEnd`,event:`brushEnd`,update:`none`},Qb),DK(`brush`,Phe)}function MJ(e,t){if(!e)return!1;for(var n=G(e)?e:[e],r=0;r=0&&(s[o]=+s[o].toFixed(f)),[s,d]}var RJ={min:Eb(LJ,`min`),max:Eb(LJ,`max`),average:Eb(LJ,`average`),median:Eb(LJ,`median`)};function zJ(e,t){if(t){var n=e.getData(),r=e.coordinateSystem,i=r&&r.dimensions;if(!Ihe(t)&&!G(t.coord)&&G(i)){var a=BJ(t,n,r,e);if(t=mb(t),t.type&&RJ[t.type]&&a.baseAxis&&a.valueAxis){var o=_b(i,a.baseAxis.dim),s=_b(i,a.valueAxis.dim),c=RJ[t.type](n,a.valueAxis.dim,a.baseDataDim,a.valueDataDim,o,s);t.coord=c[0],t.value=c[1]}else t.coord=[t.xAxis==null?t.radiusAxis:t.xAxis,t.yAxis==null?t.angleAxis:t.yAxis]}if(t.coord==null||!G(i)){t.coord=[];var l=e.getBaseAxis();if(l&&t.type&&RJ[t.type]){var u=r.getOtherAxis(l);u&&(t.value=HJ(n,n.mapDimension(u.dim),t.type))}}else for(var d=t.coord,f=0;f<2;f++)RJ[d[f]]&&(d[f]=HJ(n,n.mapDimension(i[f]),d[f]));return t}}function BJ(e,t,n,r){var i={};return e.valueIndex!=null||e.valueDim!=null?(i.valueDataDim=e.valueIndex==null?e.valueDim:t.getDimension(e.valueIndex),i.valueAxis=n.getAxis(Lhe(r,i.valueDataDim)),i.baseAxis=n.getOtherAxis(i.valueAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim)):(i.baseAxis=r.getBaseAxis(),i.valueAxis=n.getOtherAxis(i.baseAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim),i.valueDataDim=t.mapDimension(i.valueAxis.dim)),i}function Lhe(e,t){var n=e.getData().getDimensionInfo(t);return n&&n.coordDim}function VJ(e,t){return e&&e.containData&&t.coord&&!IJ(t)?e.containData(t.coord):!0}function Rhe(e,t,n){return e&&e.containZone&&t.coord&&n.coord&&!IJ(t)&&!IJ(n)?e.containZone(t.coord,n.coord):!0}function zhe(e,t){return e?function(e,n,r,i){return DM(i<2?e.coord&&e.coord[i]:e.value,t[i])}:function(e,n,r,i){return DM(e.value,t[i])}}function HJ(e,t,n){if(n===`average`){var r=0,i=0;return e.each(t,function(e,t){isNaN(e)||(r+=e,i++)}),r/i}return n===`median`?e.getMedian(t):e.getDataExtent(t)[+(n===`max`)]}var UJ=dS(),WJ=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(){this.markerGroupMap=Jb()},t.prototype.render=function(e,t,n){var r=this,i=this.markerGroupMap;i.each(function(e){UJ(e).keep=!1}),t.eachSeries(function(e){var i=FJ.getMarkerModelFromSeries(e,r.type);i&&r.renderSeries(e,i,t,n)}),i.each(function(e){!UJ(e).keep&&r.group.remove(e.group)}),Bhe(t,i,this.type)},t.prototype.markKeep=function(e){UJ(e).keep=!0},t.prototype.toggleBlurSeries=function(e,t){var n=this;W(e,function(e){var r=FJ.getMarkerModelFromSeries(e,n.type);r&&r.getData().eachItemGraphicEl(function(e){e&&(t?oO(e):sO(e))})})},t.type=`marker`,t}(pR);function Bhe(e,t,n){e.eachSeries(function(e){var r=FJ.getMarkerModelFromSeries(e,n),i=t.get(e.id);if(r&&i&&i.group){var a=rA(r),o=a.z,s=a.zlevel;iA(i.group,o,s)}})}var Vhe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.createMarkerModelFromSeries=function(e,n,r){return new t(e,n,r)},t.type=`markLine`,t.defaultOption={z:5,symbol:[`circle`,`arrow`],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:`item`},label:{show:!0,position:`end`,distance:5},lineStyle:{type:`dashed`},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:`linear`},t}(FJ),GJ=dS(),Hhe=function(e,t,n,r){var i=e.getData(),a;if(G(r))a=r;else{var o=r.type;if(o===`min`||o===`max`||o===`average`||o===`median`||r.xAxis!=null||r.yAxis!=null){var s=void 0,c=void 0;if(r.yAxis!=null||r.xAxis!=null)s=t.getAxis(r.yAxis==null?`x`:`y`),c=Lb(r.yAxis,r.xAxis);else{var l=BJ(r,i,t,e);s=l.valueAxis,c=HJ(i,nF(i,l.valueDataDim),o)}var u=s.dim===`x`?0:1,d=1-u,f=mb(r),p={coord:[]};f.type=null,f.coord=[],f.coord[d]=-1/0,p.coord[d]=1/0;var m=n.get(`precision`);m>=0&&Ab(c)&&(c=+c.toFixed(Math.min(m,20))),f.coord[u]=p.coord[u]=c,a=[f,p,{type:o,valueIndex:r.valueIndex,value:c}]}else a=[]}var h=[zJ(e,a[0]),zJ(e,a[1]),U({},a[2])];return h[2].type=h[2].type||null,hb(h[2],h[0]),hb(h[2],h[1]),h};function KJ(e){return!isNaN(e)&&!isFinite(e)}function qJ(e,t,n,r){var i=1-e,a=r.dimensions[e];return KJ(t[i])&&KJ(n[i])&&t[e]===n[e]&&r.getAxis(a).containData(t[e])}function Uhe(e,t){if(e.type===`cartesian2d`){var n=t[0].coord,r=t[1].coord;if(n&&r&&(qJ(1,n,r,e)||qJ(0,n,r,e)))return!0}return VJ(e,t[0])&&VJ(e,t[1])}function JJ(e,t,n,r,i){var a=r.coordinateSystem,o=e.getItemModel(t),s,c=fx(o.get(`x`),i.getWidth()),l=fx(o.get(`y`),i.getHeight());if(!isNaN(c)&&!isNaN(l))s=[c,l];else{if(r.getMarkerPosition)s=r.getMarkerPosition(e.getValues(e.dimensions,t));else{var u=a.dimensions,d=e.get(u[0],t),f=e.get(u[1],t);s=a.dataToPoint([d,f])}if(LV(a,`cartesian2d`)){var p=a.getAxis(`x`),m=a.getAxis(`y`),u=a.dimensions;KJ(e.get(u[0],t))?s[0]=p.toGlobalCoord(p.getExtent()[+!n]):KJ(e.get(u[1],t))&&(s[1]=m.toGlobalCoord(m.getExtent()[+!n]))}isNaN(c)||(s[0]=c),isNaN(l)||(s[1]=l)}e.setItemLayout(t,s)}var Whe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=FJ.getMarkerModelFromSeries(e,`markLine`);if(t){var r=t.getData(),i=GJ(t).from,a=GJ(t).to;i.each(function(t){JJ(i,t,!0,e,n),JJ(a,t,!1,e,n)}),r.each(function(e){r.setItemLayout(e,[i.getItemLayout(e),a.getItemLayout(e)])}),this.markerGroupMap.get(e.id).updateLayout()}},this)},t.prototype.renderSeries=function(e,t,n,r){var i=e.coordinateSystem,a=e.id,o=e.getData(),s=this.markerGroupMap,c=s.get(a)||s.set(a,new Ame);this.group.add(c.group);var l=Ghe(i,e,t),u=l.from,d=l.to,f=l.line;GJ(t).from=u,GJ(t).to=d,t.setData(f);var p=t.get(`symbol`),m=t.get(`symbolSize`),h=t.get(`symbolRotate`),g=t.get(`symbolOffset`);G(p)||(p=[p,p]),G(m)||(m=[m,m]),G(h)||(h=[h,h]),G(g)||(g=[g,g]),l.from.each(function(e){_(u,e,!0),_(d,e,!1)}),f.each(function(e){var t=f.getItemModel(e),n=t.getModel(`lineStyle`).getLineStyle();f.setItemLayout(e,[u.getItemLayout(e),d.getItemLayout(e)]);var r=t.get(`z2`);n.stroke??=u.getItemVisual(e,`style`).fill,f.setItemVisual(e,{z2:Rb(r,0),fromSymbolKeepAspect:u.getItemVisual(e,`symbolKeepAspect`),fromSymbolOffset:u.getItemVisual(e,`symbolOffset`),fromSymbolRotate:u.getItemVisual(e,`symbolRotate`),fromSymbolSize:u.getItemVisual(e,`symbolSize`),fromSymbol:u.getItemVisual(e,`symbol`),toSymbolKeepAspect:d.getItemVisual(e,`symbolKeepAspect`),toSymbolOffset:d.getItemVisual(e,`symbolOffset`),toSymbolRotate:d.getItemVisual(e,`symbolRotate`),toSymbolSize:d.getItemVisual(e,`symbolSize`),toSymbol:d.getItemVisual(e,`symbol`),style:n})}),c.updateData(f),l.line.eachItemGraphicEl(function(e){yD(e).dataModel=t,e.traverse(function(e){yD(e).dataModel=t})});function _(t,n,i){var a=t.getItemModel(n);JJ(t,n,i,e,r);var s=a.getModel(`itemStyle`).getItemStyle();s.fill??=GR(o,`color`),t.setItemVisual(n,{symbolKeepAspect:a.get(`symbolKeepAspect`),symbolOffset:Rb(a.get(`symbolOffset`,!0),g[+!i]),symbolRotate:Rb(a.get(`symbolRotate`,!0),h[+!i]),symbolSize:Rb(a.get(`symbolSize`),m[+!i]),symbol:Rb(a.get(`symbol`,!0),p[+!i]),style:s})}this.markKeep(c),c.group.silent=t.get(`silent`)||e.get(`silent`)},t.type=`markLine`,t}(WJ);function Ghe(e,t,n){var r=e?bb(e&&e.dimensions,function(e){var n=t.getData();return U(U({},n.getDimensionInfo(n.mapDimension(e))||{}),{name:e,ordinalMeta:null})}):[{name:`value`,type:`float`}],i=new YB(r,n),a=new YB(r,n),o=new YB([],n),s=bb(n.get(`data`),Eb(Hhe,t,e,n));e&&(s=Sb(s,Eb(Uhe,e)));var c=zhe(!!e,r);return i.initData(bb(s,function(e){return e[0]}),null,c),a.initData(bb(s,function(e){return e[1]}),null,c),o.initData(bb(s,function(e){return e[2]})),o.hasItemOption=!0,{from:i,to:a,line:o}}function Khe(e){e.registerComponentModel(Vhe),e.registerComponentView(Whe),e.registerPreprocessor(function(e){MJ(e.series,`markLine`)&&(e.markLine=e.markLine||{})})}var qhe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.createMarkerModelFromSeries=function(e,n,r){return new t(e,n,r)},t.type=`markArea`,t.defaultOption={z:1,tooltip:{trigger:`item`},animation:!1,label:{show:!0,position:`top`},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:`top`}}},t}(FJ),YJ=dS(),Jhe=function(e,t,n,r){var i=r[0],a=r[1];if(i&&a){var o=zJ(e,i),s=zJ(e,a),c=o.coord,l=s.coord;c[0]=Lb(c[0],-1/0),c[1]=Lb(c[1],-1/0),l[0]=Lb(l[0],1/0),l[1]=Lb(l[1],1/0);var u=Qre([{},o,s]);return u.coord=[o.coord,s.coord],u.x0=o.x,u.y0=o.y,u.x1=s.x,u.y1=s.y,u}};function XJ(e){return!isNaN(e)&&!isFinite(e)}function ZJ(e,t,n,r){var i=1-e;return XJ(t[i])&&XJ(n[i])}function Yhe(e,t){var n=t.coord[0],r=t.coord[1],i={coord:n,x:t.x0,y:t.y0},a={coord:r,x:t.x1,y:t.y1};return LV(e,`cartesian2d`)?n&&r&&(ZJ(1,n,r,e)||ZJ(0,n,r,e))?!0:Rhe(e,i,a):VJ(e,i)||VJ(e,a)}function QJ(e,t,n,r,i){var a=r.coordinateSystem,o=e.getItemModel(t),s,c=fx(o.get(n[0]),i.getWidth()),l=fx(o.get(n[1]),i.getHeight());if(!isNaN(c)&&!isNaN(l))s=[c,l];else{if(r.getMarkerPosition){var u=e.getValues([`x0`,`y0`],t),d=e.getValues([`x1`,`y1`],t),f=a.clampData(u),p=a.clampData(d),m=[];m[0]=n[0]===`x0`?f[0]>p[0]?d[0]:u[0]:f[0]>p[0]?u[0]:d[0],m[1]=n[1]===`y0`?f[1]>p[1]?d[1]:u[1]:f[1]>p[1]?u[1]:d[1],s=r.getMarkerPosition(m,n,!0)}else{var h=e.get(n[0],t),g=e.get(n[1],t),_=[h,g];a.clampData&&a.clampData(_,_),s=a.dataToPoint(_,!0)}if(LV(a,`cartesian2d`)){var v=a.getAxis(`x`),y=a.getAxis(`y`),h=e.get(n[0],t),g=e.get(n[1],t);XJ(h)?s[0]=v.toGlobalCoord(v.getExtent()[n[0]===`x0`?0:1]):XJ(g)&&(s[1]=y.toGlobalCoord(y.getExtent()[n[1]===`y0`?0:1]))}isNaN(c)||(s[0]=c),isNaN(l)||(s[1]=l)}return s}var $J=[[`x0`,`y0`],[`x1`,`y0`],[`x1`,`y1`],[`x0`,`y1`]],Xhe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=FJ.getMarkerModelFromSeries(e,`markArea`);if(t){var r=t.getData();r.each(function(t){var i=bb($J,function(i){return QJ(r,t,i,e,n)});r.setItemLayout(t,i),r.getItemGraphicEl(t).setShape(`points`,i)})}},this)},t.prototype.renderSeries=function(e,t,n,r){var i=e.coordinateSystem,a=e.id,o=e.getData(),s=this.markerGroupMap,c=s.get(a)||s.set(a,{group:new LO});this.group.add(c.group),this.markKeep(c);var l=Zhe(i,e,t);t.setData(l),l.each(function(t){var n=bb($J,function(n){return QJ(l,t,n,e,r)}),a=i.getAxis(`x`).scale,s=i.getAxis(`y`).scale,c=a.getExtent(),u=s.getExtent(),d=[a.parse(l.get(`x0`,t)),a.parse(l.get(`x1`,t))],f=[s.parse(l.get(`y0`,t)),s.parse(l.get(`y1`,t))];hx(d),hx(f);var p=c[0]>d[1]||c[1]f[1]||u[1]=0},t.prototype.getOrient=function(){return this.get(`orient`)===`vertical`?{index:1,name:`vertical`}:{index:0,name:`horizontal`}},t.type=`legend.plain`,t.dependencies=[`series`],t.defaultOption={z:4,show:!0,orient:`horizontal`,left:`center`,bottom:K.size.m,align:`auto`,backgroundColor:K.color.transparent,borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:`inherit`,symbolKeepAspect:!0,inactiveColor:K.color.disabled,inactiveBorderColor:K.color.disabled,inactiveBorderWidth:`auto`,itemStyle:{color:`inherit`,opacity:`inherit`,borderColor:`inherit`,borderWidth:`auto`,borderCap:`inherit`,borderJoin:`inherit`,borderDashOffset:`inherit`,borderMiterLimit:`inherit`},lineStyle:{width:`auto`,color:`inherit`,inactiveColor:K.color.disabled,inactiveWidth:2,opacity:`inherit`,type:`inherit`,cap:`inherit`,join:`inherit`,dashOffset:`inherit`,miterLimit:`inherit`},textStyle:{color:K.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:`sans-serif`,color:K.color.tertiary,borderWidth:1,borderColor:K.color.border},emphasis:{selectorLabel:{show:!0,color:K.color.quaternary}},selectorPosition:`auto`,selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(Wj),tY=Eb,nY=W,rY=LO,iY=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return t.prototype.init=function(){this.group.add(this._contentGroup=new rY),this.group.add(this._selectorGroup=new rY),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,t,n){var r=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),e.get(`show`,!0)){var i=e.get(`align`),a=e.get(`orient`);(!i||i===`auto`)&&(i=e.get(`left`)===`right`&&a===`vertical`?`right`:`left`);var o=e.get(`selector`,!0),s=e.get(`selectorPosition`,!0);o&&(!s||s===`auto`)&&(s=a===`horizontal`?`end`:`start`),this.renderInner(i,e,t,n,o,a,s);var c=Rj(e,n).refContainer,l=e.getBoxLayoutParams(),u=e.get(`padding`),d=Ij(l,c,u),f=this.layoutInner(e,i,d,r,o,s),p=Ij(gb({width:f.width,height:f.height},l),c,u);this.group.x=p.x-f.x,this.group.y=p.y-f.y,this.group.markRedraw(),this.group.add(this._backgroundEl=AK(f,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,t,n,r,i,a,o){var s=this.getContentGroup(),c=Jb(),l=t.get(`selectedMode`),u=t.get(`triggerEvent`),d=[];n.eachRawSeries(function(e){!e.get(`legendHoverLink`)&&d.push(e.id)}),nY(t.getData(),function(i,a){var o=this,f=i.get(`name`);if(!this.newlineDisabled&&(f===``||f===` -`)){var p=new rY;p.newline=!0,s.add(p);return}var m=n.getSeriesByName(f)[0];if(!c.get(f)){if(m){var h=m.getData(),g=h.getVisual(`legendLineStyle`)||{},_=h.getVisual(`legendIcon`),v=h.getVisual(`style`),y=this._createItem(m,f,a,i,t,e,g,v,_,l,r);y.on(`click`,tY(aY,f,null,r,d)).on(`mouseover`,tY(oY,m.name,null,r,d)).on(`mouseout`,tY(sY,m.name,null,r,d)),n.ssr&&y.eachChild(function(e){var t=yD(e);t.seriesIndex=m.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&y.eachChild(function(e){o.packEventData(e,t,m,a,f)}),c.set(f,!0)}else n.eachRawSeries(function(o){var s=this;if(!c.get(f)&&o.legendVisualProvider){var p=o.legendVisualProvider;if(!p.containName(f))return;var m=p.indexOfName(f),h=p.getItemVisual(m,`style`),g=p.getItemVisual(m,`legendIcon`),_=tT(h.fill);_&&_[3]===0&&(_[3]=.2,h=U(U({},h),{fill:sT(_,`rgba`)}));var v=this._createItem(o,f,a,i,t,e,{},h,g,l,r);v.on(`click`,tY(aY,null,f,r,d)).on(`mouseover`,tY(oY,null,f,r,d)).on(`mouseout`,tY(sY,null,f,r,d)),n.ssr&&v.eachChild(function(e){var t=yD(e);t.seriesIndex=o.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&v.eachChild(function(e){s.packEventData(e,t,o,a,f)}),c.set(f,!0)}},this)}},this),i&&this._createSelector(i,t,r,a,o)},t.prototype.packEventData=function(e,t,n,r,i){var a={componentType:`legend`,componentIndex:t.componentIndex,dataIndex:r,value:i,seriesIndex:n.seriesIndex};yD(e).eventData=a},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();nY(e,function(e){var r=e.type,i=new aD({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),uA(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),gO(i)})},t.prototype._createItem=function(e,t,n,r,i,a,o,s,c,l,u){var d=e.visualDrawType,f=i.get(`itemWidth`),p=i.get(`itemHeight`),m=i.isSelected(t),h=r.get(`symbolRotate`),g=r.get(`symbolKeepAspect`),_=r.get(`icon`);c=_||c||`roundRect`;var v=ege(c,r,o,s,d,m,u),y=new rY,b=r.getModel(`textStyle`);if(Db(e.getLegendIcon)&&(!_||_===`inherit`))y.add(e.getLegendIcon({itemWidth:f,itemHeight:p,icon:c,iconRotate:h,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}));else{var x=_===`inherit`&&e.getData().getVisual(`symbol`)?h===`inherit`?e.getData().getVisual(`symbolRotate`):h:0;y.add(tge({itemWidth:f,itemHeight:p,icon:c,iconRotate:x,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}))}var S=a===`left`?f+5:-5,C=a,w=i.get(`formatter`),T=t;Ob(w)&&w?T=w.replace(`{name}`,t??``):Db(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new aD({style:fA(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new eD({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&Xk({el:D,componentModel:i,itemName:t,itemTooltipOption:O.option}),y.add(D),y.eachChild(function(e){e.silent=!0}),D.silent=!l,this.getContentGroup().add(y),gO(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();Fj(e.get(`orient`),o,e.get(`itemGap`),n.width,n.height);var c=o.getBoundingRect(),l=[-c.x,-c.y];if(s.markRedraw(),o.markRedraw(),i){Fj(`horizontal`,s,e.get(`selectorItemGap`,!0));var u=s.getBoundingRect(),d=[-u.x,-u.y],f=e.get(`selectorButtonGap`,!0),p=e.getOrient().index,m=p===0?`width`:`height`,h=p===0?`height`:`width`,g=p===0?`y`:`x`;a===`end`?d[p]+=c[m]+f:l[p]+=u[m]+f,d[1-p]+=c[h]/2-u[h]/2,s.x=d[0],s.y=d[1],o.x=l[0],o.y=l[1];var _={x:0,y:0};return _[m]=c[m]+f+u[m],_[h]=Math.max(c[h],u[h]),_[g]=Math.min(0,u[g]+d[1-p]),_}return o.x=l[0],o.y=l[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type=`legend.plain`,t}(pR);function ege(e,t,n,r,i,a,o){function s(e,t){e.lineWidth===`auto`&&(e.lineWidth=t.lineWidth>0?2:0),nY(e,function(n,r){e[r]===`inherit`&&(e[r]=t[r])})}var c=t.getModel(`itemStyle`),l=c.getItemStyle(),u=e.lastIndexOf(`empty`,0)===0?`fill`:`stroke`,d=c.getShallow(`decal`);l.decal=!d||d===`inherit`?r.decal:Tz(d,o),l.fill===`inherit`&&(l.fill=r[i]),l.stroke===`inherit`&&(l.stroke=r[u]),l.opacity===`inherit`&&(l.opacity=(i===`fill`?r:n).opacity),s(l,r);var f=t.getModel(`lineStyle`),p=f.getLineStyle();if(s(p,n),l.fill===`auto`&&(l.fill=r.fill),l.stroke===`auto`&&(l.stroke=r.fill),p.stroke===`auto`&&(p.stroke=r.fill),!a){var m=t.get(`inactiveBorderWidth`),h=l[u];l.lineWidth=m===`auto`?r.lineWidth>0&&h?2:0:l.lineWidth,l.fill=t.get(`inactiveColor`),l.stroke=t.get(`inactiveBorderColor`),p.stroke=f.get(`inactiveColor`),p.lineWidth=f.get(`inactiveWidth`)}return{itemStyle:l,lineStyle:p}}function tge(e){var t=e.icon||`roundRect`,n=aI(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return n.setStyle(e.itemStyle),n.rotation=(e.iconRotate||0)*Math.PI/180,n.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf(`empty`)>-1&&(n.style.stroke=n.style.fill,n.style.fill=K.color.neutral00,n.style.lineWidth=2),n}function aY(e,t,n,r){sY(e,t,n,r),n.dispatchAction({type:`legendToggleSelect`,name:e??t}),oY(e,t,n,r)}function oY(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`highlight`,seriesName:e,name:t,excludeSeriesId:r})}function sY(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`downplay`,seriesName:e,name:t,excludeSeriesId:r})}function cY(e,t,n){var r=e===`allSelect`||e===`inverseSelect`,i={},a=[];n.eachComponent({mainType:`legend`,query:t},function(n){r?n[e]():n[e](t.name),lY(n,i),a.push(n.componentIndex)});var o={};return n.eachComponent(`legend`,function(e){W(i,function(t,n){e[t?`select`:`unSelect`](n)}),lY(e,o)}),r?{selected:o,legendIndex:a}:{name:t.name,selected:o}}function lY(e,t){var n=t||{};return W(e.getData(),function(t){var r=t.get(`name`);if(r!==` -`&&r!==``){var i=e.isSelected(r);n[r]=Zb(n,r)?n[r]&&i:i}}),n}function nge(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,Eb(cY,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,Eb(cY,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,Eb(cY,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,Eb(cY,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,Eb(cY,`unSelect`))}var rge=PS(ige);function ige(e){var t=e.findComponents({mainType:`legend`});t&&t.length&&e.filterSeries(function(e){for(var n=0;nn[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=Rb(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new eD({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&bk(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;W([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,Ob(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=pY[i],o=mY[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=+!!u,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(iY);function sge(e){e.registerAction(`legendScroll`,`legendscroll`,function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:`legend`,subType:`scroll`,query:e},function(e){e.setScrollDataIndex(n)})})}function cge(e){IB(uY),e.registerComponentModel(age),e.registerComponentView(oge),sge(e)}function lge(e){IB(uY),IB(cge)}var uge=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.inside`,t.defaultOption=DA(mK.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(mK),hY=dS();function dge(e,t,n){hY(e).coordSysRecordMap.each(function(e){var r=e.dataZoomInfoMap.get(t.uid);r&&(r.getRange=n)})}function fge(e,t){for(var n=hY(e).coordSysRecordMap,r=n.keys(),i=0;ia[i+r]&&(r=n),o&&=t.get(`preventDefaultMouseMove`,!0),s=Rb(t.get(`cursorGrab`,!0),s),c=Rb(t.get(`cursorGrabbing`,!0),c)}),{controlType:r,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:n,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint},cursorGrab:s,cursorGrabbing:c}}}function _ge(e){e.registerUpdateLifecycle(`coordsys:aftercreate`,function(e,t){var n=hY(t),r=n.coordSysRecordMap||=Jb();r.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:`dataZoom`,subType:`inside`},function(e){W(cK(e).infoList,function(n){var i=n.model.uid,a=r.get(i)||r.set(i,pge(t,n.model));(a.dataZoomInfoMap||=Jb()).set(e.uid,{dzReferCoordSysInfo:n,model:e,getRange:null})})}),r.each(function(e){var n=e.controller,i,a=e.dataZoomInfoMap;if(a){var o=a.keys()[0];o!=null&&(i=a.get(o))}if(!i){gY(r,e);return}var s=gge(a,e,t);n.enable(s.controlType,s.opt),CR(e,`dispatchAction`,i.model.get(`throttle`,!0),`fixRate`)})})}var vge=function(e){H(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`dataZoom.inside`,t}return t.prototype.render=function(t,n,r){if(e.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),dge(r,t,{pan:Tb(_Y.pan,this),zoom:Tb(_Y.zoom,this),scrollMove:Tb(_Y.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){fge(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(_K),_Y={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=yY[t](null,[r.originX,r.originY],o,n,e),c=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],l=Math.max(1/r.scale,0);a[0]=(a[0]-c)*l+c,a[1]=(a[1]-c)*l+c;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(lU(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:vY(function(e,t,n,r,i,a){var o=yY[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:vY(function(e,t,n,r,i,a){return yY[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})};function vY(e){return function(t,n,r,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s&&(lU(e(o,s,t,n,r,i),o,[0,100],`all`),this.range=o,a[0]!==o[0]||a[1]!==o[1]))return o}}var yY={grid:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem.getRect();return e||=[0,0],a.dim===`x`?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem,c=s.getRadiusAxis().getExtent(),l=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),n.mainType===`radiusAxis`?(o.pixel=t[0]-e[0],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,n,r,i){var a=n.axis,o=i.model.coordinateSystem.getRect(),s={};return e||=[0,0],a.orient===`horizontal`?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};function yge(e){CK(e),e.registerComponentModel(uge),e.registerComponentView(vge),_ge(e)}var bge=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.slider`,t.layoutMode=`box`,t.defaultOption=DA(mK.defaultOption,{show:!0,right:`ph`,top:`ph`,width:`ph`,height:`ph`,left:null,bottom:null,borderColor:K.color.accent10,borderRadius:0,backgroundColor:K.color.transparent,dataBackground:{lineStyle:{color:K.color.accent30,width:.5},areaStyle:{color:K.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:K.color.accent40,width:.5},areaStyle:{color:K.color.accent20,opacity:.3}},fillerColor:`rgba(135,175,274,0.2)`,handleIcon:`path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z`,handleSize:`100%`,handleStyle:{color:K.color.neutral00,borderColor:K.color.accent20},moveHandleSize:7,moveHandleIcon:`path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z`,moveHandleStyle:{color:K.color.accent40,opacity:.5},showDetail:!0,showDataShadow:`auto`,realtime:!0,zoomLock:!1,textStyle:{color:K.color.tertiary},brushSelect:!0,brushStyle:{color:K.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:K.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(mK),bY=eD,xge=1,xY=30,Sge=7,SY=`horizontal`,CY=`vertical`,Cge=5,wge=[`line`,`bar`,`candlestick`,`scatter`],Tge={easing:`cubicOut`,duration:100,delay:0},Ege=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return t.prototype.init=function(e,t){this.api=t,this._onBrush=Tb(this._onBrush,this),this._onBrushEnd=Tb(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){if(e.prototype.render.apply(this,arguments),CR(this,`_dispatchZoomAction`,t.get(`throttle`),`fixRate`),this._orient=t.getOrient(),t.get(`show`)===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!i||i.type!==`dataZoom`||i.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){wR(this,`_dispatchZoomAction`);var e=this.api.getZr();e.off(`mousemove`,this._onBrush),e.off(`mouseup`,this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new LO;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get(`brushSelect`)?Sge:0,r=Rj(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===SY?{right:r.width-i.x-i.width,top:r.height-xY-a-n,width:i.width,height:xY}:{right:a,top:i.y,width:xY,height:i.height},s=Hj(e.option);W([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=Ij(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===CY&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,r=this.dataZoomModel.getFirstTargetAxisModel(),i=r&&r.get(`inverse`),a=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;a.attr(n===SY&&!i?{scaleY:o?1:-1,scaleX:1}:n===SY&&i?{scaleY:o?1:-1,scaleX:-1}:n===CY&&!i?{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2});var s=e.getBoundingRect([a]),c=isNaN(s.x)?0:s.x,l=isNaN(s.y)?0:s.y;e.x=t.x-c,e.y=t.y-l,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,r=e.get(`brushSelect`);n.add(new bY({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new bY({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:Tb(this._onClickPanel,this)}),a=this.api.getZr();r?(i.on(`mousedown`,this._onBrushStart,this),i.cursor=`crosshair`,a.on(`mousemove`,this._onBrush),a.on(`mouseup`,this._onBrushEnd)):(a.off(`mousemove`,this._onBrush),a.off(`mouseup`,this._onBrushEnd)),n.add(i)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var t=this._size,n=this._shadowSize||[],r=e.series,i=r.getRawData(),a=r.getShadowDim&&r.getShadowDim(),o=a&&i.getDimensionInfo(a)?r.getShadowDim():e.otherDim;if(o==null)return;var s=this._shadowPolygonPts,c=this._shadowPolylinePts;if(i!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var l=i.getDataExtent(e.thisDim),u=i.getDataExtent(o),d=(u[1]-u[0])*.3;u=[u[0]-d,u[1]+d];var f=[0,t[1]],p=[0,t[0]],m=[[t[0],0],[0,0]],h=[],g=p[1]/Math.max(1,i.count()-1),_=t[0]/(l[1]-l[0]),v=e.thisAxis.type===`time`,y=-g,b=Math.round(i.count()/t[0]),x;i.each([e.thisDim,o],function(e,t,n){if(b>0&&n%b){v||(y+=g);return}y=v?(+e-l[0])*_:y+g;var r=t==null||isNaN(t)||t===``,i=r?0:dx(t,u,f,!0);r&&!x&&n?(m.push([m[m.length-1][0],0]),h.push([h[h.length-1][0],0])):!r&&x&&(m.push([y,0]),h.push([y,0])),r||(m.push([y,i]),h.push([y,i])),x=r}),s=this._shadowPolygonPts=m,c=this._shadowPolylinePts=h}this._shadowData=i,this._shadowDim=o,this._shadowSize=[t[0],t[1]];var S=this.dataZoomModel;function C(e){var t=S.getModel(e?`selectedDataBackground`:`dataBackground`),n=new LO,r=new ek({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new tk({shape:{points:c},segmentIgnoreThreshold:1,style:t.getModel(`lineStyle`).getLineStyle(),silent:!0,z2:-19});return n.add(r),n.add(i),n}for(var w=0;w<3;w++){var T=C(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get(`showDataShadow`);if(t!==!1){var n,r=this.ecModel;return e.eachTargetAxis(function(i,a){W(e.getAxisProxy(i,a).getTargetSeriesModels(),function(e){if(!n&&!(t!==!0&&_b(wge,e.get(`type`))<0)){var o=r.getComponent(oK(i),a).axis,s=Dge(i),c,l=e.coordinateSystem;s!=null&&l.getOtherAxis&&(c=l.getOtherAxis(o).inverse),s=e.getData().mapDimension(s),n={thisAxis:o,series:e,thisDim:e.getData().mapDimension(i),otherDim:s,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],r=t.handleLabels=[null,null],i=this._displayables.sliderGroup,a=this._size,o=this.dataZoomModel,s=this.api,c=o.get(`borderRadius`)||0,l=o.get(`brushSelect`),u=t.filler=new bY({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new bY({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:a[0],height:a[1],r:c},style:{stroke:o.get(`dataBackgroundColor`)||o.get(`borderColor`),lineWidth:xge,fill:K.color.transparent}})),W([0,1],function(t){var a=o.get(`handleIcon`);!iI[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=aI(a,-1,0,2,2,null,!0);s.attr({cursor:Oge(this._orient),draggable:!0,drift:Tb(this._onDragMove,this,t),ondragend:Tb(this._onDragEnd,this),onmouseover:Tb(this._onOverDataInfoTriggerArea,this,!0),onmouseout:Tb(this._onOverDataInfoTriggerArea,this,!1),z2:5});var c=s.getBoundingRect(),l=o.get(`handleSize`);this._handleHeight=fx(l,this._size[1]),this._handleWidth=c.width/c.height*this._handleHeight,s.setStyle(o.getModel(`handleStyle`).getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState(`emphasis`).style=o.getModel([`emphasis`,`handleStyle`]).getItemStyle(),gO(s);var u=o.get(`handleColor`);u!=null&&(s.style.fill=u),i.add(n[t]=s);var d=o.getModel(`textStyle`),f=(o.get(`handleLabel`)||{}).show||!1;e.add(r[t]=new aD({silent:!0,invisible:!f,style:fA(d,{x:0,y:0,text:``,verticalAlign:`middle`,align:`center`,fill:d.getTextColor(),font:d.getFont()}),z2:10}))},this);var d=u;if(l){var f=fx(o.get(`moveHandleSize`),a[1]),p=t.moveHandle=new eD({style:o.getModel(`moveHandleStyle`).getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:a[1]-.5,height:f}}),m=f*.8,h=t.moveHandleIcon=aI(o.get(`moveHandleIcon`),-m/2,-m/2,m,m,K.color.neutral00,!0);h.silent=!0,h.y=a[1]+f/2-.5,p.ensureState(`emphasis`).style=o.getModel([`emphasis`,`moveHandleStyle`]).getItemStyle();var g=Math.min(a[1]/2,Math.max(f,10));d=t.moveZone=new eD({invisible:!0,shape:{y:a[1]-g,height:f+g}}),d.on(`mouseover`,function(){s.enterEmphasis(p)}).on(`mouseout`,function(){s.leaveEmphasis(p)}),i.add(p),i.add(h),i.add(d)}d.attr({draggable:!0,cursor:`grab`,drift:Tb(this._onActualMoveZoneDrift,this),ondragstart:Tb(this._onActualMoveZoneDragStart,this),ondragend:Tb(this._onActualMoveZoneDragEnd,this),onmouseover:Tb(this._onOverDataInfoTriggerArea,this,!0),onmouseout:Tb(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[dx(e[0],[0,100],t,!0),dx(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,r=this._handleEnds,i=this._getViewExtent(),a=n.findRepresentativeAxisProxy().getMinMaxSpan(),o=[0,100];lU(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:dx(a.minSpan,o,i,!0),a.maxSpan==null?null:dx(a.maxSpan,o,i,!0));var s=this._range,c=this._range=hx([dx(r[0],i,o,!0),dx(r[1],i,o,!0)]);return!s||s[0]!==c[0]||s[1]!==c[1]},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,r=hx(n.slice()),i=this._size;W([0,1],function(e){var r=t.handles[e],a=this._handleHeight;r.attr({scaleX:a/2,scaleY:a/2,x:n[e]+(e?-1:1),y:i[1]/2-a/2})},this),t.filler.setShape({x:r[0],y:0,width:r[1]-r[0],height:i[1]});var a={x:r[0],width:r[1]-r[0]};t.moveHandle&&(t.moveHandle.setShape(a),t.moveZone.setShape(a),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr(`x`,a.x+a.width/2));for(var o=t.dataShadowSegs,s=[0,r[0],r[1],i[0]],c=0;ct[0]||n[1]<0||n[1]>t[1])){var r=this._handleEnds,i=(r[0]+r[1])/2,a=this._updateInterval(`all`,n[0]-i);this._updateView(),a&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new hC(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr(`ignore`,!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var r=this._getViewExtent(),i=[0,100],a=this._handleEnds=[n.x,n.x+n.width],o=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();lU(0,a,r,0,o.minSpan==null?null:dx(o.minSpan,i,r,!0),o.maxSpan==null?null:dx(o.maxSpan,i,r,!0)),this._range=hx([dx(a[0],r,i,!0),dx(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(eL(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,r=this.dataZoomModel,i=n.brushRect;i||(i=n.brushRect=new bY({silent:!0,style:r.getModel(`brushStyle`).getItemStyle()}),n.sliderGroup.add(i)),i.attr(`ignore`,!1);var a=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),c=o.transformCoordToLocal(a.x,a.y),l=this._size;s[0]=Math.max(Math.min(l[0],s[0]),0),i.setShape({x:c[0],y:0,width:s[0]-c[0],height:l[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:`dataZoom`,from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?Tge:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=cK(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var r=this.api.getWidth(),i=this.api.getHeight();e={x:r*.2,y:i*.2,width:r*.6,height:i*.6}}return e},t.type=`dataZoom.slider`,t}(_K);function wY(e,t,n,r){var i=e.get(`labelFormatter`),a=e.get(`labelPrecision`);(a==null||a===`auto`)&&(a=n.valuePrecision);var o=n.value[t],s=o==null||isNaN(o)?``:pP(r)||dP(r)?r.getLabel({value:Math.round(o)}):isFinite(a)?mx(o,a,!0):o+``;return Db(i)?i(o,s):Ob(i)?i.replace(`{value}`,s):s}function Dge(e){return{x:`y`,y:`x`,radius:`angle`,angle:`radius`}[e]}function Oge(e){return e===`vertical`?`ns-resize`:`ew-resize`}function kge(e){e.registerComponentModel(bge),e.registerComponentView(Ege),CK(e)}function Age(e){IB(yge),IB(kge)}var TY={get:function(e,t,n){var r=mb((jge[e]||{})[t]);return n&&G(r)?r[r.length-1]:r}},jge={color:{active:[`#006edd`,`#e0ffff`],inactive:[K.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:[`circle`,`roundRect`,`diamond`],inactive:[`none`]},symbolSize:{active:[10,50],inactive:[0,0]}},EY=BH.mapVisual,Mge=BH.eachVisual,Nge=G,DY=W,Pge=hx,Fge=dx,OY=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=[`inRange`,`outOfRange`],n.replacableOptionKeys=[`inRange`,`outOfRange`,`target`,`controller`,`color`],n.layoutMode={type:`box`,ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&fJ(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=Tb(e,this),this.controllerVisuals=dJ(this.option.controller,t,e),this.targetVisuals=dJ(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this,t=this.option.seriesTargets;if(t){var n=[];return DY(t,function(t){if(t.seriesIndex!=null)n.push(t.seriesIndex);else if(t.seriesId!=null){var r;e.ecModel.eachSeries(function(e){e.id===t.seriesId&&(r=e)}),r&&n.push(r.componentIndex)}}),n}var r=this.option.seriesId,i=this.option.seriesIndex;i==null&&r==null&&(i=`all`);var a=_S(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return bb(a,function(e){return e.componentIndex})},t.prototype.eachTargetSeries=function(e,t){W(this.getTargetSeriesIndices(),function(n){var r=this.ecModel.getSeriesByIndex(n);r&&e.call(t,r)},this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries(function(n){n===e&&(t=!0)}),t},t.prototype.formatValueText=function(e,t,n){var r=this.option,i=r.precision,a=this.dataBound,o=r.formatter,s;n||=[`<`,`>`],G(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);return Ob(o)?o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c):Db(o)?s?o(e[0],e[1]):o(e):s?e[0]===a[0]?n[0]+` `+c[1]:e[1]===a[1]?n[1]+` `+c[0]:c[0]+` - `+c[1]:c;function l(e){return e===a[0]?`min`:e===a[1]?`max`:(+e).toFixed(Math.min(i,20))}},t.prototype.resetExtent=function(){var e=this.option,t=Pge([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=Cb(n,function(n){return n.seriesIndex!=null&&n.seriesIndex===e||n.seriesId!=null&&n.seriesId===t.ecModel.getSeriesByIndex(e).id});if(r)return r.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(e){var t=e.hostModel.seriesIndex,n=this.getDimension(t);if(n!=null)return e.getDimensionIndex(n);for(var r=e.dimensions,i=r.length-1;i>=0;i--){var a=r[i],o=e.getDimensionInfo(a);if(!o.isCalculationCoord)return o.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},r=t.target||={},i=t.controller||={};hb(r,n),hb(i,n);var a=this.isCategory();o.call(this,r),o.call(this,i),s.call(this,r,`inRange`,`outOfRange`),c.call(this,i);function o(n){Nge(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get(`gradientColor`)}}function s(e,t,n){var r=e[t],i=e[n];r&&!i&&(i=e[n]={},DY(r,function(e,t){if(BH.isValidType(t)){var n=TY.get(t,`inactive`,a);n!=null&&(i[t]=n,t===`color`&&!i.hasOwnProperty(`opacity`)&&!i.hasOwnProperty(`colorAlpha`)&&(i.opacity=[0,0]))}}))}function c(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,r=this.get(`inactiveColor`),i=this.getItemSymbol()||`roundRect`;DY(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??(c.symbol=t&&mb(t)||(a?i:[i])),c.symbolSize??(c.symbolSize=n&&mb(n)||(a?s[0]:[s[0],s[0]])),c.symbol=EY(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;Mge(l,function(e){e>u&&(u=e)}),c.symbolSize=EY(l,function(e){return Fge(e,[0,u],[0,s[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get(`itemWidth`)),parseFloat(this.get(`itemHeight`))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type=`visualMap`,t.dependencies=[`series`],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:`vertical`,backgroundColor:K.color.transparent,borderColor:K.color.borderTint,contentColor:K.color.theme[0],inactiveColor:K.color.disabled,borderWidth:0,padding:K.size.m,textGap:10,precision:0,textStyle:{color:K.color.secondary}},t}(Wj),kY=[20,140],Ige=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(e){e.mappingMethod=`linear`,e.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=kY[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=kY[1])},t.prototype._resetRange=function(){var e=this.getExtent(),t=this.option.range;!t||t.auto?(e.auto=1,this.option.range=e):G(t)&&(t[0]>t[1]&&t.reverse(),t[0]=Math.max(t[0],e[0]),t[1]=Math.min(t[1],e[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),W(this.stateList,function(e){var t=this.option.controller[e].symbolSize;t&&t[0]!==t[1]&&(t[0]=t[1]/3)},this)},t.prototype.setSelected=function(e){this.option.range=e.slice(),this._resetRange()},t.prototype.getSelected=function(){var e=this.getExtent(),t=hx((this.get(`range`)||[]).slice());return t[0]>e[1]&&(t[0]=e[1]),t[1]>e[1]&&(t[1]=e[1]),t[0]=n[1]||e<=t[1])?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[];return this.eachTargetSeries(function(n){var r=[],i=n.getData();i.each(this.getDataDimensionIndex(i),function(t,n){e[0]<=t&&t<=e[1]&&r.push(n)},this),t.push({seriesId:n.id,dataIndex:r})},this),t},t.prototype.getVisualMeta=function(e){var t=AY(this,`outOfRange`,this.getExtent()),n=AY(this,`inRange`,this.option.range.slice()),r=[];function i(t,n){r.push({value:t,color:e(t,n)})}for(var a=0,o=0,s=n.length,c=t.length;oe[1])break;r.push({color:this.getControllerVisual(o,`color`,t),offset:a/n})}return r.push({color:this.getControllerVisual(e[1],`color`,t),offset:1}),r},t.prototype._createBarPoints=function(e,t){var n=this.visualMapModel.itemSize;return[[n[0]-t[0],e[0]],[n[0],e[0]],[n[0],e[1]],[n[0]-t[1],e[1]]]},t.prototype._createBarGroup=function(e){var t=this._orient,n=this.visualMapModel.get(`inverse`);return new LO(t===`horizontal`&&!n?{scaleX:e===`bottom`?1:-1,rotation:Math.PI/2}:t===`horizontal`&&n?{scaleX:e===`bottom`?-1:1,rotation:-Math.PI/2}:t===`vertical`&&!n?{scaleX:e===`left`?1:-1,scaleY:-1}:{scaleX:e===`left`?1:-1})},t.prototype._updateHandle=function(e,t){if(this._useHandle){var n=this._shapes,r=this.visualMapModel,i=n.handleThumbs,a=n.handleLabels,o=r.itemSize,s=r.getExtent(),c=this._applyTransform(`left`,n.mainGroup);Lge([0,1],function(l){var u=i[l];u.setStyle(`fill`,t.handlesColor[l]),u.y=e[l];var d=FY(e[l],[0,o[1]],s,!0),f=this.getControllerVisual(d,`symbolSize`);u.scaleX=u.scaleY=f/o[0],u.x=o[0]-f/2;var p=Rk(n.handleLabelPoints[l],Lk(u,this.group));if(this._orient===`horizontal`){var m=c===`left`||c===`top`?(o[0]-f)/2:(o[0]-f)/-2;p[1]+=m}a[l].setStyle({x:p[0],y:p[1],text:r.formatValueText(this._dataInterval[l]),verticalAlign:`middle`,align:this._orient===`vertical`?this._applyTransform(`left`,n.mainGroup):`center`})},this)}},t.prototype._showIndicator=function(e,t,n,r){var i=this.visualMapModel,a=i.getExtent(),o=i.itemSize,s=[0,o[1]],c=this._shapes,l=c.indicator;if(l){l.attr(`invisible`,!1);var u=this.getControllerVisual(e,`color`,{convertOpacityToAlpha:!0}),d=this.getControllerVisual(e,`symbolSize`),f=FY(e,a,s,!0),p=o[0]-d/2,m={x:l.x,y:l.y};l.y=f,l.x=p;var h=Rk(c.indicatorLabelPoint,Lk(l,this.group)),g=c.indicatorLabel;g.attr(`invisible`,!1);var _=this._applyTransform(`left`,c.mainGroup),v=this._orient===`horizontal`;g.setStyle({text:(n||``)+i.formatValueText(t),verticalAlign:v?_:`middle`,align:v?`center`:_});var y={x:p,y:f,style:{fill:u}},b={style:{x:h[0],y:h[1]}};if(i.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var x={duration:100,easing:`cubicInOut`,additive:!0};l.x=m.x,l.y=m.y,l.animateTo(y,x),g.animateTo(b,x)}else l.attr(y),g.attr(b);this._firstShowIndicator=!1;var S=this._shapes.handleLabels;if(S)for(var C=0;Ci[1]&&(l[1]=1/0),t&&(l[0]===-1/0?this._showIndicator(c,l[1],`< `,o):l[1]===1/0?this._showIndicator(c,l[0],`> `,o):this._showIndicator(c,c,`≈ `,o));var u=this._hoverLinkDataIndices,d=[];(t||zY(n))&&(d=this._hoverLinkDataIndices=n.findTargetDataIndices(l));var f=lS(u,d);this._dispatchHighDown(`downplay`,PY(f[0],n)),this._dispatchHighDown(`highlight`,PY(f[1],n))}},t.prototype._hoverLinkFromSeriesMouseOver=function(e){var t;if(JR(e.target,function(e){var n=yD(e);if(n.dataIndex!=null)return t=n,!0},!0),t){var n=this.ecModel.getSeriesByIndex(t.seriesIndex),r=this.visualMapModel;if(r.isTargetSeries(n)){var i=n.getData(t.dataType),a=i.getStore().get(r.getDataDimensionIndex(i),t.dataIndex);isNaN(a)||this._showIndicator(a,a)}}},t.prototype._hideIndicator=function(){var e=this._shapes;e.indicator&&e.indicator.attr(`invisible`,!0),e.indicatorLabel&&e.indicatorLabel.attr(`invisible`,!0);var t=this._shapes.handleLabels;if(t)for(var n=0;n=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}];function Gge(e,t,n,r){for(var i=t.targetVisuals[r],a=BH.prepareVisualTypes(i),o={color:GR(e.getData(),`color`)},s=0,c=a.length;s0:e.splitNumber>0)||e.calculable)?`continuous`:`piecewise`}),e.registerAction(Hge,Uge),W(Wge,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(Kge))}function qge(e){e.registerComponentModel(Ige),e.registerComponentView(Bge),WY(e)}var Jge=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var r=this._mode=this._determineMode();this._pieceList=[],Yge[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(e,t){r===`categories`?(e.mappingMethod=`category`,e.categories=mb(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=bb(this._pieceList,function(e){return e=mb(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=BH.listVisualTypes(),i=this.isCategory();W(t.pieces,function(e){W(r,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),W(n,function(e,n){var r=!1;W(this.stateList,function(e){r=r||a(t,e,n)||a(t.target,e,n)},this),!r&&W(this.stateList,function(e){(t[e]||(t[e]={}))[n]=TY.get(n,e===`inRange`?`active`:`inactive`,i)})},this);function a(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,r=this._pieceList,i=(t?n:e).selected||{};if(n.selected=i,W(r,function(e,t){var n=this.getSelectedMapKey(e);i.hasOwnProperty(n)||(i[n]=!0)},this),n.selectedMode===`single`){var a=!1;W(r,function(e,t){var n=this.getSelectedMapKey(e);i[n]&&(a?i[n]=!1:a=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get(`itemSymbol`)},t.prototype.getSelectedMapKey=function(e){return this._mode===`categories`?e.value+``:e.index+``},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?`pieces`:this.option.categories?`categories`:`splitNumber`},t.prototype.setSelected=function(e){this.option.selected=mb(e)},t.prototype.getValueState=function(e){var t=BH.findPieceIndex(e,this._pieceList);return t==null?`outOfRange`:this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries(function(r){var i=[],a=r.getData();a.each(this.getDataDimensionIndex(a),function(t,r){BH.findPieceIndex(t,n)===e&&i.push(r)},this),t.push({seriesId:r.id,dataIndex:i})},this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(e.value!=null)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(this.isCategory())return;var t=[],n=[``,``],r=this;function i(i,a){var o=r.getRepresentValue({interval:i});a||=r.getValueState(o);var s=e(o,a);i[0]===-1/0?n[0]=s:i[1]===1/0?n[1]=s:t.push({value:i[0],color:s},{value:i[1],color:s})}var a=this._pieceList.slice();if(!a.length)a.push({interval:[-1/0,1/0]});else{var o=a[0].interval[0];o!==-1/0&&a.unshift({interval:[-1/0,o]}),o=a[a.length-1].interval[1],o!==1/0&&a.push({interval:[o,1/0]})}var s=-1/0;return W(a,function(e){var t=e.interval;t&&(t[0]>s&&i([s,t[0]],`outOfRange`),i(t.slice()),s=t[1])},this),{stops:t,outerColors:n}},t.type=`visualMap.piecewise`,t.defaultOption=DA(OY.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:`auto`,itemWidth:20,itemHeight:14,itemSymbol:`roundRect`,pieces:null,categories:null,splitNumber:5,selectedMode:`multiple`,itemGap:10,hoverLink:!0}),t}(OY),Yge={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),r=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(r[1]-r[0])/i;+a.toFixed(n)!==a&&n<5;)n++;t.precision=n,a=+a.toFixed(n),t.minOpen&&e.push({interval:[-1/0,r[0]],close:[0,0]});for(var o=0,s=r[0];o`,`≥`][t[0]]];e.text=e.text||this.formatValueText(e.value==null?e.interval:e.value,!1,n)},this)}};function GY(e,t){var n=e.inverse;(e.orient===`vertical`?!n:n)&&t.reverse()}var Xge=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get(`textGap`),r=t.textStyleModel,i=this._getItemAlign(),a=t.itemSize,o=this._getViewData(),s=o.endsText,c=Lb(t.get(`showLabel`,!0),!s),l=!t.get(`selectedMode`);s&&this._renderEndsText(e,s[0],a,c,i),W(o.viewPieceList,function(o){var s=o.piece,u=new LO;u.onclick=Tb(this._onItemClick,this,s),this._enableHoverLink(u,o.indexInModelPieceList);var d=t.getRepresentValue(s);if(this._createItemSymbol(u,d,[0,0,a[0],a[1]],l),c){var f=this.visualMapModel.getValueState(d),p=r.get(`align`)||i;u.add(new aD({style:fA(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:Rb(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),Fj(t.get(`orient`),e,t.get(`itemGap`)),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on(`mouseover`,function(){return r(`highlight`)}).on(`mouseout`,function(){return r(`downplay`)});var r=function(e){var r=n.visualMapModel;r.option.hoverLink&&n.api.dispatchAction({type:e,batch:PY(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return NY(e,this.api,e.itemSize);var n=t.align;return(!n||n===`auto`)&&(n=`left`),n},t.prototype._renderEndsText=function(e,t,n,r,i){if(t){var a=new LO,o=this.visualMapModel.textStyleModel;a.add(new aD({style:fA(o,{x:r?i===`right`?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:`middle`,align:r?i:`center`,text:t})})),e.add(a)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=bb(e.getPieceList(),function(e,t){return{piece:e,indexInModelPieceList:t}}),n=e.get(`text`),r=e.get(`orient`),i=e.get(`inverse`);return(r===`horizontal`?i:!i)?t.reverse():n&&=n.slice().reverse(),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n,r){var i=aI(this.getControllerVisual(t,`symbol`),n[0],n[1],n[2],n[3],this.getControllerVisual(t,`color`));i.silent=r,e.add(i)},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,r=n.selectedMode;if(r){var i=mb(n.selected),a=t.getSelectedMapKey(e);r===`single`||r===!0?(i[a]=!0,W(i,function(e,t){i[t]=t===a})):i[a]=!i[a],this.api.dispatchAction({type:`selectDataRange`,from:this.uid,visualMapId:this.visualMapModel.id,selected:i})}},t.type=`visualMap.piecewise`,t}(jY);function Zge(e){e.registerComponentModel(Jge),e.registerComponentView(Xge),WY(e)}function Qge(e){IB(qge),IB(Zge)}var $ge={label:{enabled:!0},decal:{show:!1}},KY=dS(),qY=dS(),e_e=PS(t_e);function t_e(e,t){var n=e.getModel(`aria`);if(!n.get(`enabled`))return;var r=qY(e).scope||(qY(e).scope={}),i=mb($ge);hb(i.label,e.getLocaleModel().get(`aria`),!1),hb(n.option,i,!1),a(),o();function a(){if(n.getModel(`decal`).get(`show`)){var t=Jb();e.eachSeries(function(e){e.isColorBySeries()||(KY(e).scope=t.get(e.type)||t.set(e.type,{}))}),e.eachSeries(function(t){if(Db(t.enableAriaDecal)){t.enableAriaDecal();return}var n=t.getData();if(t.isColorBySeries()){var i=qj(t.ecModel,t.name,r,e.getSeriesCount()),a=n.getVisual(`decal`);n.setVisual(`decal`,u(a,i))}else{var o=t.getRawData(),s={},c=KY(t).scope;n.each(function(e){var t=n.getRawIndex(e);s[t]=e});var l=o.count();o.each(function(e){var r=s[e],i=o.getName(e)||e+``,a=qj(t.ecModel,i,c,l),d=n.getItemVisual(r,`decal`);n.setItemVisual(r,`decal`,u(d,a))})}function u(e,t){var n=e?U(U({},t),e):t;return n.dirty=!0,n}})}}function o(){var r=t.getZr().dom;if(r){var i=e.getLocaleModel().get(`aria`),a=n.getModel(`label`);if(a.option=gb(a.option,i),a.get(`enabled`)){if(r.setAttribute(`role`,`img`),a.get(`description`)){r.setAttribute(`aria-label`,a.get(`description`));return}var o=e.getSeriesCount(),u=a.get([`data`,`maxCount`])||10,d=a.get([`series`,`maxCount`])||10,f=Math.min(o,d),p;if(!(o<1)){var m=c();p=m?s(a.get([`general`,`withTitle`]),{title:m}):a.get([`general`,`withoutTitle`]);var h=[],g=o>1?a.get([`series`,`multiple`,`prefix`]):a.get([`series`,`single`,`prefix`]);p+=s(g,{seriesCount:o}),e.eachSeries(function(e,t){if(t1?a.get([`series`,`multiple`,r]):a.get([`series`,`single`,r]),n=s(n,{seriesId:e.seriesIndex,seriesName:e.get(`name`),seriesType:l(e.subType)});var i=e.getData();if(i.count()>u){var c=a.get([`data`,`partialData`]);n+=s(c,{displayCnt:u})}else n+=a.get([`data`,`allData`]);for(var d=a.get([`data`,`separator`,`middle`]),p=a.get([`data`,`separator`,`end`]),m=a.get([`data`,`excludeDimensionId`]),g=[],_=0;_=a}}}for(var l=XY(this),u=l.startIdx;u=0)&&(a=!0)}),a||i.__dirty){var o=n._opts.useDirtyRect&&!YY(i)?i.createRepaintRects(e,t,n._width,n._height):null,s=n._i.layerStack[0],c=!0;if(i.__dirty){c=!1,i.__dirty=!1;var l=i.zlevel===s.zl&&i.zlevel2===s.zl2?n._backgroundColor:null;i.clear(!1,l,o)}iX(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},uX),$b.wxa&&oX(this._i,function(e){e&&e.ctx&&e.ctx.draw&&e.ctx.draw()}),r},e.prototype._paintPerCursor=function(e,t,n,r,i){var a=e.ctx;if(r){if(!r.length)t.drawIdx=t.endIdx;else for(var o=this.dpr,s=0;s=t.endIdx},e.prototype._paintPerCursorInRect=function(e,t,n,r,i){for(var a={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},o=e.ctx,s=YY(e),c=s&&nb.getTime(),l=t.drawIdx,u=t.notClearIdx,d=u>=0?Math.min(u,l):l;d15){d++;break}}}xz(o,a),t.drawIdx=Math.max(d,l)},e.prototype.getLayer=function(e,t){return this._ensureLayer(e,0,t)},e.prototype._ensureLayer=function(e,t,n){t||=0;var r=this._singleCanvas;r&&!this._needsManuallyCompositing&&(e=$Y,t=0);var i=aX(this._i,e)[t];return i||(i=nX(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&hb(i,this._layerConfig[e],!0),(n||r&&e!==$Y)&&(i.virtual=!0),this._insertLayer(i,e,t,!1),i.initContext()),i},e.prototype.insertLayer=function(e,t){this._insertLayer(t,e,0,!1)},e.prototype._insertLayer=function(e,t,n,r){var i=this._i,a=i.layers,o=i.layerStack,s=this._domRoot,c=null;if(!(a[t]&&a[t][n])&&a_e(e)){for(var l=o.length,u=0;u0&&(c=aX(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),aX(i,t)[n]=e,!r&&!e.virtual){if(c){var d=c.dom;d.nextSibling?s.insertBefore(e.dom,d.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom)}e.painter||=this}},e.prototype.eachLayer=function(e,t){return oX(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return oX(this._i,function(n,r){e.call(t,n,r)},sX)},e.prototype.eachOtherLayer=function(e,t){return oX(this._i,function(n,r){e.call(t,n,r)},cX)},e.prototype.getLayers=function(){var e={};return oX(this._i,function(t,n,r){e[t.id]=t}),e},e.prototype._updateLayerStatus=function(e,t){var n=this;if(n._singleCanvas)for(var r=1;r=0;a--){var o=i.get(r[a]);if(!o.used)t.__dirty=!0,i.removeKey(r[a]),r.splice(a,1);else{var s=o.endIdxNew;(YY(t)?s=0;r--){var i=t[r];if(i.zl===e){var a=n[e][i.zl2];if(a.__builtin__)continue;if(t.splice(r,1),n[e][i.zl2]=void 0,!a.virtual){var o=a.dom.parentNode;o&&o.removeChild(a.dom)}}}},e.prototype.resize=function(e,t){if(this._domRoot.style){var n=this._domRoot;n.style.display=`none`;var r=this._opts,i=this.root;e!=null&&(r.width=e),t!=null&&(r.height=t),e=tz(i,0,r),t=tz(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,oX(this._i,function(n){n.resize(e,t)}),this.refresh({paintAll:!0})),this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this._ensureLayer($Y).resize(e,t)}return this},e.prototype.clearLayer=function(e){W(this._i.layers[e],function(e){e&&!e.__builtin__&&e.clear()})},e.prototype.dispose=function(){this.root.innerHTML=``,this.root=this.storage=this._domRoot=this._i=null},e.prototype.getRenderedCanvas=function(e){if(e||={},this._singleCanvas&&!this._compositeManually)return this._i.layers[$Y][0].dom;var t=new ZY(`image`,this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var n=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var r=t.dom.width,i=t.dom.height;oX(this._i,function(e){e.__builtin__?n.drawImage(e.dom,0,0,r,i):e.renderToCanvas&&(n.save(),e.renderToCanvas(n),n.restore())})}else{for(var a={inHover:!1,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},o=this.storage.getDisplayList(!0),s=0,c=o.length;s{e.data&&e.interactive!==!1&&e.data.forEach((r,i)=>{let a=typeof r==`object`&&r&&!Array.isArray(r)?r:void 0,o=a?.value??r;o!=null&&t.push({series_index:n,data_index:i,label:`${e.name??`Series`} · point ${i+1}`,event:{seriesName:e.name,name:a?.name,value:o,data:r,interactive:e.interactive}})})}),t}IB([WN,u_e,Npe,ume,HW,nhe,mpe,LG,tK,lge,oJ,Qhe,Khe,Qge,r_e,Fhe,Age,Oq]);var dX=new Map;function fX({option:e,optionForSize:t,height:n,label:r,onClick:i,onZoom:a,group:o,keyboard:s}){let c=(0,A.useRef)(null),l=(0,A.useRef)(null),[u,d]=(0,A.useState)(e),[f,p]=(0,A.useState)(!1),m=(0,A.useRef)(!1),h=(0,A.useRef)(e),g=(0,A.useRef)(s);g.current=s;let _=(0,A.useRef)(void 0),v=(0,A.useCallback)(e=>{_.current&&l.current?.dispatchAction({type:`downplay`,seriesIndex:_.current.series_index,dataIndex:_.current.data_index}),l.current?.dispatchAction({type:`hideTip`}),_.current=e,e&&(l.current?.dispatchAction({type:`highlight`,seriesIndex:e.series_index,dataIndex:e.data_index}),l.current?.dispatchAction({type:`showTip`,seriesIndex:e.series_index,dataIndex:e.data_index}))},[]),y=Array.isArray(u.series)?u.series:u.series?[u.series]:[],b=Array.isArray(u.xAxis)?u.xAxis[0]:u.xAxis,x=Array.isArray(u.yAxis)?u.yAxis[0]:u.yAxis,S=(0,A.useMemo)(()=>{if(!s||!f)return[];let e=Array.isArray(u.series)?u.series:u.series?[u.series]:[],t=x?.type===`category`&&e[0]?.type!==`custom`?x:b?.type===`category`?b:void 0;return d_e(e.map(e=>({...e,interactive:void 0}))).map(n=>{let r=Array.isArray(n.event.value)?n.event.value:[];return{...n,event:{...n.event,interactive:e[n.series_index]?.interactive,name:n.event.name??(e[n.series_index]?.type===`custom`?x?.data?.[Number(r[1])]:t?.data?.[n.data_index])}}}).filter(e=>e.event.value!=null&&(!Array.isArray(e.event.value)||e.event.value.at(-1)!=null))},[u,f]),C=e=>{let t=e.event.data?.selection,n=Array.isArray(e.event.value)?e.event.value:[],r=t?.from?Date.parse(t.from):t?.time??(b?.type===`time`?Number(n[0]):NaN),i=/^(\d+)(ms|s|m|h|d)$/.exec(s?.interval??``),a=i?Number(i[1])*{ms:1,s:1e3,m:6e4,h:36e5,d:864e5}[i[2]]:void 0,o=y[e.series_index]?.data?.[e.data_index+1],c=Array.isArray(o)?o:o?.value,l=typeof c?.[0]==`number`&&c[0]>r?c[0]:void 0,u=a?r+a:l??s?.bounds?.to??r,d=t?.to?Date.parse(t.to):y[e.series_index]?.type===`custom`?Number(n[3]):Math.min(u,s?.bounds?.to??u);return Number.isFinite(r)&&Number.isFinite(d)?{from:r,to:d}:void 0},w=e=>{let t=y[e.series_index],n=Array.isArray(e.event.value)?e.event.value:[e.event.value],r=t?.type===`custom`,i=C(e),a=r?x?.data?.[Number(n[1])]:e.event.name,o=r?n[2]:n.at(-1),s=typeof o==`number`?t?.tooltip?.valueFormatter?.(o)??py(t?.keyboard_unit,o):String(o??`No value`),c=t?.type===`scatter`?`x: ${py(t.keyboard_x_unit,Number(n[0]))} · y: `:``;return[e.event.seriesName??`Series`,a,i?new Date(i.from).toISOString()+(i.to===i.from?``:` – ${new Date(i.to).toISOString()}`):void 0,c+s].filter(Boolean).join(` · `)},T=(0,A.useRef)({}),E=(0,A.useRef)(i);E.current=i;let D=(0,A.useRef)(a);D.current=a;let O=!!a,k=(0,A.useRef)(void 0),j=(0,A.useRef)(0),[M,N]=(0,A.useState)(0),P=(0,A.useCallback)(()=>{let e=k.current;l.current?.dispatchAction({type:`brush`,areas:e?[{brushType:`lineX`,xAxisIndex:0,coordRange:[e.from,e.to]}]:[]},{silent:!0})},[]),F=(0,A.useCallback)(e=>{(k.current?.from!==e?.from||k.current?.to!==e?.to)&&(k.current=e,P())},[P]),ee=O?`${r} Brush across the chart to zoom to that range.`:r,I=(0,A.useRef)(()=>void 0),te=(0,A.useCallback)(e=>{e!==j.current&&(j.current=e,I.current())},[]);(0,A.useRef)(null);let L=(0,A.useRef)(void 0),ne=(0,A.useRef)(!1);ne.current=!!t,I.current=()=>{L.current===void 0&&(L.current=document.createElement(`canvas`).getContext(`2d`));let n=L.current,r={measureText:n?(e,t)=>(n.font=t,n.measureText(e).width):void 0,width:c.current?.clientWidth??0,height:c.current?.clientHeight??0},i=t&&r.width>0&&r.height>0?t(r):e;if(j.current&&i.grid&&!Array.isArray(i.grid)){let e=i.grid;i={...i,grid:{...e,bottom:(typeof e.bottom==`number`?e.bottom:8)+j.current}}}let a=i.series??[],o=new Set(a.map(e=>e.name)),s=Object.fromEntries(Object.entries(T.current).filter(([e])=>o.has(e)));T.current=s;let u=i.legend;l.current?.setOption({...i,...u?{legend:{...u,selected:{...u.selected,...s}}}:{},...D.current?{toolbox:{show:!1},brush:{xAxisIndex:0,brushMode:`single`,removeOnClick:!0}}:{},aria:{...i.aria,enabled:!0,description:ee}},{notMerge:!0});let f=l.current?.getModel?.().getComponent(`grid`)?.coordinateSystem?.getRect(),p=f?.height;if(p&&i.yAxis){let e=Array.isArray(i.yAxis)?i.yAxis:[i.yAxis],t=e.map(e=>yy(e,p));t.some((t,n)=>t.splitNumber!==e[n].splitNumber||t.interval!==e[n].interval)&&(i={...i,yAxis:Array.isArray(i.yAxis)?t:t[0]},l.current?.setOption({yAxis:i.yAxis}))}f&&i.series?.some(e=>e.endLabel?.show)&&(i=zy(i,f,(e,t)=>{let n=l.current?.convertToPixel({seriesIndex:e},t);return Array.isArray(n)?n[1]:NaN}),l.current?.setOption({series:i.series})),_.current&&v(_.current),D.current&&l.current?.dispatchAction({type:`takeGlobalCursor`,key:`brush`,brushOption:{brushType:`lineX`,brushMode:`single`}}),D.current&&k.current&&P(),h.current=i,g.current&&m.current&&d(i)},(0,A.useEffect)(()=>{if(!c.current)return;let e=mfe(c.current,void 0,{renderer:`canvas`});l.current=e,e.on(`click`,e=>{let t=e,n=h.current.series??[],r=t.seriesIndex===void 0?t.interactive:t.componentType&&t.componentType!==`series`?!1:n[t.seriesIndex]?.interactive;E.current?.({...t,...r===void 0?{}:{interactive:r}})}),e.on(`brushEnd`,t=>{let n=t.areas?.[0]?.coordRange;n?.length===2&&Number.isFinite(n[0])&&Number.isFinite(n[1])&&n[0]e+1)),e.dispatchAction({type:`brush`,areas:[]},{silent:!0}),D.current&&e.dispatchAction({type:`takeGlobalCursor`,key:`brush`,brushOption:{brushType:`lineX`,brushMode:`single`}}))}),e.on(`legendselectchanged`,e=>{T.current={...e.selected}});let t=new ResizeObserver(()=>{e.resize(),ne.current&&I.current()});return t.observe(c.current),()=>{t.disconnect(),_.current&&v(void 0),e.dispose(),l.current=null}},[]),(0,A.useEffect)(()=>{I.current()},[e,t,ee,O]),(0,A.useEffect)(()=>{let e=l.current;if(e&&o)return e.group=o,dX.set(o,(dX.get(o)??0)+1),hfe(o),()=>{e.group=``;let t=(dX.get(o)??1)-1;if(t>0){dX.set(o,t);return}dX.delete(o),gfe(o)}},[o]);let re=(0,z.jsx)(`div`,{ref:c,role:`img`,"aria-label":ee,"aria-hidden":s?!0:void 0,style:{height:s?`100%`:n,position:s?`absolute`:void 0,inset:s?0:void 0,zIndex:s?0:void 0,flex:`1 1 auto`,minHeight:0,width:`100%`,minWidth:0,cursor:i?`pointer`:void 0}}),ie=Array.isArray(e.series)?e.series:e.series?[e.series]:[],ae=r+`: `+ie.length+` series`+(s?.bounds?`; `+new Date(s.bounds.from).toISOString()+` – `+new Date(s.bounds.to).toISOString():``);return s?(0,z.jsx)(Vre,{height:n,rangeReset:M,onRangeChange:F,onRangeBarHeight:te,points:S,label:ae,summary:w,onClick:i,canSelect:s.canSelect,onHighlight:v,onZoom:a,bounds:s.bounds,pointWindow:C,onRangePending:s.onRangePending,onActiveChange:e=>{m.current=e,p(e),e&&d(h.current)},children:re}):re}function f_e({panel:e,title:t=e.title,result:n,dark:r,height:i,onSelect:a,onPoint:o}){let s=(0,A.useMemo)(()=>t=>xre(e,n.frame,Ry(r),t),[e,n.frame,r]),c=(0,A.useMemo)(()=>s({width:500,height:i}),[s,i]),l=(0,A.useCallback)(t=>!!Qy(e,n,t),[e,n]);return(0,z.jsx)(fX,{keyboard:{canSelect:l},option:c,optionForSize:s,height:i,label:`${t}: bar chart`,onClick:o||a?t=>{let r=Qy(e,n,t);if(!r)return;o?.(r);let i=Object.values(r.dimensions)[0];i!==void 0&&a?.(i)}:void 0})}function p_e({panel:e,title:t=e.title,result:n,dark:r,height:i}){let a=Ty(e,n.frame),o=n.frame.columns.find(e=>e.role===`measure`)?.unit??e.unit,s=e.better??n.better,c=(0,A.useMemo)(()=>t=>Sre({...e,better:s},a,Ry(r),o,t),[e,s,a,r,o]),l=(0,A.useMemo)(()=>c({width:270,height:i}),[c,i]);return(0,z.jsx)(fX,{option:l,optionForSize:c,height:i,label:`${t}: gauge`})}function m_e(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var h_e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,g_e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,__e={};function pX(e,t){return((t||__e).jsx?g_e:h_e).test(e)}var v_e=/[ \t\n\f\r]/g;function y_e(e){return typeof e==`object`?e.type===`text`&&mX(e.value):mX(e)}function mX(e){return e.replace(v_e,``)===``}var hX=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};hX.prototype.normal={},hX.prototype.property={},hX.prototype.space=void 0;function gX(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new hX(n,r,t)}function _X(e){return e.toLowerCase()}var vX=class{constructor(e,t){this.attribute=t,this.property=e}};vX.prototype.attribute=``,vX.prototype.booleanish=!1,vX.prototype.boolean=!1,vX.prototype.commaOrSpaceSeparated=!1,vX.prototype.commaSeparated=!1,vX.prototype.defined=!1,vX.prototype.mustUseProperty=!1,vX.prototype.number=!1,vX.prototype.overloadedBoolean=!1,vX.prototype.property=``,vX.prototype.spaceSeparated=!1,vX.prototype.space=void 0;var yX=s({boolean:()=>bX,booleanish:()=>xX,commaOrSpaceSeparated:()=>TX,commaSeparated:()=>wX,number:()=>q,overloadedBoolean:()=>SX,spaceSeparated:()=>CX}),b_e=0,bX=EX(),xX=EX(),SX=EX(),q=EX(),CX=EX(),wX=EX(),TX=EX();function EX(){return 2**++b_e}var DX=Object.keys(yX),OX=class extends vX{constructor(e,t,n,r){let i=-1;if(super(e,t),kX(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&T_e.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(LX,O_e);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!LX.test(e)){let n=e.replace(w_e,D_e);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=OX}return new i(r,t)}function D_e(e){return`-`+e.toLowerCase()}function O_e(e){return e.charAt(1).toUpperCase()}var k_e=gX([jX,x_e,PX,FX,IX],`html`),RX=gX([jX,S_e,PX,FX,IX],`svg`);function A_e(e){return e.join(` `).trim()}var j_e=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` -`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),M_e=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(j_e());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),N_e=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),P_e=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(M_e()),r=N_e();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),zX=VX(`end`),BX=VX(`start`);function VX(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function F_e(e){let t=BX(e),n=zX(e);if(t&&n)return{start:t,end:n}}function HX(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?WX(e.position):`start`in e||`end`in e?WX(e):`line`in e||`column`in e?UX(e):``}function UX(e){return GX(e&&e.line)+`:`+GX(e&&e.column)}function WX(e){return UX(e&&e.start)+`-`+UX(e&&e.end)}function GX(e){return e&&typeof e==`number`?e:1}var KX=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=HX(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};KX.prototype.file=``,KX.prototype.name=``,KX.prototype.reason=``,KX.prototype.message=``,KX.prototype.stack=``,KX.prototype.column=void 0,KX.prototype.line=void 0,KX.prototype.ancestors=void 0,KX.prototype.cause=void 0,KX.prototype.fatal=void 0,KX.prototype.place=void 0,KX.prototype.ruleId=void 0,KX.prototype.source=void 0;var I_e=l(P_e(),1),qX={}.hasOwnProperty,L_e=new Map,R_e=/[A-Z]/g,z_e=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),B_e=new Set([`td`,`th`]),JX=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function V_e(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Y_e(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=J_e(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?RX:k_e,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=YX(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function YX(e,t,n){if(t.type===`element`)return H_e(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return U_e(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return G_e(e,t,n);if(t.type===`mdxjsEsm`)return W_e(e,t);if(t.type===`root`)return K_e(e,t,n);if(t.type===`text`)return q_e(e,t)}function H_e(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=RX,e.schema=i),e.ancestors.push(t);let a=$X(e,t.tagName,!1),o=X_e(e,t),s=QX(e,t);return z_e.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!y_e(e)})),XX(e,o,a,t),ZX(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function U_e(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}eZ(e,t.position)}function W_e(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);eZ(e,t.position)}function G_e(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=RX,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:$X(e,t.name,!0),o=Z_e(e,t),s=QX(e,t);return XX(e,o,a,t),ZX(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function K_e(e,t,n){let r={};return ZX(r,QX(e,t)),e.create(t,e.Fragment,r,n)}function q_e(e,t){return t.value}function XX(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ZX(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function J_e(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Y_e(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=BX(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function X_e(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&qX.call(t.properties,i)){let a=Q_e(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&B_e.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Z_e(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else eZ(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else eZ(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function QX(e,t){let n=[],r=-1,i=e.passKeys?new Map:L_e;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(sZ(e,e.length,0,t),e):t}var lZ={}.hasOwnProperty;function uZ(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function fZ(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var pZ=SZ(/[A-Za-z]/),mZ=SZ(/[\dA-Za-z]/),sve=SZ(/[#-'*+\--9=?A-Z^-~]/);function hZ(e){return e!==null&&(e<32||e===127)}var gZ=SZ(/\d/),cve=SZ(/[\dA-Fa-f]/),lve=SZ(/[!-/:-@[-`{-~]/);function _Z(e){return e!==null&&e<-2}function vZ(e){return e!==null&&(e<0||e===32)}function yZ(e){return e===-2||e===-1||e===32}var bZ=SZ(/\p{P}|\p{S}/u),xZ=SZ(/\s/);function SZ(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function CZ(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function wZ(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return yZ(r)?(e.enter(n),s(r)):t(r)}function s(r){return yZ(r)&&a++0&&yZ(t)?(e.enter(r),c(t)):l(t)}function c(t){return yZ(t)&&o=i?t(e):n(e)}}var uve={tokenize:dve};function dve(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),wZ(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return _Z(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var EZ=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){DZ(this,e,t,n,!1)}addBefore(e,t,n){DZ(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function DZ(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var fve={tokenize:pve},OZ={tokenize:mve};function pve(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(ro))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function mve(e,t,n){return wZ(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function kZ(e){if(e===null||vZ(e)||xZ(e))return 1;if(bZ(e))return 2}function AZ(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};MZ(o,-a),MZ(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=cZ(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=cZ(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=cZ(r,AZ(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=cZ(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=cZ(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),sZ(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n0&&yZ(t)?wZ(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||_Z(t)?e.check(LZ,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||_Z(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),yZ(t)?wZ(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),yZ(t)?wZ(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||_Z(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var zZ={name:`codeIndented`,tokenize:Ove},Dve={partial:!0,tokenize:kve};function Ove(e,t,n){return r;function r(t){return e.enter(`codeIndented`),TZ(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):_Z(t)?e.attempt(Dve,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||_Z(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function kve(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):_Z(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):TZ(e,t,a,`linePrefix`,4,4)(o)}function a(e){return _Z(e)?i(e):n(e)}}var Ave={name:`codeText`,previous:Mve,resolve:jve,tokenize:Nve};function jve(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&BZ(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),BZ(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),BZ(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function HZ(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||hZ(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||_Z(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||vZ(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):_Z(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||_Z(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!yZ(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function WZ(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):_Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),wZ(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||_Z(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function GZ(e,t){let n;return r;function r(i){return _Z(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):yZ(i)?wZ(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Vve={name:`definition`,tokenize:Uve},Hve={partial:!0,tokenize:Wve};function Uve(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return UZ.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=fZ(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return vZ(t)?GZ(e,l)(t):l(t)}function l(t){return HZ(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Hve,d,d)(t)}function d(t){return yZ(t)?wZ(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||_Z(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Wve(e,t,n){return r;function r(t){return vZ(t)?GZ(e,i)(t):n(t)}function i(t){return WZ(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return yZ(t)?wZ(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||_Z(e)?t(e):n(e)}}var Gve={name:`hardBreakEscape`,tokenize:Kve};function Kve(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return _Z(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var qve={name:`headingAtx`,resolve:Jve,tokenize:Yve};function Jve(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};sZ(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function Yve(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||vZ(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||_Z(n)?(e.exit(`atxHeading`),t(n)):yZ(n)?wZ(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||vZ(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Xve=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),KZ=[`pre`,`script`,`style`,`textarea`],Zve={concrete:!0,name:`htmlFlow`,resolveTo:$ve,tokenize:eye},Qve={partial:!0,tokenize:tye};function $ve(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function eye(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ee):pZ(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):pZ(a)?(e.consume(a),i=4,r.interrupt?t:ee):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ee):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return pZ(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||vZ(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&KZ.includes(l)?(i=1,r.interrupt?t(s):O(s)):Xve.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||mZ(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return yZ(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||pZ(t)?(e.consume(t),b):yZ(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||mZ(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):yZ(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):yZ(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||_Z(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||vZ(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||yZ(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||_Z(t)?O(t):yZ(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),I):t===63&&i===3?(e.consume(t),ee):t===93&&i===5?(e.consume(t),F):_Z(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Qve,te,k)(t)):t===null||_Z(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(LZ,A,te)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||_Z(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),ee):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return KZ.includes(n)?(e.consume(t),I):O(t)}return pZ(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),ee):O(t)}function ee(t){return t===62?(e.consume(t),I):t===45&&i===2?(e.consume(t),ee):O(t)}function I(t){return t===null||_Z(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),I)}function te(n){return e.exit(`htmlFlow`),t(n)}}function tye(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(NZ,t,n)}}var nye={name:`htmlText`,tokenize:rye};function rye(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):pZ(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):pZ(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):_Z(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):_Z(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):_Z(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):_Z(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return pZ(t)?(e.consume(t),S):n(t)}function S(t){return t===45||mZ(t)?(e.consume(t),S):C(t)}function C(t){return _Z(t)?(o=C,N(t)):yZ(t)?(e.consume(t),C):M(t)}function w(t){return t===45||mZ(t)?(e.consume(t),w):t===47||t===62||vZ(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||pZ(t)?(e.consume(t),E):_Z(t)?(o=T,N(t)):yZ(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||mZ(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):_Z(t)?(o=D,N(t)):yZ(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):_Z(t)?(o=O,N(t)):yZ(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):_Z(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||vZ(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||vZ(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return yZ(t)?wZ(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var qZ={name:`labelEnd`,resolveAll:sye,resolveTo:cye,tokenize:lye},iye={tokenize:uye},aye={tokenize:dye},oye={tokenize:fye};function sye(e){let t=-1,n=[];for(;++t0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(fZ(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(iye,u,o?u:d)(t):t===91?e.attempt(aye,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(oye,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function uye(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return vZ(t)?GZ(e,a)(t):a(t)}function a(t){return t===41?u(t):HZ(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return vZ(t)?GZ(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?WZ(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return vZ(t)?GZ(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function dye(e,t,n){let r=this;return i;function i(t){return UZ.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(fZ(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function fye(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var pye={name:`labelStartImage`,resolveAll:qZ.resolveAll,tokenize:mye};function mye(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var hye={name:`labelStartLink`,resolveAll:qZ.resolveAll,tokenize:gye};function gye(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var JZ={name:`lineEnding`,tokenize:_ye};function _ye(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),wZ(e,t,`linePrefix`)}}var YZ={name:`thematicBreak`,tokenize:vye};function vye(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||_Z(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),yZ(t)?wZ(e,s,`whitespace`)(t):s(t))}}var XZ={continuation:{tokenize:Sye},exit:wye,name:`list`,tokenize:xye},yye={partial:!0,tokenize:Tye},bye={partial:!0,tokenize:Cye};function xye(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:gZ(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(YZ,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return gZ(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(NZ,r.interrupt?n:u,e.attempt(yye,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return yZ(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Sye(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(NZ,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,wZ(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!yZ(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(bye,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,wZ(e,e.attempt(XZ,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Cye(e,t,n){let r=this;return wZ(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function wye(e){e.exit(this.containerState.type)}function Tye(e,t,n){let r=this;return wZ(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!yZ(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var ZZ={name:`setextUnderline`,resolveTo:Eye,tokenize:Dye};function Eye(e,t){let n=new EZ,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function Dye(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),yZ(t)?wZ(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||_Z(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Oye={tokenize:kye};function kye(e){let t=this,n=e.attempt(NZ,r,e.attempt(this.parser.constructs.flowInitial,i,wZ(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Ive,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Aye={resolveAll:$Z()},jye=QZ(`string`),Mye=QZ(`text`);function QZ(e){return{resolveAll:$Z(e===`text`?Nye:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++iHye,contentInitial:()=>Iye,disable:()=>Uye,document:()=>Fye,flow:()=>Rye,flowInitial:()=>Lye,insideSpan:()=>Vye,string:()=>zye,text:()=>Bye}),Fye={42:XZ,43:XZ,45:XZ,48:XZ,49:XZ,50:XZ,51:XZ,52:XZ,53:XZ,54:XZ,55:XZ,56:XZ,57:XZ,62:PZ},Iye={91:Vve},Lye={[-2]:zZ,[-1]:zZ,32:zZ},Rye={35:qve,42:YZ,45:[ZZ,YZ],60:Zve,61:ZZ,95:YZ,96:RZ,126:RZ},zye={38:IZ,92:FZ},Bye={[-5]:JZ,[-4]:JZ,[-3]:JZ,33:pye,38:IZ,42:jZ,60:[_ve,nye],91:hye,92:[Gve,FZ],93:qZ,95:jZ,96:Ave},Vye={null:[jZ,Aye]},Hye={null:[42,95]},Uye={null:[]};function Wye(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=cZ(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=AZ(a,l.events,l),l.events):[]}function f(e,t){return Kye(p(e),t)}function p(e){return Gye(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Kye(e,t){let n=-1,r=[],i;for(;++n`,m=l.join(p);this._showOrMove(a,function(){this._updateContentNotChangedOnAxis(e,s)?this._updatePosition(a,d,i[0],i[1],this._tooltipContent,s):this._showTooltipContent(a,m,s,Math.random()+``,i[0],i[1],d,null,u)})},t.prototype._showSeriesItemTooltip=function(e,t,n){var r=this._ecModel,i=yD(t),a=i.seriesIndex,o=r.getSeriesByIndex(a),s=i.dataModel||o,c=i.dataIndex,l=i.dataType,u=s.getData(l),d=this._renderMode,f=e.positionDefault,p=Qq([u.getItemModel(c),s,o&&(o.coordinateSystem||{}).model],this._tooltipModel,f?{position:f}:null),m=p.get(`trigger`);if(m==null||m===`item`){var h=s.getDataParams(c,l),g=new eN;h.marker=g.makeTooltipMarker(`item`,Ej(h.color),d);var _=wM(s.formatTooltip(c,!1,l)),v=p.get(`order`),y=p.get(`valueFormatter`),b=_.frag,x=b?XM(y?U({valueFormatter:y},b):b,g,d,v,r.get(`useUTC`),p.get(`textStyle`)):_.text,S=`item_`+s.name+`_`+c;this._showOrMove(p,function(){this._showTooltipContent(p,x,h,S,e.offsetX,e.offsetY,e.position,e.target,g)}),n({type:`showTip`,dataIndexInside:c,dataIndex:u.getRawIndex(c),seriesIndex:a,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,t,n){var r=this._renderMode===`html`,i=yD(t),a=i.tooltipConfig.option||{},o=a.encodeHTMLContent;if(Ob(a)){var s=a;a={content:s,formatter:s},o=!0}o&&r&&a.content&&(a=mb(a),a.content=PA(a.content));var c=[a],l=this._ecModel.getComponent(i.componentMainType,i.componentIndex);l&&c.push(l),c.push({formatter:a.content});var u=e.positionDefault,d=Qq(c,this._tooltipModel,u?{position:u}:null),f=d.get(`content`),p=Math.random()+``,m=new eN;this._showOrMove(d,function(){var n=mb(d.get(`formatterParams`)||{});this._showTooltipContent(d,f,n,p,e.offsetX,e.offsetY,e.position,t,m)}),n({type:`showTip`,from:this.uid})},t.prototype._showTooltipContent=function(e,t,n,r,i,a,o,s,c){if(this._ticket=``,e.get(`showContent`)&&e.get(`show`)){var l=this._tooltipContent;l.setEnterable(e.get(`enterable`));var u=e.get(`formatter`);o||=e.get(`position`);var d=t,f=this._getNearestPoint([i,a],n,e.get(`trigger`),e.get(`borderColor`),e.get(`defaultBorderColor`,!0)).color;if(u){if(Ob(u)){var p=e.ecModel.get(`useUTC`),m=G(n)?n[0]:n,h=m&&m.axisType&&m.axisType.indexOf(`time`)>=0;d=u,h&&(d=rj(m.axisValue,d,p)),d=Tj(d,n,!0)}else if(Db(u)){var g=Tb(function(t,r){t===this._ticket&&(l.setContent(r,c,e,f,o),this._updatePosition(e,o,i,a,l,n,s))},this);this._ticket=r,d=u(n,r,g)}else d=u}l.setContent(d,c,e,f,o),l.show(e,f),this._updatePosition(e,o,i,a,l,n,s)}},t.prototype._getNearestPoint=function(e,t,n,r,i){if(n===`axis`||G(t))return{color:r||i};if(!G(t))return{color:r||t.color||t.borderColor}},t.prototype._updatePosition=function(e,t,n,r,i,a,o){var s=this._api.getWidth(),c=this._api.getHeight();t||=e.get(`position`);var l=i.getSize(),u=e.get(`align`),d=e.get(`verticalAlign`),f=o&&o.getBoundingRect().clone();if(o&&f.applyTransform(o.transform),Db(t)&&(t=t([n,r],a,i.el,f,{viewSize:[s,c],contentSize:l.slice()})),G(t))n=fx(t[0],s),r=fx(t[1],c);else if(jb(t)){var p=t;p.width=l[0],p.height=l[1];var m=Ij(p,{width:s,height:c});n=m.x,r=m.y,u=null,d=null}else if(Ob(t)&&o){var h=nJ(t,f,l,e.get(`borderWidth`));n=h[0],r=h[1]}else{var h=eJ(n,r,i,s,c,u?null:20,d?null:20);n=h[0],r=h[1]}if(u&&(n-=rJ(u)?l[0]/2:u===`right`?l[0]:0),d&&(r-=rJ(d)?l[1]/2:d===`bottom`?l[1]:0),kq(e)){var h=tJ(n,r,i,s,c);n=h[0],r=h[1]}i.moveTo(n,r)},t.prototype._updateContentNotChangedOnAxis=function(e,t){var n=this._lastDataByCoordSys,r=this._cbParamsList,i=!!n&&n.length===e.length;return i&&W(n,function(n,a){var o=n.dataByAxis||[],s=(e[a]||{}).dataByAxis||[];i&&=o.length===s.length,i&&W(o,function(e,n){var a=s[n]||{},o=e.seriesDataIndices||[],c=a.seriesDataIndices||[];i=i&&e.value===a.value&&e.axisType===a.axisType&&e.axisId===a.axisId&&o.length===c.length,i&&W(o,function(e,t){var n=c[t];i=i&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex}),r&&W(e.seriesDataIndices,function(e){var n=e.seriesIndex,a=t[n],o=r[n];a&&o&&o.data!==a.data&&(i=!1)})})}),this._lastDataByCoordSys=e,this._cbParamsList=t,!!i},t.prototype._hide=function(e){this._lastDataByCoordSys=null,this._cbParamsList=null,e({type:`hideTip`,from:this.uid})},t.prototype.dispose=function(e,t){!$b.node&&t.getDom()&&(wR(this,`_updatePosition`),this._tooltipContent.dispose(),bG(`itemTooltip`,t),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type=`tooltip`,t}(pR);function Qq(e,t,n){var r=t.ecModel,i;n?(i=new TA(n,r,r),i=new TA(t.option,i,r)):i=t;for(var a=e.length-1;a>=0;a--){var o=e[a];o&&(o instanceof TA&&(o=o.get(`tooltip`,!0)),Ob(o)&&(o={formatter:o}),o&&(i=new TA(o,i,r)))}return i}function $q(e,t){return e.dispatchAction||Tb(t.dispatchAction,t)}function eJ(e,t,n,r,i,a,o){var s=n.getSize(),c=s[0],l=s[1];return a!=null&&(e+c+a+2>r?e-=c+a:e+=a),o!=null&&(t+l+o>i?t-=l+o:t+=o),[e,t]}function tJ(e,t,n,r,i){var a=n.getSize(),o=a[0],s=a[1];return e=Math.min(e+o,r)-o,t=Math.min(t+s,i)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function nJ(e,t,n,r){var i=n[0],a=n[1],o=Math.ceil(Math.SQRT2*r)+8,s=0,c=0,l=t.width,u=t.height;switch(e){case`inside`:s=t.x+l/2-i/2,c=t.y+u/2-a/2;break;case`top`:s=t.x+l/2-i/2,c=t.y-a-o;break;case`bottom`:s=t.x+l/2-i/2,c=t.y+u+o;break;case`left`:s=t.x-i-o,c=t.y+u/2-a/2;break;case`right`:s=t.x+l+o,c=t.y+u/2-a/2}return[s,c]}function rJ(e){return e===`center`||e===`middle`}function iJ(e,t,n){var r=mS(e).queryOptionMap,i=r.keys()[0];if(i&&i!==`series`){var a=_S(t,i,r.get(i),{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];if(a){var o=n.getViewOfComponentModel(a),s;if(o.group.traverse(function(t){var n=yD(t).tooltipConfig;if(n&&n.name===e.name)return s=t,!0}),s)return{componentMainType:i,componentIndex:a.componentIndex,el:s}}}}function aJ(e){IB(FG),e.registerComponentModel(Oq),e.registerComponentView(Zq),e.registerAction({type:`showTip`,event:`showTip`,update:`tooltip:manuallyShowTip`},Qb),e.registerAction({type:`hideTip`,event:`hideTip`,update:`tooltip:manuallyHideTip`},Qb)}var oJ=[`rect`,`polygon`,`keep`,`clear`];function sJ(e,t){var n=Ux(e?e.brush:[]);if(n.length){var r=[];W(n,function(e){var t=e.hasOwnProperty(`toolbox`)?e.toolbox:[];t instanceof Array&&(r=r.concat(t))});var i=e&&e.toolbox;G(i)&&(i=i[0]),i||(i={feature:{}},e.toolbox=[i]);var a=i.feature||(i.feature={}),o=a.brush||={},s=o.type||=[];s.push.apply(s,r),jS(s,function(e){return e+``},null),t&&!s.length&&s.push.apply(s,oJ)}}var cJ=W;function lJ(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function uJ(e,t,n){var r={};return cJ(t,function(t){var a=r[t]=i();cJ(e[t],function(e,r){if(BH.isValidType(r)){var i={type:r,visual:e};n&&n(i,t),a[r]=new BH(i),r===`opacity`&&(i=mb(i),i.type=`colorAlpha`,a.__hidden.__alphaForOpacity=new BH(i))}})}),r;function i(){var e=function(){};return e.prototype.__hidden=e.prototype,new e}}function dJ(e,t,n){var r;W(n,function(e){t.hasOwnProperty(e)&&lJ(t[e])&&(r=!0)}),r&&W(n,function(n){t.hasOwnProperty(n)&&lJ(t[n])?e[n]=mb(t[n]):delete e[n]})}function fJ(e,t,n,r,i,a){var o={};W(e,function(e){o[e]=BH.prepareVisualTypes(t[e])});var s;function c(e){return WR(n,s,e)}function l(e,t){KR(n,s,e,t)}a==null?n.each(u):n.each([a],u);function u(e,u){s=a==null?e:u;var d=n.getRawDataItem(s);if(!(d&&d.visualMap===!1))for(var f=r.call(i,e),p=t[f],m=o[f],h=0,g=m.length;ht[0][1]&&(t[0][1]=a[0]),a[1]t[1][1]&&(t[1][1]=a[1])}return t&&kJ(t)}};function kJ(e){return new OC(e[0][0],e[1][0],e[0][1]-e[0][0],e[1][1]-e[1][0])}var Mhe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(e,t){this.ecModel=e,this.api=t,this.model,(this._brushController=new _U(t.getZr())).on(`brush`,Tb(this._onBrush,this)).mount()},t.prototype.render=function(e,t,n,r){this.model=e,this._updateController(e,t,n,r)},t.prototype.updateTransform=function(e,t,n,r){xJ(t),this._updateController(e,t,n,r)},t.prototype.updateVisual=function(e,t,n,r){this.updateTransform(e,t,n,r)},t.prototype.updateView=function(e,t,n,r){this._updateController(e,t,n,r)},t.prototype._updateController=function(e,t,n,r){(!r||r.$from!==e.id)&&this._brushController.setPanels(e.brushTargetManager.makePanelOpts(n)).enableBrush(e.brushOption).updateCovers(e.areas.slice())},t.prototype.dispose=function(){this._brushController.dispose()},t.prototype._onBrush=function(e){var t=this.model.id,n=this.model.brushTargetManager.setOutputRanges(e.areas,this.ecModel);(!e.isEnd||e.removeOnClick)&&this.api.dispatchAction({type:`brush`,brushId:t,areas:mb(n),$from:t}),e.isEnd&&this.api.dispatchAction({type:`brushEnd`,brushId:t,areas:mb(n),$from:t})},t.type=`brush`,t}(pR),Nhe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.areas=[],n.brushOption={},n}return t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&dJ(n,e,[`inBrush`,`outOfBrush`]);var r=n.inBrush=n.inBrush||{};n.outOfBrush=n.outOfBrush||{color:this.option.defaultOutOfBrushColor},r.hasOwnProperty(`liftZ`)||(r.liftZ=5)},t.prototype.setAreas=function(e){e&&(this.areas=bb(e,function(e){return AJ(this.option,e)},this))},t.prototype.setBrushOption=function(e){this.brushOption=AJ(this.option,e),this.brushType=this.brushOption.brushType},t.type=`brush`,t.dependencies=[`geo`,`grid`,`xAxis`,`yAxis`,`parallel`,`series`],t.defaultOption={seriesIndex:`all`,brushType:`rect`,brushMode:`single`,transformable:!0,brushStyle:{borderWidth:1,color:K.color.backgroundTint,borderColor:K.color.borderTint},throttleType:`fixRate`,throttleDelay:0,removeOnClick:!0,z:1e4,defaultOutOfBrushColor:K.color.disabled},t}(Wj);function AJ(e,t){return hb({brushType:e.brushType,brushMode:e.brushMode,transformable:e.transformable,brushStyle:new TA(e.brushStyle).getItemStyle(),removeOnClick:e.removeOnClick,z:e.z},t,!0)}var Phe=[`rect`,`polygon`,`lineX`,`lineY`,`keep`,`clear`],Fhe=function(e){H(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(e,t,n){var r,i,a;t.eachComponent({mainType:`brush`},function(e){r=e.brushType,i=e.brushOption.brushMode||`single`,a||=!!e.areas.length}),this._brushType=r,this._brushMode=i,W(e.get(`type`,!0),function(t){e.setIconStatus(t,(t===`keep`?i===`multiple`:t===`clear`?a:t===r)?`emphasis`:`normal`)})},t.prototype.updateView=function(e,t,n){this.render(e,t,n)},t.prototype.getIcons=function(){var e=this.model,t=e.get(`icon`,!0),n={};return W(e.get(`type`,!0),function(e){t[e]&&(n[e]=t[e])}),n},t.prototype.onclick=function(e,t,n){var r=this._brushType,i=this._brushMode;n===`clear`?(t.dispatchAction({type:`axisAreaSelect`,intervals:[]}),t.dispatchAction({type:`brush`,command:`clear`,areas:[]})):t.dispatchAction({type:`takeGlobalCursor`,key:`brush`,brushOption:{brushType:n===`keep`?r:r!==n&&n,brushMode:n===`keep`?i===`multiple`?`single`:`multiple`:i}})},t.getDefaultOption=function(e){return{show:!0,type:Phe.slice(),icon:{rect:`M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13`,polygon:`M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2`,lineX:`M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4`,lineY:`M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4`,keep:`M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z`,clear:`M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2`},title:e.getLocaleModel().get([`toolbox`,`brush`,`title`])}},t}(wK);function Ihe(e){e.registerComponentView(Mhe),e.registerComponentModel(Nhe),e.registerPreprocessor(sJ),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,SJ),e.registerAction({type:`brush`,event:`brush`,update:`updateVisual`},function(e,t){t.eachComponent({mainType:`brush`,query:e},function(t){t.setAreas(e.areas)})}),e.registerAction({type:`brushSelect`,event:`brushSelected`,update:`none`},Qb),e.registerAction({type:`brushEnd`,event:`brushEnd`,update:`none`},Qb),EK(`brush`,Fhe)}function jJ(e,t){if(!e)return!1;for(var n=G(e)?e:[e],r=0;r=0&&(s[o]=+s[o].toFixed(f)),[s,d]}var LJ={min:Eb(IJ,`min`),max:Eb(IJ,`max`),average:Eb(IJ,`average`),median:Eb(IJ,`median`)};function RJ(e,t){if(t){var n=e.getData(),r=e.coordinateSystem,i=r&&r.dimensions;if(!Lhe(t)&&!G(t.coord)&&G(i)){var a=zJ(t,n,r,e);if(t=mb(t),t.type&&LJ[t.type]&&a.baseAxis&&a.valueAxis){var o=_b(i,a.baseAxis.dim),s=_b(i,a.valueAxis.dim),c=LJ[t.type](n,a.valueAxis.dim,a.baseDataDim,a.valueDataDim,o,s);t.coord=c[0],t.value=c[1]}else t.coord=[t.xAxis==null?t.radiusAxis:t.xAxis,t.yAxis==null?t.angleAxis:t.yAxis]}if(t.coord==null||!G(i)){t.coord=[];var l=e.getBaseAxis();if(l&&t.type&&LJ[t.type]){var u=r.getOtherAxis(l);u&&(t.value=VJ(n,n.mapDimension(u.dim),t.type))}}else for(var d=t.coord,f=0;f<2;f++)LJ[d[f]]&&(d[f]=VJ(n,n.mapDimension(i[f]),d[f]));return t}}function zJ(e,t,n,r){var i={};return e.valueIndex!=null||e.valueDim!=null?(i.valueDataDim=e.valueIndex==null?e.valueDim:t.getDimension(e.valueIndex),i.valueAxis=n.getAxis(Rhe(r,i.valueDataDim)),i.baseAxis=n.getOtherAxis(i.valueAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim)):(i.baseAxis=r.getBaseAxis(),i.valueAxis=n.getOtherAxis(i.baseAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim),i.valueDataDim=t.mapDimension(i.valueAxis.dim)),i}function Rhe(e,t){var n=e.getData().getDimensionInfo(t);return n&&n.coordDim}function BJ(e,t){return e&&e.containData&&t.coord&&!FJ(t)?e.containData(t.coord):!0}function zhe(e,t,n){return e&&e.containZone&&t.coord&&n.coord&&!FJ(t)&&!FJ(n)?e.containZone(t.coord,n.coord):!0}function Bhe(e,t){return e?function(e,n,r,i){return DM(i<2?e.coord&&e.coord[i]:e.value,t[i])}:function(e,n,r,i){return DM(e.value,t[i])}}function VJ(e,t,n){if(n===`average`){var r=0,i=0;return e.each(t,function(e,t){isNaN(e)||(r+=e,i++)}),r/i}return n===`median`?e.getMedian(t):e.getDataExtent(t)[+(n===`max`)]}var HJ=dS(),UJ=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(){this.markerGroupMap=Jb()},t.prototype.render=function(e,t,n){var r=this,i=this.markerGroupMap;i.each(function(e){HJ(e).keep=!1}),t.eachSeries(function(e){var i=PJ.getMarkerModelFromSeries(e,r.type);i&&r.renderSeries(e,i,t,n)}),i.each(function(e){!HJ(e).keep&&r.group.remove(e.group)}),Vhe(t,i,this.type)},t.prototype.markKeep=function(e){HJ(e).keep=!0},t.prototype.toggleBlurSeries=function(e,t){var n=this;W(e,function(e){var r=PJ.getMarkerModelFromSeries(e,n.type);r&&r.getData().eachItemGraphicEl(function(e){e&&(t?oO(e):sO(e))})})},t.type=`marker`,t}(pR);function Vhe(e,t,n){e.eachSeries(function(e){var r=PJ.getMarkerModelFromSeries(e,n),i=t.get(e.id);if(r&&i&&i.group){var a=rA(r),o=a.z,s=a.zlevel;iA(i.group,o,s)}})}var Hhe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.createMarkerModelFromSeries=function(e,n,r){return new t(e,n,r)},t.type=`markLine`,t.defaultOption={z:5,symbol:[`circle`,`arrow`],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:`item`},label:{show:!0,position:`end`,distance:5},lineStyle:{type:`dashed`},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:`linear`},t}(PJ),WJ=dS(),Uhe=function(e,t,n,r){var i=e.getData(),a;if(G(r))a=r;else{var o=r.type;if(o===`min`||o===`max`||o===`average`||o===`median`||r.xAxis!=null||r.yAxis!=null){var s=void 0,c=void 0;if(r.yAxis!=null||r.xAxis!=null)s=t.getAxis(r.yAxis==null?`x`:`y`),c=Lb(r.yAxis,r.xAxis);else{var l=zJ(r,i,t,e);s=l.valueAxis,c=VJ(i,nF(i,l.valueDataDim),o)}var u=s.dim===`x`?0:1,d=1-u,f=mb(r),p={coord:[]};f.type=null,f.coord=[],f.coord[d]=-1/0,p.coord[d]=1/0;var m=n.get(`precision`);m>=0&&Ab(c)&&(c=+c.toFixed(Math.min(m,20))),f.coord[u]=p.coord[u]=c,a=[f,p,{type:o,valueIndex:r.valueIndex,value:c}]}else a=[]}var h=[RJ(e,a[0]),RJ(e,a[1]),U({},a[2])];return h[2].type=h[2].type||null,hb(h[2],h[0]),hb(h[2],h[1]),h};function GJ(e){return!isNaN(e)&&!isFinite(e)}function KJ(e,t,n,r){var i=1-e,a=r.dimensions[e];return GJ(t[i])&&GJ(n[i])&&t[e]===n[e]&&r.getAxis(a).containData(t[e])}function Whe(e,t){if(e.type===`cartesian2d`){var n=t[0].coord,r=t[1].coord;if(n&&r&&(KJ(1,n,r,e)||KJ(0,n,r,e)))return!0}return BJ(e,t[0])&&BJ(e,t[1])}function qJ(e,t,n,r,i){var a=r.coordinateSystem,o=e.getItemModel(t),s,c=fx(o.get(`x`),i.getWidth()),l=fx(o.get(`y`),i.getHeight());if(!isNaN(c)&&!isNaN(l))s=[c,l];else{if(r.getMarkerPosition)s=r.getMarkerPosition(e.getValues(e.dimensions,t));else{var u=a.dimensions,d=e.get(u[0],t),f=e.get(u[1],t);s=a.dataToPoint([d,f])}if(LV(a,`cartesian2d`)){var p=a.getAxis(`x`),m=a.getAxis(`y`),u=a.dimensions;GJ(e.get(u[0],t))?s[0]=p.toGlobalCoord(p.getExtent()[+!n]):GJ(e.get(u[1],t))&&(s[1]=m.toGlobalCoord(m.getExtent()[+!n]))}isNaN(c)||(s[0]=c),isNaN(l)||(s[1]=l)}e.setItemLayout(t,s)}var Ghe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=PJ.getMarkerModelFromSeries(e,`markLine`);if(t){var r=t.getData(),i=WJ(t).from,a=WJ(t).to;i.each(function(t){qJ(i,t,!0,e,n),qJ(a,t,!1,e,n)}),r.each(function(e){r.setItemLayout(e,[i.getItemLayout(e),a.getItemLayout(e)])}),this.markerGroupMap.get(e.id).updateLayout()}},this)},t.prototype.renderSeries=function(e,t,n,r){var i=e.coordinateSystem,a=e.id,o=e.getData(),s=this.markerGroupMap,c=s.get(a)||s.set(a,new Ame);this.group.add(c.group);var l=Khe(i,e,t),u=l.from,d=l.to,f=l.line;WJ(t).from=u,WJ(t).to=d,t.setData(f);var p=t.get(`symbol`),m=t.get(`symbolSize`),h=t.get(`symbolRotate`),g=t.get(`symbolOffset`);G(p)||(p=[p,p]),G(m)||(m=[m,m]),G(h)||(h=[h,h]),G(g)||(g=[g,g]),l.from.each(function(e){_(u,e,!0),_(d,e,!1)}),f.each(function(e){var t=f.getItemModel(e),n=t.getModel(`lineStyle`).getLineStyle();f.setItemLayout(e,[u.getItemLayout(e),d.getItemLayout(e)]);var r=t.get(`z2`);n.stroke??=u.getItemVisual(e,`style`).fill,f.setItemVisual(e,{z2:Rb(r,0),fromSymbolKeepAspect:u.getItemVisual(e,`symbolKeepAspect`),fromSymbolOffset:u.getItemVisual(e,`symbolOffset`),fromSymbolRotate:u.getItemVisual(e,`symbolRotate`),fromSymbolSize:u.getItemVisual(e,`symbolSize`),fromSymbol:u.getItemVisual(e,`symbol`),toSymbolKeepAspect:d.getItemVisual(e,`symbolKeepAspect`),toSymbolOffset:d.getItemVisual(e,`symbolOffset`),toSymbolRotate:d.getItemVisual(e,`symbolRotate`),toSymbolSize:d.getItemVisual(e,`symbolSize`),toSymbol:d.getItemVisual(e,`symbol`),style:n})}),c.updateData(f),l.line.eachItemGraphicEl(function(e){yD(e).dataModel=t,e.traverse(function(e){yD(e).dataModel=t})});function _(t,n,i){var a=t.getItemModel(n);qJ(t,n,i,e,r);var s=a.getModel(`itemStyle`).getItemStyle();s.fill??=GR(o,`color`),t.setItemVisual(n,{symbolKeepAspect:a.get(`symbolKeepAspect`),symbolOffset:Rb(a.get(`symbolOffset`,!0),g[+!i]),symbolRotate:Rb(a.get(`symbolRotate`,!0),h[+!i]),symbolSize:Rb(a.get(`symbolSize`),m[+!i]),symbol:Rb(a.get(`symbol`,!0),p[+!i]),style:s})}this.markKeep(c),c.group.silent=t.get(`silent`)||e.get(`silent`)},t.type=`markLine`,t}(UJ);function Khe(e,t,n){var r=e?bb(e&&e.dimensions,function(e){var n=t.getData();return U(U({},n.getDimensionInfo(n.mapDimension(e))||{}),{name:e,ordinalMeta:null})}):[{name:`value`,type:`float`}],i=new YB(r,n),a=new YB(r,n),o=new YB([],n),s=bb(n.get(`data`),Eb(Uhe,t,e,n));e&&(s=Sb(s,Eb(Whe,e)));var c=Bhe(!!e,r);return i.initData(bb(s,function(e){return e[0]}),null,c),a.initData(bb(s,function(e){return e[1]}),null,c),o.initData(bb(s,function(e){return e[2]})),o.hasItemOption=!0,{from:i,to:a,line:o}}function qhe(e){e.registerComponentModel(Hhe),e.registerComponentView(Ghe),e.registerPreprocessor(function(e){jJ(e.series,`markLine`)&&(e.markLine=e.markLine||{})})}var Jhe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.createMarkerModelFromSeries=function(e,n,r){return new t(e,n,r)},t.type=`markArea`,t.defaultOption={z:1,tooltip:{trigger:`item`},animation:!1,label:{show:!0,position:`top`},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:`top`}}},t}(PJ),JJ=dS(),Yhe=function(e,t,n,r){var i=r[0],a=r[1];if(i&&a){var o=RJ(e,i),s=RJ(e,a),c=o.coord,l=s.coord;c[0]=Lb(c[0],-1/0),c[1]=Lb(c[1],-1/0),l[0]=Lb(l[0],1/0),l[1]=Lb(l[1],1/0);var u=Qre([{},o,s]);return u.coord=[o.coord,s.coord],u.x0=o.x,u.y0=o.y,u.x1=s.x,u.y1=s.y,u}};function YJ(e){return!isNaN(e)&&!isFinite(e)}function XJ(e,t,n,r){var i=1-e;return YJ(t[i])&&YJ(n[i])}function Xhe(e,t){var n=t.coord[0],r=t.coord[1],i={coord:n,x:t.x0,y:t.y0},a={coord:r,x:t.x1,y:t.y1};return LV(e,`cartesian2d`)?n&&r&&(XJ(1,n,r,e)||XJ(0,n,r,e))?!0:zhe(e,i,a):BJ(e,i)||BJ(e,a)}function ZJ(e,t,n,r,i){var a=r.coordinateSystem,o=e.getItemModel(t),s,c=fx(o.get(n[0]),i.getWidth()),l=fx(o.get(n[1]),i.getHeight());if(!isNaN(c)&&!isNaN(l))s=[c,l];else{if(r.getMarkerPosition){var u=e.getValues([`x0`,`y0`],t),d=e.getValues([`x1`,`y1`],t),f=a.clampData(u),p=a.clampData(d),m=[];m[0]=n[0]===`x0`?f[0]>p[0]?d[0]:u[0]:f[0]>p[0]?u[0]:d[0],m[1]=n[1]===`y0`?f[1]>p[1]?d[1]:u[1]:f[1]>p[1]?u[1]:d[1],s=r.getMarkerPosition(m,n,!0)}else{var h=e.get(n[0],t),g=e.get(n[1],t),_=[h,g];a.clampData&&a.clampData(_,_),s=a.dataToPoint(_,!0)}if(LV(a,`cartesian2d`)){var v=a.getAxis(`x`),y=a.getAxis(`y`),h=e.get(n[0],t),g=e.get(n[1],t);YJ(h)?s[0]=v.toGlobalCoord(v.getExtent()[n[0]===`x0`?0:1]):YJ(g)&&(s[1]=y.toGlobalCoord(y.getExtent()[n[1]===`y0`?0:1]))}isNaN(c)||(s[0]=c),isNaN(l)||(s[1]=l)}return s}var QJ=[[`x0`,`y0`],[`x1`,`y0`],[`x1`,`y1`],[`x0`,`y1`]],Zhe=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=PJ.getMarkerModelFromSeries(e,`markArea`);if(t){var r=t.getData();r.each(function(t){var i=bb(QJ,function(i){return ZJ(r,t,i,e,n)});r.setItemLayout(t,i),r.getItemGraphicEl(t).setShape(`points`,i)})}},this)},t.prototype.renderSeries=function(e,t,n,r){var i=e.coordinateSystem,a=e.id,o=e.getData(),s=this.markerGroupMap,c=s.get(a)||s.set(a,{group:new LO});this.group.add(c.group),this.markKeep(c);var l=Qhe(i,e,t);t.setData(l),l.each(function(t){var n=bb(QJ,function(n){return ZJ(l,t,n,e,r)}),a=i.getAxis(`x`).scale,s=i.getAxis(`y`).scale,c=a.getExtent(),u=s.getExtent(),d=[a.parse(l.get(`x0`,t)),a.parse(l.get(`x1`,t))],f=[s.parse(l.get(`y0`,t)),s.parse(l.get(`y1`,t))];hx(d),hx(f);var p=c[0]>d[1]||c[1]f[1]||u[1]=0},t.prototype.getOrient=function(){return this.get(`orient`)===`vertical`?{index:1,name:`vertical`}:{index:0,name:`horizontal`}},t.type=`legend.plain`,t.dependencies=[`series`],t.defaultOption={z:4,show:!0,orient:`horizontal`,left:`center`,bottom:K.size.m,align:`auto`,backgroundColor:K.color.transparent,borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:`inherit`,symbolKeepAspect:!0,inactiveColor:K.color.disabled,inactiveBorderColor:K.color.disabled,inactiveBorderWidth:`auto`,itemStyle:{color:`inherit`,opacity:`inherit`,borderColor:`inherit`,borderWidth:`auto`,borderCap:`inherit`,borderJoin:`inherit`,borderDashOffset:`inherit`,borderMiterLimit:`inherit`},lineStyle:{width:`auto`,color:`inherit`,inactiveColor:K.color.disabled,inactiveWidth:2,opacity:`inherit`,type:`inherit`,cap:`inherit`,join:`inherit`,dashOffset:`inherit`,miterLimit:`inherit`},textStyle:{color:K.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:`sans-serif`,color:K.color.tertiary,borderWidth:1,borderColor:K.color.border},emphasis:{selectorLabel:{show:!0,color:K.color.quaternary}},selectorPosition:`auto`,selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(Wj),eY=Eb,tY=W,nY=LO,rY=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return t.prototype.init=function(){this.group.add(this._contentGroup=new nY),this.group.add(this._selectorGroup=new nY),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,t,n){var r=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),e.get(`show`,!0)){var i=e.get(`align`),a=e.get(`orient`);(!i||i===`auto`)&&(i=e.get(`left`)===`right`&&a===`vertical`?`right`:`left`);var o=e.get(`selector`,!0),s=e.get(`selectorPosition`,!0);o&&(!s||s===`auto`)&&(s=a===`horizontal`?`end`:`start`),this.renderInner(i,e,t,n,o,a,s);var c=Rj(e,n).refContainer,l=e.getBoxLayoutParams(),u=e.get(`padding`),d=Ij(l,c,u),f=this.layoutInner(e,i,d,r,o,s),p=Ij(gb({width:f.width,height:f.height},l),c,u);this.group.x=p.x-f.x,this.group.y=p.y-f.y,this.group.markRedraw(),this.group.add(this._backgroundEl=kK(f,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,t,n,r,i,a,o){var s=this.getContentGroup(),c=Jb(),l=t.get(`selectedMode`),u=t.get(`triggerEvent`),d=[];n.eachRawSeries(function(e){!e.get(`legendHoverLink`)&&d.push(e.id)}),tY(t.getData(),function(i,a){var o=this,f=i.get(`name`);if(!this.newlineDisabled&&(f===``||f===` +`)){var p=new nY;p.newline=!0,s.add(p);return}var m=n.getSeriesByName(f)[0];if(!c.get(f)){if(m){var h=m.getData(),g=h.getVisual(`legendLineStyle`)||{},_=h.getVisual(`legendIcon`),v=h.getVisual(`style`),y=this._createItem(m,f,a,i,t,e,g,v,_,l,r);y.on(`click`,eY(iY,f,null,r,d)).on(`mouseover`,eY(aY,m.name,null,r,d)).on(`mouseout`,eY(oY,m.name,null,r,d)),n.ssr&&y.eachChild(function(e){var t=yD(e);t.seriesIndex=m.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&y.eachChild(function(e){o.packEventData(e,t,m,a,f)}),c.set(f,!0)}else n.eachRawSeries(function(o){var s=this;if(!c.get(f)&&o.legendVisualProvider){var p=o.legendVisualProvider;if(!p.containName(f))return;var m=p.indexOfName(f),h=p.getItemVisual(m,`style`),g=p.getItemVisual(m,`legendIcon`),_=tT(h.fill);_&&_[3]===0&&(_[3]=.2,h=U(U({},h),{fill:sT(_,`rgba`)}));var v=this._createItem(o,f,a,i,t,e,{},h,g,l,r);v.on(`click`,eY(iY,null,f,r,d)).on(`mouseover`,eY(aY,null,f,r,d)).on(`mouseout`,eY(oY,null,f,r,d)),n.ssr&&v.eachChild(function(e){var t=yD(e);t.seriesIndex=o.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&v.eachChild(function(e){s.packEventData(e,t,o,a,f)}),c.set(f,!0)}},this)}},this),i&&this._createSelector(i,t,r,a,o)},t.prototype.packEventData=function(e,t,n,r,i){var a={componentType:`legend`,componentIndex:t.componentIndex,dataIndex:r,value:i,seriesIndex:n.seriesIndex};yD(e).eventData=a},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();tY(e,function(e){var r=e.type,i=new aD({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),uA(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),gO(i)})},t.prototype._createItem=function(e,t,n,r,i,a,o,s,c,l,u){var d=e.visualDrawType,f=i.get(`itemWidth`),p=i.get(`itemHeight`),m=i.isSelected(t),h=r.get(`symbolRotate`),g=r.get(`symbolKeepAspect`),_=r.get(`icon`);c=_||c||`roundRect`;var v=tge(c,r,o,s,d,m,u),y=new nY,b=r.getModel(`textStyle`);if(Db(e.getLegendIcon)&&(!_||_===`inherit`))y.add(e.getLegendIcon({itemWidth:f,itemHeight:p,icon:c,iconRotate:h,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}));else{var x=_===`inherit`&&e.getData().getVisual(`symbol`)?h===`inherit`?e.getData().getVisual(`symbolRotate`):h:0;y.add(nge({itemWidth:f,itemHeight:p,icon:c,iconRotate:x,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}))}var S=a===`left`?f+5:-5,C=a,w=i.get(`formatter`),T=t;Ob(w)&&w?T=w.replace(`{name}`,t??``):Db(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new aD({style:fA(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new eD({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&Xk({el:D,componentModel:i,itemName:t,itemTooltipOption:O.option}),y.add(D),y.eachChild(function(e){e.silent=!0}),D.silent=!l,this.getContentGroup().add(y),gO(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();Fj(e.get(`orient`),o,e.get(`itemGap`),n.width,n.height);var c=o.getBoundingRect(),l=[-c.x,-c.y];if(s.markRedraw(),o.markRedraw(),i){Fj(`horizontal`,s,e.get(`selectorItemGap`,!0));var u=s.getBoundingRect(),d=[-u.x,-u.y],f=e.get(`selectorButtonGap`,!0),p=e.getOrient().index,m=p===0?`width`:`height`,h=p===0?`height`:`width`,g=p===0?`y`:`x`;a===`end`?d[p]+=c[m]+f:l[p]+=u[m]+f,d[1-p]+=c[h]/2-u[h]/2,s.x=d[0],s.y=d[1],o.x=l[0],o.y=l[1];var _={x:0,y:0};return _[m]=c[m]+f+u[m],_[h]=Math.max(c[h],u[h]),_[g]=Math.min(0,u[g]+d[1-p]),_}return o.x=l[0],o.y=l[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type=`legend.plain`,t}(pR);function tge(e,t,n,r,i,a,o){function s(e,t){e.lineWidth===`auto`&&(e.lineWidth=t.lineWidth>0?2:0),tY(e,function(n,r){e[r]===`inherit`&&(e[r]=t[r])})}var c=t.getModel(`itemStyle`),l=c.getItemStyle(),u=e.lastIndexOf(`empty`,0)===0?`fill`:`stroke`,d=c.getShallow(`decal`);l.decal=!d||d===`inherit`?r.decal:Tz(d,o),l.fill===`inherit`&&(l.fill=r[i]),l.stroke===`inherit`&&(l.stroke=r[u]),l.opacity===`inherit`&&(l.opacity=(i===`fill`?r:n).opacity),s(l,r);var f=t.getModel(`lineStyle`),p=f.getLineStyle();if(s(p,n),l.fill===`auto`&&(l.fill=r.fill),l.stroke===`auto`&&(l.stroke=r.fill),p.stroke===`auto`&&(p.stroke=r.fill),!a){var m=t.get(`inactiveBorderWidth`),h=l[u];l.lineWidth=m===`auto`?r.lineWidth>0&&h?2:0:l.lineWidth,l.fill=t.get(`inactiveColor`),l.stroke=t.get(`inactiveBorderColor`),p.stroke=f.get(`inactiveColor`),p.lineWidth=f.get(`inactiveWidth`)}return{itemStyle:l,lineStyle:p}}function nge(e){var t=e.icon||`roundRect`,n=aI(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return n.setStyle(e.itemStyle),n.rotation=(e.iconRotate||0)*Math.PI/180,n.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf(`empty`)>-1&&(n.style.stroke=n.style.fill,n.style.fill=K.color.neutral00,n.style.lineWidth=2),n}function iY(e,t,n,r){oY(e,t,n,r),n.dispatchAction({type:`legendToggleSelect`,name:e??t}),aY(e,t,n,r)}function aY(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`highlight`,seriesName:e,name:t,excludeSeriesId:r})}function oY(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`downplay`,seriesName:e,name:t,excludeSeriesId:r})}function sY(e,t,n){var r=e===`allSelect`||e===`inverseSelect`,i={},a=[];n.eachComponent({mainType:`legend`,query:t},function(n){r?n[e]():n[e](t.name),cY(n,i),a.push(n.componentIndex)});var o={};return n.eachComponent(`legend`,function(e){W(i,function(t,n){e[t?`select`:`unSelect`](n)}),cY(e,o)}),r?{selected:o,legendIndex:a}:{name:t.name,selected:o}}function cY(e,t){var n=t||{};return W(e.getData(),function(t){var r=t.get(`name`);if(r!==` +`&&r!==``){var i=e.isSelected(r);n[r]=Zb(n,r)?n[r]&&i:i}}),n}function rge(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,Eb(sY,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,Eb(sY,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,Eb(sY,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,Eb(sY,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,Eb(sY,`unSelect`))}var ige=PS(age);function age(e){var t=e.findComponents({mainType:`legend`});t&&t.length&&e.filterSeries(function(e){for(var n=0;nn[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=Rb(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new eD({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&bk(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;W([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,Ob(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=fY[i],o=pY[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=+!!u,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(rY);function cge(e){e.registerAction(`legendScroll`,`legendscroll`,function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:`legend`,subType:`scroll`,query:e},function(e){e.setScrollDataIndex(n)})})}function lge(e){IB(lY),e.registerComponentModel(oge),e.registerComponentView(sge),cge(e)}function uge(e){IB(lY),IB(lge)}var dge=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.inside`,t.defaultOption=DA(pK.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(pK),mY=dS();function fge(e,t,n){mY(e).coordSysRecordMap.each(function(e){var r=e.dataZoomInfoMap.get(t.uid);r&&(r.getRange=n)})}function pge(e,t){for(var n=mY(e).coordSysRecordMap,r=n.keys(),i=0;ia[i+r]&&(r=n),o&&=t.get(`preventDefaultMouseMove`,!0),s=Rb(t.get(`cursorGrab`,!0),s),c=Rb(t.get(`cursorGrabbing`,!0),c)}),{controlType:r,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:n,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint},cursorGrab:s,cursorGrabbing:c}}}function vge(e){e.registerUpdateLifecycle(`coordsys:aftercreate`,function(e,t){var n=mY(t),r=n.coordSysRecordMap||=Jb();r.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:`dataZoom`,subType:`inside`},function(e){W(sK(e).infoList,function(n){var i=n.model.uid,a=r.get(i)||r.set(i,mge(t,n.model));(a.dataZoomInfoMap||=Jb()).set(e.uid,{dzReferCoordSysInfo:n,model:e,getRange:null})})}),r.each(function(e){var n=e.controller,i,a=e.dataZoomInfoMap;if(a){var o=a.keys()[0];o!=null&&(i=a.get(o))}if(!i){hY(r,e);return}var s=_ge(a,e,t);n.enable(s.controlType,s.opt),CR(e,`dispatchAction`,i.model.get(`throttle`,!0),`fixRate`)})})}var yge=function(e){H(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`dataZoom.inside`,t}return t.prototype.render=function(t,n,r){if(e.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),fge(r,t,{pan:Tb(gY.pan,this),zoom:Tb(gY.zoom,this),scrollMove:Tb(gY.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){pge(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(gK),gY={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=vY[t](null,[r.originX,r.originY],o,n,e),c=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],l=Math.max(1/r.scale,0);a[0]=(a[0]-c)*l+c,a[1]=(a[1]-c)*l+c;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(lU(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:_Y(function(e,t,n,r,i,a){var o=vY[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:_Y(function(e,t,n,r,i,a){return vY[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})};function _Y(e){return function(t,n,r,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s&&(lU(e(o,s,t,n,r,i),o,[0,100],`all`),this.range=o,a[0]!==o[0]||a[1]!==o[1]))return o}}var vY={grid:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem.getRect();return e||=[0,0],a.dim===`x`?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem,c=s.getRadiusAxis().getExtent(),l=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),n.mainType===`radiusAxis`?(o.pixel=t[0]-e[0],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,n,r,i){var a=n.axis,o=i.model.coordinateSystem.getRect(),s={};return e||=[0,0],a.orient===`horizontal`?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};function bge(e){SK(e),e.registerComponentModel(dge),e.registerComponentView(yge),vge(e)}var xge=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.slider`,t.layoutMode=`box`,t.defaultOption=DA(pK.defaultOption,{show:!0,right:`ph`,top:`ph`,width:`ph`,height:`ph`,left:null,bottom:null,borderColor:K.color.accent10,borderRadius:0,backgroundColor:K.color.transparent,dataBackground:{lineStyle:{color:K.color.accent30,width:.5},areaStyle:{color:K.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:K.color.accent40,width:.5},areaStyle:{color:K.color.accent20,opacity:.3}},fillerColor:`rgba(135,175,274,0.2)`,handleIcon:`path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z`,handleSize:`100%`,handleStyle:{color:K.color.neutral00,borderColor:K.color.accent20},moveHandleSize:7,moveHandleIcon:`path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z`,moveHandleStyle:{color:K.color.accent40,opacity:.5},showDetail:!0,showDataShadow:`auto`,realtime:!0,zoomLock:!1,textStyle:{color:K.color.tertiary},brushSelect:!0,brushStyle:{color:K.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:K.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(pK),yY=eD,Sge=1,bY=30,Cge=7,xY=`horizontal`,SY=`vertical`,wge=5,Tge=[`line`,`bar`,`candlestick`,`scatter`],Ege={easing:`cubicOut`,duration:100,delay:0},Dge=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return t.prototype.init=function(e,t){this.api=t,this._onBrush=Tb(this._onBrush,this),this._onBrushEnd=Tb(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){if(e.prototype.render.apply(this,arguments),CR(this,`_dispatchZoomAction`,t.get(`throttle`),`fixRate`),this._orient=t.getOrient(),t.get(`show`)===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!i||i.type!==`dataZoom`||i.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){wR(this,`_dispatchZoomAction`);var e=this.api.getZr();e.off(`mousemove`,this._onBrush),e.off(`mouseup`,this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new LO;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get(`brushSelect`)?Cge:0,r=Rj(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===xY?{right:r.width-i.x-i.width,top:r.height-bY-a-n,width:i.width,height:bY}:{right:a,top:i.y,width:bY,height:i.height},s=Hj(e.option);W([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=Ij(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===SY&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,r=this.dataZoomModel.getFirstTargetAxisModel(),i=r&&r.get(`inverse`),a=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;a.attr(n===xY&&!i?{scaleY:o?1:-1,scaleX:1}:n===xY&&i?{scaleY:o?1:-1,scaleX:-1}:n===SY&&!i?{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2});var s=e.getBoundingRect([a]),c=isNaN(s.x)?0:s.x,l=isNaN(s.y)?0:s.y;e.x=t.x-c,e.y=t.y-l,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,r=e.get(`brushSelect`);n.add(new yY({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new yY({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:Tb(this._onClickPanel,this)}),a=this.api.getZr();r?(i.on(`mousedown`,this._onBrushStart,this),i.cursor=`crosshair`,a.on(`mousemove`,this._onBrush),a.on(`mouseup`,this._onBrushEnd)):(a.off(`mousemove`,this._onBrush),a.off(`mouseup`,this._onBrushEnd)),n.add(i)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var t=this._size,n=this._shadowSize||[],r=e.series,i=r.getRawData(),a=r.getShadowDim&&r.getShadowDim(),o=a&&i.getDimensionInfo(a)?r.getShadowDim():e.otherDim;if(o==null)return;var s=this._shadowPolygonPts,c=this._shadowPolylinePts;if(i!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var l=i.getDataExtent(e.thisDim),u=i.getDataExtent(o),d=(u[1]-u[0])*.3;u=[u[0]-d,u[1]+d];var f=[0,t[1]],p=[0,t[0]],m=[[t[0],0],[0,0]],h=[],g=p[1]/Math.max(1,i.count()-1),_=t[0]/(l[1]-l[0]),v=e.thisAxis.type===`time`,y=-g,b=Math.round(i.count()/t[0]),x;i.each([e.thisDim,o],function(e,t,n){if(b>0&&n%b){v||(y+=g);return}y=v?(+e-l[0])*_:y+g;var r=t==null||isNaN(t)||t===``,i=r?0:dx(t,u,f,!0);r&&!x&&n?(m.push([m[m.length-1][0],0]),h.push([h[h.length-1][0],0])):!r&&x&&(m.push([y,0]),h.push([y,0])),r||(m.push([y,i]),h.push([y,i])),x=r}),s=this._shadowPolygonPts=m,c=this._shadowPolylinePts=h}this._shadowData=i,this._shadowDim=o,this._shadowSize=[t[0],t[1]];var S=this.dataZoomModel;function C(e){var t=S.getModel(e?`selectedDataBackground`:`dataBackground`),n=new LO,r=new ek({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new tk({shape:{points:c},segmentIgnoreThreshold:1,style:t.getModel(`lineStyle`).getLineStyle(),silent:!0,z2:-19});return n.add(r),n.add(i),n}for(var w=0;w<3;w++){var T=C(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get(`showDataShadow`);if(t!==!1){var n,r=this.ecModel;return e.eachTargetAxis(function(i,a){W(e.getAxisProxy(i,a).getTargetSeriesModels(),function(e){if(!n&&!(t!==!0&&_b(Tge,e.get(`type`))<0)){var o=r.getComponent(aK(i),a).axis,s=Oge(i),c,l=e.coordinateSystem;s!=null&&l.getOtherAxis&&(c=l.getOtherAxis(o).inverse),s=e.getData().mapDimension(s),n={thisAxis:o,series:e,thisDim:e.getData().mapDimension(i),otherDim:s,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],r=t.handleLabels=[null,null],i=this._displayables.sliderGroup,a=this._size,o=this.dataZoomModel,s=this.api,c=o.get(`borderRadius`)||0,l=o.get(`brushSelect`),u=t.filler=new yY({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new yY({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:a[0],height:a[1],r:c},style:{stroke:o.get(`dataBackgroundColor`)||o.get(`borderColor`),lineWidth:Sge,fill:K.color.transparent}})),W([0,1],function(t){var a=o.get(`handleIcon`);!iI[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=aI(a,-1,0,2,2,null,!0);s.attr({cursor:kge(this._orient),draggable:!0,drift:Tb(this._onDragMove,this,t),ondragend:Tb(this._onDragEnd,this),onmouseover:Tb(this._onOverDataInfoTriggerArea,this,!0),onmouseout:Tb(this._onOverDataInfoTriggerArea,this,!1),z2:5});var c=s.getBoundingRect(),l=o.get(`handleSize`);this._handleHeight=fx(l,this._size[1]),this._handleWidth=c.width/c.height*this._handleHeight,s.setStyle(o.getModel(`handleStyle`).getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState(`emphasis`).style=o.getModel([`emphasis`,`handleStyle`]).getItemStyle(),gO(s);var u=o.get(`handleColor`);u!=null&&(s.style.fill=u),i.add(n[t]=s);var d=o.getModel(`textStyle`),f=(o.get(`handleLabel`)||{}).show||!1;e.add(r[t]=new aD({silent:!0,invisible:!f,style:fA(d,{x:0,y:0,text:``,verticalAlign:`middle`,align:`center`,fill:d.getTextColor(),font:d.getFont()}),z2:10}))},this);var d=u;if(l){var f=fx(o.get(`moveHandleSize`),a[1]),p=t.moveHandle=new eD({style:o.getModel(`moveHandleStyle`).getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:a[1]-.5,height:f}}),m=f*.8,h=t.moveHandleIcon=aI(o.get(`moveHandleIcon`),-m/2,-m/2,m,m,K.color.neutral00,!0);h.silent=!0,h.y=a[1]+f/2-.5,p.ensureState(`emphasis`).style=o.getModel([`emphasis`,`moveHandleStyle`]).getItemStyle();var g=Math.min(a[1]/2,Math.max(f,10));d=t.moveZone=new eD({invisible:!0,shape:{y:a[1]-g,height:f+g}}),d.on(`mouseover`,function(){s.enterEmphasis(p)}).on(`mouseout`,function(){s.leaveEmphasis(p)}),i.add(p),i.add(h),i.add(d)}d.attr({draggable:!0,cursor:`grab`,drift:Tb(this._onActualMoveZoneDrift,this),ondragstart:Tb(this._onActualMoveZoneDragStart,this),ondragend:Tb(this._onActualMoveZoneDragEnd,this),onmouseover:Tb(this._onOverDataInfoTriggerArea,this,!0),onmouseout:Tb(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[dx(e[0],[0,100],t,!0),dx(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,r=this._handleEnds,i=this._getViewExtent(),a=n.findRepresentativeAxisProxy().getMinMaxSpan(),o=[0,100];lU(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:dx(a.minSpan,o,i,!0),a.maxSpan==null?null:dx(a.maxSpan,o,i,!0));var s=this._range,c=this._range=hx([dx(r[0],i,o,!0),dx(r[1],i,o,!0)]);return!s||s[0]!==c[0]||s[1]!==c[1]},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,r=hx(n.slice()),i=this._size;W([0,1],function(e){var r=t.handles[e],a=this._handleHeight;r.attr({scaleX:a/2,scaleY:a/2,x:n[e]+(e?-1:1),y:i[1]/2-a/2})},this),t.filler.setShape({x:r[0],y:0,width:r[1]-r[0],height:i[1]});var a={x:r[0],width:r[1]-r[0]};t.moveHandle&&(t.moveHandle.setShape(a),t.moveZone.setShape(a),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr(`x`,a.x+a.width/2));for(var o=t.dataShadowSegs,s=[0,r[0],r[1],i[0]],c=0;ct[0]||n[1]<0||n[1]>t[1])){var r=this._handleEnds,i=(r[0]+r[1])/2,a=this._updateInterval(`all`,n[0]-i);this._updateView(),a&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new hC(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr(`ignore`,!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var r=this._getViewExtent(),i=[0,100],a=this._handleEnds=[n.x,n.x+n.width],o=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();lU(0,a,r,0,o.minSpan==null?null:dx(o.minSpan,i,r,!0),o.maxSpan==null?null:dx(o.maxSpan,i,r,!0)),this._range=hx([dx(a[0],r,i,!0),dx(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(eL(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,r=this.dataZoomModel,i=n.brushRect;i||(i=n.brushRect=new yY({silent:!0,style:r.getModel(`brushStyle`).getItemStyle()}),n.sliderGroup.add(i)),i.attr(`ignore`,!1);var a=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),c=o.transformCoordToLocal(a.x,a.y),l=this._size;s[0]=Math.max(Math.min(l[0],s[0]),0),i.setShape({x:c[0],y:0,width:s[0]-c[0],height:l[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:`dataZoom`,from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?Ege:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=sK(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var r=this.api.getWidth(),i=this.api.getHeight();e={x:r*.2,y:i*.2,width:r*.6,height:i*.6}}return e},t.type=`dataZoom.slider`,t}(gK);function CY(e,t,n,r){var i=e.get(`labelFormatter`),a=e.get(`labelPrecision`);(a==null||a===`auto`)&&(a=n.valuePrecision);var o=n.value[t],s=o==null||isNaN(o)?``:pP(r)||dP(r)?r.getLabel({value:Math.round(o)}):isFinite(a)?mx(o,a,!0):o+``;return Db(i)?i(o,s):Ob(i)?i.replace(`{value}`,s):s}function Oge(e){return{x:`y`,y:`x`,radius:`angle`,angle:`radius`}[e]}function kge(e){return e===`vertical`?`ns-resize`:`ew-resize`}function Age(e){e.registerComponentModel(xge),e.registerComponentView(Dge),SK(e)}function jge(e){IB(bge),IB(Age)}var wY={get:function(e,t,n){var r=mb((Mge[e]||{})[t]);return n&&G(r)?r[r.length-1]:r}},Mge={color:{active:[`#006edd`,`#e0ffff`],inactive:[K.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:[`circle`,`roundRect`,`diamond`],inactive:[`none`]},symbolSize:{active:[10,50],inactive:[0,0]}},TY=BH.mapVisual,Nge=BH.eachVisual,Pge=G,EY=W,Fge=hx,Ige=dx,DY=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=[`inRange`,`outOfRange`],n.replacableOptionKeys=[`inRange`,`outOfRange`,`target`,`controller`,`color`],n.layoutMode={type:`box`,ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&dJ(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=Tb(e,this),this.controllerVisuals=uJ(this.option.controller,t,e),this.targetVisuals=uJ(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this,t=this.option.seriesTargets;if(t){var n=[];return EY(t,function(t){if(t.seriesIndex!=null)n.push(t.seriesIndex);else if(t.seriesId!=null){var r;e.ecModel.eachSeries(function(e){e.id===t.seriesId&&(r=e)}),r&&n.push(r.componentIndex)}}),n}var r=this.option.seriesId,i=this.option.seriesIndex;i==null&&r==null&&(i=`all`);var a=_S(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return bb(a,function(e){return e.componentIndex})},t.prototype.eachTargetSeries=function(e,t){W(this.getTargetSeriesIndices(),function(n){var r=this.ecModel.getSeriesByIndex(n);r&&e.call(t,r)},this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries(function(n){n===e&&(t=!0)}),t},t.prototype.formatValueText=function(e,t,n){var r=this.option,i=r.precision,a=this.dataBound,o=r.formatter,s;n||=[`<`,`>`],G(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);return Ob(o)?o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c):Db(o)?s?o(e[0],e[1]):o(e):s?e[0]===a[0]?n[0]+` `+c[1]:e[1]===a[1]?n[1]+` `+c[0]:c[0]+` - `+c[1]:c;function l(e){return e===a[0]?`min`:e===a[1]?`max`:(+e).toFixed(Math.min(i,20))}},t.prototype.resetExtent=function(){var e=this.option,t=Fge([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=Cb(n,function(n){return n.seriesIndex!=null&&n.seriesIndex===e||n.seriesId!=null&&n.seriesId===t.ecModel.getSeriesByIndex(e).id});if(r)return r.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(e){var t=e.hostModel.seriesIndex,n=this.getDimension(t);if(n!=null)return e.getDimensionIndex(n);for(var r=e.dimensions,i=r.length-1;i>=0;i--){var a=r[i],o=e.getDimensionInfo(a);if(!o.isCalculationCoord)return o.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},r=t.target||={},i=t.controller||={};hb(r,n),hb(i,n);var a=this.isCategory();o.call(this,r),o.call(this,i),s.call(this,r,`inRange`,`outOfRange`),c.call(this,i);function o(n){Pge(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get(`gradientColor`)}}function s(e,t,n){var r=e[t],i=e[n];r&&!i&&(i=e[n]={},EY(r,function(e,t){if(BH.isValidType(t)){var n=wY.get(t,`inactive`,a);n!=null&&(i[t]=n,t===`color`&&!i.hasOwnProperty(`opacity`)&&!i.hasOwnProperty(`colorAlpha`)&&(i.opacity=[0,0]))}}))}function c(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,r=this.get(`inactiveColor`),i=this.getItemSymbol()||`roundRect`;EY(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??(c.symbol=t&&mb(t)||(a?i:[i])),c.symbolSize??(c.symbolSize=n&&mb(n)||(a?s[0]:[s[0],s[0]])),c.symbol=TY(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;Nge(l,function(e){e>u&&(u=e)}),c.symbolSize=TY(l,function(e){return Ige(e,[0,u],[0,s[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get(`itemWidth`)),parseFloat(this.get(`itemHeight`))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type=`visualMap`,t.dependencies=[`series`],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:`vertical`,backgroundColor:K.color.transparent,borderColor:K.color.borderTint,contentColor:K.color.theme[0],inactiveColor:K.color.disabled,borderWidth:0,padding:K.size.m,textGap:10,precision:0,textStyle:{color:K.color.secondary}},t}(Wj),OY=[20,140],Lge=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(e){e.mappingMethod=`linear`,e.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=OY[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=OY[1])},t.prototype._resetRange=function(){var e=this.getExtent(),t=this.option.range;!t||t.auto?(e.auto=1,this.option.range=e):G(t)&&(t[0]>t[1]&&t.reverse(),t[0]=Math.max(t[0],e[0]),t[1]=Math.min(t[1],e[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),W(this.stateList,function(e){var t=this.option.controller[e].symbolSize;t&&t[0]!==t[1]&&(t[0]=t[1]/3)},this)},t.prototype.setSelected=function(e){this.option.range=e.slice(),this._resetRange()},t.prototype.getSelected=function(){var e=this.getExtent(),t=hx((this.get(`range`)||[]).slice());return t[0]>e[1]&&(t[0]=e[1]),t[1]>e[1]&&(t[1]=e[1]),t[0]=n[1]||e<=t[1])?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[];return this.eachTargetSeries(function(n){var r=[],i=n.getData();i.each(this.getDataDimensionIndex(i),function(t,n){e[0]<=t&&t<=e[1]&&r.push(n)},this),t.push({seriesId:n.id,dataIndex:r})},this),t},t.prototype.getVisualMeta=function(e){var t=kY(this,`outOfRange`,this.getExtent()),n=kY(this,`inRange`,this.option.range.slice()),r=[];function i(t,n){r.push({value:t,color:e(t,n)})}for(var a=0,o=0,s=n.length,c=t.length;oe[1])break;r.push({color:this.getControllerVisual(o,`color`,t),offset:a/n})}return r.push({color:this.getControllerVisual(e[1],`color`,t),offset:1}),r},t.prototype._createBarPoints=function(e,t){var n=this.visualMapModel.itemSize;return[[n[0]-t[0],e[0]],[n[0],e[0]],[n[0],e[1]],[n[0]-t[1],e[1]]]},t.prototype._createBarGroup=function(e){var t=this._orient,n=this.visualMapModel.get(`inverse`);return new LO(t===`horizontal`&&!n?{scaleX:e===`bottom`?1:-1,rotation:Math.PI/2}:t===`horizontal`&&n?{scaleX:e===`bottom`?-1:1,rotation:-Math.PI/2}:t===`vertical`&&!n?{scaleX:e===`left`?1:-1,scaleY:-1}:{scaleX:e===`left`?1:-1})},t.prototype._updateHandle=function(e,t){if(this._useHandle){var n=this._shapes,r=this.visualMapModel,i=n.handleThumbs,a=n.handleLabels,o=r.itemSize,s=r.getExtent(),c=this._applyTransform(`left`,n.mainGroup);Rge([0,1],function(l){var u=i[l];u.setStyle(`fill`,t.handlesColor[l]),u.y=e[l];var d=PY(e[l],[0,o[1]],s,!0),f=this.getControllerVisual(d,`symbolSize`);u.scaleX=u.scaleY=f/o[0],u.x=o[0]-f/2;var p=Rk(n.handleLabelPoints[l],Lk(u,this.group));if(this._orient===`horizontal`){var m=c===`left`||c===`top`?(o[0]-f)/2:(o[0]-f)/-2;p[1]+=m}a[l].setStyle({x:p[0],y:p[1],text:r.formatValueText(this._dataInterval[l]),verticalAlign:`middle`,align:this._orient===`vertical`?this._applyTransform(`left`,n.mainGroup):`center`})},this)}},t.prototype._showIndicator=function(e,t,n,r){var i=this.visualMapModel,a=i.getExtent(),o=i.itemSize,s=[0,o[1]],c=this._shapes,l=c.indicator;if(l){l.attr(`invisible`,!1);var u=this.getControllerVisual(e,`color`,{convertOpacityToAlpha:!0}),d=this.getControllerVisual(e,`symbolSize`),f=PY(e,a,s,!0),p=o[0]-d/2,m={x:l.x,y:l.y};l.y=f,l.x=p;var h=Rk(c.indicatorLabelPoint,Lk(l,this.group)),g=c.indicatorLabel;g.attr(`invisible`,!1);var _=this._applyTransform(`left`,c.mainGroup),v=this._orient===`horizontal`;g.setStyle({text:(n||``)+i.formatValueText(t),verticalAlign:v?_:`middle`,align:v?`center`:_});var y={x:p,y:f,style:{fill:u}},b={style:{x:h[0],y:h[1]}};if(i.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var x={duration:100,easing:`cubicInOut`,additive:!0};l.x=m.x,l.y=m.y,l.animateTo(y,x),g.animateTo(b,x)}else l.attr(y),g.attr(b);this._firstShowIndicator=!1;var S=this._shapes.handleLabels;if(S)for(var C=0;Ci[1]&&(l[1]=1/0),t&&(l[0]===-1/0?this._showIndicator(c,l[1],`< `,o):l[1]===1/0?this._showIndicator(c,l[0],`> `,o):this._showIndicator(c,c,`≈ `,o));var u=this._hoverLinkDataIndices,d=[];(t||RY(n))&&(d=this._hoverLinkDataIndices=n.findTargetDataIndices(l));var f=lS(u,d);this._dispatchHighDown(`downplay`,NY(f[0],n)),this._dispatchHighDown(`highlight`,NY(f[1],n))}},t.prototype._hoverLinkFromSeriesMouseOver=function(e){var t;if(JR(e.target,function(e){var n=yD(e);if(n.dataIndex!=null)return t=n,!0},!0),t){var n=this.ecModel.getSeriesByIndex(t.seriesIndex),r=this.visualMapModel;if(r.isTargetSeries(n)){var i=n.getData(t.dataType),a=i.getStore().get(r.getDataDimensionIndex(i),t.dataIndex);isNaN(a)||this._showIndicator(a,a)}}},t.prototype._hideIndicator=function(){var e=this._shapes;e.indicator&&e.indicator.attr(`invisible`,!0),e.indicatorLabel&&e.indicatorLabel.attr(`invisible`,!0);var t=this._shapes.handleLabels;if(t)for(var n=0;n=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}];function Kge(e,t,n,r){for(var i=t.targetVisuals[r],a=BH.prepareVisualTypes(i),o={color:GR(e.getData(),`color`)},s=0,c=a.length;s0:e.splitNumber>0)||e.calculable)?`continuous`:`piecewise`}),e.registerAction(Uge,Wge),W(Gge,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(qge))}function Jge(e){e.registerComponentModel(Lge),e.registerComponentView(Vge),UY(e)}var Yge=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var r=this._mode=this._determineMode();this._pieceList=[],Xge[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(e,t){r===`categories`?(e.mappingMethod=`category`,e.categories=mb(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=bb(this._pieceList,function(e){return e=mb(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=BH.listVisualTypes(),i=this.isCategory();W(t.pieces,function(e){W(r,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),W(n,function(e,n){var r=!1;W(this.stateList,function(e){r=r||a(t,e,n)||a(t.target,e,n)},this),!r&&W(this.stateList,function(e){(t[e]||(t[e]={}))[n]=wY.get(n,e===`inRange`?`active`:`inactive`,i)})},this);function a(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,r=this._pieceList,i=(t?n:e).selected||{};if(n.selected=i,W(r,function(e,t){var n=this.getSelectedMapKey(e);i.hasOwnProperty(n)||(i[n]=!0)},this),n.selectedMode===`single`){var a=!1;W(r,function(e,t){var n=this.getSelectedMapKey(e);i[n]&&(a?i[n]=!1:a=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get(`itemSymbol`)},t.prototype.getSelectedMapKey=function(e){return this._mode===`categories`?e.value+``:e.index+``},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?`pieces`:this.option.categories?`categories`:`splitNumber`},t.prototype.setSelected=function(e){this.option.selected=mb(e)},t.prototype.getValueState=function(e){var t=BH.findPieceIndex(e,this._pieceList);return t==null?`outOfRange`:this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries(function(r){var i=[],a=r.getData();a.each(this.getDataDimensionIndex(a),function(t,r){BH.findPieceIndex(t,n)===e&&i.push(r)},this),t.push({seriesId:r.id,dataIndex:i})},this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(e.value!=null)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(this.isCategory())return;var t=[],n=[``,``],r=this;function i(i,a){var o=r.getRepresentValue({interval:i});a||=r.getValueState(o);var s=e(o,a);i[0]===-1/0?n[0]=s:i[1]===1/0?n[1]=s:t.push({value:i[0],color:s},{value:i[1],color:s})}var a=this._pieceList.slice();if(!a.length)a.push({interval:[-1/0,1/0]});else{var o=a[0].interval[0];o!==-1/0&&a.unshift({interval:[-1/0,o]}),o=a[a.length-1].interval[1],o!==1/0&&a.push({interval:[o,1/0]})}var s=-1/0;return W(a,function(e){var t=e.interval;t&&(t[0]>s&&i([s,t[0]],`outOfRange`),i(t.slice()),s=t[1])},this),{stops:t,outerColors:n}},t.type=`visualMap.piecewise`,t.defaultOption=DA(DY.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:`auto`,itemWidth:20,itemHeight:14,itemSymbol:`roundRect`,pieces:null,categories:null,splitNumber:5,selectedMode:`multiple`,itemGap:10,hoverLink:!0}),t}(DY),Xge={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),r=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(r[1]-r[0])/i;+a.toFixed(n)!==a&&n<5;)n++;t.precision=n,a=+a.toFixed(n),t.minOpen&&e.push({interval:[-1/0,r[0]],close:[0,0]});for(var o=0,s=r[0];o`,`≥`][t[0]]];e.text=e.text||this.formatValueText(e.value==null?e.interval:e.value,!1,n)},this)}};function WY(e,t){var n=e.inverse;(e.orient===`vertical`?!n:n)&&t.reverse()}var Zge=function(e){H(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get(`textGap`),r=t.textStyleModel,i=this._getItemAlign(),a=t.itemSize,o=this._getViewData(),s=o.endsText,c=Lb(t.get(`showLabel`,!0),!s),l=!t.get(`selectedMode`);s&&this._renderEndsText(e,s[0],a,c,i),W(o.viewPieceList,function(o){var s=o.piece,u=new LO;u.onclick=Tb(this._onItemClick,this,s),this._enableHoverLink(u,o.indexInModelPieceList);var d=t.getRepresentValue(s);if(this._createItemSymbol(u,d,[0,0,a[0],a[1]],l),c){var f=this.visualMapModel.getValueState(d),p=r.get(`align`)||i;u.add(new aD({style:fA(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:Rb(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),Fj(t.get(`orient`),e,t.get(`itemGap`)),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on(`mouseover`,function(){return r(`highlight`)}).on(`mouseout`,function(){return r(`downplay`)});var r=function(e){var r=n.visualMapModel;r.option.hoverLink&&n.api.dispatchAction({type:e,batch:NY(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return MY(e,this.api,e.itemSize);var n=t.align;return(!n||n===`auto`)&&(n=`left`),n},t.prototype._renderEndsText=function(e,t,n,r,i){if(t){var a=new LO,o=this.visualMapModel.textStyleModel;a.add(new aD({style:fA(o,{x:r?i===`right`?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:`middle`,align:r?i:`center`,text:t})})),e.add(a)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=bb(e.getPieceList(),function(e,t){return{piece:e,indexInModelPieceList:t}}),n=e.get(`text`),r=e.get(`orient`),i=e.get(`inverse`);return(r===`horizontal`?i:!i)?t.reverse():n&&=n.slice().reverse(),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n,r){var i=aI(this.getControllerVisual(t,`symbol`),n[0],n[1],n[2],n[3],this.getControllerVisual(t,`color`));i.silent=r,e.add(i)},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,r=n.selectedMode;if(r){var i=mb(n.selected),a=t.getSelectedMapKey(e);r===`single`||r===!0?(i[a]=!0,W(i,function(e,t){i[t]=t===a})):i[a]=!i[a],this.api.dispatchAction({type:`selectDataRange`,from:this.uid,visualMapId:this.visualMapModel.id,selected:i})}},t.type=`visualMap.piecewise`,t}(AY);function Qge(e){e.registerComponentModel(Yge),e.registerComponentView(Zge),UY(e)}function $ge(e){IB(Jge),IB(Qge)}var e_e={label:{enabled:!0},decal:{show:!1}},GY=dS(),KY=dS(),t_e=PS(n_e);function n_e(e,t){var n=e.getModel(`aria`);if(!n.get(`enabled`))return;var r=KY(e).scope||(KY(e).scope={}),i=mb(e_e);hb(i.label,e.getLocaleModel().get(`aria`),!1),hb(n.option,i,!1),a(),o();function a(){if(n.getModel(`decal`).get(`show`)){var t=Jb();e.eachSeries(function(e){e.isColorBySeries()||(GY(e).scope=t.get(e.type)||t.set(e.type,{}))}),e.eachSeries(function(t){if(Db(t.enableAriaDecal)){t.enableAriaDecal();return}var n=t.getData();if(t.isColorBySeries()){var i=qj(t.ecModel,t.name,r,e.getSeriesCount()),a=n.getVisual(`decal`);n.setVisual(`decal`,u(a,i))}else{var o=t.getRawData(),s={},c=GY(t).scope;n.each(function(e){var t=n.getRawIndex(e);s[t]=e});var l=o.count();o.each(function(e){var r=s[e],i=o.getName(e)||e+``,a=qj(t.ecModel,i,c,l),d=n.getItemVisual(r,`decal`);n.setItemVisual(r,`decal`,u(d,a))})}function u(e,t){var n=e?U(U({},t),e):t;return n.dirty=!0,n}})}}function o(){var r=t.getZr().dom;if(r){var i=e.getLocaleModel().get(`aria`),a=n.getModel(`label`);if(a.option=gb(a.option,i),a.get(`enabled`)){if(r.setAttribute(`role`,`img`),a.get(`description`)){r.setAttribute(`aria-label`,a.get(`description`));return}var o=e.getSeriesCount(),u=a.get([`data`,`maxCount`])||10,d=a.get([`series`,`maxCount`])||10,f=Math.min(o,d),p;if(!(o<1)){var m=c();p=m?s(a.get([`general`,`withTitle`]),{title:m}):a.get([`general`,`withoutTitle`]);var h=[],g=o>1?a.get([`series`,`multiple`,`prefix`]):a.get([`series`,`single`,`prefix`]);p+=s(g,{seriesCount:o}),e.eachSeries(function(e,t){if(t1?a.get([`series`,`multiple`,r]):a.get([`series`,`single`,r]),n=s(n,{seriesId:e.seriesIndex,seriesName:e.get(`name`),seriesType:l(e.subType)});var i=e.getData();if(i.count()>u){var c=a.get([`data`,`partialData`]);n+=s(c,{displayCnt:u})}else n+=a.get([`data`,`allData`]);for(var d=a.get([`data`,`separator`,`middle`]),p=a.get([`data`,`separator`,`end`]),m=a.get([`data`,`excludeDimensionId`]),g=[],_=0;_=a}}}for(var l=YY(this),u=l.startIdx;u=0)&&(a=!0)}),a||i.__dirty){var o=n._opts.useDirtyRect&&!JY(i)?i.createRepaintRects(e,t,n._width,n._height):null,s=n._i.layerStack[0],c=!0;if(i.__dirty){c=!1,i.__dirty=!1;var l=i.zlevel===s.zl&&i.zlevel2===s.zl2?n._backgroundColor:null;i.clear(!1,l,o)}rX(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},lX),$b.wxa&&aX(this._i,function(e){e&&e.ctx&&e.ctx.draw&&e.ctx.draw()}),r},e.prototype._paintPerCursor=function(e,t,n,r,i){var a=e.ctx;if(r){if(!r.length)t.drawIdx=t.endIdx;else for(var o=this.dpr,s=0;s=t.endIdx},e.prototype._paintPerCursorInRect=function(e,t,n,r,i){for(var a={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},o=e.ctx,s=JY(e),c=s&&nb.getTime(),l=t.drawIdx,u=t.notClearIdx,d=u>=0?Math.min(u,l):l;d15){d++;break}}}xz(o,a),t.drawIdx=Math.max(d,l)},e.prototype.getLayer=function(e,t){return this._ensureLayer(e,0,t)},e.prototype._ensureLayer=function(e,t,n){t||=0;var r=this._singleCanvas;r&&!this._needsManuallyCompositing&&(e=QY,t=0);var i=iX(this._i,e)[t];return i||(i=tX(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&hb(i,this._layerConfig[e],!0),(n||r&&e!==QY)&&(i.virtual=!0),this._insertLayer(i,e,t,!1),i.initContext()),i},e.prototype.insertLayer=function(e,t){this._insertLayer(t,e,0,!1)},e.prototype._insertLayer=function(e,t,n,r){var i=this._i,a=i.layers,o=i.layerStack,s=this._domRoot,c=null;if(!(a[t]&&a[t][n])&&o_e(e)){for(var l=o.length,u=0;u0&&(c=iX(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),iX(i,t)[n]=e,!r&&!e.virtual){if(c){var d=c.dom;d.nextSibling?s.insertBefore(e.dom,d.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom)}e.painter||=this}},e.prototype.eachLayer=function(e,t){return aX(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return aX(this._i,function(n,r){e.call(t,n,r)},oX)},e.prototype.eachOtherLayer=function(e,t){return aX(this._i,function(n,r){e.call(t,n,r)},sX)},e.prototype.getLayers=function(){var e={};return aX(this._i,function(t,n,r){e[t.id]=t}),e},e.prototype._updateLayerStatus=function(e,t){var n=this;if(n._singleCanvas)for(var r=1;r=0;a--){var o=i.get(r[a]);if(!o.used)t.__dirty=!0,i.removeKey(r[a]),r.splice(a,1);else{var s=o.endIdxNew;(JY(t)?s=0;r--){var i=t[r];if(i.zl===e){var a=n[e][i.zl2];if(a.__builtin__)continue;if(t.splice(r,1),n[e][i.zl2]=void 0,!a.virtual){var o=a.dom.parentNode;o&&o.removeChild(a.dom)}}}},e.prototype.resize=function(e,t){if(this._domRoot.style){var n=this._domRoot;n.style.display=`none`;var r=this._opts,i=this.root;e!=null&&(r.width=e),t!=null&&(r.height=t),e=tz(i,0,r),t=tz(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,aX(this._i,function(n){n.resize(e,t)}),this.refresh({paintAll:!0})),this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this._ensureLayer(QY).resize(e,t)}return this},e.prototype.clearLayer=function(e){W(this._i.layers[e],function(e){e&&!e.__builtin__&&e.clear()})},e.prototype.dispose=function(){this.root.innerHTML=``,this.root=this.storage=this._domRoot=this._i=null},e.prototype.getRenderedCanvas=function(e){if(e||={},this._singleCanvas&&!this._compositeManually)return this._i.layers[QY][0].dom;var t=new XY(`image`,this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var n=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var r=t.dom.width,i=t.dom.height;aX(this._i,function(e){e.__builtin__?n.drawImage(e.dom,0,0,r,i):e.renderToCanvas&&(n.save(),e.renderToCanvas(n),n.restore())})}else{for(var a={inHover:!1,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},o=this.storage.getDisplayList(!0),s=0,c=o.length;s{e.data&&e.interactive!==!1&&e.data.forEach((r,i)=>{let a=typeof r==`object`&&r&&!Array.isArray(r)?r:void 0,o=a?.value??r;o!=null&&t.push({series_index:n,data_index:i,label:`${e.name??`Series`} · point ${i+1}`,event:{seriesName:e.name,name:a?.name,value:o,data:r,interactive:e.interactive}})})}),t}IB([WN,d_e,Npe,ume,VW,nhe,mpe,IG,eK,uge,aJ,$he,qhe,$ge,i_e,Ihe,jge,Dq]);var uX=new Map;function dX({option:e,optionForSize:t,height:n,label:r,onClick:i,onZoom:a,group:o,keyboard:s}){let c=(0,A.useRef)(null),l=(0,A.useRef)(null),[u,d]=(0,A.useState)(e),[f,p]=(0,A.useState)(!1),m=(0,A.useRef)(!1),h=(0,A.useRef)(e),g=(0,A.useRef)(s);g.current=s;let _=(0,A.useRef)(void 0),v=(0,A.useCallback)(e=>{_.current&&l.current?.dispatchAction({type:`downplay`,seriesIndex:_.current.series_index,dataIndex:_.current.data_index}),l.current?.dispatchAction({type:`hideTip`}),_.current=e,e&&(l.current?.dispatchAction({type:`highlight`,seriesIndex:e.series_index,dataIndex:e.data_index}),l.current?.dispatchAction({type:`showTip`,seriesIndex:e.series_index,dataIndex:e.data_index}))},[]),y=Array.isArray(u.series)?u.series:u.series?[u.series]:[],b=Array.isArray(u.xAxis)?u.xAxis[0]:u.xAxis,x=Array.isArray(u.yAxis)?u.yAxis[0]:u.yAxis,S=(0,A.useMemo)(()=>{if(!s||!f)return[];let e=Array.isArray(u.series)?u.series:u.series?[u.series]:[],t=x?.type===`category`&&e[0]?.type!==`custom`?x:b?.type===`category`?b:void 0;return f_e(e.map(e=>({...e,interactive:void 0}))).map(n=>{let r=Array.isArray(n.event.value)?n.event.value:[];return{...n,event:{...n.event,interactive:e[n.series_index]?.interactive,name:n.event.name??(e[n.series_index]?.type===`custom`?x?.data?.[Number(r[1])]:t?.data?.[n.data_index])}}}).filter(e=>e.event.value!=null&&(!Array.isArray(e.event.value)||e.event.value.at(-1)!=null))},[u,f]),C=e=>{let t=e.event.data?.selection,n=Array.isArray(e.event.value)?e.event.value:[],r=t?.from?Date.parse(t.from):t?.time??(b?.type===`time`?Number(n[0]):NaN),i=/^(\d+)(ms|s|m|h|d)$/.exec(s?.interval??``),a=i?Number(i[1])*{ms:1,s:1e3,m:6e4,h:36e5,d:864e5}[i[2]]:void 0,o=y[e.series_index]?.data?.[e.data_index+1],c=Array.isArray(o)?o:o?.value,l=typeof c?.[0]==`number`&&c[0]>r?c[0]:void 0,u=a?r+a:l??s?.bounds?.to??r,d=t?.to?Date.parse(t.to):y[e.series_index]?.type===`custom`?Number(n[3]):Math.min(u,s?.bounds?.to??u);return Number.isFinite(r)&&Number.isFinite(d)?{from:r,to:d}:void 0},w=e=>{let t=y[e.series_index],n=Array.isArray(e.event.value)?e.event.value:[e.event.value],r=t?.type===`custom`,i=C(e),a=r?x?.data?.[Number(n[1])]:e.event.name,o=r?n[2]:n.at(-1),s=typeof o==`number`?t?.tooltip?.valueFormatter?.(o)??py(t?.keyboard_unit,o):String(o??`No value`),c=t?.type===`scatter`?`x: ${py(t.keyboard_x_unit,Number(n[0]))} · y: `:``;return[e.event.seriesName??`Series`,a,i?new Date(i.from).toISOString()+(i.to===i.from?``:` – ${new Date(i.to).toISOString()}`):void 0,c+s].filter(Boolean).join(` · `)},T=(0,A.useRef)({}),E=(0,A.useRef)(i);E.current=i;let D=(0,A.useRef)(a);D.current=a;let O=!!a,k=(0,A.useRef)(void 0),j=(0,A.useRef)(0),[M,N]=(0,A.useState)(0),P=(0,A.useCallback)(()=>{let e=k.current;l.current?.dispatchAction({type:`brush`,areas:e?[{brushType:`lineX`,xAxisIndex:0,coordRange:[e.from,e.to]}]:[]},{silent:!0})},[]),F=(0,A.useCallback)(e=>{(k.current?.from!==e?.from||k.current?.to!==e?.to)&&(k.current=e,P())},[P]),ee=O?`${r} Brush across the chart to zoom to that range.`:r,I=(0,A.useRef)(()=>void 0),te=(0,A.useCallback)(e=>{e!==j.current&&(j.current=e,I.current())},[]);(0,A.useRef)(null);let L=(0,A.useRef)(void 0),ne=(0,A.useRef)(!1);ne.current=!!t,I.current=()=>{L.current===void 0&&(L.current=document.createElement(`canvas`).getContext(`2d`));let n=L.current,r={measureText:n?(e,t)=>(n.font=t,n.measureText(e).width):void 0,width:c.current?.clientWidth??0,height:c.current?.clientHeight??0},i=t&&r.width>0&&r.height>0?t(r):e;if(j.current&&i.grid&&!Array.isArray(i.grid)){let e=i.grid;i={...i,grid:{...e,bottom:(typeof e.bottom==`number`?e.bottom:8)+j.current}}}let a=i.series??[],o=new Set(a.map(e=>e.name)),s=Object.fromEntries(Object.entries(T.current).filter(([e])=>o.has(e)));T.current=s;let u=i.legend;l.current?.setOption({...i,...u?{legend:{...u,selected:{...u.selected,...s}}}:{},...D.current?{toolbox:{show:!1},brush:{xAxisIndex:0,brushMode:`single`,removeOnClick:!0}}:{},aria:{...i.aria,enabled:!0,description:ee}},{notMerge:!0});let f=l.current?.getModel?.().getComponent(`grid`)?.coordinateSystem?.getRect(),p=f?.height;if(p&&i.yAxis){let e=Array.isArray(i.yAxis)?i.yAxis:[i.yAxis],t=e.map(e=>yy(e,p));t.some((t,n)=>t.splitNumber!==e[n].splitNumber||t.interval!==e[n].interval)&&(i={...i,yAxis:Array.isArray(i.yAxis)?t:t[0]},l.current?.setOption({yAxis:i.yAxis}))}f&&i.series?.some(e=>e.endLabel?.show)&&(i=zy(i,f,(e,t)=>{let n=l.current?.convertToPixel({seriesIndex:e},t);return Array.isArray(n)?n[1]:NaN}),l.current?.setOption({series:i.series})),_.current&&v(_.current),D.current&&l.current?.dispatchAction({type:`takeGlobalCursor`,key:`brush`,brushOption:{brushType:`lineX`,brushMode:`single`}}),D.current&&k.current&&P(),h.current=i,g.current&&m.current&&d(i)},(0,A.useEffect)(()=>{if(!c.current)return;let e=mfe(c.current,void 0,{renderer:`canvas`});l.current=e,e.on(`click`,e=>{let t=e,n=h.current.series??[],r=t.seriesIndex===void 0?t.interactive:t.componentType&&t.componentType!==`series`?!1:n[t.seriesIndex]?.interactive;E.current?.({...t,...r===void 0?{}:{interactive:r}})}),e.on(`brushEnd`,t=>{let n=t.areas?.[0]?.coordRange;n?.length===2&&Number.isFinite(n[0])&&Number.isFinite(n[1])&&n[0]e+1)),e.dispatchAction({type:`brush`,areas:[]},{silent:!0}),D.current&&e.dispatchAction({type:`takeGlobalCursor`,key:`brush`,brushOption:{brushType:`lineX`,brushMode:`single`}}))}),e.on(`legendselectchanged`,e=>{T.current={...e.selected}});let t=new ResizeObserver(()=>{e.resize(),ne.current&&I.current()});return t.observe(c.current),()=>{t.disconnect(),_.current&&v(void 0),e.dispose(),l.current=null}},[]),(0,A.useEffect)(()=>{I.current()},[e,t,ee,O]),(0,A.useEffect)(()=>{let e=l.current;if(e&&o)return e.group=o,uX.set(o,(uX.get(o)??0)+1),hfe(o),()=>{e.group=``;let t=(uX.get(o)??1)-1;if(t>0){uX.set(o,t);return}uX.delete(o),gfe(o)}},[o]);let re=(0,z.jsx)(`div`,{ref:c,role:`img`,"aria-label":ee,"aria-hidden":s?!0:void 0,style:{height:s?`100%`:n,position:s?`absolute`:void 0,inset:s?0:void 0,zIndex:s?0:void 0,flex:`1 1 auto`,minHeight:0,width:`100%`,minWidth:0,cursor:i?`pointer`:void 0}}),ie=Array.isArray(e.series)?e.series:e.series?[e.series]:[],ae=r+`: `+ie.length+` series`+(s?.bounds?`; `+new Date(s.bounds.from).toISOString()+` – `+new Date(s.bounds.to).toISOString():``);return s?(0,z.jsx)(Vre,{height:n,rangeReset:M,onRangeChange:F,onRangeBarHeight:te,points:S,label:ae,summary:w,onClick:i,canSelect:s.canSelect,onHighlight:v,onZoom:a,bounds:s.bounds,pointWindow:C,onRangePending:s.onRangePending,onActiveChange:e=>{m.current=e,p(e),e&&d(h.current)},children:re}):re}function p_e({panel:e,title:t=e.title,result:n,dark:r,height:i,onSelect:a,onPoint:o}){let s=(0,A.useMemo)(()=>t=>xre(e,n.frame,Ry(r),t),[e,n.frame,r]),c=(0,A.useMemo)(()=>s({width:500,height:i}),[s,i]),l=(0,A.useCallback)(t=>!!Qy(e,n,t),[e,n]);return(0,z.jsx)(dX,{keyboard:{canSelect:l},option:c,optionForSize:s,height:i,label:`${t}: bar chart`,onClick:o||a?t=>{let r=Qy(e,n,t);if(!r)return;o?.(r);let i=Object.values(r.dimensions)[0];i!==void 0&&a?.(i)}:void 0})}function m_e({panel:e,title:t=e.title,result:n,dark:r,height:i}){let a=Ty(e,n.frame),o=n.frame.columns.find(e=>e.role===`measure`)?.unit??e.unit,s=e.better??n.better,c=(0,A.useMemo)(()=>t=>Sre({...e,better:s},a,Ry(r),o,t),[e,s,a,r,o]),l=(0,A.useMemo)(()=>c({width:270,height:i}),[c,i]);return(0,z.jsx)(dX,{option:l,optionForSize:c,height:i,label:`${t}: gauge`})}function h_e(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var g_e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,__e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,v_e={};function fX(e,t){return((t||v_e).jsx?__e:g_e).test(e)}var y_e=/[ \t\n\f\r]/g;function b_e(e){return typeof e==`object`?e.type===`text`&&pX(e.value):pX(e)}function pX(e){return e.replace(y_e,``)===``}var mX=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};mX.prototype.normal={},mX.prototype.property={},mX.prototype.space=void 0;function hX(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new mX(n,r,t)}function gX(e){return e.toLowerCase()}var _X=class{constructor(e,t){this.attribute=t,this.property=e}};_X.prototype.attribute=``,_X.prototype.booleanish=!1,_X.prototype.boolean=!1,_X.prototype.commaOrSpaceSeparated=!1,_X.prototype.commaSeparated=!1,_X.prototype.defined=!1,_X.prototype.mustUseProperty=!1,_X.prototype.number=!1,_X.prototype.overloadedBoolean=!1,_X.prototype.property=``,_X.prototype.spaceSeparated=!1,_X.prototype.space=void 0;var vX=s({boolean:()=>yX,booleanish:()=>bX,commaOrSpaceSeparated:()=>wX,commaSeparated:()=>CX,number:()=>q,overloadedBoolean:()=>xX,spaceSeparated:()=>SX}),x_e=0,yX=TX(),bX=TX(),xX=TX(),q=TX(),SX=TX(),CX=TX(),wX=TX();function TX(){return 2**++x_e}var EX=Object.keys(vX),DX=class extends _X{constructor(e,t,n,r){let i=-1;if(super(e,t),OX(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&E_e.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(IX,k_e);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!IX.test(e)){let n=e.replace(T_e,O_e);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=DX}return new i(r,t)}function O_e(e){return`-`+e.toLowerCase()}function k_e(e){return e.charAt(1).toUpperCase()}var A_e=hX([AX,S_e,NX,PX,FX],`html`),LX=hX([AX,C_e,NX,PX,FX],`svg`);function j_e(e){return e.join(` `).trim()}var M_e=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` +`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),N_e=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(M_e());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),P_e=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),F_e=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(N_e()),r=P_e();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),RX=BX(`end`),zX=BX(`start`);function BX(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function I_e(e){let t=zX(e),n=RX(e);if(t&&n)return{start:t,end:n}}function VX(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?UX(e.position):`start`in e||`end`in e?UX(e):`line`in e||`column`in e?HX(e):``}function HX(e){return WX(e&&e.line)+`:`+WX(e&&e.column)}function UX(e){return HX(e&&e.start)+`-`+HX(e&&e.end)}function WX(e){return e&&typeof e==`number`?e:1}var GX=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=VX(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};GX.prototype.file=``,GX.prototype.name=``,GX.prototype.reason=``,GX.prototype.message=``,GX.prototype.stack=``,GX.prototype.column=void 0,GX.prototype.line=void 0,GX.prototype.ancestors=void 0,GX.prototype.cause=void 0,GX.prototype.fatal=void 0,GX.prototype.place=void 0,GX.prototype.ruleId=void 0,GX.prototype.source=void 0;var L_e=l(F_e(),1),KX={}.hasOwnProperty,R_e=new Map,z_e=/[A-Z]/g,B_e=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),V_e=new Set([`td`,`th`]),qX=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function H_e(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=X_e(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Y_e(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?LX:A_e,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=JX(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function JX(e,t,n){if(t.type===`element`)return U_e(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return W_e(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return K_e(e,t,n);if(t.type===`mdxjsEsm`)return G_e(e,t);if(t.type===`root`)return q_e(e,t,n);if(t.type===`text`)return J_e(e,t)}function U_e(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=LX,e.schema=i),e.ancestors.push(t);let a=QX(e,t.tagName,!1),o=Z_e(e,t),s=ZX(e,t);return B_e.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!b_e(e)})),YX(e,o,a,t),XX(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function W_e(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}$X(e,t.position)}function G_e(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);$X(e,t.position)}function K_e(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=LX,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:QX(e,t.name,!0),o=Q_e(e,t),s=ZX(e,t);return YX(e,o,a,t),XX(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function q_e(e,t,n){let r={};return XX(r,ZX(e,t)),e.create(t,e.Fragment,r,n)}function J_e(e,t){return t.value}function YX(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function XX(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Y_e(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function X_e(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=zX(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Z_e(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&KX.call(t.properties,i)){let a=$_e(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&V_e.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Q_e(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else $X(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else $X(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function ZX(e,t){let n=[],r=-1,i=e.passKeys?new Map:R_e;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(oZ(e,e.length,0,t),e):t}var cZ={}.hasOwnProperty;function lZ(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function dZ(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var fZ=xZ(/[A-Za-z]/),pZ=xZ(/[\dA-Za-z]/),cve=xZ(/[#-'*+\--9=?A-Z^-~]/);function mZ(e){return e!==null&&(e<32||e===127)}var hZ=xZ(/\d/),lve=xZ(/[\dA-Fa-f]/),uve=xZ(/[!-/:-@[-`{-~]/);function gZ(e){return e!==null&&e<-2}function _Z(e){return e!==null&&(e<0||e===32)}function vZ(e){return e===-2||e===-1||e===32}var yZ=xZ(/\p{P}|\p{S}/u),bZ=xZ(/\s/);function xZ(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function SZ(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function CZ(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return vZ(r)?(e.enter(n),s(r)):t(r)}function s(r){return vZ(r)&&a++0&&vZ(t)?(e.enter(r),c(t)):l(t)}function c(t){return vZ(t)&&o=i?t(e):n(e)}}var dve={tokenize:fve};function fve(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),CZ(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return gZ(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var TZ=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){EZ(this,e,t,n,!1)}addBefore(e,t,n){EZ(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function EZ(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var pve={tokenize:mve},DZ={tokenize:hve};function mve(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(ro))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function hve(e,t,n){return CZ(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function OZ(e){if(e===null||_Z(e)||bZ(e))return 1;if(yZ(e))return 2}function kZ(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};jZ(o,-a),jZ(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=sZ(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=sZ(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=sZ(r,kZ(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=sZ(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=sZ(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),oZ(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n0&&vZ(t)?CZ(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||gZ(t)?e.check(IZ,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||gZ(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),vZ(t)?CZ(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),vZ(t)?CZ(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||gZ(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var RZ={name:`codeIndented`,tokenize:kve},Ove={partial:!0,tokenize:Ave};function kve(e,t,n){return r;function r(t){return e.enter(`codeIndented`),wZ(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):gZ(t)?e.attempt(Ove,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||gZ(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function Ave(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):gZ(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):wZ(e,t,a,`linePrefix`,4,4)(o)}function a(e){return gZ(e)?i(e):n(e)}}var jve={name:`codeText`,previous:Nve,resolve:Mve,tokenize:Pve};function Mve(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&zZ(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),zZ(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),zZ(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function VZ(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||mZ(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||gZ(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||_Z(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):gZ(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||gZ(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!vZ(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function UZ(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):gZ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),CZ(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||gZ(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function WZ(e,t){let n;return r;function r(i){return gZ(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):vZ(i)?CZ(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Hve={name:`definition`,tokenize:Wve},Uve={partial:!0,tokenize:Gve};function Wve(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return HZ.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=dZ(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return _Z(t)?WZ(e,l)(t):l(t)}function l(t){return VZ(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Uve,d,d)(t)}function d(t){return vZ(t)?CZ(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||gZ(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Gve(e,t,n){return r;function r(t){return _Z(t)?WZ(e,i)(t):n(t)}function i(t){return UZ(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return vZ(t)?CZ(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||gZ(e)?t(e):n(e)}}var Kve={name:`hardBreakEscape`,tokenize:qve};function qve(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return gZ(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Jve={name:`headingAtx`,resolve:Yve,tokenize:Xve};function Yve(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};oZ(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function Xve(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||_Z(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||gZ(n)?(e.exit(`atxHeading`),t(n)):vZ(n)?CZ(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||_Z(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Zve=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),GZ=[`pre`,`script`,`style`,`textarea`],Qve={concrete:!0,name:`htmlFlow`,resolveTo:eye,tokenize:tye},$ve={partial:!0,tokenize:nye};function eye(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function tye(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ee):fZ(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):fZ(a)?(e.consume(a),i=4,r.interrupt?t:ee):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ee):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return fZ(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||_Z(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&GZ.includes(l)?(i=1,r.interrupt?t(s):O(s)):Zve.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||pZ(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return vZ(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||fZ(t)?(e.consume(t),b):vZ(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||pZ(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):vZ(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):vZ(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||gZ(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||_Z(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||vZ(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||gZ(t)?O(t):vZ(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),I):t===63&&i===3?(e.consume(t),ee):t===93&&i===5?(e.consume(t),F):gZ(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check($ve,te,k)(t)):t===null||gZ(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(IZ,A,te)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||gZ(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),ee):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return GZ.includes(n)?(e.consume(t),I):O(t)}return fZ(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),ee):O(t)}function ee(t){return t===62?(e.consume(t),I):t===45&&i===2?(e.consume(t),ee):O(t)}function I(t){return t===null||gZ(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),I)}function te(n){return e.exit(`htmlFlow`),t(n)}}function nye(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(MZ,t,n)}}var rye={name:`htmlText`,tokenize:iye};function iye(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):fZ(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):fZ(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):gZ(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):gZ(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):gZ(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):gZ(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return fZ(t)?(e.consume(t),S):n(t)}function S(t){return t===45||pZ(t)?(e.consume(t),S):C(t)}function C(t){return gZ(t)?(o=C,N(t)):vZ(t)?(e.consume(t),C):M(t)}function w(t){return t===45||pZ(t)?(e.consume(t),w):t===47||t===62||_Z(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||fZ(t)?(e.consume(t),E):gZ(t)?(o=T,N(t)):vZ(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||pZ(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):gZ(t)?(o=D,N(t)):vZ(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):gZ(t)?(o=O,N(t)):vZ(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):gZ(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||_Z(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||_Z(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return vZ(t)?CZ(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var KZ={name:`labelEnd`,resolveAll:cye,resolveTo:lye,tokenize:uye},aye={tokenize:dye},oye={tokenize:fye},sye={tokenize:pye};function cye(e){let t=-1,n=[];for(;++t0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(dZ(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(aye,u,o?u:d)(t):t===91?e.attempt(oye,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(sye,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function dye(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return _Z(t)?WZ(e,a)(t):a(t)}function a(t){return t===41?u(t):VZ(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return _Z(t)?WZ(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?UZ(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return _Z(t)?WZ(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function fye(e,t,n){let r=this;return i;function i(t){return HZ.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(dZ(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function pye(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var mye={name:`labelStartImage`,resolveAll:KZ.resolveAll,tokenize:hye};function hye(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var gye={name:`labelStartLink`,resolveAll:KZ.resolveAll,tokenize:_ye};function _ye(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var qZ={name:`lineEnding`,tokenize:vye};function vye(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),CZ(e,t,`linePrefix`)}}var JZ={name:`thematicBreak`,tokenize:yye};function yye(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||gZ(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),vZ(t)?CZ(e,s,`whitespace`)(t):s(t))}}var YZ={continuation:{tokenize:Cye},exit:Tye,name:`list`,tokenize:Sye},bye={partial:!0,tokenize:Eye},xye={partial:!0,tokenize:wye};function Sye(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:hZ(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(JZ,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return hZ(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(MZ,r.interrupt?n:u,e.attempt(bye,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return vZ(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Cye(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(MZ,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,CZ(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!vZ(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(xye,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,CZ(e,e.attempt(YZ,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function wye(e,t,n){let r=this;return CZ(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Tye(e){e.exit(this.containerState.type)}function Eye(e,t,n){let r=this;return CZ(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!vZ(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var XZ={name:`setextUnderline`,resolveTo:Dye,tokenize:Oye};function Dye(e,t){let n=new TZ,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function Oye(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),vZ(t)?CZ(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||gZ(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var kye={tokenize:Aye};function Aye(e){let t=this,n=e.attempt(MZ,r,e.attempt(this.parser.constructs.flowInitial,i,CZ(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Lve,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var jye={resolveAll:QZ()},Mye=ZZ(`string`),Nye=ZZ(`text`);function ZZ(e){return{resolveAll:QZ(e===`text`?Pye:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++iUye,contentInitial:()=>Lye,disable:()=>Wye,document:()=>Iye,flow:()=>zye,flowInitial:()=>Rye,insideSpan:()=>Hye,string:()=>Bye,text:()=>Vye}),Iye={42:YZ,43:YZ,45:YZ,48:YZ,49:YZ,50:YZ,51:YZ,52:YZ,53:YZ,54:YZ,55:YZ,56:YZ,57:YZ,62:NZ},Lye={91:Hve},Rye={[-2]:RZ,[-1]:RZ,32:RZ},zye={35:Jve,42:JZ,45:[XZ,JZ],60:Qve,61:XZ,95:JZ,96:LZ,126:LZ},Bye={38:FZ,92:PZ},Vye={[-5]:qZ,[-4]:qZ,[-3]:qZ,33:mye,38:FZ,42:AZ,60:[vve,rye],91:gye,92:[Kve,PZ],93:KZ,95:AZ,96:jve},Hye={null:[AZ,jye]},Uye={null:[42,95]},Wye={null:[]};function Gye(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=sZ(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=kZ(a,l.events,l),l.events):[]}function f(e,t){return qye(p(e),t)}function p(e){return Kye(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function qye(e,t){let n=-1,r=[],i;for(;++n0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||iQ).call(a,void 0,e[0])}for(r.position={start:nQ(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:nQ(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function obe(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sbe(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cbe(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=CZ(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function lbe(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ube(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function aQ(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function dbe(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return aQ(e,t);let i={src:CZ(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function fbe(e,t){let n={src:CZ(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function pbe(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function mbe(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return aQ(e,t);let i={href:CZ(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function hbe(e,t){let n={href:CZ(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function gbe(e,t,n){let r=e.all(t),i=n?_be(n):oQ(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||rQ).call(a,void 0,e[0])}for(r.position={start:tQ(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:tQ(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function sbe(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cbe(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lbe(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=SZ(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function ube(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dbe(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function iQ(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function fbe(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return iQ(e,t);let i={src:SZ(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function pbe(e,t){let n={src:SZ(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function mbe(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function hbe(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return iQ(e,t);let i={href:SZ(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function gbe(e,t){let n={href:SZ(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _be(e,t,n){let r=e.all(t),i=n?vbe(n):aQ(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s1}function vbe(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=BX(t.children[1]),o=zX(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Cbe(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(lQ(t.slice(i),i>0,!1)),a.join(``)}function lQ(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===sQ||t===cQ;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===sQ||t===cQ;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Ebe(e,t){let n={type:`text`,value:Tbe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Dbe(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Obe={blockquote:rbe,break:ibe,code:abe,delete:obe,emphasis:sbe,footnoteReference:cbe,heading:lbe,html:ube,imageReference:dbe,image:fbe,inlineCode:pbe,linkReference:mbe,link:hbe,listItem:gbe,list:vbe,paragraph:ybe,root:bbe,strong:xbe,table:Sbe,tableCell:wbe,tableRow:Cbe,text:Ebe,thematicBreak:Dbe,toml:uQ,yaml:uQ,definition:uQ,footnoteDefinition:uQ};function uQ(){}var{defineProperty:kbe}=Object,dQ=typeof self==`object`?self:globalThis,fQ=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new dQ[e](t)},Abe=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?kbe(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof dQ[e]==`function`?fQ(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(fQ(a,o),i)};return r},pQ=e=>Abe(new Map,e)(0),mQ=``,{toString:jbe}={},{keys:Mbe,is:Nbe}=Object,hQ=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=jbe.call(e).slice(8,-1);switch(n){case`Array`:return[1,mQ];case`Object`:return[2,mQ];case`Date`:return[3,mQ];case`RegExp`:return[4,mQ];case`Map`:return[5,mQ];case`Set`:return[6,mQ];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},gQ=([e,t])=>e===0&&(t===`function`||t===`symbol`),Pbe=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=hQ(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&Nbe(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of Mbe(o))(e||!gQ(hQ(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?mQ:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(gQ(hQ(n))||gQ(hQ(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!gQ(hQ(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},_Q=(e,{json:t,lossy:n}={})=>{let r=[];return Pbe(!(t||n),!!t,new Map,r)(e),r},vQ=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?pQ(_Q(e,t)):structuredClone(e):(e,t)=>pQ(_Q(e,t));function Fbe(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Ibe(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Lbe(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Fbe,r=e.options.footnoteBackLabel||Ibe,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...vQ(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:` +`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function vbe(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r1}function ybe(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=zX(t.children[1]),o=RX(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function wbe(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(cQ(t.slice(i),i>0,!1)),a.join(``)}function cQ(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===oQ||t===sQ;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===oQ||t===sQ;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Dbe(e,t){let n={type:`text`,value:Ebe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Obe(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var kbe={blockquote:ibe,break:abe,code:obe,delete:sbe,emphasis:cbe,footnoteReference:lbe,heading:ube,html:dbe,imageReference:fbe,image:pbe,inlineCode:mbe,linkReference:hbe,link:gbe,listItem:_be,list:ybe,paragraph:bbe,root:xbe,strong:Sbe,table:Cbe,tableCell:Tbe,tableRow:wbe,text:Dbe,thematicBreak:Obe,toml:lQ,yaml:lQ,definition:lQ,footnoteDefinition:lQ};function lQ(){}var{defineProperty:Abe}=Object,uQ=typeof self==`object`?self:globalThis,dQ=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new uQ[e](t)},jbe=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?Abe(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof uQ[e]==`function`?dQ(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(dQ(a,o),i)};return r},fQ=e=>jbe(new Map,e)(0),pQ=``,{toString:Mbe}={},{keys:Nbe,is:Pbe}=Object,mQ=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Mbe.call(e).slice(8,-1);switch(n){case`Array`:return[1,pQ];case`Object`:return[2,pQ];case`Date`:return[3,pQ];case`RegExp`:return[4,pQ];case`Map`:return[5,pQ];case`Set`:return[6,pQ];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},hQ=([e,t])=>e===0&&(t===`function`||t===`symbol`),Fbe=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=mQ(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&Pbe(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of Nbe(o))(e||!hQ(mQ(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?pQ:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(hQ(mQ(n))||hQ(mQ(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!hQ(mQ(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},gQ=(e,{json:t,lossy:n}={})=>{let r=[];return Fbe(!(t||n),!!t,new Map,r)(e),r},_Q=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?fQ(gQ(e,t)):structuredClone(e):(e,t)=>fQ(gQ(e,t));function Ibe(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Lbe(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Rbe(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Ibe,r=e.options.footnoteBackLabel||Lbe,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{..._Q(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:` `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:` -`}]}}var yQ=(function(e){if(e==null)return Vbe;if(typeof e==`function`)return bQ(e);if(typeof e==`object`)return Array.isArray(e)?Rbe(e):zbe(e);if(typeof e==`string`)return Bbe(e);throw Error(`Expected function, string, or object as test`)});function Rbe(e){let t=[],n=-1;for(;++n`:``))+`)`})}return u;function u(){let l=xQ,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Wbe(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d`:``))+`)`})}return u;function u(){let l=bQ,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Gbe(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d0&&n.push({type:`text`,value:` -`}),n}function TQ(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function EQ(e,t){let n=Kbe(e,t),r=n.one(e,void 0),i=Lbe(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:` -`},i)),a}function Zbe(e,t){return e&&`run`in e?async function(n,r){let i=EQ(n,{file:r,...t});await e.run(i,r)}:function(n,r){return EQ(n,{file:r,...e||t})}}function DQ(e){if(e)throw e}var Qbe=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var kQ={basename:txe,dirname:nxe,extname:rxe,join:ixe,sep:`/`};function txe(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);AQ(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function nxe(e){if(AQ(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function rxe(e){AQ(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function ixe(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function oxe(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function AQ(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var sxe={cwd:cxe};function cxe(){return`/`}function jQ(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function lxe(e){if(typeof e==`string`)e=new URL(e);else if(!jQ(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return uxe(e)}function uxe(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];OQ(o)&&OQ(r)&&(r=(0,LQ.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function RQ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function zQ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function BQ(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function VQ(e){if(!OQ(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function HQ(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function UQ(e){return hxe(e)?e:new NQ(e)}function hxe(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function gxe(e){return typeof e==`string`||_xe(e)}function _xe(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var WQ=[],GQ={allowDangerousHtml:!0},vxe=/^(https?|ircs?|mailto|xmpp)$/i,yxe=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function bxe(e){let t=xxe(e),n=Sxe(e);return Cxe(t.runSync(t.parse(n),n),e)}function xxe(e){let t=e.rehypePlugins||WQ,n=e.remarkPlugins||WQ,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...GQ}:GQ;return mxe().use(nbe).use(n).use(Zbe,r).use(t)}function Sxe(e){let t=e.children||``,n=new NQ;return typeof t==`string`?n.value=t:``+t,n}function Cxe(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||wxe;for(let e of yxe)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return CQ(e,l),V_e(e,{Fragment:z.Fragment,components:i,ignoreInvalidStyle:!0,jsx:z.jsx,jsxs:z.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in tZ)if(Object.hasOwn(tZ,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=tZ[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function wxe(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||vxe.test(e.slice(0,t))?e:``}function KQ(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Txe(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Exe(e,t,n){let r=yQ((n||{}).ignore||[]),i=Dxe(t),a=-1;for(;++a0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=KQ(e,`(`),a=KQ(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function XQ(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||xZ(n)||bZ(n))&&(!t||n!==47)}ZQ.peek=Xxe;function Hxe(){this.buffer()}function Uxe(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Wxe(){this.buffer()}function Gxe(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Kxe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fZ(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qxe(e){this.exit(e)}function Jxe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fZ(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Yxe(e){this.exit(e)}function Xxe(){return`[`}function ZQ(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Zxe(){return{enter:{gfmFootnoteCallString:Hxe,gfmFootnoteCall:Uxe,gfmFootnoteDefinitionLabelString:Wxe,gfmFootnoteDefinition:Gxe},exit:{gfmFootnoteCallString:Kxe,gfmFootnoteCall:qxe,gfmFootnoteDefinitionLabelString:Jxe,gfmFootnoteDefinition:Yxe}}}function Qxe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:ZQ},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?` -`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?QQ:$xe))),s(),o}}function $xe(e,t,n){return t===0?e:QQ(e,t,n)}function QQ(e,t,n){return(n?``:` `)+e}var eSe=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];$Q.attention=aSe,$Q.peek=oSe;function tSe(){return{canContainEols:[`delete`],enter:{strikethrough:rSe},exit:{strikethrough:iSe}}}function nSe(){return{handlers:{delete:$Q},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:eSe}]}}function rSe(e){this.enter({type:`delete`,children:[],position:void 0},e)}function iSe(e){this.exit(e)}function $Q(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function aSe(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function oSe(){return`~`}function sSe(e){return e.length}function cSe(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||sSe,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++ul&&(l=e[u].length);++ac[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++dc[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),fSe);return i(),o}function fSe(e,t,n){return`>`+(n?``:` `)+e}function pSe(e,t){return t$(e,t.inConstruct,!0)&&!t$(e,t.notInConstruct,!1)}function t$(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ro&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function hSe(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^\n\r ]/.test(e.value)||/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function gSe(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function _Se(e,t,n,r){let i=gSe(n),a=e.value||``;if(hSe(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,vSe);return e(),t}let o=n.createTracker(r),s=i.repeat(Math.max(mSe(a,i)+1,3)),c=n.enter(`codeFenced`),l=i==="`"?`GraveAccent`:`Tilde`,u=o.move(s);if(e.lang){let t=n.enter(`codeFencedLang${l}`);u+=o.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...o.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${l}`);u+=o.move(` `),u+=o.move(n.safe(e.meta,{before:u,after:` +`}),n}function wQ(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function TQ(e,t){let n=qbe(e,t),r=n.one(e,void 0),i=Rbe(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:` +`},i)),a}function Qbe(e,t){return e&&`run`in e?async function(n,r){let i=TQ(n,{file:r,...t});await e.run(i,r)}:function(n,r){return TQ(n,{file:r,...e||t})}}function EQ(e){if(e)throw e}var $be=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var OQ={basename:nxe,dirname:rxe,extname:ixe,join:axe,sep:`/`};function nxe(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);kQ(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function rxe(e){if(kQ(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function ixe(e){kQ(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function axe(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function sxe(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function kQ(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var cxe={cwd:lxe};function lxe(){return`/`}function AQ(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function uxe(e){if(typeof e==`string`)e=new URL(e);else if(!AQ(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return dxe(e)}function dxe(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];DQ(o)&&DQ(r)&&(r=(0,IQ.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function LQ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function RQ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function zQ(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function BQ(e){if(!DQ(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function VQ(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function HQ(e){return gxe(e)?e:new MQ(e)}function gxe(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function _xe(e){return typeof e==`string`||vxe(e)}function vxe(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var UQ=[],WQ={allowDangerousHtml:!0},yxe=/^(https?|ircs?|mailto|xmpp)$/i,bxe=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function xxe(e){let t=Sxe(e),n=Cxe(e);return wxe(t.runSync(t.parse(n),n),e)}function Sxe(e){let t=e.rehypePlugins||UQ,n=e.remarkPlugins||UQ,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...WQ}:WQ;return hxe().use(rbe).use(n).use(Qbe,r).use(t)}function Cxe(e){let t=e.children||``,n=new MQ;return typeof t==`string`?n.value=t:``+t,n}function wxe(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Txe;for(let e of bxe)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return SQ(e,l),H_e(e,{Fragment:z.Fragment,components:i,ignoreInvalidStyle:!0,jsx:z.jsx,jsxs:z.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in eZ)if(Object.hasOwn(eZ,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=eZ[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Txe(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||yxe.test(e.slice(0,t))?e:``}function GQ(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Exe(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Dxe(e,t,n){let r=vQ((n||{}).ignore||[]),i=Oxe(t),a=-1;for(;++a0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=GQ(e,`(`),a=GQ(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function YQ(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||bZ(n)||yZ(n))&&(!t||n!==47)}XQ.peek=Zxe;function Uxe(){this.buffer()}function Wxe(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Gxe(){this.buffer()}function Kxe(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function qxe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=dZ(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Jxe(e){this.exit(e)}function Yxe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=dZ(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Xxe(e){this.exit(e)}function Zxe(){return`[`}function XQ(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Qxe(){return{enter:{gfmFootnoteCallString:Uxe,gfmFootnoteCall:Wxe,gfmFootnoteDefinitionLabelString:Gxe,gfmFootnoteDefinition:Kxe},exit:{gfmFootnoteCallString:qxe,gfmFootnoteCall:Jxe,gfmFootnoteDefinitionLabelString:Yxe,gfmFootnoteDefinition:Xxe}}}function $xe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:XQ},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?` +`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?ZQ:eSe))),s(),o}}function eSe(e,t,n){return t===0?e:ZQ(e,t,n)}function ZQ(e,t,n){return(n?``:` `)+e}var tSe=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];QQ.attention=oSe,QQ.peek=sSe;function nSe(){return{canContainEols:[`delete`],enter:{strikethrough:iSe},exit:{strikethrough:aSe}}}function rSe(){return{handlers:{delete:QQ},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:tSe}]}}function iSe(e){this.enter({type:`delete`,children:[],position:void 0},e)}function aSe(e){this.exit(e)}function QQ(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function oSe(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function sSe(){return`~`}function cSe(e){return e.length}function lSe(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||cSe,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++ul&&(l=e[u].length);++ac[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++dc[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),pSe);return i(),o}function pSe(e,t,n){return`>`+(n?``:` `)+e}function mSe(e,t){return e$(e,t.inConstruct,!0)&&!e$(e,t.notInConstruct,!1)}function e$(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ro&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function gSe(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^\n\r ]/.test(e.value)||/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function _Se(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function vSe(e,t,n,r){let i=_Se(n),a=e.value||``;if(gSe(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,ySe);return e(),t}let o=n.createTracker(r),s=i.repeat(Math.max(hSe(a,i)+1,3)),c=n.enter(`codeFenced`),l=i==="`"?`GraveAccent`:`Tilde`,u=o.move(s);if(e.lang){let t=n.enter(`codeFencedLang${l}`);u+=o.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...o.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${l}`);u+=o.move(` `),u+=o.move(n.safe(e.meta,{before:u,after:` `,encode:["`"],...o.current()})),t()}return u+=o.move(` `),a&&(u+=o.move(a+` -`)),u+=o.move(s),c(),u}function vSe(e,t,n){return(n?``:` `)+e}function r$(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ySe(e,t,n,r){let i=r$(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:` -`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function bSe(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}i$.attention=xSe,i$.peek=SSe;function i$(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function xSe(e,t){return{construct:`emphasis`,markers:bSe(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function SSe(e,t,n){return n.options.emphasis||`*`}function CSe(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function wSe(e,t){let n=!1;return CQ(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&nZ(e)&&(t.options.setext||n))}function TSe(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(wSe(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:` +`)),u+=o.move(s),c(),u}function ySe(e,t,n){return(n?``:` `)+e}function n$(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function bSe(e,t,n,r){let i=n$(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:` +`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function xSe(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}r$.attention=SSe,r$.peek=CSe;function r$(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function SSe(e,t){return{construct:`emphasis`,markers:xSe(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function CSe(e,t,n){return n.options.emphasis||`*`}function wSe(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function TSe(e,t){let n=!1;return SQ(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&tZ(e)&&(t.options.setext||n))}function ESe(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(TSe(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:` `,after:` `});return r(),t(),o+` `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(` `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:` -`,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=CSe(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}a$.peek=ESe;function a$(e){return e.value||``}function ESe(){return`<`}o$.peek=DSe;function o$(e,t,n,r){let i=r$(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function DSe(){return`!`}s$.peek=OSe;function s$(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function OSe(){return`!`}c$.peek=kSe;function c$(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a\u007F]/.test(e.url))}u$.peek=ASe;function u$(e,t,n,r){let i=r$(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(l$(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function ASe(e,t,n){return l$(e,n)?`<`:`[`}d$.peek=jSe;function d$(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function jSe(){return`[`}function f$(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function MSe(e){let t=f$(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function NSe(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function p$(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function PSe(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?NSe(n):f$(n),s=e.ordered?o===`.`?`)`:`.`:MSe(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),p$(n)===o&&t){let t=-1;for(;++t-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function LSe(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function RSe(e,t,n,r){if(!e.children.some(function(e){return uSe(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function zSe(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}m$.attention=BSe,m$.peek=VSe;function m$(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function BSe(e,t){return{construct:`strong`,markers:zSe(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function VSe(e,t,n){return n.options.strong||`*`}function HSe(e,t,n,r){return n.safe(e.value,r)}function USe(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function WSe(e,t,n){let r=(p$(n)+(n.options.ruleSpaces?` `:``)).repeat(USe(n));return n.options.ruleSpaces?r.slice(0,-1):r}var h$={blockquote:dSe,break:n$,code:_Se,definition:ySe,emphasis:i$,hardBreak:n$,heading:TSe,html:a$,image:o$,imageReference:s$,inlineCode:c$,link:u$,linkReference:d$,list:PSe,listItem:ISe,paragraph:LSe,root:RSe,strong:m$,text:HSe,thematicBreak:WSe};function GSe(){return{enter:{table:KSe,tableData:_$,tableHeader:_$,tableRow:JSe},exit:{codeText:YSe,table:qSe,tableData:g$,tableHeader:g$,tableRow:g$}}}function KSe(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function qSe(e){this.exit(e),this.data.inTable=void 0}function JSe(e){this.enter({type:`tableRow`,children:[]},e)}function g$(e){this.exit(e)}function _$(e){this.enter({type:`tableCell`,children:[]},e)}function YSe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,XSe));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function XSe(e,t){return t===`|`?t:e}function ZSe(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:` +`,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=wSe(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}i$.peek=DSe;function i$(e){return e.value||``}function DSe(){return`<`}a$.peek=OSe;function a$(e,t,n,r){let i=n$(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function OSe(){return`!`}o$.peek=kSe;function o$(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function kSe(){return`!`}s$.peek=ASe;function s$(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a\u007F]/.test(e.url))}l$.peek=jSe;function l$(e,t,n,r){let i=n$(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(c$(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function jSe(e,t,n){return c$(e,n)?`<`:`[`}u$.peek=MSe;function u$(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function MSe(){return`[`}function d$(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function NSe(e){let t=d$(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function PSe(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function f$(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function FSe(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?PSe(n):d$(n),s=e.ordered?o===`.`?`)`:`.`:NSe(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),f$(n)===o&&t){let t=-1;for(;++t-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function RSe(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function zSe(e,t,n,r){if(!e.children.some(function(e){return dSe(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function BSe(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}p$.attention=VSe,p$.peek=HSe;function p$(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function VSe(e,t){return{construct:`strong`,markers:BSe(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function HSe(e,t,n){return n.options.strong||`*`}function USe(e,t,n,r){return n.safe(e.value,r)}function WSe(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function GSe(e,t,n){let r=(f$(n)+(n.options.ruleSpaces?` `:``)).repeat(WSe(n));return n.options.ruleSpaces?r.slice(0,-1):r}var m$={blockquote:fSe,break:t$,code:vSe,definition:bSe,emphasis:r$,hardBreak:t$,heading:ESe,html:i$,image:a$,imageReference:o$,inlineCode:s$,link:l$,linkReference:u$,list:FSe,listItem:LSe,paragraph:RSe,root:zSe,strong:p$,text:USe,thematicBreak:GSe};function KSe(){return{enter:{table:qSe,tableData:g$,tableHeader:g$,tableRow:YSe},exit:{codeText:XSe,table:JSe,tableData:h$,tableHeader:h$,tableRow:h$}}}function qSe(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function JSe(e){this.exit(e),this.data.inTable=void 0}function YSe(e){this.enter({type:`tableRow`,children:[]},e)}function h$(e){this.exit(e)}function g$(e){this.enter({type:`tableCell`,children:[]},e)}function XSe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,ZSe));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function ZSe(e,t){return t===`|`?t:e}function QSe(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:` `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(` -`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return cSe(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var hCe={tokenize:CCe,partial:!0};function gCe(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:bCe,continuation:{tokenize:xCe},exit:SCe}},text:{91:{name:`gfmFootnoteCall`,tokenize:yCe},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:_Ce,resolveTo:vCe}}}}function _Ce(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=fZ(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function vCe(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function yCe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||vZ(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(fZ(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return vZ(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function bCe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||vZ(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=fZ(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return vZ(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),wZ(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function xCe(e,t,n){return e.check(NZ,t,e.attempt(hCe,t,n))}function SCe(e){e.exit(`gfmFootnoteDefinition`)}function CCe(e,t,n){let r=this;return wZ(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function wCe(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=kZ(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var TCe=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){ECe(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function ECe(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function DCe(e,t){let n=!1,r=[];for(;t-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):_Z(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):yZ(t)?wZ(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||vZ(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,yZ(t)?wZ(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return yZ(t)?wZ(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||_Z(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return yZ(t)?wZ(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||_Z(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||_Z(n)?(e.exit(`tableRow`),t(n)):yZ(n)?wZ(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||vZ(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function ACe(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new TCe;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},P$(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function N$(e,t,n,r,i){let a=[],o=P$(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function P$(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var jCe={name:`tasklistCheck`,tokenize:NCe};function MCe(){return{text:{91:jCe}}}function NCe(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return vZ(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return _Z(r)?t(r):yZ(r)?e.check({tokenize:PCe},t,n)(r):n(r)}}function PCe(e,t,n){return wZ(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function FCe(e){return uZ([oCe(),gCe(),wCe(e),OCe(),MCe()])}var ICe={};function LCe(e){let t=this,n=e||ICe,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(FCe(n)),a.push(nCe()),o.push(rCe(n))}function RCe({panel:e}){return(0,z.jsx)(`div`,{className:`panel-markdown`,children:(0,z.jsx)(bxe,{remarkPlugins:[LCe],skipHtml:!0,disallowedElements:[`img`],components:{a:({children:e,...t})=>(0,z.jsx)(`a`,{...t,target:`_blank`,rel:`noopener noreferrer`,children:e})},children:e.content??``})})}function F$(e,t,n,r,i,a,o={width:500,height:248}){if(![`timeseries`,`heatmap`,`state_timeline`].includes(t.viz))return e;let s=n.annotation_scope;if(n.annotation_error)return e;let c=e=>!s||s.services.some(t=>t.service===e.service&&(t.namespace===e.namespace||e.namespace===``&&!s.namespace_scoped)),l=n.from_ms??-1/0,u=n.to_ms??1/0,d=r.deploys.filter(c).filter(e=>Date.parse(e.at)>=l&&Date.parse(e.at)({xAxis:Date.parse(e.at),name:`${e.service} ${e.version}`,label:{show:!1},symbol:[`none`,`path://M0,0 L0,-6`],symbolSize:[1,6],lineStyle:{type:`dashed`,color:a.muted,width:1},tooltip:{formatter:()=>Ey(`${e.service} · ${e.version} · ${e.at}`)}})),f=[];for(let e of r.anomalies.filter(c).filter(e=>Date.parse(e.to)>l&&Date.parse(e.from)Date.parse(e.from)-Date.parse(t.from))){let t=Math.max(l,Date.parse(e.from)),n=Math.min(u,Date.parse(e.to)),r=e.namespace?`${e.namespace}/${e.service}`:e.service,i=`${r} · ${e.title} (${e.kind}) · ${e.from} – ${e.to}`,a=Ey(`${r} · ${e.title} · ${e.severity} · ${e.kind} · ${e.from} – ${e.to}`),o=f.at(-1);o&&t<=o.to?(o.to=Math.max(o.to,n),o.count++,o.labels.includes(i)||o.labels.push(i),o.details.includes(a)||o.details.push(a)):f.push({from:t,to:n,labels:[i],details:[a],count:1})}let p=f.map(e=>[{xAxis:e.from,name:e.labels.join(` · `),itemStyle:{color:a.status.warn,opacity:a.dark?.12:.09},label:{show:!1},tooltip:{formatter:()=>(e.count>1?`${e.count} windows\n`:``)+e.details.join(` -`)}},{xAxis:e.to}]),m=e.series??[];if(!m.length)return e;let h=e.grid??{},g=Array.isArray(e.yAxis)?e.yAxis[0]:e.yAxis,_=h.containLabel?(g?.axisLabel?.width??64)+(g?.axisLabel?.margin??8):0,v=(typeof h.left==`number`?h.left:8)+_,y=o.width-(typeof h.right==`number`?h.right:16),b=Math.max(1,y-v),x=e=>o.measureText?.(e,`12px ${a.font}`)??e.length*12,S=e.legend,C=0;for(let e of S?.data??[]){let t=15+x(S?.formatter?.(e)??e);if(C&&C+(S?.itemGap??6)+t>o.width)break;C+=(C?S?.itemGap??6:0)+t}let w=[...p.length?[{text:`anomaly`,details:p.map(e=>e[0].tooltip.formatter()).join(`
`)}]:[],...[...d].sort((e,t)=>e.xAxis-t.xAxis).map(e=>({text:e.name,details:e.tooltip.formatter()}))],T=w.reduce((e,t)=>e+x(t.text)+12,0),E=!!(S?.show&&T<=o.width-16-C-12),D=E?o.width-16-C-12:b,O=0,k=w.filter(e=>{let t=x(e.text)+12;return O+t>D?!1:(O+=t,!0)}),A=(typeof h.top==`number`?h.top:8)+(k.length&&!E?18:0),j=E?1:A-17,M=E?16:typeof h.right==`number`?h.right:16,N=k.map(e=>{let t=x(e.text),n={type:`text`,right:M,top:j,annotation:!0,style:{text:e.text,fill:a.muted,backgroundColor:a.surface,padding:[1,3],fontSize:11,fontFamily:a.font,width:t,stroke:a.surface,lineWidth:3},tooltip:{formatter:()=>e.details}};return M+=t+12,n}),P=e=>e?.type===`value`||e?.type===`log`?{...e,...yy(e,o.height-A-Number(h.bottom??8)-22),axisLabel:{...e.axisLabel,hideOverlap:!0}}:e,F=Array.isArray(e.yAxis)?e.yAxis.map(P):e.yAxis?P(e.yAxis):void 0,ee=m,I=[...e.graphic??[],...N];if(t.viz===`state_timeline`&&F&&!Array.isArray(F)){let e=F.data,t=Math.max(1,Math.floor((o.height-A-Number(h.bottom??8)-22)/16));if(e.length>t){F={...F,data:e.slice(0,t)},ee=m.map(e=>({...e,data:e.data.filter(e=>e.value[1]e.style?.text?.match(/^\+\d+ rows$/)),r=e.length-t+Number(n?.style.text.match(/\d+/)?.[0]??0);I=I.filter(e=>e!==n),I.push({type:`text`,right:0,bottom:0,style:{text:`+${r} rows`,fill:a.muted,fontSize:11,fontFamily:a.font},tooltip:{formatter:()=>e.slice(t).map(Ey).join(`
`)+(n?`
`+n.tooltip.formatter():``)}})}}return{...e,...d.length||p.length?{tooltip:{...e.tooltip??{},renderMode:`html`}}:{},grid:{...h,top:A},...F?{yAxis:F}:{},graphic:I,series:ee.map((e,t)=>{if(t!==0)return e;let n=e.markLine??{},r=e.markArea??{};return{...e,markLine:{...n,silent:!1,symbol:[`none`,`none`],data:[...n.data??[],...d]},markArea:{...r,silent:!1,data:[...r.data??[],...p]}}})}}function zCe({panel:e,title:t=e.title,result:n,dark:r,height:i,group:a,annotations:o,vars:s,onSelect:c,onPoint:l,onZoom:u,onRangePending:d}){let f=(0,A.useMemo)(()=>t=>{let i=Ry(r),a=yre(e,n,i,t);return o?F$(a,e,n,o,s??{},i,t):a},[e,n.frame,n.previous,n.shift_ms,n.from_ms,n.to_ms,n.annotation_scope,n.annotation_error,r,o]),p=(0,A.useMemo)(()=>f({width:500,height:i}),[f,i]),m=(0,A.useCallback)(t=>!!Qy(e,n,t),[e,n]);return(0,z.jsx)(fX,{keyboard:{canSelect:m,interval:n.interval,onRangePending:d,bounds:n.from_ms!==void 0&&n.to_ms!==void 0?{from:n.from_ms,to:n.to_ms}:void 0},option:p,optionForSize:f,height:i,label:`${t}: time series`,group:a,onZoom:u,onClick:l||c?t=>{let r=Qy(e,n,t);if(!r)return;l?.(r);let i=Object.values(r.dimensions)[0];i!==void 0&&c?.(i)}:void 0})}function BCe(e){return e.dark?[`#0f2a43`,`#164267`,`#1e5a8a`,`#2879ae`,`#399aca`,`#57b8e3`,`#7dd3fc`]:[`#dbeafe`,`#bfdbfe`,`#93c5fd`,`#60a5fa`,`#3b82f6`,`#2563eb`,`#1d4ed8`]}function I$(e,t){return e<=1?0:e>=t?6:Math.max(0,Math.min(6,Math.floor(Math.log10(Math.max(1,e))/Math.log10(t)*6)))}var L$={healthy:`●`,degraded:`■`,unhealthy:`◆`,unknown:`○`},R$=(e,t)=>et);function z$(e,t={}){let n=new Map(e.columns.map((e,t)=>[e.name,t])),r=(t,r)=>e.values[n.get(t)??-1]?.[r],i=(e,t)=>String(r(e,t)??``),a=(e,t)=>{let n=r(e,t);return typeof n==`number`&&Number.isFinite(n)?n:null},o=t.from_ms!==void 0&&t.to_ms!==void 0&&t.to_ms>t.from_ms?(t.to_ms-t.from_ms)/1e3:void 0,s=e=>o&&e!==null?e/o:null,c=new Map,l=[];for(let t=0;t=5?`bad`:c>=1?`warn`:null})}for(let e of l)for(let t of[e.caller,e.callee])c.has(t)||c.set(t,{id:t,health:`unknown`,spans:null,p95_ms:null,error_rate:null,request_rate:null});return{nodes:[...c.values()].sort((e,t)=>R$(e.id,t.id)),edges:l.sort((e,t)=>R$(e.id,t.id))}}function VCe(e){let t=e=>typeof e==`number`&&Number.isFinite(e)?e:null,n=(e,t)=>{let n=Math.max(0,Math.min(1,e/100)),r=3.8416;return Math.max(0,(n+r/(2*t)-1.96*Math.sqrt(n*(1-n)/t+r/(4*t*t)))/(1+r/t))};return e.filter(e=>typeof e.service==`string`).map(e=>{let r=Math.max(0,t(e.spans)??0),i=t(e.error_rate),a=r>=20&&i!==null;return{name:String(e.service),health:String(e.health??`unknown`),n:r,eligible:a,score:a?n(i,r):0,metric:i===null?`—`:`${i.toFixed(1)}%`}}).sort((e,t)=>Number(t.eligible)-Number(e.eligible)||(e.eligible?t.score-e.score:0)||t.n-e.n||R$(e.name,t.name)).slice(0,4)}function HCe(e){let t=/^(\d+)(s|m|h|d)$/.exec(e??``);return t?Number(t[1])*{s:1e3,m:6e4,h:36e5,d:864e5}[t[2]]:6e4}var B$=(e,t)=>dre(typeof e.bucket_lower==`number`?e.bucket_lower:null,typeof e.bucket_upper==`number`?e.bucket_upper:null,t),V$=e=>`${e.bucket_lower}:${e.bucket_upper}`,H$=e=>typeof e?.bucket_lower==`number`?{lower:e.bucket_lower,upper:typeof e.bucket_upper==`number`?e.bucket_upper:void 0}:void 0,UCe=e=>e>=1e3&&e<1e6&&e%1e3==0?`${e/1e3}k`:py(`count`,e);function WCe(e){let t=[];for(let n of[...e].sort((e,t)=>Number(e.value[1])-Number(t.value[1])||Number(e.value[0])-Number(t.value[0]))){let e=t.at(-1);e&&e.value[1]===n.value[1]&&e.value[4]===n.value[4]&&e.value[3]===n.value[0]?(e.value[3]=n.value[3],e.selection.to=n.selection.to):t.push({...n,value:[...n.value],selection:{...n.selection}})}return t}function U$(e,t){return(e.bucket_lower===null?-1/0:Number(e.bucket_lower))-(t.bucket_lower===null?-1/0:Number(t.bucket_lower))||(e.bucket_upper===null?1/0:Number(e.bucket_upper))-(t.bucket_upper===null?1/0:Number(t.bucket_upper))}function W$(e,t){let n=(t.frame?.columns??[]).map(t=>ay(t,e)).join(`, `);return`${e.title}: ${t.frame?.rows??0} rows; ${n}${t.frame?.truncated?`, limited data`:``}`}function GCe(e,t,n,r={width:500,height:248}){let i=t.frame??{columns:[],values:[],rows:0},a=O_(i),o=i.columns.filter(e=>e.role===`dimension`).map(e=>e.name),s=i.columns.filter(e=>e.role===`measure`),c=e.unit??i.columns.find(e=>e.name===`bucket_lower`)?.unit,l={animation:!1,aria:{enabled:!0,description:W$(e,t)},textStyle:{fontFamily:n.font,color:n.text},grid:{left:70,right:24,top:30,bottom:40,containLabel:!0},tooltip:{trigger:`item`,backgroundColor:n.surface,borderColor:n.border,textStyle:{color:n.text,fontFamily:n.font,fontSize:12},renderMode:`html`,formatter:Oy(t=>py(e.unit,t))},legend:{show:!1,textStyle:{color:n.muted}},xAxis:{type:`value`,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11},splitLine:{lineStyle:{color:n.grid}}},yAxis:{type:`value`,splitNumber:gy(r.height-92),axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11},splitLine:{lineStyle:{color:n.grid}}},series:[]};if(e.viz===`scatter`){let t=o[0],i=o[1],c=Ay([...new Set(a.map(e=>i?String(e[i]??``):`Items`))].map(e=>({name:e})),e),u=Ny(c.map(e=>e.name),r.width,c.length>1&&e.options?.legend!==`hidden`,n.text,n.font,r.measureText),d=e.options?.x_scale??e.options?.scale,f=e.options?.y_scale??e.options?.scale,p=e.x_unit??s[0]?.unit,m=e.unit??s[1]?.unit,h=(e,t,r,i)=>{let o=a.map(e=>e[r]).filter(e=>typeof e==`number`&&Number.isFinite(e)),s=Math.min(0,...o),c=Math.max(0,...o);return{type:t===`log`?`log`:`value`,...t===`log`?{splitNumber:gy(i)}:vy(s,c,e,i),axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},splitLine:{lineStyle:{color:n.grid}},axisLabel:{fontFamily:n.font,fontSize:11,color:n.muted,formatter:my(e),hideOverlap:!0}}};return{...l,tooltip:{...l.tooltip,formatter:t=>(Array.isArray(t)?t:[t]).map(t=>{let n=Array.isArray(t.value)?t.value:[];return Dy([`${t.seriesName??``} · ${t.name??``}`,`${ay(s[0]?{...s[0],unit:p}:`x`,e)}: ${py(p,Number(n[0]))}`,`${ay(s[1]?{...s[1],unit:m}:`y`,e)}: ${py(m,Number(n[1]))}`])}).join(`
`)},legend:u.option,grid:{...l.grid,top:u.option.show?u.top+20:28,left:8,right:16,bottom:32},xAxis:{...h(p,d,s[0]?.name,r.width-80),name:ay(s[0]?{...s[0],unit:p}:`x`,e),nameLocation:`middle`,nameGap:28,nameTextStyle:{color:n.muted,fontFamily:n.font,fontSize:11,align:`right`,verticalAlign:`top`}},yAxis:{...h(m,f,s[1]?.name,r.height-u.top-74),name:ay(s[1]?{...s[1],unit:m}:`y`,e),nameLocation:`end`,nameGap:8,nameRotate:0,nameTextStyle:{color:n.muted,fontFamily:n.font,fontSize:11,align:`left`,verticalAlign:`bottom`}},series:c.map(({name:r,items:c},l)=>({type:`scatter`,name:r,interactive:!0,keyboard_unit:m,keyboard_x_unit:p,itemStyle:Iy(ky(r)?n.muted:n_(l,n.dark),n),data:a.filter(e=>!i||c.some(t=>t.name===String(e[i]??``))).filter(e=>typeof e[s[0]?.name]==`number`&&typeof e[s[1]?.name]==`number`).filter(e=>(d!==`log`||Number(e[s[0].name])>0)&&(f!==`log`||Number(e[s[1].name])>0)).map(n=>({name:String(n[t]??``),value:[n[s[0].name],n[s[1].name]],selection:{dimensions:Object.fromEntries((e.query?.by??[]).map((e,t)=>[e,String(n[o[t]]??``)]))}}))}))}}if(e.viz===`histogram`){let t=o.find(e=>e!==`bucket_lower`&&e!==`bucket_upper`),i=[...new Map([...a].sort(U$).map(e=>[V$(e),e])).values()],s=i.map(e=>B$(e,c)),u=Ay([...new Set(a.map(e=>t?String(e[t]??``):`Count`))].map(e=>({name:e})),e),d=Ny(u.map(e=>e.name),r.width,u.length>1&&e.options?.legend!==`hidden`,n.text,n.font,r.measureText),f=u.map(({name:r,items:o},s)=>({type:`bar`,name:r,interactive:!0,keyboard_unit:`count`,itemStyle:Iy(ky(r)?n.muted:n_(s,n.dark),n),data:i.map(n=>{let i=a.filter(e=>(!t||o.some(n=>n.name===String(e[t]??``)))&&V$(e)===V$(n));return{value:gre(i.map(e=>typeof e.count==`number`?e.count:null))??0,selection:{dimensions:t?{[e.query?.by?.[0]??t]:r}:{},bucket:H$(i[0])}}})}));return{...l,legend:d.option,grid:{...l.grid,left:16,right:8,top:d.option.show?d.top+20:28,bottom:8},xAxis:{...l.xAxis,type:`category`,data:s,splitLine:{show:!1}},yAxis:{...l.yAxis,type:`value`,name:ay(`count`),nameLocation:`end`,nameGap:8,nameRotate:0,...vy(0,Math.max(0,...f.flatMap(e=>e.data.map(e=>e.value))),`count`,r.height-(d.option.show?d.top+20:28)-30),axisLabel:{...l.yAxis.axisLabel,hideOverlap:!0},nameTextStyle:{color:n.muted,fontFamily:n.font,fontSize:11,align:`right`,verticalAlign:`bottom`}},series:f}}if(e.viz===`service_map`)return{model:z$(i,t)};if(e.viz===`heatmap`||e.viz===`state_timeline`){let i=e.viz===`heatmap`,u=o[0],d=e=>i?V$(e):String(e[u]??``),f=[...new Set((i?[...a].sort(U$):a).map(d))],p=i?f:f.slice(0,Math.max(1,Math.floor((r.height-54)/16))),m=f.slice(p.length),h=new Map(a.map(e=>[V$(e),B$(e,c)])),g=HCe(t.interval),_=s[0]?.name??`count`,v=a.filter(e=>typeof e.time==`number`&&p.includes(d(e))).map(r=>{let a=r[_],o=typeof a==`number`?cy(a,e.thresholds,e.better??t.better)??`ok`:null;return{value:[r.time,p.indexOf(d(r)),a,Number(r.time)+g,i||o===null?0:o===`bad`?3:o===`warn`?2:1],selection:{...i?{time:r.time}:{},dimensions:i?{}:{[e.query?.by?.[0]??u]:String(r[u]??``)},bucket:i?H$(r):void 0,...i?{}:{from:new Date(Number(r.time)).toISOString(),to:new Date(Number(r.time)+g).toISOString()}},itemStyle:i?void 0:{color:o===null?`${n.text}26`:n.status[o]}}}),y=v.filter(e=>Number.isFinite(Number(e.value[2]))&&Number(e.value[2])>0),b=y.map(e=>Number(e.value[2])).sort((e,t)=>e-t),x=b[Math.max(0,Math.ceil(b.length*.99)-1)]??1,S=BCe(n),C=i?y.map(e=>({...e,value:[...e.value,I$(Number(e.value[2]),x)]})):WCe(v).map(e=>({...e,tooltip:{formatter:()=>`${Ey(p[Number(e.value[1])])} · ${[`Unknown`,`OK`,`Warn`,`Bad`][Number(e.value[4])]}\n${xy(Number(e.value[0]))} – ${xy(Number(e.value[3]))}`}})),w=UCe(b.length?x:0);return{...l,grid:{...l.grid,left:8,right:8,top:8,bottom:i?32:m.length?24:8},tooltip:{...l.tooltip,trigger:`axis`,formatter:t=>(Array.isArray(t)?t:[t]).map(t=>{let n=Array.isArray(t.value)?t.value:[];return Dy([`${t.seriesName??``} · ${t.name??``}`,i?h.get(p[Number(n[1])])??``:p[Number(n[1])]??``,`${xy(Number(n[0]))} – ${xy(Number(n[3]))}`,`${ay(s[0]??_,e)}: ${py(i?`count`:e.unit??s[0]?.unit,typeof n[2]==`number`?n[2]:null)}`])}).join(`
`)},axisPointer:{link:[{xAxisIndex:`all`}]},xAxis:{type:`time`,min:t.from_ms,max:t.to_ms,axisPointer:{show:!0},axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{fontFamily:n.font,fontSize:11,color:n.muted,formatter:by,hideOverlap:!0}},yAxis:{type:`category`,data:i?p.map(e=>h.get(e)):p,axisLine:{show:!1},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{fontFamily:n.font,fontSize:11,color:n.muted,width:140,overflow:`truncate`,...i?{interval:+((r.height-60)/Math.max(1,p.length)<12),hideOverlap:!0}:{interval:0}}},visualMap:i?{type:`continuous`,show:!0,orient:`horizontal`,right:16,bottom:0,padding:0,itemWidth:8,itemHeight:96,text:[w,b.length?`1`:`0`],textGap:10,textStyle:{color:n.muted,fontFamily:n.font,fontSize:11},min:0,max:6,dimension:5,inRange:{color:S}}:void 0,graphic:!i&&m.length?[{type:`text`,right:0,bottom:0,style:{text:`+${m.length} rows`,fill:n.muted,fontSize:11,fontFamily:n.font},tooltip:{formatter:()=>m.map(Ey).join(`
`)}}]:[],series:[{type:`custom`,clip:!0,name:e.title,interactive:!0,keyboard_unit:i?`count`:e.unit??s[0]?.unit,encode:{x:[0,3],y:1,tooltip:2},data:C,renderItem:(e,t)=>{let n=t.coord([t.value(0),t.value(1)]),r=t.coord([t.value(3),t.value(1)]),a=Math.abs(t.size([0,1])[1])*(i?1:.65),o=i&&Math.abs(r[0]-n[0])>=8?1:0;if(!i||t.value(2)>0)return{type:`rect`,shape:{x:n[0]+o/2,y:n[1]-a/2+o/2,width:Math.max(0,r[0]-n[0]-o),height:Math.max(0,a-o),r:i?0:Math.min(3,a/4)},style:{fill:t.visual(`color`),stroke:void 0,lineWidth:0,...i?{fill:S[I$(t.value(2),x)]}:{}}}}}]}}return l}function G$({panel:e,title:t,result:n,dark:r,height:i,group:a,annotations:o,vars:s,onSelect:c,onPoint:l,onZoom:u,onRangePending:d}){let f=(0,A.useMemo)(()=>t=>{let i=Ry(r),a=GCe(e,n,i,t);return o?F$(a,e,n,o,s??{},i,t):a},[e,n.frame,n.interval,n.better,n.from_ms,n.to_ms,n.annotation_scope,n.annotation_error,r,o]),p=W$(t?{...e,title:t}:e,n),m=(0,A.useMemo)(()=>f({width:500,height:i}),[f,i]),h=(0,A.useCallback)(t=>!!(t.data?.selection&&Qy(e,n,t)),[e,n]),g=e.viz===`heatmap`||e.viz===`state_timeline`;return(0,z.jsx)(fX,{keyboard:{canSelect:h,onRangePending:d,bounds:g&&n.from_ms!==void 0&&n.to_ms!==void 0?{from:n.from_ms,to:n.to_ms}:void 0},option:m,optionForSize:f,height:i,label:p,group:g?a:void 0,onZoom:g?u:void 0,onClick:l||c?t=>{let r=h(t)?Qy(e,n,t):void 0;if(r){l?.(r);let e=Object.values(r.dimensions)[0];e!==void 0&&c?.(e)}}:void 0})}function KCe(e){return(0,z.jsx)(G$,{...e})}function qCe(e){return(0,z.jsx)(G$,{...e})}function JCe(e){return(0,z.jsx)(G$,{...e})}function YCe(e){return(0,z.jsxs)(dh,{gap:4,style:{flex:`1 1 auto`,minHeight:0},children:[(0,z.jsx)(G$,{...e,height:Math.max(60,e.height-24)}),(0,z.jsx)(vl,{gap:`sm`,wrap:`nowrap`,role:`list`,"aria-label":`State legend`,style:{flexShrink:0},children:[[`● OK`,`ok`],[`■ Warn`,`warn`],[`◆ Bad`,`bad`],[`○ Unknown`,`dimmed`]].map(([t,n])=>(0,z.jsx)(Ed,{size:`xs`,style:{color:n===`dimmed`?Ry(e.dark).muted:Ly(n,e.dark)},role:`listitem`,children:t},t))})]})}var K$=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,'(function(){var e=Object.defineProperty,t=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,n=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},r=(e,n,r)=>t(e,typeof n==`symbol`?n:n+``,r),i={};n(i,{Graph:()=>D,alg:()=>_});var a=Object.defineProperty,o=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},s=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\\0`,this._children[e]={},this._children[`\\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\\0`)return t}}children(e=`\\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),(t?.length??0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,l=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,l=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,l=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let f=u(this._isDirected,i,a,o);if(f in this._edgeLabels)return l&&(this._edgeLabels[f]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[f]=l?s:this._defaultEdgeLabelFn(i,a,o);let p=d(this._isDirected,i,a,o);return i=p.v,a=p.w,Object.freeze(p),this._edgeObjs[f]=p,c(this._preds[a],i),c(this._sucs[i],a),this._in[a][f]=p,this._out[i][f]=p,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?f(this._isDirected,e):u(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!=`object`||!r?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?f(this._isDirected,e):u(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?f(this._isDirected,e):u(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],l(this._preds[t],e),l(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function c(e,t){e[t]?e[t]++:e[t]=1}function l(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function u(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\\0`:r)}function d(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function f(e,t){return u(e,t.v,t.w,t.name)}o({},{read:()=>g,write:()=>p});function p(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:m(e),edges:h(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function m(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function h(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function g(e){let t=new s(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var _={};o(_,{CycleException:()=>w,bellmanFord:()=>y,components:()=>x,dijkstra:()=>C,dijkstraAll:()=>ne,findCycles:()=>ie,floydWarshall:()=>oe,isAcyclic:()=>ce,postorder:()=>de,preorder:()=>fe,prim:()=>pe,shortestPaths:()=>me,tarjan:()=>re,topsort:()=>T});var v=()=>1;function y(e,t,n,r){return b(e,String(t),n||v,r||function(t){return e.outEdges(t)??[]})}function b(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=i[e.v],r=i[e.w];if(!t||!r)return;let o=n(e);t.distance+oe.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw Error(`Queue underflow`);this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n>1,!(t[r].priority1;function C(e,t,n,r){return te(e,String(t),n||ee,r||function(t){return e.outEdges(t)??[]})}function te(e,t,n,r){let i={},a=new S,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t];if(!r)return;let c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l0;){o=a.removeMin();let e=i[o];if(!e||e.distance===1/0)break;s=e,r(o).forEach(c)}return i}function ne(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=C(e,i,t,n),r},{})}function re(e){let t=0,n=[],r={},i=[];function a(o){var s;let c=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),(s=e.successors(o))==null||s.forEach(function(e){if(e in r){let t=r[e];t!=null&&t.onStack&&(c.lowlink=Math.min(c.lowlink,t.index))}else{a(e);let t=r[e];t&&(c.lowlink=Math.min(c.lowlink,t.lowlink))}}),c.lowlink===c.index){let e=[],t;do{t=n.pop();let i=r[t];i&&(i.onStack=!1),e.push(t)}while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function ie(e){return re(e).filter(function(t){let n=t[0];return n?t.length>1||t.length===1&&(e.outEdges(n,n)??[]).length>0:!1})}var ae=()=>1;function oe(e,t,n){return se(e,t||ae,n||function(t){return e.outEdges(t)??[]})}function se(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){let a={};r[e]=a,a[e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(a[t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=t(n);a[r]={distance:i,predecessor:e}})}),i.forEach(function(e){let t=r[e];t&&i.forEach(function(n){let a=r[n];a&&i.forEach(function(n){let r=a[e],i=t[n],o=a[n];if(r&&i&&o){let e=r.distance+i.distance;e(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=E(e,t,n===`post`,o,a,r,i)}),i}function E(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=E(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function ue(e,t,n){return le(e,t,n,function(e,t){return e.push(t),e},[])}function de(e,t){return ue(e,t,`post`)}function fe(e,t){return ue(e,t,`pre`)}function pe(e,t){var n;let r=new s,i={},a=new S,o;function c(e){let n=e.v===o?e.w:e.v,r=a.priority(n);if(r!==void 0){let s=t(e);s0;){if(o=a.removeMin(),o in i)r.setEdge(o,i[o]);else{if(u)throw Error(`Input graph is not connected: `+e);u=!0}(n=e.nodeEdges(o))==null||n.forEach(c)}return r}function me(e,t,n,r){return he(e,t,n,r??(t=>e.outEdges(t)??[]))}function he(e,t,n,r){if(n===void 0)return C(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;ot.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function _e(e){let t=new D({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function ve(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function k(e){let t=F(N(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function ye(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=M(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function be(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=M(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function A(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),O(e,`border`,i,t)}function xe(e,t=j){let n=[];for(let r=0;rj?e(...xe(t).map(t=>e(...t))):e(...t)}function N(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return M(Math.max,t)}function Se(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Ce(e,t){return t()}var we=0;function P(e){return e+(``+ ++we)}function F(e,t,n=1){t??(t=e,e=0);let r=e=>ete[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function Te(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var R=`\\0`;function z(e,t,n){if(!(e&&t&&n&&t.dummy===`edge`&&n.dummy===`edge`&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let r=!0;t.edgeObj.w===n.edgeObj.w&&(r=!1);let i=r?e[t.edgeObj.v]?.rank??NaN:e[t.edgeObj.w]?.rank??NaN,a=Object.entries(e).find(e=>e[1].edgeObj?.v===t.edgeObj.v&&e[1].edgeObj?.w===t.edgeObj.w&&e[1].rank===i),o=Object.entries(e).find(e=>e[1].edgeObj?.v===n.edgeObj.v&&e[1].edgeObj?.w===n.edgeObj.w&&e[1].rank===i);if(!a||!o)return 0;let s=a[1].order??NaN,c=o[1].order??NaN;return isNaN(s-c)?0:s-c}var Ee=class{constructor(){r(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return B(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&B(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,De)),n=n._prev;return`[`+e.join(`, `)+`]`}};function B(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function De(e,t){if(e!==`_next`&&e!==`_prev`)return t}var Oe=Ee,ke=()=>1;function Ae(e,t){if(e.nodeCount()<=1)return[];let n=Me(e,t||ke);return je(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function je(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)V(e,t,n,o);for(;o=i.dequeue();)V(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(V(e,t,n,o,!0)||[]);break}}}return r}function V(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,H(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,H(t,n,o)}),e.removeNode(r.v),o}function Me(e,t){let n=new D,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=Ne(i+r+3).map(()=>new Oe),o=r+1;return n.nodes().forEach(e=>{H(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function H(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function Ne(e){let t=[];for(let n=0;n{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,P(`rev`))});function n(e){return t=>e.edge(t).weight}}function Fe(e,t){let n=[],r={},i={};function a(t){Object.hasOwn(i,t)||(i[t]=!0,r[t]=!0,e.outEdges(t).forEach(e=>{Object.hasOwn(r,e.w)?n.push(e):a(e.w)}),delete r[t])}function o(a){var s;Object.hasOwn(i,a)||(i[a]=!0,r[a]=!0,(s=e.outEdges(a))==null||s.forEach(i=>{Object.hasOwn(r,i.w)||t.node(a)?.rank>t.node(i.w)?.rank&&Le(e,i.w,i)?n.push(i):o(i.w)}),delete r[a])}let s=a;return t&&typeof t.node==`function`&&(s=o),e.sources().forEach(s),e.nodes().forEach(s),n}function Ie(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Le(e,t,n){let r=/* @__PURE__ */ new Set;function i(t){if(e.sources().includes(t))return!0;r.add(t);for(let a of e.inEdges(t)??[])if((a.v!==n.v||a.w!==n.w)&&!r.has(a.v)&&i(a.v))return!0;return!1}return i(t)}function Re(e){e.graph().dummyChains=[],e.edges().forEach(t=>ze(e,t))}function ze(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d=0;for(++r;r{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function U(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=M(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function W(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Ve=He;function He(e){let t=new D({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;Ue(t,e){let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!W(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function We(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=W(t,r)),it.node(e).rank+=n)}var{preorder:Ke,postorder:qe}=_,Je=G;G.initLowLimValues=q,G.initCutValues=K,G.calcCutValue=Xe,G.leaveEdge=Qe,G.enterEdge=$e,G.exchangeEdges=et;function G(e){e=ge(e),U(e);let t=Ve(e);q(t),K(t,e);let n,r;for(;n=Qe(t);)r=$e(t,e,n),et(t,e,n,r)}function K(e,t){let n=qe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>Ye(e,t,n))}function Ye(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=Xe(e,t,n)}function Xe(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,nt(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function q(e,t){arguments.length<2&&(t=e.nodes()[0]),Ze(e,{},1,t)}function Ze(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=Ze(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function Qe(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function $e(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===rt(e,e.node(t.v),s)&&c!==rt(e,e.node(t.w),s)).reduce((e,n)=>W(t,n)!e.node(t).parent);if(!n)return;let r=Ke(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function nt(e,t,n){return e.hasEdge(t,n)}function rt(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var it=at;function at(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:ct(e);break;case`tight-tree`:st(e);break;case`longest-path`:ot(e);break;case`none`:break;default:ct(e)}}var ot=U;function st(e){U(e),Ve(e)}function ct(e){Je(e)}var lt=ut;function ut(e){let t=ft(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=dt(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRanko||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function ft(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(R).forEach(r),t}function pt(e){let t=O(e,`root`,{},`_root`),n=mt(e),r=Object.values(n),i=M(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=ht(e)+1;e.children(R).forEach(r=>{J(e,t,a,o,i,n,r)}),e.graph().nodeRankFactor=a}function J(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=A(e,`_bt`),l=A(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{J(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function mt(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(R).forEach(e=>n(e,1)),t}function ht(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function gt(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var _t=vt;function vt(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),i&&Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;tCt(e.node(t))),e.edges().forEach(t=>Ct(e.edge(t)))}function Ct(e){let t=e.width;e.width=e.height,e.height=t}function wt(e){e.nodes().forEach(t=>Y(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Y),Object.hasOwn(r,`y`)&&Y(r)})}function Y(e){e.y=-e.y}function Tt(e){e.nodes().forEach(t=>X(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(X),Object.hasOwn(r,`x`)&&X(r)})}function X(e){let t=e.x;e.x=e.y,e.y=t}function Et(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=F(M(Math.max,i)+1).map(()=>[]);function o(t){if(n[t])return;n[t]=!0;let r=e.node(t);a[r.rank].push(t);let i=e.successors(t);i&&[...i].sort((e,t)=>s(e,t)).forEach(o)}r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(o);function s(n,r){return z(t,e.node(n),e.node(r))}return a}function Dt(e,t){let n=0;for(let r=1;rt)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function kt(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function At(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),jt(Object.values(n).filter(e=>!e.indegree))}function jt(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&Mt(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>I(e,[`vs`,`i`,`barycenter`,`weight`]))}function Mt(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Nt(e,t,n,r,i){let a={},o=null,s=null,c=i;typeof t==`boolean`?(c=t,a={}):t&&(a=t,o=n??null,s=r??null);let l=Se(e,e=>Object.hasOwn(e,`barycenter`)),u=l.lhs,d=l.rhs.sort((e,t)=>t.i-e.i),f=[],p=0,m=0,h=0;u.sort(Ft(s,o,!!c));for(let[e,t]of Object.entries(a)){let n=u.findIndex(t=>t.vs[0]===e);u.splice(n+1,0,t)}h=Pt(f,d,h),u.forEach(e=>{h+=e.vs.length,f.push(e.vs),p+=e.barycenter*e.weight,m+=e.weight,h=Pt(f,d,h)});let g={vs:f.flat(1)};return m&&(g.barycenter=p/m,g.weight=m),g}function Pt(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Ft(e,t,n){return(r,i)=>{if(r.barycenteri.barycenter)return 1;if(e&&(typeof r.vs[0]==`string`||typeof i.vs[0]==`string`)){let n=z(t,e.node(r.vs[0]),e.node(i.vs[0]));if(n!==0)return n}return n?i.i-r.i:r.i-i.i}}function It(e,t,n,r,i){var a,o;let s=null,c=i;typeof r==`boolean`?(c=r,s=null):r!==void 0&&(s=r);let l=e.children(t),u=e.node(t),d=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};d&&(l=l.filter(e=>e!==d&&e!==f));let m=kt(e,l);m.forEach(t=>{if(e.children(t.v).length){let{result:r}=It(e,t.v,n,s,c);p[t.v]=r,Object.hasOwn(r,`barycenter`)&&Rt(t,r)}});let h=At(m,n);Lt(h,p);let g={},_=!1;for(let t=0;t{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function Rt(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function zt(e,t,n,r){r||=e.nodes();let i=Bt(e),a=new D({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function Bt(e){let t;for(;e.hasNode(t=P(`_root`)););return t}function Vt(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function Ht(e,t={},n=null){if(typeof t.customOrder==`function`){t.customOrder(e,Ht);return}let r=N(e),i=Ut(e,F(1,r+1),`inEdges`),a=Ut(e,F(r-1,-1,-1),`outEdges`),o=Et(e,n);if(Gt(e,o),t.disableOptimalOrderHeuristic)return;let s=1/0,c,l=t.constraints||[];for(let t=0,r=0;r<4;++t,++r){Wt(t%2?i:a,t%4>=2,l,n),o=k(e);let u=Dt(e,o);u{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return zt(e,t,n,r.get(t)||[])})}function Wt(e,t,n,r){let i=!0,a=new D;e.forEach(function(e){n.forEach(e=>a.setEdge(e.left,e.right));let o=e.graph().root,{result:s,usedBias:c}=It(e,o,a,r,i);t&&c&&(i=!i),s.vs.forEach((t,n)=>e.node(t).order=n),Vt(e,a,s.vs)})}function Gt(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function Kt(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=Jt(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.ordero)&&Yt(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function Jt(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function Yt(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function Xt(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function Zt(e,t,n,r,i){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(t=>{let c=-1,l=-1,u=!1,d=t,f=t.findIndex(t=>i?.includes(t)||sn(t,e,i));f>0&&(d=[t[f],...t.slice(0,f),...t.slice(f+1)],u=!0),d.forEach(t=>{let d=r(t);if(d&&d.length){i!=null&&i.includes(t)&&(d=d.filter(t=>sn(t,e,i)));let r=d.sort((e,t)=>{let n=s[e],r=s[t];return(n===void 0?0:n)-(r===void 0?0:r)}),f=(r.length-1)/2;for(let e=Math.floor(f),i=Math.ceil(f);e<=i;++e){let i=r[e];if(i===void 0)continue;let d=s[i];if(d!==void 0&&o[t]===t&&c{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function $t(e,t,n,r){let i=new D,a=e.graph(),o=an(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function en(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=on(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-M(Math.min,c);a!==`l`&&(l=i-M(Math.max,c)),l&&(e[o]=L(s,e=>e+l))})})}function nn(e,t=void 0){let n=e.ul;return n?L(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function rn(e,t){let n=k(e),r=Object.assign(Kt(e,n),qt(e,n)),i={},a;return[`u`,`d`].forEach(o=>{a=o===`u`?n:Object.values(n).reverse(),[`l`,`r`].forEach(n=>{n===`r`&&(a=a.map(e=>Object.values(e).reverse()));let s=Zt(e,a,r,t=>(o===`u`?e.predecessors(t):e.successors(t))||[],t),c=Qt(e,a,s.root,s.align,n===`r`);n===`r`&&(c=L(c,e=>-e)),i[o+n]=c})}),tn(i,en(e,i)),nn(i,e.graph().align)}function an(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),c}}function on(e,t){return e.node(t).width}function sn(e,t,n){if(!n)return!1;let r=t.node(e)?.edgeObj;if(!r||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(r?.v),a=n.indexOf(r?.w);return i!==-1&&a!==-1&&i===(a+1)%n.length||i===(a-1)%n.length}function cn(e,t){e=_e(e),ln(e),Object.entries(rn(e,t)).forEach(([t,n])=>e.node(t).x=n)}function ln(e){let t=k(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}var un=/* @__PURE__ */ new WeakMap;function dn(e,t={}){return pn(e,Ce,t),e}function fn(e,t,n){let r=t;for(;r!==void 0;){let t=e.parent(r);if(t===n)return r;r=t}}function pn(e,t,n){let r=e.nodes().filter(t=>e.children(t).length),i={};r.forEach(r=>{let a=e.node(r);if(a&&a.rankdir){let o=new D({multigraph:!0,compound:!0});o.setGraph({rankdir:a.rankdir});let s=e.children(r);s.forEach(t=>{let n={...e.node(t)};o.setNode(t,n);let i=e.parent(t);i&&i!==r&&s.includes(i)&&o.setParent(t,i)});let c=/* @__PURE__ */ new Set;e.edges().forEach(t=>{let n=fn(e,t.v,r),i=fn(e,t.w,r);if(n&&i&&n!==i){let r=`${n}\\0${i}`;c.has(r)||(c.add(r),o.setEdge(n,i,{...e.edge(t)}))}}),pn(o,t,n);let l=wn(o);mn(l,t,n,null),hn(o,l);let u=1/0,d=1/0,f=-1/0,p=-1/0;o.nodes().forEach(e=>{if(e===r)return;let t=o.node(e);t&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.width==`number`&&typeof t.height==`number`&&(u=Math.min(u,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),d=Math.min(d,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),(!isFinite(u)||!isFinite(d)||!isFinite(f)||!isFinite(p))&&(u=d=0,f=p=0);let m=f-u,h=p-d;i[r]={minX:u,minY:d,maxX:f,maxY:p,width:m,height:h,offsetX:u,offsetY:d},a._dagreClusterSubgraph=o}});let a=[],o=t=>{let n=[],r=(e.children(t)||[]).filter(e=>e!==t);for(;r.length>0;){let t=r.shift();n.push(t),(e.children(t)||[]).filter(e=>e!==t).forEach(e=>r.push(e))}return n},s=/* @__PURE__ */ new Map;r.forEach(t=>{let n=e.node(t);n&&n.rankdir&&i[t]&&s.set(t,(e.children(t)||[]).filter(e=>e!==t))});let c=new Set([...s.values()].flat()),l=/* @__PURE__ */ new Map;s.forEach((e,t)=>{c.has(t)||l.set(t,o(t))});let u=new Set([...l.values()].flat()),d=e=>{for(let[t,n]of l)if(n.includes(e))return t;return e},f=[];e.edges().forEach(t=>{(u.has(t.v)||u.has(t.w))&&f.push({edge:t,label:e.edge(t)})});let p=/* @__PURE__ */ new Map;u.forEach(t=>{let n=e.parent(t);p.set(t,typeof n==`string`?n:void 0)}),l.forEach((t,n)=>{let r=e.node(n),o=[];t.forEach(t=>{let n=e.node(t);n&&(o.push({id:t,node:n,parent:p.get(t)}),e.removeNode(t))});let s=f.filter(({edge:e})=>t.includes(e.v)||t.includes(e.w)),c=i[n];r&&(a.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:c,children:t,removedNodes:o,removedEdges:s}),r.width=c.width,r.height=c.height)});let m=/* @__PURE__ */ new Set;f.forEach(({edge:t,label:n})=>{let r=d(t.v),i=d(t.w);if(r!==i&&e.hasNode(r)&&e.hasNode(i)){let t=`${r}\\0${i}`;m.has(t)||(m.add(t),e.setEdge(r,i,{...n,width:0,height:0}))}});let h=wn(e),g=mn(h,t,n,un.get(e)??null);un.set(e,g),hn(e,h),m.forEach(t=>{let n=t.indexOf(`\\0`),r=t.slice(0,n),i=t.slice(n+1);e.hasEdge(r,i)&&e.removeEdge(r,i)}),a.forEach(({clusterId:t,subgraph:n,bounds:r,removedNodes:i,removedEdges:a})=>{let o=e.node(t),s=o?.x??0,c=o?.y??0,l=(r.minX+r.maxX)/2,u=(r.minY+r.maxY)/2;i.forEach(({id:t,node:n,parent:r})=>{e.setNode(t,n),r!==void 0&&e.setParent(t,r)}),a.forEach(({edge:t,label:n})=>{e.setEdge(t,n)}),n.nodes().forEach(r=>{if(r===t)return;let i=n.node(r),a=e.node(r);a&&i&&typeof i.x==`number`&&typeof i.y==`number`&&(a.x=s+(i.x-l),a.y=c+(i.y-u))}),delete o._dagreClusterSubgraph}),r.forEach(t=>{let n=e.node(t),r=i[t];if(n&&n.rankdir&&n._dagreClusterSubgraph&&r){let i=n._dagreClusterSubgraph,a=n.x??0,o=n.y??0,s=(r.minX+r.maxX)/2,c=(r.minY+r.maxY)/2;i.nodes().forEach(n=>{if(n===t)return;let r=i.node(n),l=e.node(n);if(l&&r&&typeof r.x==`number`&&typeof r.y==`number`){let e=r.x-s,t=r.y-c;l.x=a+e,l.y=o+t}}),delete n._dagreClusterSubgraph}})}function mn(e,t,n,r=null){var i,a;let o=n?.useDynamic!==!1,s=o&&(i=r?.graph)!=null?i:null,c=o&&(a=r?.rawNodes)!=null?a:null;t(` makeSpaceForEdgeLabels`,()=>Tn(e)),t(` removeSelfEdges`,()=>Pn(e)),t(` acyclic`,()=>Pe(e,s)),t(` nestingGraph.run`,()=>pt(e)),t(` rank`,()=>it(_e(e))),t(` injectEdgeLabelProxies`,()=>En(e)),t(` removeEmptyRanks`,()=>be(e)),t(` nestingGraph.cleanup`,()=>gt(e)),t(` normalizeRanks`,()=>ye(e)),t(` assignRankMinMax`,()=>Dn(e)),t(` removeEdgeLabelProxies`,()=>On(e)),t(` normalize.run`,()=>Re(e)),t(` parentDummyChains`,()=>lt(e)),t(` addBorderSegments`,()=>_t(e)),t(` order`,()=>Ht(e,n,c)),t(` insertSelfEdges`,()=>Fn(e)),t(` adjustCoordinateSystem`,()=>bt(e)),t(` position`,()=>cn(e,n.corePath)),t(` positionSelfEdges`,()=>In(e));let l=JSON.parse(JSON.stringify(e._nodes));return t(` removeBorderNodes`,()=>Nn(e)),t(` normalize.undo`,()=>Be(e)),t(` fixupEdgeLabelCoords`,()=>jn(e)),t(` undoCoordinateSystem`,()=>xt(e)),t(` translateGraph`,()=>kn(e)),t(` assignNodeIntersects`,()=>An(e)),t(` reversePoints`,()=>Mn(e)),t(` acyclic.undo`,()=>Ie(e)),{graph:e,rawNodes:l}}function hn(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var gn=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],_n={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},vn=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],yn=[`width`,`height`,`rank`],bn={width:0,height:0},xn=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Sn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Cn=[`labelpos`];function wn(e){let t=new D({multigraph:!0,compound:!0}),n=Q(e.graph());return t.setGraph(Object.assign({},_n,Z(n,gn),I(n,vn))),e.nodes().forEach(n=>{let r=Z(Q(e.node(n)),yn);Object.keys(bn).forEach(e=>{r[e]===void 0&&(r[e]=bn[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=Q(e.edge(n));t.setEdge(n,Object.assign({},Sn,Z(r,xn),I(r,Cn)))}),t}function Tn(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,(r.labelpos??`r`).toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function En(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);O(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function Dn(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function On(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function kn(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function An(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(ve(r,a)),n.points.push(ve(i,o))})}function jn(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function Mn(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Nn(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function Pn(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Fn(e){k(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);typeof i.rank!=`number`&&(i.rank=0),i.order=r+n,(i.selfEdges||[]).forEach(t=>{O(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,edgeLabel:t.label},`_se`),(!Array.isArray(t.label.points)||t.label.points.length!==7)&&(t.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function In(e){e.nodes().forEach(t=>{let n=e.node(t),r=e=>typeof e==`number`&&isFinite(e);if(n.dummy===`selfedge`){let i=n,a=e.node(i.e.v),o=r(a?.x)?a.x:0,s=r(a?.y)?a.y:0,c=r(a?.width)?a.width:0,l=r(a?.height)?a.height:0,u=r(n.x)?n.x:o,d=r(n.y)?n.y:s,f=c/2,p=l/2;i.edgeLabel.points=[{x:u+f,y:d-p},{x:u+f,y:d-p},{x:u,y:d},{x:u-f,y:d+p},{x:u-f,y:d+p},{x:u,y:d},{x:u,y:d}],i.edgeLabel.x=u,i.edgeLabel.y=d,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||e.label.points.length!==7){let t=r(n.x)?n.x:0,i=r(n.y)?n.y:0,a=r(n.width)?n.width:0,o=r(n.height)?n.height:0,s=a/2,c=o/2;e.label.points=[{x:t+s,y:i-c},{x:t+s,y:i-c},{x:t,y:i},{x:t-s,y:i+c},{x:t-s,y:i+c},{x:t,y:i},{x:t,y:i}]}})})}function Z(e,t){return L(I(e,t),Number)}function Q(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}\n/*! For license information please see dagre.esm.js.LEGAL.txt */\nlet Ln={healthy:`●`,degraded:`■`,unhealthy:`◆`,unknown:`○`};new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}),new Intl.NumberFormat(`en`,{maximumFractionDigits:2});let Rn={micro:11,small:12,body:14,title:16,section:22,page:32},zn={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`},$=(e,t)=>et),Bn=Math.ceil(Rn.micro*1.4+2)/20;function Vn(e,t){let n=Object.create(null);for(let r of e.nodes)n[r.id]={full:qn(r,!1,t),compact:qn(r,!0,t)};let r=Object.entries(n).sort(([e],[t])=>$(e,t)),i=JSON.stringify([r.map(([e])=>e),e.edges.map(e=>[e.id,e.caller,e.callee]).sort((e,t)=>$(e[0],t[0]))]);return{key:JSON.stringify([i,r]),topology:i,widths:n}}function Hn(e,t,n){let r=n??Vn(e,t.measureText).widths;return{...Un(e,r,!0),full:Un(e,r,!1)}}function Un(e,t,n){let r=[...e.nodes].sort((e,t)=>$(e.id,t.id)),a=[...e.edges].sort((e,t)=>$(e.id,t.id)),o=new Set(a.flatMap(e=>[e.caller,e.callee])),s=new Set(a.map(e=>e.callee)),c=new Set(a.map(e=>e.caller)),l=new i.Graph({directed:!0,multigraph:!0});l.setDefaultEdgeLabel(()=>({}));let u=n?20:44;l.setGraph({rankdir:`LR`,ranker:`network-simplex`,acyclicer:`greedy`,ranksep:n?16:32,nodesep:n?4:8,edgesep:n?2:8,marginx:0,marginy:0});let d=new Map(r.map(e=>[e.id,t[e.id][n?`compact`:`full`]]));for(let e of r)o.has(e.id)&&l.setNode(e.id,{width:d.get(e.id),height:u});for(let e of a)l.setEdge(e.caller,e.callee,{weight:1,minlen:1},e.id);l.nodeCount()&&dn(l);let f=r.filter(e=>o.has(e.id)).map(e=>({...e,x:l.node(e.id).x-d.get(e.id)/2,y:l.node(e.id).y-u/2,width:d.get(e.id),height:u,entry:c.has(e.id)&&!s.has(e.id),uncalled:!1})),p=a.map(e=>l.edge(e.caller,e.callee,e.id).points),m=r.filter(e=>!o.has(e.id)),h=m.reduce((e,t)=>e+d.get(t.id)+12,0)-(m.length?12:0),g=m.length?Wn(`No traced calls in this window`,`12px ${zn.display}`):0,_=Math.max(1,l.graph().width??0,h,g),v=(_-h)/2,y=Math.max(0,l.graph().height??0,...p.flat().map(e=>e.y),...f.map(e=>e.y+e.height)),b=y+(y?40:24);for(let e of m)f.push({...e,x:v,y:b,width:d.get(e.id),height:u,entry:!1,uncalled:!0}),v+=d.get(e.id)+12;let x=(_-(l.graph().width??0))/2;for(let e of f)e.uncalled||(e.x+=x);for(let e of p)for(let t of e)t.x+=x;let S=new Map(f.map(e=>[e.id,e]));for(let[e,t]of a.entries()){let n=S.get(t.caller),r=S.get(t.callee),i=p[e].slice(1,-1);if(!i.length||n===r)continue;let a=n.xArray.from(e).length*Number(t.match(/([\\d.]+)px/)?.[1]??11)*.6,Gn=e=>Array.from(e).length>24?Array.from(e).slice(0,24).join(``)+`…`:e,Kn=/* @__PURE__ */ new WeakMap;function qn(e,t,n){let r=n??Wn,i=Kn.get(r);i||(i=/* @__PURE__ */ new Map,Kn.set(r,i));let a=`600 ${t?Rn.micro/Bn:12}px ${zn.display}`,o=i.get(a);o===void 0&&(o=Math.max(...Object.values(Ln).map(e=>r(e,a))),i.set(a,o));let s=t?Math.ceil(16/Bn)+1:20;return Math.ceil(Math.max(t?0:168,r(Gn(e.id),a)+o+s))}self.onmessage=e=>{let{model:t,size:n,widths:r}=e.data;self.postMessage(Hn(t,n,r))}})();'],{type:`text/javascript;charset=utf-8`});function XCe(e){let t;try{if(t=K$&&(self.URL||self.webkitURL).createObjectURL(K$),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(e){throw e}}var q$=Object.defineProperty,ZCe=(e,t,n)=>t in e?q$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QCe=(e,t)=>{for(var n in t)q$(e,n,{get:t[n],enumerable:!0})},$Ce=(e,t,n)=>ZCe(e,typeof t==`symbol`?t:t+``,n),J$={};QCe(J$,{Graph:()=>u1,alg:()=>t1});var ewe=Object.defineProperty,Y$=(e,t)=>{for(var n in t)ewe(e,n,{get:t[n],enumerable:!0})},X$=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),(t?.length??0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=$$(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=twe(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,Z$(this._preds[a],i),Z$(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?e1(this._isDirected,e):$$(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!=`object`||!r?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?e1(this._isDirected,e):$$(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?e1(this._isDirected,e):$$(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],Q$(this._preds[t],e),Q$(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function Z$(e,t){e[t]?e[t]++:e[t]=1}function Q$(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function $$(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function twe(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function e1(e,t){return $$(e,t.v,t.w,t.name)}Y$({},{read:()=>awe,write:()=>nwe});function nwe(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:rwe(e),edges:iwe(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function rwe(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function iwe(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function awe(e){let t=new X$(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var t1={};Y$(t1,{CycleException:()=>o1,bellmanFord:()=>n1,components:()=>cwe,dijkstra:()=>i1,dijkstraAll:()=>dwe,findCycles:()=>fwe,floydWarshall:()=>mwe,isAcyclic:()=>gwe,postorder:()=>vwe,preorder:()=>ywe,prim:()=>bwe,shortestPaths:()=>xwe,tarjan:()=>a1,topsort:()=>s1});var owe=()=>1;function n1(e,t,n,r){return swe(e,String(t),n||owe,r||function(t){return e.outEdges(t)??[]})}function swe(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=i[e.v],r=i[e.w];if(!t||!r)return;let o=n(e);t.distance+oe.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw Error(`Queue underflow`);this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n>1,!(t[r].priority1;function i1(e,t,n,r){return uwe(e,String(t),n||lwe,r||function(t){return e.outEdges(t)??[]})}function uwe(e,t,n,r){let i={},a=new r1,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t];if(!r)return;let c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l0;){o=a.removeMin();let e=i[o];if(!e||e.distance===1/0)break;s=e,r(o).forEach(c)}return i}function dwe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=i1(e,i,t,n),r},{})}function a1(e){let t=0,n=[],r={},i=[];function a(o){var s;let c=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),(s=e.successors(o))==null||s.forEach(function(e){if(e in r){let t=r[e];t!=null&&t.onStack&&(c.lowlink=Math.min(c.lowlink,t.index))}else{a(e);let t=r[e];t&&(c.lowlink=Math.min(c.lowlink,t.lowlink))}}),c.lowlink===c.index){let e=[],t;do{t=n.pop();let i=r[t];i&&(i.onStack=!1),e.push(t)}while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function fwe(e){return a1(e).filter(function(t){let n=t[0];return n?t.length>1||t.length===1&&(e.outEdges(n,n)??[]).length>0:!1})}var pwe=()=>1;function mwe(e,t,n){return hwe(e,t||pwe,n||function(t){return e.outEdges(t)??[]})}function hwe(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){let a={};r[e]=a,a[e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(a[t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=t(n);a[r]={distance:i,predecessor:e}})}),i.forEach(function(e){let t=r[e];t&&i.forEach(function(n){let a=r[n];a&&i.forEach(function(n){let r=a[e],i=t[n],o=a[n];if(r&&i&&o){let e=r.distance+i.distance;e(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=c1(e,t,n===`post`,o,a,r,i)}),i}function c1(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=c1(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function l1(e,t,n){return _we(e,t,n,function(e,t){return e.push(t),e},[])}function vwe(e,t){return l1(e,t,`post`)}function ywe(e,t){return l1(e,t,`pre`)}function bwe(e,t){var n;let r=new X$,i={},a=new r1,o;function s(e){let n=e.v===o?e.w:e.v,r=a.priority(n);if(r!==void 0){let s=t(e);s0;){if(o=a.removeMin(),o in i)r.setEdge(o,i[o]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}(n=e.nodeEdges(o))==null||n.forEach(s)}return r}function xwe(e,t,n,r){return Swe(e,t,n,r??(t=>e.outEdges(t)??[]))}function Swe(e,t,n,r){if(n===void 0)return i1(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;ot.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function f1(e){let t=new u1({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function p1(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function m1(e){let t=b1(v1(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function wwe(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=_1(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function Twe(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=_1(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function h1(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),d1(e,`border`,i,t)}function Ewe(e,t=g1){let n=[];for(let r=0;rg1?e(...Ewe(t).map(t=>e(...t))):e(...t)}function v1(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return _1(Math.max,t)}function Dwe(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Owe(e,t){return t()}var kwe=0;function y1(e){return e+(``+ ++kwe)}function b1(e,t,n=1){t??(t=e,e=0);let r=e=>ete[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function Awe(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var C1=`\0`;function w1(e,t,n){if(!(e&&t&&n&&t.dummy===`edge`&&n.dummy===`edge`&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let r=!0;t.edgeObj.w===n.edgeObj.w&&(r=!1);let i=r?e[t.edgeObj.v]?.rank??NaN:e[t.edgeObj.w]?.rank??NaN,a=Object.entries(e).find(e=>e[1].edgeObj?.v===t.edgeObj.v&&e[1].edgeObj?.w===t.edgeObj.w&&e[1].rank===i),o=Object.entries(e).find(e=>e[1].edgeObj?.v===n.edgeObj.v&&e[1].edgeObj?.w===n.edgeObj.w&&e[1].rank===i);if(!a||!o)return 0;let s=a[1].order??NaN,c=o[1].order??NaN;return isNaN(s-c)?0:s-c}var jwe=class{constructor(){$Ce(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return T1(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&T1(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Mwe)),n=n._prev;return`[`+e.join(`, `)+`]`}};function T1(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Mwe(e,t){if(e!==`_next`&&e!==`_prev`)return t}var Nwe=jwe,Pwe=()=>1;function Fwe(e,t){if(e.nodeCount()<=1)return[];let n=Lwe(e,t||Pwe);return Iwe(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function Iwe(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)E1(e,t,n,o);for(;o=i.dequeue();)E1(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(E1(e,t,n,o,!0)||[]);break}}}return r}function E1(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,D1(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,D1(t,n,o)}),e.removeNode(r.v),o}function Lwe(e,t){let n=new u1,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=Rwe(i+r+3).map(()=>new Nwe),o=r+1;return n.nodes().forEach(e=>{D1(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function D1(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function Rwe(e){let t=[];for(let n=0;n{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,y1(`rev`))});function n(e){return t=>e.edge(t).weight}}function Bwe(e,t){let n=[],r={},i={};function a(t){Object.hasOwn(i,t)||(i[t]=!0,r[t]=!0,e.outEdges(t).forEach(e=>{Object.hasOwn(r,e.w)?n.push(e):a(e.w)}),delete r[t])}function o(a){var s;Object.hasOwn(i,a)||(i[a]=!0,r[a]=!0,(s=e.outEdges(a))==null||s.forEach(i=>{Object.hasOwn(r,i.w)||t.node(a)?.rank>t.node(i.w)?.rank&&Hwe(e,i.w,i)?n.push(i):o(i.w)}),delete r[a])}let s=a;return t&&typeof t.node==`function`&&(s=o),e.sources().forEach(s),e.nodes().forEach(s),n}function Vwe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Hwe(e,t,n){let r=new Set;function i(t){if(e.sources().includes(t))return!0;r.add(t);for(let a of e.inEdges(t)??[])if((a.v!==n.v||a.w!==n.w)&&!r.has(a.v)&&i(a.v))return!0;return!1}return i(t)}function Uwe(e){e.graph().dummyChains=[],e.edges().forEach(t=>Wwe(e,t))}function Wwe(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d=0;for(++r;r{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function O1(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=_1(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function k1(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var A1=Kwe;function Kwe(e){let t=new u1({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;qwe(t,e){let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!k1(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function Jwe(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=k1(t,r)),it.node(e).rank+=n)}var{preorder:Xwe,postorder:Zwe}=t1,Qwe=j1;j1.initLowLimValues=P1,j1.initCutValues=M1,j1.calcCutValue=N1,j1.leaveEdge=I1,j1.enterEdge=L1,j1.exchangeEdges=R1;function j1(e){e=Cwe(e),O1(e);let t=A1(e);P1(t),M1(t,e);let n,r;for(;n=I1(t);)r=L1(t,e,n),R1(t,e,n,r)}function M1(e,t){let n=Zwe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>$we(e,t,n))}function $we(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=N1(e,t,n)}function N1(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,tTe(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function P1(e,t){arguments.length<2&&(t=e.nodes()[0]),F1(e,{},1,t)}function F1(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=F1(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function I1(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function L1(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===z1(e,e.node(t.v),s)&&c!==z1(e,e.node(t.w),s)).reduce((e,n)=>k1(t,n)!e.node(t).parent);if(!n)return;let r=Xwe(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function tTe(e,t,n){return e.hasEdge(t,n)}function z1(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var nTe=rTe;function rTe(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:B1(e);break;case`tight-tree`:aTe(e);break;case`longest-path`:iTe(e);break;case`none`:break;default:B1(e)}}var iTe=O1;function aTe(e){O1(e),A1(e)}function B1(e){Qwe(e)}var oTe=sTe;function sTe(e){let t=lTe(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=cTe(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRanko||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function lTe(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(C1).forEach(r),t}function uTe(e){let t=d1(e,`root`,{},`_root`),n=dTe(e),r=Object.values(n),i=_1(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=fTe(e)+1;e.children(C1).forEach(r=>{V1(e,t,a,o,i,n,r)}),e.graph().nodeRankFactor=a}function V1(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=h1(e,`_bt`),l=h1(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{V1(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function dTe(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(C1).forEach(e=>n(e,1)),t}function fTe(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function pTe(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var mTe=hTe;function hTe(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),i&&Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;tW1(e.node(t))),e.edges().forEach(t=>W1(e.edge(t)))}function W1(e){let t=e.width;e.width=e.height,e.height=t}function vTe(e){e.nodes().forEach(t=>G1(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(G1),Object.hasOwn(r,`y`)&&G1(r)})}function G1(e){e.y=-e.y}function yTe(e){e.nodes().forEach(t=>K1(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(K1),Object.hasOwn(r,`x`)&&K1(r)})}function K1(e){let t=e.x;e.x=e.y,e.y=t}function bTe(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=b1(_1(Math.max,i)+1).map(()=>[]);function o(t){if(n[t])return;n[t]=!0;let r=e.node(t);a[r.rank].push(t);let i=e.successors(t);i&&[...i].sort((e,t)=>s(e,t)).forEach(o)}r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(o);function s(n,r){return w1(t,e.node(n),e.node(r))}return a}function xTe(e,t){let n=0;for(let r=1;rt)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function CTe(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function wTe(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),TTe(Object.values(n).filter(e=>!e.indegree))}function TTe(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&ETe(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>x1(e,[`vs`,`i`,`barycenter`,`weight`]))}function ETe(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function DTe(e,t,n,r,i){let a={},o=null,s=null,c=i;typeof t==`boolean`?(c=t,a={}):t&&(a=t,o=n??null,s=r??null);let l=Dwe(e,e=>Object.hasOwn(e,`barycenter`)),u=l.lhs,d=l.rhs.sort((e,t)=>t.i-e.i),f=[],p=0,m=0,h=0;u.sort(OTe(s,o,!!c));for(let[e,t]of Object.entries(a)){let n=u.findIndex(t=>t.vs[0]===e);u.splice(n+1,0,t)}h=q1(f,d,h),u.forEach(e=>{h+=e.vs.length,f.push(e.vs),p+=e.barycenter*e.weight,m+=e.weight,h=q1(f,d,h)});let g={vs:f.flat(1)};return m&&(g.barycenter=p/m,g.weight=m),g}function q1(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function OTe(e,t,n){return(r,i)=>{if(r.barycenteri.barycenter)return 1;if(e&&(typeof r.vs[0]==`string`||typeof i.vs[0]==`string`)){let n=w1(t,e.node(r.vs[0]),e.node(i.vs[0]));if(n!==0)return n}return n?i.i-r.i:r.i-i.i}}function J1(e,t,n,r,i){var a,o;let s=null,c=i;typeof r==`boolean`?(c=r,s=null):r!==void 0&&(s=r);let l=e.children(t),u=e.node(t),d=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};d&&(l=l.filter(e=>e!==d&&e!==f));let m=CTe(e,l);m.forEach(t=>{if(e.children(t.v).length){let{result:r}=J1(e,t.v,n,s,c);p[t.v]=r,Object.hasOwn(r,`barycenter`)&&ATe(t,r)}});let h=wTe(m,n);kTe(h,p);let g={},_=!1;for(let t=0;t{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function ATe(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function jTe(e,t,n,r){r||=e.nodes();let i=MTe(e),a=new u1({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function MTe(e){let t;for(;e.hasNode(t=y1(`_root`)););return t}function NTe(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function Y1(e,t={},n=null){if(typeof t.customOrder==`function`){t.customOrder(e,Y1);return}let r=v1(e),i=X1(e,b1(1,r+1),`inEdges`),a=X1(e,b1(r-1,-1,-1),`outEdges`),o=bTe(e,n);if(Z1(e,o),t.disableOptimalOrderHeuristic)return;let s=1/0,c,l=t.constraints||[];for(let t=0,r=0;r<4;++t,++r){PTe(t%2?i:a,t%4>=2,l,n),o=m1(e);let u=xTe(e,o);u{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return jTe(e,t,n,r.get(t)||[])})}function PTe(e,t,n,r){let i=!0,a=new u1;e.forEach(function(e){n.forEach(e=>a.setEdge(e.left,e.right));let o=e.graph().root,{result:s,usedBias:c}=J1(e,o,a,r,i);t&&c&&(i=!i),s.vs.forEach((t,n)=>e.node(t).order=n),NTe(e,a,s.vs)})}function Z1(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function FTe(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=LTe(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.ordero)&&Q1(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function LTe(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function Q1(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function RTe(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function zTe(e,t,n,r,i){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(t=>{let c=-1,l=-1,u=!1,d=t,f=t.findIndex(t=>i?.includes(t)||$1(t,e,i));f>0&&(d=[t[f],...t.slice(0,f),...t.slice(f+1)],u=!0),d.forEach(t=>{let d=r(t);if(d&&d.length){i!=null&&i.includes(t)&&(d=d.filter(t=>$1(t,e,i)));let r=d.sort((e,t)=>{let n=s[e],r=s[t];return(n===void 0?0:n)-(r===void 0?0:r)}),f=(r.length-1)/2;for(let e=Math.floor(f),i=Math.ceil(f);e<=i;++e){let i=r[e];if(i===void 0)continue;let d=s[i];if(d!==void 0&&o[t]===t&&c{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function VTe(e,t,n,r){let i=new u1,a=e.graph(),o=KTe(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function HTe(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=qTe(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-_1(Math.min,c);a!==`l`&&(l=i-_1(Math.max,c)),l&&(e[o]=S1(s,e=>e+l))})})}function WTe(e,t=void 0){let n=e.ul;return n?S1(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function GTe(e,t){let n=m1(e),r=Object.assign(FTe(e,n),ITe(e,n)),i={},a;return[`u`,`d`].forEach(o=>{a=o===`u`?n:Object.values(n).reverse(),[`l`,`r`].forEach(n=>{n===`r`&&(a=a.map(e=>Object.values(e).reverse()));let s=zTe(e,a,r,t=>(o===`u`?e.predecessors(t):e.successors(t))||[],t),c=BTe(e,a,s.root,s.align,n===`r`);n===`r`&&(c=S1(c,e=>-e)),i[o+n]=c})}),UTe(i,HTe(e,i)),WTe(i,e.graph().align)}function KTe(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),c}}function qTe(e,t){return e.node(t).width}function $1(e,t,n){if(!n)return!1;let r=t.node(e)?.edgeObj;if(!r||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(r?.v),a=n.indexOf(r?.w);return i!==-1&&a!==-1&&i===(a+1)%n.length||i===(a-1)%n.length}function JTe(e,t){e=f1(e),YTe(e),Object.entries(GTe(e,t)).forEach(([t,n])=>e.node(t).x=n)}function YTe(e){let t=m1(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}var e0=new WeakMap;function XTe(e,t={}){return n0(e,Owe,t),e}function t0(e,t,n){let r=t;for(;r!==void 0;){let t=e.parent(r);if(t===n)return r;r=t}}function n0(e,t,n){let r=e.nodes().filter(t=>e.children(t).length),i={};r.forEach(r=>{let a=e.node(r);if(a&&a.rankdir){let o=new u1({multigraph:!0,compound:!0});o.setGraph({rankdir:a.rankdir});let s=e.children(r);s.forEach(t=>{let n={...e.node(t)};o.setNode(t,n);let i=e.parent(t);i&&i!==r&&s.includes(i)&&o.setParent(t,i)});let c=new Set;e.edges().forEach(t=>{let n=t0(e,t.v,r),i=t0(e,t.w,r);if(n&&i&&n!==i){let r=`${n}\0${i}`;c.has(r)||(c.add(r),o.setEdge(n,i,{...e.edge(t)}))}}),n0(o,t,n);let l=o0(o);r0(l,t,n,null),i0(o,l);let u=1/0,d=1/0,f=-1/0,p=-1/0;o.nodes().forEach(e=>{if(e===r)return;let t=o.node(e);t&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.width==`number`&&typeof t.height==`number`&&(u=Math.min(u,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),d=Math.min(d,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),(!isFinite(u)||!isFinite(d)||!isFinite(f)||!isFinite(p))&&(u=d=0,f=p=0);let m=f-u,h=p-d;i[r]={minX:u,minY:d,maxX:f,maxY:p,width:m,height:h,offsetX:u,offsetY:d},a._dagreClusterSubgraph=o}});let a=[],o=t=>{let n=[],r=(e.children(t)||[]).filter(e=>e!==t);for(;r.length>0;){let t=r.shift();n.push(t),(e.children(t)||[]).filter(e=>e!==t).forEach(e=>r.push(e))}return n},s=new Map;r.forEach(t=>{let n=e.node(t);n&&n.rankdir&&i[t]&&s.set(t,(e.children(t)||[]).filter(e=>e!==t))});let c=new Set([...s.values()].flat()),l=new Map;s.forEach((e,t)=>{c.has(t)||l.set(t,o(t))});let u=new Set([...l.values()].flat()),d=e=>{for(let[t,n]of l)if(n.includes(e))return t;return e},f=[];e.edges().forEach(t=>{(u.has(t.v)||u.has(t.w))&&f.push({edge:t,label:e.edge(t)})});let p=new Map;u.forEach(t=>{let n=e.parent(t);p.set(t,typeof n==`string`?n:void 0)}),l.forEach((t,n)=>{let r=e.node(n),o=[];t.forEach(t=>{let n=e.node(t);n&&(o.push({id:t,node:n,parent:p.get(t)}),e.removeNode(t))});let s=f.filter(({edge:e})=>t.includes(e.v)||t.includes(e.w)),c=i[n];r&&(a.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:c,children:t,removedNodes:o,removedEdges:s}),r.width=c.width,r.height=c.height)});let m=new Set;f.forEach(({edge:t,label:n})=>{let r=d(t.v),i=d(t.w);if(r!==i&&e.hasNode(r)&&e.hasNode(i)){let t=`${r}\0${i}`;m.has(t)||(m.add(t),e.setEdge(r,i,{...n,width:0,height:0}))}});let h=o0(e),g=r0(h,t,n,e0.get(e)??null);e0.set(e,g),i0(e,h),m.forEach(t=>{let n=t.indexOf(`\0`),r=t.slice(0,n),i=t.slice(n+1);e.hasEdge(r,i)&&e.removeEdge(r,i)}),a.forEach(({clusterId:t,subgraph:n,bounds:r,removedNodes:i,removedEdges:a})=>{let o=e.node(t),s=o?.x??0,c=o?.y??0,l=(r.minX+r.maxX)/2,u=(r.minY+r.maxY)/2;i.forEach(({id:t,node:n,parent:r})=>{e.setNode(t,n),r!==void 0&&e.setParent(t,r)}),a.forEach(({edge:t,label:n})=>{e.setEdge(t,n)}),n.nodes().forEach(r=>{if(r===t)return;let i=n.node(r),a=e.node(r);a&&i&&typeof i.x==`number`&&typeof i.y==`number`&&(a.x=s+(i.x-l),a.y=c+(i.y-u))}),delete o._dagreClusterSubgraph}),r.forEach(t=>{let n=e.node(t),r=i[t];if(n&&n.rankdir&&n._dagreClusterSubgraph&&r){let i=n._dagreClusterSubgraph,a=n.x??0,o=n.y??0,s=(r.minX+r.maxX)/2,c=(r.minY+r.maxY)/2;i.nodes().forEach(n=>{if(n===t)return;let r=i.node(n),l=e.node(n);if(l&&r&&typeof r.x==`number`&&typeof r.y==`number`){let e=r.x-s,t=r.y-c;l.x=a+e,l.y=o+t}}),delete n._dagreClusterSubgraph}})}function r0(e,t,n,r=null){var i,a;let o=n?.useDynamic!==!1,s=o&&(i=r?.graph)!=null?i:null,c=o&&(a=r?.rawNodes)!=null?a:null;t(` makeSpaceForEdgeLabels`,()=>iEe(e)),t(` removeSelfEdges`,()=>pEe(e)),t(` acyclic`,()=>zwe(e,s)),t(` nestingGraph.run`,()=>uTe(e)),t(` rank`,()=>nTe(f1(e))),t(` injectEdgeLabelProxies`,()=>aEe(e)),t(` removeEmptyRanks`,()=>Twe(e)),t(` nestingGraph.cleanup`,()=>pTe(e)),t(` normalizeRanks`,()=>wwe(e)),t(` assignRankMinMax`,()=>oEe(e)),t(` removeEdgeLabelProxies`,()=>sEe(e)),t(` normalize.run`,()=>Uwe(e)),t(` parentDummyChains`,()=>oTe(e)),t(` addBorderSegments`,()=>mTe(e)),t(` order`,()=>Y1(e,n,c)),t(` insertSelfEdges`,()=>mEe(e)),t(` adjustCoordinateSystem`,()=>gTe(e)),t(` position`,()=>JTe(e,n.corePath)),t(` positionSelfEdges`,()=>hEe(e));let l=JSON.parse(JSON.stringify(e._nodes));return t(` removeBorderNodes`,()=>fEe(e)),t(` normalize.undo`,()=>Gwe(e)),t(` fixupEdgeLabelCoords`,()=>uEe(e)),t(` undoCoordinateSystem`,()=>_Te(e)),t(` translateGraph`,()=>cEe(e)),t(` assignNodeIntersects`,()=>lEe(e)),t(` reversePoints`,()=>dEe(e)),t(` acyclic.undo`,()=>Vwe(e)),{graph:e,rawNodes:l}}function i0(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var ZTe=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],QTe={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},$Te=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],eEe=[`width`,`height`,`rank`],a0={width:0,height:0},tEe=[`minlen`,`weight`,`width`,`height`,`labeloffset`],nEe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},rEe=[`labelpos`];function o0(e){let t=new u1({multigraph:!0,compound:!0}),n=c0(e.graph());return t.setGraph(Object.assign({},QTe,s0(n,ZTe),x1(n,$Te))),e.nodes().forEach(n=>{let r=s0(c0(e.node(n)),eEe);Object.keys(a0).forEach(e=>{r[e]===void 0&&(r[e]=a0[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=c0(e.edge(n));t.setEdge(n,Object.assign({},nEe,s0(r,tEe),x1(r,rEe)))}),t}function iEe(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,(r.labelpos??`r`).toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function aEe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);d1(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function oEe(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function sEe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function cEe(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function lEe(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(p1(r,a)),n.points.push(p1(i,o))})}function uEe(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function dEe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function fEe(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function pEe(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function mEe(e){m1(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);typeof i.rank!=`number`&&(i.rank=0),i.order=r+n,(i.selfEdges||[]).forEach(t=>{d1(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,edgeLabel:t.label},`_se`),(!Array.isArray(t.label.points)||t.label.points.length!==7)&&(t.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function hEe(e){e.nodes().forEach(t=>{let n=e.node(t),r=e=>typeof e==`number`&&isFinite(e);if(n.dummy===`selfedge`){let i=n,a=e.node(i.e.v),o=r(a?.x)?a.x:0,s=r(a?.y)?a.y:0,c=r(a?.width)?a.width:0,l=r(a?.height)?a.height:0,u=r(n.x)?n.x:o,d=r(n.y)?n.y:s,f=c/2,p=l/2;i.edgeLabel.points=[{x:u+f,y:d-p},{x:u+f,y:d-p},{x:u,y:d},{x:u-f,y:d+p},{x:u-f,y:d+p},{x:u,y:d},{x:u,y:d}],i.edgeLabel.x=u,i.edgeLabel.y=d,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||e.label.points.length!==7){let t=r(n.x)?n.x:0,i=r(n.y)?n.y:0,a=r(n.width)?n.width:0,o=r(n.height)?n.height:0,s=a/2,c=o/2;e.label.points=[{x:t+s,y:i-c},{x:t+s,y:i-c},{x:t,y:i},{x:t-s,y:i+c},{x:t-s,y:i+c},{x:t,y:i},{x:t,y:i}]}})})}function s0(e,t){return S1(x1(e,t),Number)}function c0(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}var l0=(e,t)=>et),u0=(e,t,n)=>Math.min(n,Math.max(t,e)),d0=20,gEe=44,f0=1.4,p0=Math.ceil(zg.micro*f0+2)/d0;function m0(e,t){let n=Object.create(null);for(let r of e.nodes)n[r.id]={full:x0(r,!1,t),compact:x0(r,!0,t)};let r=Object.entries(n).sort(([e],[t])=>l0(e,t)),i=JSON.stringify([r.map(([e])=>e),e.edges.map(e=>[e.id,e.caller,e.callee]).sort((e,t)=>l0(e[0],t[0]))]);return{key:JSON.stringify([i,r]),topology:i,widths:n}}function _Ee(e,t,n){let r=n??m0(e,t.measureText).widths;return{...h0(e,r,!0),full:h0(e,r,!1)}}function h0(e,t,n){let r=[...e.nodes].sort((e,t)=>l0(e.id,t.id)),i=[...e.edges].sort((e,t)=>l0(e.id,t.id)),a=new Set(i.flatMap(e=>[e.caller,e.callee])),o=new Set(i.map(e=>e.callee)),s=new Set(i.map(e=>e.caller)),c=new J$.Graph({directed:!0,multigraph:!0});c.setDefaultEdgeLabel(()=>({}));let l=n?d0:gEe;c.setGraph({rankdir:`LR`,ranker:`network-simplex`,acyclicer:`greedy`,ranksep:n?16:32,nodesep:n?4:8,edgesep:n?2:8,marginx:0,marginy:0});let u=new Map(r.map(e=>[e.id,t[e.id][n?`compact`:`full`]]));for(let e of r)a.has(e.id)&&c.setNode(e.id,{width:u.get(e.id),height:l});for(let e of i)c.setEdge(e.caller,e.callee,{weight:1,minlen:1},e.id);c.nodeCount()&&XTe(c);let d=r.filter(e=>a.has(e.id)).map(e=>({...e,x:c.node(e.id).x-u.get(e.id)/2,y:c.node(e.id).y-l/2,width:u.get(e.id),height:l,entry:s.has(e.id)&&!o.has(e.id),uncalled:!1})),f=i.map(e=>c.edge(e.caller,e.callee,e.id).points),p=r.filter(e=>!a.has(e.id)),m=p.reduce((e,t)=>e+u.get(t.id)+12,0)-(p.length?12:0),h=p.length?v0(`No traced calls in this window`,`12px ${Bg.display}`):0,g=Math.max(1,c.graph().width??0,m,h),_=(g-m)/2,v=Math.max(0,c.graph().height??0,...f.flat().map(e=>e.y),...d.map(e=>e.y+e.height)),y=v+(v?40:24);for(let e of p)d.push({...e,x:_,y,width:u.get(e.id),height:l,entry:!1,uncalled:!0}),_+=u.get(e.id)+12;let b=(g-(c.graph().width??0))/2;for(let e of d)e.uncalled||(e.x+=b);for(let e of f)for(let t of e)t.x+=b;let x=new Map(d.map(e=>[e.id,e]));for(let[e,t]of i.entries()){let n=x.get(t.caller),r=x.get(t.callee),i=f[e].slice(1,-1);if(!i.length||n===r)continue;let a=n.x{let r=e.nodes.filter(e=>e.uncalled);if(!r.length)return e;let i=Math.max(1,n.width-24)/t,a=[[]],o=0;for(let e of r)o&&o+12+e.width>i&&(a.push([]),o=0),a.at(-1).push(e),o+=(o?12:0)+e.width;let s=a.map(e=>e.reduce((e,t)=>e+t.width,0)+(e.length-1)*12),c=e.nodes.filter(e=>!e.uncalled),l=e.routes.flat(),u=Math.min(...c.map(e=>e.x),...l.map(e=>e.x)),d=c.length?Math.max(...c.map(e=>e.x+e.width),...l.map(e=>e.x))-u:0,f=Math.max(d,e.labelWidth,...s),p=c.length?(f-d)/2-u:0,m=c.map(e=>({...e,x:e.x+p}));return a.forEach((e,t)=>{let n=(f-s[t])/2;for(let i of e)m.push({...i,x:n,y:r[0].y+t*(i.height+12)}),n+=i.width+12}),{...e,nodes:m,routes:e.routes.map(e=>e.map(e=>({...e,x:e.x+p}))),width:f,height:Math.max(...m.map(e=>e.y+e.height))}},i=e=>{let t=e.routes.flat(),r=Math.min(0,...t.map(e=>e.x)),i=Math.min(0,...t.map(e=>e.y)),a=Math.max(e.width,...t.map(e=>e.x))-r,o=Math.max(e.height,...t.map(e=>e.y))-i,s=Math.max(0,...e.routes.flat().map(e=>e.y),...e.nodes.filter(e=>!e.uncalled).map(e=>e.y+e.height)),c=e.nodes.find(e=>e.uncalled)?.y,l=c===void 0?0:c-s,u=c===void 0?0:32;return{minX:r,minY:i,width:a,height:o,scale:Math.min(Math.max(1,n.width-24)/a,Math.max(1,n.height-24-u)/Math.max(1,o-l)),graphBottom:s,rowY:c,gap:l,lane:u}},a=r(e.full,1),o=i(a).scale<1,s=o?r(e,p0):a,{minX:c,minY:l,width:u,height:d,scale:f,graphBottom:p,rowY:m,gap:h,lane:g}=i(s),_=Math.max(o?p0:1,Math.min(f,1)),v=(d-h)*_+g,y=Math.max(n.width,u*_+24),b=Math.max(n.height,v+24),x=(y-u*_)/2,S=(b-v)/2,C=e=>({x:x+(e.x-c)*_,y:S+(e.y-l)*_+(m!==void 0&&e.y>=m?g-h*_:0)}),w=new Map(t.nodes.map(e=>[e.id,e])),T=s.nodes.map(e=>({...e,...w.get(e.id),...C(e),width:e.width*_,height:e.height*_})),E=[...t.edges].sort((e,t)=>l0(e.id,t.id)).map((e,t)=>{let n=s.routes[t].map(C),r=n.map((e,t)=>`${t?`L`:`M`}${e.x},${e.y}`).join(` `);return{...e,points:n,path:r}}),D=T.find(e=>e.entry)??T[0];return{nodes:T,edges:E,scale:_,compact:o,initialView:D?{x:u0(n.width/2-D.x-D.width/2,n.width-y,0),y:u0(n.height/2-D.y-D.height/2,n.height-b,0)}:{x:0,y:0},contentWidth:y,contentHeight:b,uncalledLabel:s.label?{x:(y-s.labelWidth)/2,y:S+(p-l)*_+8}:void 0}}var yEe=e=>`${py(`per_second`,e.request_rate)} · ${py(`percent`,e.error_rate)} err · ${py(`ms`,e.p95_ms)} p95`,g0=e=>{if(e===null||!Number.isFinite(e))return`—`;let t=u0(e,0,999e3);return t>0&&t<.01?`<0.01`:t>=1e3?`${Math.min(999,Math.round(t/1e3))}K`:String(Number(t.toFixed(t<1?2:+(t<10))))},_0=e=>e===null||!Number.isFinite(e)?`— err`:`${Number((e>0?u0(e,.1,100):0).toFixed(1))}% err`,bEe=e=>e===null?`—`:Number(e.toPrecision(2))>=1e3?`${g0(e/1e3)}s`:`${g0(e)}ms`,v0=(e,t)=>Array.from(e).length*Number(t.match(/([\d.]+)px/)?.[1]??11)*.6,y0=e=>Array.from(e).length>24?Array.from(e).slice(0,24).join(``)+`…`:e;function xEe(e,{width:t,scale:n,compact:r=!1,measureText:i}){let a=Math.max(12,zg.micro/n),o=zg.micro/n,s=i??v0,c=Math.max(0,t-12/n),l=s(L$[e.health]??`○`,`${a}px ${Bg.display}`),u=y0(e.id),d=e.error_rate!==null&&e.error_rate>0?_0(e.error_rate):`${g0(e.request_rate)}/s`,f=`${g0(e.request_rate)}/s · ${_0(e.error_rate)}`;return{name:u,metric:r?``:[`${f} · p95 ${bEe(e.p95_ms)}`,f,d].find(e=>s(e,`${o}px ${Bg.display}`)<=c)??``,nameSize:a,metricSize:o,nameWidth:Math.max(0,c-l-4/n)}}var b0=new WeakMap;function x0(e,t,n){let r=n??v0,i=b0.get(r);i||(i=new Map,b0.set(r,i));let a=`600 ${t?zg.micro/p0:12}px ${Bg.display}`,o=i.get(a);o===void 0&&(o=Math.max(...Object.values(L$).map(e=>r(e,a))),i.set(a,o));let s=t?Math.ceil(16/p0)+1:20;return Math.ceil(Math.max(t?0:168,r(y0(e.id),a)+o+s))}var SEe=(e,t,n)=>Math.min(n,Math.max(t,e)),S0={x:0,y:0,zoom:1};function CEe({panel:e,title:t=e.title,result:n,dark:r,height:i,onSelect:a,onPoint:o,onMapView:s}){let c=(0,A.useRef)(null),[l,u]=(0,A.useState)({width:500,height:Math.max(40,i-24)}),[d,f]=(0,A.useState)(!1),[p,m]=(0,A.useState)(0),h=(0,A.useMemo)(()=>{let e=document.createElement(`canvas`).getContext(`2d`);return e?(t,n)=>(e.font=n,e.measureText(t).width):void 0},[p]);(0,A.useEffect)(()=>{let e=document.fonts,t=()=>m(e=>e+1);return e?.addEventListener(`loadingdone`,t),()=>e?.removeEventListener(`loadingdone`,t)},[]);let[g,_]=(0,A.useState)(),[v,y]=(0,A.useState)(),[b,x]=(0,A.useState)(S0),S=(0,A.useRef)(null),C=(0,A.useRef)(!1),w=(0,A.useMemo)(()=>z$(n.frame,n),[n.frame,n.from_ms,n.to_ms]),T=(0,A.useMemo)(()=>m0(w,h),[w,h]),[E,D]=(0,A.useState)(),[O,k]=(0,A.useState)(),j=(0,A.useRef)({model:w,size:l,structure:T});j.current={model:w,size:l,structure:T},(0,A.useLayoutEffect)(()=>{if(!d)return;let{model:e,size:t,structure:n}=j.current;if(k(void 0),e.nodes.length<=60){D({key:n.key,layout:_Ee(e,t,n.widths),model:e});return}let r;try{r=new XCe}catch{k(`Service layout unavailable`);return}let i=!0;r.onmessage=t=>{i&&D({key:n.key,layout:t.data,model:e})},r.onerror=()=>{i&&k(`Service layout unavailable`)};try{r.postMessage({model:e,size:{width:t.width,height:t.height},widths:n.widths})}catch{i=!1,r.terminate(),k(`Service layout unavailable`);return}return()=>{i=!1,r.terminate()}},[T.key,d]);let M=(0,A.useMemo)(()=>E?vEe(E.layout,E.key===T.key?w:E.model,l):{nodes:[],edges:[],scale:1,compact:!0,contentWidth:l.width,contentHeight:l.height,uncalledLabel:void 0,initialView:{x:0,y:0}},[E,w,l,T.key]),N=Ry(r),P=Ng[r?4:7],F=(0,A.useId)().replaceAll(`:`,``),ee=g??v,I=Math.max(12,1/M.scale),te=Math.max(1e-9,...w.edges.map(e=>e.request_rate??e.calls)),L=Math.max(1,b.zoom),ne=(0,A.useMemo)(()=>{let e=M.edges.flatMap(e=>e.points),t=[...M.nodes.flatMap(e=>[e.x,e.x+e.width]),...e.map(e=>e.x)],n=[...M.nodes.flatMap(e=>[e.y,e.y+e.height]),...e.map(e=>e.y)];if(M.uncalledLabel){let e=h?.(`No traced calls in this window`,`${zg.micro}px ${Bg.display}`)??29*zg.micro*.6;t.push((M.contentWidth-e/L)/2,(M.contentWidth+e/L)/2),n.push(M.uncalledLabel.y,M.uncalledLabel.y+(zg.micro*f0+2)/L)}return{left:Math.min(...t),right:Math.max(...t),top:Math.min(...n),bottom:Math.max(...n)}},[M,h,L]),re=[ne.left*b.zoom+b.x<0&&`left`,ne.right*b.zoom+b.x>l.width&&`right`,ne.top*b.zoom+b.y<0&&`top`,ne.bottom*b.zoom+b.y>l.height&&`bottom`].filter(e=>!!e),ie=re.join(` `),ae=M.initialView.x,oe=M.initialView.y,se=(0,A.useCallback)(()=>x({x:ae,y:oe,zoom:1}),[ae,oe]),ce=b.zoom<1,le=M.contentWidth>l.width||M.contentHeight>l.height,ue=(0,A.useCallback)(()=>{if(ce||!le){se();return}let e=Math.min(l.width/M.contentWidth,l.height/M.contentHeight,1);x({x:(l.width-M.contentWidth*e)/2,y:(l.height-M.contentHeight*e)/2,zoom:e})},[ce,le,se,l.width,l.height,M.contentWidth,M.contentHeight]);(0,A.useLayoutEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=e.clientWidth||t.width,r=e.clientHeight||t.height;n>0&&r>0&&u(e=>e.width===n&&e.height===r?e:{width:n,height:r})};t(),f(!0);let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let de=(0,A.useRef)(void 0),fe=(0,A.useRef)(S0);(0,A.useLayoutEffect)(()=>{E&&(E.key!==de.current||b.zoom===1&&b.x===fe.current.x&&b.y===fe.current.y)&&se(),de.current=E?.key,fe.current={x:ae,y:oe,zoom:1}},[E,se]),(0,A.useEffect)(()=>(s?.({canFit:!!ie||b.zoom!==1||b.x!==ae||b.y!==oe,overview:ce,fit:ue}),()=>s?.({canFit:!1,overview:!1,fit:()=>void 0})),[s,b,ue,ae,oe,ie,ce]),(0,A.useEffect)(()=>{let e=c.current;if(!e)return;let t=t=>{if(!E||O||t.deltaY===0)return;t.preventDefault();let n=e.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top;x(e=>{let n=SEe(e.zoom*Math.exp(-t.deltaY*.002),1,I);if(n===1)return{x:ae,y:oe,zoom:1};let a=n/e.zoom;return{zoom:n,x:r-(r-e.x)*a,y:i-(i-e.y)*a}})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[I,!!E,O,ae,oe]);let R=t=>{if(C.current){C.current=!1;return}e.click&&a?a(t):o?.({dimensions:{service:t}})};return(0,z.jsxs)(`div`,{role:`region`,"aria-label":`${t}: service dependency graph; ${W$({...e,title:t},n)}`,style:{display:`flex`,flexDirection:`column`,flex:`1 1 auto`,minHeight:0,minWidth:0,width:`100%`},children:[(0,z.jsxs)(`div`,{ref:c,style:{position:`relative`,flex:`1 1 auto`,minHeight:0,overflow:`hidden`,touchAction:`none`,cursor:S.current?`grabbing`:`grab`},onMouseLeave:()=>_(void 0),onPointerDown:e=>{e.button===0&&(C.current=!1,S.current={x:e.clientX,y:e.clientY,initial:b,moved:!1})},onPointerMove:e=>{let t=S.current;if(!t)return;let n=e.clientX-t.x,r=e.clientY-t.y;Math.hypot(n,r)>3&&(t.moved=!0),t.moved&&(e.currentTarget.setPointerCapture?.(e.pointerId),x({...t.initial,x:t.initial.x+n,y:t.initial.y+r}))},onPointerUp:()=>{C.current=S.current?.moved??!1,S.current=null},onPointerCancel:()=>{S.current=null,C.current=!1},children:[(O||!E)&&(0,z.jsx)(Ed,{role:`status`,c:`dimmed`,children:O??`Laying out services…`}),(0,z.jsxs)(`div`,{style:{position:`relative`,width:M.contentWidth,height:M.contentHeight,transform:`translate(${b.x}px, ${b.y}px) scale(${b.zoom})`,transformOrigin:`0 0`},children:[(0,z.jsxs)(`svg`,{"aria-hidden":`true`,width:M.contentWidth,height:M.contentHeight,viewBox:`0 0 ${M.contentWidth} ${M.contentHeight}`,style:{position:`absolute`,inset:0},children:[(0,z.jsx)(`defs`,{children:[N.muted,N.status.warn,N.status.bad].map((e,t)=>(0,z.jsx)(`marker`,{id:`${F}-arrow-${t}`,viewBox:`0 0 6 6`,refX:5,refY:3,markerWidth:5,markerHeight:5,orient:`auto-start-reverse`,markerUnits:`userSpaceOnUse`,children:(0,z.jsx)(`path`,{d:`M0,0 L6,3 L0,6 Z`,fill:e})},e))}),(0,z.jsx)(`g`,{children:M.edges.map(e=>(0,z.jsx)(`path`,{d:e.path,fill:`none`,stroke:e.status?N.status[e.status]:N.muted,strokeLinejoin:`round`,strokeWidth:1+3*Math.log1p(e.request_rate??e.calls)/Math.log1p(te),opacity:ee&&e.caller!==ee&&e.callee!==ee?.25:1,markerEnd:`url(#${F}-arrow-${e.status===`bad`?2:+(e.status===`warn`)})`,style:{pointerEvents:`stroke`},children:(0,z.jsx)(`title`,{children:`${e.caller} → ${e.callee}\n${e.edge_type} · ${py(`per_second`,e.request_rate)} · ${py(`count`,e.calls)} calls\n${py(`percent`,e.error_rate)} errors · ${py(`ms`,e.average_ms)} average`})},e.id))})]}),(0,z.jsxs)(`div`,{style:{position:`absolute`,inset:0,pointerEvents:`none`},children:[M.uncalledLabel&&(0,z.jsx)(`span`,{style:{position:`absolute`,left:`50%`,top:M.uncalledLabel.y,transform:`translateX(-50%)`,color:N.muted,background:N.surface,fontSize:zg.micro/L,lineHeight:1.4,padding:`${1/L}px 0`,whiteSpace:`nowrap`},children:`No traced calls in this window`}),M.nodes.map(e=>{let t=e.health===`unhealthy`?N.status.bad:e.health===`degraded`?N.status.warn:e.health===`healthy`?N.status.ok:N.muted,n=xEe(e,{width:e.width/M.scale,scale:M.scale*L,compact:M.compact,measureText:h});return(0,z.jsxs)(`button`,{type:`button`,title:`${e.id} · ${e.health}\n${yEe(e)}`,onMouseEnter:()=>_(e.id),onMouseLeave:()=>_(void 0),onFocus:()=>y(e.id),onBlur:()=>y(void 0),onClick:()=>R(e.id),onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),C.current=!1,R(e.id))},style:{position:`absolute`,left:e.x,top:e.y,width:e.width,height:e.height,display:`flex`,flexDirection:`column`,justifyContent:`center`,gap:3/L,boxSizing:`border-box`,border:`${1/L}px solid ${e.health===`unhealthy`||e.health===`degraded`?t:N.border}`,borderRadius:6,padding:`0 ${5/L}px`,background:N.surface,color:N.text,textAlign:`left`,opacity:1,outline:v===e.id?`2px solid ${P}`:void 0,outlineOffset:-2,pointerEvents:`auto`,cursor:`pointer`,fontFamily:Bg.display},children:[(0,z.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4/L,width:`100%`,minWidth:0,fontSize:Math.max(zg.micro/L,12*M.scale),lineHeight:f0,whiteSpace:`nowrap`},children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,style:{color:t,flex:`none`},children:L$[e.health]??`○`}),(0,z.jsx)(`span`,{style:{flex:`none`,fontWeight:600,whiteSpace:`nowrap`},children:n.name}),(0,z.jsxs)(ec,{component:`span`,children:[`, `,e.health]})]}),!M.compact&&(0,z.jsx)(`span`,{style:{width:`100%`,fontSize:n.metricSize*M.scale,lineHeight:1.4,color:N.muted,whiteSpace:`nowrap`},children:n.metric})]},e.id)})]})]}),re.map(e=>(0,z.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,pointerEvents:`none`,zIndex:1,...e===`left`||e===`right`?{top:0,bottom:0,[e]:0,width:24}:{left:0,right:0,[e]:0,height:24},background:`linear-gradient(to ${e}, transparent, var(--mantine-color-body))`}},e))]}),(0,z.jsxs)(Ed,{c:`dimmed`,fz:12,mt:4,style:{flexShrink:0},children:[w.nodes.length,` services · `,w.edges.length,` `,w.edges.length===1?`route`:`routes`]})]})}function C0({label:e,value:t,color:n,hint:r,children:i}){let a=qt(`light`)===`dark`;return(0,z.jsxs)(rc,{withBorder:!0,radius:`md`,p:`sm`,bg:`var(--mantine-color-default)`,miw:0,h:`100%`,style:{display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,z.jsx)(Ed,{c:`dimmed`,size:`xs`,truncate:!0,children:e}),(0,z.jsx)(V,{fw:600,fz:`xl`,c:n,mt:2,lh:1.2,style:{color:n===`ok`||n===`warn`||n===`bad`?Ly(n,a):void 0},children:t}),r&&(0,z.jsx)(Ed,{c:`dimmed`,size:`xs`,mt:2,children:r}),i&&(0,z.jsx)(V,{mt:4,style:{display:`flex`,flexDirection:`column`,flex:`1 1 auto`,minHeight:0},children:i})]})}function w0({health:e}){let t=Fee(e),n=`var(--mantine-color-${$g(e)}-filled)`;return(0,z.jsx)(`svg`,{"aria-hidden":!0,width:12,height:12,viewBox:`0 0 12 12`,fill:e===`unknown`?`none`:n,stroke:n,strokeDasharray:Iee(e)===`dashed`?`2 2`:void 0,children:t===`diamond`?(0,z.jsx)(`polygon`,{points:`6,0 12,6 6,12 0,6`}):t===`roundRect`?(0,z.jsx)(`rect`,{x:1,y:1,width:10,height:10,rx:2}):(0,z.jsx)(`circle`,{cx:6,cy:6,r:5})})}function wEe({values:e,color:t}){let n=(0,A.useMemo)(()=>e.map(e=>Number.isFinite(e)?e:null),[e]),r=Math.max(0,...n.filter(e=>e!==null)),i=(0,A.useMemo)(()=>({animation:!1,grid:{left:0,right:0,top:2,bottom:2},xAxis:{type:`category`,show:!1,data:n.map((e,t)=>t)},yAxis:{type:`value`,show:!1,min:0},tooltip:{show:!1},series:[{type:`line`,data:n,showSymbol:!1,smooth:.3,lineStyle:{width:1.5,color:t},areaStyle:{opacity:.12,color:t}}]}),[n,t]);return(0,z.jsxs)(V,{"data-health-trend":!0,style:{display:`flex`,flexDirection:`column`,flex:`1 1 auto`,minHeight:0},children:[(0,z.jsx)(fX,{option:i,height:`100%`,label:`Error rate trend`}),r>0&&(0,z.jsxs)(Ed,{c:`dimmed`,size:`xs`,ta:`right`,mt:2,style:{flexShrink:0},children:[`peak `,r.toFixed(2),`%`]})]})}function TEe({result:e,dark:t,onSelect:n,onVariable:r,vars:i}){let a=e.frame?.health,o=e=>Number.isFinite(e)?e:0,s=a?{...a,total_spans:o(a.total_spans),service_count:o(a.service_count),counts:{healthy:o(a.counts.healthy),degraded:o(a.counts.degraded),unhealthy:o(a.counts.unhealthy)}}:void 0,c=!s||s.health===`unknown`||s.service_count===0||!Number.isFinite(s.error_rate),l=c?`unknown`:s.health,u=Math.max(s?.service_count??0,1),d=t_(t),f=n??(r&&i&&Object.hasOwn(i,`service`)?e=>r(`service`,e):void 0),p=c?[]:VCe(O_(e.frame));return(0,z.jsxs)(dh,{gap:`sm`,style:{flex:`1 1 auto`,minHeight:0},role:`region`,"aria-label":`Service health: ${c?`No data`:l}; ${s?.service_count??0} services`,children:[(0,z.jsxs)(sh,{cols:2,spacing:`sm`,"data-health-tiles":!0,style:{flex:`1 1 auto`,minHeight:0},children:[(0,z.jsx)(C0,{label:`Health`,value:(0,z.jsxs)(vl,{gap:6,children:[(0,z.jsx)(w0,{health:l}),c?`No data`:l.charAt(0).toUpperCase()+l.slice(1)]}),color:$g(l),hint:c?`No telemetry in this window`:`${r_.format(s.service_count)} services`,children:p.map(e=>{let t=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(w0,{health:e.health}),(0,z.jsx)(Ed,{component:`span`,fz:12,truncate:!0,style:{minWidth:0,textAlign:`left`},title:e.name,children:e.name}),(0,z.jsx)(Ed,{component:`span`,fz:12,ff:`monospace`,style:{textAlign:`right`},children:e.metric})]}),n={display:`grid`,gridTemplateColumns:`12px minmax(0, 1fr) 64px`,alignItems:`center`,textAlign:`left`,gap:6,minHeight:20,minWidth:0,width:`100%`};return f?(0,z.jsx)(kd,{component:`button`,type:`button`,"data-health-service":e.name,style:n,onClick:()=>f(e.name),children:t},e.name):(0,z.jsx)(V,{"data-health-service":e.name,style:n,children:t},e.name)})}),(0,z.jsx)(C0,{label:`Error rate`,value:c?`—`:`${s.error_rate.toFixed(2)}%`,color:!c&&s.error_rate>=1?`bad`:void 0,hint:c?void 0:`${r_.format(s.total_spans)} operations`,children:!c&&s.error_trend.length>1&&(0,z.jsx)(wEe,{values:s.error_trend,color:d.bad})})]}),!c&&(0,z.jsxs)(V,{style:{flexShrink:0},children:[(0,z.jsxs)(Im.Root,{size:`md`,role:`group`,"aria-label":`Service health distribution`,children:[(0,z.jsx)(Im.Section,{value:s.counts.healthy/u*100,color:`ok`,"aria-label":`Healthy`}),(0,z.jsx)(Im.Section,{value:s.counts.degraded/u*100,color:`warn`,"aria-label":`Degraded`}),(0,z.jsx)(Im.Section,{value:s.counts.unhealthy/u*100,color:`bad`,"aria-label":`Unhealthy`})]}),(0,z.jsx)(vl,{mt:6,gap:`md`,children:[`healthy`,`degraded`,`unhealthy`].map(e=>(0,z.jsxs)(vl,{gap:6,children:[(0,z.jsx)(w0,{health:e}),(0,z.jsx)(Ed,{c:`dimmed`,size:`xs`,children:`${s.counts[e]} ${e}`})]},e))})]})]})}function EEe(e){return(0,z.jsx)(Jy,{...e})}function DEe(e){return(0,z.jsx)(Jy,{...e})}function OEe(e){let{panel:t,title:n,result:r,dark:i,height:a,group:o,onSelect:s,onPoint:c,onVariable:l,onZoom:u}=e;if(t.viz===`text`)return(0,z.jsx)(RCe,{panel:t});if(!r?.frame)return null;let d={...e,result:r};switch(t.viz){case`stat`:return(0,z.jsx)(wre,{panel:t,result:r,dark:i,compare:e.compare,range:e.range});case`gauge`:return(0,z.jsx)(p_e,{panel:t,title:n,result:r,dark:i,height:a});case`timeseries`:return(0,z.jsx)(zCe,{...d});case`bar`:return(0,z.jsx)(f_e,{panel:t,title:n,result:r,dark:i,height:a,onSelect:s,onPoint:c});case`table`:return(0,z.jsx)(Gy,{traceLinks:e.traceLinks,panel:t,result:r,height:a,onSelect:s,onPoint:c,onVariable:l});case`heatmap`:return(0,z.jsx)(KCe,{...d});case`histogram`:return(0,z.jsx)(qCe,{...d});case`scatter`:return(0,z.jsx)(JCe,{...d});case`state_timeline`:return(0,z.jsx)(YCe,{...d});case`service_map`:return(0,z.jsx)(CEe,{...d});case`health`:return(0,z.jsx)(TEe,{...d});case`logs`:return(0,z.jsx)(Yy,{...d});case`log_patterns`:return(0,z.jsx)(EEe,{...d});case`traces`:return(0,z.jsx)(DEe,{...d})}}function kEe({onClick:e}){return(0,z.jsx)(Xm,{label:`Keyboard shortcuts (?)`,children:(0,z.jsx)(cl,{variant:`default`,size:`lg`,"aria-label":`Keyboard shortcuts (?)`,onClick:e,children:(0,z.jsx)(lte,{size:16})})})}var T0=(0,A.createContext)(void 0);function AEe({opened:e,onClose:t,title:n,children:r,returnFocusTo:i,shortcutScope:a,onShortcuts:o,escapeEnabled:s=!0}){let c=(0,A.useRef)(!1),[l,u]=(0,A.useState)(!1),d=(0,A.useRef)(i);return d.current=i,(0,A.useEffect)(()=>{let t=c.current&&!e;if(c.current=e,!t)return;let n=requestAnimationFrame(()=>d.current()?.focus());return()=>cancelAnimationFrame(n)},[e]),(0,z.jsxs)(cm.Root,{opened:e,onClose:t,fullScreen:!0,trapFocus:!0,returnFocus:!1,closeOnEscape:s&&!l,children:[(0,z.jsx)(cm.Overlay,{}),(0,z.jsxs)(cm.Content,{"aria-label":n,"data-panel-fullscreen":!0,"data-shortcut-scope":a,children:[(0,z.jsx)(cm.Header,{children:(0,z.jsxs)(vl,{ml:`auto`,gap:`xs`,children:[o&&(0,z.jsx)(kEe,{onClick:o}),(0,z.jsx)(cm.CloseButton,{"data-autofocus":!0,"aria-label":`Close panel view`})]})}),(0,z.jsx)(cm.Body,{children:(0,z.jsx)(T0.Provider,{value:u,children:r})})]})]})}function jEe({panel:e,title:t,result:n,loading:r,compare:i,range:a,height:o,group:s,editing:c,agentAvailable:l,annotations:u,vars:d,onSelect:f,onPoint:p,onVariable:m,onZoom:h,onRangePending:g,onZoomReset:_,zoomed:v,onView:y,onCopyLink:b,onExplain:x,onFix:S,onRetry:C,onRemove:w,onDuplicate:T,onEditSQL:E,staleAt:D,traceLinks:O,suspended:k=!1,menuRef:j}){let[M,N]=(0,A.useState)(),P=(0,A.useMemo)(()=>({setHint:N}),[]),F=qt(`light`)===`dark`,ee=(0,A.useRef)(null),[I,te]=(0,A.useState)(0);(0,A.useLayoutEffect)(()=>{let e=ee.current;if(!e)return;te(e.getBoundingClientRect().width);let t=new ResizeObserver(([e])=>{e&&te(e.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]);let L=I>0&&I<360,[ne,re]=(0,A.useState)(0);(0,A.useLayoutEffect)(()=>{let n=()=>{let n=document.createElement(`canvas`).getContext(`2d`),r=ee.current?.querySelector(`[data-panel-title]`),i=r?getComputedStyle(r).fontFamily:`inherit`;n&&(n.font=`600 15px ${i}`);let a=n?.measureText(t).width??Array.from(t).length*8.25;n&&(n.font=`400 11px ${i}`);let o=[`Chart`,`Data`,`Spec`].reduce((e,t)=>e+(n?.measureText(t).width??t.length*7)+12,4),s=(e.description?24:0)+18+(Zy(e)?.length??0)*7;re(a+o+22+32+20+s)};return n(),document.fonts?.addEventListener(`loadingdone`,n),()=>document.fonts?.removeEventListener(`loadingdone`,n)},[t,e.description,e.time]);let ie=L||I>0&&I{if(!D)return;oe(Date.now());let e=window.setInterval(()=>oe(Date.now()),3e4);return()=>window.clearInterval(e)},[D]);let[se,ce]=(0,A.useState)(`Chart`),[le,ue]=(0,A.useState)(),de=(0,A.useCallback)(e=>ue(e),[]),fe=e.click?`click to filter by ${e.click.set_variable}`:e.viz===`traces`||(e.drill===`traces`||n?.frame?.columns.some(e=>e.name===`trace_id`))&&e.viz===`table`?`click to open trace`:e.drill===`logs`?`click for matching logs`:e.drill===`traces`&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)?`click for exemplar traces`:void 0,R=Math.max(40,o-88),pe=[...new Set(k_(e,n?.frame).map(e=>e.value))],me=`${e.viz===`timeseries`?`time series`:e.viz.replaceAll(`_`,` `)}${pe.length?` · ${pe.join(` · `)}`:``}${fe?` · ${fe}`:``}`,he=[`timeseries`,`bar`,`heatmap`,`histogram`,`scatter`,`state_timeline`,`gauge`,`service_map`].includes(e.viz),ge=se!==`Chart`||!he||!n||n.status!==`ok`||n.frame?.truncated||n.previous?.truncated,_e=[`table`,`logs`,`traces`,`log_patterns`,`text`].includes(e.viz),ve=MEe(n?.frame?.note),ye=n?.frame&&n.error,be=!!n?.request_error?.length,xe=!!n?.error&&!be,Se=D?`Showing data from ${E0(D,ae)}`:void 0,Ce=ye?`${Se?`${Se}. `:``}${ye}`:void 0,we=Ce&&Ce.length>200?`${Ce.slice(0,199)}…`:Ce,Te=(0,A.useId)(),Ee=(0,A.useRef)(null),De=Be(j,Ee),[Oe,ke]=(0,A.useState)(!1),[Ae,je]=(0,A.useState)(!1),[Me,Ne]=(0,A.useState)(!1),Pe=!!ye&&!Me&&(Oe||Ae),Fe=(0,A.useContext)(T0);(0,A.useEffect)(()=>(Fe?.(Pe),()=>Fe?.(!1)),[Fe,Pe]);let Ie=(0,A.useCallback)(()=>{Ne(!0),ke(!1),je(!1)},[]);(0,A.useEffect)(()=>{if(!Pe)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),Ie())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[Pe,Ie]);let Le=[...new Set([D&&!ye?`Stale: last updated ${E0(D,ae)}`:void 0,n?.frame?.truncated||n?.previous?.truncated?`Truncated: showing limited data`:void 0,ve,n?.annotation_error,n?.annotation_scope?.limited?`Annotation service scope is limited.`:void 0].filter(e=>!!e))],Re=(0,A.useRef)(null),[ze,Ve]=(0,A.useState)(),He=(ze??R)<160;(0,A.useLayoutEffect)(()=>{let e=Re.current;if(!e)return;let t=new ResizeObserver(([e])=>{e&&Ve(e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]);let[Ue,We]=(0,A.useState)();return(0,A.useLayoutEffect)(()=>{let e=Re.current,t=ee.current;if(!e||!t)return;if(!ge||!(_e||se===`Data`)){We(void 0);return}let n=()=>{let n=Math.max(0,t.getBoundingClientRect().bottom-e.getBoundingClientRect().bottom),r=e.scrollHeight>e.clientHeight;We(e=>r?e?.bottom===n?e:{bottom:n}:void 0)};n();let r=new ResizeObserver(n);r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild);let i=new MutationObserver(n);return i.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{r.disconnect(),i.disconnect()}},[n,se,_e,ge,o,L,Le.length]),(0,z.jsxs)(rc,{ref:ee,withBorder:!0,radius:`md`,h:`100%`,p:0,style:{display:`flex`,flexDirection:`column`,minWidth:0,position:`relative`},"data-panel":e.id,"data-compact-views":ie,children:[(0,z.jsxs)(vl,{justify:`space-between`,wrap:`nowrap`,gap:`xs`,px:16,pt:12,className:c?`panel-drag`:void 0,style:{cursor:c?`grab`:void 0,flexShrink:0},children:[(0,z.jsxs)(vl,{gap:6,wrap:`nowrap`,miw:0,style:{flex:1},children:[(0,z.jsxs)(V,{miw:0,style:{flex:1},children:[(0,z.jsx)(Ed,{"data-panel-title":!0,fw:600,fz:15,truncate:!ie||void 0,style:ie?{overflowWrap:`anywhere`}:void 0,children:t}),(0,z.jsxs)(Ed,{"data-panel-subtitle":!0,title:M??me,fz:12,ff:Bg.display,c:`dimmed`,truncate:!L||void 0,style:{position:`relative`,...L?{overflowWrap:`anywhere`}:{}},children:[(0,z.jsx)(`span`,{"aria-hidden":M?!0:void 0,style:{visibility:M?`hidden`:void 0},children:me}),M&&(0,z.jsx)(z.Fragment,{children:(0,z.jsx)(`span`,{"data-chart-hint":!0,"aria-hidden":`true`,style:{position:`absolute`,inset:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:Bre(M)})})]}),e.options?.highlight&&(0,z.jsxs)(Ed,{component:`span`,"data-highlight-term":!0,title:`highlight: ${e.options.highlight}`,fz:11,c:`dimmed`,style:{display:`inline-block`,maxWidth:`100%`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,border:`1px solid var(--mantine-color-default-border)`,borderRadius:4,padding:`0 5px`},children:[`highlight: `,e.options.highlight]})]}),Zy(e)&&(0,z.jsx)(Ed,{size:`xs`,c:`dimmed`,role:`status`,children:Zy(e)}),e.description&&(0,z.jsx)(Xm,{label:e.description,multiline:!0,w:260,children:(0,z.jsx)(cl,{variant:`transparent`,color:`gray`,size:`xs`,"aria-label":`${t} description`,children:(0,z.jsx)(cte,{size:14})})}),r&&n&&(0,z.jsx)(el,{size:12,"aria-label":`Refreshing`})]}),(0,z.jsxs)(vl,{gap:4,wrap:`nowrap`,style:{flexShrink:0},children:[!ie&&e.viz!==`text`&&(0,z.jsx)(vl,{gap:0,wrap:`nowrap`,role:`group`,"aria-label":`${t} view`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:5,overflow:`hidden`},children:[`Chart`,`Data`,`Spec`].map(e=>(0,z.jsx)(`button`,{type:`button`,"data-panel-view":e,"aria-pressed":se===e,onClick:()=>ce(e),style:{border:0,borderLeft:e===`Chart`?void 0:`1px solid var(--mantine-color-default-border)`,padding:`2px 6px`,fontSize:11,fontFamily:`inherit`,cursor:`pointer`,background:se===e?`var(--mantine-color-default)`:`transparent`,color:se===e?`var(--mantine-primary-color-filled)`:`var(--mantine-color-dimmed)`,fontWeight:se===e?600:400,boxShadow:se===e?`inset 0 -2px var(--mantine-primary-color-filled)`:void 0},children:e},e))}),e.viz===`service_map`&&le?.canFit&&(0,z.jsx)(cl,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":le.overview?`Return to readable ${t} view`:`Show whole ${t} graph`,onClick:le.fit,children:(0,z.jsx)(c_,{size:16})}),v&&_&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)&&(0,z.jsx)(cl,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":`Reset ${t} zoom`,onClick:_,children:(0,z.jsx)(rte,{size:16})}),(0,z.jsxs)(Kp,{position:`bottom-end`,withinPortal:!0,onChange:e=>{e&&Ie()},children:[(0,z.jsx)(Kp.Target,{children:(0,z.jsx)(cl,{ref:De,variant:`subtle`,color:`gray`,size:`sm`,"aria-label":`${t} menu${we?`, refresh failed`:``}`,"aria-describedby":we?Te:void 0,onFocus:e=>{let t=e.currentTarget.matches(`:focus-visible`);ke(t),t&&Ne(!1)},onBlur:()=>ke(!1),onMouseEnter:()=>{je(!0),Ne(!1)},onMouseLeave:Ie,children:ye?(0,z.jsx)(x_,{size:18,weight:`fill`,color:`var(--mantine-color-warn-filled)`}):(0,z.jsx)(ste,{size:18,weight:`bold`})})}),(0,z.jsx)(Xm,{target:Ee,multiline:!0,maw:`min(360px, calc(100vw - 32px))`,label:(0,z.jsxs)(z.Fragment,{children:[Se&&(0,z.jsx)(Ed,{size:`xs`,children:Se}),(0,z.jsx)(Ed,{"data-refresh-error-message":!0,size:`xs`,title:ye||void 0,lineClamp:4,style:{overflowWrap:`anywhere`},children:ye})]}),opened:Pe}),(0,z.jsxs)(Kp.Dropdown,{children:[(ie||e.viz===`text`)&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Kp.RadioGroup,{value:se,onChange:ce,children:(0,z.jsx)(V,{role:`group`,"aria-label":`${t} view`,children:(e.viz===`text`?[`Chart`,`Spec`]:[`Chart`,`Data`,`Spec`]).map(t=>(0,z.jsx)(Kp.RadioItem,{value:t,"data-panel-view":t,closeMenuOnClick:!0,children:e.viz===`text`&&t===`Chart`?`Content`:t},t))})}),(0,z.jsx)(Kp.Divider,{})]}),ye&&be&&C&&(0,z.jsx)(Kp.Item,{disabled:r,onClick:()=>{Ie(),C()},children:`Retry`}),xe&&l&&S&&(0,z.jsx)(Kp.Item,{onClick:S,children:`Ask Fanout to fix it`}),y&&(0,z.jsx)(Kp.Item,{leftSection:(0,z.jsx)(c_,{size:14}),onClick:y,children:`View`}),l&&x&&(0,z.jsx)(Kp.Item,{leftSection:(0,z.jsx)(ote,{size:14}),onClick:x,children:`Explain in chat`}),b&&(0,z.jsx)(Kp.Item,{leftSection:(0,z.jsx)(p_,{size:14}),onClick:b,children:`Copy link`}),typeof e.sql==`string`&&E&&(0,z.jsx)(Kp.Item,{onClick:E,children:`Edit SQL`}),T&&(0,z.jsx)(Kp.Item,{leftSection:(0,z.jsx)(p_,{size:14}),onClick:T,children:`Duplicate`}),w&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Kp.Divider,{}),(0,z.jsx)(Kp.Item,{color:`bad`,leftSection:(0,z.jsx)(fte,{size:14}),onClick:w,children:`Remove panel`})]})]})]})]})]}),(0,z.jsx)(V,{ref:Re,"data-panel-body":!0,className:`dashboard-panel-padding`,tabIndex:se===`Chart`?void 0:0,style:{flex:`1 1 0px`,isolation:`isolate`,contain:_e||se===`Data`?`paint`:void 0,minHeight:0,minWidth:0,padding:`16px`,overflow:ge?`auto`:`hidden`,display:_e||se!==`Chart`?`block`:`flex`,flexDirection:`column`,backgroundColor:`inherit`,borderBottomLeftRadius:`inherit`,borderBottomRightRadius:`inherit`},children:k?(0,z.jsx)(Rf,{h:`100%`,children:(0,z.jsx)(Ed,{size:`sm`,c:`dimmed`,children:`Shown in full-screen`})}):se===`Data`?(0,z.jsx)(Ire,{panel:e,result:n}):se===`Spec`?(0,z.jsx)(Lre,{panel:e,dark:F}):!n&&e.viz!==`text`?(0,z.jsx)(Rf,{style:{minHeight:`100%`,flexShrink:0},children:(0,z.jsx)(el,{size:`sm`,"aria-label":`Loading panel`})}):n?.status===`error`?(0,z.jsxs)(V,{"data-panel-error":!0,style:{height:`100%`,maxHeight:`100%`,minHeight:0,minWidth:0,overflow:`hidden`,display:`flex`,flexDirection:He?`row`:`column`,alignItems:`center`,justifyContent:`center`,gap:He?6:4},children:[(0,z.jsx)(x_,{size:18,weight:`fill`,color:`var(--mantine-color-bad-filled)`,style:{flexShrink:0}}),!He&&(0,z.jsx)(Ed,{size:`sm`,fw:500,c:`bad`,style:{flexShrink:0},children:`This panel failed`}),(0,z.jsx)(Ed,{"data-panel-error-message":!0,title:n.error,size:`xs`,c:`dimmed`,ta:He?`left`:`center`,style:{minWidth:0,minHeight:0,overflow:`hidden`,...He?{flex:`1 1 0px`,whiteSpace:`nowrap`,textOverflow:`ellipsis`}:{overflowWrap:`anywhere`,flex:`0 1 auto`}},children:He?`This panel failed: ${n.error??`Request failed`}`:n.error}),be&&C&&(0,z.jsx)(Ff,{size:`compact-xs`,variant:`light`,style:{flexShrink:0},disabled:r,onClick:C,children:`Retry`}),xe&&l&&S&&(He?(0,z.jsx)(Xm,{label:`Ask Fanout to fix it`,events:{hover:!0,focus:!0,touch:!1},children:(0,z.jsx)(cl,{size:32,variant:`light`,"aria-label":`Ask Fanout to fix it`,style:{flex:`0 0 32px`},onClick:S,children:(0,z.jsx)(pte,{size:16})})}):(0,z.jsx)(Ff,{size:`compact-xs`,variant:`light`,style:{flexShrink:0},onClick:S,children:`Ask Fanout to fix it`}))]}):n?.status===`empty`?(0,z.jsx)(Rf,{style:{minHeight:`100%`,flexShrink:0},children:(0,z.jsxs)(dh,{align:`center`,gap:4,maw:420,children:[(0,z.jsx)(dte,{size:20,color:`var(--mantine-color-dimmed)`}),(0,z.jsx)(Ed,{size:`sm`,c:`dimmed`,ta:`center`,style:{overflowWrap:`anywhere`},children:n.diagnosis||`No data in this time range.`})]})}):(0,z.jsx)(eb.Provider,{value:P,children:(0,z.jsx)(OEe,{traceLinks:O,onMapView:de,compare:i,range:a,panel:e,title:t,result:n,dark:F,height:R,group:s,annotations:u,vars:d,onSelect:f,onPoint:p,onVariable:m,onZoom:h,onRangePending:g})})}),Le.length>0&&(0,z.jsx)(V,{"data-panel-notes":!0,className:`dashboard-panel-padding`,pb:12,style:{display:`flex`,flexDirection:`column`,gap:4,flexShrink:0,position:`relative`,zIndex:1,paddingTop:8,background:`var(--mantine-color-body)`,borderBottomLeftRadius:`inherit`,borderBottomRightRadius:`inherit`},children:Le.map(e=>(0,z.jsx)(Ed,{"data-panel-note":!0,fz:12,c:`dimmed`,role:`status`,title:e===ve?n?.frame?.note:void 0,style:{overflowWrap:`anywhere`},children:e},e))}),we&&(0,z.jsx)(`span`,{id:Te,hidden:!0,children:we}),Ue&&(0,z.jsx)(V,{"data-panel-scroll-fade":!0,"aria-hidden":`true`,style:{position:`absolute`,left:16,right:16,bottom:Ue.bottom,height:16,pointerEvents:`none`,zIndex:1,background:`linear-gradient(to bottom, transparent, var(--mantine-color-body))`}})]})}function MEe(e){let t=e?.match(/^Split at (\S+)( · .+)$/);if(!t)return e;let n=new Date(t[1]);return Number.isFinite(n.getTime())?`Split at ${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).format(n)}${t[2]}`:e}function E0(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r} minute${r===1?``:`s`} ago`;let i=Math.floor(r/60);return`${i} hour${i===1?``:`s`} ago`}function NEe({variables:e,vars:t,options:n,onChange:r}){return e.length===0?null:(0,z.jsx)(vl,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard variables`,children:e.map(e=>{let i=Xg(e,t,n[e.name]),a=[...e.include_all?[{value:Yg,label:`All`}]:[],...(n[e.name]??e.options?.map(e=>({value:e}))??[]).map(e=>({value:e.value,label:e.value}))],o=(0,z.jsxs)(Ed,{size:`xs`,c:`dimmed`,ff:`monospace`,children:[`$`,e.name]});return e.kind===`constant`?(0,z.jsx)(jh,{label:o,size:`xs`,value:e.value,readOnly:!0,w:160},e.name):e.kind===`text`?(0,z.jsx)(jh,{label:o,size:`xs`,w:200,defaultValue:typeof i==`string`?i:``,onBlur:t=>r(e.name,t.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}},`${e.name}:${JSON.stringify(i)}`):e.multi?(0,z.jsx)(Dm,{label:o,size:`xs`,w:260,searchable:!0,clearable:!0,data:a.filter(e=>e.value!==Yg),value:Array.isArray(i)?i:i&&i!==`$__all`?[i]:[],placeholder:e.include_all?`All`:`None`,onChange:t=>r(e.name,t.length?t:e.include_all?Yg:[])},e.name):(0,z.jsx)(Qm,{label:o,size:`xs`,w:220,searchable:!0,allowDeselect:!1,data:a,value:Array.isArray(i)?i[0]??null:i||null,onChange:t=>t!==null&&r(e.name,t)},e.name)})})}var PEe=e=>({panels:e.panels.map(({grid:e,...t})=>t),variables:e.variables,time:e.time,annotations:e.annotations});function FEe(e,t,n,r){return[`variables`,e,PEe(t),n,r]}function IEe(e,t,n,r,i,a=!1){let o=!!t.variables?.some(e=>e.kind===`query`),s=jg({queryKey:FEe(e,t,n,r),queryFn:async({signal:e})=>{let a=await i({dashboard:t,time:n,vars:r},e);return Object.fromEntries((t.variables??[]).map(e=>[e.name,a[e.name]??(e.kind===`custom`?e.options?.map(e=>({value:e})):void 0)??[]]))},enabled:o,retry:a,staleTime:6e4,placeholderData:e=>e}),c=s.isPlaceholderData?void 0:s.data,l=s.isError||(t.variables??[]).every(e=>e.kind!==`query`||r[e.name]!==void 0&&r[e.name]!==`$__all`&&(e.multi||!Array.isArray(r[e.name])||r[e.name].length>0)||!!e.default||e.include_all||c?.[e.name]!==void 0);return{...s,currentData:c,ready:l}}function LEe(e,t){let n=JSON.stringify([e.range,e.from,e.to]),r=(0,A.useRef)({search:e,onSearch:t,scope:n}),i=(0,A.useRef)(``),a=(0,A.useRef)(void 0),[o,s]=(0,A.useState)(!1);r.current.scope!==n&&(i.current!==`${e.from}/${e.to}`&&(a.current=void 0,o&&s(!1)),i.current=``),r.current={search:e,onSearch:t,scope:n};let c=(0,A.useCallback)(()=>{i.current=``,a.current=void 0,s(!1)},[]),l=(0,A.useCallback)(()=>{if(!a.current)return;let e=a.current;c(),r.current.onSearch({...r.current.search,...e},!1)},[c]);return{zoom:(0,A.useCallback)((e,t)=>{let n=Fre(e,t);if(!n)return;let o=r.current,c=`${n.from}/${n.to}`;o.search.from===n.from&&o.search.to===n.to||i.current===c||(a.current??={range:o.search.range,from:o.search.from,to:o.search.to},s(!0),i.current=c,o.onSearch({...o.search,range:void 0,...n},!1))},[]),reset:c,resetZoom:l,zoomed:o}}function REe(e,t,n,r){let i=e=>t?.frame?.columns.some((n,r)=>n.name===e&&t.frame.values[r]?.some(e=>typeof e==`string`&&e!==``));return{onSelect:e.click&&(e.viz===`service_map`||!(e.drill&&r))?t=>n(e.click.set_variable,t):void 0,onPoint:r&&(e.viz===`service_map`||e.click||e.drill||i(`trace_id`)||e.options?.columns?.some(e=>e.format===`trace_link`&&i(e.field)))?r:void 0}}function zEe(e,t,n,r){if(!t)return;let i=w_(e,t,n);if(!i)return;let a=Object.values(n.dimensions)[0],o=e.click?.set_variable;return{target:i,vars:o&&a!==void 0?{...r,[o]:a}:r}}var BEe=e=>e*40+(e-1)*12,VEe={s:3,m:6,l:10},HEe={stat:4},UEe=e=>Math.max(HEe[e.viz]??0,VEe[e.height??(e.viz===`service_map`?`l`:e.viz===`stat`?`s`:`m`)]),D0=e=>Math.max(e.viz===`service_map`?460:0,BEe(e.grid?.h??UEe(e)));function WEe(e){let t=(0,A.useRef)(void 0),n=t=>[...e.current?.querySelectorAll(`[data-panel]`)??[]].find(e=>e.dataset.panel===t&&!e.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`));return(0,A.useEffect)(()=>{t.current&&!n(t.current.panel)&&(t.current=void 0)}),{remember(n){t.current=void 0;let r=document.activeElement;if(!(r instanceof HTMLElement)||!e.current?.contains(r)||r.closest(`[data-panel]`)?.dataset.panel!==n)return;let i=r.getAttribute(`data-panel-view`),a=r.getAttribute(`aria-label`),o=r.hasAttribute(`data-chart-plot`)?`[data-chart-plot]`:i?`[data-panel-view=${JSON.stringify(i)}]`:a?`[aria-label=${JSON.stringify(a)}]`:void 0;t.current={element:r,panel:n,selector:o}},restore(e){let r=t.current;if(t.current=void 0,r&&(e===void 0||r.panel===e)&&n(r.panel))return r.element.isConnected&&!r.element.closest(`[hidden]`)?r.element:r.selector?n(r.panel)?.querySelector(r.selector)??void 0:void 0}}}var GEe=async()=>{throw Error(`Variable options unavailable`)};function KEe({fragment:e,dark:t,onQuery:n,drillClient:r,resolveVariables:i,height:a,hostDisplayMode:o,onDisplayMode:s}){let c=(0,A.useId)(),[l,u]=(0,A.useState)(e),[d,f]=(0,A.useState)(e.vars??{}),[p,m]=(0,A.useState)(e.dashboard.time),[h,g]=(0,A.useState)(!1),[_,v]=(0,A.useState)(),[y,b]=(0,A.useState)(),x=(0,A.useRef)(Date.now()),S=(0,A.useRef)(0),[C,w]=(0,A.useState)(),[T,E]=(0,A.useState)(),D=(0,A.useRef)(null),O=WEe(D),k=(0,A.useRef)(o);(0,A.useEffect)(()=>{k.current===`fullscreen`&&o===`inline`&&E(void 0),k.current=o},[o]);let j=async e=>{O.remember(e);try{(!s||await s(`fullscreen`))&&E(e)}catch{v(`Full-screen could not be opened. Please try again.`)}},M=()=>{E(void 0),s&&s(`inline`).catch(()=>v(`Full-screen could not be closed. Please try again.`))},N=(0,A.useRef)(new Map),P=(0,A.useRef)(void 0);T&&(P.current=T);let F=o===`fullscreen`&&!!T,ee=(0,A.useRef)(null),I=(0,A.useRef)(!1);(0,A.useEffect)(()=>{let e=I.current&&!F;if(I.current=F,F&&ee.current?.focus(),!e)return;let t=requestAnimationFrame(()=>(O.restore(P.current)??N.current.get(P.current??``))?.focus());return()=>cancelAnimationFrame(t)},[F]),(0,A.useEffect)(()=>{if(!F)return;let e=e=>{e.key===`Escape`&&!e.defaultPrevented&&!e.repeat&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!document.querySelector(`[role="dialog"]`)&&(e.preventDefault(),M())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[F,s]);let[te,L]=(0,A.useState)(()=>window.innerHeight);(0,A.useEffect)(()=>{let e=()=>L(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,A.useEffect)(()=>{S.current++,u(e),f(e.vars??{}),m(e.dashboard.time),w(void 0),E(void 0),g(!1),v(void 0),b(void 0),ce(),x.current=Date.now()},[e]),(0,A.useEffect)(()=>()=>{S.current++},[]);let ne=l.dashboard,re=IEe(c,ne,p,d,i??GEe),ie=(0,A.useMemo)(()=>Qg(ne.variables,d,re.currentData),[ne.variables,d,re.currentData]);async function ae(e=d,t=p){let r=++S.current;f(e),m(t),w(void 0),g(!0),v(void 0),b(x.current);let i=e===d?ie:Qg(ne.variables,e,re.currentData);try{let e=Jg(await n({dashboard:ne,time:t,vars:i}));if(S.current!==r)return;u(e),x.current=Date.now(),b(void 0)}catch(e){S.current===r&&v(e instanceof Error?e.message:`This view could not be refreshed.`)}finally{S.current===r&&g(!1)}}let oe=(e,t)=>{let n={...d};t===void 0?delete n[e]:n[e]=t,ae(n)},{zoom:se,reset:ce,resetZoom:le,zoomed:ue}=LEe(p,e=>void ae(d,e)),de=(e,t)=>{let n=zEe(e,l.results.find(t=>t.id===e.id),t,d);n&&(n.vars!==d&&ae(n.vars),w(n.target))},fe=(e,t,n=!1)=>(0,z.jsx)(jEe,{panel:e,title:Zg(e.title,ie),result:l.results.find(t=>t.id===e.id),suspended:!n&&e.id===T,menuRef:n?void 0:t=>{t?N.current.set(e.id,t):N.current.delete(e.id)},group:c,height:t,loading:h,staleAt:y,editing:!1,agentAvailable:!1,vars:ie,range:e.time?.range??p.range,compare:p.compare===`previous_period`,onVariable:oe,...REe(e,l.results.find(t=>t.id===e.id),oe,t=>de(e,t)),onZoom:se,zoomed:ue,onZoomReset:le,onView:o===void 0||s?()=>void j(e.id):void 0,traceLinks:`button`}),R=ne.panels.find(e=>e.id===T);return(0,z.jsxs)(dh,{ref:D,"data-dashboard-fragment":!0,gap:`md`,p:`md`,children:[(0,z.jsx)(V,{hidden:F,style:F?{display:`none`}:void 0,children:(0,z.jsxs)(dh,{gap:`md`,children:[ne.panels.length>1&&(0,z.jsx)(Ed,{"data-fragment-header":!0,fw:600,children:Pee(l)}),(0,z.jsx)(NEe,{variables:ne.variables??[],vars:d,options:re.data??{},onChange:oe}),re.error&&(0,z.jsx)(xd,{color:`bad`,children:`Variable options could not be loaded.`}),_&&(0,z.jsx)(xd,{color:`bad`,children:_}),ne.panels.map(e=>(0,z.jsx)(V,{h:a??D0(e),children:fe(e,a??D0(e))},e.id)),l.trace&&(0,z.jsx)(Xy,{result:l.trace,dark:t})]})}),F&&R&&(0,z.jsx)(V,{"data-fragment-fullscreen":!0,role:`region`,"aria-label":Zg(R.title,ie),tabIndex:-1,ref:ee,h:`calc(100vh - 32px)`,children:fe(R,Math.max(40,te-80),!0)}),o!==`fullscreen`&&(0,z.jsx)(AEe,{opened:!!R,onClose:M,title:R?Zg(R.title,ie):`Panel`,escapeEnabled:!C,returnFocusTo:()=>O.restore(P.current)??N.current.get(P.current??``),children:R&&(0,z.jsx)(V,{h:`calc(100vh - 120px)`,children:fe(R,Math.max(40,te-140),!0)})}),(0,z.jsx)(Pre,{client:r,spec:ne,time:p,vars:ie,target:C,onChange:w})]})}function qEe(e){async function t(t,n,r){if(r?.aborted)throw new DOMException(`Canceled`,`AbortError`);let i;try{i=await e.callServerTool({name:t,arguments:n},{signal:r})}catch(e){throw e instanceof Error&&e.name===`AbortError`?e:r?.aborted?new DOMException(`Canceled`,`AbortError`):Error(`This view could not be refreshed.`)}if(r?.aborted)throw new DOMException(`Canceled`,`AbortError`);if(i.isError||!i.structuredContent)throw Error(`This view could not be refreshed.`);return i.structuredContent}return{drill:{exemplars:(e,n)=>t(`list_panel_exemplars`,{...e},n),trace:async(e,n)=>{let r=Jg(await t(`inspect_trace`,{trace_id:e.trace_id,namespace:e.namespace,from:e.window_from,to:e.window_to,limit:200},n));if(!r.trace)throw Error(`Trace unavailable`);return r.trace}},query:async e=>{if(Object.hasOwn(e,`panels`))throw Error(`Panel subsets are unavailable in chat fragments`);let n=Jg(await t(`query_panel_fragment`,{...e}));return n.vars=e.vars,n},resolveVariables:async(e,n)=>{let r=await t(`resolve_panel_variables`,{...e},n);if(!r.options||typeof r.options!=`object`||Array.isArray(r.options)||Object.values(r.options).some(e=>!Array.isArray(e)||e.some(e=>!e||typeof e.value!=`string`)))throw Error(`Invalid variable options`);return r.options}}}var O0=Object.defineProperty,JEe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),YEe=(e,t)=>{let n={};for(var r in e)O0(n,r,{get:e[r],enumerable:!0});return t&&O0(n,Symbol.toStringTag,{value:`Module`}),n},XEe=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function ZEe(e){return typeof e==`string`&&XEe.has(e.replace(/#$/,``))}function k0(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 A0(e,t=`|`){return e.map(e=>Y0(e)).join(t)}function j0(e,t){return typeof t==`bigint`?t.toString():t}var QEe=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function M0(e){return new QEe(e)}function $Ee(e){return e==null}function N0(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function eDe(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){let e=t._zod.def.shape[a];return r?r(e,a):e}):z0(e,a,r?r(n.value,a):n.value))}}function nDe(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?R0(e,n,()=>t[n]):z0(e,n,r.value))}}function V0(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function rDe(e){return JSON.stringify(e)}function iDe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var H0=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function U0(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var aDe=M0(()=>{if(y2.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function W0(e){if(U0(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return U0(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function G0(e){return W0(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var oDe=new Set([`string`,`number`,`symbol`]);function K0(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function q0(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function J0(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 Y0(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function sDe(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var X0={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},cDe={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function lDe(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`);let i={};return B0(i,e,Z0(e,t)),q0(e,V0(n,{shape:i,checks:[]}))}function Z0(e,t){let n=L0(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function uDe(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`);let i=new Set(Z0(e,t)),a={};return B0(a,e,Reflect.ownKeys(L0(e)).filter(e=>!i.has(e))),q0(e,V0(n,{shape:a,checks:[]}))}function dDe(e,t){if(!W0(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=L0(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return q0(e,V0(e._zod.def,{shape:Q0(e,t)}))}function Q0(e,t){let n={};return B0(n,e,Reflect.ownKeys(L0(e))),nDe(n,t),n}function fDe(e,t){if(!W0(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return q0(e,V0(e._zod.def,{shape:Q0(e,t)}))}function pDe(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return B0(n,e,Reflect.ownKeys(L0(e))),B0(n,t,Reflect.ownKeys(L0(t))),q0(e,V0(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function $0(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Z0(t,n)):void 0,o={};return B0(o,t,Reflect.ownKeys(L0(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),q0(t,V0(t._zod.def,{shape:o,checks:[]}))}function mDe(e,t,n){let r=n?new Set(Z0(t,n)):void 0,i={};return B0(i,t,Reflect.ownKeys(L0(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),q0(t,V0(t._zod.def,{shape:i}))}function e2(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function n2(e){return typeof e==`string`?e:e?.message}function r2(e,t,n){var r;for(let i=t;ie;return t[CDe]=!0,t}var m2,TDe=Object.freeze({status:`aborted`}),h2={value:void 0,enumerable:!1},g2=`captureStackTrace`in Error?Error:null;function EDe(e){let t=g2;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return g2=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function J(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){h2.value=new a(r);try{Object.defineProperty(n,"_zod",h2)}finally{h2.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),vDe(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?EDe(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var _2=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},v2=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(m2=globalThis).__zod_globalConfig??(m2.__zod_globalConfig={});var y2=globalThis.__zod_globalConfig;function b2(e){return e&&Object.assign(y2,e),y2}function DDe(){let e=this._zod;return e.message??=JSON.stringify(e.def,j0,2),e.message}function ODe(e){this._zod.message=e}var kDe={get:DDe,set:ODe,enumerable:!0,configurable:!0},x2={value:void 0,enumerable:!1},S2=new WeakSet([Object.prototype,Error.prototype]),C2=(e,t)=>{e.name=`$ZodError`,x2.value=t,Object.defineProperty(e,"issues",x2),x2.value=void 0,Object.defineProperty(e,"message",kDe);let n=Object.getPrototypeOf(e);S2.has(n)||(S2.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},ADe=J(`$ZodError`,C2);J(`$ZodError`,C2,void 0,{Parent:Error});function jDe(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function MDe(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?jDe(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function NDe(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new _2;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>i2(e,o,b2())));throw H0(n,a?.callee??t),n}return s.value};return t},E2=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>i2(e,o,b2())));throw H0(n,a?.callee??t),n}return s.value};return t},D2=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 _2;return a.issues.length?O2(e,a.issues,i):{success:!0,data:a.value}};function O2(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>i2(e,n,b2()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var k2=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?O2(e,a.issues,i):{success:!0,data:a.value}},PDe=Symbol.for(`zod.compile.invalid`),FDe=Symbol.for(`zod.compile.fallback`),IDe=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==PDe)return!0;if(r.definite===!0&&n===void 0)return!1}return LDe(e,t,n)});function LDe(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[FDe]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new _2;return a.issues.length===0}var RDe=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},zDe=e=>{let t=T2(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,w2(n,a))};return n},BDe=e=>{let t=T2(e),n=(e,r,i,a)=>t(e,r,i,w2(n,a));return n},VDe=e=>{let t=E2(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,w2(n,a))};return n},HDe=e=>{let t=E2(e),n=async(e,r,i,a)=>await t(e,r,i,w2(n,a));return n},UDe=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return D2(e)(t,n,i)},WDe=e=>(t,n,r)=>D2(e)(t,n,r),GDe=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return k2(e)(t,n,i)},KDe=e=>async(t,n,r)=>k2(e)(t,n,r),qDe=/^[cC][0-9a-z]{6,}$/,JDe=/^[0-9a-z]+$/,YDe=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,XDe=/^[0-9a-vA-V]{20}$/,ZDe=/^[A-Za-z0-9]{27}$/,QDe=/^[a-zA-Z0-9_-]{21}$/;function $De(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var eOe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tOe=/^([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})$/,A2=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)$/,nOe=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rOe=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function iOe(){return new RegExp(rOe,`u`)}var aOe=/^(?:(?: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])$/,oOe=/^(([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}|:))$/,sOe=/^((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])$/,cOe=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lOe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uOe=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,dOe=/^https?$/,fOe=/^\+[1-9]\d{6,14}$/,j2=`(?:(?:\\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])))`;function pOe(e){return RegExp(`^${e}$`)}var mOe=pOe(j2);function M2(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function hOe(e){return RegExp(`^${M2(e)}$`)}function gOe(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${M2({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${M2({precision:e.precision})}`:n;return RegExp(`^${j2}T(?:${r})$`)}var _Oe=/^[\s\S]{0,}$/,vOe=/^-?\d+$/,N2=/^-?\d+(?:\.\d+)?$/,yOe=/^(?:true|false)$/i,bOe=/^null$/i,xOe=/^undefined$/i,SOe=/^[^A-Z]*$/,COe=/^[^a-z]*$/,P2=J(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),F2=e=>{let t=e.value;return!$Ee(t)&&t.length!==void 0},I2={number:`number`,bigint:`bigint`,object:`date`},L2=J(`$ZodCheckLessThan`,(e,t)=>{P2.init(e,t);let n=I2[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{P2.init(e,t);let n=I2[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:I2[typeof r.value]??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})}}),wOe=J(`$ZodCheckMultipleOf`,(e,t)=>{P2.init(e,t),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`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):eDe(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})}}),TOe=J(`$ZodCheckNumberFormat`,(e,t)=>{P2.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=X0[t.format];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}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),EOe=J(`$ZodCheckMaxLength`,(e,t)=>{var n;P2.init(e,t),(n=e._zod.def).when??(n.when=F2),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?a2(r):i)<=t.maximum)return;let a=o2(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),DOe=J(`$ZodCheckMinLength`,(e,t)=>{var n;P2.init(e,t),(n=e._zod.def).when??(n.when=F2),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i=t.minimum)return;let a=o2(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),OOe=J(`$ZodCheckLengthEquals`,(e,t)=>{var n;P2.init(e,t),(n=e._zod.def).when??(n.when=F2),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?a2(r):i;if(a===t.length)return;let o=o2(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),z2=J(`$ZodCheckStringFormat`,(e,t)=>{var n,r;P2.init(e,t),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=()=>{})}),kOe=J(`$ZodCheckRegex`,(e,t)=>{z2.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})}}),AOe=J(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=SOe,z2.init(e,t)}),jOe=J(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=COe,z2.init(e,t)}),MOe=J(`$ZodCheckIncludes`,(e,t)=>{P2.init(e,t);let n=K0(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),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})}}),NOe=J(`$ZodCheckStartsWith`,(e,t)=>{P2.init(e,t);let n=RegExp(`^${K0(t.prefix)}.*`);t.pattern??=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})}}),POe=J(`$ZodCheckEndsWith`,(e,t)=>{P2.init(e,t);let n=RegExp(`.*${K0(t.suffix)}$`);t.pattern??=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})}}),FOe=J(`$ZodCheckOverwrite`,(e,t)=>{P2.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),IOe=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` +`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return lSe(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var gCe={tokenize:wCe,partial:!0};function _Ce(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:xCe,continuation:{tokenize:SCe},exit:CCe}},text:{91:{name:`gfmFootnoteCall`,tokenize:bCe},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:vCe,resolveTo:yCe}}}}function vCe(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=dZ(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function yCe(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function bCe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||_Z(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(dZ(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return _Z(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function xCe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||_Z(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=dZ(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return _Z(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),CZ(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function SCe(e,t,n){return e.check(MZ,t,e.attempt(gCe,t,n))}function CCe(e){e.exit(`gfmFootnoteDefinition`)}function wCe(e,t,n){let r=this;return CZ(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function TCe(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=OZ(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var ECe=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){DCe(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function DCe(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function OCe(e,t){let n=!1,r=[];for(;t-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):gZ(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):vZ(t)?CZ(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||_Z(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,vZ(t)?CZ(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return vZ(t)?CZ(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||gZ(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return vZ(t)?CZ(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||gZ(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||gZ(n)?(e.exit(`tableRow`),t(n)):vZ(n)?CZ(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||_Z(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function jCe(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new ECe;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},N$(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function M$(e,t,n,r,i){let a=[],o=N$(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function N$(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var MCe={name:`tasklistCheck`,tokenize:PCe};function NCe(){return{text:{91:MCe}}}function PCe(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return _Z(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return gZ(r)?t(r):vZ(r)?e.check({tokenize:FCe},t,n)(r):n(r)}}function FCe(e,t,n){return CZ(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function ICe(e){return lZ([sCe(),_Ce(),TCe(e),kCe(),NCe()])}var LCe={};function RCe(e){let t=this,n=e||LCe,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(ICe(n)),a.push(rCe()),o.push(iCe(n))}function zCe({panel:e}){return(0,z.jsx)(`div`,{className:`panel-markdown`,children:(0,z.jsx)(xxe,{remarkPlugins:[RCe],skipHtml:!0,disallowedElements:[`img`],components:{a:({children:e,...t})=>(0,z.jsx)(`a`,{...t,target:`_blank`,rel:`noopener noreferrer`,children:e})},children:e.content??``})})}function P$(e,t,n,r,i,a,o={width:500,height:248}){if(![`timeseries`,`heatmap`,`state_timeline`].includes(t.viz))return e;let s=n.annotation_scope;if(n.annotation_error)return e;let c=e=>!s||s.services.some(t=>t.service===e.service&&(t.namespace===e.namespace||e.namespace===``&&!s.namespace_scoped)),l=n.from_ms??-1/0,u=n.to_ms??1/0,d=r.deploys.filter(c).filter(e=>Date.parse(e.at)>=l&&Date.parse(e.at)({xAxis:Date.parse(e.at),name:`${e.service} ${e.version}`,label:{show:!1},symbol:[`none`,`path://M0,0 L0,-6`],symbolSize:[1,6],lineStyle:{type:`dashed`,color:a.muted,width:1},tooltip:{formatter:()=>Ey(`${e.service} · ${e.version} · ${e.at}`)}})),f=[];for(let e of r.anomalies.filter(c).filter(e=>Date.parse(e.to)>l&&Date.parse(e.from)Date.parse(e.from)-Date.parse(t.from))){let t=Math.max(l,Date.parse(e.from)),n=Math.min(u,Date.parse(e.to)),r=e.namespace?`${e.namespace}/${e.service}`:e.service,i=`${r} · ${e.title} (${e.kind}) · ${e.from} – ${e.to}`,a=Ey(`${r} · ${e.title} · ${e.severity} · ${e.kind} · ${e.from} – ${e.to}`),o=f.at(-1);o&&t<=o.to?(o.to=Math.max(o.to,n),o.count++,o.labels.includes(i)||o.labels.push(i),o.details.includes(a)||o.details.push(a)):f.push({from:t,to:n,labels:[i],details:[a],count:1})}let p=f.map(e=>[{xAxis:e.from,name:e.labels.join(` · `),itemStyle:{color:a.status.warn,opacity:a.dark?.12:.09},label:{show:!1},tooltip:{formatter:()=>(e.count>1?`${e.count} windows\n`:``)+e.details.join(` +`)}},{xAxis:e.to}]),m=e.series??[];if(!m.length)return e;let h=e.grid??{},g=Array.isArray(e.yAxis)?e.yAxis[0]:e.yAxis,_=h.containLabel?(g?.axisLabel?.width??64)+(g?.axisLabel?.margin??8):0,v=(typeof h.left==`number`?h.left:8)+_,y=o.width-(typeof h.right==`number`?h.right:16),b=Math.max(1,y-v),x=e=>o.measureText?.(e,`12px ${a.font}`)??e.length*12,S=e.legend,C=0;for(let e of S?.data??[]){let t=15+x(S?.formatter?.(e)??e);if(C&&C+(S?.itemGap??6)+t>o.width)break;C+=(C?S?.itemGap??6:0)+t}let w=[...p.length?[{text:`anomaly`,details:p.map(e=>e[0].tooltip.formatter()).join(`
`)}]:[],...[...d].sort((e,t)=>e.xAxis-t.xAxis).map(e=>({text:e.name,details:e.tooltip.formatter()}))],T=w.reduce((e,t)=>e+x(t.text)+12,0),E=!!(S?.show&&T<=o.width-16-C-12),D=E?o.width-16-C-12:b,O=0,k=w.filter(e=>{let t=x(e.text)+12;return O+t>D?!1:(O+=t,!0)}),A=(typeof h.top==`number`?h.top:8)+(k.length&&!E?18:0),j=E?1:A-17,M=E?16:typeof h.right==`number`?h.right:16,N=k.map(e=>{let t=x(e.text),n={type:`text`,right:M,top:j,annotation:!0,style:{text:e.text,fill:a.muted,backgroundColor:a.surface,padding:[1,3],fontSize:11,fontFamily:a.font,width:t,stroke:a.surface,lineWidth:3},tooltip:{formatter:()=>e.details}};return M+=t+12,n}),P=e=>e?.type===`value`||e?.type===`log`?{...e,...yy(e,o.height-A-Number(h.bottom??8)-22),axisLabel:{...e.axisLabel,hideOverlap:!0}}:e,F=Array.isArray(e.yAxis)?e.yAxis.map(P):e.yAxis?P(e.yAxis):void 0,ee=m,I=[...e.graphic??[],...N];if(t.viz===`state_timeline`&&F&&!Array.isArray(F)){let e=F.data,t=Math.max(1,Math.floor((o.height-A-Number(h.bottom??8)-22)/16));if(e.length>t){F={...F,data:e.slice(0,t)},ee=m.map(e=>({...e,data:e.data.filter(e=>e.value[1]e.style?.text?.match(/^\+\d+ rows$/)),r=e.length-t+Number(n?.style.text.match(/\d+/)?.[0]??0);I=I.filter(e=>e!==n),I.push({type:`text`,right:0,bottom:0,style:{text:`+${r} rows`,fill:a.muted,fontSize:11,fontFamily:a.font},tooltip:{formatter:()=>e.slice(t).map(Ey).join(`
`)+(n?`
`+n.tooltip.formatter():``)}})}}return{...e,...d.length||p.length?{tooltip:{...e.tooltip??{},renderMode:`html`}}:{},grid:{...h,top:A},...F?{yAxis:F}:{},graphic:I,series:ee.map((e,t)=>{if(t!==0)return e;let n=e.markLine??{},r=e.markArea??{};return{...e,markLine:{...n,silent:!1,symbol:[`none`,`none`],data:[...n.data??[],...d]},markArea:{...r,silent:!1,data:[...r.data??[],...p]}}})}}function BCe({panel:e,title:t=e.title,result:n,dark:r,height:i,group:a,annotations:o,vars:s,onSelect:c,onPoint:l,onZoom:u,onRangePending:d}){let f=(0,A.useMemo)(()=>t=>{let i=Ry(r),a=yre(e,n,i,t);return o?P$(a,e,n,o,s??{},i,t):a},[e,n.frame,n.previous,n.shift_ms,n.from_ms,n.to_ms,n.annotation_scope,n.annotation_error,r,o]),p=(0,A.useMemo)(()=>f({width:500,height:i}),[f,i]),m=(0,A.useCallback)(t=>!!Qy(e,n,t),[e,n]);return(0,z.jsx)(dX,{keyboard:{canSelect:m,interval:n.interval,onRangePending:d,bounds:n.from_ms!==void 0&&n.to_ms!==void 0?{from:n.from_ms,to:n.to_ms}:void 0},option:p,optionForSize:f,height:i,label:`${t}: time series`,group:a,onZoom:u,onClick:l||c?t=>{let r=Qy(e,n,t);if(!r)return;l?.(r);let i=Object.values(r.dimensions)[0];i!==void 0&&c?.(i)}:void 0})}function VCe(e){return e.dark?[`#0f2a43`,`#164267`,`#1e5a8a`,`#2879ae`,`#399aca`,`#57b8e3`,`#7dd3fc`]:[`#dbeafe`,`#bfdbfe`,`#93c5fd`,`#60a5fa`,`#3b82f6`,`#2563eb`,`#1d4ed8`]}function F$(e,t){return e<=1?0:e>=t?6:Math.max(0,Math.min(6,Math.floor(Math.log10(Math.max(1,e))/Math.log10(t)*6)))}var I$={healthy:`●`,degraded:`■`,unhealthy:`◆`,unknown:`○`},L$=(e,t)=>et);function R$(e,t={}){let n=new Map(e.columns.map((e,t)=>[e.name,t])),r=(t,r)=>e.values[n.get(t)??-1]?.[r],i=(e,t)=>String(r(e,t)??``),a=(e,t)=>{let n=r(e,t);return typeof n==`number`&&Number.isFinite(n)?n:null},o=t.from_ms!==void 0&&t.to_ms!==void 0&&t.to_ms>t.from_ms?(t.to_ms-t.from_ms)/1e3:void 0,s=e=>o&&e!==null?e/o:null,c=new Map,l=[];for(let t=0;t=5?`bad`:c>=1?`warn`:null})}for(let e of l)for(let t of[e.caller,e.callee])c.has(t)||c.set(t,{id:t,health:`unknown`,spans:null,p95_ms:null,error_rate:null,request_rate:null});return{nodes:[...c.values()].sort((e,t)=>L$(e.id,t.id)),edges:l.sort((e,t)=>L$(e.id,t.id))}}function HCe(e){let t=e=>typeof e==`number`&&Number.isFinite(e)?e:null,n=(e,t)=>{let n=Math.max(0,Math.min(1,e/100)),r=3.8416;return Math.max(0,(n+r/(2*t)-1.96*Math.sqrt(n*(1-n)/t+r/(4*t*t)))/(1+r/t))};return e.filter(e=>typeof e.service==`string`).map(e=>{let r=Math.max(0,t(e.spans)??0),i=t(e.error_rate),a=r>=20&&i!==null;return{name:String(e.service),health:String(e.health??`unknown`),n:r,eligible:a,score:a?n(i,r):0,metric:i===null?`—`:`${i.toFixed(1)}%`}}).sort((e,t)=>Number(t.eligible)-Number(e.eligible)||(e.eligible?t.score-e.score:0)||t.n-e.n||L$(e.name,t.name)).slice(0,4)}function UCe(e){let t=/^(\d+)(s|m|h|d)$/.exec(e??``);return t?Number(t[1])*{s:1e3,m:6e4,h:36e5,d:864e5}[t[2]]:6e4}var z$=(e,t)=>dre(typeof e.bucket_lower==`number`?e.bucket_lower:null,typeof e.bucket_upper==`number`?e.bucket_upper:null,t),B$=e=>`${e.bucket_lower}:${e.bucket_upper}`,V$=e=>typeof e?.bucket_lower==`number`?{lower:e.bucket_lower,upper:typeof e.bucket_upper==`number`?e.bucket_upper:void 0}:void 0,WCe=e=>e>=1e3&&e<1e6&&e%1e3==0?`${e/1e3}k`:py(`count`,e);function GCe(e){let t=[];for(let n of[...e].sort((e,t)=>Number(e.value[1])-Number(t.value[1])||Number(e.value[0])-Number(t.value[0]))){let e=t.at(-1);e&&e.value[1]===n.value[1]&&e.value[4]===n.value[4]&&e.value[3]===n.value[0]?(e.value[3]=n.value[3],e.selection.to=n.selection.to):t.push({...n,value:[...n.value],selection:{...n.selection}})}return t}function H$(e,t){return(e.bucket_lower===null?-1/0:Number(e.bucket_lower))-(t.bucket_lower===null?-1/0:Number(t.bucket_lower))||(e.bucket_upper===null?1/0:Number(e.bucket_upper))-(t.bucket_upper===null?1/0:Number(t.bucket_upper))}function U$(e,t){let n=(t.frame?.columns??[]).map(t=>ay(t,e)).join(`, `);return`${e.title}: ${t.frame?.rows??0} rows; ${n}${t.frame?.truncated?`, limited data`:``}`}function KCe(e,t,n,r={width:500,height:248}){let i=t.frame??{columns:[],values:[],rows:0},a=O_(i),o=i.columns.filter(e=>e.role===`dimension`).map(e=>e.name),s=i.columns.filter(e=>e.role===`measure`),c=e.unit??i.columns.find(e=>e.name===`bucket_lower`)?.unit,l={animation:!1,aria:{enabled:!0,description:U$(e,t)},textStyle:{fontFamily:n.font,color:n.text},grid:{left:70,right:24,top:30,bottom:40,containLabel:!0},tooltip:{trigger:`item`,backgroundColor:n.surface,borderColor:n.border,textStyle:{color:n.text,fontFamily:n.font,fontSize:12},renderMode:`html`,formatter:Oy(t=>py(e.unit,t))},legend:{show:!1,textStyle:{color:n.muted}},xAxis:{type:`value`,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11},splitLine:{lineStyle:{color:n.grid}}},yAxis:{type:`value`,splitNumber:gy(r.height-92),axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11},splitLine:{lineStyle:{color:n.grid}}},series:[]};if(e.viz===`scatter`){let t=o[0],i=o[1],c=Ay([...new Set(a.map(e=>i?String(e[i]??``):`Items`))].map(e=>({name:e})),e),u=Ny(c.map(e=>e.name),r.width,c.length>1&&e.options?.legend!==`hidden`,n.text,n.font,r.measureText),d=e.options?.x_scale??e.options?.scale,f=e.options?.y_scale??e.options?.scale,p=e.x_unit??s[0]?.unit,m=e.unit??s[1]?.unit,h=(e,t,r,i)=>{let o=a.map(e=>e[r]).filter(e=>typeof e==`number`&&Number.isFinite(e)),s=Math.min(0,...o),c=Math.max(0,...o);return{type:t===`log`?`log`:`value`,...t===`log`?{splitNumber:gy(i)}:vy(s,c,e,i),axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},splitLine:{lineStyle:{color:n.grid}},axisLabel:{fontFamily:n.font,fontSize:11,color:n.muted,formatter:my(e),hideOverlap:!0}}};return{...l,tooltip:{...l.tooltip,formatter:t=>(Array.isArray(t)?t:[t]).map(t=>{let n=Array.isArray(t.value)?t.value:[];return Dy([`${t.seriesName??``} · ${t.name??``}`,`${ay(s[0]?{...s[0],unit:p}:`x`,e)}: ${py(p,Number(n[0]))}`,`${ay(s[1]?{...s[1],unit:m}:`y`,e)}: ${py(m,Number(n[1]))}`])}).join(`
`)},legend:u.option,grid:{...l.grid,top:u.option.show?u.top+20:28,left:8,right:16,bottom:32},xAxis:{...h(p,d,s[0]?.name,r.width-80),name:ay(s[0]?{...s[0],unit:p}:`x`,e),nameLocation:`middle`,nameGap:28,nameTextStyle:{color:n.muted,fontFamily:n.font,fontSize:11,align:`right`,verticalAlign:`top`}},yAxis:{...h(m,f,s[1]?.name,r.height-u.top-74),name:ay(s[1]?{...s[1],unit:m}:`y`,e),nameLocation:`end`,nameGap:8,nameRotate:0,nameTextStyle:{color:n.muted,fontFamily:n.font,fontSize:11,align:`left`,verticalAlign:`bottom`}},series:c.map(({name:r,items:c},l)=>({type:`scatter`,name:r,interactive:!0,keyboard_unit:m,keyboard_x_unit:p,itemStyle:Iy(ky(r)?n.muted:n_(l,n.dark),n),data:a.filter(e=>!i||c.some(t=>t.name===String(e[i]??``))).filter(e=>typeof e[s[0]?.name]==`number`&&typeof e[s[1]?.name]==`number`).filter(e=>(d!==`log`||Number(e[s[0].name])>0)&&(f!==`log`||Number(e[s[1].name])>0)).map(n=>({name:String(n[t]??``),value:[n[s[0].name],n[s[1].name]],selection:{dimensions:Object.fromEntries((e.query?.by??[]).map((e,t)=>[e,String(n[o[t]]??``)]))}}))}))}}if(e.viz===`histogram`){let t=o.find(e=>e!==`bucket_lower`&&e!==`bucket_upper`),i=[...new Map([...a].sort(H$).map(e=>[B$(e),e])).values()],s=i.map(e=>z$(e,c)),u=Ay([...new Set(a.map(e=>t?String(e[t]??``):`Count`))].map(e=>({name:e})),e),d=Ny(u.map(e=>e.name),r.width,u.length>1&&e.options?.legend!==`hidden`,n.text,n.font,r.measureText),f=u.map(({name:r,items:o},s)=>({type:`bar`,name:r,interactive:!0,keyboard_unit:`count`,itemStyle:Iy(ky(r)?n.muted:n_(s,n.dark),n),data:i.map(n=>{let i=a.filter(e=>(!t||o.some(n=>n.name===String(e[t]??``)))&&B$(e)===B$(n));return{value:gre(i.map(e=>typeof e.count==`number`?e.count:null))??0,selection:{dimensions:t?{[e.query?.by?.[0]??t]:r}:{},bucket:V$(i[0])}}})}));return{...l,legend:d.option,grid:{...l.grid,left:16,right:8,top:d.option.show?d.top+20:28,bottom:8},xAxis:{...l.xAxis,type:`category`,data:s,splitLine:{show:!1}},yAxis:{...l.yAxis,type:`value`,name:ay(`count`),nameLocation:`end`,nameGap:8,nameRotate:0,...vy(0,Math.max(0,...f.flatMap(e=>e.data.map(e=>e.value))),`count`,r.height-(d.option.show?d.top+20:28)-30),axisLabel:{...l.yAxis.axisLabel,hideOverlap:!0},nameTextStyle:{color:n.muted,fontFamily:n.font,fontSize:11,align:`right`,verticalAlign:`bottom`}},series:f}}if(e.viz===`service_map`)return{model:R$(i,t)};if(e.viz===`heatmap`||e.viz===`state_timeline`){let i=e.viz===`heatmap`,u=o[0],d=e=>i?B$(e):String(e[u]??``),f=[...new Set((i?[...a].sort(H$):a).map(d))],p=i?f:f.slice(0,Math.max(1,Math.floor((r.height-54)/16))),m=f.slice(p.length),h=new Map(a.map(e=>[B$(e),z$(e,c)])),g=UCe(t.interval),_=s[0]?.name??`count`,v=a.filter(e=>typeof e.time==`number`&&p.includes(d(e))).map(r=>{let a=r[_],o=typeof a==`number`?cy(a,e.thresholds,e.better??t.better)??`ok`:null;return{value:[r.time,p.indexOf(d(r)),a,Number(r.time)+g,i||o===null?0:o===`bad`?3:o===`warn`?2:1],selection:{...i?{time:r.time}:{},dimensions:i?{}:{[e.query?.by?.[0]??u]:String(r[u]??``)},bucket:i?V$(r):void 0,...i?{}:{from:new Date(Number(r.time)).toISOString(),to:new Date(Number(r.time)+g).toISOString()}},itemStyle:i?void 0:{color:o===null?`${n.text}26`:n.status[o]}}}),y=v.filter(e=>Number.isFinite(Number(e.value[2]))&&Number(e.value[2])>0),b=y.map(e=>Number(e.value[2])).sort((e,t)=>e-t),x=b[Math.max(0,Math.ceil(b.length*.99)-1)]??1,S=VCe(n),C=i?y.map(e=>({...e,value:[...e.value,F$(Number(e.value[2]),x)]})):GCe(v).map(e=>({...e,tooltip:{formatter:()=>`${Ey(p[Number(e.value[1])])} · ${[`Unknown`,`OK`,`Warn`,`Bad`][Number(e.value[4])]}\n${xy(Number(e.value[0]))} – ${xy(Number(e.value[3]))}`}})),w=WCe(b.length?x:0);return{...l,grid:{...l.grid,left:8,right:8,top:8,bottom:i?32:m.length?24:8},tooltip:{...l.tooltip,trigger:`axis`,formatter:t=>(Array.isArray(t)?t:[t]).map(t=>{let n=Array.isArray(t.value)?t.value:[];return Dy([`${t.seriesName??``} · ${t.name??``}`,i?h.get(p[Number(n[1])])??``:p[Number(n[1])]??``,`${xy(Number(n[0]))} – ${xy(Number(n[3]))}`,`${ay(s[0]??_,e)}: ${py(i?`count`:e.unit??s[0]?.unit,typeof n[2]==`number`?n[2]:null)}`])}).join(`
`)},axisPointer:{link:[{xAxisIndex:`all`}]},xAxis:{type:`time`,min:t.from_ms,max:t.to_ms,axisPointer:{show:!0},axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{fontFamily:n.font,fontSize:11,color:n.muted,formatter:by,hideOverlap:!0}},yAxis:{type:`category`,data:i?p.map(e=>h.get(e)):p,axisLine:{show:!1},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{fontFamily:n.font,fontSize:11,color:n.muted,width:140,overflow:`truncate`,...i?{interval:+((r.height-60)/Math.max(1,p.length)<12),hideOverlap:!0}:{interval:0}}},visualMap:i?{type:`continuous`,show:!0,orient:`horizontal`,right:16,bottom:0,padding:0,itemWidth:8,itemHeight:96,text:[w,b.length?`1`:`0`],textGap:10,textStyle:{color:n.muted,fontFamily:n.font,fontSize:11},min:0,max:6,dimension:5,inRange:{color:S}}:void 0,graphic:!i&&m.length?[{type:`text`,right:0,bottom:0,style:{text:`+${m.length} rows`,fill:n.muted,fontSize:11,fontFamily:n.font},tooltip:{formatter:()=>m.map(Ey).join(`
`)}}]:[],series:[{type:`custom`,clip:!0,name:e.title,interactive:!0,keyboard_unit:i?`count`:e.unit??s[0]?.unit,encode:{x:[0,3],y:1,tooltip:2},data:C,renderItem:(e,t)=>{let n=t.coord([t.value(0),t.value(1)]),r=t.coord([t.value(3),t.value(1)]),a=Math.abs(t.size([0,1])[1])*(i?1:.65),o=i&&Math.abs(r[0]-n[0])>=8?1:0;if(!i||t.value(2)>0)return{type:`rect`,shape:{x:n[0]+o/2,y:n[1]-a/2+o/2,width:Math.max(0,r[0]-n[0]-o),height:Math.max(0,a-o),r:i?0:Math.min(3,a/4)},style:{fill:t.visual(`color`),stroke:void 0,lineWidth:0,...i?{fill:S[F$(t.value(2),x)]}:{}}}}}]}}return l}function W$({panel:e,title:t,result:n,dark:r,height:i,group:a,annotations:o,vars:s,onSelect:c,onPoint:l,onZoom:u,onRangePending:d}){let f=(0,A.useMemo)(()=>t=>{let i=Ry(r),a=KCe(e,n,i,t);return o?P$(a,e,n,o,s??{},i,t):a},[e,n.frame,n.interval,n.better,n.from_ms,n.to_ms,n.annotation_scope,n.annotation_error,r,o]),p=U$(t?{...e,title:t}:e,n),m=(0,A.useMemo)(()=>f({width:500,height:i}),[f,i]),h=(0,A.useCallback)(t=>!!(t.data?.selection&&Qy(e,n,t)),[e,n]),g=e.viz===`heatmap`||e.viz===`state_timeline`;return(0,z.jsx)(dX,{keyboard:{canSelect:h,onRangePending:d,bounds:g&&n.from_ms!==void 0&&n.to_ms!==void 0?{from:n.from_ms,to:n.to_ms}:void 0},option:m,optionForSize:f,height:i,label:p,group:g?a:void 0,onZoom:g?u:void 0,onClick:l||c?t=>{let r=h(t)?Qy(e,n,t):void 0;if(r){l?.(r);let e=Object.values(r.dimensions)[0];e!==void 0&&c?.(e)}}:void 0})}function qCe(e){return(0,z.jsx)(W$,{...e})}function JCe(e){return(0,z.jsx)(W$,{...e})}function YCe(e){return(0,z.jsx)(W$,{...e})}function XCe(e){return(0,z.jsxs)(dh,{gap:4,style:{flex:`1 1 auto`,minHeight:0},children:[(0,z.jsx)(W$,{...e,height:Math.max(60,e.height-24)}),(0,z.jsx)(vl,{gap:`sm`,wrap:`nowrap`,role:`list`,"aria-label":`State legend`,style:{flexShrink:0},children:[[`● OK`,`ok`],[`■ Warn`,`warn`],[`◆ Bad`,`bad`],[`○ Unknown`,`dimmed`]].map(([t,n])=>(0,z.jsx)(Ed,{size:`xs`,style:{color:n===`dimmed`?Ry(e.dark).muted:Ly(n,e.dark)},role:`listitem`,children:t},t))})]})}var G$=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,'(function(){var e=Object.defineProperty,t=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,n=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},r=(e,n,r)=>t(e,typeof n==`symbol`?n:n+``,r),i={};n(i,{Graph:()=>D,alg:()=>_});var a=Object.defineProperty,o=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},s=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\\0`,this._children[e]={},this._children[`\\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\\0`)return t}}children(e=`\\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),(t?.length??0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,l=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,l=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,l=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let f=u(this._isDirected,i,a,o);if(f in this._edgeLabels)return l&&(this._edgeLabels[f]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[f]=l?s:this._defaultEdgeLabelFn(i,a,o);let p=d(this._isDirected,i,a,o);return i=p.v,a=p.w,Object.freeze(p),this._edgeObjs[f]=p,c(this._preds[a],i),c(this._sucs[i],a),this._in[a][f]=p,this._out[i][f]=p,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?f(this._isDirected,e):u(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!=`object`||!r?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?f(this._isDirected,e):u(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?f(this._isDirected,e):u(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],l(this._preds[t],e),l(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function c(e,t){e[t]?e[t]++:e[t]=1}function l(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function u(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\\0`:r)}function d(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function f(e,t){return u(e,t.v,t.w,t.name)}o({},{read:()=>g,write:()=>p});function p(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:m(e),edges:h(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function m(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function h(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function g(e){let t=new s(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var _={};o(_,{CycleException:()=>w,bellmanFord:()=>y,components:()=>x,dijkstra:()=>C,dijkstraAll:()=>ne,findCycles:()=>ie,floydWarshall:()=>oe,isAcyclic:()=>ce,postorder:()=>de,preorder:()=>fe,prim:()=>pe,shortestPaths:()=>me,tarjan:()=>re,topsort:()=>T});var v=()=>1;function y(e,t,n,r){return b(e,String(t),n||v,r||function(t){return e.outEdges(t)??[]})}function b(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=i[e.v],r=i[e.w];if(!t||!r)return;let o=n(e);t.distance+oe.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw Error(`Queue underflow`);this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n>1,!(t[r].priority1;function C(e,t,n,r){return te(e,String(t),n||ee,r||function(t){return e.outEdges(t)??[]})}function te(e,t,n,r){let i={},a=new S,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t];if(!r)return;let c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l0;){o=a.removeMin();let e=i[o];if(!e||e.distance===1/0)break;s=e,r(o).forEach(c)}return i}function ne(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=C(e,i,t,n),r},{})}function re(e){let t=0,n=[],r={},i=[];function a(o){var s;let c=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),(s=e.successors(o))==null||s.forEach(function(e){if(e in r){let t=r[e];t!=null&&t.onStack&&(c.lowlink=Math.min(c.lowlink,t.index))}else{a(e);let t=r[e];t&&(c.lowlink=Math.min(c.lowlink,t.lowlink))}}),c.lowlink===c.index){let e=[],t;do{t=n.pop();let i=r[t];i&&(i.onStack=!1),e.push(t)}while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function ie(e){return re(e).filter(function(t){let n=t[0];return n?t.length>1||t.length===1&&(e.outEdges(n,n)??[]).length>0:!1})}var ae=()=>1;function oe(e,t,n){return se(e,t||ae,n||function(t){return e.outEdges(t)??[]})}function se(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){let a={};r[e]=a,a[e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(a[t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=t(n);a[r]={distance:i,predecessor:e}})}),i.forEach(function(e){let t=r[e];t&&i.forEach(function(n){let a=r[n];a&&i.forEach(function(n){let r=a[e],i=t[n],o=a[n];if(r&&i&&o){let e=r.distance+i.distance;e(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=E(e,t,n===`post`,o,a,r,i)}),i}function E(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=E(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function ue(e,t,n){return le(e,t,n,function(e,t){return e.push(t),e},[])}function de(e,t){return ue(e,t,`post`)}function fe(e,t){return ue(e,t,`pre`)}function pe(e,t){var n;let r=new s,i={},a=new S,o;function c(e){let n=e.v===o?e.w:e.v,r=a.priority(n);if(r!==void 0){let s=t(e);s0;){if(o=a.removeMin(),o in i)r.setEdge(o,i[o]);else{if(u)throw Error(`Input graph is not connected: `+e);u=!0}(n=e.nodeEdges(o))==null||n.forEach(c)}return r}function me(e,t,n,r){return he(e,t,n,r??(t=>e.outEdges(t)??[]))}function he(e,t,n,r){if(n===void 0)return C(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;ot.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function _e(e){let t=new D({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function ve(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function k(e){let t=F(N(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function ye(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=M(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function be(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=M(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function A(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),O(e,`border`,i,t)}function xe(e,t=j){let n=[];for(let r=0;rj?e(...xe(t).map(t=>e(...t))):e(...t)}function N(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return M(Math.max,t)}function Se(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Ce(e,t){return t()}var we=0;function P(e){return e+(``+ ++we)}function F(e,t,n=1){t??(t=e,e=0);let r=e=>ete[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function Te(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var R=`\\0`;function z(e,t,n){if(!(e&&t&&n&&t.dummy===`edge`&&n.dummy===`edge`&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let r=!0;t.edgeObj.w===n.edgeObj.w&&(r=!1);let i=r?e[t.edgeObj.v]?.rank??NaN:e[t.edgeObj.w]?.rank??NaN,a=Object.entries(e).find(e=>e[1].edgeObj?.v===t.edgeObj.v&&e[1].edgeObj?.w===t.edgeObj.w&&e[1].rank===i),o=Object.entries(e).find(e=>e[1].edgeObj?.v===n.edgeObj.v&&e[1].edgeObj?.w===n.edgeObj.w&&e[1].rank===i);if(!a||!o)return 0;let s=a[1].order??NaN,c=o[1].order??NaN;return isNaN(s-c)?0:s-c}var Ee=class{constructor(){r(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return B(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&B(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,De)),n=n._prev;return`[`+e.join(`, `)+`]`}};function B(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function De(e,t){if(e!==`_next`&&e!==`_prev`)return t}var Oe=Ee,ke=()=>1;function Ae(e,t){if(e.nodeCount()<=1)return[];let n=Me(e,t||ke);return je(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function je(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)V(e,t,n,o);for(;o=i.dequeue();)V(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(V(e,t,n,o,!0)||[]);break}}}return r}function V(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,H(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,H(t,n,o)}),e.removeNode(r.v),o}function Me(e,t){let n=new D,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=Ne(i+r+3).map(()=>new Oe),o=r+1;return n.nodes().forEach(e=>{H(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function H(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function Ne(e){let t=[];for(let n=0;n{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,P(`rev`))});function n(e){return t=>e.edge(t).weight}}function Fe(e,t){let n=[],r={},i={};function a(t){Object.hasOwn(i,t)||(i[t]=!0,r[t]=!0,e.outEdges(t).forEach(e=>{Object.hasOwn(r,e.w)?n.push(e):a(e.w)}),delete r[t])}function o(a){var s;Object.hasOwn(i,a)||(i[a]=!0,r[a]=!0,(s=e.outEdges(a))==null||s.forEach(i=>{Object.hasOwn(r,i.w)||t.node(a)?.rank>t.node(i.w)?.rank&&Le(e,i.w,i)?n.push(i):o(i.w)}),delete r[a])}let s=a;return t&&typeof t.node==`function`&&(s=o),e.sources().forEach(s),e.nodes().forEach(s),n}function Ie(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Le(e,t,n){let r=/* @__PURE__ */ new Set;function i(t){if(e.sources().includes(t))return!0;r.add(t);for(let a of e.inEdges(t)??[])if((a.v!==n.v||a.w!==n.w)&&!r.has(a.v)&&i(a.v))return!0;return!1}return i(t)}function Re(e){e.graph().dummyChains=[],e.edges().forEach(t=>ze(e,t))}function ze(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d=0;for(++r;r{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function U(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=M(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function W(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Ve=He;function He(e){let t=new D({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;Ue(t,e){let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!W(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function We(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=W(t,r)),it.node(e).rank+=n)}var{preorder:Ke,postorder:qe}=_,Je=G;G.initLowLimValues=q,G.initCutValues=K,G.calcCutValue=Xe,G.leaveEdge=Qe,G.enterEdge=$e,G.exchangeEdges=et;function G(e){e=ge(e),U(e);let t=Ve(e);q(t),K(t,e);let n,r;for(;n=Qe(t);)r=$e(t,e,n),et(t,e,n,r)}function K(e,t){let n=qe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>Ye(e,t,n))}function Ye(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=Xe(e,t,n)}function Xe(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,nt(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function q(e,t){arguments.length<2&&(t=e.nodes()[0]),Ze(e,{},1,t)}function Ze(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=Ze(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function Qe(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function $e(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===rt(e,e.node(t.v),s)&&c!==rt(e,e.node(t.w),s)).reduce((e,n)=>W(t,n)!e.node(t).parent);if(!n)return;let r=Ke(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function nt(e,t,n){return e.hasEdge(t,n)}function rt(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var it=at;function at(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:ct(e);break;case`tight-tree`:st(e);break;case`longest-path`:ot(e);break;case`none`:break;default:ct(e)}}var ot=U;function st(e){U(e),Ve(e)}function ct(e){Je(e)}var lt=ut;function ut(e){let t=ft(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=dt(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRanko||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function ft(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(R).forEach(r),t}function pt(e){let t=O(e,`root`,{},`_root`),n=mt(e),r=Object.values(n),i=M(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=ht(e)+1;e.children(R).forEach(r=>{J(e,t,a,o,i,n,r)}),e.graph().nodeRankFactor=a}function J(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=A(e,`_bt`),l=A(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{J(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function mt(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(R).forEach(e=>n(e,1)),t}function ht(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function gt(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var _t=vt;function vt(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),i&&Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;tCt(e.node(t))),e.edges().forEach(t=>Ct(e.edge(t)))}function Ct(e){let t=e.width;e.width=e.height,e.height=t}function wt(e){e.nodes().forEach(t=>Y(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Y),Object.hasOwn(r,`y`)&&Y(r)})}function Y(e){e.y=-e.y}function Tt(e){e.nodes().forEach(t=>X(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(X),Object.hasOwn(r,`x`)&&X(r)})}function X(e){let t=e.x;e.x=e.y,e.y=t}function Et(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=F(M(Math.max,i)+1).map(()=>[]);function o(t){if(n[t])return;n[t]=!0;let r=e.node(t);a[r.rank].push(t);let i=e.successors(t);i&&[...i].sort((e,t)=>s(e,t)).forEach(o)}r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(o);function s(n,r){return z(t,e.node(n),e.node(r))}return a}function Dt(e,t){let n=0;for(let r=1;rt)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function kt(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function At(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),jt(Object.values(n).filter(e=>!e.indegree))}function jt(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&Mt(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>I(e,[`vs`,`i`,`barycenter`,`weight`]))}function Mt(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Nt(e,t,n,r,i){let a={},o=null,s=null,c=i;typeof t==`boolean`?(c=t,a={}):t&&(a=t,o=n??null,s=r??null);let l=Se(e,e=>Object.hasOwn(e,`barycenter`)),u=l.lhs,d=l.rhs.sort((e,t)=>t.i-e.i),f=[],p=0,m=0,h=0;u.sort(Ft(s,o,!!c));for(let[e,t]of Object.entries(a)){let n=u.findIndex(t=>t.vs[0]===e);u.splice(n+1,0,t)}h=Pt(f,d,h),u.forEach(e=>{h+=e.vs.length,f.push(e.vs),p+=e.barycenter*e.weight,m+=e.weight,h=Pt(f,d,h)});let g={vs:f.flat(1)};return m&&(g.barycenter=p/m,g.weight=m),g}function Pt(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Ft(e,t,n){return(r,i)=>{if(r.barycenteri.barycenter)return 1;if(e&&(typeof r.vs[0]==`string`||typeof i.vs[0]==`string`)){let n=z(t,e.node(r.vs[0]),e.node(i.vs[0]));if(n!==0)return n}return n?i.i-r.i:r.i-i.i}}function It(e,t,n,r,i){var a,o;let s=null,c=i;typeof r==`boolean`?(c=r,s=null):r!==void 0&&(s=r);let l=e.children(t),u=e.node(t),d=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};d&&(l=l.filter(e=>e!==d&&e!==f));let m=kt(e,l);m.forEach(t=>{if(e.children(t.v).length){let{result:r}=It(e,t.v,n,s,c);p[t.v]=r,Object.hasOwn(r,`barycenter`)&&Rt(t,r)}});let h=At(m,n);Lt(h,p);let g={},_=!1;for(let t=0;t{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function Rt(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function zt(e,t,n,r){r||=e.nodes();let i=Bt(e),a=new D({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function Bt(e){let t;for(;e.hasNode(t=P(`_root`)););return t}function Vt(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function Ht(e,t={},n=null){if(typeof t.customOrder==`function`){t.customOrder(e,Ht);return}let r=N(e),i=Ut(e,F(1,r+1),`inEdges`),a=Ut(e,F(r-1,-1,-1),`outEdges`),o=Et(e,n);if(Gt(e,o),t.disableOptimalOrderHeuristic)return;let s=1/0,c,l=t.constraints||[];for(let t=0,r=0;r<4;++t,++r){Wt(t%2?i:a,t%4>=2,l,n),o=k(e);let u=Dt(e,o);u{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return zt(e,t,n,r.get(t)||[])})}function Wt(e,t,n,r){let i=!0,a=new D;e.forEach(function(e){n.forEach(e=>a.setEdge(e.left,e.right));let o=e.graph().root,{result:s,usedBias:c}=It(e,o,a,r,i);t&&c&&(i=!i),s.vs.forEach((t,n)=>e.node(t).order=n),Vt(e,a,s.vs)})}function Gt(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function Kt(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=Jt(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.ordero)&&Yt(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function Jt(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function Yt(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function Xt(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function Zt(e,t,n,r,i){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(t=>{let c=-1,l=-1,u=!1,d=t,f=t.findIndex(t=>i?.includes(t)||sn(t,e,i));f>0&&(d=[t[f],...t.slice(0,f),...t.slice(f+1)],u=!0),d.forEach(t=>{let d=r(t);if(d&&d.length){i!=null&&i.includes(t)&&(d=d.filter(t=>sn(t,e,i)));let r=d.sort((e,t)=>{let n=s[e],r=s[t];return(n===void 0?0:n)-(r===void 0?0:r)}),f=(r.length-1)/2;for(let e=Math.floor(f),i=Math.ceil(f);e<=i;++e){let i=r[e];if(i===void 0)continue;let d=s[i];if(d!==void 0&&o[t]===t&&c{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function $t(e,t,n,r){let i=new D,a=e.graph(),o=an(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function en(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=on(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-M(Math.min,c);a!==`l`&&(l=i-M(Math.max,c)),l&&(e[o]=L(s,e=>e+l))})})}function nn(e,t=void 0){let n=e.ul;return n?L(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function rn(e,t){let n=k(e),r=Object.assign(Kt(e,n),qt(e,n)),i={},a;return[`u`,`d`].forEach(o=>{a=o===`u`?n:Object.values(n).reverse(),[`l`,`r`].forEach(n=>{n===`r`&&(a=a.map(e=>Object.values(e).reverse()));let s=Zt(e,a,r,t=>(o===`u`?e.predecessors(t):e.successors(t))||[],t),c=Qt(e,a,s.root,s.align,n===`r`);n===`r`&&(c=L(c,e=>-e)),i[o+n]=c})}),tn(i,en(e,i)),nn(i,e.graph().align)}function an(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),c}}function on(e,t){return e.node(t).width}function sn(e,t,n){if(!n)return!1;let r=t.node(e)?.edgeObj;if(!r||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(r?.v),a=n.indexOf(r?.w);return i!==-1&&a!==-1&&i===(a+1)%n.length||i===(a-1)%n.length}function cn(e,t){e=_e(e),ln(e),Object.entries(rn(e,t)).forEach(([t,n])=>e.node(t).x=n)}function ln(e){let t=k(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}var un=/* @__PURE__ */ new WeakMap;function dn(e,t={}){return pn(e,Ce,t),e}function fn(e,t,n){let r=t;for(;r!==void 0;){let t=e.parent(r);if(t===n)return r;r=t}}function pn(e,t,n){let r=e.nodes().filter(t=>e.children(t).length),i={};r.forEach(r=>{let a=e.node(r);if(a&&a.rankdir){let o=new D({multigraph:!0,compound:!0});o.setGraph({rankdir:a.rankdir});let s=e.children(r);s.forEach(t=>{let n={...e.node(t)};o.setNode(t,n);let i=e.parent(t);i&&i!==r&&s.includes(i)&&o.setParent(t,i)});let c=/* @__PURE__ */ new Set;e.edges().forEach(t=>{let n=fn(e,t.v,r),i=fn(e,t.w,r);if(n&&i&&n!==i){let r=`${n}\\0${i}`;c.has(r)||(c.add(r),o.setEdge(n,i,{...e.edge(t)}))}}),pn(o,t,n);let l=wn(o);mn(l,t,n,null),hn(o,l);let u=1/0,d=1/0,f=-1/0,p=-1/0;o.nodes().forEach(e=>{if(e===r)return;let t=o.node(e);t&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.width==`number`&&typeof t.height==`number`&&(u=Math.min(u,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),d=Math.min(d,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),(!isFinite(u)||!isFinite(d)||!isFinite(f)||!isFinite(p))&&(u=d=0,f=p=0);let m=f-u,h=p-d;i[r]={minX:u,minY:d,maxX:f,maxY:p,width:m,height:h,offsetX:u,offsetY:d},a._dagreClusterSubgraph=o}});let a=[],o=t=>{let n=[],r=(e.children(t)||[]).filter(e=>e!==t);for(;r.length>0;){let t=r.shift();n.push(t),(e.children(t)||[]).filter(e=>e!==t).forEach(e=>r.push(e))}return n},s=/* @__PURE__ */ new Map;r.forEach(t=>{let n=e.node(t);n&&n.rankdir&&i[t]&&s.set(t,(e.children(t)||[]).filter(e=>e!==t))});let c=new Set([...s.values()].flat()),l=/* @__PURE__ */ new Map;s.forEach((e,t)=>{c.has(t)||l.set(t,o(t))});let u=new Set([...l.values()].flat()),d=e=>{for(let[t,n]of l)if(n.includes(e))return t;return e},f=[];e.edges().forEach(t=>{(u.has(t.v)||u.has(t.w))&&f.push({edge:t,label:e.edge(t)})});let p=/* @__PURE__ */ new Map;u.forEach(t=>{let n=e.parent(t);p.set(t,typeof n==`string`?n:void 0)}),l.forEach((t,n)=>{let r=e.node(n),o=[];t.forEach(t=>{let n=e.node(t);n&&(o.push({id:t,node:n,parent:p.get(t)}),e.removeNode(t))});let s=f.filter(({edge:e})=>t.includes(e.v)||t.includes(e.w)),c=i[n];r&&(a.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:c,children:t,removedNodes:o,removedEdges:s}),r.width=c.width,r.height=c.height)});let m=/* @__PURE__ */ new Set;f.forEach(({edge:t,label:n})=>{let r=d(t.v),i=d(t.w);if(r!==i&&e.hasNode(r)&&e.hasNode(i)){let t=`${r}\\0${i}`;m.has(t)||(m.add(t),e.setEdge(r,i,{...n,width:0,height:0}))}});let h=wn(e),g=mn(h,t,n,un.get(e)??null);un.set(e,g),hn(e,h),m.forEach(t=>{let n=t.indexOf(`\\0`),r=t.slice(0,n),i=t.slice(n+1);e.hasEdge(r,i)&&e.removeEdge(r,i)}),a.forEach(({clusterId:t,subgraph:n,bounds:r,removedNodes:i,removedEdges:a})=>{let o=e.node(t),s=o?.x??0,c=o?.y??0,l=(r.minX+r.maxX)/2,u=(r.minY+r.maxY)/2;i.forEach(({id:t,node:n,parent:r})=>{e.setNode(t,n),r!==void 0&&e.setParent(t,r)}),a.forEach(({edge:t,label:n})=>{e.setEdge(t,n)}),n.nodes().forEach(r=>{if(r===t)return;let i=n.node(r),a=e.node(r);a&&i&&typeof i.x==`number`&&typeof i.y==`number`&&(a.x=s+(i.x-l),a.y=c+(i.y-u))}),delete o._dagreClusterSubgraph}),r.forEach(t=>{let n=e.node(t),r=i[t];if(n&&n.rankdir&&n._dagreClusterSubgraph&&r){let i=n._dagreClusterSubgraph,a=n.x??0,o=n.y??0,s=(r.minX+r.maxX)/2,c=(r.minY+r.maxY)/2;i.nodes().forEach(n=>{if(n===t)return;let r=i.node(n),l=e.node(n);if(l&&r&&typeof r.x==`number`&&typeof r.y==`number`){let e=r.x-s,t=r.y-c;l.x=a+e,l.y=o+t}}),delete n._dagreClusterSubgraph}})}function mn(e,t,n,r=null){var i,a;let o=n?.useDynamic!==!1,s=o&&(i=r?.graph)!=null?i:null,c=o&&(a=r?.rawNodes)!=null?a:null;t(` makeSpaceForEdgeLabels`,()=>Tn(e)),t(` removeSelfEdges`,()=>Pn(e)),t(` acyclic`,()=>Pe(e,s)),t(` nestingGraph.run`,()=>pt(e)),t(` rank`,()=>it(_e(e))),t(` injectEdgeLabelProxies`,()=>En(e)),t(` removeEmptyRanks`,()=>be(e)),t(` nestingGraph.cleanup`,()=>gt(e)),t(` normalizeRanks`,()=>ye(e)),t(` assignRankMinMax`,()=>Dn(e)),t(` removeEdgeLabelProxies`,()=>On(e)),t(` normalize.run`,()=>Re(e)),t(` parentDummyChains`,()=>lt(e)),t(` addBorderSegments`,()=>_t(e)),t(` order`,()=>Ht(e,n,c)),t(` insertSelfEdges`,()=>Fn(e)),t(` adjustCoordinateSystem`,()=>bt(e)),t(` position`,()=>cn(e,n.corePath)),t(` positionSelfEdges`,()=>In(e));let l=JSON.parse(JSON.stringify(e._nodes));return t(` removeBorderNodes`,()=>Nn(e)),t(` normalize.undo`,()=>Be(e)),t(` fixupEdgeLabelCoords`,()=>jn(e)),t(` undoCoordinateSystem`,()=>xt(e)),t(` translateGraph`,()=>kn(e)),t(` assignNodeIntersects`,()=>An(e)),t(` reversePoints`,()=>Mn(e)),t(` acyclic.undo`,()=>Ie(e)),{graph:e,rawNodes:l}}function hn(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var gn=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],_n={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},vn=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],yn=[`width`,`height`,`rank`],bn={width:0,height:0},xn=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Sn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Cn=[`labelpos`];function wn(e){let t=new D({multigraph:!0,compound:!0}),n=Q(e.graph());return t.setGraph(Object.assign({},_n,Z(n,gn),I(n,vn))),e.nodes().forEach(n=>{let r=Z(Q(e.node(n)),yn);Object.keys(bn).forEach(e=>{r[e]===void 0&&(r[e]=bn[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=Q(e.edge(n));t.setEdge(n,Object.assign({},Sn,Z(r,xn),I(r,Cn)))}),t}function Tn(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,(r.labelpos??`r`).toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function En(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);O(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function Dn(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function On(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function kn(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function An(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(ve(r,a)),n.points.push(ve(i,o))})}function jn(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function Mn(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Nn(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function Pn(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Fn(e){k(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);typeof i.rank!=`number`&&(i.rank=0),i.order=r+n,(i.selfEdges||[]).forEach(t=>{O(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,edgeLabel:t.label},`_se`),(!Array.isArray(t.label.points)||t.label.points.length!==7)&&(t.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function In(e){e.nodes().forEach(t=>{let n=e.node(t),r=e=>typeof e==`number`&&isFinite(e);if(n.dummy===`selfedge`){let i=n,a=e.node(i.e.v),o=r(a?.x)?a.x:0,s=r(a?.y)?a.y:0,c=r(a?.width)?a.width:0,l=r(a?.height)?a.height:0,u=r(n.x)?n.x:o,d=r(n.y)?n.y:s,f=c/2,p=l/2;i.edgeLabel.points=[{x:u+f,y:d-p},{x:u+f,y:d-p},{x:u,y:d},{x:u-f,y:d+p},{x:u-f,y:d+p},{x:u,y:d},{x:u,y:d}],i.edgeLabel.x=u,i.edgeLabel.y=d,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||e.label.points.length!==7){let t=r(n.x)?n.x:0,i=r(n.y)?n.y:0,a=r(n.width)?n.width:0,o=r(n.height)?n.height:0,s=a/2,c=o/2;e.label.points=[{x:t+s,y:i-c},{x:t+s,y:i-c},{x:t,y:i},{x:t-s,y:i+c},{x:t-s,y:i+c},{x:t,y:i},{x:t,y:i}]}})})}function Z(e,t){return L(I(e,t),Number)}function Q(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}\n/*! For license information please see dagre.esm.js.LEGAL.txt */\nlet Ln={healthy:`●`,degraded:`■`,unhealthy:`◆`,unknown:`○`};new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}),new Intl.NumberFormat(`en`,{maximumFractionDigits:2});let Rn={micro:11,small:12,body:14,title:16,section:22,page:32},zn={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`},$=(e,t)=>et),Bn=Math.ceil(Rn.micro*1.4+2)/20;function Vn(e,t){let n=Object.create(null);for(let r of e.nodes)n[r.id]={full:qn(r,!1,t),compact:qn(r,!0,t)};let r=Object.entries(n).sort(([e],[t])=>$(e,t)),i=JSON.stringify([r.map(([e])=>e),e.edges.map(e=>[e.id,e.caller,e.callee]).sort((e,t)=>$(e[0],t[0]))]);return{key:JSON.stringify([i,r]),topology:i,widths:n}}function Hn(e,t,n){let r=n??Vn(e,t.measureText).widths;return{...Un(e,r,!0),full:Un(e,r,!1)}}function Un(e,t,n){let r=[...e.nodes].sort((e,t)=>$(e.id,t.id)),a=[...e.edges].sort((e,t)=>$(e.id,t.id)),o=new Set(a.flatMap(e=>[e.caller,e.callee])),s=new Set(a.map(e=>e.callee)),c=new Set(a.map(e=>e.caller)),l=new i.Graph({directed:!0,multigraph:!0});l.setDefaultEdgeLabel(()=>({}));let u=n?20:44;l.setGraph({rankdir:`LR`,ranker:`network-simplex`,acyclicer:`greedy`,ranksep:n?16:32,nodesep:n?4:8,edgesep:n?2:8,marginx:0,marginy:0});let d=new Map(r.map(e=>[e.id,t[e.id][n?`compact`:`full`]]));for(let e of r)o.has(e.id)&&l.setNode(e.id,{width:d.get(e.id),height:u});for(let e of a)l.setEdge(e.caller,e.callee,{weight:1,minlen:1},e.id);l.nodeCount()&&dn(l);let f=r.filter(e=>o.has(e.id)).map(e=>({...e,x:l.node(e.id).x-d.get(e.id)/2,y:l.node(e.id).y-u/2,width:d.get(e.id),height:u,entry:c.has(e.id)&&!s.has(e.id),uncalled:!1})),p=a.map(e=>l.edge(e.caller,e.callee,e.id).points),m=r.filter(e=>!o.has(e.id)),h=m.reduce((e,t)=>e+d.get(t.id)+12,0)-(m.length?12:0),g=m.length?Wn(`No traced calls in this window`,`12px ${zn.display}`):0,_=Math.max(1,l.graph().width??0,h,g),v=(_-h)/2,y=Math.max(0,l.graph().height??0,...p.flat().map(e=>e.y),...f.map(e=>e.y+e.height)),b=y+(y?40:24);for(let e of m)f.push({...e,x:v,y:b,width:d.get(e.id),height:u,entry:!1,uncalled:!0}),v+=d.get(e.id)+12;let x=(_-(l.graph().width??0))/2;for(let e of f)e.uncalled||(e.x+=x);for(let e of p)for(let t of e)t.x+=x;let S=new Map(f.map(e=>[e.id,e]));for(let[e,t]of a.entries()){let n=S.get(t.caller),r=S.get(t.callee),i=p[e].slice(1,-1);if(!i.length||n===r)continue;let a=n.xArray.from(e).length*Number(t.match(/([\\d.]+)px/)?.[1]??11)*.6,Gn=e=>Array.from(e).length>24?Array.from(e).slice(0,24).join(``)+`…`:e,Kn=/* @__PURE__ */ new WeakMap;function qn(e,t,n){let r=n??Wn,i=Kn.get(r);i||(i=/* @__PURE__ */ new Map,Kn.set(r,i));let a=`600 ${t?Rn.micro/Bn:12}px ${zn.display}`,o=i.get(a);o===void 0&&(o=Math.max(...Object.values(Ln).map(e=>r(e,a))),i.set(a,o));let s=t?Math.ceil(16/Bn)+1:20;return Math.ceil(Math.max(t?0:168,r(Gn(e.id),a)+o+s))}self.onmessage=e=>{let{model:t,size:n,widths:r}=e.data;self.postMessage(Hn(t,n,r))}})();'],{type:`text/javascript;charset=utf-8`});function ZCe(e){let t;try{if(t=G$&&(self.URL||self.webkitURL).createObjectURL(G$),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(e){throw e}}var K$=Object.defineProperty,QCe=(e,t,n)=>t in e?K$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$Ce=(e,t)=>{for(var n in t)K$(e,n,{get:t[n],enumerable:!0})},ewe=(e,t,n)=>QCe(e,typeof t==`symbol`?t:t+``,n),q$={};$Ce(q$,{Graph:()=>l1,alg:()=>e1});var twe=Object.defineProperty,J$=(e,t)=>{for(var n in t)twe(e,n,{get:t[n],enumerable:!0})},Y$=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),(t?.length??0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=Q$(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=nwe(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,X$(this._preds[a],i),X$(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?$$(this._isDirected,e):Q$(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!=`object`||!r?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?$$(this._isDirected,e):Q$(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?$$(this._isDirected,e):Q$(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],Z$(this._preds[t],e),Z$(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function X$(e,t){e[t]?e[t]++:e[t]=1}function Z$(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Q$(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function nwe(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function $$(e,t){return Q$(e,t.v,t.w,t.name)}J$({},{read:()=>owe,write:()=>rwe});function rwe(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:iwe(e),edges:awe(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function iwe(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function awe(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function owe(e){let t=new Y$(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var e1={};J$(e1,{CycleException:()=>a1,bellmanFord:()=>t1,components:()=>lwe,dijkstra:()=>r1,dijkstraAll:()=>fwe,findCycles:()=>pwe,floydWarshall:()=>hwe,isAcyclic:()=>_we,postorder:()=>ywe,preorder:()=>bwe,prim:()=>xwe,shortestPaths:()=>Swe,tarjan:()=>i1,topsort:()=>o1});var swe=()=>1;function t1(e,t,n,r){return cwe(e,String(t),n||swe,r||function(t){return e.outEdges(t)??[]})}function cwe(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=i[e.v],r=i[e.w];if(!t||!r)return;let o=n(e);t.distance+oe.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw Error(`Queue underflow`);this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n>1,!(t[r].priority1;function r1(e,t,n,r){return dwe(e,String(t),n||uwe,r||function(t){return e.outEdges(t)??[]})}function dwe(e,t,n,r){let i={},a=new n1,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t];if(!r)return;let c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l0;){o=a.removeMin();let e=i[o];if(!e||e.distance===1/0)break;s=e,r(o).forEach(c)}return i}function fwe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=r1(e,i,t,n),r},{})}function i1(e){let t=0,n=[],r={},i=[];function a(o){var s;let c=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),(s=e.successors(o))==null||s.forEach(function(e){if(e in r){let t=r[e];t!=null&&t.onStack&&(c.lowlink=Math.min(c.lowlink,t.index))}else{a(e);let t=r[e];t&&(c.lowlink=Math.min(c.lowlink,t.lowlink))}}),c.lowlink===c.index){let e=[],t;do{t=n.pop();let i=r[t];i&&(i.onStack=!1),e.push(t)}while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function pwe(e){return i1(e).filter(function(t){let n=t[0];return n?t.length>1||t.length===1&&(e.outEdges(n,n)??[]).length>0:!1})}var mwe=()=>1;function hwe(e,t,n){return gwe(e,t||mwe,n||function(t){return e.outEdges(t)??[]})}function gwe(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){let a={};r[e]=a,a[e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(a[t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=t(n);a[r]={distance:i,predecessor:e}})}),i.forEach(function(e){let t=r[e];t&&i.forEach(function(n){let a=r[n];a&&i.forEach(function(n){let r=a[e],i=t[n],o=a[n];if(r&&i&&o){let e=r.distance+i.distance;e(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=s1(e,t,n===`post`,o,a,r,i)}),i}function s1(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=s1(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function c1(e,t,n){return vwe(e,t,n,function(e,t){return e.push(t),e},[])}function ywe(e,t){return c1(e,t,`post`)}function bwe(e,t){return c1(e,t,`pre`)}function xwe(e,t){var n;let r=new Y$,i={},a=new n1,o;function s(e){let n=e.v===o?e.w:e.v,r=a.priority(n);if(r!==void 0){let s=t(e);s0;){if(o=a.removeMin(),o in i)r.setEdge(o,i[o]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}(n=e.nodeEdges(o))==null||n.forEach(s)}return r}function Swe(e,t,n,r){return Cwe(e,t,n,r??(t=>e.outEdges(t)??[]))}function Cwe(e,t,n,r){if(n===void 0)return r1(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;ot.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function d1(e){let t=new l1({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function f1(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function p1(e){let t=y1(_1(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function Twe(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=g1(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function Ewe(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=g1(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function m1(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),u1(e,`border`,i,t)}function Dwe(e,t=h1){let n=[];for(let r=0;rh1?e(...Dwe(t).map(t=>e(...t))):e(...t)}function _1(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return g1(Math.max,t)}function Owe(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function kwe(e,t){return t()}var Awe=0;function v1(e){return e+(``+ ++Awe)}function y1(e,t,n=1){t??(t=e,e=0);let r=e=>ete[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function jwe(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var S1=`\0`;function C1(e,t,n){if(!(e&&t&&n&&t.dummy===`edge`&&n.dummy===`edge`&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let r=!0;t.edgeObj.w===n.edgeObj.w&&(r=!1);let i=r?e[t.edgeObj.v]?.rank??NaN:e[t.edgeObj.w]?.rank??NaN,a=Object.entries(e).find(e=>e[1].edgeObj?.v===t.edgeObj.v&&e[1].edgeObj?.w===t.edgeObj.w&&e[1].rank===i),o=Object.entries(e).find(e=>e[1].edgeObj?.v===n.edgeObj.v&&e[1].edgeObj?.w===n.edgeObj.w&&e[1].rank===i);if(!a||!o)return 0;let s=a[1].order??NaN,c=o[1].order??NaN;return isNaN(s-c)?0:s-c}var Mwe=class{constructor(){ewe(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return w1(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&w1(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Nwe)),n=n._prev;return`[`+e.join(`, `)+`]`}};function w1(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Nwe(e,t){if(e!==`_next`&&e!==`_prev`)return t}var Pwe=Mwe,Fwe=()=>1;function Iwe(e,t){if(e.nodeCount()<=1)return[];let n=Rwe(e,t||Fwe);return Lwe(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function Lwe(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)T1(e,t,n,o);for(;o=i.dequeue();)T1(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(T1(e,t,n,o,!0)||[]);break}}}return r}function T1(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,E1(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,E1(t,n,o)}),e.removeNode(r.v),o}function Rwe(e,t){let n=new l1,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=zwe(i+r+3).map(()=>new Pwe),o=r+1;return n.nodes().forEach(e=>{E1(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function E1(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function zwe(e){let t=[];for(let n=0;n{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,v1(`rev`))});function n(e){return t=>e.edge(t).weight}}function Vwe(e,t){let n=[],r={},i={};function a(t){Object.hasOwn(i,t)||(i[t]=!0,r[t]=!0,e.outEdges(t).forEach(e=>{Object.hasOwn(r,e.w)?n.push(e):a(e.w)}),delete r[t])}function o(a){var s;Object.hasOwn(i,a)||(i[a]=!0,r[a]=!0,(s=e.outEdges(a))==null||s.forEach(i=>{Object.hasOwn(r,i.w)||t.node(a)?.rank>t.node(i.w)?.rank&&Uwe(e,i.w,i)?n.push(i):o(i.w)}),delete r[a])}let s=a;return t&&typeof t.node==`function`&&(s=o),e.sources().forEach(s),e.nodes().forEach(s),n}function Hwe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Uwe(e,t,n){let r=new Set;function i(t){if(e.sources().includes(t))return!0;r.add(t);for(let a of e.inEdges(t)??[])if((a.v!==n.v||a.w!==n.w)&&!r.has(a.v)&&i(a.v))return!0;return!1}return i(t)}function Wwe(e){e.graph().dummyChains=[],e.edges().forEach(t=>Gwe(e,t))}function Gwe(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d=0;for(++r;r{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function D1(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=g1(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function O1(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var k1=qwe;function qwe(e){let t=new l1({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;Jwe(t,e){let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!O1(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function Ywe(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=O1(t,r)),it.node(e).rank+=n)}var{preorder:Zwe,postorder:Qwe}=e1,$we=A1;A1.initLowLimValues=N1,A1.initCutValues=j1,A1.calcCutValue=M1,A1.leaveEdge=F1,A1.enterEdge=I1,A1.exchangeEdges=L1;function A1(e){e=wwe(e),D1(e);let t=k1(e);N1(t),j1(t,e);let n,r;for(;n=F1(t);)r=I1(t,e,n),L1(t,e,n,r)}function j1(e,t){let n=Qwe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>eTe(e,t,n))}function eTe(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=M1(e,t,n)}function M1(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,nTe(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function N1(e,t){arguments.length<2&&(t=e.nodes()[0]),P1(e,{},1,t)}function P1(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=P1(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function F1(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function I1(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===R1(e,e.node(t.v),s)&&c!==R1(e,e.node(t.w),s)).reduce((e,n)=>O1(t,n)!e.node(t).parent);if(!n)return;let r=Zwe(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function nTe(e,t,n){return e.hasEdge(t,n)}function R1(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var rTe=iTe;function iTe(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:z1(e);break;case`tight-tree`:oTe(e);break;case`longest-path`:aTe(e);break;case`none`:break;default:z1(e)}}var aTe=D1;function oTe(e){D1(e),k1(e)}function z1(e){$we(e)}var sTe=cTe;function cTe(e){let t=uTe(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=lTe(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRanko||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function uTe(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(S1).forEach(r),t}function dTe(e){let t=u1(e,`root`,{},`_root`),n=fTe(e),r=Object.values(n),i=g1(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=pTe(e)+1;e.children(S1).forEach(r=>{B1(e,t,a,o,i,n,r)}),e.graph().nodeRankFactor=a}function B1(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=m1(e,`_bt`),l=m1(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{B1(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function fTe(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(S1).forEach(e=>n(e,1)),t}function pTe(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function mTe(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var hTe=gTe;function gTe(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),i&&Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;tU1(e.node(t))),e.edges().forEach(t=>U1(e.edge(t)))}function U1(e){let t=e.width;e.width=e.height,e.height=t}function yTe(e){e.nodes().forEach(t=>W1(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(W1),Object.hasOwn(r,`y`)&&W1(r)})}function W1(e){e.y=-e.y}function bTe(e){e.nodes().forEach(t=>G1(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(G1),Object.hasOwn(r,`x`)&&G1(r)})}function G1(e){let t=e.x;e.x=e.y,e.y=t}function xTe(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=y1(g1(Math.max,i)+1).map(()=>[]);function o(t){if(n[t])return;n[t]=!0;let r=e.node(t);a[r.rank].push(t);let i=e.successors(t);i&&[...i].sort((e,t)=>s(e,t)).forEach(o)}r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(o);function s(n,r){return C1(t,e.node(n),e.node(r))}return a}function STe(e,t){let n=0;for(let r=1;rt)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function wTe(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function TTe(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),ETe(Object.values(n).filter(e=>!e.indegree))}function ETe(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&DTe(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>b1(e,[`vs`,`i`,`barycenter`,`weight`]))}function DTe(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function OTe(e,t,n,r,i){let a={},o=null,s=null,c=i;typeof t==`boolean`?(c=t,a={}):t&&(a=t,o=n??null,s=r??null);let l=Owe(e,e=>Object.hasOwn(e,`barycenter`)),u=l.lhs,d=l.rhs.sort((e,t)=>t.i-e.i),f=[],p=0,m=0,h=0;u.sort(kTe(s,o,!!c));for(let[e,t]of Object.entries(a)){let n=u.findIndex(t=>t.vs[0]===e);u.splice(n+1,0,t)}h=K1(f,d,h),u.forEach(e=>{h+=e.vs.length,f.push(e.vs),p+=e.barycenter*e.weight,m+=e.weight,h=K1(f,d,h)});let g={vs:f.flat(1)};return m&&(g.barycenter=p/m,g.weight=m),g}function K1(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function kTe(e,t,n){return(r,i)=>{if(r.barycenteri.barycenter)return 1;if(e&&(typeof r.vs[0]==`string`||typeof i.vs[0]==`string`)){let n=C1(t,e.node(r.vs[0]),e.node(i.vs[0]));if(n!==0)return n}return n?i.i-r.i:r.i-i.i}}function q1(e,t,n,r,i){var a,o;let s=null,c=i;typeof r==`boolean`?(c=r,s=null):r!==void 0&&(s=r);let l=e.children(t),u=e.node(t),d=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};d&&(l=l.filter(e=>e!==d&&e!==f));let m=wTe(e,l);m.forEach(t=>{if(e.children(t.v).length){let{result:r}=q1(e,t.v,n,s,c);p[t.v]=r,Object.hasOwn(r,`barycenter`)&&jTe(t,r)}});let h=TTe(m,n);ATe(h,p);let g={},_=!1;for(let t=0;t{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function jTe(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function MTe(e,t,n,r){r||=e.nodes();let i=NTe(e),a=new l1({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function NTe(e){let t;for(;e.hasNode(t=v1(`_root`)););return t}function PTe(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function J1(e,t={},n=null){if(typeof t.customOrder==`function`){t.customOrder(e,J1);return}let r=_1(e),i=Y1(e,y1(1,r+1),`inEdges`),a=Y1(e,y1(r-1,-1,-1),`outEdges`),o=xTe(e,n);if(X1(e,o),t.disableOptimalOrderHeuristic)return;let s=1/0,c,l=t.constraints||[];for(let t=0,r=0;r<4;++t,++r){FTe(t%2?i:a,t%4>=2,l,n),o=p1(e);let u=STe(e,o);u{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return MTe(e,t,n,r.get(t)||[])})}function FTe(e,t,n,r){let i=!0,a=new l1;e.forEach(function(e){n.forEach(e=>a.setEdge(e.left,e.right));let o=e.graph().root,{result:s,usedBias:c}=q1(e,o,a,r,i);t&&c&&(i=!i),s.vs.forEach((t,n)=>e.node(t).order=n),PTe(e,a,s.vs)})}function X1(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function ITe(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=RTe(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.ordero)&&Z1(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function RTe(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function Z1(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function zTe(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function BTe(e,t,n,r,i){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(t=>{let c=-1,l=-1,u=!1,d=t,f=t.findIndex(t=>i?.includes(t)||Q1(t,e,i));f>0&&(d=[t[f],...t.slice(0,f),...t.slice(f+1)],u=!0),d.forEach(t=>{let d=r(t);if(d&&d.length){i!=null&&i.includes(t)&&(d=d.filter(t=>Q1(t,e,i)));let r=d.sort((e,t)=>{let n=s[e],r=s[t];return(n===void 0?0:n)-(r===void 0?0:r)}),f=(r.length-1)/2;for(let e=Math.floor(f),i=Math.ceil(f);e<=i;++e){let i=r[e];if(i===void 0)continue;let d=s[i];if(d!==void 0&&o[t]===t&&c{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function HTe(e,t,n,r){let i=new l1,a=e.graph(),o=qTe(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function UTe(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=JTe(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-g1(Math.min,c);a!==`l`&&(l=i-g1(Math.max,c)),l&&(e[o]=x1(s,e=>e+l))})})}function GTe(e,t=void 0){let n=e.ul;return n?x1(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function KTe(e,t){let n=p1(e),r=Object.assign(ITe(e,n),LTe(e,n)),i={},a;return[`u`,`d`].forEach(o=>{a=o===`u`?n:Object.values(n).reverse(),[`l`,`r`].forEach(n=>{n===`r`&&(a=a.map(e=>Object.values(e).reverse()));let s=BTe(e,a,r,t=>(o===`u`?e.predecessors(t):e.successors(t))||[],t),c=VTe(e,a,s.root,s.align,n===`r`);n===`r`&&(c=x1(c,e=>-e)),i[o+n]=c})}),WTe(i,UTe(e,i)),GTe(i,e.graph().align)}function qTe(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),c}}function JTe(e,t){return e.node(t).width}function Q1(e,t,n){if(!n)return!1;let r=t.node(e)?.edgeObj;if(!r||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(r?.v),a=n.indexOf(r?.w);return i!==-1&&a!==-1&&i===(a+1)%n.length||i===(a-1)%n.length}function YTe(e,t){e=d1(e),XTe(e),Object.entries(KTe(e,t)).forEach(([t,n])=>e.node(t).x=n)}function XTe(e){let t=p1(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}var $1=new WeakMap;function ZTe(e,t={}){return t0(e,kwe,t),e}function e0(e,t,n){let r=t;for(;r!==void 0;){let t=e.parent(r);if(t===n)return r;r=t}}function t0(e,t,n){let r=e.nodes().filter(t=>e.children(t).length),i={};r.forEach(r=>{let a=e.node(r);if(a&&a.rankdir){let o=new l1({multigraph:!0,compound:!0});o.setGraph({rankdir:a.rankdir});let s=e.children(r);s.forEach(t=>{let n={...e.node(t)};o.setNode(t,n);let i=e.parent(t);i&&i!==r&&s.includes(i)&&o.setParent(t,i)});let c=new Set;e.edges().forEach(t=>{let n=e0(e,t.v,r),i=e0(e,t.w,r);if(n&&i&&n!==i){let r=`${n}\0${i}`;c.has(r)||(c.add(r),o.setEdge(n,i,{...e.edge(t)}))}}),t0(o,t,n);let l=a0(o);n0(l,t,n,null),r0(o,l);let u=1/0,d=1/0,f=-1/0,p=-1/0;o.nodes().forEach(e=>{if(e===r)return;let t=o.node(e);t&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.width==`number`&&typeof t.height==`number`&&(u=Math.min(u,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),d=Math.min(d,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),(!isFinite(u)||!isFinite(d)||!isFinite(f)||!isFinite(p))&&(u=d=0,f=p=0);let m=f-u,h=p-d;i[r]={minX:u,minY:d,maxX:f,maxY:p,width:m,height:h,offsetX:u,offsetY:d},a._dagreClusterSubgraph=o}});let a=[],o=t=>{let n=[],r=(e.children(t)||[]).filter(e=>e!==t);for(;r.length>0;){let t=r.shift();n.push(t),(e.children(t)||[]).filter(e=>e!==t).forEach(e=>r.push(e))}return n},s=new Map;r.forEach(t=>{let n=e.node(t);n&&n.rankdir&&i[t]&&s.set(t,(e.children(t)||[]).filter(e=>e!==t))});let c=new Set([...s.values()].flat()),l=new Map;s.forEach((e,t)=>{c.has(t)||l.set(t,o(t))});let u=new Set([...l.values()].flat()),d=e=>{for(let[t,n]of l)if(n.includes(e))return t;return e},f=[];e.edges().forEach(t=>{(u.has(t.v)||u.has(t.w))&&f.push({edge:t,label:e.edge(t)})});let p=new Map;u.forEach(t=>{let n=e.parent(t);p.set(t,typeof n==`string`?n:void 0)}),l.forEach((t,n)=>{let r=e.node(n),o=[];t.forEach(t=>{let n=e.node(t);n&&(o.push({id:t,node:n,parent:p.get(t)}),e.removeNode(t))});let s=f.filter(({edge:e})=>t.includes(e.v)||t.includes(e.w)),c=i[n];r&&(a.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:c,children:t,removedNodes:o,removedEdges:s}),r.width=c.width,r.height=c.height)});let m=new Set;f.forEach(({edge:t,label:n})=>{let r=d(t.v),i=d(t.w);if(r!==i&&e.hasNode(r)&&e.hasNode(i)){let t=`${r}\0${i}`;m.has(t)||(m.add(t),e.setEdge(r,i,{...n,width:0,height:0}))}});let h=a0(e),g=n0(h,t,n,$1.get(e)??null);$1.set(e,g),r0(e,h),m.forEach(t=>{let n=t.indexOf(`\0`),r=t.slice(0,n),i=t.slice(n+1);e.hasEdge(r,i)&&e.removeEdge(r,i)}),a.forEach(({clusterId:t,subgraph:n,bounds:r,removedNodes:i,removedEdges:a})=>{let o=e.node(t),s=o?.x??0,c=o?.y??0,l=(r.minX+r.maxX)/2,u=(r.minY+r.maxY)/2;i.forEach(({id:t,node:n,parent:r})=>{e.setNode(t,n),r!==void 0&&e.setParent(t,r)}),a.forEach(({edge:t,label:n})=>{e.setEdge(t,n)}),n.nodes().forEach(r=>{if(r===t)return;let i=n.node(r),a=e.node(r);a&&i&&typeof i.x==`number`&&typeof i.y==`number`&&(a.x=s+(i.x-l),a.y=c+(i.y-u))}),delete o._dagreClusterSubgraph}),r.forEach(t=>{let n=e.node(t),r=i[t];if(n&&n.rankdir&&n._dagreClusterSubgraph&&r){let i=n._dagreClusterSubgraph,a=n.x??0,o=n.y??0,s=(r.minX+r.maxX)/2,c=(r.minY+r.maxY)/2;i.nodes().forEach(n=>{if(n===t)return;let r=i.node(n),l=e.node(n);if(l&&r&&typeof r.x==`number`&&typeof r.y==`number`){let e=r.x-s,t=r.y-c;l.x=a+e,l.y=o+t}}),delete n._dagreClusterSubgraph}})}function n0(e,t,n,r=null){var i,a;let o=n?.useDynamic!==!1,s=o&&(i=r?.graph)!=null?i:null,c=o&&(a=r?.rawNodes)!=null?a:null;t(` makeSpaceForEdgeLabels`,()=>aEe(e)),t(` removeSelfEdges`,()=>mEe(e)),t(` acyclic`,()=>Bwe(e,s)),t(` nestingGraph.run`,()=>dTe(e)),t(` rank`,()=>rTe(d1(e))),t(` injectEdgeLabelProxies`,()=>oEe(e)),t(` removeEmptyRanks`,()=>Ewe(e)),t(` nestingGraph.cleanup`,()=>mTe(e)),t(` normalizeRanks`,()=>Twe(e)),t(` assignRankMinMax`,()=>sEe(e)),t(` removeEdgeLabelProxies`,()=>cEe(e)),t(` normalize.run`,()=>Wwe(e)),t(` parentDummyChains`,()=>sTe(e)),t(` addBorderSegments`,()=>hTe(e)),t(` order`,()=>J1(e,n,c)),t(` insertSelfEdges`,()=>hEe(e)),t(` adjustCoordinateSystem`,()=>_Te(e)),t(` position`,()=>YTe(e,n.corePath)),t(` positionSelfEdges`,()=>gEe(e));let l=JSON.parse(JSON.stringify(e._nodes));return t(` removeBorderNodes`,()=>pEe(e)),t(` normalize.undo`,()=>Kwe(e)),t(` fixupEdgeLabelCoords`,()=>dEe(e)),t(` undoCoordinateSystem`,()=>vTe(e)),t(` translateGraph`,()=>lEe(e)),t(` assignNodeIntersects`,()=>uEe(e)),t(` reversePoints`,()=>fEe(e)),t(` acyclic.undo`,()=>Hwe(e)),{graph:e,rawNodes:l}}function r0(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var QTe=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],$Te={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},eEe=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],tEe=[`width`,`height`,`rank`],i0={width:0,height:0},nEe=[`minlen`,`weight`,`width`,`height`,`labeloffset`],rEe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},iEe=[`labelpos`];function a0(e){let t=new l1({multigraph:!0,compound:!0}),n=s0(e.graph());return t.setGraph(Object.assign({},$Te,o0(n,QTe),b1(n,eEe))),e.nodes().forEach(n=>{let r=o0(s0(e.node(n)),tEe);Object.keys(i0).forEach(e=>{r[e]===void 0&&(r[e]=i0[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=s0(e.edge(n));t.setEdge(n,Object.assign({},rEe,o0(r,nEe),b1(r,iEe)))}),t}function aEe(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,(r.labelpos??`r`).toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function oEe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);u1(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function sEe(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function cEe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function lEe(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function uEe(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(f1(r,a)),n.points.push(f1(i,o))})}function dEe(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function fEe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function pEe(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function mEe(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function hEe(e){p1(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);typeof i.rank!=`number`&&(i.rank=0),i.order=r+n,(i.selfEdges||[]).forEach(t=>{u1(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,edgeLabel:t.label},`_se`),(!Array.isArray(t.label.points)||t.label.points.length!==7)&&(t.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function gEe(e){e.nodes().forEach(t=>{let n=e.node(t),r=e=>typeof e==`number`&&isFinite(e);if(n.dummy===`selfedge`){let i=n,a=e.node(i.e.v),o=r(a?.x)?a.x:0,s=r(a?.y)?a.y:0,c=r(a?.width)?a.width:0,l=r(a?.height)?a.height:0,u=r(n.x)?n.x:o,d=r(n.y)?n.y:s,f=c/2,p=l/2;i.edgeLabel.points=[{x:u+f,y:d-p},{x:u+f,y:d-p},{x:u,y:d},{x:u-f,y:d+p},{x:u-f,y:d+p},{x:u,y:d},{x:u,y:d}],i.edgeLabel.x=u,i.edgeLabel.y=d,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||e.label.points.length!==7){let t=r(n.x)?n.x:0,i=r(n.y)?n.y:0,a=r(n.width)?n.width:0,o=r(n.height)?n.height:0,s=a/2,c=o/2;e.label.points=[{x:t+s,y:i-c},{x:t+s,y:i-c},{x:t,y:i},{x:t-s,y:i+c},{x:t-s,y:i+c},{x:t,y:i},{x:t,y:i}]}})})}function o0(e,t){return x1(b1(e,t),Number)}function s0(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}var c0=(e,t)=>et),l0=(e,t,n)=>Math.min(n,Math.max(t,e)),u0=20,_Ee=44,d0=1.4,f0=Math.ceil(zg.micro*d0+2)/u0;function p0(e,t){let n=Object.create(null);for(let r of e.nodes)n[r.id]={full:b0(r,!1,t),compact:b0(r,!0,t)};let r=Object.entries(n).sort(([e],[t])=>c0(e,t)),i=JSON.stringify([r.map(([e])=>e),e.edges.map(e=>[e.id,e.caller,e.callee]).sort((e,t)=>c0(e[0],t[0]))]);return{key:JSON.stringify([i,r]),topology:i,widths:n}}function vEe(e,t,n){let r=n??p0(e,t.measureText).widths;return{...m0(e,r,!0),full:m0(e,r,!1)}}function m0(e,t,n){let r=[...e.nodes].sort((e,t)=>c0(e.id,t.id)),i=[...e.edges].sort((e,t)=>c0(e.id,t.id)),a=new Set(i.flatMap(e=>[e.caller,e.callee])),o=new Set(i.map(e=>e.callee)),s=new Set(i.map(e=>e.caller)),c=new q$.Graph({directed:!0,multigraph:!0});c.setDefaultEdgeLabel(()=>({}));let l=n?u0:_Ee;c.setGraph({rankdir:`LR`,ranker:`network-simplex`,acyclicer:`greedy`,ranksep:n?16:32,nodesep:n?4:8,edgesep:n?2:8,marginx:0,marginy:0});let u=new Map(r.map(e=>[e.id,t[e.id][n?`compact`:`full`]]));for(let e of r)a.has(e.id)&&c.setNode(e.id,{width:u.get(e.id),height:l});for(let e of i)c.setEdge(e.caller,e.callee,{weight:1,minlen:1},e.id);c.nodeCount()&&ZTe(c);let d=r.filter(e=>a.has(e.id)).map(e=>({...e,x:c.node(e.id).x-u.get(e.id)/2,y:c.node(e.id).y-l/2,width:u.get(e.id),height:l,entry:s.has(e.id)&&!o.has(e.id),uncalled:!1})),f=i.map(e=>c.edge(e.caller,e.callee,e.id).points),p=r.filter(e=>!a.has(e.id)),m=p.reduce((e,t)=>e+u.get(t.id)+12,0)-(p.length?12:0),h=p.length?_0(`No traced calls in this window`,`12px ${Bg.display}`):0,g=Math.max(1,c.graph().width??0,m,h),_=(g-m)/2,v=Math.max(0,c.graph().height??0,...f.flat().map(e=>e.y),...d.map(e=>e.y+e.height)),y=v+(v?40:24);for(let e of p)d.push({...e,x:_,y,width:u.get(e.id),height:l,entry:!1,uncalled:!0}),_+=u.get(e.id)+12;let b=(g-(c.graph().width??0))/2;for(let e of d)e.uncalled||(e.x+=b);for(let e of f)for(let t of e)t.x+=b;let x=new Map(d.map(e=>[e.id,e]));for(let[e,t]of i.entries()){let n=x.get(t.caller),r=x.get(t.callee),i=f[e].slice(1,-1);if(!i.length||n===r)continue;let a=n.x{let r=e.nodes.filter(e=>e.uncalled);if(!r.length)return e;let i=Math.max(1,n.width-24)/t,a=[[]],o=0;for(let e of r)o&&o+12+e.width>i&&(a.push([]),o=0),a.at(-1).push(e),o+=(o?12:0)+e.width;let s=a.map(e=>e.reduce((e,t)=>e+t.width,0)+(e.length-1)*12),c=e.nodes.filter(e=>!e.uncalled),l=e.routes.flat(),u=Math.min(...c.map(e=>e.x),...l.map(e=>e.x)),d=c.length?Math.max(...c.map(e=>e.x+e.width),...l.map(e=>e.x))-u:0,f=Math.max(d,e.labelWidth,...s),p=c.length?(f-d)/2-u:0,m=c.map(e=>({...e,x:e.x+p}));return a.forEach((e,t)=>{let n=(f-s[t])/2;for(let i of e)m.push({...i,x:n,y:r[0].y+t*(i.height+12)}),n+=i.width+12}),{...e,nodes:m,routes:e.routes.map(e=>e.map(e=>({...e,x:e.x+p}))),width:f,height:Math.max(...m.map(e=>e.y+e.height))}},i=e=>{let t=e.routes.flat(),r=Math.min(0,...t.map(e=>e.x)),i=Math.min(0,...t.map(e=>e.y)),a=Math.max(e.width,...t.map(e=>e.x))-r,o=Math.max(e.height,...t.map(e=>e.y))-i,s=Math.max(0,...e.routes.flat().map(e=>e.y),...e.nodes.filter(e=>!e.uncalled).map(e=>e.y+e.height)),c=e.nodes.find(e=>e.uncalled)?.y,l=c===void 0?0:c-s,u=c===void 0?0:32;return{minX:r,minY:i,width:a,height:o,scale:Math.min(Math.max(1,n.width-24)/a,Math.max(1,n.height-24-u)/Math.max(1,o-l)),graphBottom:s,rowY:c,gap:l,lane:u}},a=r(e.full,1),o=i(a).scale<1,s=o?r(e,f0):a,{minX:c,minY:l,width:u,height:d,scale:f,graphBottom:p,rowY:m,gap:h,lane:g}=i(s),_=Math.max(o?f0:1,Math.min(f,1)),v=(d-h)*_+g,y=Math.max(n.width,u*_+24),b=Math.max(n.height,v+24),x=(y-u*_)/2,S=(b-v)/2,C=e=>({x:x+(e.x-c)*_,y:S+(e.y-l)*_+(m!==void 0&&e.y>=m?g-h*_:0)}),w=new Map(t.nodes.map(e=>[e.id,e])),T=s.nodes.map(e=>({...e,...w.get(e.id),...C(e),width:e.width*_,height:e.height*_})),E=[...t.edges].sort((e,t)=>c0(e.id,t.id)).map((e,t)=>{let n=s.routes[t].map(C),r=n.map((e,t)=>`${t?`L`:`M`}${e.x},${e.y}`).join(` `);return{...e,points:n,path:r}}),D=T.find(e=>e.entry)??T[0];return{nodes:T,edges:E,scale:_,compact:o,initialView:D?{x:l0(n.width/2-D.x-D.width/2,n.width-y,0),y:l0(n.height/2-D.y-D.height/2,n.height-b,0)}:{x:0,y:0},contentWidth:y,contentHeight:b,uncalledLabel:s.label?{x:(y-s.labelWidth)/2,y:S+(p-l)*_+8}:void 0}}var bEe=e=>`${py(`per_second`,e.request_rate)} · ${py(`percent`,e.error_rate)} err · ${py(`ms`,e.p95_ms)} p95`,h0=e=>{if(e===null||!Number.isFinite(e))return`—`;let t=l0(e,0,999e3);return t>0&&t<.01?`<0.01`:t>=1e3?`${Math.min(999,Math.round(t/1e3))}K`:String(Number(t.toFixed(t<1?2:+(t<10))))},g0=e=>e===null||!Number.isFinite(e)?`— err`:`${Number((e>0?l0(e,.1,100):0).toFixed(1))}% err`,xEe=e=>e===null?`—`:Number(e.toPrecision(2))>=1e3?`${h0(e/1e3)}s`:`${h0(e)}ms`,_0=(e,t)=>Array.from(e).length*Number(t.match(/([\d.]+)px/)?.[1]??11)*.6,v0=e=>Array.from(e).length>24?Array.from(e).slice(0,24).join(``)+`…`:e;function SEe(e,{width:t,scale:n,compact:r=!1,measureText:i}){let a=Math.max(12,zg.micro/n),o=zg.micro/n,s=i??_0,c=Math.max(0,t-12/n),l=s(I$[e.health]??`○`,`${a}px ${Bg.display}`),u=v0(e.id),d=e.error_rate!==null&&e.error_rate>0?g0(e.error_rate):`${h0(e.request_rate)}/s`,f=`${h0(e.request_rate)}/s · ${g0(e.error_rate)}`;return{name:u,metric:r?``:[`${f} · p95 ${xEe(e.p95_ms)}`,f,d].find(e=>s(e,`${o}px ${Bg.display}`)<=c)??``,nameSize:a,metricSize:o,nameWidth:Math.max(0,c-l-4/n)}}var y0=new WeakMap;function b0(e,t,n){let r=n??_0,i=y0.get(r);i||(i=new Map,y0.set(r,i));let a=`600 ${t?zg.micro/f0:12}px ${Bg.display}`,o=i.get(a);o===void 0&&(o=Math.max(...Object.values(I$).map(e=>r(e,a))),i.set(a,o));let s=t?Math.ceil(16/f0)+1:20;return Math.ceil(Math.max(t?0:168,r(v0(e.id),a)+o+s))}var CEe=(e,t,n)=>Math.min(n,Math.max(t,e)),x0={x:0,y:0,zoom:1};function wEe({panel:e,title:t=e.title,result:n,dark:r,height:i,onSelect:a,onPoint:o,onMapView:s}){let c=(0,A.useRef)(null),[l,u]=(0,A.useState)({width:500,height:Math.max(40,i-24)}),[d,f]=(0,A.useState)(!1),[p,m]=(0,A.useState)(0),h=(0,A.useMemo)(()=>{let e=document.createElement(`canvas`).getContext(`2d`);return e?(t,n)=>(e.font=n,e.measureText(t).width):void 0},[p]);(0,A.useEffect)(()=>{let e=document.fonts,t=()=>m(e=>e+1);return e?.addEventListener(`loadingdone`,t),()=>e?.removeEventListener(`loadingdone`,t)},[]);let[g,_]=(0,A.useState)(),[v,y]=(0,A.useState)(),[b,x]=(0,A.useState)(x0),S=(0,A.useRef)(null),C=(0,A.useRef)(!1),w=(0,A.useMemo)(()=>R$(n.frame,n),[n.frame,n.from_ms,n.to_ms]),T=(0,A.useMemo)(()=>p0(w,h),[w,h]),[E,D]=(0,A.useState)(),[O,k]=(0,A.useState)(),j=(0,A.useRef)({model:w,size:l,structure:T});j.current={model:w,size:l,structure:T},(0,A.useLayoutEffect)(()=>{if(!d)return;let{model:e,size:t,structure:n}=j.current;if(k(void 0),e.nodes.length<=60){D({key:n.key,layout:vEe(e,t,n.widths),model:e});return}let r;try{r=new ZCe}catch{k(`Service layout unavailable`);return}let i=!0;r.onmessage=t=>{i&&D({key:n.key,layout:t.data,model:e})},r.onerror=()=>{i&&k(`Service layout unavailable`)};try{r.postMessage({model:e,size:{width:t.width,height:t.height},widths:n.widths})}catch{i=!1,r.terminate(),k(`Service layout unavailable`);return}return()=>{i=!1,r.terminate()}},[T.key,d]);let M=(0,A.useMemo)(()=>E?yEe(E.layout,E.key===T.key?w:E.model,l):{nodes:[],edges:[],scale:1,compact:!0,contentWidth:l.width,contentHeight:l.height,uncalledLabel:void 0,initialView:{x:0,y:0}},[E,w,l,T.key]),N=Ry(r),P=Ng[r?4:7],F=(0,A.useId)().replaceAll(`:`,``),ee=g??v,I=Math.max(12,1/M.scale),te=Math.max(1e-9,...w.edges.map(e=>e.request_rate??e.calls)),L=Math.max(1,b.zoom),ne=(0,A.useMemo)(()=>{let e=M.edges.flatMap(e=>e.points),t=[...M.nodes.flatMap(e=>[e.x,e.x+e.width]),...e.map(e=>e.x)],n=[...M.nodes.flatMap(e=>[e.y,e.y+e.height]),...e.map(e=>e.y)];if(M.uncalledLabel){let e=h?.(`No traced calls in this window`,`${zg.micro}px ${Bg.display}`)??29*zg.micro*.6;t.push((M.contentWidth-e/L)/2,(M.contentWidth+e/L)/2),n.push(M.uncalledLabel.y,M.uncalledLabel.y+(zg.micro*d0+2)/L)}return{left:Math.min(...t),right:Math.max(...t),top:Math.min(...n),bottom:Math.max(...n)}},[M,h,L]),re=[ne.left*b.zoom+b.x<0&&`left`,ne.right*b.zoom+b.x>l.width&&`right`,ne.top*b.zoom+b.y<0&&`top`,ne.bottom*b.zoom+b.y>l.height&&`bottom`].filter(e=>!!e),ie=re.join(` `),ae=M.initialView.x,oe=M.initialView.y,se=(0,A.useCallback)(()=>x({x:ae,y:oe,zoom:1}),[ae,oe]),ce=b.zoom<1,le=M.contentWidth>l.width||M.contentHeight>l.height,ue=(0,A.useCallback)(()=>{if(ce||!le){se();return}let e=Math.min(l.width/M.contentWidth,l.height/M.contentHeight,1);x({x:(l.width-M.contentWidth*e)/2,y:(l.height-M.contentHeight*e)/2,zoom:e})},[ce,le,se,l.width,l.height,M.contentWidth,M.contentHeight]);(0,A.useLayoutEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=e.clientWidth||t.width,r=e.clientHeight||t.height;n>0&&r>0&&u(e=>e.width===n&&e.height===r?e:{width:n,height:r})};t(),f(!0);let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let de=(0,A.useRef)(void 0),fe=(0,A.useRef)(x0);(0,A.useLayoutEffect)(()=>{E&&(E.key!==de.current||b.zoom===1&&b.x===fe.current.x&&b.y===fe.current.y)&&se(),de.current=E?.key,fe.current={x:ae,y:oe,zoom:1}},[E,se]),(0,A.useEffect)(()=>(s?.({canFit:!!ie||b.zoom!==1||b.x!==ae||b.y!==oe,overview:ce,fit:ue}),()=>s?.({canFit:!1,overview:!1,fit:()=>void 0})),[s,b,ue,ae,oe,ie,ce]),(0,A.useEffect)(()=>{let e=c.current;if(!e)return;let t=t=>{if(!E||O||t.deltaY===0)return;t.preventDefault();let n=e.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top;x(e=>{let n=CEe(e.zoom*Math.exp(-t.deltaY*.002),1,I);if(n===1)return{x:ae,y:oe,zoom:1};let a=n/e.zoom;return{zoom:n,x:r-(r-e.x)*a,y:i-(i-e.y)*a}})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[I,!!E,O,ae,oe]);let R=t=>{if(C.current){C.current=!1;return}e.click&&a?a(t):o?.({dimensions:{service:t}})};return(0,z.jsxs)(`div`,{role:`region`,"aria-label":`${t}: service dependency graph; ${U$({...e,title:t},n)}`,style:{display:`flex`,flexDirection:`column`,flex:`1 1 auto`,minHeight:0,minWidth:0,width:`100%`},children:[(0,z.jsxs)(`div`,{ref:c,style:{position:`relative`,flex:`1 1 auto`,minHeight:0,overflow:`hidden`,touchAction:`none`,cursor:S.current?`grabbing`:`grab`},onMouseLeave:()=>_(void 0),onPointerDown:e=>{e.button===0&&(C.current=!1,S.current={x:e.clientX,y:e.clientY,initial:b,moved:!1})},onPointerMove:e=>{let t=S.current;if(!t)return;let n=e.clientX-t.x,r=e.clientY-t.y;Math.hypot(n,r)>3&&(t.moved=!0),t.moved&&(e.currentTarget.setPointerCapture?.(e.pointerId),x({...t.initial,x:t.initial.x+n,y:t.initial.y+r}))},onPointerUp:()=>{C.current=S.current?.moved??!1,S.current=null},onPointerCancel:()=>{S.current=null,C.current=!1},children:[(O||!E)&&(0,z.jsx)(Ed,{role:`status`,c:`dimmed`,children:O??`Laying out services…`}),(0,z.jsxs)(`div`,{style:{position:`relative`,width:M.contentWidth,height:M.contentHeight,transform:`translate(${b.x}px, ${b.y}px) scale(${b.zoom})`,transformOrigin:`0 0`},children:[(0,z.jsxs)(`svg`,{"aria-hidden":`true`,width:M.contentWidth,height:M.contentHeight,viewBox:`0 0 ${M.contentWidth} ${M.contentHeight}`,style:{position:`absolute`,inset:0},children:[(0,z.jsx)(`defs`,{children:[N.muted,N.status.warn,N.status.bad].map((e,t)=>(0,z.jsx)(`marker`,{id:`${F}-arrow-${t}`,viewBox:`0 0 6 6`,refX:5,refY:3,markerWidth:5,markerHeight:5,orient:`auto-start-reverse`,markerUnits:`userSpaceOnUse`,children:(0,z.jsx)(`path`,{d:`M0,0 L6,3 L0,6 Z`,fill:e})},e))}),(0,z.jsx)(`g`,{children:M.edges.map(e=>(0,z.jsx)(`path`,{d:e.path,fill:`none`,stroke:e.status?N.status[e.status]:N.muted,strokeLinejoin:`round`,strokeWidth:1+3*Math.log1p(e.request_rate??e.calls)/Math.log1p(te),opacity:ee&&e.caller!==ee&&e.callee!==ee?.25:1,markerEnd:`url(#${F}-arrow-${e.status===`bad`?2:+(e.status===`warn`)})`,style:{pointerEvents:`stroke`},children:(0,z.jsx)(`title`,{children:`${e.caller} → ${e.callee}\n${e.edge_type} · ${py(`per_second`,e.request_rate)} · ${py(`count`,e.calls)} calls\n${py(`percent`,e.error_rate)} errors · ${py(`ms`,e.average_ms)} average`})},e.id))})]}),(0,z.jsxs)(`div`,{style:{position:`absolute`,inset:0,pointerEvents:`none`},children:[M.uncalledLabel&&(0,z.jsx)(`span`,{style:{position:`absolute`,left:`50%`,top:M.uncalledLabel.y,transform:`translateX(-50%)`,color:N.muted,background:N.surface,fontSize:zg.micro/L,lineHeight:1.4,padding:`${1/L}px 0`,whiteSpace:`nowrap`},children:`No traced calls in this window`}),M.nodes.map(e=>{let t=e.health===`unhealthy`?N.status.bad:e.health===`degraded`?N.status.warn:e.health===`healthy`?N.status.ok:N.muted,n=SEe(e,{width:e.width/M.scale,scale:M.scale*L,compact:M.compact,measureText:h});return(0,z.jsxs)(`button`,{type:`button`,title:`${e.id} · ${e.health}\n${bEe(e)}`,onMouseEnter:()=>_(e.id),onMouseLeave:()=>_(void 0),onFocus:()=>y(e.id),onBlur:()=>y(void 0),onClick:()=>R(e.id),onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),C.current=!1,R(e.id))},style:{position:`absolute`,left:e.x,top:e.y,width:e.width,height:e.height,display:`flex`,flexDirection:`column`,justifyContent:`center`,gap:3/L,boxSizing:`border-box`,border:`${1/L}px solid ${e.health===`unhealthy`||e.health===`degraded`?t:N.border}`,borderRadius:6,padding:`0 ${5/L}px`,background:N.surface,color:N.text,textAlign:`left`,opacity:1,outline:v===e.id?`2px solid ${P}`:void 0,outlineOffset:-2,pointerEvents:`auto`,cursor:`pointer`,fontFamily:Bg.display},children:[(0,z.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4/L,width:`100%`,minWidth:0,fontSize:Math.max(zg.micro/L,12*M.scale),lineHeight:d0,whiteSpace:`nowrap`},children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,style:{color:t,flex:`none`},children:I$[e.health]??`○`}),(0,z.jsx)(`span`,{style:{flex:`none`,fontWeight:600,whiteSpace:`nowrap`},children:n.name}),(0,z.jsxs)(ec,{component:`span`,children:[`, `,e.health]})]}),!M.compact&&(0,z.jsx)(`span`,{style:{width:`100%`,fontSize:n.metricSize*M.scale,lineHeight:1.4,color:N.muted,whiteSpace:`nowrap`},children:n.metric})]},e.id)})]})]}),re.map(e=>(0,z.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,pointerEvents:`none`,zIndex:1,...e===`left`||e===`right`?{top:0,bottom:0,[e]:0,width:24}:{left:0,right:0,[e]:0,height:24},background:`linear-gradient(to ${e}, transparent, var(--mantine-color-body))`}},e))]}),(0,z.jsxs)(Ed,{c:`dimmed`,fz:12,mt:4,style:{flexShrink:0},children:[w.nodes.length,` services · `,w.edges.length,` `,w.edges.length===1?`route`:`routes`]})]})}function S0({label:e,value:t,color:n,hint:r,children:i}){let a=qt(`light`)===`dark`;return(0,z.jsxs)(rc,{withBorder:!0,radius:`md`,p:`sm`,bg:`var(--mantine-color-default)`,miw:0,h:`100%`,style:{display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,z.jsx)(Ed,{c:`dimmed`,size:`xs`,truncate:!0,children:e}),(0,z.jsx)(V,{fw:600,fz:`xl`,c:n,mt:2,lh:1.2,style:{color:n===`ok`||n===`warn`||n===`bad`?Ly(n,a):void 0},children:t}),r&&(0,z.jsx)(Ed,{c:`dimmed`,size:`xs`,mt:2,children:r}),i&&(0,z.jsx)(V,{mt:4,style:{display:`flex`,flexDirection:`column`,flex:`1 1 auto`,minHeight:0},children:i})]})}function C0({health:e}){let t=Fee(e),n=`var(--mantine-color-${$g(e)}-filled)`;return(0,z.jsx)(`svg`,{"aria-hidden":!0,width:12,height:12,viewBox:`0 0 12 12`,fill:e===`unknown`?`none`:n,stroke:n,strokeDasharray:Iee(e)===`dashed`?`2 2`:void 0,children:t===`diamond`?(0,z.jsx)(`polygon`,{points:`6,0 12,6 6,12 0,6`}):t===`roundRect`?(0,z.jsx)(`rect`,{x:1,y:1,width:10,height:10,rx:2}):(0,z.jsx)(`circle`,{cx:6,cy:6,r:5})})}function TEe({values:e,color:t}){let n=(0,A.useMemo)(()=>e.map(e=>Number.isFinite(e)?e:null),[e]),r=Math.max(0,...n.filter(e=>e!==null)),i=(0,A.useMemo)(()=>({animation:!1,grid:{left:0,right:0,top:2,bottom:2},xAxis:{type:`category`,show:!1,data:n.map((e,t)=>t)},yAxis:{type:`value`,show:!1,min:0},tooltip:{show:!1},series:[{type:`line`,data:n,showSymbol:!1,smooth:.3,lineStyle:{width:1.5,color:t},areaStyle:{opacity:.12,color:t}}]}),[n,t]);return(0,z.jsxs)(V,{"data-health-trend":!0,style:{display:`flex`,flexDirection:`column`,flex:`1 1 auto`,minHeight:0},children:[(0,z.jsx)(dX,{option:i,height:`100%`,label:`Error rate trend`}),r>0&&(0,z.jsxs)(Ed,{c:`dimmed`,size:`xs`,ta:`right`,mt:2,style:{flexShrink:0},children:[`peak `,r.toFixed(2),`%`]})]})}function EEe({result:e,dark:t,onSelect:n,onVariable:r,vars:i}){let a=e.frame?.health,o=e=>Number.isFinite(e)?e:0,s=a?{...a,total_spans:o(a.total_spans),service_count:o(a.service_count),counts:{healthy:o(a.counts.healthy),degraded:o(a.counts.degraded),unhealthy:o(a.counts.unhealthy)}}:void 0,c=!s||s.health===`unknown`||s.service_count===0||!Number.isFinite(s.error_rate),l=c?`unknown`:s.health,u=Math.max(s?.service_count??0,1),d=t_(t),f=n??(r&&i&&Object.hasOwn(i,`service`)?e=>r(`service`,e):void 0),p=c?[]:HCe(O_(e.frame));return(0,z.jsxs)(dh,{gap:`sm`,style:{flex:`1 1 auto`,minHeight:0},role:`region`,"aria-label":`Service health: ${c?`No data`:l}; ${s?.service_count??0} services`,children:[(0,z.jsxs)(sh,{cols:2,spacing:`sm`,"data-health-tiles":!0,style:{flex:`1 1 auto`,minHeight:0},children:[(0,z.jsx)(S0,{label:`Health`,value:(0,z.jsxs)(vl,{gap:6,children:[(0,z.jsx)(C0,{health:l}),c?`No data`:l.charAt(0).toUpperCase()+l.slice(1)]}),color:$g(l),hint:c?`No telemetry in this window`:`${r_.format(s.service_count)} services`,children:p.map(e=>{let t=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(C0,{health:e.health}),(0,z.jsx)(Ed,{component:`span`,fz:12,truncate:!0,style:{minWidth:0,textAlign:`left`},title:e.name,children:e.name}),(0,z.jsx)(Ed,{component:`span`,fz:12,ff:`monospace`,style:{textAlign:`right`},children:e.metric})]}),n={display:`grid`,gridTemplateColumns:`12px minmax(0, 1fr) 64px`,alignItems:`center`,textAlign:`left`,gap:6,minHeight:20,minWidth:0,width:`100%`};return f?(0,z.jsx)(kd,{component:`button`,type:`button`,"data-health-service":e.name,style:n,onClick:()=>f(e.name),children:t},e.name):(0,z.jsx)(V,{"data-health-service":e.name,style:n,children:t},e.name)})}),(0,z.jsx)(S0,{label:`Error rate`,value:c?`—`:`${s.error_rate.toFixed(2)}%`,color:!c&&s.error_rate>=1?`bad`:void 0,hint:c?void 0:`${r_.format(s.total_spans)} operations`,children:!c&&s.error_trend.length>1&&(0,z.jsx)(TEe,{values:s.error_trend,color:d.bad})})]}),!c&&(0,z.jsxs)(V,{style:{flexShrink:0},children:[(0,z.jsxs)(Im.Root,{size:`md`,role:`group`,"aria-label":`Service health distribution`,children:[(0,z.jsx)(Im.Section,{value:s.counts.healthy/u*100,color:`ok`,"aria-label":`Healthy`}),(0,z.jsx)(Im.Section,{value:s.counts.degraded/u*100,color:`warn`,"aria-label":`Degraded`}),(0,z.jsx)(Im.Section,{value:s.counts.unhealthy/u*100,color:`bad`,"aria-label":`Unhealthy`})]}),(0,z.jsx)(vl,{mt:6,gap:`md`,children:[`healthy`,`degraded`,`unhealthy`].map(e=>(0,z.jsxs)(vl,{gap:6,children:[(0,z.jsx)(C0,{health:e}),(0,z.jsx)(Ed,{c:`dimmed`,size:`xs`,children:`${s.counts[e]} ${e}`})]},e))})]})]})}function DEe(e){return(0,z.jsx)(Jy,{...e})}function OEe(e){return(0,z.jsx)(Jy,{...e})}function kEe(e){let{panel:t,title:n,result:r,dark:i,height:a,group:o,onSelect:s,onPoint:c,onVariable:l,onZoom:u}=e;if(t.viz===`text`)return(0,z.jsx)(zCe,{panel:t});if(!r?.frame)return null;let d={...e,result:r};switch(t.viz){case`stat`:return(0,z.jsx)(wre,{panel:t,result:r,dark:i,compare:e.compare,range:e.range});case`gauge`:return(0,z.jsx)(m_e,{panel:t,title:n,result:r,dark:i,height:a});case`timeseries`:return(0,z.jsx)(BCe,{...d});case`bar`:return(0,z.jsx)(p_e,{panel:t,title:n,result:r,dark:i,height:a,onSelect:s,onPoint:c});case`table`:return(0,z.jsx)(Gy,{traceLinks:e.traceLinks,panel:t,result:r,height:a,onSelect:s,onPoint:c,onVariable:l});case`heatmap`:return(0,z.jsx)(qCe,{...d});case`histogram`:return(0,z.jsx)(JCe,{...d});case`scatter`:return(0,z.jsx)(YCe,{...d});case`state_timeline`:return(0,z.jsx)(XCe,{...d});case`service_map`:return(0,z.jsx)(wEe,{...d});case`health`:return(0,z.jsx)(EEe,{...d});case`logs`:return(0,z.jsx)(Yy,{...d});case`log_patterns`:return(0,z.jsx)(DEe,{...d});case`traces`:return(0,z.jsx)(OEe,{...d})}}function AEe({onClick:e}){return(0,z.jsx)(Xm,{label:`Keyboard shortcuts (?)`,children:(0,z.jsx)(cl,{variant:`default`,size:`lg`,"aria-label":`Keyboard shortcuts (?)`,onClick:e,children:(0,z.jsx)(lte,{size:16})})})}var w0=(0,A.createContext)(void 0);function jEe({opened:e,onClose:t,title:n,children:r,returnFocusTo:i,shortcutScope:a,onShortcuts:o,escapeEnabled:s=!0}){let c=(0,A.useRef)(!1),[l,u]=(0,A.useState)(!1),d=(0,A.useRef)(i);return d.current=i,(0,A.useEffect)(()=>{let t=c.current&&!e;if(c.current=e,!t)return;let n=requestAnimationFrame(()=>d.current()?.focus());return()=>cancelAnimationFrame(n)},[e]),(0,z.jsxs)(cm.Root,{opened:e,onClose:t,fullScreen:!0,trapFocus:!0,returnFocus:!1,closeOnEscape:s&&!l,children:[(0,z.jsx)(cm.Overlay,{}),(0,z.jsxs)(cm.Content,{"aria-label":n,"data-panel-fullscreen":!0,"data-shortcut-scope":a,children:[(0,z.jsx)(cm.Header,{children:(0,z.jsxs)(vl,{ml:`auto`,gap:`xs`,children:[o&&(0,z.jsx)(AEe,{onClick:o}),(0,z.jsx)(cm.CloseButton,{"data-autofocus":!0,"aria-label":`Close panel view`})]})}),(0,z.jsx)(cm.Body,{children:(0,z.jsx)(w0.Provider,{value:u,children:r})})]})]})}function MEe({panel:e,title:t,result:n,loading:r,compare:i,range:a,height:o,group:s,editing:c,agentAvailable:l,annotations:u,vars:d,onSelect:f,onPoint:p,onVariable:m,onZoom:h,onRangePending:g,onZoomReset:_,zoomed:v,onView:y,onCopyLink:b,onExplain:x,onFix:S,onRetry:C,onRemove:w,onDuplicate:T,onEditSQL:E,staleAt:D,traceLinks:O,suspended:k=!1,menuRef:j}){let[M,N]=(0,A.useState)(),P=(0,A.useMemo)(()=>({setHint:N}),[]),F=qt(`light`)===`dark`,ee=(0,A.useRef)(null),[I,te]=(0,A.useState)(0);(0,A.useLayoutEffect)(()=>{let e=ee.current;if(!e)return;te(e.getBoundingClientRect().width);let t=new ResizeObserver(([e])=>{e&&te(e.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]);let L=I>0&&I<360,[ne,re]=(0,A.useState)(0);(0,A.useLayoutEffect)(()=>{let n=()=>{let n=document.createElement(`canvas`).getContext(`2d`),r=ee.current?.querySelector(`[data-panel-title]`),i=r?getComputedStyle(r).fontFamily:`inherit`;n&&(n.font=`600 15px ${i}`);let a=n?.measureText(t).width??Array.from(t).length*8.25;n&&(n.font=`400 11px ${i}`);let o=[`Chart`,`Data`,`Spec`].reduce((e,t)=>e+(n?.measureText(t).width??t.length*7)+12,4),s=(e.description?24:0)+18+(Zy(e)?.length??0)*7;re(a+o+22+32+20+s)};return n(),document.fonts?.addEventListener(`loadingdone`,n),()=>document.fonts?.removeEventListener(`loadingdone`,n)},[t,e.description,e.time]);let ie=L||I>0&&I{if(!D)return;oe(Date.now());let e=window.setInterval(()=>oe(Date.now()),3e4);return()=>window.clearInterval(e)},[D]);let[se,ce]=(0,A.useState)(`Chart`),[le,ue]=(0,A.useState)(),de=(0,A.useCallback)(e=>ue(e),[]),fe=e.click?`click to filter by ${e.click.set_variable}`:e.viz===`traces`||(e.drill===`traces`||n?.frame?.columns.some(e=>e.name===`trace_id`))&&e.viz===`table`?`click to open trace`:e.drill===`logs`?`click for matching logs`:e.drill===`traces`&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)?`click for exemplar traces`:void 0,R=Math.max(40,o-88),pe=[...new Set(k_(e,n?.frame).map(e=>e.value))],me=`${e.viz===`timeseries`?`time series`:e.viz.replaceAll(`_`,` `)}${pe.length?` · ${pe.join(` · `)}`:``}${fe?` · ${fe}`:``}`,he=[`timeseries`,`bar`,`heatmap`,`histogram`,`scatter`,`state_timeline`,`gauge`,`service_map`].includes(e.viz),ge=se!==`Chart`||!he||!n||n.status!==`ok`||n.frame?.truncated||n.previous?.truncated,_e=[`table`,`logs`,`traces`,`log_patterns`,`text`].includes(e.viz),ve=NEe(n?.frame?.note),ye=n?.frame&&n.error,be=!!n?.request_error?.length,xe=!!n?.error&&!be,Se=D?`Showing data from ${T0(D,ae)}`:void 0,Ce=ye?`${Se?`${Se}. `:``}${ye}`:void 0,we=Ce&&Ce.length>200?`${Ce.slice(0,199)}…`:Ce,Te=(0,A.useId)(),Ee=(0,A.useRef)(null),De=Be(j,Ee),[Oe,ke]=(0,A.useState)(!1),[Ae,je]=(0,A.useState)(!1),[Me,Ne]=(0,A.useState)(!1),Pe=!!ye&&!Me&&(Oe||Ae),Fe=(0,A.useContext)(w0);(0,A.useEffect)(()=>(Fe?.(Pe),()=>Fe?.(!1)),[Fe,Pe]);let Ie=(0,A.useCallback)(()=>{Ne(!0),ke(!1),je(!1)},[]);(0,A.useEffect)(()=>{if(!Pe)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),Ie())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[Pe,Ie]);let Le=[...new Set([D&&!ye?`Stale: last updated ${T0(D,ae)}`:void 0,n?.frame?.truncated||n?.previous?.truncated?`Truncated: showing limited data`:void 0,ve,n?.annotation_error,n?.annotation_scope?.limited?`Annotation service scope is limited.`:void 0].filter(e=>!!e))],Re=(0,A.useRef)(null),[ze,Ve]=(0,A.useState)(),He=(ze??R)<160;(0,A.useLayoutEffect)(()=>{let e=Re.current;if(!e)return;let t=new ResizeObserver(([e])=>{e&&Ve(e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]);let[Ue,We]=(0,A.useState)();return(0,A.useLayoutEffect)(()=>{let e=Re.current,t=ee.current;if(!e||!t)return;if(!ge||!(_e||se===`Data`)){We(void 0);return}let n=()=>{let n=Math.max(0,t.getBoundingClientRect().bottom-e.getBoundingClientRect().bottom),r=e.scrollHeight>e.clientHeight;We(e=>r?e?.bottom===n?e:{bottom:n}:void 0)};n();let r=new ResizeObserver(n);r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild);let i=new MutationObserver(n);return i.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{r.disconnect(),i.disconnect()}},[n,se,_e,ge,o,L,Le.length]),(0,z.jsxs)(rc,{ref:ee,withBorder:!0,radius:`md`,h:`100%`,p:0,style:{display:`flex`,flexDirection:`column`,minWidth:0,position:`relative`},"data-panel":e.id,"data-compact-views":ie,children:[(0,z.jsxs)(vl,{justify:`space-between`,wrap:`nowrap`,gap:`xs`,px:16,pt:12,className:c?`panel-drag`:void 0,style:{cursor:c?`grab`:void 0,flexShrink:0},children:[(0,z.jsxs)(vl,{gap:6,wrap:`nowrap`,miw:0,style:{flex:1},children:[(0,z.jsxs)(V,{miw:0,style:{flex:1},children:[(0,z.jsx)(Ed,{"data-panel-title":!0,fw:600,fz:15,truncate:!ie||void 0,style:ie?{overflowWrap:`anywhere`}:void 0,children:t}),(0,z.jsxs)(Ed,{"data-panel-subtitle":!0,title:M??me,fz:12,ff:Bg.display,c:`dimmed`,truncate:!L||void 0,style:{position:`relative`,...L?{overflowWrap:`anywhere`}:{}},children:[(0,z.jsx)(`span`,{"aria-hidden":M?!0:void 0,style:{visibility:M?`hidden`:void 0},children:me}),M&&(0,z.jsx)(z.Fragment,{children:(0,z.jsx)(`span`,{"data-chart-hint":!0,"aria-hidden":`true`,style:{position:`absolute`,inset:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:Bre(M)})})]}),e.options?.highlight&&(0,z.jsxs)(Ed,{component:`span`,"data-highlight-term":!0,title:`highlight: ${e.options.highlight}`,fz:11,c:`dimmed`,style:{display:`inline-block`,maxWidth:`100%`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,border:`1px solid var(--mantine-color-default-border)`,borderRadius:4,padding:`0 5px`},children:[`highlight: `,e.options.highlight]})]}),Zy(e)&&(0,z.jsx)(Ed,{size:`xs`,c:`dimmed`,role:`status`,children:Zy(e)}),e.description&&(0,z.jsx)(Xm,{label:e.description,multiline:!0,w:260,children:(0,z.jsx)(cl,{variant:`transparent`,color:`gray`,size:`xs`,"aria-label":`${t} description`,children:(0,z.jsx)(cte,{size:14})})}),r&&n&&(0,z.jsx)(el,{size:12,"aria-label":`Refreshing`})]}),(0,z.jsxs)(vl,{gap:4,wrap:`nowrap`,style:{flexShrink:0},children:[!ie&&e.viz!==`text`&&(0,z.jsx)(vl,{gap:0,wrap:`nowrap`,role:`group`,"aria-label":`${t} view`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:5,overflow:`hidden`},children:[`Chart`,`Data`,`Spec`].map(e=>(0,z.jsx)(`button`,{type:`button`,"data-panel-view":e,"aria-pressed":se===e,onClick:()=>ce(e),style:{border:0,borderLeft:e===`Chart`?void 0:`1px solid var(--mantine-color-default-border)`,padding:`2px 6px`,fontSize:11,fontFamily:`inherit`,cursor:`pointer`,background:se===e?`var(--mantine-color-default)`:`transparent`,color:se===e?`var(--mantine-primary-color-filled)`:`var(--mantine-color-dimmed)`,fontWeight:se===e?600:400,boxShadow:se===e?`inset 0 -2px var(--mantine-primary-color-filled)`:void 0},children:e},e))}),e.viz===`service_map`&&le?.canFit&&(0,z.jsx)(cl,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":le.overview?`Return to readable ${t} view`:`Show whole ${t} graph`,onClick:le.fit,children:(0,z.jsx)(c_,{size:16})}),v&&_&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)&&(0,z.jsx)(cl,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":`Reset ${t} zoom`,onClick:_,children:(0,z.jsx)(rte,{size:16})}),(0,z.jsxs)(Kp,{position:`bottom-end`,withinPortal:!0,onChange:e=>{e&&Ie()},children:[(0,z.jsx)(Kp.Target,{children:(0,z.jsx)(cl,{ref:De,variant:`subtle`,color:`gray`,size:`sm`,"aria-label":`${t} menu${we?`, refresh failed`:``}`,"aria-describedby":we?Te:void 0,onFocus:e=>{let t=e.currentTarget.matches(`:focus-visible`);ke(t),t&&Ne(!1)},onBlur:()=>ke(!1),onMouseEnter:()=>{je(!0),Ne(!1)},onMouseLeave:Ie,children:ye?(0,z.jsx)(x_,{size:18,weight:`fill`,color:`var(--mantine-color-warn-filled)`}):(0,z.jsx)(ste,{size:18,weight:`bold`})})}),(0,z.jsx)(Xm,{target:Ee,multiline:!0,maw:`min(360px, calc(100vw - 32px))`,label:(0,z.jsxs)(z.Fragment,{children:[Se&&(0,z.jsx)(Ed,{size:`xs`,children:Se}),(0,z.jsx)(Ed,{"data-refresh-error-message":!0,size:`xs`,title:ye||void 0,lineClamp:4,style:{overflowWrap:`anywhere`},children:ye})]}),opened:Pe}),(0,z.jsxs)(Kp.Dropdown,{children:[(ie||e.viz===`text`)&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Kp.RadioGroup,{value:se,onChange:ce,children:(0,z.jsx)(V,{role:`group`,"aria-label":`${t} view`,children:(e.viz===`text`?[`Chart`,`Spec`]:[`Chart`,`Data`,`Spec`]).map(t=>(0,z.jsx)(Kp.RadioItem,{value:t,"data-panel-view":t,closeMenuOnClick:!0,children:e.viz===`text`&&t===`Chart`?`Content`:t},t))})}),(0,z.jsx)(Kp.Divider,{})]}),ye&&be&&C&&(0,z.jsx)(Kp.Item,{disabled:r,onClick:()=>{Ie(),C()},children:`Retry`}),xe&&l&&S&&(0,z.jsx)(Kp.Item,{onClick:S,children:`Ask Fanout to fix it`}),y&&(0,z.jsx)(Kp.Item,{leftSection:(0,z.jsx)(c_,{size:14}),onClick:y,children:`View`}),l&&x&&(0,z.jsx)(Kp.Item,{leftSection:(0,z.jsx)(ote,{size:14}),onClick:x,children:`Explain in chat`}),b&&(0,z.jsx)(Kp.Item,{leftSection:(0,z.jsx)(p_,{size:14}),onClick:b,children:`Copy link`}),typeof e.sql==`string`&&E&&(0,z.jsx)(Kp.Item,{onClick:E,children:`Edit SQL`}),T&&(0,z.jsx)(Kp.Item,{leftSection:(0,z.jsx)(p_,{size:14}),onClick:T,children:`Duplicate`}),w&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Kp.Divider,{}),(0,z.jsx)(Kp.Item,{color:`bad`,leftSection:(0,z.jsx)(fte,{size:14}),onClick:w,children:`Remove panel`})]})]})]})]})]}),(0,z.jsx)(V,{ref:Re,"data-panel-body":!0,className:`dashboard-panel-padding`,tabIndex:se===`Chart`?void 0:0,style:{flex:`1 1 0px`,isolation:`isolate`,contain:_e||se===`Data`?`paint`:void 0,minHeight:0,minWidth:0,padding:`16px`,overflow:ge?`auto`:`hidden`,display:_e||se!==`Chart`?`block`:`flex`,flexDirection:`column`,backgroundColor:`inherit`,borderBottomLeftRadius:`inherit`,borderBottomRightRadius:`inherit`},children:k?(0,z.jsx)(Rf,{h:`100%`,children:(0,z.jsx)(Ed,{size:`sm`,c:`dimmed`,children:`Shown in full-screen`})}):se===`Data`?(0,z.jsx)(Ire,{panel:e,result:n}):se===`Spec`?(0,z.jsx)(Lre,{panel:e,dark:F}):!n&&e.viz!==`text`?(0,z.jsx)(Rf,{style:{minHeight:`100%`,flexShrink:0},children:(0,z.jsx)(el,{size:`sm`,"aria-label":`Loading panel`})}):n?.status===`error`?(0,z.jsxs)(V,{"data-panel-error":!0,style:{height:`100%`,maxHeight:`100%`,minHeight:0,minWidth:0,overflow:`hidden`,display:`flex`,flexDirection:He?`row`:`column`,alignItems:`center`,justifyContent:`center`,gap:He?6:4},children:[(0,z.jsx)(x_,{size:18,weight:`fill`,color:`var(--mantine-color-bad-filled)`,style:{flexShrink:0}}),!He&&(0,z.jsx)(Ed,{size:`sm`,fw:500,c:`bad`,style:{flexShrink:0},children:`This panel failed`}),(0,z.jsx)(Ed,{"data-panel-error-message":!0,title:n.error,size:`xs`,c:`dimmed`,ta:He?`left`:`center`,style:{minWidth:0,minHeight:0,overflow:`hidden`,...He?{flex:`1 1 0px`,whiteSpace:`nowrap`,textOverflow:`ellipsis`}:{overflowWrap:`anywhere`,flex:`0 1 auto`}},children:He?`This panel failed: ${n.error??`Request failed`}`:n.error}),be&&C&&(0,z.jsx)(Ff,{size:`compact-xs`,variant:`light`,style:{flexShrink:0},disabled:r,onClick:C,children:`Retry`}),xe&&l&&S&&(He?(0,z.jsx)(Xm,{label:`Ask Fanout to fix it`,events:{hover:!0,focus:!0,touch:!1},children:(0,z.jsx)(cl,{size:32,variant:`light`,"aria-label":`Ask Fanout to fix it`,style:{flex:`0 0 32px`},onClick:S,children:(0,z.jsx)(pte,{size:16})})}):(0,z.jsx)(Ff,{size:`compact-xs`,variant:`light`,style:{flexShrink:0},onClick:S,children:`Ask Fanout to fix it`}))]}):n?.status===`empty`?(0,z.jsx)(Rf,{style:{minHeight:`100%`,flexShrink:0},children:(0,z.jsxs)(dh,{align:`center`,gap:4,maw:420,children:[(0,z.jsx)(dte,{size:20,color:`var(--mantine-color-dimmed)`}),(0,z.jsx)(Ed,{size:`sm`,c:`dimmed`,ta:`center`,style:{overflowWrap:`anywhere`},children:n.diagnosis||`No data in this time range.`})]})}):(0,z.jsx)(eb.Provider,{value:P,children:(0,z.jsx)(kEe,{traceLinks:O,onMapView:de,compare:i,range:a,panel:e,title:t,result:n,dark:F,height:R,group:s,annotations:u,vars:d,onSelect:f,onPoint:p,onVariable:m,onZoom:h,onRangePending:g})})}),Le.length>0&&(0,z.jsx)(V,{"data-panel-notes":!0,className:`dashboard-panel-padding`,pb:12,style:{display:`flex`,flexDirection:`column`,gap:4,flexShrink:0,position:`relative`,zIndex:1,paddingTop:8,background:`var(--mantine-color-body)`,borderBottomLeftRadius:`inherit`,borderBottomRightRadius:`inherit`},children:Le.map(e=>(0,z.jsx)(Ed,{"data-panel-note":!0,fz:12,c:`dimmed`,role:`status`,title:e===ve?n?.frame?.note:void 0,style:{overflowWrap:`anywhere`},children:e},e))}),we&&(0,z.jsx)(`span`,{id:Te,hidden:!0,children:we}),Ue&&(0,z.jsx)(V,{"data-panel-scroll-fade":!0,"aria-hidden":`true`,style:{position:`absolute`,left:16,right:16,bottom:Ue.bottom,height:16,pointerEvents:`none`,zIndex:1,background:`linear-gradient(to bottom, transparent, var(--mantine-color-body))`}})]})}function NEe(e){let t=e?.match(/^Split at (\S+)( · .+)$/);if(!t)return e;let n=new Date(t[1]);return Number.isFinite(n.getTime())?`Split at ${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).format(n)}${t[2]}`:e}function T0(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r} minute${r===1?``:`s`} ago`;let i=Math.floor(r/60);return`${i} hour${i===1?``:`s`} ago`}function PEe({variables:e,vars:t,options:n,onChange:r}){return e.length===0?null:(0,z.jsx)(vl,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard variables`,children:e.map(e=>{let i=Xg(e,t,n[e.name]),a=[...e.include_all?[{value:Yg,label:`All`}]:[],...(n[e.name]??e.options?.map(e=>({value:e}))??[]).map(e=>({value:e.value,label:e.value}))],o=(0,z.jsxs)(Ed,{size:`xs`,c:`dimmed`,ff:`monospace`,children:[`$`,e.name]});return e.kind===`constant`?(0,z.jsx)(jh,{label:o,size:`xs`,value:e.value,readOnly:!0,w:160},e.name):e.kind===`text`?(0,z.jsx)(jh,{label:o,size:`xs`,w:200,defaultValue:typeof i==`string`?i:``,onBlur:t=>r(e.name,t.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}},`${e.name}:${JSON.stringify(i)}`):e.multi?(0,z.jsx)(Dm,{label:o,size:`xs`,w:260,searchable:!0,clearable:!0,data:a.filter(e=>e.value!==Yg),value:Array.isArray(i)?i:i&&i!==`$__all`?[i]:[],placeholder:e.include_all?`All`:`None`,onChange:t=>r(e.name,t.length?t:e.include_all?Yg:[])},e.name):(0,z.jsx)(Qm,{label:o,size:`xs`,w:220,searchable:!0,allowDeselect:!1,data:a,value:Array.isArray(i)?i[0]??null:i||null,onChange:t=>t!==null&&r(e.name,t)},e.name)})})}var FEe=e=>({panels:e.panels.map(({grid:e,...t})=>t),variables:e.variables,time:e.time,annotations:e.annotations});function IEe(e,t,n,r){return[`variables`,e,FEe(t),n,r]}function LEe(e,t,n,r,i,a=!1){let o=!!t.variables?.some(e=>e.kind===`query`),s=jg({queryKey:IEe(e,t,n,r),queryFn:async({signal:e})=>{let a=await i({dashboard:t,time:n,vars:r},e);return Object.fromEntries((t.variables??[]).map(e=>[e.name,a[e.name]??(e.kind===`custom`?e.options?.map(e=>({value:e})):void 0)??[]]))},enabled:o,retry:a,staleTime:6e4,placeholderData:e=>e}),c=s.isPlaceholderData?void 0:s.data,l=s.isError||(t.variables??[]).every(e=>e.kind!==`query`||r[e.name]!==void 0&&r[e.name]!==`$__all`&&(e.multi||!Array.isArray(r[e.name])||r[e.name].length>0)||!!e.default||e.include_all||c?.[e.name]!==void 0);return{...s,currentData:c,ready:l}}function REe(e,t){let n=JSON.stringify([e.range,e.from,e.to]),r=(0,A.useRef)({search:e,onSearch:t,scope:n}),i=(0,A.useRef)(``),a=(0,A.useRef)(void 0),[o,s]=(0,A.useState)(!1);r.current.scope!==n&&(i.current!==`${e.from}/${e.to}`&&(a.current=void 0,o&&s(!1)),i.current=``),r.current={search:e,onSearch:t,scope:n};let c=(0,A.useCallback)(()=>{i.current=``,a.current=void 0,s(!1)},[]),l=(0,A.useCallback)(()=>{if(!a.current)return;let e=a.current;c(),r.current.onSearch({...r.current.search,...e},!1)},[c]);return{zoom:(0,A.useCallback)((e,t)=>{let n=Fre(e,t);if(!n)return;let o=r.current,c=`${n.from}/${n.to}`;o.search.from===n.from&&o.search.to===n.to||i.current===c||(a.current??={range:o.search.range,from:o.search.from,to:o.search.to},s(!0),i.current=c,o.onSearch({...o.search,range:void 0,...n},!1))},[]),reset:c,resetZoom:l,zoomed:o}}function zEe(e,t,n,r){let i=e=>t?.frame?.columns.some((n,r)=>n.name===e&&t.frame.values[r]?.some(e=>typeof e==`string`&&e!==``));return{onSelect:e.click&&(e.viz===`service_map`||!(e.drill&&r))?t=>n(e.click.set_variable,t):void 0,onPoint:r&&(e.viz===`service_map`||e.click||e.drill||i(`trace_id`)||e.options?.columns?.some(e=>e.format===`trace_link`&&i(e.field)))?r:void 0}}function BEe(e,t,n,r){if(!t)return;let i=w_(e,t,n);if(!i)return;let a=Object.values(n.dimensions)[0],o=e.click?.set_variable;return{target:i,vars:o&&a!==void 0?{...r,[o]:a}:r}}var VEe=e=>e*40+(e-1)*12,HEe={s:3,m:6,l:10},UEe={stat:4},WEe=e=>Math.max(UEe[e.viz]??0,HEe[e.height??(e.viz===`service_map`?`l`:e.viz===`stat`?`s`:`m`)]),E0=e=>Math.max(e.viz===`service_map`?460:0,VEe(e.grid?.h??WEe(e)));function GEe(e){let t=(0,A.useRef)(void 0),n=t=>[...e.current?.querySelectorAll(`[data-panel]`)??[]].find(e=>e.dataset.panel===t&&!e.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`));return(0,A.useEffect)(()=>{t.current&&!n(t.current.panel)&&(t.current=void 0)}),{remember(n){t.current=void 0;let r=document.activeElement;if(!(r instanceof HTMLElement)||!e.current?.contains(r)||r.closest(`[data-panel]`)?.dataset.panel!==n)return;let i=r.getAttribute(`data-panel-view`),a=r.getAttribute(`aria-label`),o=r.hasAttribute(`data-chart-plot`)?`[data-chart-plot]`:i?`[data-panel-view=${JSON.stringify(i)}]`:a?`[aria-label=${JSON.stringify(a)}]`:void 0;t.current={element:r,panel:n,selector:o}},restore(e){let r=t.current;if(t.current=void 0,r&&(e===void 0||r.panel===e)&&n(r.panel))return r.element.isConnected&&!r.element.closest(`[hidden]`)?r.element:r.selector?n(r.panel)?.querySelector(r.selector)??void 0:void 0}}}var KEe=async()=>{throw Error(`Variable options unavailable`)};function qEe({fragment:e,dark:t,onQuery:n,drillClient:r,resolveVariables:i,height:a,hostDisplayMode:o,onDisplayMode:s}){let c=(0,A.useId)(),[l,u]=(0,A.useState)(e),[d,f]=(0,A.useState)(e.vars??{}),[p,m]=(0,A.useState)(e.dashboard.time),[h,g]=(0,A.useState)(!1),[_,v]=(0,A.useState)(),[y,b]=(0,A.useState)(),x=(0,A.useRef)(Date.now()),S=(0,A.useRef)(0),[C,w]=(0,A.useState)(),[T,E]=(0,A.useState)(),D=(0,A.useRef)(null),O=GEe(D),k=(0,A.useRef)(o);(0,A.useEffect)(()=>{k.current===`fullscreen`&&o===`inline`&&E(void 0),k.current=o},[o]);let j=async e=>{O.remember(e);try{(!s||await s(`fullscreen`))&&E(e)}catch{v(`Full-screen could not be opened. Please try again.`)}},M=()=>{E(void 0),s&&s(`inline`).catch(()=>v(`Full-screen could not be closed. Please try again.`))},N=(0,A.useRef)(new Map),P=(0,A.useRef)(void 0);T&&(P.current=T);let F=o===`fullscreen`&&!!T,ee=(0,A.useRef)(null),I=(0,A.useRef)(!1);(0,A.useEffect)(()=>{let e=I.current&&!F;if(I.current=F,F&&ee.current?.focus(),!e)return;let t=requestAnimationFrame(()=>(O.restore(P.current)??N.current.get(P.current??``))?.focus());return()=>cancelAnimationFrame(t)},[F]),(0,A.useEffect)(()=>{if(!F)return;let e=e=>{e.key===`Escape`&&!e.defaultPrevented&&!e.repeat&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!document.querySelector(`[role="dialog"]`)&&(e.preventDefault(),M())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[F,s]);let[te,L]=(0,A.useState)(()=>window.innerHeight);(0,A.useEffect)(()=>{let e=()=>L(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,A.useEffect)(()=>{S.current++,u(e),f(e.vars??{}),m(e.dashboard.time),w(void 0),E(void 0),g(!1),v(void 0),b(void 0),ce(),x.current=Date.now()},[e]),(0,A.useEffect)(()=>()=>{S.current++},[]);let ne=l.dashboard,re=LEe(c,ne,p,d,i??KEe),ie=(0,A.useMemo)(()=>Qg(ne.variables,d,re.currentData),[ne.variables,d,re.currentData]);async function ae(e=d,t=p){let r=++S.current;f(e),m(t),w(void 0),g(!0),v(void 0),b(x.current);let i=e===d?ie:Qg(ne.variables,e,re.currentData);try{let e=Jg(await n({dashboard:ne,time:t,vars:i}));if(S.current!==r)return;u(e),x.current=Date.now(),b(void 0)}catch(e){S.current===r&&v(e instanceof Error?e.message:`This view could not be refreshed.`)}finally{S.current===r&&g(!1)}}let oe=(e,t)=>{let n={...d};t===void 0?delete n[e]:n[e]=t,ae(n)},{zoom:se,reset:ce,resetZoom:le,zoomed:ue}=REe(p,e=>void ae(d,e)),de=(e,t)=>{let n=BEe(e,l.results.find(t=>t.id===e.id),t,d);n&&(n.vars!==d&&ae(n.vars),w(n.target))},fe=(e,t,n=!1)=>(0,z.jsx)(MEe,{panel:e,title:Zg(e.title,ie),result:l.results.find(t=>t.id===e.id),suspended:!n&&e.id===T,menuRef:n?void 0:t=>{t?N.current.set(e.id,t):N.current.delete(e.id)},group:c,height:t,loading:h,staleAt:y,editing:!1,agentAvailable:!1,vars:ie,range:e.time?.range??p.range,compare:p.compare===`previous_period`,onVariable:oe,...zEe(e,l.results.find(t=>t.id===e.id),oe,t=>de(e,t)),onZoom:se,zoomed:ue,onZoomReset:le,onView:o===void 0||s?()=>void j(e.id):void 0,traceLinks:`button`}),R=ne.panels.find(e=>e.id===T);return(0,z.jsxs)(dh,{ref:D,"data-dashboard-fragment":!0,gap:`md`,p:`md`,children:[(0,z.jsx)(V,{hidden:F,style:F?{display:`none`}:void 0,children:(0,z.jsxs)(dh,{gap:`md`,children:[ne.panels.length>1&&(0,z.jsx)(Ed,{"data-fragment-header":!0,fw:600,children:Pee(l)}),(0,z.jsx)(PEe,{variables:ne.variables??[],vars:d,options:re.data??{},onChange:oe}),re.error&&(0,z.jsx)(xd,{color:`bad`,children:`Variable options could not be loaded.`}),_&&(0,z.jsx)(xd,{color:`bad`,children:_}),ne.panels.map(e=>(0,z.jsx)(V,{h:a??E0(e),children:fe(e,a??E0(e))},e.id)),l.trace&&(0,z.jsx)(Xy,{result:l.trace,dark:t})]})}),F&&R&&(0,z.jsx)(V,{"data-fragment-fullscreen":!0,role:`region`,"aria-label":Zg(R.title,ie),tabIndex:-1,ref:ee,h:`calc(100vh - 32px)`,children:fe(R,Math.max(40,te-80),!0)}),o!==`fullscreen`&&(0,z.jsx)(jEe,{opened:!!R,onClose:M,title:R?Zg(R.title,ie):`Panel`,escapeEnabled:!C,returnFocusTo:()=>O.restore(P.current)??N.current.get(P.current??``),children:R&&(0,z.jsx)(V,{h:`calc(100vh - 120px)`,children:fe(R,Math.max(40,te-140),!0)})}),(0,z.jsx)(Pre,{client:r,spec:ne,time:p,vars:ie,target:C,onChange:w})]})}function JEe(e){async function t(t,n,r){if(r?.aborted)throw new DOMException(`Canceled`,`AbortError`);let i;try{i=await e.callServerTool({name:t,arguments:n},{signal:r})}catch(e){throw e instanceof Error&&e.name===`AbortError`?e:r?.aborted?new DOMException(`Canceled`,`AbortError`):Error(`This view could not be refreshed.`)}if(r?.aborted)throw new DOMException(`Canceled`,`AbortError`);if(i.isError||!i.structuredContent)throw Error(`This view could not be refreshed.`);return i.structuredContent}return{drill:{exemplars:(e,n)=>t(`list_panel_exemplars`,{...e},n),trace:async(e,n)=>{let r=Jg(await t(`inspect_trace`,{trace_id:e.trace_id,namespace:e.namespace,from:e.window_from,to:e.window_to,limit:200},n));if(!r.trace)throw Error(`Trace unavailable`);return r.trace}},query:async e=>{if(Object.hasOwn(e,`panels`))throw Error(`Panel subsets are unavailable in chat fragments`);let n=Jg(await t(`query_panel_fragment`,{...e}));return n.vars=e.vars,n},resolveVariables:async(e,n)=>{let r=await t(`resolve_panel_variables`,{...e},n);if(!r.options||typeof r.options!=`object`||Array.isArray(r.options)||Object.values(r.options).some(e=>!Array.isArray(e)||e.some(e=>!e||typeof e.value!=`string`)))throw Error(`Invalid variable options`);return r.options}}}var D0=Object.defineProperty,YEe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),XEe=(e,t)=>{let n={};for(var r in e)D0(n,r,{get:e[r],enumerable:!0});return t&&D0(n,Symbol.toStringTag,{value:`Module`}),n},ZEe=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function QEe(e){return typeof e==`string`&&ZEe.has(e.replace(/#$/,``))}function O0(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 k0(e,t=`|`){return e.map(e=>J0(e)).join(t)}function A0(e,t){return typeof t==`bigint`?t.toString():t}var $Ee=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function j0(e){return new $Ee(e)}function eDe(e){return e==null}function M0(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function tDe(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){let e=t._zod.def.shape[a];return r?r(e,a):e}):R0(e,a,r?r(n.value,a):n.value))}}function rDe(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?L0(e,n,()=>t[n]):R0(e,n,r.value))}}function B0(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function iDe(e){return JSON.stringify(e)}function aDe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var V0=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function H0(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var oDe=j0(()=>{if(y2.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function U0(e){if(H0(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return H0(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function W0(e){return U0(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var sDe=new Set([`string`,`number`,`symbol`]);function G0(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function K0(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function q0(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 J0(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function cDe(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Y0={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lDe={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function uDe(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`);let i={};return z0(i,e,X0(e,t)),K0(e,B0(n,{shape:i,checks:[]}))}function X0(e,t){let n=I0(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function dDe(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`);let i=new Set(X0(e,t)),a={};return z0(a,e,Reflect.ownKeys(I0(e)).filter(e=>!i.has(e))),K0(e,B0(n,{shape:a,checks:[]}))}function fDe(e,t){if(!U0(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=I0(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return K0(e,B0(e._zod.def,{shape:Z0(e,t)}))}function Z0(e,t){let n={};return z0(n,e,Reflect.ownKeys(I0(e))),rDe(n,t),n}function pDe(e,t){if(!U0(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return K0(e,B0(e._zod.def,{shape:Z0(e,t)}))}function mDe(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return z0(n,e,Reflect.ownKeys(I0(e))),z0(n,t,Reflect.ownKeys(I0(t))),K0(e,B0(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Q0(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(X0(t,n)):void 0,o={};return z0(o,t,Reflect.ownKeys(I0(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),K0(t,B0(t._zod.def,{shape:o,checks:[]}))}function hDe(e,t,n){let r=n?new Set(X0(t,n)):void 0,i={};return z0(i,t,Reflect.ownKeys(I0(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),K0(t,B0(t._zod.def,{shape:i}))}function $0(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function t2(e){return typeof e==`string`?e:e?.message}function n2(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function r2(e,t,n){var r;for(let i=t;ie;return t[wDe]=!0,t}var m2,EDe=Object.freeze({status:`aborted`}),h2={value:void 0,enumerable:!1},g2=`captureStackTrace`in Error?Error:null;function DDe(e){let t=g2;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return g2=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function J(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){h2.value=new a(r);try{Object.defineProperty(n,"_zod",h2)}finally{h2.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),yDe(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?DDe(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var _2=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},v2=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(m2=globalThis).__zod_globalConfig??(m2.__zod_globalConfig={});var y2=globalThis.__zod_globalConfig;function b2(e){return e&&Object.assign(y2,e),y2}function ODe(){let e=this._zod;return e.message??=JSON.stringify(e.def,A0,2),e.message}function kDe(e){this._zod.message=e}var ADe={get:ODe,set:kDe,enumerable:!0,configurable:!0},x2={value:void 0,enumerable:!1},S2=new WeakSet([Object.prototype,Error.prototype]),C2=(e,t)=>{e.name=`$ZodError`,x2.value=t,Object.defineProperty(e,"issues",x2),x2.value=void 0,Object.defineProperty(e,"message",ADe);let n=Object.getPrototypeOf(e);S2.has(n)||(S2.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},jDe=J(`$ZodError`,C2);J(`$ZodError`,C2,void 0,{Parent:Error});function MDe(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function NDe(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?MDe(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function PDe(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new _2;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>i2(e,o,b2())));throw V0(n,a?.callee??t),n}return s.value};return t},E2=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>i2(e,o,b2())));throw V0(n,a?.callee??t),n}return s.value};return t},D2=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 _2;return a.issues.length?O2(e,a.issues,i):{success:!0,data:a.value}};function O2(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>i2(e,n,b2()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var k2=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?O2(e,a.issues,i):{success:!0,data:a.value}},FDe=Symbol.for(`zod.compile.invalid`),IDe=Symbol.for(`zod.compile.fallback`),LDe=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==FDe)return!0;if(r.definite===!0&&n===void 0)return!1}return RDe(e,t,n)});function RDe(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[IDe]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new _2;return a.issues.length===0}var zDe=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},BDe=e=>{let t=T2(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,w2(n,a))};return n},VDe=e=>{let t=T2(e),n=(e,r,i,a)=>t(e,r,i,w2(n,a));return n},HDe=e=>{let t=E2(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,w2(n,a))};return n},UDe=e=>{let t=E2(e),n=async(e,r,i,a)=>await t(e,r,i,w2(n,a));return n},WDe=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return D2(e)(t,n,i)},GDe=e=>(t,n,r)=>D2(e)(t,n,r),KDe=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return k2(e)(t,n,i)},qDe=e=>async(t,n,r)=>k2(e)(t,n,r),JDe=/^[cC][0-9a-z]{6,}$/,YDe=/^[0-9a-z]+$/,XDe=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ZDe=/^[0-9a-vA-V]{20}$/,QDe=/^[A-Za-z0-9]{27}$/,$De=/^[a-zA-Z0-9_-]{21}$/;function eOe(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var tOe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,nOe=/^([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})$/,A2=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)$/,rOe=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,iOe=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function aOe(){return new RegExp(iOe,`u`)}var oOe=/^(?:(?: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])$/,sOe=/^(([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}|:))$/,cOe=/^((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])$/,lOe=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uOe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dOe=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,fOe=/^https?$/,pOe=/^\+[1-9]\d{6,14}$/,j2=`(?:(?:\\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])))`;function mOe(e){return RegExp(`^${e}$`)}var hOe=mOe(j2);function M2(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gOe(e){return RegExp(`^${M2(e)}$`)}function _Oe(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${M2({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${M2({precision:e.precision})}`:n;return RegExp(`^${j2}T(?:${r})$`)}var vOe=/^[\s\S]{0,}$/,yOe=/^-?\d+$/,N2=/^-?\d+(?:\.\d+)?$/,bOe=/^(?:true|false)$/i,xOe=/^null$/i,SOe=/^undefined$/i,COe=/^[^A-Z]*$/,wOe=/^[^a-z]*$/,P2=J(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),F2=e=>{let t=e.value;return!eDe(t)&&t.length!==void 0},I2={number:`number`,bigint:`bigint`,object:`date`},L2=J(`$ZodCheckLessThan`,(e,t)=>{P2.init(e,t);let n=I2[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{P2.init(e,t);let n=I2[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:I2[typeof r.value]??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})}}),TOe=J(`$ZodCheckMultipleOf`,(e,t)=>{P2.init(e,t),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`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):tDe(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})}}),EOe=J(`$ZodCheckNumberFormat`,(e,t)=>{P2.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Y0[t.format];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}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),DOe=J(`$ZodCheckMaxLength`,(e,t)=>{var n;P2.init(e,t),(n=e._zod.def).when??(n.when=F2),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?a2(r):i)<=t.maximum)return;let a=o2(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),OOe=J(`$ZodCheckMinLength`,(e,t)=>{var n;P2.init(e,t),(n=e._zod.def).when??(n.when=F2),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i=t.minimum)return;let a=o2(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),kOe=J(`$ZodCheckLengthEquals`,(e,t)=>{var n;P2.init(e,t),(n=e._zod.def).when??(n.when=F2),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?a2(r):i;if(a===t.length)return;let o=o2(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),z2=J(`$ZodCheckStringFormat`,(e,t)=>{var n,r;P2.init(e,t),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=()=>{})}),AOe=J(`$ZodCheckRegex`,(e,t)=>{z2.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})}}),jOe=J(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=COe,z2.init(e,t)}),MOe=J(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=wOe,z2.init(e,t)}),NOe=J(`$ZodCheckIncludes`,(e,t)=>{P2.init(e,t);let n=G0(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),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})}}),POe=J(`$ZodCheckStartsWith`,(e,t)=>{P2.init(e,t);let n=RegExp(`^${G0(t.prefix)}.*`);t.pattern??=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})}}),FOe=J(`$ZodCheckEndsWith`,(e,t)=>{P2.init(e,t);let n=RegExp(`.*${G0(t.suffix)}$`);t.pattern??=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})}}),IOe=J(`$ZodCheckOverwrite`,(e,t)=>{P2.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),LOe=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` `).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?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(` -`)}\n};`)(...Object.values(this.closed))}},LOe={major:4,minor:6,patch:5},B2=J(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=LOe;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=e2(t),a;for(let o of n){if(o._zod.def.when){if(hDe(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new _2;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(r2(t.issues,n,e),i||=e2(t,n))});else{if(t.issues.length===n)continue;r2(t.issues,n,e),i||=e2(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(e2(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new _2;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new _2;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return l2(this,`~standard`,H2(this))},set"~standard"(e){c2(this,`~standard`,e)}}),V2=(e,t)=>e.issues.length?{issues:e.issues.map(e=>i2(e,t,b2()))}:{value:e.value};async function ROe(e,t){let n={async:!0};return V2(await e._zod.run({value:t,issues:[]},n),n)}function H2(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return V2(r,n)}catch{}return ROe(e,t)},vendor:`zod`,version:1}}var U2=J(`$ZodString`,(e,t)=>{B2.init(e,t),e._zod.pattern=t.pattern??_Oe,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}}),W2=J(`$ZodStringFormat`,(e,t)=>{z2.init(e,t),U2.init(e,t)}),zOe=J(`$ZodGUID`,(e,t)=>{t.pattern??=tOe,W2.init(e,t)}),BOe=J(`$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??=A2(e)}else t.pattern??=A2();W2.init(e,t)}),VOe=J(`$ZodEmail`,(e,t)=>{t.pattern??=nOe,W2.init(e,t)});function G2(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function HOe(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?G2(e)||2:UOe(e,t)}function UOe(e,t){if(!t.normalize&&t.protocol?.source===dOe.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var WOe=/[\t\n\r]/g;function K2(e){return e.replace(WOe,``)}function GOe(e,t){return t.lastIndex=0,t.test(e.hostname)}function KOe(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var qOe=J(`$ZodURL`,(e,t)=>{W2.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=HOe(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=K2(r);return}t.hostname&&!GOe(i,t.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&&!KOe(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:K2(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),JOe=J(`$ZodEmoji`,(e,t)=>{t.pattern??=iOe(),W2.init(e,t)}),YOe=J(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?QDe:$De(t.length),W2.init(e,t)}),XOe=J(`$ZodCUID`,(e,t)=>{t.pattern??=qDe,W2.init(e,t)}),ZOe=J(`$ZodCUID2`,(e,t)=>{t.pattern??=JDe,W2.init(e,t)}),QOe=J(`$ZodULID`,(e,t)=>{t.pattern??=YDe,W2.init(e,t)}),$Oe=J(`$ZodXID`,(e,t)=>{t.pattern??=XDe,W2.init(e,t)}),eke=J(`$ZodKSUID`,(e,t)=>{t.pattern??=ZDe,W2.init(e,t)}),tke=J(`$ZodISODateTime`,(e,t)=>{t.pattern??=gOe(t),W2.init(e,t)}),nke=J(`$ZodISODate`,(e,t)=>{t.pattern??=mOe,W2.init(e,t)}),rke=J(`$ZodISOTime`,(e,t)=>{t.pattern??=hOe(t),W2.init(e,t)}),ike=J(`$ZodISODuration`,(e,t)=>{t.pattern??=eOe,W2.init(e,t)}),ake=J(`$ZodIPv4`,(e,t)=>{t.pattern??=aOe,W2.init(e,t)}),oke=/^[0-9a-fA-F:.]+$/;function q2(e){return oke.test(e)?G2(`http://[${e}]`):!1}var ske=J(`$ZodIPv6`,(e,t)=>{t.pattern??=oOe,W2.init(e,t),e._zod.check=n=>{q2(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),cke=J(`$ZodCIDRv4`,(e,t)=>{t.pattern??=sOe,W2.init(e,t)});function lke(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:q2(n)}var uke=J(`$ZodCIDRv6`,(e,t)=>{t.pattern??=cOe,W2.init(e,t),e._zod.check=n=>{lke(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function J2(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Y2=/^[0-9a-zA-Z+/]*={0,2}$/,dke=J(`$ZodBase64`,(e,t)=>{t.pattern??=Y2,W2.init(e,t),e._zod.check=n=>{J2(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),X2=/^[A-Za-z0-9_-]*$/;function fke(e){if(!X2.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return J2(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var pke=J(`$ZodBase64URL`,(e,t)=>{t.pattern??=X2,W2.init(e,t),e._zod.check=n=>{fke(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),mke=J(`$ZodE164`,(e,t)=>{t.pattern??=fOe,W2.init(e,t)});function hke(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 gke=J(`$ZodJWT`,(e,t)=>{W2.init(e,t),e._zod.check=n=>{hke(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Z2=J(`$ZodNumber`,(e,t)=>{B2.init(e,t),e._zod.pattern=N2,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:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),_ke=J(`$ZodNumberFormat`,(e,t)=>{TOe.init(e,t),Z2.init(e,t)}),vke=J(`$ZodBoolean`,(e,t)=>{B2.init(e,t),e._zod.pattern=yOe,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}}),yke=J(`$ZodUndefined`,(e,t)=>{B2.init(e,t),e._zod.pattern=xOe,e._zod.values=new Set([void 0]),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}}),bke=J(`$ZodNull`,(e,t)=>{B2.init(e,t),e._zod.pattern=bOe,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}}),xke=J(`$ZodAny`,(e,t)=>{B2.init(e,t),e._zod.parse=e=>e}),Ske=J(`$ZodUnknown`,(e,t)=>{B2.init(e,t),e._zod.parse=e=>e}),Cke=J(`$ZodNever`,(e,t)=>{B2.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Q2(e,t,n){e.issues.length&&t.issues.push(...t2(n,e.issues)),t.value[n]=e.value}var wke=J(`$ZodArray`,(e,t)=>{B2.init(e,t);let n=y2.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;eQ2(t,r,e)));else if(Q2(c,r,e),s&&c.issues.length!==0&&e2(c))break}return o.length?Promise.all(o).then(()=>r):r}});function $2(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...t2(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Tke=[];function e4(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Tke,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=sDe(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function t4(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(e2(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>$2(e,n,i,t,d,f))):$2(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Eke=J(`$ZodObject`,(e,t)=>{B2.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=M0(()=>e4(t));p2(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||F0(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=U0,o=t.catchall,s,c=y2.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(e2(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>$2(n,t,e,r,a,o))):$2(s,t,e,r,a,o)}return o?t4(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Dke=J(`$ZodObjectJIT`,(e,t)=>{Eke.init(e,t);let n=e._zod.parse,r=M0(()=>e4(t)),i=y2.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new IOe([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>` +`)}\n};`)(...Object.values(this.closed))}},ROe={major:4,minor:6,patch:6},B2=J(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ROe;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=$0(t),a;for(let o of n){if(o._zod.def.when){if(gDe(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new _2;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(r2(t.issues,n,e),i||=$0(t,n))});else{if(t.issues.length===n)continue;r2(t.issues,n,e),i||=$0(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if($0(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new _2;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new _2;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return l2(this,`~standard`,H2(this))},set"~standard"(e){c2(this,`~standard`,e)}}),V2=(e,t)=>e.issues.length?{issues:e.issues.map(e=>i2(e,t,b2()))}:{value:e.value};async function zOe(e,t){let n={async:!0};return V2(await e._zod.run({value:t,issues:[]},n),n)}function H2(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return V2(r,n)}catch{}return zOe(e,t)},vendor:`zod`,version:1}}var U2=J(`$ZodString`,(e,t)=>{B2.init(e,t),e._zod.pattern=t.pattern??vOe,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}}),W2=J(`$ZodStringFormat`,(e,t)=>{z2.init(e,t),U2.init(e,t)}),BOe=J(`$ZodGUID`,(e,t)=>{t.pattern??=nOe,W2.init(e,t)}),VOe=J(`$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??=A2(e)}else t.pattern??=A2();W2.init(e,t)}),HOe=J(`$ZodEmail`,(e,t)=>{t.pattern??=rOe,W2.init(e,t)});function G2(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function UOe(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?G2(e)||2:WOe(e,t)}function WOe(e,t){if(!t.normalize&&t.protocol?.source===fOe.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var GOe=/[\t\n\r]/g;function K2(e){return e.replace(GOe,``)}function KOe(e,t){return t.lastIndex=0,t.test(e.hostname)}function qOe(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var JOe=J(`$ZodURL`,(e,t)=>{W2.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=UOe(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=K2(r);return}t.hostname&&!KOe(i,t.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&&!qOe(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:K2(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),YOe=J(`$ZodEmoji`,(e,t)=>{t.pattern??=aOe(),W2.init(e,t)}),XOe=J(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?$De:eOe(t.length),W2.init(e,t)}),ZOe=J(`$ZodCUID`,(e,t)=>{t.pattern??=JDe,W2.init(e,t)}),QOe=J(`$ZodCUID2`,(e,t)=>{t.pattern??=YDe,W2.init(e,t)}),$Oe=J(`$ZodULID`,(e,t)=>{t.pattern??=XDe,W2.init(e,t)}),eke=J(`$ZodXID`,(e,t)=>{t.pattern??=ZDe,W2.init(e,t)}),tke=J(`$ZodKSUID`,(e,t)=>{t.pattern??=QDe,W2.init(e,t)}),nke=J(`$ZodISODateTime`,(e,t)=>{t.pattern??=_Oe(t),W2.init(e,t)}),rke=J(`$ZodISODate`,(e,t)=>{t.pattern??=hOe,W2.init(e,t)}),ike=J(`$ZodISOTime`,(e,t)=>{t.pattern??=gOe(t),W2.init(e,t)}),ake=J(`$ZodISODuration`,(e,t)=>{t.pattern??=tOe,W2.init(e,t)}),oke=J(`$ZodIPv4`,(e,t)=>{t.pattern??=oOe,W2.init(e,t)}),ske=/^[0-9a-fA-F:.]+$/;function q2(e){return ske.test(e)?G2(`http://[${e}]`):!1}var cke=J(`$ZodIPv6`,(e,t)=>{t.pattern??=sOe,W2.init(e,t),e._zod.check=n=>{q2(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),lke=J(`$ZodCIDRv4`,(e,t)=>{t.pattern??=cOe,W2.init(e,t)});function uke(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:q2(n)}var dke=J(`$ZodCIDRv6`,(e,t)=>{t.pattern??=lOe,W2.init(e,t),e._zod.check=n=>{uke(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function J2(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Y2=/^[0-9a-zA-Z+/]*={0,2}$/,fke=J(`$ZodBase64`,(e,t)=>{t.pattern??=Y2,W2.init(e,t),e._zod.check=n=>{J2(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),X2=/^[A-Za-z0-9_-]*$/;function pke(e){if(!X2.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return J2(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var mke=J(`$ZodBase64URL`,(e,t)=>{t.pattern??=X2,W2.init(e,t),e._zod.check=n=>{pke(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),hke=J(`$ZodE164`,(e,t)=>{t.pattern??=pOe,W2.init(e,t)});function gke(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 _ke=J(`$ZodJWT`,(e,t)=>{W2.init(e,t),e._zod.check=n=>{gke(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Z2=J(`$ZodNumber`,(e,t)=>{B2.init(e,t),e._zod.pattern=N2,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:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),vke=J(`$ZodNumberFormat`,(e,t)=>{EOe.init(e,t),Z2.init(e,t)}),yke=J(`$ZodBoolean`,(e,t)=>{B2.init(e,t),e._zod.pattern=bOe,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}}),bke=J(`$ZodUndefined`,(e,t)=>{B2.init(e,t),e._zod.pattern=SOe,e._zod.values=new Set([void 0]),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}}),xke=J(`$ZodNull`,(e,t)=>{B2.init(e,t),e._zod.pattern=xOe,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}}),Ske=J(`$ZodAny`,(e,t)=>{B2.init(e,t),e._zod.parse=e=>e}),Cke=J(`$ZodUnknown`,(e,t)=>{B2.init(e,t),e._zod.parse=e=>e}),wke=J(`$ZodNever`,(e,t)=>{B2.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Tke(e,t){let n=n2(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of n2(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,r2(n.issues,t,e),n}}return i(n,a)}}var Eke=e=>Array.isArray(e)?e.length:-1;function Q2(e,t,n){e.issues.length&&t.issues.push(...e2(n,e.issues)),t.value[n]=e.value}var Dke=J(`$ZodArray`,(e,t)=>{B2.init(e,t);let n=y2.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;eQ2(t,r,e)));else if(Q2(c,r,e),s&&c.issues.length!==0&&$0(c))break}return o.length?Promise.all(o).then(()=>r):r},Tke(e,Eke)});function $2(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...e2(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Oke=[];function e4(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Oke,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=cDe(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function t4(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if($0(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>$2(e,n,i,t,d,f))):$2(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var kke=J(`$ZodObject`,(e,t)=>{B2.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=j0(()=>e4(t));p2(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||P0(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=H0,o=t.catchall,s,c=y2.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if($0(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>$2(n,t,e,r,a,o))):$2(s,t,e,r,a,o)}return o?t4(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Ake=J(`$ZodObjectJIT`,(e,t)=>{kke.init(e,t);let n=e._zod.parse,r=j0(()=>e4(t)),i=y2.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new LOe([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>` let ${e}_ab = false; for (let i = 0; i < ${e}.issues.length; i++) { const iss = ${e}.issues[i]; @@ -123,7 +123,7 @@ if (${e}_ab && ctx && ctx.abortEarly) { payload.value = newResult; return payload; - }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:rDe(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(` + }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:iDe(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(` const ${n}_present = ${i}; if (!${n}.issues.length || ${n}_present) { if (${n}.issues.length) {${c(n,r)} @@ -162,9 +162,9 @@ newResult[${r}] = ${n}.value; } - `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=U0,c=!y2.jitless,l=c&&aDe.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?t4([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function n4(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=>!e2(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=>i2(e,r,b2())))}),t)}var r4=J(`$ZodUnion`,(e,t)=>{B2.init(e,t),p2(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),p2(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),p2(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),p2(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>N0(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>n4(t,r,e,i)):n4(o,r,e,i)}});function Oke(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var kke=J(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,r4.init(e,t);let n=e._zod.parse;p2(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||F0(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=I0(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=M0(()=>Oke(t));e._zod.parse=(i,a)=>{let o=i.value;if(!U0(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Ake=J(`$ZodIntersection`,(e,t)=>{B2.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])=>a4(e,t,n)):a4(e,i,a)}});function i4(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(W0(e)&&W0(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=i4(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{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=i4(t.value,n.value);if(!c.valid){if(e2(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var jke=J(`$ZodRecord`,(e,t)=>{B2.init(e,t);let n=y2.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!W0(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>i2(e,i,b2())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...t2(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...t2(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&N2.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>i2(e,i,b2())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...t2(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...t2(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Mke=J(`$ZodEnum`,(e,t)=>{B2.init(e,t);let n=k0(t.entries),r=new Set(n);e._zod.values=r,p2(e,`pattern`,e=>{let t=k0(e.def.entries).filter(e=>oDe.has(typeof e));return RegExp(t.length?`^(${t.map(e=>K0(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),Nke=J(`$ZodLiteral`,(e,t)=>{B2.init(e,t);let n=new Set(t.values);e._zod.values=n,p2(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?K0(e):e?K0(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),Pke=J(`$ZodTransform`,(e,t)=>{B2.init(e,t),e._zod.optin=`optional`,y2.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new v2(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 _2;return n.value=i,n}});function o4(e,t){return e.value=t.issues.length?void 0:t.value,e}var s4=J(`$ZodOptional`,(e,t)=>{B2.init(e,t),p2(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,p2(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),p2(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${N0(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>o4(e,t)):o4(e,r)}return t.innerType._zod.run(e,n)}}),Fke=J(`$ZodExactOptional`,(e,t)=>{s4.init(e,t),p2(e,`values`,e=>e.def.innerType._zod.values),p2(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Ike=J(`$ZodNullable`,(e,t)=>{B2.init(e,t),p2(e,`optin`,e=>e.def.innerType._zod.optin),p2(e,`optout`,e=>e.def.innerType._zod.optout),p2(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${N0(t.source)}|null)$`):void 0}),p2(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Lke=J(`$ZodDefault`,(e,t)=>{B2.init(e,t),e._zod.optin=`defaulted`,p2(e,`values`,e=>e.def.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=>c4(e,t)):c4(r,t)}});function c4(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Rke=J(`$ZodPrefault`,(e,t)=>{B2.init(e,t),e._zod.optin=`defaulted`,p2(e,`values`,e=>e.def.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))}),zke=J(`$ZodNonOptional`,(e,t)=>{B2.init(e,t),p2(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>l4(t,e)):l4(i,e)}});function l4(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function u4(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>i2(e,r,b2()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Bke=J(`$ZodCatch`,(e,t)=>{B2.init(e,t),p2(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),p2(e,`optout`,e=>e.def.innerType._zod.optout),p2(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>u4(e,r,t,n)):u4(e,r,t,n)}}),d4=J(`$ZodPipe`,(e,t)=>{B2.init(e,t),p2(e,`values`,e=>e.def.in._zod.values),p2(e,`optin`,e=>e.def.in._zod.optin),p2(e,`optout`,e=>e.def.out._zod.optout),p2(e,`propValues`,e=>e.def.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=>f4(e,t.in,n)):f4(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>f4(e,t.out,n)):f4(r,t.out,n)}});function f4(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Vke=J(`$ZodPreprocess`,(e,t)=>{d4.init(e,t)}),Hke=J(`$ZodReadonly`,(e,t)=>{B2.init(e,t),p2(e,`propValues`,e=>e.def.innerType._zod.propValues),p2(e,`values`,e=>e.def.innerType._zod.values),p2(e,`optin`,e=>e.def.innerType?._zod?.optin),p2(e,`optout`,e=>e.def.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(p4):p4(r)}});function p4(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Uke=J(`$ZodLazy`,(e,t)=>{B2.init(e,t),tDe(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),p2(e,`pattern`,e=>e.innerType?._zod?.pattern),p2(e,`propValues`,e=>e.innerType?._zod?.propValues),p2(e,`optin`,e=>e.innerType?._zod?.optin??void 0),p2(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Wke=J(`$ZodCustom`,(e,t)=>{P2.init(e,t),B2.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=>m4(t,n,r,e));m4(i,n,r,e)}});function m4(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(s2(e))}}var Gke=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},h4=`~memo`,g4=[];function _4(e){return typeof e==`object`&&!!e}function v4(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var y4=new WeakMap,b4=0,x4=1,S4=2;function C4(e,t,n){let r=y4.get(e);if(r!==void 0)return r?S4:b4;if(t.has(e))return S4;t.add(e);let i=b4,a=e=>{if(i!==S4&&e?._zod){let r=C4(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=b4;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?x4:o.value?._zod?C4(o.value,t,n):b4;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=I0(c);s(e?o(e,!0):x4),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?C4(r,t,!1):x4);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Kke(e,i)}function Kke(e,t){return t!==x4&&y4.set(e,t===S4),t}function qke(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var w4,T4=[],Jke={alloc(e,t,n){let r=w4;if(!r)return n;w4=void 0;let i={value:n,issues:null};return r.set(t.value,i),T4.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Xke(n,e.value))throw new Gke;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=C4(e,new Set,!1);if(i===b4)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===S4||r?n=!0:r=!0}let l=s.value;if(!_4(l))return t(s,c);let u=c[h4];u||(u={buckets:new WeakMap,backEdges:void 0},c[h4]=u);let d;i===c?d=a:(d=qke(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...v4(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;w4=d;let p=T4.length,m=t(s,c);w4=void 0;let h=T4.length>p?T4.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?v4(e.issues):g4),e)):(h&&(h.issues=m.issues.length?v4(m.issues):g4),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Yke(){return Jke}function Xke(e,t){let n=e[h4]?.backEdges;return n!==void 0&&_4(t)&&n.has(t)}var Zke=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(_De(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Y0(e.values[0])}`:`Invalid option: expected one of ${A0(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${A0(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Qke(){return{localeError:Zke()}}var E4,$ke=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 eAe(){return new $ke}(E4=globalThis).__zod_globalRegistry??(E4.__zod_globalRegistry=eAe());var D4=globalThis.__zod_globalRegistry;function O4(e){return e.checks&&=[...e.checks],e}function tAe(e,t){return new e(O4({type:`string`,...J0(t)}))}function k4(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...J0(t)})}function nAe(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...J0(t)})}function rAe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...J0(t)})}function iAe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...J0(t)})}function aAe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...J0(t)})}function oAe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...J0(t)})}function A4(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...J0(t)})}function sAe(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...J0(t)})}function cAe(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...J0(t)})}function lAe(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...J0(t)})}function uAe(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...J0(t)})}function dAe(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...J0(t)})}function fAe(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...J0(t)})}function pAe(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...J0(t)})}function mAe(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...J0(t)})}function hAe(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...J0(t)})}function gAe(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...J0(t)})}function _Ae(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...J0(t)})}function vAe(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...J0(t)})}function yAe(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...J0(t)})}function bAe(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...J0(t)})}function xAe(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...J0(t)})}function j4(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...J0(t)})}function M4(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...J0(t)})}function SAe(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...J0(t)})}function CAe(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...J0(t)})}function wAe(e,t){return new e(O4({type:`number`,checks:[],...J0(t)}))}function TAe(e,t){return new e(O4({type:`number`,coerce:!0,checks:[],...J0(t)}))}function EAe(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...J0(t)})}function DAe(e,t){return new e({type:`boolean`,...J0(t)})}function OAe(e,t){return new e({type:`undefined`,...J0(t)})}function kAe(e,t){return new e({type:`null`,...J0(t)})}function AAe(e){return new e({type:`any`})}function jAe(e){return new e({type:`unknown`})}function MAe(e,t){return new e({type:`never`,...J0(t)})}function N4(e,t){return new L2({check:`less_than`,...J0(t),value:e,inclusive:!1})}function P4(e,t){return new L2({check:`less_than`,...J0(t),value:e,inclusive:!0})}function F4(e,t){return new R2({check:`greater_than`,...J0(t),value:e,inclusive:!1})}function I4(e,t){return new R2({check:`greater_than`,...J0(t),value:e,inclusive:!0})}function L4(e,t){return new wOe({check:`multiple_of`,...J0(t),value:e})}function R4(e,t){return new EOe({check:`max_length`,...J0(t),maximum:e})}function z4(e,t){return new DOe({check:`min_length`,...J0(t),minimum:e})}function B4(e,t){return new OOe({check:`length_equals`,...J0(t),length:e})}function NAe(e,t){return new kOe({check:`string_format`,format:`regex`,...J0(t),pattern:e})}function PAe(e){return new AOe({check:`string_format`,format:`lowercase`,...J0(e)})}function FAe(e){return new jOe({check:`string_format`,format:`uppercase`,...J0(e)})}function IAe(e,t){return new MOe({check:`string_format`,format:`includes`,...J0(t),includes:e})}function LAe(e,t){return new NOe({check:`string_format`,format:`starts_with`,...J0(t),prefix:e})}function RAe(e,t){return new POe({check:`string_format`,format:`ends_with`,...J0(t),suffix:e})}function V4(e){return new FOe({check:`overwrite`,tx:e})}function zAe(e){return V4(t=>t.normalize(e))}function BAe(){return V4(e=>e.trim())}function VAe(){return V4(e=>e.toLowerCase())}function HAe(){return V4(e=>e.toUpperCase())}function UAe(){return V4(e=>iDe(e))}function WAe(e,t,n){return new e({type:`array`,element:t,...J0(n)})}function GAe(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...J0(n)})}function KAe(e,t){let n=qAe(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(s2(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(s2(r))}},e(t.value,t)),t);return n}function qAe(e,t){let n=new P2({check:`custom`,...J0(t)});return n._zod.check=e,n}function H4(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&F0(e,t,n[t]);return e}function U4(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??D4,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function W4(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function G4(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,G4(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&H4(o.schema,c),t.io===`input`&&e3(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function K4(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function q4(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${K4(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+K4(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(`/`)}/ + `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=H0,c=!y2.jitless,l=c&&oDe.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?t4([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function n4(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=>!$0(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=>i2(e,r,b2())))}),t)}var r4=J(`$ZodUnion`,(e,t)=>{B2.init(e,t),p2(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),p2(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),p2(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),p2(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>M0(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>n4(t,r,e,i)):n4(o,r,e,i)}});function jke(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Mke=J(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,r4.init(e,t);let n=e._zod.parse;p2(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||P0(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=F0(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=j0(()=>jke(t));e._zod.parse=(i,a)=>{let o=i.value;if(!H0(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Nke=J(`$ZodIntersection`,(e,t)=>{B2.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])=>a4(e,t,n)):a4(e,i,a)}});function i4(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(U0(e)&&U0(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=i4(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{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=i4(t.value,n.value);if(!c.valid){if($0(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Pke=J(`$ZodRecord`,(e,t)=>{B2.init(e,t);let n=y2.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!U0(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>i2(e,i,b2())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...e2(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...e2(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&N2.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>i2(e,i,b2())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...e2(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...e2(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Fke=J(`$ZodEnum`,(e,t)=>{B2.init(e,t);let n=O0(t.entries),r=new Set(n);e._zod.values=r,p2(e,`pattern`,e=>{let t=O0(e.def.entries).filter(e=>sDe.has(typeof e));return RegExp(t.length?`^(${t.map(e=>G0(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),Ike=J(`$ZodLiteral`,(e,t)=>{B2.init(e,t);let n=new Set(t.values);e._zod.values=n,p2(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?G0(e):e?G0(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),Lke=J(`$ZodTransform`,(e,t)=>{B2.init(e,t),e._zod.optin=`optional`,y2.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new v2(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 _2;return n.value=i,n}});function o4(e,t){return e.value=t.issues.length?void 0:t.value,e}var s4=J(`$ZodOptional`,(e,t)=>{B2.init(e,t),p2(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,p2(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),p2(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${M0(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>o4(e,t)):o4(e,r)}return t.innerType._zod.run(e,n)}}),Rke=J(`$ZodExactOptional`,(e,t)=>{s4.init(e,t),p2(e,`values`,e=>e.def.innerType._zod.values),p2(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),zke=J(`$ZodNullable`,(e,t)=>{B2.init(e,t),p2(e,`optin`,e=>e.def.innerType._zod.optin),p2(e,`optout`,e=>e.def.innerType._zod.optout),p2(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${M0(t.source)}|null)$`):void 0}),p2(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Bke=J(`$ZodDefault`,(e,t)=>{B2.init(e,t),e._zod.optin=`defaulted`,p2(e,`values`,e=>e.def.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=>c4(e,t)):c4(r,t)}});function c4(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Vke=J(`$ZodPrefault`,(e,t)=>{B2.init(e,t),e._zod.optin=`defaulted`,p2(e,`values`,e=>e.def.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))}),Hke=J(`$ZodNonOptional`,(e,t)=>{B2.init(e,t),p2(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>l4(t,e)):l4(i,e)}});function l4(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function u4(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>i2(e,r,b2()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Uke=J(`$ZodCatch`,(e,t)=>{B2.init(e,t),p2(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),p2(e,`optout`,e=>e.def.innerType._zod.optout),p2(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>u4(e,r,t,n)):u4(e,r,t,n)}}),d4=J(`$ZodPipe`,(e,t)=>{B2.init(e,t),p2(e,`values`,e=>e.def.in._zod.values),p2(e,`optin`,e=>e.def.in._zod.optin),p2(e,`optout`,e=>e.def.out._zod.optout),p2(e,`propValues`,e=>e.def.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=>f4(e,t.in,n)):f4(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>f4(e,t.out,n)):f4(r,t.out,n)}});function f4(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Wke=J(`$ZodPreprocess`,(e,t)=>{d4.init(e,t)}),Gke=J(`$ZodReadonly`,(e,t)=>{B2.init(e,t),p2(e,`propValues`,e=>e.def.innerType._zod.propValues),p2(e,`values`,e=>e.def.innerType._zod.values),p2(e,`optin`,e=>e.def.innerType?._zod?.optin),p2(e,`optout`,e=>e.def.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(p4):p4(r)}});function p4(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Kke=J(`$ZodLazy`,(e,t)=>{B2.init(e,t),nDe(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),p2(e,`pattern`,e=>e.innerType?._zod?.pattern),p2(e,`propValues`,e=>e.innerType?._zod?.propValues),p2(e,`optin`,e=>e.innerType?._zod?.optin??void 0),p2(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),qke=J(`$ZodCustom`,(e,t)=>{P2.init(e,t),B2.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=>m4(t,n,r,e));m4(i,n,r,e)}});function m4(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(s2(e))}}var Jke=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},h4=`~memo`,g4=[];function _4(e){return typeof e==`object`&&!!e}function v4(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var y4=new WeakMap,b4=0,x4=1,S4=2;function C4(e,t,n){let r=y4.get(e);if(r!==void 0)return r?S4:b4;if(t.has(e))return S4;t.add(e);let i=b4,a=e=>{if(i!==S4&&e?._zod){let r=C4(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=b4;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?x4:o.value?._zod?C4(o.value,t,n):b4;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=F0(c);s(e?o(e,!0):x4),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?C4(r,t,!1):x4);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Yke(e,i)}function Yke(e,t){return t!==x4&&y4.set(e,t===S4),t}function Xke(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var w4,T4=[],Zke={alloc(e,t,n){let r=w4;if(!r)return n;w4=void 0;let i={value:n,issues:null};return r.set(t.value,i),T4.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&$ke(n,e.value))throw new Jke;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=C4(e,new Set,!1);if(i===b4)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===S4||r?n=!0:r=!0}let l=s.value;if(!_4(l))return t(s,c);let u=c[h4];u||(u={buckets:new WeakMap,backEdges:void 0},c[h4]=u);let d;i===c?d=a:(d=Xke(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...v4(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;w4=d;let p=T4.length,m=t(s,c);w4=void 0;let h=T4.length>p?T4.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?v4(e.issues):g4),e)):(h&&(h.issues=m.issues.length?v4(m.issues):g4),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Qke(){return Zke}function $ke(e,t){let n=e[h4]?.backEdges;return n!==void 0&&_4(t)&&n.has(t)}var eAe=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(vDe(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${J0(e.values[0])}`:`Invalid option: expected one of ${k0(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${k0(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function tAe(){return{localeError:eAe()}}var E4,nAe=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 rAe(){return new nAe}(E4=globalThis).__zod_globalRegistry??(E4.__zod_globalRegistry=rAe());var D4=globalThis.__zod_globalRegistry;function O4(e){return e.checks&&=[...e.checks],e}function iAe(e,t){return new e(O4({type:`string`,...q0(t)}))}function k4(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...q0(t)})}function aAe(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...q0(t)})}function oAe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...q0(t)})}function sAe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...q0(t)})}function cAe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...q0(t)})}function lAe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...q0(t)})}function A4(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...q0(t)})}function uAe(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...q0(t)})}function dAe(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...q0(t)})}function fAe(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...q0(t)})}function pAe(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...q0(t)})}function mAe(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...q0(t)})}function hAe(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...q0(t)})}function gAe(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...q0(t)})}function _Ae(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...q0(t)})}function vAe(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...q0(t)})}function yAe(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...q0(t)})}function bAe(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...q0(t)})}function xAe(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...q0(t)})}function SAe(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...q0(t)})}function CAe(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...q0(t)})}function wAe(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...q0(t)})}function j4(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...q0(t)})}function M4(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...q0(t)})}function TAe(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...q0(t)})}function EAe(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...q0(t)})}function DAe(e,t){return new e(O4({type:`number`,checks:[],...q0(t)}))}function OAe(e,t){return new e(O4({type:`number`,coerce:!0,checks:[],...q0(t)}))}function kAe(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...q0(t)})}function AAe(e,t){return new e({type:`boolean`,...q0(t)})}function jAe(e,t){return new e({type:`undefined`,...q0(t)})}function MAe(e,t){return new e({type:`null`,...q0(t)})}function NAe(e){return new e({type:`any`})}function PAe(e){return new e({type:`unknown`})}function FAe(e,t){return new e({type:`never`,...q0(t)})}function N4(e,t){return new L2({check:`less_than`,...q0(t),value:e,inclusive:!1})}function P4(e,t){return new L2({check:`less_than`,...q0(t),value:e,inclusive:!0})}function F4(e,t){return new R2({check:`greater_than`,...q0(t),value:e,inclusive:!1})}function I4(e,t){return new R2({check:`greater_than`,...q0(t),value:e,inclusive:!0})}function L4(e,t){return new TOe({check:`multiple_of`,...q0(t),value:e})}function R4(e,t){return new DOe({check:`max_length`,...q0(t),maximum:e})}function z4(e,t){return new OOe({check:`min_length`,...q0(t),minimum:e})}function B4(e,t){return new kOe({check:`length_equals`,...q0(t),length:e})}function IAe(e,t){return new AOe({check:`string_format`,format:`regex`,...q0(t),pattern:e})}function LAe(e){return new jOe({check:`string_format`,format:`lowercase`,...q0(e)})}function RAe(e){return new MOe({check:`string_format`,format:`uppercase`,...q0(e)})}function zAe(e,t){return new NOe({check:`string_format`,format:`includes`,...q0(t),includes:e})}function BAe(e,t){return new POe({check:`string_format`,format:`starts_with`,...q0(t),prefix:e})}function VAe(e,t){return new FOe({check:`string_format`,format:`ends_with`,...q0(t),suffix:e})}function V4(e){return new IOe({check:`overwrite`,tx:e})}function HAe(e){return V4(t=>t.normalize(e))}function UAe(){return V4(e=>e.trim())}function WAe(){return V4(e=>e.toLowerCase())}function GAe(){return V4(e=>e.toUpperCase())}function KAe(){return V4(e=>aDe(e))}function qAe(e,t,n){return new e({type:`array`,element:t,...q0(n)})}function JAe(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...q0(n)})}function YAe(e,t){let n=XAe(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(s2(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(s2(r))}},e(t.value,t)),t);return n}function XAe(e,t){let n=new P2({check:`custom`,...q0(t)});return n._zod.check=e,n}function H4(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&P0(e,t,n[t]);return e}function U4(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??D4,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function W4(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function G4(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,G4(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&H4(o.schema,c),t.io===`input`&&e3(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function K4(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function q4(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${K4(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+K4(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(`/`)}/ -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}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function J4(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;J4(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Y4=new Set([`type`,`properties`,`required`,`additionalProperties`]),X4=[`oneOf`,`anyOf`];function Z4(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Q4(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Y4.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Z4(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}F0(n,r,e.length===1?e[0]:Q4(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Z4(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function JAe(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Y4)if(t in e)return;let n=t.filter(e=>X4.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Q4(t);else{let e=n[0],i=X4.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Q4([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,H4(e,r))}function $4(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)):H4(i,s),H4(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())J4(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])JAe(e)}}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)}H4(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,F0(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:t3(t,`input`,e.processors),output:t3(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function e3(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 e3(r.element,n);if(r.type===`set`)return e3(r.valueType,n);if(r.type===`lazy`)return e3(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`||r.type===`catch`)return e3(r.innerType,n);if(r.type===`intersection`)return e3(r.left,n)||e3(r.right,n);if(r.type===`record`||r.type===`map`)return e3(r.keyType,n)||e3(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:e3(r.in,n)||e3(r.out,n);if(r.type===`object`){for(let e in r.shape)if(e3(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(e3(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(e3(e,n))return!0;return!!(r.rest&&e3(r.rest,n))}return!1}var YAe=(e,t={})=>n=>{let r=U4({...n,processors:t});return G4(e,r),q4(r,e),$4(r,e)},t3=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=U4({...i??{},target:a,io:t,processors:n});return G4(e,o),q4(o,e),$4(o,e)},n3=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},r3=(e,t,n)=>{(e[t]===void 0||n{n3(e,`minimum`,t),r3(e,`maximum`,t)},a3=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},o3=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},s3=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},c3=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},l3=(e,t)=>n3(e,`minimum`,t.minimum),u3=(e,t)=>r3(e,`maximum`,t.maximum),d3=e=>(t,n)=>{c3(t,n.format);let[r,i]=e[n.format];n3(t,`minimum`,r),r3(t,`maximum`,i)},XAe={greater_than:(e,t)=>n3(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>r3(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>a3(e,t.value),number_format:d3(X0),bigint_format:d3(cDe),min_length:l3,max_length:u3,length_equals:(e,t)=>i3(e,t.length),min_size:l3,max_size:u3,size_equals:(e,t)=>i3(e,t.size),string_format:(e,t)=>{c3(e,t.format),t.pattern&&o3(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>s3(e,t.mime)};function f3(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)XAe[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&n3(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&n3(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&r3(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&r3(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&a3(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&s3(t,i.mime);for(let e of i.patterns??[])o3(t,e);return t}var ZAe={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},QAe=new Map([[Y2,lOe],[X2,uOe]]),p3=e=>QAe.get(e)??e,m3=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=f3(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ZAe[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(p3);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}))])}},h3=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=f3(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):W4(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},g3=(e,t,n,r)=>{n.type=`boolean`},$Ae=(e,t,n,r)=>{W4(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},eje=(e,t,n,r)=>{W4(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},_3=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},v3=(e,t,n,r)=>{W4(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},tje=(e,t,n,r)=>{W4(e,t,n,r,`Void cannot be represented in JSON Schema`)},y3=(e,t,n,r)=>{n.not={}},nje=(e,t,n,r)=>{},rje=(e,t,n,r)=>{},ije=(e,t,n,r)=>{W4(e,t,n,r,`Date cannot be represented in JSON Schema`)},b3=(e,t,n,r)=>{let i=e._zod.def,a=k0(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},x3=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(W4(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(W4(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},aje=(e,t,n,r)=>{W4(e,t,n,r,`NaN cannot be represented in JSON Schema`)},oje=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},sje=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=f3(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},cje=(e,t,n,r)=>{n.type=`boolean`},S3=(e,t,n,r)=>{W4(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},lje=(e,t,n,r)=>{W4(e,t,n,r,`Function types cannot be represented in JSON Schema`)},C3=(e,t,n,r)=>{W4(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},uje=(e,t,n,r)=>{W4(e,t,n,r,`Map cannot be represented in JSON Schema`)},dje=(e,t,n,r)=>{W4(e,t,n,r,`Set cannot be represented in JSON Schema`)},w3=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=f3(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=G4(a.element,t,{...r,path:[...r.path,`items`]})};function T3(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?T3(t.out):t.type===`catch`?T3(t.innerType):e._zod.optin}var E3=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&W4(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)F0(i.properties,e,G4(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?T3(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=G4(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},D3=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>G4(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},O3=(e,t,n,r)=>{let i=e._zod.def,a=G4(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=G4(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},fje=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>G4(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?G4(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?T3(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=f3(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function k3(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=k3(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>k3(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?N2:vOe).source),p):p}var A3=new WeakMap;function pje(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of A3.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=k3(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var j3=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=f3(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=G4(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)F0(i.patternProperties,p3(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=G4(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=A3.get(t);n||(n=[],A3.set(t,n),t.deferred.push(()=>pje(t))),n.push(e)}i.additionalProperties=G4(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&T3(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},M3=(e,t,n,r)=>{let i=e._zod.def,a=G4(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`}]},N3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},P3=Symbol();function F3(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(W4(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),P3):JSON.parse(o)}var I3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=F3(i.defaultValue,e,t,n,r);o!==P3&&(n.default=o)},L3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=F3(i.defaultValue,e,t,n,r);o!==P3&&(n._prefault=o)},R3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{W4(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},z3=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;G4(o,t,r);let s=t.seen.get(e);s.ref=o},B3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},mje=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},V3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},H3=(e,t,n,r)=>{let i=e._zod.innerType;G4(i,t,r);let a=t.seen.get(e);a.ref=i},U3={string:m3,number:h3,boolean:g3,bigint:$Ae,symbol:eje,null:_3,undefined:v3,void:tje,never:y3,any:nje,unknown:rje,date:ije,enum:b3,literal:x3,nan:aje,template_literal:oje,file:sje,success:cje,custom:S3,function:lje,transform:C3,map:uje,set:dje,array:w3,object:E3,union:D3,intersection:O3,tuple:fje,record:j3,nullable:M3,nonoptional:N3,default:I3,prefault:L3,catch:R3,pipe:z3,readonly:B3,promise:mje,optional:V3,lazy:H3};function W3(e,t){if(`_idmap`in e){let n=e,r=U4({...t,processors:U3}),i={};for(let e of n._idmap.entries()){let[t,n]=e;G4(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;q4(r,n),F0(a,t,$4(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=U4({...t,processors:U3});return G4(e,n),q4(n,e),$4(n,e)}var G3=new WeakSet([Object.prototype,Error.prototype]);function K3(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var q3=J(`ZodError`,(e,t)=>{ADe.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);G3.has(n)||(G3.add(n),K3(n,`format`,e=>t=>NDe(e,t)),K3(n,`flatten`,e=>t=>MDe(e,t)),K3(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,j0,2)}),K3(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,j0,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),hje=T2(q3),gje=E2(q3),J3=D2(q3),_je=k2(q3),vje=zDe(q3),yje=BDe(q3),bje=VDe(q3),xje=HDe(q3),Sje=UDe(q3),Cje=WDe(q3),wje=GDe(q3),Tje=KDe(q3);function Eje(){y2.localeError||b2(Qke())}function Y3(){y2.memoizer||b2({memoizer:Yke()})}var X3=J(`ZodType`,(e,t)=>(Eje(),B2.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(V0(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return q0(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(yMe(e,t))},superRefine(e,t){return this.check(bMe(e,t))},overwrite(e){return this.check(V4(e))},optional(){return T6(this)},exactOptional(){return aMe(this)},nullable(){return D6(this)},nullish(){return T6(D6(this))},nonoptional(e){return dMe(this,e)},array(){return Z(this)},or(e){return g6([this,e])},and(e){return v6(this,e)},transform(e){return A6(this,C6(e))},default(e){return cMe(this,e)},prefault(e){return uMe(this,e)},catch(e){return pMe(this,e)},pipe(e){return A6(this,e)},readonly(){return gMe(this)},describe(e){let t=this.clone();return D4.add(t,{description:e}),t},meta(...e){if(e.length===0)return D4.get(this);let t=this.clone();return D4.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return l2(this,`~standard`,{...H2(this),jsonSchema:{input:t3(this,`input`),output:t3(this,`output`)}})},set"~standard"(e){c2(this,`~standard`,e)},parse:function e(t,n){return hje(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await gje(this,t,n,{callee:e})},safeParse(e,t){return J3(this,e,t)},async safeParseAsync(e,t){return _je(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){c2(this,`spa`,e)},validate(e,t){return IDe(this,e,t)},validateAsync(e,t){return RDe(this,e,t)},encode:function e(t,n){return vje(this,t,n,{callee:e})},decode:function e(t,n){return yje(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await bje(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await xje(this,t,n,{callee:e})},safeEncode(e,t){return Sje(this,e,t)},safeDecode(e,t){return Cje(this,e,t)},async safeEncodeAsync(e,t){return wje(this,e,t)},async safeDecodeAsync(e,t){return Tje(this,e,t)},toJSONSchema(e){return YAe(this,{})(e)},get description(){return D4.get(this)?.description},get _def(){return this._zod.def}}),Z3=J(`_ZodString`,(e,t)=>{U2.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>m3(e,t,n,r)},u2({format:e=>f3(e).format??null,minLength:e=>f3(e).minimum??null,maxLength:e=>f3(e).maximum??null},{regex(...e){return this.check(NAe(...e))},includes(...e){return this.check(IAe(...e))},startsWith(...e){return this.check(LAe(...e))},endsWith(...e){return this.check(RAe(...e))},min(...e){return this.check(z4(...e))},max(...e){return this.check(R4(...e))},length(...e){return this.check(B4(...e))},nonempty(...e){return this.check(z4(1,...e))},lowercase(e){return this.check(PAe(e))},uppercase(e){return this.check(FAe(e))},trim(){return this.check(BAe())},normalize(...e){return this.check(zAe(...e))},toLowerCase(){return this.check(VAe())},toUpperCase(){return this.check(HAe())},slugify(){return this.check(UAe())}})),Dje=J(`ZodString`,(e,t)=>{U2.init(e,t),Z3.init(e,t)},{email(e){return this.check(k4(t6,e))},url(e){return this.check(A4(r6,e))},jwt(e){return this.check(xAe(Kje,e))},emoji(e){return this.check(sAe(Mje,e))},guid(e){return this.check(nAe(jje,e))},uuid(e){return this.check(rAe(n6,e))},uuidv4(e){return this.check(iAe(n6,e))},uuidv6(e){return this.check(aAe(n6,e))},uuidv7(e){return this.check(oAe(n6,e))},nanoid(e){return this.check(cAe(Nje,e))},cuid(e){return this.check(lAe(Pje,e))},cuid2(e){return this.check(uAe(Fje,e))},ulid(e){return this.check(dAe(Ije,e))},base64(e){return this.check(vAe(Uje,e))},base64url(e){return this.check(yAe(Wje,e))},xid(e){return this.check(fAe(Lje,e))},ksuid(e){return this.check(pAe(Rje,e))},ipv4(e){return this.check(mAe(zje,e))},ipv6(e){return this.check(hAe(Bje,e))},cidrv4(e){return this.check(gAe(Vje,e))},cidrv6(e){return this.check(_Ae(Hje,e))},e164(e){return this.check(bAe(Gje,e))},datetime(e){return this.check(j4($3,e))},date(e){return this.check(M4(e6,e))},time(e){return this.check(SAe(Oje,e))},duration(e){return this.check(CAe(kje,e))}});function Y(e){return tAe(Dje,e)}var Q3=J(`ZodStringFormat`,(e,t)=>{W2.init(e,t),Z3.init(e,t)}),$3=J(`ZodISODateTime`,(e,t)=>{tke.init(e,t),Q3.init(e,t)}),e6=J(`ZodISODate`,(e,t)=>{nke.init(e,t),Q3.init(e,t)}),Oje=J(`ZodISOTime`,(e,t)=>{rke.init(e,t),Q3.init(e,t)}),kje=J(`ZodISODuration`,(e,t)=>{ike.init(e,t),Q3.init(e,t)}),t6=J(`ZodEmail`,(e,t)=>{VOe.init(e,t),Q3.init(e,t)});function Aje(e){return k4(t6,e)}var jje=J(`ZodGUID`,(e,t)=>{zOe.init(e,t),Q3.init(e,t)}),n6=J(`ZodUUID`,(e,t)=>{BOe.init(e,t),Q3.init(e,t)}),r6=J(`ZodURL`,(e,t)=>{qOe.init(e,t),Q3.init(e,t)});function i6(e){return A4(r6,e)}var Mje=J(`ZodEmoji`,(e,t)=>{JOe.init(e,t),Q3.init(e,t)}),Nje=J(`ZodNanoID`,(e,t)=>{YOe.init(e,t),Q3.init(e,t)}),Pje=J(`ZodCUID`,(e,t)=>{XOe.init(e,t),Q3.init(e,t)}),Fje=J(`ZodCUID2`,(e,t)=>{ZOe.init(e,t),Q3.init(e,t)}),Ije=J(`ZodULID`,(e,t)=>{QOe.init(e,t),Q3.init(e,t)}),Lje=J(`ZodXID`,(e,t)=>{$Oe.init(e,t),Q3.init(e,t)}),Rje=J(`ZodKSUID`,(e,t)=>{eke.init(e,t),Q3.init(e,t)}),zje=J(`ZodIPv4`,(e,t)=>{ake.init(e,t),Q3.init(e,t)}),Bje=J(`ZodIPv6`,(e,t)=>{ske.init(e,t),Q3.init(e,t)}),Vje=J(`ZodCIDRv4`,(e,t)=>{cke.init(e,t),Q3.init(e,t)}),Hje=J(`ZodCIDRv6`,(e,t)=>{uke.init(e,t),Q3.init(e,t)}),Uje=J(`ZodBase64`,(e,t)=>{dke.init(e,t),Q3.init(e,t)}),Wje=J(`ZodBase64URL`,(e,t)=>{pke.init(e,t),Q3.init(e,t)}),Gje=J(`ZodE164`,(e,t)=>{mke.init(e,t),Q3.init(e,t)}),Kje=J(`ZodJWT`,(e,t)=>{gke.init(e,t),Q3.init(e,t)}),a6=J(`ZodNumber`,(e,t)=>{Z2.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>h3(e,t,n,r),e.isFinite=!0},u2({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=f3(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=f3(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=f3(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>f3(e).format??null},{gt(e,t){return this.check(F4(e,t))},gte(e,t){return this.check(I4(e,t))},min(e,t){return this.check(I4(e,t))},lt(e,t){return this.check(N4(e,t))},lte(e,t){return this.check(P4(e,t))},max(e,t){return this.check(P4(e,t))},int(e){return this.check(o6(e))},safe(e){return this.check(o6(e))},positive(e){return this.check(F4(0,e))},nonnegative(e){return this.check(I4(0,e))},negative(e){return this.check(N4(0,e))},nonpositive(e){return this.check(P4(0,e))},multipleOf(e,t){return this.check(L4(e,t))},step(e,t){return this.check(L4(e,t))},finite(){return this}}));function X(e){return wAe(a6,e)}var qje=J(`ZodNumberFormat`,(e,t)=>{_ke.init(e,t),a6.init(e,t)});function o6(e){return EAe(qje,e)}var Jje=J(`ZodBoolean`,(e,t)=>{vke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>g3(e,t,n,r)});function s6(e){return DAe(Jje,e)}var Yje=J(`ZodUndefined`,(e,t)=>{yke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>v3(e,t,n,r)});function c6(e){return OAe(Yje,e)}var Xje=J(`ZodNull`,(e,t)=>{bke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_3(e,t,n,r)});function l6(e){return kAe(Xje,e)}var Zje=J(`ZodAny`,(e,t)=>{xke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function u6(){return AAe(Zje)}var Qje=J(`ZodUnknown`,(e,t)=>{Ske.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function d6(){return jAe(Qje)}var $je=J(`ZodNever`,(e,t)=>{Cke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>y3(e,t,n,r)});function f6(e){return MAe($je,e)}var eMe=J(`ZodArray`,(e,t)=>{Y3(),wke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>w3(e,t,n,r),e.element=t.element},{min(e,t){return this.check(z4(e,t))},nonempty(e){return this.check(z4(1,e))},max(e,t){return this.check(R4(e,t))},length(e,t){return this.check(B4(e,t))},unwrap(){return this.element}});function Z(e,t){return WAe(eMe,e,t)}var p6=J(`ZodObject`,(e,t)=>{Y3(),Dke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>E3(e,t,n,r),SDe(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return S6(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(V0(this._zod.def,{catchall:e}))},passthrough(){return this.clone(V0(this._zod.def,{catchall:d6()}))},loose(){return this.clone(V0(this._zod.def,{catchall:d6()}))},strict(){return this.clone(V0(this._zod.def,{catchall:f6()}))},strip(){return this.clone(V0(this._zod.def,{catchall:void 0}))},extend(e){return dDe(this,e)},safeExtend(e){return fDe(this,e)},merge(e){return pDe(this,e)},pick(e){return lDe(this,e)},omit(e){return uDe(this,e)},partial(...e){return $0(w6,this,e[0])},exactPartial(...e){return $0(E6,this,e[0],`exactPartial`)},required(...e){return mDe(O6,this,e[0])}});function Q(e,t){return new p6({type:`object`,shape:e??{},...J0(t)})}function m6(e,t){return new p6({type:`object`,shape:e,catchall:d6(),...J0(t)})}var h6=J(`ZodUnion`,(e,t)=>{r4.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>D3(e,t,n,r),e.options=t.options});function g6(e,t){return new h6({type:`union`,options:e,...J0(t)})}var tMe=J(`ZodDiscriminatedUnion`,(e,t)=>{h6.init(e,t),kke.init(e,t)});function _6(e,t,n){return new tMe({type:`union`,options:t,discriminator:e,...J0(n)})}var nMe=J(`ZodIntersection`,(e,t)=>{Ake.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>O3(e,t,n,r)});function v6(e,t){return new nMe({type:`intersection`,left:e,right:t})}var y6=J(`ZodRecord`,(e,t)=>{Y3(),jke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>j3(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function b6(e,t,n){return!t||!t._zod?new y6({type:`record`,keyType:Y(),valueType:e,...J0(t)}):new y6({type:`record`,keyType:e,valueType:t,...J0(n)})}var x6=J(`ZodEnum`,(e,t)=>{Mke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>b3(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 x6({...t,checks:[],...J0(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 x6({...t,checks:[],...J0(r),entries:i})}});function S6(e,t){return new x6({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...J0(t)})}var rMe=J(`ZodLiteral`,(e,t)=>{Nke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>x3(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 $(e,t){return new rMe({type:`literal`,values:Array.isArray(e)?e:[e],...J0(t)})}var iMe=J(`ZodTransform`,(e,t)=>{Y3(),Pke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>C3(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new v2(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(s2(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(s2(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function C6(e){return new iMe({type:`transform`,transform:e})}var w6=J(`ZodOptional`,(e,t)=>{s4.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>V3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function T6(e){return new w6({type:`optional`,innerType:e})}var E6=J(`ZodExactOptional`,(e,t)=>{Fke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>V3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function aMe(e){return new E6({type:`optional`,innerType:e})}var oMe=J(`ZodNullable`,(e,t)=>{Ike.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>M3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function D6(e){return new oMe({type:`nullable`,innerType:e})}var sMe=J(`ZodDefault`,(e,t)=>{Lke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>I3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cMe(e,t){return new sMe({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():G0(t)}})}var lMe=J(`ZodPrefault`,(e,t)=>{Rke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>L3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uMe(e,t){return new lMe({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():G0(t)}})}var O6=J(`ZodNonOptional`,(e,t)=>{zke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>N3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dMe(e,t){return new O6({type:`nonoptional`,innerType:e,...J0(t)})}var fMe=J(`ZodCatch`,(e,t)=>{Bke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>R3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pMe(e,t){return new fMe({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:wDe(t)})}var k6=J(`ZodPipe`,(e,t)=>{d4.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z3(e,t,n,r),e.in=t.in,e.out=t.out});function A6(e,t){return new k6({type:`pipe`,in:e,out:t})}var mMe=J(`ZodPreprocess`,(e,t)=>{k6.init(e,t),Vke.init(e,t)}),hMe=J(`ZodReadonly`,(e,t)=>{Hke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>B3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gMe(e){return new hMe({type:`readonly`,innerType:e})}var _Me=J(`ZodLazy`,(e,t)=>{Uke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>H3(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function j6(e){return new _Me({type:`lazy`,getter:e})}var vMe=J(`ZodCustom`,(e,t)=>{Wke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>S3(e,t,n,r)});function yMe(e,t={}){return GAe(vMe,e,t)}function bMe(e,t){return KAe(e,t)}function M6(e,t){return new mMe({type:`pipe`,in:C6(e),out:t})}var xMe={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`},SMe;SMe||={};function N6(e){return j4($3,e)}function CMe(e){return M4(e6,e)}function wMe(e){return TAe(a6,e)}var TMe=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],EMe=`io.modelcontextprotocol/related-task`,P6=`io.modelcontextprotocol/protocolVersion`,F6=`io.modelcontextprotocol/clientInfo`,I6=`io.modelcontextprotocol/serverInfo`,L6=`io.modelcontextprotocol/clientCapabilities`,DMe=`io.modelcontextprotocol/subscriptionId`,R6=`io.modelcontextprotocol/logLevel`,z6=j6(()=>g6([Y(),X(),s6(),l6(),b6(Y(),z6),Z(z6)])),B6=b6(Y(),z6),OMe=Z(z6),V6=g6([Y(),X().int()]),H6=Y(),U6=Q({ttl:X().optional()}),W6=Q({taskId:Y()}),G6=m6({progressToken:V6.optional(),[EMe]:W6.optional()}),K6=Q({_meta:G6.optional()}),q6=K6.extend({task:U6.optional()}),J6=Q({method:Y(),params:K6.loose().optional()}),Y6=Q({_meta:G6.optional()}),X6=Q({method:Y(),params:Y6.loose().optional()}),Z6=m6({get[I6](){return d8.optional().catch(void 0)}}),Q6=m6({_meta:Z6.optional()}),$6=g6([Y(),X().int()]),e8=Q({jsonrpc:$(`2.0`),id:$6,...J6.shape}).strict(),t8=Q({jsonrpc:$(`2.0`),...X6.shape}).strict(),n8=Q({jsonrpc:$(`2.0`),id:$6,result:Q6}).strict(),r8=Q({jsonrpc:$(`2.0`),id:$6.optional(),error:Q({code:X().int(),message:Y(),data:d6().optional()})}).strict(),i8=g6([e8,t8,n8,r8]),kMe=g6([n8,r8]),a8=Q6.strict(),o8=Y6.extend({requestId:$6.optional(),reason:Y().optional()}),s8=X6.extend({method:$(`notifications/cancelled`),params:o8}),c8=Q({src:Y(),mimeType:Y().optional(),sizes:Z(Y()).optional(),theme:S6([`light`,`dark`]).optional()}),l8=Q({icons:Z(c8).optional()}),u8=Q({name:Y(),title:Y().optional()}),d8=u8.extend({...u8.shape,...l8.shape,version:Y(),websiteUrl:Y().optional(),description:Y().optional()}),AMe=M6(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,v6(Q({form:v6(Q({applyDefaults:s6().optional()}),B6).optional(),url:B6.optional()}),B6.optional())),f8=m6({list:B6.optional(),cancel:B6.optional(),requests:m6({sampling:m6({createMessage:B6.optional()}).optional(),elicitation:m6({create:B6.optional()}).optional()}).optional()}),p8=m6({list:B6.optional(),cancel:B6.optional(),requests:m6({tools:m6({call:B6.optional()}).optional()}).optional()}),m8=Q({experimental:b6(Y(),B6).optional(),sampling:Q({context:B6.optional(),tools:B6.optional()}).optional(),elicitation:AMe.optional(),roots:Q({listChanged:s6().optional()}).optional(),tasks:f8.optional(),extensions:b6(Y(),B6).optional()}),h8=K6.extend({protocolVersion:Y(),capabilities:m8,clientInfo:d8}),g8=J6.extend({method:$(`initialize`),params:h8}),_8=Q({experimental:b6(Y(),B6).optional(),logging:B6.optional(),completions:B6.optional(),prompts:Q({listChanged:s6().optional()}).optional(),resources:Q({subscribe:s6().optional(),listChanged:s6().optional()}).optional(),tools:Q({listChanged:s6().optional()}).optional(),tasks:p8.optional(),extensions:b6(Y(),B6).optional()}),v8=Q6.extend({protocolVersion:Y(),capabilities:_8,serverInfo:d8,instructions:Y().optional()}),y8=X6.extend({method:$(`notifications/initialized`),params:Y6.optional()}),b8=J6.extend({method:$(`server/discover`),params:K6.optional()}),x8=Q6.extend({supportedVersions:Z(Y()),capabilities:_8,instructions:Y().optional()}),S8=J6.extend({method:$(`ping`),params:K6.optional()}),C8=Q({progress:X(),total:T6(X()),message:T6(Y())}),w8=Q({...Y6.shape,...C8.shape,progressToken:V6}),T8=X6.extend({method:$(`notifications/progress`),params:w8}),E8=K6.extend({cursor:H6.optional()}),D8=J6.extend({params:E8.optional()}),O8=Q6.extend({nextCursor:H6.optional()}),k8=Q({uri:Y(),mimeType:T6(Y()),_meta:b6(Y(),d6()).optional()}),A8=k8.extend({text:Y()}),j8=Y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),M8=k8.extend({blob:j8}),N8=S6([`user`,`assistant`]),P8=Q({audience:Z(N8).optional(),priority:X().min(0).max(1).optional(),lastModified:N6({offset:!0}).optional()}),F8=Q({...u8.shape,...l8.shape,uri:Y(),description:T6(Y()),mimeType:T6(Y()),size:T6(X()),annotations:P8.optional(),_meta:T6(m6({}))}),I8=Q({...u8.shape,...l8.shape,uriTemplate:Y(),description:T6(Y()),mimeType:T6(Y()),annotations:P8.optional(),_meta:T6(m6({}))}),L8=D8.extend({method:$(`resources/list`)}),R8=O8.extend({resources:Z(F8)}),z8=D8.extend({method:$(`resources/templates/list`)}),B8=O8.extend({resourceTemplates:Z(I8)}),V8=K6.extend({uri:Y()}),H8=V8,U8=J6.extend({method:$(`resources/read`),params:H8}),W8=Q6.extend({contents:Z(g6([A8,M8]))}),G8=X6.extend({method:$(`notifications/resources/list_changed`),params:Y6.optional()}),K8=V8,q8=J6.extend({method:$(`resources/subscribe`),params:K8}),J8=V8,Y8=J6.extend({method:$(`resources/unsubscribe`),params:J8}),X8=Q({toolsListChanged:s6().optional(),promptsListChanged:s6().optional(),resourcesListChanged:s6().optional(),resourceSubscriptions:Z(Y()).optional()}),Z8=K6.extend({notifications:X8}),Q8=J6.extend({method:$(`subscriptions/listen`),params:Z8}),$8=Y6.extend({notifications:X8}),e5=X6.extend({method:$(`notifications/subscriptions/acknowledged`),params:$8}),t5=Z6.extend({[DMe]:$6}),n5=Q6.extend({_meta:t5}),r5=Y6.extend({uri:Y()}),i5=X6.extend({method:$(`notifications/resources/updated`),params:r5}),a5=Q({name:Y(),description:T6(Y()),required:T6(s6())}),o5=Q({...u8.shape,...l8.shape,description:T6(Y()),arguments:T6(Z(a5)),_meta:T6(m6({}))}),s5=D8.extend({method:$(`prompts/list`)}),c5=O8.extend({prompts:Z(o5)}),l5=K6.extend({name:Y(),arguments:b6(Y(),Y()).optional()}),u5=J6.extend({method:$(`prompts/get`),params:l5}),d5=Q({type:$(`text`),text:Y(),annotations:P8.optional(),_meta:b6(Y(),d6()).optional()}),f5=Q({type:$(`image`),data:j8,mimeType:Y(),annotations:P8.optional(),_meta:b6(Y(),d6()).optional()}),p5=Q({type:$(`audio`),data:j8,mimeType:Y(),annotations:P8.optional(),_meta:b6(Y(),d6()).optional()}),m5=Q({type:$(`tool_use`),name:Y(),id:Y(),input:b6(Y(),d6()),_meta:b6(Y(),d6()).optional()}),h5=Q({type:$(`resource`),resource:g6([A8,M8]),annotations:P8.optional(),_meta:b6(Y(),d6()).optional()}),g5=F8.extend({type:$(`resource_link`)}),_5=g6([d5,f5,p5,g5,h5]),v5=Q({role:N8,content:_5}),y5=Q6.extend({description:Y().optional(),messages:Z(v5)}),b5=X6.extend({method:$(`notifications/prompts/list_changed`),params:Y6.optional()}),x5=Q({title:Y().optional(),readOnlyHint:s6().optional(),destructiveHint:s6().optional(),idempotentHint:s6().optional(),openWorldHint:s6().optional()}),S5=Q({taskSupport:S6([`required`,`optional`,`forbidden`]).optional()}),C5=Q({...u8.shape,...l8.shape,description:Y().optional(),inputSchema:Q({type:$(`object`),properties:b6(Y(),z6).optional(),required:Z(Y()).optional()}).catchall(d6()),outputSchema:m6({$schema:Y().optional()}).optional(),annotations:x5.optional(),execution:S5.optional(),_meta:b6(Y(),d6()).optional()}),w5=D8.extend({method:$(`tools/list`)}),T5=O8.extend({tools:Z(C5)}),E5=Q6.extend({content:Z(_5).default([]),structuredContent:d6().optional(),isError:s6().optional()}),jMe=E5.or(Q6.extend({toolResult:d6()})),D5=q6.extend({name:Y(),arguments:b6(Y(),d6()).optional()}),O5=J6.extend({method:$(`tools/call`),params:D5}),k5=X6.extend({method:$(`notifications/tools/list_changed`),params:Y6.optional()}),MMe=Q({autoRefresh:s6().default(!0),debounceMs:X().int().nonnegative().default(300)}),A5=S6([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),j5=K6.extend({level:A5}),M5=J6.extend({method:$(`logging/setLevel`),params:j5}),N5=Y6.extend({level:A5,logger:Y().optional(),data:d6()}),P5=X6.extend({method:$(`notifications/message`),params:N5}),F5=Q({name:Y().optional()}),I5=Q({hints:Z(F5).optional(),costPriority:X().min(0).max(1).optional(),speedPriority:X().min(0).max(1).optional(),intelligencePriority:X().min(0).max(1).optional()}),L5=Q({mode:S6([`auto`,`required`,`none`]).optional()}),R5=Q({type:$(`tool_result`),toolUseId:Y().describe(`The unique identifier for the corresponding tool call.`),content:Z(_5),structuredContent:d6().optional(),isError:s6().optional(),_meta:b6(Y(),d6()).optional()}),z5=_6(`type`,[d5,f5,p5]),B5=_6(`type`,[d5,f5,p5,m5,R5]),V5=Q({role:N8,content:g6([B5,Z(B5)]),_meta:b6(Y(),d6()).optional()}),H5=q6.extend({messages:Z(V5),modelPreferences:I5.optional(),systemPrompt:Y().optional(),includeContext:S6([`none`,`thisServer`,`allServers`]).optional(),temperature:X().optional(),maxTokens:X().int(),stopSequences:Z(Y()).optional(),metadata:B6.optional(),tools:Z(C5).optional(),toolChoice:L5.optional()}),U5=J6.extend({method:$(`sampling/createMessage`),params:H5}),W5=Q6.extend({model:Y(),stopReason:T6(S6([`endTurn`,`stopSequence`,`maxTokens`]).or(Y())),role:N8,content:z5}),G5=Q6.extend({model:Y(),stopReason:T6(S6([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(Y())),role:N8,content:g6([B5,Z(B5)])}),K5=Q({type:$(`boolean`),title:Y().optional(),description:Y().optional(),default:s6().optional()}),q5=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),minLength:X().optional(),maxLength:X().optional(),format:S6([`email`,`uri`,`date`,`date-time`]).optional(),default:Y().optional()}),J5=Q({type:S6([`number`,`integer`]),title:Y().optional(),description:Y().optional(),minimum:X().optional(),maximum:X().optional(),default:X().optional()}),Y5=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),default:Y().optional()}),X5=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),oneOf:Z(Q({const:Y(),title:Y()})),default:Y().optional()}),Z5=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),enumNames:Z(Y()).optional(),default:Y().optional()}),Q5=g6([Y5,X5]),$5=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({type:$(`string`),enum:Z(Y())}),default:Z(Y()).optional()}),e7=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({anyOf:Z(Q({const:Y(),title:Y()}))}),default:Z(Y()).optional()}),t7=g6([$5,e7]),n7=g6([Z5,Q5,t7]),r7=g6([n7,K5,q5,J5]),i7=q6.extend({mode:$(`form`).optional(),message:Y(),requestedSchema:Q({type:$(`object`),properties:b6(Y(),r7),required:Z(Y()).optional()}).catchall(d6())}),a7=q6.extend({mode:$(`url`),message:Y(),elicitationId:Y(),url:Y().url()}),o7=g6([i7,a7]),s7=J6.extend({method:$(`elicitation/create`),params:o7}),c7=Y6.extend({elicitationId:Y()}),l7=X6.extend({method:$(`notifications/elicitation/complete`),params:c7}),u7=Q6.extend({action:S6([`accept`,`decline`,`cancel`]),content:M6(e=>e===null?void 0:e,b6(Y(),g6([Y(),X(),s6(),Z(Y())])).optional())}),d7=Q({type:$(`ref/resource`),uri:Y()}),f7=Q({type:$(`ref/prompt`),name:Y()}),p7=K6.extend({ref:g6([f7,d7]),argument:Q({name:Y(),value:Y()}),context:Q({arguments:b6(Y(),Y()).optional()}).optional()}),m7=J6.extend({method:$(`completion/complete`),params:p7}),h7=Q6.extend({completion:m6({values:Z(Y()).max(100),total:T6(X().int()),hasMore:T6(s6())})}),g7=Q({uri:Y().startsWith(`file://`),name:Y().optional(),_meta:b6(Y(),d6()).optional()}),_7=J6.extend({method:$(`roots/list`),params:K6.optional()}),v7=Q6.extend({roots:Z(g7)}),y7=X6.extend({method:$(`notifications/roots/list_changed`),params:Y6.optional()}),NMe=m6({ttl:X().optional(),pollInterval:X().optional()}),b7=S6([`working`,`input_required`,`completed`,`failed`,`cancelled`]),x7=Q({taskId:Y(),status:b7,ttl:g6([X(),l6()]),createdAt:Y(),lastUpdatedAt:Y(),pollInterval:T6(X()),statusMessage:T6(Y())}),PMe=Q6.extend({task:x7}),S7=Y6.merge(x7),FMe=X6.extend({method:$(`notifications/tasks/status`),params:S7}),IMe=J6.extend({method:$(`tasks/get`),params:K6.extend({taskId:Y()})}),LMe=Q6.merge(x7),RMe=J6.extend({method:$(`tasks/result`),params:K6.extend({taskId:Y()})}),zMe=Q6.loose(),BMe=D8.extend({method:$(`tasks/list`)}),VMe=O8.extend({tasks:Z(x7)}),HMe=J6.extend({method:$(`tasks/cancel`),params:K6.extend({taskId:Y()})}),UMe=Q6.merge(x7),WMe=g6([S8,g8,b8,m7,M5,u5,s5,L8,z8,U8,q8,Y8,Q8,O5,w5]),GMe=g6([s8,T8,y8,y7]),KMe=g6([a8,W5,G5,u7,v7]),qMe=g6([S8,U5,s7,_7]),JMe=g6([s8,T8,P5,i5,G8,k5,b5,e5,l7]),YMe=g6([a8,v8,x8,h7,y5,c5,R8,B8,W8,E5,T5,n5]),C7=i6().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:xMe.custom,message:`URL must be parseable`,fatal:!0}),TDe}).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`}),XMe=m6({resource:Y().url(),authorization_servers:Z(C7).optional(),jwks_uri:Y().url().optional(),scopes_supported:Z(Y()).optional(),bearer_methods_supported:Z(Y()).optional(),resource_signing_alg_values_supported:Z(Y()).optional(),resource_name:Y().optional(),resource_documentation:Y().optional(),resource_policy_uri:Y().url().optional(),resource_tos_uri:Y().url().optional(),tls_client_certificate_bound_access_tokens:s6().optional(),authorization_details_types_supported:Z(Y()).optional(),dpop_signing_alg_values_supported:Z(Y()).optional(),dpop_bound_access_tokens_required:s6().optional()}),w7=m6({issuer:Y(),authorization_endpoint:C7,token_endpoint:C7,registration_endpoint:C7.optional(),scopes_supported:Z(Y()).optional(),response_types_supported:Z(Y()),response_modes_supported:Z(Y()).optional(),grant_types_supported:Z(Y()).optional(),token_endpoint_auth_methods_supported:Z(Y()).optional(),token_endpoint_auth_signing_alg_values_supported:Z(Y()).optional(),service_documentation:C7.optional(),revocation_endpoint:C7.optional(),revocation_endpoint_auth_methods_supported:Z(Y()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Z(Y()).optional(),introspection_endpoint:Y().optional(),introspection_endpoint_auth_methods_supported:Z(Y()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Z(Y()).optional(),code_challenge_methods_supported:Z(Y()).optional(),client_id_metadata_document_supported:s6().optional(),authorization_response_iss_parameter_supported:s6().optional().catch(void 0),dpop_signing_alg_values_supported:Z(Y()).optional()}),T7=m6({issuer:Y(),authorization_endpoint:C7,token_endpoint:C7,userinfo_endpoint:C7.optional(),jwks_uri:C7,registration_endpoint:C7.optional(),scopes_supported:Z(Y()).optional(),response_types_supported:Z(Y()),response_modes_supported:Z(Y()).optional(),grant_types_supported:Z(Y()).optional(),acr_values_supported:Z(Y()).optional(),subject_types_supported:Z(Y()),id_token_signing_alg_values_supported:Z(Y()),id_token_encryption_alg_values_supported:Z(Y()).optional(),id_token_encryption_enc_values_supported:Z(Y()).optional(),userinfo_signing_alg_values_supported:Z(Y()).optional(),userinfo_encryption_alg_values_supported:Z(Y()).optional(),userinfo_encryption_enc_values_supported:Z(Y()).optional(),request_object_signing_alg_values_supported:Z(Y()).optional(),request_object_encryption_alg_values_supported:Z(Y()).optional(),request_object_encryption_enc_values_supported:Z(Y()).optional(),token_endpoint_auth_methods_supported:Z(Y()).optional(),token_endpoint_auth_signing_alg_values_supported:Z(Y()).optional(),display_values_supported:Z(Y()).optional(),claim_types_supported:Z(Y()).optional(),claims_supported:Z(Y()).optional(),service_documentation:Y().optional(),claims_locales_supported:Z(Y()).optional(),ui_locales_supported:Z(Y()).optional(),claims_parameter_supported:s6().optional(),request_parameter_supported:s6().optional(),request_uri_parameter_supported:s6().optional(),require_request_uri_registration:s6().optional(),op_policy_uri:C7.optional(),op_tos_uri:C7.optional(),client_id_metadata_document_supported:s6().optional(),authorization_response_iss_parameter_supported:s6().optional().catch(void 0)}),ZMe=Q({...T7.shape,...w7.pick({code_challenge_methods_supported:!0}).shape}),QMe=Q({access_token:Y(),id_token:Y().optional(),token_type:Y(),expires_in:wMe().optional(),scope:Y().optional(),refresh_token:Y().optional(),issuer:Y().optional().catch(void 0)}).strip(),$Me=Q({issued_token_type:$(`urn:ietf:params:oauth:token-type:id-jag`),access_token:Y(),token_type:Y().optional(),expires_in:X().optional(),scope:Y().optional()}).strip(),eNe=Q({error:Y(),error_description:Y().optional(),error_uri:Y().optional()}),E7=C7.optional().or($(``).transform(()=>void 0)),D7=Q({redirect_uris:Z(C7),token_endpoint_auth_method:Y().optional(),grant_types:Z(Y()).optional(),response_types:Z(Y()).optional(),application_type:Y().optional(),client_name:Y().optional(),client_uri:C7.optional(),logo_uri:E7,scope:Y().optional(),contacts:Z(Y()).optional(),tos_uri:E7,policy_uri:Y().optional(),jwks_uri:C7.optional(),jwks:u6().optional(),software_id:Y().optional(),software_version:Y().optional(),software_statement:Y().optional()}).strip(),O7=Q({client_id:Y(),client_secret:Y().optional(),client_id_issued_at:X().optional(),client_secret_expires_at:X().optional(),issuer:Y().optional().catch(void 0)}).strip(),tNe=D7.merge(O7),nNe=Q({error:Y(),error_description:Y().optional()}).strip(),rNe=Q({token:Y(),token_type_hint:Y().optional()}).strip(),k7=Symbol.for(`mcp.sdk.errorBrands`);function A7(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,k7,{value:n,enumerable:!1,configurable:!0})}function j7(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,k7)){let n=t[k7];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,A7(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});var M7=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),N7=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,A7(this,new.target)}};(class extends N7{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var iNe=`2026-07-28`;function aNe(e){return e>=iNe}function P7(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var F7=[`task`,`inputRequests`,`requestState`];function oNe(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||F7.some(t=>t in e)?e:{...e,content:[]}}function sNe(){let e=j6(()=>g6([Y(),X(),s6(),l6(),b6(Y(),e),Z(e)])),t=b6(Y(),e),n=g6([Y(),X().int()]),r=Y(),i=Q({ttl:X().optional()}),a=Q({taskId:Y()}),o=m6({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=Q({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=Q({method:Y(),params:s.loose().optional()}),u=Q({_meta:o.optional()}),d=Q({method:Y(),params:u.loose().optional()}),f=m6({_meta:o.optional()}),p=g6([Y(),X().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:Y().optional()}),g=d.extend({method:$(`notifications/cancelled`),params:h}),_=Q({src:Y(),mimeType:Y().optional(),sizes:Z(Y()).optional(),theme:S6([`light`,`dark`]).optional()}),v=Q({icons:Z(_).optional()}),y=Q({name:Y(),title:Y().optional()}),b=y.extend({...y.shape,...v.shape,version:Y(),websiteUrl:Y().optional(),description:Y().optional()}),x=M6(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,v6(Q({form:v6(Q({applyDefaults:s6().optional()}),t).optional(),url:t.optional()}),t.optional())),S=m6({list:t.optional(),cancel:t.optional(),requests:m6({sampling:m6({createMessage:t.optional()}).optional(),elicitation:m6({create:t.optional()}).optional()}).optional()}),C=m6({list:t.optional(),cancel:t.optional(),requests:m6({tools:m6({call:t.optional()}).optional()}).optional()}),w=Q({experimental:b6(Y(),t).optional(),sampling:Q({context:t.optional(),tools:t.optional()}).optional(),elicitation:x.optional(),roots:Q({listChanged:s6().optional()}).optional(),tasks:S.optional(),extensions:b6(Y(),t).optional()}),T=s.extend({protocolVersion:Y(),capabilities:w,clientInfo:b}),E=l.extend({method:$(`initialize`),params:T}),D=Q({experimental:b6(Y(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:Q({listChanged:s6().optional()}).optional(),resources:Q({subscribe:s6().optional(),listChanged:s6().optional()}).optional(),tools:Q({listChanged:s6().optional()}).optional(),tasks:C.optional(),extensions:b6(Y(),t).optional()}),O=f.extend({protocolVersion:Y(),capabilities:D,serverInfo:b,instructions:Y().optional()}),k=d.extend({method:$(`notifications/initialized`),params:u.optional()}),A=l.extend({method:$(`ping`),params:s.optional()}),j=Q({progress:X(),total:T6(X()),message:T6(Y())}),M=Q({...u.shape,...j.shape,progressToken:n}),N=d.extend({method:$(`notifications/progress`),params:M}),P=s.extend({cursor:r.optional()}),F=l.extend({params:P.optional()}),ee=f.extend({nextCursor:r.optional()}),I=Q({uri:Y(),mimeType:T6(Y()),_meta:b6(Y(),d6()).optional()}),te=I.extend({text:Y()}),L=Y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),ne=I.extend({blob:L}),re=S6([`user`,`assistant`]),ie=Q({audience:Z(re).optional(),priority:X().min(0).max(1).optional(),lastModified:N6({offset:!0}).optional()}),ae=Q({...y.shape,...v.shape,uri:Y(),description:T6(Y()),mimeType:T6(Y()),size:T6(X()),annotations:ie.optional(),_meta:T6(m6({}))}),oe=Q({...y.shape,...v.shape,uriTemplate:Y(),description:T6(Y()),mimeType:T6(Y()),annotations:ie.optional(),_meta:T6(m6({}))}),se=F.extend({method:$(`resources/list`)}),ce=ee.extend({resources:Z(ae)}),le=F.extend({method:$(`resources/templates/list`)}),ue=ee.extend({resourceTemplates:Z(oe)}),de=s.extend({uri:Y()}),fe=de,R=l.extend({method:$(`resources/read`),params:fe}),pe=f.extend({contents:Z(g6([te,ne]))}),me=d.extend({method:$(`notifications/resources/list_changed`),params:u.optional()}),he=de,ge=l.extend({method:$(`resources/subscribe`),params:he}),_e=de,ve=l.extend({method:$(`resources/unsubscribe`),params:_e}),ye=u.extend({uri:Y()}),be=d.extend({method:$(`notifications/resources/updated`),params:ye}),xe=Q({name:Y(),description:T6(Y()),required:T6(s6())}),Se=Q({...y.shape,...v.shape,description:T6(Y()),arguments:T6(Z(xe)),_meta:T6(m6({}))}),Ce=F.extend({method:$(`prompts/list`)}),we=ee.extend({prompts:Z(Se)}),Te=s.extend({name:Y(),arguments:b6(Y(),Y()).optional()}),Ee=l.extend({method:$(`prompts/get`),params:Te}),De=Q({type:$(`text`),text:Y(),annotations:ie.optional(),_meta:b6(Y(),d6()).optional()}),Oe=Q({type:$(`image`),data:L,mimeType:Y(),annotations:ie.optional(),_meta:b6(Y(),d6()).optional()}),ke=Q({type:$(`audio`),data:L,mimeType:Y(),annotations:ie.optional(),_meta:b6(Y(),d6()).optional()}),Ae=Q({type:$(`tool_use`),name:Y(),id:Y(),input:b6(Y(),d6()),_meta:b6(Y(),d6()).optional()}),je=Q({type:$(`resource`),resource:g6([te,ne]),annotations:ie.optional(),_meta:b6(Y(),d6()).optional()}),Me=ae.extend({type:$(`resource_link`)}),Ne=g6([De,Oe,ke,Me,je]),Pe=Q({role:re,content:Ne}),Fe=f.extend({description:Y().optional(),messages:Z(Pe)}),Ie=d.extend({method:$(`notifications/prompts/list_changed`),params:u.optional()}),Le=Q({title:Y().optional(),readOnlyHint:s6().optional(),destructiveHint:s6().optional(),idempotentHint:s6().optional(),openWorldHint:s6().optional()}),Re=Q({taskSupport:S6([`required`,`optional`,`forbidden`]).optional()}),ze=Q({...y.shape,...v.shape,description:Y().optional(),inputSchema:Q({type:$(`object`),properties:b6(Y(),e).optional(),required:Z(Y()).optional()}).catchall(d6()),outputSchema:Q({type:$(`object`),properties:b6(Y(),e).optional(),required:Z(Y()).optional()}).catchall(d6()).optional(),annotations:Le.optional(),execution:Re.optional(),_meta:b6(Y(),d6()).optional()}),Be=F.extend({method:$(`tools/list`)}),Ve=ee.extend({tools:Z(ze)}),He=f.extend({content:Z(Ne),structuredContent:b6(Y(),d6()).optional(),isError:s6().optional()}),Ue=c.extend({name:Y(),arguments:b6(Y(),d6()).optional()}),We=l.extend({method:$(`tools/call`),params:Ue}),Ge=d.extend({method:$(`notifications/tools/list_changed`),params:u.optional()}),Ke=S6([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),qe=s.extend({level:Ke}),Je=l.extend({method:$(`logging/setLevel`),params:qe}),Ye=u.extend({level:Ke,logger:Y().optional(),data:d6()}),Xe=d.extend({method:$(`notifications/message`),params:Ye}),Ze=Q({name:Y().optional()}),Qe=Q({hints:Z(Ze).optional(),costPriority:X().min(0).max(1).optional(),speedPriority:X().min(0).max(1).optional(),intelligencePriority:X().min(0).max(1).optional()}),$e=Q({mode:S6([`auto`,`required`,`none`]).optional()}),et=Q({type:$(`tool_result`),toolUseId:Y().describe(`The unique identifier for the corresponding tool call.`),content:Z(Ne),structuredContent:Q({}).loose().optional(),isError:s6().optional(),_meta:b6(Y(),d6()).optional()}),tt=_6(`type`,[De,Oe,ke]),nt=_6(`type`,[De,Oe,ke,Ae,et]),rt=Q({role:re,content:g6([nt,Z(nt)]),_meta:b6(Y(),d6()).optional()}),it=c.extend({messages:Z(rt),modelPreferences:Qe.optional(),systemPrompt:Y().optional(),includeContext:S6([`none`,`thisServer`,`allServers`]).optional(),temperature:X().optional(),maxTokens:X().int(),stopSequences:Z(Y()).optional(),metadata:t.optional(),tools:Z(ze).optional(),toolChoice:$e.optional()}),at=l.extend({method:$(`sampling/createMessage`),params:it}),ot=f.extend({model:Y(),stopReason:T6(S6([`endTurn`,`stopSequence`,`maxTokens`]).or(Y())),role:re,content:tt}),st=f.extend({model:Y(),stopReason:T6(S6([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(Y())),role:re,content:g6([nt,Z(nt)])}),ct=Q({type:$(`boolean`),title:Y().optional(),description:Y().optional(),default:s6().optional()}),lt=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),minLength:X().optional(),maxLength:X().optional(),format:S6([`email`,`uri`,`date`,`date-time`]).optional(),default:Y().optional()}),ut=Q({type:S6([`number`,`integer`]),title:Y().optional(),description:Y().optional(),minimum:X().optional(),maximum:X().optional(),default:X().optional()}),dt=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),default:Y().optional()}),ft=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),oneOf:Z(Q({const:Y(),title:Y()})),default:Y().optional()}),pt=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),enumNames:Z(Y()).optional(),default:Y().optional()}),mt=g6([dt,ft]),ht=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({type:$(`string`),enum:Z(Y())}),default:Z(Y()).optional()}),gt=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({anyOf:Z(Q({const:Y(),title:Y()}))}),default:Z(Y()).optional()}),_t=g6([ht,gt]),vt=g6([pt,mt,_t]),yt=g6([vt,ct,lt,ut]),bt=c.extend({mode:$(`form`).optional(),message:Y(),requestedSchema:Q({type:$(`object`),properties:b6(Y(),yt),required:Z(Y()).optional()}).catchall(d6())}),xt=c.extend({mode:$(`url`),message:Y(),elicitationId:Y(),url:Y().url()}),St=g6([bt,xt]),Ct=l.extend({method:$(`elicitation/create`),params:St}),wt=u.extend({elicitationId:Y()}),Tt=d.extend({method:$(`notifications/elicitation/complete`),params:wt}),Et=f.extend({action:S6([`accept`,`decline`,`cancel`]),content:M6(e=>e===null?void 0:e,b6(Y(),g6([Y(),X(),s6(),Z(Y())])).optional())}),Dt=Q({type:$(`ref/resource`),uri:Y()}),Ot=Q({type:$(`ref/prompt`),name:Y()}),kt=s.extend({ref:g6([Ot,Dt]),argument:Q({name:Y(),value:Y()}),context:Q({arguments:b6(Y(),Y()).optional()}).optional()}),At=l.extend({method:$(`completion/complete`),params:kt}),jt=f.extend({completion:m6({values:Z(Y()).max(100),total:T6(X().int()),hasMore:T6(s6())})}),Mt=Q({uri:Y().startsWith(`file://`),name:Y().optional(),_meta:b6(Y(),d6()).optional()}),Nt=l.extend({method:$(`roots/list`),params:s.optional()}),Pt=f.extend({roots:Z(Mt)}),Ft=d.extend({method:$(`notifications/roots/list_changed`),params:u.optional()}),It=m6({ttl:X().optional(),pollInterval:X().optional()}),Lt=S6([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Rt=Q({taskId:Y(),status:Lt,ttl:g6([X(),l6()]),createdAt:Y(),lastUpdatedAt:Y(),pollInterval:T6(X()),statusMessage:T6(Y())}),zt=f.extend({task:Rt}),Bt=u.merge(Rt),Vt=d.extend({method:$(`notifications/tasks/status`),params:Bt}),Ht=l.extend({method:$(`tasks/get`),params:s.extend({taskId:Y()})}),Ut=f.merge(Rt),Wt=l.extend({method:$(`tasks/result`),params:s.extend({taskId:Y()})}),Gt=f.loose(),Kt=F.extend({method:$(`tasks/list`)}),qt=ee.extend({tasks:Z(Rt)}),Jt=l.extend({method:$(`tasks/cancel`),params:s.extend({taskId:Y()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:g,IconSchema:_,IconsSchema:v,BaseMetadataSchema:y,ImplementationSchema:b,ClientTasksCapabilitySchema:S,ServerTasksCapabilitySchema:C,ClientCapabilitiesSchema:w,InitializeRequestParamsSchema:T,InitializeRequestSchema:E,ServerCapabilitiesSchema:D,InitializeResultSchema:O,InitializedNotificationSchema:k,PingRequestSchema:A,ProgressSchema:j,ProgressNotificationParamsSchema:M,ProgressNotificationSchema:N,PaginatedRequestParamsSchema:P,PaginatedRequestSchema:F,PaginatedResultSchema:ee,ResourceContentsSchema:I,TextResourceContentsSchema:te,BlobResourceContentsSchema:ne,RoleSchema:re,AnnotationsSchema:ie,ResourceSchema:ae,ResourceTemplateSchema:oe,ListResourcesRequestSchema:se,ListResourcesResultSchema:ce,ListResourceTemplatesRequestSchema:le,ListResourceTemplatesResultSchema:ue,ResourceRequestParamsSchema:de,ReadResourceRequestParamsSchema:fe,ReadResourceRequestSchema:R,ReadResourceResultSchema:pe,ResourceListChangedNotificationSchema:me,SubscribeRequestParamsSchema:he,SubscribeRequestSchema:ge,UnsubscribeRequestParamsSchema:_e,UnsubscribeRequestSchema:ve,ResourceUpdatedNotificationParamsSchema:ye,ResourceUpdatedNotificationSchema:be,PromptArgumentSchema:xe,PromptSchema:Se,ListPromptsRequestSchema:Ce,ListPromptsResultSchema:we,GetPromptRequestParamsSchema:Te,GetPromptRequestSchema:Ee,TextContentSchema:De,ImageContentSchema:Oe,AudioContentSchema:ke,ToolUseContentSchema:Ae,EmbeddedResourceSchema:je,ResourceLinkSchema:Me,ContentBlockSchema:Ne,PromptMessageSchema:Pe,GetPromptResultSchema:Fe,PromptListChangedNotificationSchema:Ie,ToolAnnotationsSchema:Le,ToolExecutionSchema:Re,ToolSchema:ze,ListToolsRequestSchema:Be,ListToolsResultSchema:Ve,CallToolResultSchema:He,CallToolRequestParamsSchema:Ue,CallToolRequestSchema:We,ToolListChangedNotificationSchema:Ge,LoggingLevelSchema:Ke,SetLevelRequestParamsSchema:qe,SetLevelRequestSchema:Je,LoggingMessageNotificationParamsSchema:Ye,LoggingMessageNotificationSchema:Xe,ModelHintSchema:Ze,ModelPreferencesSchema:Qe,ToolChoiceSchema:$e,ToolResultContentSchema:et,SamplingContentSchema:tt,SamplingMessageContentBlockSchema:nt,SamplingMessageSchema:rt,CreateMessageRequestParamsSchema:it,CreateMessageRequestSchema:at,CreateMessageResultSchema:ot,CreateMessageResultWithToolsSchema:st,BooleanSchemaSchema:ct,StringSchemaSchema:lt,NumberSchemaSchema:ut,UntitledSingleSelectEnumSchemaSchema:dt,TitledSingleSelectEnumSchemaSchema:ft,LegacyTitledEnumSchemaSchema:pt,SingleSelectEnumSchemaSchema:mt,UntitledMultiSelectEnumSchemaSchema:ht,TitledMultiSelectEnumSchemaSchema:gt,MultiSelectEnumSchemaSchema:_t,EnumSchemaSchema:vt,PrimitiveSchemaDefinitionSchema:yt,ElicitRequestFormParamsSchema:bt,ElicitRequestURLParamsSchema:xt,ElicitRequestParamsSchema:St,ElicitRequestSchema:Ct,ElicitationCompleteNotificationParamsSchema:wt,ElicitationCompleteNotificationSchema:Tt,ElicitResultSchema:Et,ResourceTemplateReferenceSchema:Dt,PromptReferenceSchema:Ot,CompleteRequestParamsSchema:kt,CompleteRequestSchema:At,CompleteResultSchema:jt,RootSchema:Mt,ListRootsRequestSchema:Nt,ListRootsResultSchema:Pt,RootsListChangedNotificationSchema:Ft,TaskCreationParamsSchema:It,TaskStatusSchema:Lt,TaskSchema:Rt,CreateTaskResultSchema:zt,TaskStatusNotificationParamsSchema:Bt,TaskStatusNotificationSchema:Vt,GetTaskRequestSchema:Ht,GetTaskResultSchema:Ut,GetTaskPayloadRequestSchema:Wt,GetTaskPayloadResultSchema:Gt,ListTasksRequestSchema:Kt,ListTasksResultSchema:qt,CancelTaskRequestSchema:Jt,CancelTaskResultSchema:f.merge(Rt),ClientRequestSchema:g6([A,E,At,Je,Ee,Ce,se,le,R,ge,ve,We,Be,Ht,Wt,Kt,Jt]),ClientNotificationSchema:g6([g,N,k,Ft,Vt]),ClientResultSchema:g6([m,ot,st,Et,Pt,Ut,qt,zt]),ServerRequestSchema:g6([A,at,Ct,Nt,Ht,Wt,Kt,Jt]),ServerNotificationSchema:g6([g,N,Xe,be,me,Ge,Ie,Vt,Tt]),ServerResultSchema:g6([m,O,jt,Fe,we,ce,ue,pe,He,Ve,Ut,qt,zt]),CallToolResultWireSchema:d6().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of F7)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(oNe).pipe(He)}}var cNe;function I7(){return cNe??=sNe()}function L7(e){return e.type!==`object`}var lNe=new Set([`const`,`enum`,`default`,`examples`]),uNe=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function R7(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function dNe(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(R7(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=ZEe(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&R7(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=lNe.has(o)?s:uNe.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var z7={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},B7={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},fNe={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},V7;function H7(){if(V7)return V7;let e=I7();return V7={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},V7}function U7(e){return Object.prototype.hasOwnProperty.call(z7,e)}function W7(e){return Object.prototype.hasOwnProperty.call(B7,e)}function pNe(e){return Object.prototype.hasOwnProperty.call(fNe,e)}function mNe(e){return pNe(e)?H7().resultSchemas[e]:void 0}function hNe(e){return U7(e)?H7().requestSchemas[e]:void 0}function gNe(e){return W7(e)?H7().notificationSchemas[e]:void 0}Object.keys(z7),Object.keys(B7);function G7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K7(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var q7={ok:!1,reason:`not-in-era`};function J7(e){return G7(e)&&G7(e.outputSchema)&&L7(e.outputSchema)}function Y7(e){return e}var X7={era:`2025-11-25`,hasRequestMethod:U7,hasNotificationMethod:W7,validateRequest:(e,t)=>K7(hNe(e),t),validateResult:(e,t)=>K7(mNe(e),t),validateNotification:(e,t)=>K7(gNe(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>q7,validateInputResponse:()=>q7,samplingResultVariant:((e,t)=>{let n=I7();return K7(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=P7(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&L7(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(G7(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Y7(e)}}return{kind:`complete`,result:Y7(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>J7(e))?t:{...t,tools:n.map(e=>J7(e)?{...e,outputSchema:dNe(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function _Ne(){let e=j6(()=>g6([Y(),X(),s6(),l6(),b6(Y(),e),Z(e)])),t=b6(Y(),e),n=g6([Y(),X().int()]),r=Y(),i=g6([Y(),X().int()]),a=S6([`user`,`assistant`]),o=S6([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=Y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=Q({ttl:X().optional()}),l=Q({taskId:Y()}),u=m6({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=Q({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=Q({_meta:u.optional()}),m=Q({method:Y(),params:p.loose().optional()}),h=Q({src:Y(),mimeType:Y().optional(),sizes:Z(Y()).optional(),theme:S6([`light`,`dark`]).optional()}),g=Q({icons:Z(h).optional()}),_=Q({name:Y(),title:Y().optional()}),v=_.extend({..._.shape,...g.shape,version:Y(),websiteUrl:Y().optional(),description:Y().optional()}),y=M6(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,v6(Q({form:v6(Q({applyDefaults:s6().optional()}),t).optional(),url:t.optional()}),t.optional())),b=m6({list:t.optional(),cancel:t.optional(),requests:m6({sampling:m6({createMessage:t.optional()}).optional(),elicitation:m6({create:t.optional()}).optional()}).optional()}),x=m6({list:t.optional(),cancel:t.optional(),requests:m6({tools:m6({call:t.optional()}).optional()}).optional()}),S=Q({experimental:b6(Y(),t).optional(),sampling:Q({context:t.optional(),tools:t.optional()}).optional(),elicitation:y.optional(),roots:Q({listChanged:s6().optional()}).optional(),tasks:b.optional(),extensions:b6(Y(),t).optional()}),C=Q({experimental:b6(Y(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:Q({listChanged:s6().optional()}).optional(),resources:Q({subscribe:s6().optional(),listChanged:s6().optional()}).optional(),tools:Q({listChanged:s6().optional()}).optional(),tasks:x.optional(),extensions:b6(Y(),t).optional()}),w=Q({progress:X(),total:T6(X()),message:T6(Y())}),T=Q({...p.shape,...w.shape,progressToken:n}),E=m.extend({method:$(`notifications/progress`),params:T}),D=p.extend({level:o,logger:Y().optional(),data:d6()}),O=m.extend({method:$(`notifications/message`),params:D}),k=Q({uri:Y(),mimeType:T6(Y()),_meta:b6(Y(),d6()).optional()}),A=k.extend({text:Y()}),j=k.extend({blob:s}),M=Q({audience:Z(a).optional(),priority:X().min(0).max(1).optional(),lastModified:N6({offset:!0}).optional()}),N=Q({..._.shape,...g.shape,uri:Y(),description:T6(Y()),mimeType:T6(Y()),size:T6(X()),annotations:M.optional(),_meta:T6(m6({}))}),P=Q({..._.shape,...g.shape,uriTemplate:Y(),description:T6(Y()),mimeType:T6(Y()),annotations:M.optional(),_meta:T6(m6({}))}),F=m.extend({method:$(`notifications/resources/list_changed`),params:p.optional()}),ee=p.extend({uri:Y()}),I=m.extend({method:$(`notifications/resources/updated`),params:ee}),te=Q({name:Y(),description:T6(Y()),required:T6(s6())}),L=Q({..._.shape,...g.shape,description:T6(Y()),arguments:T6(Z(te)),_meta:T6(m6({}))}),ne=m.extend({method:$(`notifications/prompts/list_changed`),params:p.optional()}),re=Q({type:$(`text`),text:Y(),annotations:M.optional(),_meta:b6(Y(),d6()).optional()}),ie=Q({type:$(`image`),data:s,mimeType:Y(),annotations:M.optional(),_meta:b6(Y(),d6()).optional()}),ae=Q({type:$(`audio`),data:s,mimeType:Y(),annotations:M.optional(),_meta:b6(Y(),d6()).optional()}),oe=Q({type:$(`tool_use`),name:Y(),id:Y(),input:b6(Y(),d6()),_meta:b6(Y(),d6()).optional()}),se=Q({type:$(`resource`),resource:g6([A,j]),annotations:M.optional(),_meta:b6(Y(),d6()).optional()}),ce=N.extend({type:$(`resource_link`)}),le=g6([re,ie,ae,ce,se]),ue=Q({role:a,content:le}),de=Q({title:Y().optional(),readOnlyHint:s6().optional(),destructiveHint:s6().optional(),idempotentHint:s6().optional(),openWorldHint:s6().optional()}),fe=m.extend({method:$(`notifications/tools/list_changed`),params:p.optional()}),R=Q({name:Y().optional()}),pe=Q({hints:Z(R).optional(),costPriority:X().min(0).max(1).optional(),speedPriority:X().min(0).max(1).optional(),intelligencePriority:X().min(0).max(1).optional()}),me=Q({mode:S6([`auto`,`required`,`none`]).optional()}),he=Q({type:$(`boolean`),title:Y().optional(),description:Y().optional(),default:s6().optional()}),ge=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),minLength:X().optional(),maxLength:X().optional(),format:S6([`email`,`uri`,`date`,`date-time`]).optional(),default:Y().optional()}),_e=Q({type:S6([`number`,`integer`]),title:Y().optional(),description:Y().optional(),minimum:X().optional(),maximum:X().optional(),default:X().optional()}),ve=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),default:Y().optional()}),ye=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),oneOf:Z(Q({const:Y(),title:Y()})),default:Y().optional()}),be=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),enumNames:Z(Y()).optional(),default:Y().optional()}),xe=g6([ve,ye]),Se=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({type:$(`string`),enum:Z(Y())}),default:Z(Y()).optional()}),Ce=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({anyOf:Z(Q({const:Y(),title:Y()}))}),default:Z(Y()).optional()}),we=g6([Se,Ce]),Te=g6([be,xe,we]),Ee=g6([Te,he,ge,_e]),De=f.extend({mode:$(`form`).optional(),message:Y(),requestedSchema:Q({type:$(`object`),properties:b6(Y(),Ee),required:Z(Y()).optional()}).catchall(d6())}),Oe=Q({type:$(`ref/resource`),uri:Y()}),ke=Q({type:$(`ref/prompt`),name:Y()}),Ae=Q({uri:Y().startsWith(`file://`),name:Y().optional(),_meta:b6(Y(),d6()).optional()}),je=S.shape,Me=Q({experimental:je.experimental,sampling:je.sampling,elicitation:je.elicitation,roots:je.roots,extensions:je.extensions}),Ne=C.shape,Pe=Q({experimental:Ne.experimental,logging:Ne.logging,completions:Ne.completions,prompts:Ne.prompts,resources:Ne.resources,tools:Ne.tools,extensions:Ne.extensions}),Fe=m6({progressToken:n.optional(),[P6]:Y(),[F6]:v.optional(),[L6]:Me,[R6]:o.optional()}),Ie=Q({..._.shape,...g.shape,description:Y().optional(),inputSchema:m6({$schema:Y().optional(),type:$(`object`)}),outputSchema:m6({$schema:Y().optional()}).optional(),annotations:de.optional(),_meta:b6(Y(),d6()).optional()}),Le=Q({type:$(`tool_result`),toolUseId:Y(),content:Z(le),structuredContent:d6().optional(),isError:s6().optional(),_meta:b6(Y(),d6()).optional()}),Re=g6([re,ie,ae,oe,Le]),ze=Q({role:a,content:g6([Re,Z(Re)]),_meta:b6(Y(),d6()).optional()}),Be=Y(),Ve=m6({[I6]:v.optional().catch(void 0)}),He=Ve.optional();function Ue(e){return m6({_meta:He,resultType:Be.default(`complete`),...e})}let We=Ue({}),Ge=Ue({nextCursor:r.optional()}),Ke=Ue({content:Z(le),structuredContent:d6().optional(),isError:s6().optional()}),qe=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),tools:Z(Ie),nextCursor:r.optional()}),Je=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),prompts:Z(L),nextCursor:r.optional()}),Ye=Ue({description:Y().optional(),messages:Z(ue)}),Xe=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),resources:Z(N),nextCursor:r.optional()}),Ze=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),resourceTemplates:Z(P),nextCursor:r.optional()}),Qe=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),contents:Z(g6([A,j]))}),$e=Ue({completion:Q({values:Z(Y()).max(100),total:X().int().optional(),hasMore:s6().optional()}).loose()}),et=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`])}),tt=Ue({ttlMs:X().int().min(0).catch(0),cacheScope:S6([`public`,`private`]).catch(`private`),supportedVersions:Z(Y()),capabilities:Pe,instructions:Y().optional()}),nt=Q({messages:Z(ze),modelPreferences:pe.optional(),systemPrompt:Y().optional(),includeContext:S6([`none`,`thisServer`,`allServers`]).optional(),temperature:X().optional(),maxTokens:X().int(),stopSequences:Z(Y()).optional(),metadata:t.optional(),tools:Z(Ie).optional(),toolChoice:me.optional()}),rt=Q({method:$(`sampling/createMessage`),params:nt}),it=Q({method:$(`roots/list`),params:Q({_meta:b6(Y(),d6()).optional()}).optional()}),at=Q({...ze.shape,model:Y(),stopReason:Y().optional()}),ot=Q({roots:Z(Ae)}),st=Q({action:S6([`accept`,`decline`,`cancel`]),content:b6(Y(),g6([Y(),X(),s6(),Z(Y())])).optional()}),ct=Q({mode:$(`url`),message:Y(),url:Y().url()}),lt=g6([De,ct]),ut=Q({method:$(`elicitation/create`),params:lt}),dt=g6([rt,it,ut]),ft=g6([at,ot,st]),pt=b6(Y(),dt),mt=b6(Y(),ft),ht=Ue({inputRequests:pt.optional(),requestState:Y().optional()}),gt={inputResponses:mt.optional(),requestState:Y().optional()},_t=Q({_meta:Fe,...gt}),vt=m6({progressToken:n.optional()});function yt(e,t){return Q({method:$(e),params:Q({_meta:Fe,...t})})}function bt(e,t){return Q({method:$(e),params:Q({_meta:vt.optional(),...t}).optional()})}let xt={name:Y(),arguments:b6(Y(),d6()).optional(),...gt},St={cursor:r.optional()},Ct=yt(`tools/call`,xt),wt=yt(`tools/list`,St),Tt=yt(`prompts/list`,St),Et=yt(`prompts/get`,{name:Y(),arguments:b6(Y(),Y()).optional(),...gt}),Dt=yt(`resources/list`,St),Ot=yt(`resources/templates/list`,St),kt=yt(`resources/read`,{uri:Y(),...gt}),At={ref:g6([ke,Oe]),argument:Q({name:Y(),value:Y()}),context:Q({arguments:b6(Y(),Y()).optional()}).optional()},jt=yt(`completion/complete`,At),Mt=yt(`server/discover`,{}),Nt=Q({toolsListChanged:s6().optional(),promptsListChanged:s6().optional(),resourcesListChanged:s6().optional(),resourceSubscriptions:Z(Y()).optional()}),Pt={notifications:Nt},Ft=yt(`subscriptions/listen`,Pt),It=Ve.extend({"io.modelcontextprotocol/subscriptionId":i}),Lt=m6({_meta:It,resultType:Be.default(`complete`)}),Rt={"tools/call":bt(`tools/call`,xt),"tools/list":bt(`tools/list`,St),"prompts/get":bt(`prompts/get`,{name:Y(),arguments:b6(Y(),Y()).optional()}),"prompts/list":bt(`prompts/list`,St),"resources/list":bt(`resources/list`,St),"resources/templates/list":bt(`resources/templates/list`,St),"resources/read":bt(`resources/read`,{uri:Y()}),"completion/complete":bt(`completion/complete`,At),"server/discover":bt(`server/discover`,{}),"subscriptions/listen":bt(`subscriptions/listen`,Pt)};function zt(e){return m6({_meta:He,...e})}let Bt={"tools/call":zt({content:Z(le),structuredContent:d6().optional(),isError:s6().optional()}),"tools/list":zt({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),tools:Z(Ie),nextCursor:r.optional()}),"prompts/get":zt({description:Y().optional(),messages:Z(ue)}),"prompts/list":zt({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),prompts:Z(L),nextCursor:r.optional()}),"resources/list":zt({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),resources:Z(N),nextCursor:r.optional()}),"resources/templates/list":zt({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),resourceTemplates:Z(P),nextCursor:r.optional()}),"resources/read":zt({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),contents:Z(g6([A,j]))}),"completion/complete":zt({completion:Q({values:Z(Y()).max(100),total:X().int().optional(),hasMore:s6().optional()}).loose()}),"server/discover":zt({ttlMs:X().int().min(0).catch(0),cacheScope:S6([`public`,`private`]).catch(`private`),supportedVersions:Z(Y()),capabilities:Pe,instructions:Y().optional()}),"subscriptions/listen":zt({})},Vt=m6({"io.modelcontextprotocol/subscriptionId":i.optional()}),Ht=Q({method:$(`notifications/subscriptions/acknowledged`),params:Q({_meta:Vt.optional(),notifications:Nt})}),Ut=Q({_meta:Vt.optional(),requestId:i,reason:Y().optional()}),Wt=Q({method:$(`notifications/cancelled`),params:Ut}),Gt={"notifications/cancelled":Wt,"notifications/progress":E,"notifications/message":O,"notifications/resources/updated":I,"notifications/resources/list_changed":F,"notifications/tools/list_changed":fe,"notifications/prompts/list_changed":ne,"notifications/subscriptions/acknowledged":Ht},Kt=e=>Q({jsonrpc:$(`2.0`),id:g6([Y(),X().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:g,BaseMetadataSchema:_,ImplementationSchema:v,ClientTasksCapabilitySchema:b,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:S,ServerCapabilitiesSchema:C,ProgressSchema:w,ProgressNotificationParamsSchema:T,ProgressNotificationSchema:E,LoggingMessageNotificationParamsSchema:D,LoggingMessageNotificationSchema:O,ResourceContentsSchema:k,TextResourceContentsSchema:A,BlobResourceContentsSchema:j,AnnotationsSchema:M,ResourceSchema:N,ResourceTemplateSchema:P,ResourceListChangedNotificationSchema:F,ResourceUpdatedNotificationParamsSchema:ee,ResourceUpdatedNotificationSchema:I,PromptArgumentSchema:te,PromptSchema:L,PromptListChangedNotificationSchema:ne,TextContentSchema:re,ImageContentSchema:ie,AudioContentSchema:ae,ToolUseContentSchema:oe,EmbeddedResourceSchema:se,ResourceLinkSchema:ce,ContentBlockSchema:le,PromptMessageSchema:ue,ToolAnnotationsSchema:de,ToolListChangedNotificationSchema:fe,ModelHintSchema:R,ModelPreferencesSchema:pe,ToolChoiceSchema:me,BooleanSchemaSchema:he,StringSchemaSchema:ge,NumberSchemaSchema:_e,UntitledSingleSelectEnumSchemaSchema:ve,TitledSingleSelectEnumSchemaSchema:ye,LegacyTitledEnumSchemaSchema:be,SingleSelectEnumSchemaSchema:xe,UntitledMultiSelectEnumSchemaSchema:Se,TitledMultiSelectEnumSchemaSchema:Ce,MultiSelectEnumSchemaSchema:we,EnumSchemaSchema:Te,PrimitiveSchemaDefinitionSchema:Ee,ElicitRequestFormParamsSchema:De,ResourceTemplateReferenceSchema:Oe,PromptReferenceSchema:ke,RootSchema:Ae,ClientCapabilities2026Schema:Me,ServerCapabilities2026Schema:Pe,RequestMetaEnvelopeSchema:Fe,ToolSchema:Ie,ToolResultContentSchema:Le,SamplingMessageContentBlockSchema:Re,SamplingMessageSchema:ze,ResultTypeSchema:Be,ResultMetaSchema:Ve,ResultSchema:We,PaginatedResultSchema:Ge,CallToolResultSchema:Ke,ListToolsResultSchema:qe,ListPromptsResultSchema:Je,GetPromptResultSchema:Ye,ListResourcesResultSchema:Xe,ListResourceTemplatesResultSchema:Ze,ReadResourceResultSchema:Qe,CompleteResultSchema:$e,CacheableResultSchema:et,DiscoverResultSchema:tt,CreateMessageRequestParamsSchema:nt,CreateMessageRequestSchema:rt,ListRootsRequestSchema:it,CreateMessageResultSchema:at,ListRootsResultSchema:ot,ElicitResultSchema:st,ElicitRequestURLParamsSchema:ct,ElicitRequestParamsSchema:lt,ElicitRequestSchema:ut,InputRequestSchema:dt,InputResponseSchema:ft,InputRequestsSchema:pt,InputResponsesSchema:mt,InputRequiredResultSchema:ht,InputResponseRequestParamsSchema:_t,CallToolRequestSchema:Ct,ListToolsRequestSchema:wt,ListPromptsRequestSchema:Tt,GetPromptRequestSchema:Et,ListResourcesRequestSchema:Dt,ListResourceTemplatesRequestSchema:Ot,ReadResourceRequestSchema:kt,CompleteRequestSchema:jt,DiscoverRequestSchema:Mt,SubscriptionFilterSchema:Nt,SubscriptionsListenRequestSchema:Ft,SubscriptionsListenResultMetaSchema:It,SubscriptionsListenResultSchema:Lt,dispatchRequestSchemas:Rt,dispatchResultSchemas:Bt,NotificationMetaSchema:Vt,SubscriptionsAcknowledgedNotificationSchema:Ht,CancelledNotificationParamsSchema:Ut,CancelledNotificationSchema:Wt,notificationSchemas2026:Gt,JSONRPCResultResponseSchema:Kt(We),CallToolResultResponseSchema:Kt(g6([Ke,ht])),ListToolsResultResponseSchema:Kt(qe),ListPromptsResultResponseSchema:Kt(Je),GetPromptResultResponseSchema:Kt(g6([Ye,ht])),ListResourcesResultResponseSchema:Kt(Xe),ListResourceTemplatesResultResponseSchema:Kt(Ze),ReadResourceResultResponseSchema:Kt(g6([Qe,ht])),CompleteResultResponseSchema:Kt($e),DiscoverResultResponseSchema:Kt(tt),SubscriptionsListenResultResponseSchema:Kt(Lt)}}var vNe;function Z7(){return vNe??=_Ne()}var yNe=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function bNe(e){return yNe.includes(e)}var Q7=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function xNe(e){return e[Q7]}function $7(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function e9(e){return e===`public`||e===`private`}var t9=function(e){return 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.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),n9=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,A7(this,new.target)}static fromError(t,n,r){if(t===t9.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new CNe(e.elicitations,n)}if(t===t9.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new wNe({supported:e.supported,requested:e.requested},n)}if(t===t9.InvalidParams||t===t9.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===t9.ResourceNotFound||Object.keys(e).length===1))return new SNe(e.uri,n)}if(t===t9.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new TNe({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},SNe=class extends n9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(t9.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},CNe=class extends n9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(t9.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},wNe=class extends n9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(t9.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},TNe=class extends n9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(t9.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},ENe=0,DNe=`private`,ONe=[`tools/call`,`prompts/get`,`resources/read`];function kNe(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||ONe.includes(e))return t;throw new n9(t9.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function ANe(e,t){let n=xNe(t);if(t.resultType!==`complete`||!bNe(e))return n===void 0?t:FNe(t);let r=t,i=$7(r.ttlMs)?r.ttlMs:NNe(n),a=e9(r.cacheScope)?r.cacheScope:PNe(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Q7],o}function jNe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function MNe(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[I6]:t}}:!jNe(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[I6]:t}}}function NNe(e){return e!==void 0&&$7(e.ttlMs)?e.ttlMs:ENe}function PNe(e){return e!==void 0&&e9(e.cacheScope)?e.cacheScope:DNe}function FNe(e){let t={...e};return delete t[Q7],t}var INe=[`elicitation/create`,`sampling/createMessage`,`roots/list`],r9;function i9(){if(r9)return r9;let e=Z7();return r9={request:{"elicitation/create":Q({method:$(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":Q({method:$(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":Q({method:$(`roots/list`),params:m6({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},r9}function a9(e){return INe.includes(e)}function o9(e){return a9(e)?i9().request[e]:void 0}function LNe(e){return a9(e)?i9().response[e]:void 0}var s9={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},c9={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function l9(e){return Object.prototype.hasOwnProperty.call(s9,e)}function u9(e){return Object.prototype.hasOwnProperty.call(c9,e)}function RNe(e){return Object.prototype.hasOwnProperty.call(s9,e)}function zNe(e){return l9(e)?Z7().dispatchRequestSchemas[e]:void 0}function BNe(e){return RNe(e)?Z7().dispatchResultSchemas[e]:void 0}function VNe(e){return u9(e)?Z7().notificationSchemas2026[e]:void 0}Object.keys(s9),Object.keys(c9);function d9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f9(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var HNe={ok:!1,reason:`not-in-era`},UNe=[P6,L6];function WNe(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>d9(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!d9(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(d9(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var p9={era:`2026-07-28`,hasRequestMethod:l9,hasNotificationMethod:u9,hasInputRequestMethod:e=>o9(e)!==void 0,validateRequest:(e,t)=>f9(zNe(e),t),validateResult:(e,t)=>f9(BNe(e),t),validateNotification:(e,t)=>f9(VNe(e),t),validateInputRequest:(e,t)=>f9(o9(e),t),validateInputResponse:(e,t)=>f9(LNe(e),t),samplingResultVariant:()=>HNe,outboundEnvelope(e){return{[P6]:e.protocolVersion,[F6]:e.clientInfo,[L6]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of UNe)n in e||t.push({key:n,problem:`missing`});let n=Z7().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>P7(e),inputRequestSchema:o9,decodeResult(e,t){if(!d9(t))return{kind:`invalid`,error:new N7(M7.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new N7(M7.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new N7(M7.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=d9(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:Z7().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new N7(M7.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new N7(M7.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=GNe(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new N7(M7.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return MNe(ANe(e,kNe(e,WNe(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=Z7().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},m9;function GNe(){if(m9)return m9;let e=Z7();return m9={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},m9}var KNe=`2026-07-28`;function h9(e){return e!==void 0&&aNe(e)?p9:X7}function g9(e){return e.revision===void 0?e.era===`modern`?p9.era:X7.era:h9(e.revision).era}function _9(e){return b9.some(t=>t.hasRequestMethod(e))}function v9(e){return b9.some(t=>t.hasNotificationMethod(e))}function y9(e){return e===`tasks/get`||e===`tasks/cancel`}var b9=[X7,p9],qNe=YEe({AnnotationsSchema:()=>P8,AudioContentSchema:()=>p5,BaseMetadataSchema:()=>u8,BaseRequestParamsSchema:()=>K6,BlobResourceContentsSchema:()=>M8,BooleanSchemaSchema:()=>K5,CallToolRequestParamsSchema:()=>D5,CallToolRequestSchema:()=>O5,CallToolResultSchema:()=>E5,CancelTaskRequestSchema:()=>HMe,CancelTaskResultSchema:()=>UMe,CancelledNotificationParamsSchema:()=>o8,CancelledNotificationSchema:()=>s8,ClientCapabilitiesSchema:()=>m8,ClientNotificationSchema:()=>GMe,ClientRequestSchema:()=>WMe,ClientResultSchema:()=>KMe,ClientTasksCapabilitySchema:()=>f8,CompatibilityCallToolResultSchema:()=>jMe,CompleteRequestParamsSchema:()=>p7,CompleteRequestSchema:()=>m7,CompleteResultSchema:()=>h7,ContentBlockSchema:()=>_5,CreateMessageRequestParamsSchema:()=>H5,CreateMessageRequestSchema:()=>U5,CreateMessageResultSchema:()=>W5,CreateMessageResultWithToolsSchema:()=>G5,CreateTaskResultSchema:()=>PMe,CursorSchema:()=>H6,DiscoverRequestSchema:()=>b8,DiscoverResultSchema:()=>x8,ElicitRequestFormParamsSchema:()=>i7,ElicitRequestParamsSchema:()=>o7,ElicitRequestSchema:()=>s7,ElicitRequestURLParamsSchema:()=>a7,ElicitResultSchema:()=>u7,ElicitationCompleteNotificationParamsSchema:()=>c7,ElicitationCompleteNotificationSchema:()=>l7,EmbeddedResourceSchema:()=>h5,EmptyResultSchema:()=>a8,EnumSchemaSchema:()=>n7,GetPromptRequestParamsSchema:()=>l5,GetPromptRequestSchema:()=>u5,GetPromptResultSchema:()=>y5,GetTaskPayloadRequestSchema:()=>RMe,GetTaskPayloadResultSchema:()=>zMe,GetTaskRequestSchema:()=>IMe,GetTaskResultSchema:()=>LMe,IconSchema:()=>c8,IconsSchema:()=>l8,ImageContentSchema:()=>f5,ImplementationSchema:()=>d8,InitializeRequestParamsSchema:()=>h8,InitializeRequestSchema:()=>g8,InitializeResultSchema:()=>v8,InitializedNotificationSchema:()=>y8,JSONArraySchema:()=>OMe,JSONObjectSchema:()=>B6,JSONRPCErrorResponseSchema:()=>r8,JSONRPCMessageSchema:()=>i8,JSONRPCNotificationSchema:()=>t8,JSONRPCRequestSchema:()=>e8,JSONRPCResponseSchema:()=>kMe,JSONRPCResultResponseSchema:()=>n8,JSONValueSchema:()=>z6,LegacyTitledEnumSchemaSchema:()=>Z5,ListChangedOptionsBaseSchema:()=>MMe,ListPromptsRequestSchema:()=>s5,ListPromptsResultSchema:()=>c5,ListResourceTemplatesRequestSchema:()=>z8,ListResourceTemplatesResultSchema:()=>B8,ListResourcesRequestSchema:()=>L8,ListResourcesResultSchema:()=>R8,ListRootsRequestSchema:()=>_7,ListRootsResultSchema:()=>v7,ListTasksRequestSchema:()=>BMe,ListTasksResultSchema:()=>VMe,ListToolsRequestSchema:()=>w5,ListToolsResultSchema:()=>T5,LoggingLevelSchema:()=>A5,LoggingMessageNotificationParamsSchema:()=>N5,LoggingMessageNotificationSchema:()=>P5,ModelHintSchema:()=>F5,ModelPreferencesSchema:()=>I5,MultiSelectEnumSchemaSchema:()=>t7,NotificationSchema:()=>X6,NotificationsParamsSchema:()=>Y6,NumberSchemaSchema:()=>J5,PaginatedRequestParamsSchema:()=>E8,PaginatedRequestSchema:()=>D8,PaginatedResultSchema:()=>O8,PingRequestSchema:()=>S8,PrimitiveSchemaDefinitionSchema:()=>r7,ProgressNotificationParamsSchema:()=>w8,ProgressNotificationSchema:()=>T8,ProgressSchema:()=>C8,ProgressTokenSchema:()=>V6,PromptArgumentSchema:()=>a5,PromptListChangedNotificationSchema:()=>b5,PromptMessageSchema:()=>v5,PromptReferenceSchema:()=>f7,PromptSchema:()=>o5,ReadResourceRequestParamsSchema:()=>H8,ReadResourceRequestSchema:()=>U8,ReadResourceResultSchema:()=>W8,RelatedTaskMetadataSchema:()=>W6,RequestIdSchema:()=>$6,RequestMetaSchema:()=>G6,RequestSchema:()=>J6,ResourceContentsSchema:()=>k8,ResourceLinkSchema:()=>g5,ResourceListChangedNotificationSchema:()=>G8,ResourceRequestParamsSchema:()=>V8,ResourceSchema:()=>F8,ResourceTemplateReferenceSchema:()=>d7,ResourceTemplateSchema:()=>I8,ResourceUpdatedNotificationParamsSchema:()=>r5,ResourceUpdatedNotificationSchema:()=>i5,ResultMetaObjectSchema:()=>Z6,ResultSchema:()=>Q6,RoleSchema:()=>N8,RootSchema:()=>g7,RootsListChangedNotificationSchema:()=>y7,SamplingContentSchema:()=>z5,SamplingMessageContentBlockSchema:()=>B5,SamplingMessageSchema:()=>V5,ServerCapabilitiesSchema:()=>_8,ServerNotificationSchema:()=>JMe,ServerRequestSchema:()=>qMe,ServerResultSchema:()=>YMe,ServerTasksCapabilitySchema:()=>p8,SetLevelRequestParamsSchema:()=>j5,SetLevelRequestSchema:()=>M5,SingleSelectEnumSchemaSchema:()=>Q5,StringSchemaSchema:()=>q5,SubscribeRequestParamsSchema:()=>K8,SubscribeRequestSchema:()=>q8,SubscriptionFilterSchema:()=>X8,SubscriptionsAcknowledgedNotificationParamsSchema:()=>$8,SubscriptionsAcknowledgedNotificationSchema:()=>e5,SubscriptionsListenRequestParamsSchema:()=>Z8,SubscriptionsListenRequestSchema:()=>Q8,SubscriptionsListenResultMetaSchema:()=>t5,SubscriptionsListenResultSchema:()=>n5,TaskAugmentedRequestParamsSchema:()=>q6,TaskCreationParamsSchema:()=>NMe,TaskMetadataSchema:()=>U6,TaskSchema:()=>x7,TaskStatusNotificationParamsSchema:()=>S7,TaskStatusNotificationSchema:()=>FMe,TaskStatusSchema:()=>b7,TextContentSchema:()=>d5,TextResourceContentsSchema:()=>A8,TitledMultiSelectEnumSchemaSchema:()=>e7,TitledSingleSelectEnumSchemaSchema:()=>X5,ToolAnnotationsSchema:()=>x5,ToolChoiceSchema:()=>L5,ToolExecutionSchema:()=>S5,ToolListChangedNotificationSchema:()=>k5,ToolResultContentSchema:()=>R5,ToolSchema:()=>C5,ToolUseContentSchema:()=>m5,UnsubscribeRequestParamsSchema:()=>J8,UnsubscribeRequestSchema:()=>Y8,UntitledMultiSelectEnumSchemaSchema:()=>$5,UntitledSingleSelectEnumSchemaSchema:()=>Y5}),JNe=e=>e8.safeParse(e).success,YNe=e=>t8.safeParse(e).success,x9=e=>n8.safeParse(e).success,XNe=e=>r8.safeParse(e).success;t9.InvalidRequest,t9.UnsupportedProtocolVersion,t9.InvalidParams,t9.MethodNotFound,t9.InvalidParams,t9.MissingRequiredClientCapability,t9.ParseError,t9.InvalidRequest,t9.MethodNotFound,t9.UnsupportedProtocolVersion,t9.MissingRequiredClientCapability;function S9(e,t){return J3(e,t)}function C9(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function w9(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var T9=!1,E9=`draft-2020-12`;function ZNe(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:E9});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);T9||(T9=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=W3(e,{target:E9,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&D9(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function D9(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||D9(e)))}return!1}function QNe(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function O9(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>QNe(e)).join(`, `)}:{success:!0,data:n.value}}function $Ne(e){let t=W3(e,{target:E9,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var ePe=/\\\.\\d\{(\d+)\}/;function tPe(e){let t=ePe.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>N6({local:e,offset:t,precision:n}))))}function nPe(e,t){let n;switch(e){case`email`:n=[Aje()];break;case`uri`:n=[i6()];break;case`date`:n=[CMe()];break;case`date-time`:n=tPe(t)}return new Set(n.map(e=>$Ne(e)).filter(e=>e!==void 0))}function rPe(e,t,n){return n!==`zod`||nPe(e,t).has(t)}function k9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function iPe(e){try{return ZNe(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new n9(t9.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var aPe=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function A9(e){return aPe.has(e)||e.startsWith(`x-`)}var oPe=new Set([`$schema`,...Object.keys(i7.shape.requestedSchema.shape)]),j9={string:C9([q5,Y5,X5,Z5]),number:C9([J5]),integer:C9([J5]),boolean:C9([K5]),array:C9([$5,e7])},sPe=new Set(q5.shape.format.unwrap().options);function cPe(e,t,n,r){if(!k9(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(j9,e.type)?j9[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||A9(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?sPe.has(e.format)?(typeof s!=`string`||!rPe(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function lPe(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&k9(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,cPe(n,`properties.${e}`,t,r)])):oPe.has(i)?n[i]=a:A9(i)||r.push(i);if(r.length>0)throw new n9(t9.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function uPe(e,t){if(!k9(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!S9(r7,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function M9(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>M9(e,t[r],`${n}[${r}]`)):!k9(e)||!k9(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?M9(r,t[e],i):A9(e)?[]:[i]})}function dPe(e){if(!w9(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=lPe(iPe(e.requestedSchema),t),r=S9(i7.shape.requestedSchema,n);if(!r.success)throw new n9(t9.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${uPe(n,r.error.message)}`);let i=M9(n,r.data);if(i.length>0)throw new n9(t9.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new n9(t9.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function fPe(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(fPe,{elicit(e){try{return{method:`elicitation/create`,params:dPe(e)}}catch(e){throw e instanceof n9?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var pPe=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),mPe={IdJagTokenExchangeResponseSchema:$Me,OAuthClientInformationFullSchema:tNe,OAuthClientInformationSchema:O7,OAuthClientMetadataSchema:D7,OAuthClientRegistrationErrorSchema:nNe,OAuthErrorResponseSchema:eNe,OAuthMetadataSchema:w7,OAuthProtectedResourceMetadataSchema:XMe,OAuthTokenRevocationRequestSchema:rNe,OAuthTokensSchema:QMe,OpenIdProviderDiscoveryMetadataSchema:ZMe,OpenIdProviderMetadataSchema:T7},N9={},P9={};function F9(e,t){let n=e.slice(0,-6);N9[n]=t,P9[n]=e=>t.safeParse(e).success}for(let e of pPe)F9(e,qNe[e]);for(let[e,t]of Object.entries(mPe))F9(e,t);Object.freeze(N9),Object.freeze(P9);function hPe(e){switch(e){case`initialize`:case`notifications/initialized`:return h9(void 0);case`server/discover`:return h9(KNe);default:return}}var gPe=[P6,F6,L6,R6],_Pe=[`inputResponses`,`requestState`];function I9(e,t){let n=e.params;if(!z9(n))return{message:e,lifted:{}};let r=n._meta,i=z9(r)?gPe.filter(e=>e in r):[],a=t===`request`?_Pe.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&z9(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function L9(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function R9(e){return()=>e}var vPe=R9(void 0),yPe=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??TMe,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new N7(M7.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&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),new N7(M7.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){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{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),x9(e)||XNe(e)?this._onresponse(e):JNe(e)?this._onrequest(e,t):YNe(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new N7(M7.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=I9(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=g9(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(v9(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=I9(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=g9(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(t9.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(_9(n.method)&&!i.hasRequestMethod(n.method)&&!(y9(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(t9.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(t9.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(t9.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:bPe(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?vPe:R9(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),w9(t))return u(e,t,n);let i=L9(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(t9.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:t9.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.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._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),x9(e)?n(e):n(n9.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(w9(t))return y9(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=L9(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return h9(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=hPe(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(_9(t)&&!e.hasRequestMethod(t))throw new N7(M7.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof N7?e:new N7(M7.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof N7?e:new N7(M7.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(xPe(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;O9(n,o).then(e=>{e.success?d(e.data):f(new N7(M7.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new N7(M7.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new N7(M7.NotConnected,`Not connected`);if(v9(t.method)&&!e.hasNotificationMethod(t.method))throw new N7(M7.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!_9(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new n9(t9.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await O9(t.params,{...r.params});if(!a.success)throw new n9(t9.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.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,n){if(typeof t==`function`){if(!v9(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new n9(t9.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await O9(t.params,{...r.params});if(!i.success)throw new n9(t9.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function z9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function B9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bPe(e){let t={},n=[];if(!B9(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!B9(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function xPe(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}JEe((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),typeof self<`u`&&self.location&&self.location.origin!==`null`?new URL(self.location.origin+self.location.pathname+location.search):new URL(`https://github.com/cfworker`);var SPe=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,CPe=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,wPe=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,TPe=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,EPe=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,DPe=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,V9=/^(?:\/(?:[^~/]|~0|~1)*)*$/,OPe=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,kPe=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,APe=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,jPe=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function H9(e){return e.test.bind(e)}MPe.bind(void 0,!1),H9(wPe),H9(TPe),H9(EPe),H9(CPe),H9(APe),H9(jPe),H9(DPe),H9(V9),H9(OPe),H9(kPe);function MPe(e,t){let n=t.match(SPe);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}globalThis.crypto;var U9=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e){super(e),this.name=new.target.name,A7(this,new.target)}};(class extends U9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}}),class extends U9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.RegistrationRejectedError`})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},class extends U9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends U9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},class extends U9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsufficientScopeError`})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:``}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,A7(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,A7(this,new.target)}};var NPe=class{_eventSlots=new Map;setHandler(e,t){let n=this._ensureEventSlot(e);n.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),n.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let n=this._eventSlots.get(e);if(!n)return;let r=n.listeners.indexOf(t);r!==-1&&n.listeners.splice(r,1)}dispatch(e,t){let n=this._eventSlots.get(e);if(n){n.onHandler?.(t);for(let e of[...n.listeners])e(t)}}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}},PPe=class{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}},W9=new Set;function G9(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;W9.has(o)||(W9.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},FPe(t)):e=>s({method:a,params:e})]}function FPe(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var IPe=`2026-01-26`,K9=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=i8.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},LPe=g6([$(`light`),$(`dark`)]).describe(`Color theme preference for the host environment.`),q9=g6([$(`inline`),$(`fullscreen`),$(`pip`)]).describe(`Display mode for UI presentation.`),RPe=b6(g6([$(`--color-background-primary`),$(`--color-background-secondary`),$(`--color-background-tertiary`),$(`--color-background-inverse`),$(`--color-background-ghost`),$(`--color-background-info`),$(`--color-background-danger`),$(`--color-background-success`),$(`--color-background-warning`),$(`--color-background-disabled`),$(`--color-text-primary`),$(`--color-text-secondary`),$(`--color-text-tertiary`),$(`--color-text-inverse`),$(`--color-text-ghost`),$(`--color-text-info`),$(`--color-text-danger`),$(`--color-text-success`),$(`--color-text-warning`),$(`--color-text-disabled`),$(`--color-border-primary`),$(`--color-border-secondary`),$(`--color-border-tertiary`),$(`--color-border-inverse`),$(`--color-border-ghost`),$(`--color-border-info`),$(`--color-border-danger`),$(`--color-border-success`),$(`--color-border-warning`),$(`--color-border-disabled`),$(`--color-ring-primary`),$(`--color-ring-secondary`),$(`--color-ring-inverse`),$(`--color-ring-info`),$(`--color-ring-danger`),$(`--color-ring-success`),$(`--color-ring-warning`),$(`--font-sans`),$(`--font-mono`),$(`--font-weight-normal`),$(`--font-weight-medium`),$(`--font-weight-semibold`),$(`--font-weight-bold`),$(`--font-text-xs-size`),$(`--font-text-sm-size`),$(`--font-text-md-size`),$(`--font-text-lg-size`),$(`--font-heading-xs-size`),$(`--font-heading-sm-size`),$(`--font-heading-md-size`),$(`--font-heading-lg-size`),$(`--font-heading-xl-size`),$(`--font-heading-2xl-size`),$(`--font-heading-3xl-size`),$(`--font-text-xs-line-height`),$(`--font-text-sm-line-height`),$(`--font-text-md-line-height`),$(`--font-text-lg-line-height`),$(`--font-heading-xs-line-height`),$(`--font-heading-sm-line-height`),$(`--font-heading-md-line-height`),$(`--font-heading-lg-line-height`),$(`--font-heading-xl-line-height`),$(`--font-heading-2xl-line-height`),$(`--font-heading-3xl-line-height`),$(`--border-radius-xs`),$(`--border-radius-sm`),$(`--border-radius-md`),$(`--border-radius-lg`),$(`--border-radius-xl`),$(`--border-radius-full`),$(`--border-width-regular`),$(`--shadow-hairline`),$(`--shadow-sm`),$(`--shadow-md`),$(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`).describe(`Style variables for theming MCP apps. +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}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function J4(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;J4(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Y4=new Set([`type`,`properties`,`required`,`additionalProperties`]),X4=[`oneOf`,`anyOf`];function Z4(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Q4(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Y4.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Z4(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}P0(n,r,e.length===1?e[0]:Q4(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Z4(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function ZAe(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Y4)if(t in e)return;let n=t.filter(e=>X4.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Q4(t);else{let e=n[0],i=X4.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Q4([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,H4(e,r))}function $4(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)):H4(i,s),H4(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())J4(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])ZAe(e)}}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)}H4(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,P0(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:t3(t,`input`,e.processors),output:t3(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function e3(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 e3(r.element,n);if(r.type===`set`)return e3(r.valueType,n);if(r.type===`lazy`)return e3(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`||r.type===`catch`)return e3(r.innerType,n);if(r.type===`intersection`)return e3(r.left,n)||e3(r.right,n);if(r.type===`record`||r.type===`map`)return e3(r.keyType,n)||e3(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:e3(r.in,n)||e3(r.out,n);if(r.type===`object`){for(let e in r.shape)if(e3(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(e3(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(e3(e,n))return!0;return!!(r.rest&&e3(r.rest,n))}return!1}var QAe=(e,t={})=>n=>{let r=U4({...n,processors:t});return G4(e,r),q4(r,e),$4(r,e)},t3=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=U4({...i??{},target:a,io:t,processors:n});return G4(e,o),q4(o,e),$4(o,e)},n3=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},r3=(e,t,n)=>{(e[t]===void 0||n{n3(e,`minimum`,t),r3(e,`maximum`,t)},a3=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},o3=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},s3=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},c3=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},l3=(e,t)=>n3(e,`minimum`,t.minimum),u3=(e,t)=>r3(e,`maximum`,t.maximum),d3=e=>(t,n)=>{c3(t,n.format);let[r,i]=e[n.format];n3(t,`minimum`,r),r3(t,`maximum`,i)},$Ae={greater_than:(e,t)=>n3(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>r3(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>a3(e,t.value),number_format:d3(Y0),bigint_format:d3(lDe),min_length:l3,max_length:u3,length_equals:(e,t)=>i3(e,t.length),min_size:l3,max_size:u3,size_equals:(e,t)=>i3(e,t.size),string_format:(e,t)=>{c3(e,t.format),t.pattern&&o3(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>s3(e,t.mime)};function f3(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)$Ae[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&n3(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&n3(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&r3(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&r3(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&a3(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&s3(t,i.mime);for(let e of i.patterns??[])o3(t,e);return t}var eje={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},tje=new Map([[Y2,uOe],[X2,dOe]]),p3=e=>tje.get(e)??e,m3=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=f3(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=eje[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(p3);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}))])}},h3=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=f3(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):W4(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},g3=(e,t,n,r)=>{n.type=`boolean`},nje=(e,t,n,r)=>{W4(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},rje=(e,t,n,r)=>{W4(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},_3=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},v3=(e,t,n,r)=>{W4(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},ije=(e,t,n,r)=>{W4(e,t,n,r,`Void cannot be represented in JSON Schema`)},y3=(e,t,n,r)=>{n.not={}},aje=(e,t,n,r)=>{},oje=(e,t,n,r)=>{},sje=(e,t,n,r)=>{W4(e,t,n,r,`Date cannot be represented in JSON Schema`)},b3=(e,t,n,r)=>{let i=e._zod.def,a=O0(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},x3=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(W4(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(W4(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},cje=(e,t,n,r)=>{W4(e,t,n,r,`NaN cannot be represented in JSON Schema`)},lje=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},uje=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=f3(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},dje=(e,t,n,r)=>{n.type=`boolean`},S3=(e,t,n,r)=>{W4(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},fje=(e,t,n,r)=>{W4(e,t,n,r,`Function types cannot be represented in JSON Schema`)},C3=(e,t,n,r)=>{W4(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},pje=(e,t,n,r)=>{W4(e,t,n,r,`Map cannot be represented in JSON Schema`)},mje=(e,t,n,r)=>{W4(e,t,n,r,`Set cannot be represented in JSON Schema`)},w3=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=f3(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=G4(a.element,t,{...r,path:[...r.path,`items`]})};function T3(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?T3(t.out):t.type===`catch`?T3(t.innerType):e._zod.optin}var E3=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&W4(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)P0(i.properties,e,G4(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?T3(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=G4(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},D3=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>G4(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},O3=(e,t,n,r)=>{let i=e._zod.def,a=G4(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=G4(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},hje=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>G4(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?G4(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?T3(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=f3(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function k3(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=k3(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>k3(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?N2:yOe).source),p):p}var A3=new WeakMap;function gje(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of A3.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=k3(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var j3=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=f3(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=G4(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)P0(i.patternProperties,p3(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=G4(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=A3.get(t);n||(n=[],A3.set(t,n),t.deferred.push(()=>gje(t))),n.push(e)}i.additionalProperties=G4(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&T3(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},M3=(e,t,n,r)=>{let i=e._zod.def,a=G4(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`}]},N3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},P3=Symbol();function F3(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(W4(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),P3):JSON.parse(o)}var I3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=F3(i.defaultValue,e,t,n,r);o!==P3&&(n.default=o)},L3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=F3(i.defaultValue,e,t,n,r);o!==P3&&(n._prefault=o)},R3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{W4(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},z3=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;G4(o,t,r);let s=t.seen.get(e);s.ref=o},B3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},_je=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},V3=(e,t,n,r)=>{let i=e._zod.def;G4(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},H3=(e,t,n,r)=>{let i=e._zod.innerType;G4(i,t,r);let a=t.seen.get(e);a.ref=i},U3={string:m3,number:h3,boolean:g3,bigint:nje,symbol:rje,null:_3,undefined:v3,void:ije,never:y3,any:aje,unknown:oje,date:sje,enum:b3,literal:x3,nan:cje,template_literal:lje,file:uje,success:dje,custom:S3,function:fje,transform:C3,map:pje,set:mje,array:w3,object:E3,union:D3,intersection:O3,tuple:hje,record:j3,nullable:M3,nonoptional:N3,default:I3,prefault:L3,catch:R3,pipe:z3,readonly:B3,promise:_je,optional:V3,lazy:H3};function W3(e,t){if(`_idmap`in e){let n=e,r=U4({...t,processors:U3}),i={};for(let e of n._idmap.entries()){let[t,n]=e;G4(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;q4(r,n),P0(a,t,$4(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=U4({...t,processors:U3});return G4(e,n),q4(n,e),$4(n,e)}var G3=new WeakSet([Object.prototype,Error.prototype]);function K3(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var q3=J(`ZodError`,(e,t)=>{jDe.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);G3.has(n)||(G3.add(n),K3(n,`format`,e=>t=>PDe(e,t)),K3(n,`flatten`,e=>t=>NDe(e,t)),K3(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,A0,2)}),K3(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,A0,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),vje=T2(q3),yje=E2(q3),J3=D2(q3),bje=k2(q3),xje=BDe(q3),Sje=VDe(q3),Cje=HDe(q3),wje=UDe(q3),Tje=WDe(q3),Eje=GDe(q3),Dje=KDe(q3),Oje=qDe(q3);function kje(){y2.localeError||b2(tAe())}function Y3(){y2.memoizer||b2({memoizer:Qke()})}var X3=J(`ZodType`,(e,t)=>(kje(),B2.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(B0(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return K0(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(SMe(e,t))},superRefine(e,t){return this.check(CMe(e,t))},overwrite(e){return this.check(V4(e))},optional(){return T6(this)},exactOptional(){return cMe(this)},nullable(){return D6(this)},nullish(){return T6(D6(this))},nonoptional(e){return mMe(this,e)},array(){return Z(this)},or(e){return g6([this,e])},and(e){return v6(this,e)},transform(e){return A6(this,C6(e))},default(e){return dMe(this,e)},prefault(e){return pMe(this,e)},catch(e){return gMe(this,e)},pipe(e){return A6(this,e)},readonly(){return yMe(this)},describe(e){let t=this.clone();return D4.add(t,{description:e}),t},meta(...e){if(e.length===0)return D4.get(this);let t=this.clone();return D4.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return l2(this,`~standard`,{...H2(this),jsonSchema:{input:t3(this,`input`),output:t3(this,`output`)}})},set"~standard"(e){c2(this,`~standard`,e)},parse:function e(t,n){return vje(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await yje(this,t,n,{callee:e})},safeParse(e,t){return J3(this,e,t)},async safeParseAsync(e,t){return bje(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){c2(this,`spa`,e)},validate(e,t){return LDe(this,e,t)},validateAsync(e,t){return zDe(this,e,t)},encode:function e(t,n){return xje(this,t,n,{callee:e})},decode:function e(t,n){return Sje(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Cje(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await wje(this,t,n,{callee:e})},safeEncode(e,t){return Tje(this,e,t)},safeDecode(e,t){return Eje(this,e,t)},async safeEncodeAsync(e,t){return Dje(this,e,t)},async safeDecodeAsync(e,t){return Oje(this,e,t)},toJSONSchema(e){return QAe(this,{})(e)},get description(){return D4.get(this)?.description},get _def(){return this._zod.def}}),Z3=J(`_ZodString`,(e,t)=>{U2.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>m3(e,t,n,r)},u2({format:e=>f3(e).format??null,minLength:e=>f3(e).minimum??null,maxLength:e=>f3(e).maximum??null},{regex(...e){return this.check(IAe(...e))},includes(...e){return this.check(zAe(...e))},startsWith(...e){return this.check(BAe(...e))},endsWith(...e){return this.check(VAe(...e))},min(...e){return this.check(z4(...e))},max(...e){return this.check(R4(...e))},length(...e){return this.check(B4(...e))},nonempty(...e){return this.check(z4(1,...e))},lowercase(e){return this.check(LAe(e))},uppercase(e){return this.check(RAe(e))},trim(){return this.check(UAe())},normalize(...e){return this.check(HAe(...e))},toLowerCase(){return this.check(WAe())},toUpperCase(){return this.check(GAe())},slugify(){return this.check(KAe())}})),Aje=J(`ZodString`,(e,t)=>{U2.init(e,t),Z3.init(e,t)},{email(e){return this.check(k4(t6,e))},url(e){return this.check(A4(r6,e))},jwt(e){return this.check(wAe(Yje,e))},emoji(e){return this.check(uAe(Fje,e))},guid(e){return this.check(aAe(Pje,e))},uuid(e){return this.check(oAe(n6,e))},uuidv4(e){return this.check(sAe(n6,e))},uuidv6(e){return this.check(cAe(n6,e))},uuidv7(e){return this.check(lAe(n6,e))},nanoid(e){return this.check(dAe(Ije,e))},cuid(e){return this.check(fAe(Lje,e))},cuid2(e){return this.check(pAe(Rje,e))},ulid(e){return this.check(mAe(zje,e))},base64(e){return this.check(xAe(Kje,e))},base64url(e){return this.check(SAe(qje,e))},xid(e){return this.check(hAe(Bje,e))},ksuid(e){return this.check(gAe(Vje,e))},ipv4(e){return this.check(_Ae(Hje,e))},ipv6(e){return this.check(vAe(Uje,e))},cidrv4(e){return this.check(yAe(Wje,e))},cidrv6(e){return this.check(bAe(Gje,e))},e164(e){return this.check(CAe(Jje,e))},datetime(e){return this.check(j4($3,e))},date(e){return this.check(M4(e6,e))},time(e){return this.check(TAe(jje,e))},duration(e){return this.check(EAe(Mje,e))}});function Y(e){return iAe(Aje,e)}var Q3=J(`ZodStringFormat`,(e,t)=>{W2.init(e,t),Z3.init(e,t)}),$3=J(`ZodISODateTime`,(e,t)=>{nke.init(e,t),Q3.init(e,t)}),e6=J(`ZodISODate`,(e,t)=>{rke.init(e,t),Q3.init(e,t)}),jje=J(`ZodISOTime`,(e,t)=>{ike.init(e,t),Q3.init(e,t)}),Mje=J(`ZodISODuration`,(e,t)=>{ake.init(e,t),Q3.init(e,t)}),t6=J(`ZodEmail`,(e,t)=>{HOe.init(e,t),Q3.init(e,t)});function Nje(e){return k4(t6,e)}var Pje=J(`ZodGUID`,(e,t)=>{BOe.init(e,t),Q3.init(e,t)}),n6=J(`ZodUUID`,(e,t)=>{VOe.init(e,t),Q3.init(e,t)}),r6=J(`ZodURL`,(e,t)=>{JOe.init(e,t),Q3.init(e,t)});function i6(e){return A4(r6,e)}var Fje=J(`ZodEmoji`,(e,t)=>{YOe.init(e,t),Q3.init(e,t)}),Ije=J(`ZodNanoID`,(e,t)=>{XOe.init(e,t),Q3.init(e,t)}),Lje=J(`ZodCUID`,(e,t)=>{ZOe.init(e,t),Q3.init(e,t)}),Rje=J(`ZodCUID2`,(e,t)=>{QOe.init(e,t),Q3.init(e,t)}),zje=J(`ZodULID`,(e,t)=>{$Oe.init(e,t),Q3.init(e,t)}),Bje=J(`ZodXID`,(e,t)=>{eke.init(e,t),Q3.init(e,t)}),Vje=J(`ZodKSUID`,(e,t)=>{tke.init(e,t),Q3.init(e,t)}),Hje=J(`ZodIPv4`,(e,t)=>{oke.init(e,t),Q3.init(e,t)}),Uje=J(`ZodIPv6`,(e,t)=>{cke.init(e,t),Q3.init(e,t)}),Wje=J(`ZodCIDRv4`,(e,t)=>{lke.init(e,t),Q3.init(e,t)}),Gje=J(`ZodCIDRv6`,(e,t)=>{dke.init(e,t),Q3.init(e,t)}),Kje=J(`ZodBase64`,(e,t)=>{fke.init(e,t),Q3.init(e,t)}),qje=J(`ZodBase64URL`,(e,t)=>{mke.init(e,t),Q3.init(e,t)}),Jje=J(`ZodE164`,(e,t)=>{hke.init(e,t),Q3.init(e,t)}),Yje=J(`ZodJWT`,(e,t)=>{_ke.init(e,t),Q3.init(e,t)}),a6=J(`ZodNumber`,(e,t)=>{Z2.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>h3(e,t,n,r),e.isFinite=!0},u2({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=f3(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=f3(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=f3(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>f3(e).format??null},{gt(e,t){return this.check(F4(e,t))},gte(e,t){return this.check(I4(e,t))},min(e,t){return this.check(I4(e,t))},lt(e,t){return this.check(N4(e,t))},lte(e,t){return this.check(P4(e,t))},max(e,t){return this.check(P4(e,t))},int(e){return this.check(o6(e))},safe(e){return this.check(o6(e))},positive(e){return this.check(F4(0,e))},nonnegative(e){return this.check(I4(0,e))},negative(e){return this.check(N4(0,e))},nonpositive(e){return this.check(P4(0,e))},multipleOf(e,t){return this.check(L4(e,t))},step(e,t){return this.check(L4(e,t))},finite(){return this}}));function X(e){return DAe(a6,e)}var Xje=J(`ZodNumberFormat`,(e,t)=>{vke.init(e,t),a6.init(e,t)});function o6(e){return kAe(Xje,e)}var Zje=J(`ZodBoolean`,(e,t)=>{yke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>g3(e,t,n,r)});function s6(e){return AAe(Zje,e)}var Qje=J(`ZodUndefined`,(e,t)=>{bke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>v3(e,t,n,r)});function c6(e){return jAe(Qje,e)}var $je=J(`ZodNull`,(e,t)=>{xke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_3(e,t,n,r)});function l6(e){return MAe($je,e)}var eMe=J(`ZodAny`,(e,t)=>{Ske.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function u6(){return NAe(eMe)}var tMe=J(`ZodUnknown`,(e,t)=>{Cke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function d6(){return PAe(tMe)}var nMe=J(`ZodNever`,(e,t)=>{wke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>y3(e,t,n,r)});function f6(e){return FAe(nMe,e)}var rMe=J(`ZodArray`,(e,t)=>{Y3(),Dke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>w3(e,t,n,r),e.element=t.element},{min(e,t){return this.check(z4(e,t))},nonempty(e){return this.check(z4(1,e))},max(e,t){return this.check(R4(e,t))},length(e,t){return this.check(B4(e,t))},unwrap(){return this.element}});function Z(e,t){return qAe(rMe,e,t)}var p6=J(`ZodObject`,(e,t)=>{Y3(),Ake.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>E3(e,t,n,r),CDe(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return S6(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(B0(this._zod.def,{catchall:e}))},passthrough(){return this.clone(B0(this._zod.def,{catchall:d6()}))},loose(){return this.clone(B0(this._zod.def,{catchall:d6()}))},strict(){return this.clone(B0(this._zod.def,{catchall:f6()}))},strip(){return this.clone(B0(this._zod.def,{catchall:void 0}))},extend(e){return fDe(this,e)},safeExtend(e){return pDe(this,e)},merge(e){return mDe(this,e)},pick(e){return uDe(this,e)},omit(e){return dDe(this,e)},partial(...e){return Q0(w6,this,e[0])},exactPartial(...e){return Q0(E6,this,e[0],`exactPartial`)},required(...e){return hDe(O6,this,e[0])}});function Q(e,t){return new p6({type:`object`,shape:e??{},...q0(t)})}function m6(e,t){return new p6({type:`object`,shape:e,catchall:d6(),...q0(t)})}var h6=J(`ZodUnion`,(e,t)=>{r4.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>D3(e,t,n,r),e.options=t.options});function g6(e,t){return new h6({type:`union`,options:e,...q0(t)})}var iMe=J(`ZodDiscriminatedUnion`,(e,t)=>{h6.init(e,t),Mke.init(e,t)});function _6(e,t,n){return new iMe({type:`union`,options:t,discriminator:e,...q0(n)})}var aMe=J(`ZodIntersection`,(e,t)=>{Nke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>O3(e,t,n,r)});function v6(e,t){return new aMe({type:`intersection`,left:e,right:t})}var y6=J(`ZodRecord`,(e,t)=>{Y3(),Pke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>j3(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function b6(e,t,n){return!t||!t._zod?new y6({type:`record`,keyType:Y(),valueType:e,...q0(t)}):new y6({type:`record`,keyType:e,valueType:t,...q0(n)})}var x6=J(`ZodEnum`,(e,t)=>{Fke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>b3(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 x6({...t,checks:[],...q0(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 x6({...t,checks:[],...q0(r),entries:i})}});function S6(e,t){return new x6({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...q0(t)})}var oMe=J(`ZodLiteral`,(e,t)=>{Ike.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>x3(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 $(e,t){return new oMe({type:`literal`,values:Array.isArray(e)?e:[e],...q0(t)})}var sMe=J(`ZodTransform`,(e,t)=>{Y3(),Lke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>C3(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new v2(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(s2(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(s2(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function C6(e){return new sMe({type:`transform`,transform:e})}var w6=J(`ZodOptional`,(e,t)=>{s4.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>V3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function T6(e){return new w6({type:`optional`,innerType:e})}var E6=J(`ZodExactOptional`,(e,t)=>{Rke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>V3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cMe(e){return new E6({type:`optional`,innerType:e})}var lMe=J(`ZodNullable`,(e,t)=>{zke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>M3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function D6(e){return new lMe({type:`nullable`,innerType:e})}var uMe=J(`ZodDefault`,(e,t)=>{Bke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>I3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dMe(e,t){return new uMe({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():W0(t)}})}var fMe=J(`ZodPrefault`,(e,t)=>{Vke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>L3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pMe(e,t){return new fMe({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():W0(t)}})}var O6=J(`ZodNonOptional`,(e,t)=>{Hke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>N3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mMe(e,t){return new O6({type:`nonoptional`,innerType:e,...q0(t)})}var hMe=J(`ZodCatch`,(e,t)=>{Uke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>R3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gMe(e,t){return new hMe({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:TDe(t)})}var k6=J(`ZodPipe`,(e,t)=>{d4.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z3(e,t,n,r),e.in=t.in,e.out=t.out});function A6(e,t){return new k6({type:`pipe`,in:e,out:t})}var _Me=J(`ZodPreprocess`,(e,t)=>{k6.init(e,t),Wke.init(e,t)}),vMe=J(`ZodReadonly`,(e,t)=>{Gke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>B3(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yMe(e){return new vMe({type:`readonly`,innerType:e})}var bMe=J(`ZodLazy`,(e,t)=>{Kke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>H3(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function j6(e){return new bMe({type:`lazy`,getter:e})}var xMe=J(`ZodCustom`,(e,t)=>{qke.init(e,t),X3.init(e,t),e._zod.processJSONSchema=(t,n,r)=>S3(e,t,n,r)});function SMe(e,t={}){return JAe(xMe,e,t)}function CMe(e,t){return YAe(e,t)}function M6(e,t){return new _Me({type:`pipe`,in:C6(e),out:t})}var wMe={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`},TMe;TMe||={};function N6(e){return j4($3,e)}function EMe(e){return M4(e6,e)}function DMe(e){return OAe(a6,e)}var OMe=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],kMe=`io.modelcontextprotocol/related-task`,P6=`io.modelcontextprotocol/protocolVersion`,F6=`io.modelcontextprotocol/clientInfo`,I6=`io.modelcontextprotocol/serverInfo`,L6=`io.modelcontextprotocol/clientCapabilities`,AMe=`io.modelcontextprotocol/subscriptionId`,R6=`io.modelcontextprotocol/logLevel`,z6=j6(()=>g6([Y(),X(),s6(),l6(),b6(Y(),z6),Z(z6)])),B6=b6(Y(),z6),jMe=Z(z6),V6=g6([Y(),X().int()]),H6=Y(),U6=Q({ttl:X().optional()}),W6=Q({taskId:Y()}),G6=m6({progressToken:V6.optional(),[kMe]:W6.optional()}),K6=Q({_meta:G6.optional()}),q6=K6.extend({task:U6.optional()}),J6=Q({method:Y(),params:K6.loose().optional()}),Y6=Q({_meta:G6.optional()}),X6=Q({method:Y(),params:Y6.loose().optional()}),Z6=m6({get[I6](){return d8.optional().catch(void 0)}}),Q6=m6({_meta:Z6.optional()}),$6=g6([Y(),X().int()]),e8=Q({jsonrpc:$(`2.0`),id:$6,...J6.shape}).strict(),t8=Q({jsonrpc:$(`2.0`),...X6.shape}).strict(),n8=Q({jsonrpc:$(`2.0`),id:$6,result:Q6}).strict(),r8=Q({jsonrpc:$(`2.0`),id:$6.optional(),error:Q({code:X().int(),message:Y(),data:d6().optional()})}).strict(),i8=g6([e8,t8,n8,r8]),MMe=g6([n8,r8]),a8=Q6.strict(),o8=Y6.extend({requestId:$6.optional(),reason:Y().optional()}),s8=X6.extend({method:$(`notifications/cancelled`),params:o8}),c8=Q({src:Y(),mimeType:Y().optional(),sizes:Z(Y()).optional(),theme:S6([`light`,`dark`]).optional()}),l8=Q({icons:Z(c8).optional()}),u8=Q({name:Y(),title:Y().optional()}),d8=u8.extend({...u8.shape,...l8.shape,version:Y(),websiteUrl:Y().optional(),description:Y().optional()}),NMe=M6(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,v6(Q({form:v6(Q({applyDefaults:s6().optional()}),B6).optional(),url:B6.optional()}),B6.optional())),f8=m6({list:B6.optional(),cancel:B6.optional(),requests:m6({sampling:m6({createMessage:B6.optional()}).optional(),elicitation:m6({create:B6.optional()}).optional()}).optional()}),p8=m6({list:B6.optional(),cancel:B6.optional(),requests:m6({tools:m6({call:B6.optional()}).optional()}).optional()}),m8=Q({experimental:b6(Y(),B6).optional(),sampling:Q({context:B6.optional(),tools:B6.optional()}).optional(),elicitation:NMe.optional(),roots:Q({listChanged:s6().optional()}).optional(),tasks:f8.optional(),extensions:b6(Y(),B6).optional()}),h8=K6.extend({protocolVersion:Y(),capabilities:m8,clientInfo:d8}),g8=J6.extend({method:$(`initialize`),params:h8}),_8=Q({experimental:b6(Y(),B6).optional(),logging:B6.optional(),completions:B6.optional(),prompts:Q({listChanged:s6().optional()}).optional(),resources:Q({subscribe:s6().optional(),listChanged:s6().optional()}).optional(),tools:Q({listChanged:s6().optional()}).optional(),tasks:p8.optional(),extensions:b6(Y(),B6).optional()}),v8=Q6.extend({protocolVersion:Y(),capabilities:_8,serverInfo:d8,instructions:Y().optional()}),y8=X6.extend({method:$(`notifications/initialized`),params:Y6.optional()}),b8=J6.extend({method:$(`server/discover`),params:K6.optional()}),x8=Q6.extend({supportedVersions:Z(Y()),capabilities:_8,instructions:Y().optional()}),S8=J6.extend({method:$(`ping`),params:K6.optional()}),C8=Q({progress:X(),total:T6(X()),message:T6(Y())}),w8=Q({...Y6.shape,...C8.shape,progressToken:V6}),T8=X6.extend({method:$(`notifications/progress`),params:w8}),E8=K6.extend({cursor:H6.optional()}),D8=J6.extend({params:E8.optional()}),O8=Q6.extend({nextCursor:H6.optional()}),k8=Q({uri:Y(),mimeType:T6(Y()),_meta:b6(Y(),d6()).optional()}),A8=k8.extend({text:Y()}),j8=Y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),M8=k8.extend({blob:j8}),N8=S6([`user`,`assistant`]),P8=Q({audience:Z(N8).optional(),priority:X().min(0).max(1).optional(),lastModified:N6({offset:!0}).optional()}),F8=Q({...u8.shape,...l8.shape,uri:Y(),description:T6(Y()),mimeType:T6(Y()),size:T6(X()),annotations:P8.optional(),_meta:T6(m6({}))}),I8=Q({...u8.shape,...l8.shape,uriTemplate:Y(),description:T6(Y()),mimeType:T6(Y()),annotations:P8.optional(),_meta:T6(m6({}))}),L8=D8.extend({method:$(`resources/list`)}),R8=O8.extend({resources:Z(F8)}),z8=D8.extend({method:$(`resources/templates/list`)}),B8=O8.extend({resourceTemplates:Z(I8)}),V8=K6.extend({uri:Y()}),H8=V8,U8=J6.extend({method:$(`resources/read`),params:H8}),W8=Q6.extend({contents:Z(g6([A8,M8]))}),G8=X6.extend({method:$(`notifications/resources/list_changed`),params:Y6.optional()}),K8=V8,q8=J6.extend({method:$(`resources/subscribe`),params:K8}),J8=V8,Y8=J6.extend({method:$(`resources/unsubscribe`),params:J8}),X8=Q({toolsListChanged:s6().optional(),promptsListChanged:s6().optional(),resourcesListChanged:s6().optional(),resourceSubscriptions:Z(Y()).optional()}),Z8=K6.extend({notifications:X8}),Q8=J6.extend({method:$(`subscriptions/listen`),params:Z8}),$8=Y6.extend({notifications:X8}),e5=X6.extend({method:$(`notifications/subscriptions/acknowledged`),params:$8}),t5=Z6.extend({[AMe]:$6}),n5=Q6.extend({_meta:t5}),r5=Y6.extend({uri:Y()}),i5=X6.extend({method:$(`notifications/resources/updated`),params:r5}),a5=Q({name:Y(),description:T6(Y()),required:T6(s6())}),o5=Q({...u8.shape,...l8.shape,description:T6(Y()),arguments:T6(Z(a5)),_meta:T6(m6({}))}),s5=D8.extend({method:$(`prompts/list`)}),c5=O8.extend({prompts:Z(o5)}),l5=K6.extend({name:Y(),arguments:b6(Y(),Y()).optional()}),u5=J6.extend({method:$(`prompts/get`),params:l5}),d5=Q({type:$(`text`),text:Y(),annotations:P8.optional(),_meta:b6(Y(),d6()).optional()}),f5=Q({type:$(`image`),data:j8,mimeType:Y(),annotations:P8.optional(),_meta:b6(Y(),d6()).optional()}),p5=Q({type:$(`audio`),data:j8,mimeType:Y(),annotations:P8.optional(),_meta:b6(Y(),d6()).optional()}),m5=Q({type:$(`tool_use`),name:Y(),id:Y(),input:b6(Y(),d6()),_meta:b6(Y(),d6()).optional()}),h5=Q({type:$(`resource`),resource:g6([A8,M8]),annotations:P8.optional(),_meta:b6(Y(),d6()).optional()}),g5=F8.extend({type:$(`resource_link`)}),_5=g6([d5,f5,p5,g5,h5]),v5=Q({role:N8,content:_5}),y5=Q6.extend({description:Y().optional(),messages:Z(v5)}),b5=X6.extend({method:$(`notifications/prompts/list_changed`),params:Y6.optional()}),x5=Q({title:Y().optional(),readOnlyHint:s6().optional(),destructiveHint:s6().optional(),idempotentHint:s6().optional(),openWorldHint:s6().optional()}),S5=Q({taskSupport:S6([`required`,`optional`,`forbidden`]).optional()}),C5=Q({...u8.shape,...l8.shape,description:Y().optional(),inputSchema:Q({type:$(`object`),properties:b6(Y(),z6).optional(),required:Z(Y()).optional()}).catchall(d6()),outputSchema:m6({$schema:Y().optional()}).optional(),annotations:x5.optional(),execution:S5.optional(),_meta:b6(Y(),d6()).optional()}),w5=D8.extend({method:$(`tools/list`)}),T5=O8.extend({tools:Z(C5)}),E5=Q6.extend({content:Z(_5).default([]),structuredContent:d6().optional(),isError:s6().optional()}),PMe=E5.or(Q6.extend({toolResult:d6()})),D5=q6.extend({name:Y(),arguments:b6(Y(),d6()).optional()}),O5=J6.extend({method:$(`tools/call`),params:D5}),k5=X6.extend({method:$(`notifications/tools/list_changed`),params:Y6.optional()}),FMe=Q({autoRefresh:s6().default(!0),debounceMs:X().int().nonnegative().default(300)}),A5=S6([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),j5=K6.extend({level:A5}),M5=J6.extend({method:$(`logging/setLevel`),params:j5}),N5=Y6.extend({level:A5,logger:Y().optional(),data:d6()}),P5=X6.extend({method:$(`notifications/message`),params:N5}),F5=Q({name:Y().optional()}),I5=Q({hints:Z(F5).optional(),costPriority:X().min(0).max(1).optional(),speedPriority:X().min(0).max(1).optional(),intelligencePriority:X().min(0).max(1).optional()}),L5=Q({mode:S6([`auto`,`required`,`none`]).optional()}),R5=Q({type:$(`tool_result`),toolUseId:Y().describe(`The unique identifier for the corresponding tool call.`),content:Z(_5),structuredContent:d6().optional(),isError:s6().optional(),_meta:b6(Y(),d6()).optional()}),z5=_6(`type`,[d5,f5,p5]),B5=_6(`type`,[d5,f5,p5,m5,R5]),V5=Q({role:N8,content:g6([B5,Z(B5)]),_meta:b6(Y(),d6()).optional()}),H5=q6.extend({messages:Z(V5),modelPreferences:I5.optional(),systemPrompt:Y().optional(),includeContext:S6([`none`,`thisServer`,`allServers`]).optional(),temperature:X().optional(),maxTokens:X().int(),stopSequences:Z(Y()).optional(),metadata:B6.optional(),tools:Z(C5).optional(),toolChoice:L5.optional()}),U5=J6.extend({method:$(`sampling/createMessage`),params:H5}),W5=Q6.extend({model:Y(),stopReason:T6(S6([`endTurn`,`stopSequence`,`maxTokens`]).or(Y())),role:N8,content:z5}),G5=Q6.extend({model:Y(),stopReason:T6(S6([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(Y())),role:N8,content:g6([B5,Z(B5)])}),K5=Q({type:$(`boolean`),title:Y().optional(),description:Y().optional(),default:s6().optional()}),q5=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),minLength:X().optional(),maxLength:X().optional(),format:S6([`email`,`uri`,`date`,`date-time`]).optional(),default:Y().optional()}),J5=Q({type:S6([`number`,`integer`]),title:Y().optional(),description:Y().optional(),minimum:X().optional(),maximum:X().optional(),default:X().optional()}),Y5=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),default:Y().optional()}),X5=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),oneOf:Z(Q({const:Y(),title:Y()})),default:Y().optional()}),Z5=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),enumNames:Z(Y()).optional(),default:Y().optional()}),Q5=g6([Y5,X5]),$5=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({type:$(`string`),enum:Z(Y())}),default:Z(Y()).optional()}),e7=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({anyOf:Z(Q({const:Y(),title:Y()}))}),default:Z(Y()).optional()}),t7=g6([$5,e7]),n7=g6([Z5,Q5,t7]),r7=g6([n7,K5,q5,J5]),i7=q6.extend({mode:$(`form`).optional(),message:Y(),requestedSchema:Q({type:$(`object`),properties:b6(Y(),r7),required:Z(Y()).optional()}).catchall(d6())}),a7=q6.extend({mode:$(`url`),message:Y(),elicitationId:Y(),url:Y().url()}),o7=g6([i7,a7]),s7=J6.extend({method:$(`elicitation/create`),params:o7}),c7=Y6.extend({elicitationId:Y()}),l7=X6.extend({method:$(`notifications/elicitation/complete`),params:c7}),u7=Q6.extend({action:S6([`accept`,`decline`,`cancel`]),content:M6(e=>e===null?void 0:e,b6(Y(),g6([Y(),X(),s6(),Z(Y())])).optional())}),d7=Q({type:$(`ref/resource`),uri:Y()}),f7=Q({type:$(`ref/prompt`),name:Y()}),p7=K6.extend({ref:g6([f7,d7]),argument:Q({name:Y(),value:Y()}),context:Q({arguments:b6(Y(),Y()).optional()}).optional()}),m7=J6.extend({method:$(`completion/complete`),params:p7}),h7=Q6.extend({completion:m6({values:Z(Y()).max(100),total:T6(X().int()),hasMore:T6(s6())})}),g7=Q({uri:Y().startsWith(`file://`),name:Y().optional(),_meta:b6(Y(),d6()).optional()}),_7=J6.extend({method:$(`roots/list`),params:K6.optional()}),v7=Q6.extend({roots:Z(g7)}),y7=X6.extend({method:$(`notifications/roots/list_changed`),params:Y6.optional()}),IMe=m6({ttl:X().optional(),pollInterval:X().optional()}),b7=S6([`working`,`input_required`,`completed`,`failed`,`cancelled`]),x7=Q({taskId:Y(),status:b7,ttl:g6([X(),l6()]),createdAt:Y(),lastUpdatedAt:Y(),pollInterval:T6(X()),statusMessage:T6(Y())}),LMe=Q6.extend({task:x7}),S7=Y6.merge(x7),RMe=X6.extend({method:$(`notifications/tasks/status`),params:S7}),zMe=J6.extend({method:$(`tasks/get`),params:K6.extend({taskId:Y()})}),BMe=Q6.merge(x7),VMe=J6.extend({method:$(`tasks/result`),params:K6.extend({taskId:Y()})}),HMe=Q6.loose(),UMe=D8.extend({method:$(`tasks/list`)}),WMe=O8.extend({tasks:Z(x7)}),GMe=J6.extend({method:$(`tasks/cancel`),params:K6.extend({taskId:Y()})}),KMe=Q6.merge(x7),qMe=g6([S8,g8,b8,m7,M5,u5,s5,L8,z8,U8,q8,Y8,Q8,O5,w5]),JMe=g6([s8,T8,y8,y7]),YMe=g6([a8,W5,G5,u7,v7]),XMe=g6([S8,U5,s7,_7]),ZMe=g6([s8,T8,P5,i5,G8,k5,b5,e5,l7]),QMe=g6([a8,v8,x8,h7,y5,c5,R8,B8,W8,E5,T5,n5]),C7=i6().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:wMe.custom,message:`URL must be parseable`,fatal:!0}),EDe}).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`}),$Me=m6({resource:Y().url(),authorization_servers:Z(C7).optional(),jwks_uri:Y().url().optional(),scopes_supported:Z(Y()).optional(),bearer_methods_supported:Z(Y()).optional(),resource_signing_alg_values_supported:Z(Y()).optional(),resource_name:Y().optional(),resource_documentation:Y().optional(),resource_policy_uri:Y().url().optional(),resource_tos_uri:Y().url().optional(),tls_client_certificate_bound_access_tokens:s6().optional(),authorization_details_types_supported:Z(Y()).optional(),dpop_signing_alg_values_supported:Z(Y()).optional(),dpop_bound_access_tokens_required:s6().optional()}),w7=m6({issuer:Y(),authorization_endpoint:C7,token_endpoint:C7,registration_endpoint:C7.optional(),scopes_supported:Z(Y()).optional(),response_types_supported:Z(Y()),response_modes_supported:Z(Y()).optional(),grant_types_supported:Z(Y()).optional(),token_endpoint_auth_methods_supported:Z(Y()).optional(),token_endpoint_auth_signing_alg_values_supported:Z(Y()).optional(),service_documentation:C7.optional(),revocation_endpoint:C7.optional(),revocation_endpoint_auth_methods_supported:Z(Y()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Z(Y()).optional(),introspection_endpoint:Y().optional(),introspection_endpoint_auth_methods_supported:Z(Y()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Z(Y()).optional(),code_challenge_methods_supported:Z(Y()).optional(),client_id_metadata_document_supported:s6().optional(),authorization_response_iss_parameter_supported:s6().optional().catch(void 0),dpop_signing_alg_values_supported:Z(Y()).optional()}),T7=m6({issuer:Y(),authorization_endpoint:C7,token_endpoint:C7,userinfo_endpoint:C7.optional(),jwks_uri:C7,registration_endpoint:C7.optional(),scopes_supported:Z(Y()).optional(),response_types_supported:Z(Y()),response_modes_supported:Z(Y()).optional(),grant_types_supported:Z(Y()).optional(),acr_values_supported:Z(Y()).optional(),subject_types_supported:Z(Y()),id_token_signing_alg_values_supported:Z(Y()),id_token_encryption_alg_values_supported:Z(Y()).optional(),id_token_encryption_enc_values_supported:Z(Y()).optional(),userinfo_signing_alg_values_supported:Z(Y()).optional(),userinfo_encryption_alg_values_supported:Z(Y()).optional(),userinfo_encryption_enc_values_supported:Z(Y()).optional(),request_object_signing_alg_values_supported:Z(Y()).optional(),request_object_encryption_alg_values_supported:Z(Y()).optional(),request_object_encryption_enc_values_supported:Z(Y()).optional(),token_endpoint_auth_methods_supported:Z(Y()).optional(),token_endpoint_auth_signing_alg_values_supported:Z(Y()).optional(),display_values_supported:Z(Y()).optional(),claim_types_supported:Z(Y()).optional(),claims_supported:Z(Y()).optional(),service_documentation:Y().optional(),claims_locales_supported:Z(Y()).optional(),ui_locales_supported:Z(Y()).optional(),claims_parameter_supported:s6().optional(),request_parameter_supported:s6().optional(),request_uri_parameter_supported:s6().optional(),require_request_uri_registration:s6().optional(),op_policy_uri:C7.optional(),op_tos_uri:C7.optional(),client_id_metadata_document_supported:s6().optional(),authorization_response_iss_parameter_supported:s6().optional().catch(void 0)}),eNe=Q({...T7.shape,...w7.pick({code_challenge_methods_supported:!0}).shape}),tNe=Q({access_token:Y(),id_token:Y().optional(),token_type:Y(),expires_in:DMe().optional(),scope:Y().optional(),refresh_token:Y().optional(),issuer:Y().optional().catch(void 0)}).strip(),nNe=Q({issued_token_type:$(`urn:ietf:params:oauth:token-type:id-jag`),access_token:Y(),token_type:Y().optional(),expires_in:X().optional(),scope:Y().optional()}).strip(),rNe=Q({error:Y(),error_description:Y().optional(),error_uri:Y().optional()}),E7=C7.optional().or($(``).transform(()=>void 0)),D7=Q({redirect_uris:Z(C7),token_endpoint_auth_method:Y().optional(),grant_types:Z(Y()).optional(),response_types:Z(Y()).optional(),application_type:Y().optional(),client_name:Y().optional(),client_uri:C7.optional(),logo_uri:E7,scope:Y().optional(),contacts:Z(Y()).optional(),tos_uri:E7,policy_uri:Y().optional(),jwks_uri:C7.optional(),jwks:u6().optional(),software_id:Y().optional(),software_version:Y().optional(),software_statement:Y().optional()}).strip(),O7=Q({client_id:Y(),client_secret:Y().optional(),client_id_issued_at:X().optional(),client_secret_expires_at:X().optional(),issuer:Y().optional().catch(void 0)}).strip(),iNe=D7.merge(O7),aNe=Q({error:Y(),error_description:Y().optional()}).strip(),oNe=Q({token:Y(),token_type_hint:Y().optional()}).strip(),k7=Symbol.for(`mcp.sdk.errorBrands`);function A7(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,k7,{value:n,enumerable:!1,configurable:!0})}function j7(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,k7)){let n=t[k7];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,A7(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});var M7=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),N7=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,A7(this,new.target)}};(class extends N7{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var sNe=`2026-07-28`;function cNe(e){return e>=sNe}function P7(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var F7=[`task`,`inputRequests`,`requestState`];function lNe(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||F7.some(t=>t in e)?e:{...e,content:[]}}function uNe(){let e=j6(()=>g6([Y(),X(),s6(),l6(),b6(Y(),e),Z(e)])),t=b6(Y(),e),n=g6([Y(),X().int()]),r=Y(),i=Q({ttl:X().optional()}),a=Q({taskId:Y()}),o=m6({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=Q({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=Q({method:Y(),params:s.loose().optional()}),u=Q({_meta:o.optional()}),d=Q({method:Y(),params:u.loose().optional()}),f=m6({_meta:o.optional()}),p=g6([Y(),X().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:Y().optional()}),g=d.extend({method:$(`notifications/cancelled`),params:h}),_=Q({src:Y(),mimeType:Y().optional(),sizes:Z(Y()).optional(),theme:S6([`light`,`dark`]).optional()}),v=Q({icons:Z(_).optional()}),y=Q({name:Y(),title:Y().optional()}),b=y.extend({...y.shape,...v.shape,version:Y(),websiteUrl:Y().optional(),description:Y().optional()}),x=M6(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,v6(Q({form:v6(Q({applyDefaults:s6().optional()}),t).optional(),url:t.optional()}),t.optional())),S=m6({list:t.optional(),cancel:t.optional(),requests:m6({sampling:m6({createMessage:t.optional()}).optional(),elicitation:m6({create:t.optional()}).optional()}).optional()}),C=m6({list:t.optional(),cancel:t.optional(),requests:m6({tools:m6({call:t.optional()}).optional()}).optional()}),w=Q({experimental:b6(Y(),t).optional(),sampling:Q({context:t.optional(),tools:t.optional()}).optional(),elicitation:x.optional(),roots:Q({listChanged:s6().optional()}).optional(),tasks:S.optional(),extensions:b6(Y(),t).optional()}),T=s.extend({protocolVersion:Y(),capabilities:w,clientInfo:b}),E=l.extend({method:$(`initialize`),params:T}),D=Q({experimental:b6(Y(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:Q({listChanged:s6().optional()}).optional(),resources:Q({subscribe:s6().optional(),listChanged:s6().optional()}).optional(),tools:Q({listChanged:s6().optional()}).optional(),tasks:C.optional(),extensions:b6(Y(),t).optional()}),O=f.extend({protocolVersion:Y(),capabilities:D,serverInfo:b,instructions:Y().optional()}),k=d.extend({method:$(`notifications/initialized`),params:u.optional()}),A=l.extend({method:$(`ping`),params:s.optional()}),j=Q({progress:X(),total:T6(X()),message:T6(Y())}),M=Q({...u.shape,...j.shape,progressToken:n}),N=d.extend({method:$(`notifications/progress`),params:M}),P=s.extend({cursor:r.optional()}),F=l.extend({params:P.optional()}),ee=f.extend({nextCursor:r.optional()}),I=Q({uri:Y(),mimeType:T6(Y()),_meta:b6(Y(),d6()).optional()}),te=I.extend({text:Y()}),L=Y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),ne=I.extend({blob:L}),re=S6([`user`,`assistant`]),ie=Q({audience:Z(re).optional(),priority:X().min(0).max(1).optional(),lastModified:N6({offset:!0}).optional()}),ae=Q({...y.shape,...v.shape,uri:Y(),description:T6(Y()),mimeType:T6(Y()),size:T6(X()),annotations:ie.optional(),_meta:T6(m6({}))}),oe=Q({...y.shape,...v.shape,uriTemplate:Y(),description:T6(Y()),mimeType:T6(Y()),annotations:ie.optional(),_meta:T6(m6({}))}),se=F.extend({method:$(`resources/list`)}),ce=ee.extend({resources:Z(ae)}),le=F.extend({method:$(`resources/templates/list`)}),ue=ee.extend({resourceTemplates:Z(oe)}),de=s.extend({uri:Y()}),fe=de,R=l.extend({method:$(`resources/read`),params:fe}),pe=f.extend({contents:Z(g6([te,ne]))}),me=d.extend({method:$(`notifications/resources/list_changed`),params:u.optional()}),he=de,ge=l.extend({method:$(`resources/subscribe`),params:he}),_e=de,ve=l.extend({method:$(`resources/unsubscribe`),params:_e}),ye=u.extend({uri:Y()}),be=d.extend({method:$(`notifications/resources/updated`),params:ye}),xe=Q({name:Y(),description:T6(Y()),required:T6(s6())}),Se=Q({...y.shape,...v.shape,description:T6(Y()),arguments:T6(Z(xe)),_meta:T6(m6({}))}),Ce=F.extend({method:$(`prompts/list`)}),we=ee.extend({prompts:Z(Se)}),Te=s.extend({name:Y(),arguments:b6(Y(),Y()).optional()}),Ee=l.extend({method:$(`prompts/get`),params:Te}),De=Q({type:$(`text`),text:Y(),annotations:ie.optional(),_meta:b6(Y(),d6()).optional()}),Oe=Q({type:$(`image`),data:L,mimeType:Y(),annotations:ie.optional(),_meta:b6(Y(),d6()).optional()}),ke=Q({type:$(`audio`),data:L,mimeType:Y(),annotations:ie.optional(),_meta:b6(Y(),d6()).optional()}),Ae=Q({type:$(`tool_use`),name:Y(),id:Y(),input:b6(Y(),d6()),_meta:b6(Y(),d6()).optional()}),je=Q({type:$(`resource`),resource:g6([te,ne]),annotations:ie.optional(),_meta:b6(Y(),d6()).optional()}),Me=ae.extend({type:$(`resource_link`)}),Ne=g6([De,Oe,ke,Me,je]),Pe=Q({role:re,content:Ne}),Fe=f.extend({description:Y().optional(),messages:Z(Pe)}),Ie=d.extend({method:$(`notifications/prompts/list_changed`),params:u.optional()}),Le=Q({title:Y().optional(),readOnlyHint:s6().optional(),destructiveHint:s6().optional(),idempotentHint:s6().optional(),openWorldHint:s6().optional()}),Re=Q({taskSupport:S6([`required`,`optional`,`forbidden`]).optional()}),ze=Q({...y.shape,...v.shape,description:Y().optional(),inputSchema:Q({type:$(`object`),properties:b6(Y(),e).optional(),required:Z(Y()).optional()}).catchall(d6()),outputSchema:Q({type:$(`object`),properties:b6(Y(),e).optional(),required:Z(Y()).optional()}).catchall(d6()).optional(),annotations:Le.optional(),execution:Re.optional(),_meta:b6(Y(),d6()).optional()}),Be=F.extend({method:$(`tools/list`)}),Ve=ee.extend({tools:Z(ze)}),He=f.extend({content:Z(Ne),structuredContent:b6(Y(),d6()).optional(),isError:s6().optional()}),Ue=c.extend({name:Y(),arguments:b6(Y(),d6()).optional()}),We=l.extend({method:$(`tools/call`),params:Ue}),Ge=d.extend({method:$(`notifications/tools/list_changed`),params:u.optional()}),Ke=S6([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),qe=s.extend({level:Ke}),Je=l.extend({method:$(`logging/setLevel`),params:qe}),Ye=u.extend({level:Ke,logger:Y().optional(),data:d6()}),Xe=d.extend({method:$(`notifications/message`),params:Ye}),Ze=Q({name:Y().optional()}),Qe=Q({hints:Z(Ze).optional(),costPriority:X().min(0).max(1).optional(),speedPriority:X().min(0).max(1).optional(),intelligencePriority:X().min(0).max(1).optional()}),$e=Q({mode:S6([`auto`,`required`,`none`]).optional()}),et=Q({type:$(`tool_result`),toolUseId:Y().describe(`The unique identifier for the corresponding tool call.`),content:Z(Ne),structuredContent:Q({}).loose().optional(),isError:s6().optional(),_meta:b6(Y(),d6()).optional()}),tt=_6(`type`,[De,Oe,ke]),nt=_6(`type`,[De,Oe,ke,Ae,et]),rt=Q({role:re,content:g6([nt,Z(nt)]),_meta:b6(Y(),d6()).optional()}),it=c.extend({messages:Z(rt),modelPreferences:Qe.optional(),systemPrompt:Y().optional(),includeContext:S6([`none`,`thisServer`,`allServers`]).optional(),temperature:X().optional(),maxTokens:X().int(),stopSequences:Z(Y()).optional(),metadata:t.optional(),tools:Z(ze).optional(),toolChoice:$e.optional()}),at=l.extend({method:$(`sampling/createMessage`),params:it}),ot=f.extend({model:Y(),stopReason:T6(S6([`endTurn`,`stopSequence`,`maxTokens`]).or(Y())),role:re,content:tt}),st=f.extend({model:Y(),stopReason:T6(S6([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(Y())),role:re,content:g6([nt,Z(nt)])}),ct=Q({type:$(`boolean`),title:Y().optional(),description:Y().optional(),default:s6().optional()}),lt=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),minLength:X().optional(),maxLength:X().optional(),format:S6([`email`,`uri`,`date`,`date-time`]).optional(),default:Y().optional()}),ut=Q({type:S6([`number`,`integer`]),title:Y().optional(),description:Y().optional(),minimum:X().optional(),maximum:X().optional(),default:X().optional()}),dt=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),default:Y().optional()}),ft=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),oneOf:Z(Q({const:Y(),title:Y()})),default:Y().optional()}),pt=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),enumNames:Z(Y()).optional(),default:Y().optional()}),mt=g6([dt,ft]),ht=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({type:$(`string`),enum:Z(Y())}),default:Z(Y()).optional()}),gt=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({anyOf:Z(Q({const:Y(),title:Y()}))}),default:Z(Y()).optional()}),_t=g6([ht,gt]),vt=g6([pt,mt,_t]),yt=g6([vt,ct,lt,ut]),bt=c.extend({mode:$(`form`).optional(),message:Y(),requestedSchema:Q({type:$(`object`),properties:b6(Y(),yt),required:Z(Y()).optional()}).catchall(d6())}),xt=c.extend({mode:$(`url`),message:Y(),elicitationId:Y(),url:Y().url()}),St=g6([bt,xt]),Ct=l.extend({method:$(`elicitation/create`),params:St}),wt=u.extend({elicitationId:Y()}),Tt=d.extend({method:$(`notifications/elicitation/complete`),params:wt}),Et=f.extend({action:S6([`accept`,`decline`,`cancel`]),content:M6(e=>e===null?void 0:e,b6(Y(),g6([Y(),X(),s6(),Z(Y())])).optional())}),Dt=Q({type:$(`ref/resource`),uri:Y()}),Ot=Q({type:$(`ref/prompt`),name:Y()}),kt=s.extend({ref:g6([Ot,Dt]),argument:Q({name:Y(),value:Y()}),context:Q({arguments:b6(Y(),Y()).optional()}).optional()}),At=l.extend({method:$(`completion/complete`),params:kt}),jt=f.extend({completion:m6({values:Z(Y()).max(100),total:T6(X().int()),hasMore:T6(s6())})}),Mt=Q({uri:Y().startsWith(`file://`),name:Y().optional(),_meta:b6(Y(),d6()).optional()}),Nt=l.extend({method:$(`roots/list`),params:s.optional()}),Pt=f.extend({roots:Z(Mt)}),Ft=d.extend({method:$(`notifications/roots/list_changed`),params:u.optional()}),It=m6({ttl:X().optional(),pollInterval:X().optional()}),Lt=S6([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Rt=Q({taskId:Y(),status:Lt,ttl:g6([X(),l6()]),createdAt:Y(),lastUpdatedAt:Y(),pollInterval:T6(X()),statusMessage:T6(Y())}),zt=f.extend({task:Rt}),Bt=u.merge(Rt),Vt=d.extend({method:$(`notifications/tasks/status`),params:Bt}),Ht=l.extend({method:$(`tasks/get`),params:s.extend({taskId:Y()})}),Ut=f.merge(Rt),Wt=l.extend({method:$(`tasks/result`),params:s.extend({taskId:Y()})}),Gt=f.loose(),Kt=F.extend({method:$(`tasks/list`)}),qt=ee.extend({tasks:Z(Rt)}),Jt=l.extend({method:$(`tasks/cancel`),params:s.extend({taskId:Y()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:g,IconSchema:_,IconsSchema:v,BaseMetadataSchema:y,ImplementationSchema:b,ClientTasksCapabilitySchema:S,ServerTasksCapabilitySchema:C,ClientCapabilitiesSchema:w,InitializeRequestParamsSchema:T,InitializeRequestSchema:E,ServerCapabilitiesSchema:D,InitializeResultSchema:O,InitializedNotificationSchema:k,PingRequestSchema:A,ProgressSchema:j,ProgressNotificationParamsSchema:M,ProgressNotificationSchema:N,PaginatedRequestParamsSchema:P,PaginatedRequestSchema:F,PaginatedResultSchema:ee,ResourceContentsSchema:I,TextResourceContentsSchema:te,BlobResourceContentsSchema:ne,RoleSchema:re,AnnotationsSchema:ie,ResourceSchema:ae,ResourceTemplateSchema:oe,ListResourcesRequestSchema:se,ListResourcesResultSchema:ce,ListResourceTemplatesRequestSchema:le,ListResourceTemplatesResultSchema:ue,ResourceRequestParamsSchema:de,ReadResourceRequestParamsSchema:fe,ReadResourceRequestSchema:R,ReadResourceResultSchema:pe,ResourceListChangedNotificationSchema:me,SubscribeRequestParamsSchema:he,SubscribeRequestSchema:ge,UnsubscribeRequestParamsSchema:_e,UnsubscribeRequestSchema:ve,ResourceUpdatedNotificationParamsSchema:ye,ResourceUpdatedNotificationSchema:be,PromptArgumentSchema:xe,PromptSchema:Se,ListPromptsRequestSchema:Ce,ListPromptsResultSchema:we,GetPromptRequestParamsSchema:Te,GetPromptRequestSchema:Ee,TextContentSchema:De,ImageContentSchema:Oe,AudioContentSchema:ke,ToolUseContentSchema:Ae,EmbeddedResourceSchema:je,ResourceLinkSchema:Me,ContentBlockSchema:Ne,PromptMessageSchema:Pe,GetPromptResultSchema:Fe,PromptListChangedNotificationSchema:Ie,ToolAnnotationsSchema:Le,ToolExecutionSchema:Re,ToolSchema:ze,ListToolsRequestSchema:Be,ListToolsResultSchema:Ve,CallToolResultSchema:He,CallToolRequestParamsSchema:Ue,CallToolRequestSchema:We,ToolListChangedNotificationSchema:Ge,LoggingLevelSchema:Ke,SetLevelRequestParamsSchema:qe,SetLevelRequestSchema:Je,LoggingMessageNotificationParamsSchema:Ye,LoggingMessageNotificationSchema:Xe,ModelHintSchema:Ze,ModelPreferencesSchema:Qe,ToolChoiceSchema:$e,ToolResultContentSchema:et,SamplingContentSchema:tt,SamplingMessageContentBlockSchema:nt,SamplingMessageSchema:rt,CreateMessageRequestParamsSchema:it,CreateMessageRequestSchema:at,CreateMessageResultSchema:ot,CreateMessageResultWithToolsSchema:st,BooleanSchemaSchema:ct,StringSchemaSchema:lt,NumberSchemaSchema:ut,UntitledSingleSelectEnumSchemaSchema:dt,TitledSingleSelectEnumSchemaSchema:ft,LegacyTitledEnumSchemaSchema:pt,SingleSelectEnumSchemaSchema:mt,UntitledMultiSelectEnumSchemaSchema:ht,TitledMultiSelectEnumSchemaSchema:gt,MultiSelectEnumSchemaSchema:_t,EnumSchemaSchema:vt,PrimitiveSchemaDefinitionSchema:yt,ElicitRequestFormParamsSchema:bt,ElicitRequestURLParamsSchema:xt,ElicitRequestParamsSchema:St,ElicitRequestSchema:Ct,ElicitationCompleteNotificationParamsSchema:wt,ElicitationCompleteNotificationSchema:Tt,ElicitResultSchema:Et,ResourceTemplateReferenceSchema:Dt,PromptReferenceSchema:Ot,CompleteRequestParamsSchema:kt,CompleteRequestSchema:At,CompleteResultSchema:jt,RootSchema:Mt,ListRootsRequestSchema:Nt,ListRootsResultSchema:Pt,RootsListChangedNotificationSchema:Ft,TaskCreationParamsSchema:It,TaskStatusSchema:Lt,TaskSchema:Rt,CreateTaskResultSchema:zt,TaskStatusNotificationParamsSchema:Bt,TaskStatusNotificationSchema:Vt,GetTaskRequestSchema:Ht,GetTaskResultSchema:Ut,GetTaskPayloadRequestSchema:Wt,GetTaskPayloadResultSchema:Gt,ListTasksRequestSchema:Kt,ListTasksResultSchema:qt,CancelTaskRequestSchema:Jt,CancelTaskResultSchema:f.merge(Rt),ClientRequestSchema:g6([A,E,At,Je,Ee,Ce,se,le,R,ge,ve,We,Be,Ht,Wt,Kt,Jt]),ClientNotificationSchema:g6([g,N,k,Ft,Vt]),ClientResultSchema:g6([m,ot,st,Et,Pt,Ut,qt,zt]),ServerRequestSchema:g6([A,at,Ct,Nt,Ht,Wt,Kt,Jt]),ServerNotificationSchema:g6([g,N,Xe,be,me,Ge,Ie,Vt,Tt]),ServerResultSchema:g6([m,O,jt,Fe,we,ce,ue,pe,He,Ve,Ut,qt,zt]),CallToolResultWireSchema:d6().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of F7)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(lNe).pipe(He)}}var dNe;function I7(){return dNe??=uNe()}function L7(e){return e.type!==`object`}var fNe=new Set([`const`,`enum`,`default`,`examples`]),pNe=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function R7(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function mNe(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(R7(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=QEe(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&R7(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=fNe.has(o)?s:pNe.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var z7={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},B7={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},hNe={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},V7;function H7(){if(V7)return V7;let e=I7();return V7={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},V7}function U7(e){return Object.prototype.hasOwnProperty.call(z7,e)}function W7(e){return Object.prototype.hasOwnProperty.call(B7,e)}function gNe(e){return Object.prototype.hasOwnProperty.call(hNe,e)}function _Ne(e){return gNe(e)?H7().resultSchemas[e]:void 0}function vNe(e){return U7(e)?H7().requestSchemas[e]:void 0}function yNe(e){return W7(e)?H7().notificationSchemas[e]:void 0}Object.keys(z7),Object.keys(B7);function G7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K7(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var q7={ok:!1,reason:`not-in-era`};function J7(e){return G7(e)&&G7(e.outputSchema)&&L7(e.outputSchema)}function Y7(e){return e}var X7={era:`2025-11-25`,hasRequestMethod:U7,hasNotificationMethod:W7,validateRequest:(e,t)=>K7(vNe(e),t),validateResult:(e,t)=>K7(_Ne(e),t),validateNotification:(e,t)=>K7(yNe(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>q7,validateInputResponse:()=>q7,samplingResultVariant:((e,t)=>{let n=I7();return K7(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=P7(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&L7(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(G7(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Y7(e)}}return{kind:`complete`,result:Y7(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>J7(e))?t:{...t,tools:n.map(e=>J7(e)?{...e,outputSchema:mNe(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function bNe(){let e=j6(()=>g6([Y(),X(),s6(),l6(),b6(Y(),e),Z(e)])),t=b6(Y(),e),n=g6([Y(),X().int()]),r=Y(),i=g6([Y(),X().int()]),a=S6([`user`,`assistant`]),o=S6([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=Y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=Q({ttl:X().optional()}),l=Q({taskId:Y()}),u=m6({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=Q({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=Q({_meta:u.optional()}),m=Q({method:Y(),params:p.loose().optional()}),h=Q({src:Y(),mimeType:Y().optional(),sizes:Z(Y()).optional(),theme:S6([`light`,`dark`]).optional()}),g=Q({icons:Z(h).optional()}),_=Q({name:Y(),title:Y().optional()}),v=_.extend({..._.shape,...g.shape,version:Y(),websiteUrl:Y().optional(),description:Y().optional()}),y=M6(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,v6(Q({form:v6(Q({applyDefaults:s6().optional()}),t).optional(),url:t.optional()}),t.optional())),b=m6({list:t.optional(),cancel:t.optional(),requests:m6({sampling:m6({createMessage:t.optional()}).optional(),elicitation:m6({create:t.optional()}).optional()}).optional()}),x=m6({list:t.optional(),cancel:t.optional(),requests:m6({tools:m6({call:t.optional()}).optional()}).optional()}),S=Q({experimental:b6(Y(),t).optional(),sampling:Q({context:t.optional(),tools:t.optional()}).optional(),elicitation:y.optional(),roots:Q({listChanged:s6().optional()}).optional(),tasks:b.optional(),extensions:b6(Y(),t).optional()}),C=Q({experimental:b6(Y(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:Q({listChanged:s6().optional()}).optional(),resources:Q({subscribe:s6().optional(),listChanged:s6().optional()}).optional(),tools:Q({listChanged:s6().optional()}).optional(),tasks:x.optional(),extensions:b6(Y(),t).optional()}),w=Q({progress:X(),total:T6(X()),message:T6(Y())}),T=Q({...p.shape,...w.shape,progressToken:n}),E=m.extend({method:$(`notifications/progress`),params:T}),D=p.extend({level:o,logger:Y().optional(),data:d6()}),O=m.extend({method:$(`notifications/message`),params:D}),k=Q({uri:Y(),mimeType:T6(Y()),_meta:b6(Y(),d6()).optional()}),A=k.extend({text:Y()}),j=k.extend({blob:s}),M=Q({audience:Z(a).optional(),priority:X().min(0).max(1).optional(),lastModified:N6({offset:!0}).optional()}),N=Q({..._.shape,...g.shape,uri:Y(),description:T6(Y()),mimeType:T6(Y()),size:T6(X()),annotations:M.optional(),_meta:T6(m6({}))}),P=Q({..._.shape,...g.shape,uriTemplate:Y(),description:T6(Y()),mimeType:T6(Y()),annotations:M.optional(),_meta:T6(m6({}))}),F=m.extend({method:$(`notifications/resources/list_changed`),params:p.optional()}),ee=p.extend({uri:Y()}),I=m.extend({method:$(`notifications/resources/updated`),params:ee}),te=Q({name:Y(),description:T6(Y()),required:T6(s6())}),L=Q({..._.shape,...g.shape,description:T6(Y()),arguments:T6(Z(te)),_meta:T6(m6({}))}),ne=m.extend({method:$(`notifications/prompts/list_changed`),params:p.optional()}),re=Q({type:$(`text`),text:Y(),annotations:M.optional(),_meta:b6(Y(),d6()).optional()}),ie=Q({type:$(`image`),data:s,mimeType:Y(),annotations:M.optional(),_meta:b6(Y(),d6()).optional()}),ae=Q({type:$(`audio`),data:s,mimeType:Y(),annotations:M.optional(),_meta:b6(Y(),d6()).optional()}),oe=Q({type:$(`tool_use`),name:Y(),id:Y(),input:b6(Y(),d6()),_meta:b6(Y(),d6()).optional()}),se=Q({type:$(`resource`),resource:g6([A,j]),annotations:M.optional(),_meta:b6(Y(),d6()).optional()}),ce=N.extend({type:$(`resource_link`)}),le=g6([re,ie,ae,ce,se]),ue=Q({role:a,content:le}),de=Q({title:Y().optional(),readOnlyHint:s6().optional(),destructiveHint:s6().optional(),idempotentHint:s6().optional(),openWorldHint:s6().optional()}),fe=m.extend({method:$(`notifications/tools/list_changed`),params:p.optional()}),R=Q({name:Y().optional()}),pe=Q({hints:Z(R).optional(),costPriority:X().min(0).max(1).optional(),speedPriority:X().min(0).max(1).optional(),intelligencePriority:X().min(0).max(1).optional()}),me=Q({mode:S6([`auto`,`required`,`none`]).optional()}),he=Q({type:$(`boolean`),title:Y().optional(),description:Y().optional(),default:s6().optional()}),ge=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),minLength:X().optional(),maxLength:X().optional(),format:S6([`email`,`uri`,`date`,`date-time`]).optional(),default:Y().optional()}),_e=Q({type:S6([`number`,`integer`]),title:Y().optional(),description:Y().optional(),minimum:X().optional(),maximum:X().optional(),default:X().optional()}),ve=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),default:Y().optional()}),ye=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),oneOf:Z(Q({const:Y(),title:Y()})),default:Y().optional()}),be=Q({type:$(`string`),title:Y().optional(),description:Y().optional(),enum:Z(Y()),enumNames:Z(Y()).optional(),default:Y().optional()}),xe=g6([ve,ye]),Se=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({type:$(`string`),enum:Z(Y())}),default:Z(Y()).optional()}),Ce=Q({type:$(`array`),title:Y().optional(),description:Y().optional(),minItems:X().optional(),maxItems:X().optional(),items:Q({anyOf:Z(Q({const:Y(),title:Y()}))}),default:Z(Y()).optional()}),we=g6([Se,Ce]),Te=g6([be,xe,we]),Ee=g6([Te,he,ge,_e]),De=f.extend({mode:$(`form`).optional(),message:Y(),requestedSchema:Q({type:$(`object`),properties:b6(Y(),Ee),required:Z(Y()).optional()}).catchall(d6())}),Oe=Q({type:$(`ref/resource`),uri:Y()}),ke=Q({type:$(`ref/prompt`),name:Y()}),Ae=Q({uri:Y().startsWith(`file://`),name:Y().optional(),_meta:b6(Y(),d6()).optional()}),je=S.shape,Me=Q({experimental:je.experimental,sampling:je.sampling,elicitation:je.elicitation,roots:je.roots,extensions:je.extensions}),Ne=C.shape,Pe=Q({experimental:Ne.experimental,logging:Ne.logging,completions:Ne.completions,prompts:Ne.prompts,resources:Ne.resources,tools:Ne.tools,extensions:Ne.extensions}),Fe=m6({progressToken:n.optional(),[P6]:Y(),[F6]:v.optional(),[L6]:Me,[R6]:o.optional()}),Ie=Q({..._.shape,...g.shape,description:Y().optional(),inputSchema:m6({$schema:Y().optional(),type:$(`object`)}),outputSchema:m6({$schema:Y().optional()}).optional(),annotations:de.optional(),_meta:b6(Y(),d6()).optional()}),Le=Q({type:$(`tool_result`),toolUseId:Y(),content:Z(le),structuredContent:d6().optional(),isError:s6().optional(),_meta:b6(Y(),d6()).optional()}),Re=g6([re,ie,ae,oe,Le]),ze=Q({role:a,content:g6([Re,Z(Re)]),_meta:b6(Y(),d6()).optional()}),Be=Y(),Ve=m6({[I6]:v.optional().catch(void 0)}),He=Ve.optional();function Ue(e){return m6({_meta:He,resultType:Be.default(`complete`),...e})}let We=Ue({}),Ge=Ue({nextCursor:r.optional()}),Ke=Ue({content:Z(le),structuredContent:d6().optional(),isError:s6().optional()}),qe=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),tools:Z(Ie),nextCursor:r.optional()}),Je=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),prompts:Z(L),nextCursor:r.optional()}),Ye=Ue({description:Y().optional(),messages:Z(ue)}),Xe=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),resources:Z(N),nextCursor:r.optional()}),Ze=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),resourceTemplates:Z(P),nextCursor:r.optional()}),Qe=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),contents:Z(g6([A,j]))}),$e=Ue({completion:Q({values:Z(Y()).max(100),total:X().int().optional(),hasMore:s6().optional()}).loose()}),et=Ue({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`])}),tt=Ue({ttlMs:X().int().min(0).catch(0),cacheScope:S6([`public`,`private`]).catch(`private`),supportedVersions:Z(Y()),capabilities:Pe,instructions:Y().optional()}),nt=Q({messages:Z(ze),modelPreferences:pe.optional(),systemPrompt:Y().optional(),includeContext:S6([`none`,`thisServer`,`allServers`]).optional(),temperature:X().optional(),maxTokens:X().int(),stopSequences:Z(Y()).optional(),metadata:t.optional(),tools:Z(Ie).optional(),toolChoice:me.optional()}),rt=Q({method:$(`sampling/createMessage`),params:nt}),it=Q({method:$(`roots/list`),params:Q({_meta:b6(Y(),d6()).optional()}).optional()}),at=Q({...ze.shape,model:Y(),stopReason:Y().optional()}),ot=Q({roots:Z(Ae)}),st=Q({action:S6([`accept`,`decline`,`cancel`]),content:b6(Y(),g6([Y(),X(),s6(),Z(Y())])).optional()}),ct=Q({mode:$(`url`),message:Y(),url:Y().url()}),lt=g6([De,ct]),ut=Q({method:$(`elicitation/create`),params:lt}),dt=g6([rt,it,ut]),ft=g6([at,ot,st]),pt=b6(Y(),dt),mt=b6(Y(),ft),ht=Ue({inputRequests:pt.optional(),requestState:Y().optional()}),gt={inputResponses:mt.optional(),requestState:Y().optional()},_t=Q({_meta:Fe,...gt}),vt=m6({progressToken:n.optional()});function yt(e,t){return Q({method:$(e),params:Q({_meta:Fe,...t})})}function bt(e,t){return Q({method:$(e),params:Q({_meta:vt.optional(),...t}).optional()})}let xt={name:Y(),arguments:b6(Y(),d6()).optional(),...gt},St={cursor:r.optional()},Ct=yt(`tools/call`,xt),wt=yt(`tools/list`,St),Tt=yt(`prompts/list`,St),Et=yt(`prompts/get`,{name:Y(),arguments:b6(Y(),Y()).optional(),...gt}),Dt=yt(`resources/list`,St),Ot=yt(`resources/templates/list`,St),kt=yt(`resources/read`,{uri:Y(),...gt}),At={ref:g6([ke,Oe]),argument:Q({name:Y(),value:Y()}),context:Q({arguments:b6(Y(),Y()).optional()}).optional()},jt=yt(`completion/complete`,At),Mt=yt(`server/discover`,{}),Nt=Q({toolsListChanged:s6().optional(),promptsListChanged:s6().optional(),resourcesListChanged:s6().optional(),resourceSubscriptions:Z(Y()).optional()}),Pt={notifications:Nt},Ft=yt(`subscriptions/listen`,Pt),It=Ve.extend({"io.modelcontextprotocol/subscriptionId":i}),Lt=m6({_meta:It,resultType:Be.default(`complete`)}),Rt={"tools/call":bt(`tools/call`,xt),"tools/list":bt(`tools/list`,St),"prompts/get":bt(`prompts/get`,{name:Y(),arguments:b6(Y(),Y()).optional()}),"prompts/list":bt(`prompts/list`,St),"resources/list":bt(`resources/list`,St),"resources/templates/list":bt(`resources/templates/list`,St),"resources/read":bt(`resources/read`,{uri:Y()}),"completion/complete":bt(`completion/complete`,At),"server/discover":bt(`server/discover`,{}),"subscriptions/listen":bt(`subscriptions/listen`,Pt)};function zt(e){return m6({_meta:He,...e})}let Bt={"tools/call":zt({content:Z(le),structuredContent:d6().optional(),isError:s6().optional()}),"tools/list":zt({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),tools:Z(Ie),nextCursor:r.optional()}),"prompts/get":zt({description:Y().optional(),messages:Z(ue)}),"prompts/list":zt({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),prompts:Z(L),nextCursor:r.optional()}),"resources/list":zt({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),resources:Z(N),nextCursor:r.optional()}),"resources/templates/list":zt({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),resourceTemplates:Z(P),nextCursor:r.optional()}),"resources/read":zt({ttlMs:X().int().min(0),cacheScope:S6([`public`,`private`]),contents:Z(g6([A,j]))}),"completion/complete":zt({completion:Q({values:Z(Y()).max(100),total:X().int().optional(),hasMore:s6().optional()}).loose()}),"server/discover":zt({ttlMs:X().int().min(0).catch(0),cacheScope:S6([`public`,`private`]).catch(`private`),supportedVersions:Z(Y()),capabilities:Pe,instructions:Y().optional()}),"subscriptions/listen":zt({})},Vt=m6({"io.modelcontextprotocol/subscriptionId":i.optional()}),Ht=Q({method:$(`notifications/subscriptions/acknowledged`),params:Q({_meta:Vt.optional(),notifications:Nt})}),Ut=Q({_meta:Vt.optional(),requestId:i,reason:Y().optional()}),Wt=Q({method:$(`notifications/cancelled`),params:Ut}),Gt={"notifications/cancelled":Wt,"notifications/progress":E,"notifications/message":O,"notifications/resources/updated":I,"notifications/resources/list_changed":F,"notifications/tools/list_changed":fe,"notifications/prompts/list_changed":ne,"notifications/subscriptions/acknowledged":Ht},Kt=e=>Q({jsonrpc:$(`2.0`),id:g6([Y(),X().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:g,BaseMetadataSchema:_,ImplementationSchema:v,ClientTasksCapabilitySchema:b,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:S,ServerCapabilitiesSchema:C,ProgressSchema:w,ProgressNotificationParamsSchema:T,ProgressNotificationSchema:E,LoggingMessageNotificationParamsSchema:D,LoggingMessageNotificationSchema:O,ResourceContentsSchema:k,TextResourceContentsSchema:A,BlobResourceContentsSchema:j,AnnotationsSchema:M,ResourceSchema:N,ResourceTemplateSchema:P,ResourceListChangedNotificationSchema:F,ResourceUpdatedNotificationParamsSchema:ee,ResourceUpdatedNotificationSchema:I,PromptArgumentSchema:te,PromptSchema:L,PromptListChangedNotificationSchema:ne,TextContentSchema:re,ImageContentSchema:ie,AudioContentSchema:ae,ToolUseContentSchema:oe,EmbeddedResourceSchema:se,ResourceLinkSchema:ce,ContentBlockSchema:le,PromptMessageSchema:ue,ToolAnnotationsSchema:de,ToolListChangedNotificationSchema:fe,ModelHintSchema:R,ModelPreferencesSchema:pe,ToolChoiceSchema:me,BooleanSchemaSchema:he,StringSchemaSchema:ge,NumberSchemaSchema:_e,UntitledSingleSelectEnumSchemaSchema:ve,TitledSingleSelectEnumSchemaSchema:ye,LegacyTitledEnumSchemaSchema:be,SingleSelectEnumSchemaSchema:xe,UntitledMultiSelectEnumSchemaSchema:Se,TitledMultiSelectEnumSchemaSchema:Ce,MultiSelectEnumSchemaSchema:we,EnumSchemaSchema:Te,PrimitiveSchemaDefinitionSchema:Ee,ElicitRequestFormParamsSchema:De,ResourceTemplateReferenceSchema:Oe,PromptReferenceSchema:ke,RootSchema:Ae,ClientCapabilities2026Schema:Me,ServerCapabilities2026Schema:Pe,RequestMetaEnvelopeSchema:Fe,ToolSchema:Ie,ToolResultContentSchema:Le,SamplingMessageContentBlockSchema:Re,SamplingMessageSchema:ze,ResultTypeSchema:Be,ResultMetaSchema:Ve,ResultSchema:We,PaginatedResultSchema:Ge,CallToolResultSchema:Ke,ListToolsResultSchema:qe,ListPromptsResultSchema:Je,GetPromptResultSchema:Ye,ListResourcesResultSchema:Xe,ListResourceTemplatesResultSchema:Ze,ReadResourceResultSchema:Qe,CompleteResultSchema:$e,CacheableResultSchema:et,DiscoverResultSchema:tt,CreateMessageRequestParamsSchema:nt,CreateMessageRequestSchema:rt,ListRootsRequestSchema:it,CreateMessageResultSchema:at,ListRootsResultSchema:ot,ElicitResultSchema:st,ElicitRequestURLParamsSchema:ct,ElicitRequestParamsSchema:lt,ElicitRequestSchema:ut,InputRequestSchema:dt,InputResponseSchema:ft,InputRequestsSchema:pt,InputResponsesSchema:mt,InputRequiredResultSchema:ht,InputResponseRequestParamsSchema:_t,CallToolRequestSchema:Ct,ListToolsRequestSchema:wt,ListPromptsRequestSchema:Tt,GetPromptRequestSchema:Et,ListResourcesRequestSchema:Dt,ListResourceTemplatesRequestSchema:Ot,ReadResourceRequestSchema:kt,CompleteRequestSchema:jt,DiscoverRequestSchema:Mt,SubscriptionFilterSchema:Nt,SubscriptionsListenRequestSchema:Ft,SubscriptionsListenResultMetaSchema:It,SubscriptionsListenResultSchema:Lt,dispatchRequestSchemas:Rt,dispatchResultSchemas:Bt,NotificationMetaSchema:Vt,SubscriptionsAcknowledgedNotificationSchema:Ht,CancelledNotificationParamsSchema:Ut,CancelledNotificationSchema:Wt,notificationSchemas2026:Gt,JSONRPCResultResponseSchema:Kt(We),CallToolResultResponseSchema:Kt(g6([Ke,ht])),ListToolsResultResponseSchema:Kt(qe),ListPromptsResultResponseSchema:Kt(Je),GetPromptResultResponseSchema:Kt(g6([Ye,ht])),ListResourcesResultResponseSchema:Kt(Xe),ListResourceTemplatesResultResponseSchema:Kt(Ze),ReadResourceResultResponseSchema:Kt(g6([Qe,ht])),CompleteResultResponseSchema:Kt($e),DiscoverResultResponseSchema:Kt(tt),SubscriptionsListenResultResponseSchema:Kt(Lt)}}var xNe;function Z7(){return xNe??=bNe()}var SNe=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function CNe(e){return SNe.includes(e)}var Q7=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function wNe(e){return e[Q7]}function $7(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function e9(e){return e===`public`||e===`private`}var t9=function(e){return 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.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),n9=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,A7(this,new.target)}static fromError(t,n,r){if(t===t9.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new ENe(e.elicitations,n)}if(t===t9.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new DNe({supported:e.supported,requested:e.requested},n)}if(t===t9.InvalidParams||t===t9.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===t9.ResourceNotFound||Object.keys(e).length===1))return new TNe(e.uri,n)}if(t===t9.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new ONe({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},TNe=class extends n9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(t9.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},ENe=class extends n9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(t9.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},DNe=class extends n9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(t9.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ONe=class extends n9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(t9.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},kNe=0,ANe=`private`,jNe=[`tools/call`,`prompts/get`,`resources/read`];function MNe(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||jNe.includes(e))return t;throw new n9(t9.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function NNe(e,t){let n=wNe(t);if(t.resultType!==`complete`||!CNe(e))return n===void 0?t:RNe(t);let r=t,i=$7(r.ttlMs)?r.ttlMs:INe(n),a=e9(r.cacheScope)?r.cacheScope:LNe(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Q7],o}function PNe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function FNe(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[I6]:t}}:!PNe(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[I6]:t}}}function INe(e){return e!==void 0&&$7(e.ttlMs)?e.ttlMs:kNe}function LNe(e){return e!==void 0&&e9(e.cacheScope)?e.cacheScope:ANe}function RNe(e){let t={...e};return delete t[Q7],t}var zNe=[`elicitation/create`,`sampling/createMessage`,`roots/list`],r9;function i9(){if(r9)return r9;let e=Z7();return r9={request:{"elicitation/create":Q({method:$(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":Q({method:$(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":Q({method:$(`roots/list`),params:m6({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},r9}function a9(e){return zNe.includes(e)}function o9(e){return a9(e)?i9().request[e]:void 0}function BNe(e){return a9(e)?i9().response[e]:void 0}var s9={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},c9={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function l9(e){return Object.prototype.hasOwnProperty.call(s9,e)}function u9(e){return Object.prototype.hasOwnProperty.call(c9,e)}function VNe(e){return Object.prototype.hasOwnProperty.call(s9,e)}function HNe(e){return l9(e)?Z7().dispatchRequestSchemas[e]:void 0}function UNe(e){return VNe(e)?Z7().dispatchResultSchemas[e]:void 0}function WNe(e){return u9(e)?Z7().notificationSchemas2026[e]:void 0}Object.keys(s9),Object.keys(c9);function d9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f9(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var GNe={ok:!1,reason:`not-in-era`},KNe=[P6,L6];function qNe(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>d9(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!d9(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(d9(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var p9={era:`2026-07-28`,hasRequestMethod:l9,hasNotificationMethod:u9,hasInputRequestMethod:e=>o9(e)!==void 0,validateRequest:(e,t)=>f9(HNe(e),t),validateResult:(e,t)=>f9(UNe(e),t),validateNotification:(e,t)=>f9(WNe(e),t),validateInputRequest:(e,t)=>f9(o9(e),t),validateInputResponse:(e,t)=>f9(BNe(e),t),samplingResultVariant:()=>GNe,outboundEnvelope(e){return{[P6]:e.protocolVersion,[F6]:e.clientInfo,[L6]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of KNe)n in e||t.push({key:n,problem:`missing`});let n=Z7().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>P7(e),inputRequestSchema:o9,decodeResult(e,t){if(!d9(t))return{kind:`invalid`,error:new N7(M7.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new N7(M7.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new N7(M7.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=d9(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:Z7().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new N7(M7.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new N7(M7.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=JNe(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new N7(M7.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return FNe(NNe(e,MNe(e,qNe(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=Z7().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},m9;function JNe(){if(m9)return m9;let e=Z7();return m9={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},m9}var YNe=`2026-07-28`;function h9(e){return e!==void 0&&cNe(e)?p9:X7}function g9(e){return e.revision===void 0?e.era===`modern`?p9.era:X7.era:h9(e.revision).era}function _9(e){return b9.some(t=>t.hasRequestMethod(e))}function v9(e){return b9.some(t=>t.hasNotificationMethod(e))}function y9(e){return e===`tasks/get`||e===`tasks/cancel`}var b9=[X7,p9],XNe=XEe({AnnotationsSchema:()=>P8,AudioContentSchema:()=>p5,BaseMetadataSchema:()=>u8,BaseRequestParamsSchema:()=>K6,BlobResourceContentsSchema:()=>M8,BooleanSchemaSchema:()=>K5,CallToolRequestParamsSchema:()=>D5,CallToolRequestSchema:()=>O5,CallToolResultSchema:()=>E5,CancelTaskRequestSchema:()=>GMe,CancelTaskResultSchema:()=>KMe,CancelledNotificationParamsSchema:()=>o8,CancelledNotificationSchema:()=>s8,ClientCapabilitiesSchema:()=>m8,ClientNotificationSchema:()=>JMe,ClientRequestSchema:()=>qMe,ClientResultSchema:()=>YMe,ClientTasksCapabilitySchema:()=>f8,CompatibilityCallToolResultSchema:()=>PMe,CompleteRequestParamsSchema:()=>p7,CompleteRequestSchema:()=>m7,CompleteResultSchema:()=>h7,ContentBlockSchema:()=>_5,CreateMessageRequestParamsSchema:()=>H5,CreateMessageRequestSchema:()=>U5,CreateMessageResultSchema:()=>W5,CreateMessageResultWithToolsSchema:()=>G5,CreateTaskResultSchema:()=>LMe,CursorSchema:()=>H6,DiscoverRequestSchema:()=>b8,DiscoverResultSchema:()=>x8,ElicitRequestFormParamsSchema:()=>i7,ElicitRequestParamsSchema:()=>o7,ElicitRequestSchema:()=>s7,ElicitRequestURLParamsSchema:()=>a7,ElicitResultSchema:()=>u7,ElicitationCompleteNotificationParamsSchema:()=>c7,ElicitationCompleteNotificationSchema:()=>l7,EmbeddedResourceSchema:()=>h5,EmptyResultSchema:()=>a8,EnumSchemaSchema:()=>n7,GetPromptRequestParamsSchema:()=>l5,GetPromptRequestSchema:()=>u5,GetPromptResultSchema:()=>y5,GetTaskPayloadRequestSchema:()=>VMe,GetTaskPayloadResultSchema:()=>HMe,GetTaskRequestSchema:()=>zMe,GetTaskResultSchema:()=>BMe,IconSchema:()=>c8,IconsSchema:()=>l8,ImageContentSchema:()=>f5,ImplementationSchema:()=>d8,InitializeRequestParamsSchema:()=>h8,InitializeRequestSchema:()=>g8,InitializeResultSchema:()=>v8,InitializedNotificationSchema:()=>y8,JSONArraySchema:()=>jMe,JSONObjectSchema:()=>B6,JSONRPCErrorResponseSchema:()=>r8,JSONRPCMessageSchema:()=>i8,JSONRPCNotificationSchema:()=>t8,JSONRPCRequestSchema:()=>e8,JSONRPCResponseSchema:()=>MMe,JSONRPCResultResponseSchema:()=>n8,JSONValueSchema:()=>z6,LegacyTitledEnumSchemaSchema:()=>Z5,ListChangedOptionsBaseSchema:()=>FMe,ListPromptsRequestSchema:()=>s5,ListPromptsResultSchema:()=>c5,ListResourceTemplatesRequestSchema:()=>z8,ListResourceTemplatesResultSchema:()=>B8,ListResourcesRequestSchema:()=>L8,ListResourcesResultSchema:()=>R8,ListRootsRequestSchema:()=>_7,ListRootsResultSchema:()=>v7,ListTasksRequestSchema:()=>UMe,ListTasksResultSchema:()=>WMe,ListToolsRequestSchema:()=>w5,ListToolsResultSchema:()=>T5,LoggingLevelSchema:()=>A5,LoggingMessageNotificationParamsSchema:()=>N5,LoggingMessageNotificationSchema:()=>P5,ModelHintSchema:()=>F5,ModelPreferencesSchema:()=>I5,MultiSelectEnumSchemaSchema:()=>t7,NotificationSchema:()=>X6,NotificationsParamsSchema:()=>Y6,NumberSchemaSchema:()=>J5,PaginatedRequestParamsSchema:()=>E8,PaginatedRequestSchema:()=>D8,PaginatedResultSchema:()=>O8,PingRequestSchema:()=>S8,PrimitiveSchemaDefinitionSchema:()=>r7,ProgressNotificationParamsSchema:()=>w8,ProgressNotificationSchema:()=>T8,ProgressSchema:()=>C8,ProgressTokenSchema:()=>V6,PromptArgumentSchema:()=>a5,PromptListChangedNotificationSchema:()=>b5,PromptMessageSchema:()=>v5,PromptReferenceSchema:()=>f7,PromptSchema:()=>o5,ReadResourceRequestParamsSchema:()=>H8,ReadResourceRequestSchema:()=>U8,ReadResourceResultSchema:()=>W8,RelatedTaskMetadataSchema:()=>W6,RequestIdSchema:()=>$6,RequestMetaSchema:()=>G6,RequestSchema:()=>J6,ResourceContentsSchema:()=>k8,ResourceLinkSchema:()=>g5,ResourceListChangedNotificationSchema:()=>G8,ResourceRequestParamsSchema:()=>V8,ResourceSchema:()=>F8,ResourceTemplateReferenceSchema:()=>d7,ResourceTemplateSchema:()=>I8,ResourceUpdatedNotificationParamsSchema:()=>r5,ResourceUpdatedNotificationSchema:()=>i5,ResultMetaObjectSchema:()=>Z6,ResultSchema:()=>Q6,RoleSchema:()=>N8,RootSchema:()=>g7,RootsListChangedNotificationSchema:()=>y7,SamplingContentSchema:()=>z5,SamplingMessageContentBlockSchema:()=>B5,SamplingMessageSchema:()=>V5,ServerCapabilitiesSchema:()=>_8,ServerNotificationSchema:()=>ZMe,ServerRequestSchema:()=>XMe,ServerResultSchema:()=>QMe,ServerTasksCapabilitySchema:()=>p8,SetLevelRequestParamsSchema:()=>j5,SetLevelRequestSchema:()=>M5,SingleSelectEnumSchemaSchema:()=>Q5,StringSchemaSchema:()=>q5,SubscribeRequestParamsSchema:()=>K8,SubscribeRequestSchema:()=>q8,SubscriptionFilterSchema:()=>X8,SubscriptionsAcknowledgedNotificationParamsSchema:()=>$8,SubscriptionsAcknowledgedNotificationSchema:()=>e5,SubscriptionsListenRequestParamsSchema:()=>Z8,SubscriptionsListenRequestSchema:()=>Q8,SubscriptionsListenResultMetaSchema:()=>t5,SubscriptionsListenResultSchema:()=>n5,TaskAugmentedRequestParamsSchema:()=>q6,TaskCreationParamsSchema:()=>IMe,TaskMetadataSchema:()=>U6,TaskSchema:()=>x7,TaskStatusNotificationParamsSchema:()=>S7,TaskStatusNotificationSchema:()=>RMe,TaskStatusSchema:()=>b7,TextContentSchema:()=>d5,TextResourceContentsSchema:()=>A8,TitledMultiSelectEnumSchemaSchema:()=>e7,TitledSingleSelectEnumSchemaSchema:()=>X5,ToolAnnotationsSchema:()=>x5,ToolChoiceSchema:()=>L5,ToolExecutionSchema:()=>S5,ToolListChangedNotificationSchema:()=>k5,ToolResultContentSchema:()=>R5,ToolSchema:()=>C5,ToolUseContentSchema:()=>m5,UnsubscribeRequestParamsSchema:()=>J8,UnsubscribeRequestSchema:()=>Y8,UntitledMultiSelectEnumSchemaSchema:()=>$5,UntitledSingleSelectEnumSchemaSchema:()=>Y5}),ZNe=e=>e8.safeParse(e).success,QNe=e=>t8.safeParse(e).success,x9=e=>n8.safeParse(e).success,$Ne=e=>r8.safeParse(e).success;t9.InvalidRequest,t9.UnsupportedProtocolVersion,t9.InvalidParams,t9.MethodNotFound,t9.InvalidParams,t9.MissingRequiredClientCapability,t9.ParseError,t9.InvalidRequest,t9.MethodNotFound,t9.UnsupportedProtocolVersion,t9.MissingRequiredClientCapability;function S9(e,t){return J3(e,t)}function C9(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function w9(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var T9=!1,E9=`draft-2020-12`;function ePe(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:E9});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);T9||(T9=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=W3(e,{target:E9,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&D9(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function D9(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||D9(e)))}return!1}function tPe(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function O9(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>tPe(e)).join(`, `)}:{success:!0,data:n.value}}function nPe(e){let t=W3(e,{target:E9,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var rPe=/\\\.\\d\{(\d+)\}/;function iPe(e){let t=rPe.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>N6({local:e,offset:t,precision:n}))))}function aPe(e,t){let n;switch(e){case`email`:n=[Nje()];break;case`uri`:n=[i6()];break;case`date`:n=[EMe()];break;case`date-time`:n=iPe(t)}return new Set(n.map(e=>nPe(e)).filter(e=>e!==void 0))}function oPe(e,t,n){return n!==`zod`||aPe(e,t).has(t)}function k9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sPe(e){try{return ePe(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new n9(t9.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var cPe=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function A9(e){return cPe.has(e)||e.startsWith(`x-`)}var lPe=new Set([`$schema`,...Object.keys(i7.shape.requestedSchema.shape)]),j9={string:C9([q5,Y5,X5,Z5]),number:C9([J5]),integer:C9([J5]),boolean:C9([K5]),array:C9([$5,e7])},uPe=new Set(q5.shape.format.unwrap().options);function dPe(e,t,n,r){if(!k9(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(j9,e.type)?j9[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||A9(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?uPe.has(e.format)?(typeof s!=`string`||!oPe(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function fPe(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&k9(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,dPe(n,`properties.${e}`,t,r)])):lPe.has(i)?n[i]=a:A9(i)||r.push(i);if(r.length>0)throw new n9(t9.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function pPe(e,t){if(!k9(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!S9(r7,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function M9(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>M9(e,t[r],`${n}[${r}]`)):!k9(e)||!k9(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?M9(r,t[e],i):A9(e)?[]:[i]})}function mPe(e){if(!w9(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=fPe(sPe(e.requestedSchema),t),r=S9(i7.shape.requestedSchema,n);if(!r.success)throw new n9(t9.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${pPe(n,r.error.message)}`);let i=M9(n,r.data);if(i.length>0)throw new n9(t9.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new n9(t9.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function hPe(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(hPe,{elicit(e){try{return{method:`elicitation/create`,params:mPe(e)}}catch(e){throw e instanceof n9?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var gPe=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),_Pe={IdJagTokenExchangeResponseSchema:nNe,OAuthClientInformationFullSchema:iNe,OAuthClientInformationSchema:O7,OAuthClientMetadataSchema:D7,OAuthClientRegistrationErrorSchema:aNe,OAuthErrorResponseSchema:rNe,OAuthMetadataSchema:w7,OAuthProtectedResourceMetadataSchema:$Me,OAuthTokenRevocationRequestSchema:oNe,OAuthTokensSchema:tNe,OpenIdProviderDiscoveryMetadataSchema:eNe,OpenIdProviderMetadataSchema:T7},N9={},P9={};function F9(e,t){let n=e.slice(0,-6);N9[n]=t,P9[n]=e=>t.safeParse(e).success}for(let e of gPe)F9(e,XNe[e]);for(let[e,t]of Object.entries(_Pe))F9(e,t);Object.freeze(N9),Object.freeze(P9);function vPe(e){switch(e){case`initialize`:case`notifications/initialized`:return h9(void 0);case`server/discover`:return h9(YNe);default:return}}var yPe=[P6,F6,L6,R6],bPe=[`inputResponses`,`requestState`];function I9(e,t){let n=e.params;if(!z9(n))return{message:e,lifted:{}};let r=n._meta,i=z9(r)?yPe.filter(e=>e in r):[],a=t===`request`?bPe.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&z9(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function L9(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function R9(e){return()=>e}var xPe=R9(void 0),SPe=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??OMe,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new N7(M7.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&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),new N7(M7.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){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{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),x9(e)||$Ne(e)?this._onresponse(e):ZNe(e)?this._onrequest(e,t):QNe(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new N7(M7.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=I9(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=g9(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(v9(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=I9(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=g9(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(t9.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(_9(n.method)&&!i.hasRequestMethod(n.method)&&!(y9(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(t9.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(t9.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(t9.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:CPe(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?xPe:R9(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),w9(t))return u(e,t,n);let i=L9(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(t9.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:t9.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.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._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),x9(e)?n(e):n(n9.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(w9(t))return y9(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=L9(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return h9(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=vPe(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(_9(t)&&!e.hasRequestMethod(t))throw new N7(M7.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof N7?e:new N7(M7.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof N7?e:new N7(M7.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(wPe(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;O9(n,o).then(e=>{e.success?d(e.data):f(new N7(M7.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new N7(M7.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new N7(M7.NotConnected,`Not connected`);if(v9(t.method)&&!e.hasNotificationMethod(t.method))throw new N7(M7.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!_9(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new n9(t9.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await O9(t.params,{...r.params});if(!a.success)throw new n9(t9.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.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,n){if(typeof t==`function`){if(!v9(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new n9(t9.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await O9(t.params,{...r.params});if(!i.success)throw new n9(t9.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function z9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function B9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function CPe(e){let t={},n=[];if(!B9(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!B9(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function wPe(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}YEe((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),typeof self<`u`&&self.location&&self.location.origin!==`null`?new URL(self.location.origin+self.location.pathname+location.search):new URL(`https://github.com/cfworker`);var TPe=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,EPe=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,DPe=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,OPe=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,kPe=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,APe=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,jPe=/^(?:\/(?:[^~/]|~0|~1)*)*$/,MPe=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,NPe=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,PPe=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,FPe=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function V9(e){return e.test.bind(e)}IPe.bind(void 0,!1),V9(DPe),V9(OPe),V9(kPe),V9(EPe),V9(PPe),V9(FPe),V9(APe),V9(jPe),V9(MPe),V9(NPe);function IPe(e,t){let n=t.match(TPe);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}globalThis.crypto;var H9=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e){super(e),this.name=new.target.name,A7(this,new.target)}};(class extends H9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}}),class extends H9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.RegistrationRejectedError`})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},class extends H9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends H9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},class extends H9{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsufficientScopeError`})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:``}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,A7(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return j7(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return j7(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,A7(this,new.target)}};var LPe=class{_eventSlots=new Map;setHandler(e,t){let n=this._ensureEventSlot(e);n.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),n.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let n=this._eventSlots.get(e);if(!n)return;let r=n.listeners.indexOf(t);r!==-1&&n.listeners.splice(r,1)}dispatch(e,t){let n=this._eventSlots.get(e);if(n){n.onHandler?.(t);for(let e of[...n.listeners])e(t)}}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}},RPe=class{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}},U9=new Set;function W9(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;U9.has(o)||(U9.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},zPe(t)):e=>s({method:a,params:e})]}function zPe(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var BPe=`2026-01-26`,G9=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=i8.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},VPe=g6([$(`light`),$(`dark`)]).describe(`Color theme preference for the host environment.`),K9=g6([$(`inline`),$(`fullscreen`),$(`pip`)]).describe(`Display mode for UI presentation.`),HPe=b6(g6([$(`--color-background-primary`),$(`--color-background-secondary`),$(`--color-background-tertiary`),$(`--color-background-inverse`),$(`--color-background-ghost`),$(`--color-background-info`),$(`--color-background-danger`),$(`--color-background-success`),$(`--color-background-warning`),$(`--color-background-disabled`),$(`--color-text-primary`),$(`--color-text-secondary`),$(`--color-text-tertiary`),$(`--color-text-inverse`),$(`--color-text-ghost`),$(`--color-text-info`),$(`--color-text-danger`),$(`--color-text-success`),$(`--color-text-warning`),$(`--color-text-disabled`),$(`--color-border-primary`),$(`--color-border-secondary`),$(`--color-border-tertiary`),$(`--color-border-inverse`),$(`--color-border-ghost`),$(`--color-border-info`),$(`--color-border-danger`),$(`--color-border-success`),$(`--color-border-warning`),$(`--color-border-disabled`),$(`--color-ring-primary`),$(`--color-ring-secondary`),$(`--color-ring-inverse`),$(`--color-ring-info`),$(`--color-ring-danger`),$(`--color-ring-success`),$(`--color-ring-warning`),$(`--font-sans`),$(`--font-mono`),$(`--font-weight-normal`),$(`--font-weight-medium`),$(`--font-weight-semibold`),$(`--font-weight-bold`),$(`--font-text-xs-size`),$(`--font-text-sm-size`),$(`--font-text-md-size`),$(`--font-text-lg-size`),$(`--font-heading-xs-size`),$(`--font-heading-sm-size`),$(`--font-heading-md-size`),$(`--font-heading-lg-size`),$(`--font-heading-xl-size`),$(`--font-heading-2xl-size`),$(`--font-heading-3xl-size`),$(`--font-text-xs-line-height`),$(`--font-text-sm-line-height`),$(`--font-text-md-line-height`),$(`--font-text-lg-line-height`),$(`--font-heading-xs-line-height`),$(`--font-heading-sm-line-height`),$(`--font-heading-md-line-height`),$(`--font-heading-lg-line-height`),$(`--font-heading-xl-line-height`),$(`--font-heading-2xl-line-height`),$(`--font-heading-3xl-line-height`),$(`--border-radius-xs`),$(`--border-radius-sm`),$(`--border-radius-md`),$(`--border-radius-lg`),$(`--border-radius-xl`),$(`--border-radius-full`),$(`--border-width-regular`),$(`--shadow-hairline`),$(`--shadow-sm`),$(`--shadow-md`),$(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`).describe(`Style variables for theming MCP apps. Individual style keys are optional - hosts may provide any subset of these values. Values are strings containing CSS values (colors, sizes, font stacks, etc.). @@ -182,10 +182,10 @@ Values are strings containing CSS values (colors, sizes, font stacks, etc.). Note: This type uses \`Record\` rather than \`Partial>\` -for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);Q({method:$(`ui/open-link`),params:Q({url:Y().describe(`URL to open in the host's browser`)})});var zPe=Q({isError:s6().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),BPe=Q({isError:s6().optional().describe(`True if the download failed (e.g., user cancelled or host denied).`)}).passthrough(),VPe=Q({isError:s6().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough();Q({method:$(`ui/notifications/sandbox-proxy-ready`),params:Q({})});var J9=Q({connectDomains:Z(Y()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket). +for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);Q({method:$(`ui/open-link`),params:Q({url:Y().describe(`URL to open in the host's browser`)})});var UPe=Q({isError:s6().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),WPe=Q({isError:s6().optional().describe(`True if the download failed (e.g., user cancelled or host denied).`)}).passthrough(),GPe=Q({isError:s6().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough();Q({method:$(`ui/notifications/sandbox-proxy-ready`),params:Q({})});var q9=Q({connectDomains:Z(Y()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket). - Maps to CSP \`connect-src\` directive -- Empty or omitted → no network connections (secure default)`),resourceDomains:Z(Y()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:Z(Y()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:Z(Y()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Y9=Q({camera:Q({}).optional().describe(`Request camera access. +- Empty or omitted → no network connections (secure default)`),resourceDomains:Z(Y()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:Z(Y()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:Z(Y()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),J9=Q({camera:Q({}).optional().describe(`Request camera access. Maps to Permission Policy \`camera\` feature.`),microphone:Q({}).optional().describe(`Request microphone access. @@ -193,7 +193,7 @@ Maps to Permission Policy \`geolocation\` feature.`),clipboardWrite:Q({}).optional().describe(`Request clipboard write access. -Maps to Permission Policy \`clipboard-write\` feature.`)});Q({method:$(`ui/notifications/size-changed`),params:Q({width:X().optional().describe(`New width in pixels.`),height:X().optional().describe(`New height in pixels.`)})});var HPe=Q({method:$(`ui/notifications/tool-input`),params:Q({arguments:b6(Y(),d6().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),UPe=Q({method:$(`ui/notifications/tool-input-partial`),params:Q({arguments:b6(Y(),d6().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),WPe=Q({method:$(`ui/notifications/tool-cancelled`),params:Q({reason:Y().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})}),GPe=Q({fonts:Y().optional()}),KPe=Q({variables:RPe.optional().describe(`CSS variables for theming the app.`),css:GPe.optional().describe(`CSS blocks that apps can inject.`)}),qPe=Q({method:$(`ui/resource-teardown`),params:Q({})}),JPe=b6(Y(),d6()),X9=Q({text:Q({}).optional().describe(`Host supports text content blocks.`),image:Q({}).optional().describe(`Host supports image content blocks.`),audio:Q({}).optional().describe(`Host supports audio content blocks.`),resource:Q({}).optional().describe(`Host supports resource content blocks.`),resourceLink:Q({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:Q({}).optional().describe(`Host supports structured content.`)});Q({method:$(`ui/notifications/request-teardown`),params:Q({}).optional()});var YPe=Q({experimental:b6(Y(),b6(Y(),u6()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),openLinks:Q({}).optional().describe(`Host supports opening external URLs.`),downloadFile:Q({}).optional().describe(`Host supports file downloads via ui/download-file.`),serverTools:Q({listChanged:s6().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:Q({listChanged:s6().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:Q({}).optional().describe(`Host accepts log messages.`),sandbox:Q({permissions:Y9.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:J9.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:X9.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:X9.optional().describe(`Host supports receiving content messages (ui/message) from the view.`),sampling:Q({tools:Q({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),XPe=Q({experimental:b6(Y(),b6(Y(),u6()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),tools:Q({listChanged:s6().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:Z(q9).optional().describe(`Display modes the app supports.`)});Q({method:$(`ui/notifications/initialized`),params:Q({}).optional()}),Q({csp:J9.optional().describe(`Content Security Policy configuration for UI resources.`),permissions:Y9.optional().describe(`Sandbox permissions requested by the UI resource.`),domain:Y().optional().describe(`Dedicated origin for view sandbox. +Maps to Permission Policy \`clipboard-write\` feature.`)});Q({method:$(`ui/notifications/size-changed`),params:Q({width:X().optional().describe(`New width in pixels.`),height:X().optional().describe(`New height in pixels.`)})});var KPe=Q({method:$(`ui/notifications/tool-input`),params:Q({arguments:b6(Y(),d6().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),qPe=Q({method:$(`ui/notifications/tool-input-partial`),params:Q({arguments:b6(Y(),d6().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),JPe=Q({method:$(`ui/notifications/tool-cancelled`),params:Q({reason:Y().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})}),YPe=Q({fonts:Y().optional()}),XPe=Q({variables:HPe.optional().describe(`CSS variables for theming the app.`),css:YPe.optional().describe(`CSS blocks that apps can inject.`)}),ZPe=Q({method:$(`ui/resource-teardown`),params:Q({})}),QPe=b6(Y(),d6()),Y9=Q({text:Q({}).optional().describe(`Host supports text content blocks.`),image:Q({}).optional().describe(`Host supports image content blocks.`),audio:Q({}).optional().describe(`Host supports audio content blocks.`),resource:Q({}).optional().describe(`Host supports resource content blocks.`),resourceLink:Q({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:Q({}).optional().describe(`Host supports structured content.`)});Q({method:$(`ui/notifications/request-teardown`),params:Q({}).optional()});var $Pe=Q({experimental:b6(Y(),b6(Y(),u6()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),openLinks:Q({}).optional().describe(`Host supports opening external URLs.`),downloadFile:Q({}).optional().describe(`Host supports file downloads via ui/download-file.`),serverTools:Q({listChanged:s6().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:Q({listChanged:s6().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:Q({}).optional().describe(`Host accepts log messages.`),sandbox:Q({permissions:J9.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:q9.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:Y9.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:Y9.optional().describe(`Host supports receiving content messages (ui/message) from the view.`),sampling:Q({tools:Q({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),eFe=Q({experimental:b6(Y(),b6(Y(),u6()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),tools:Q({listChanged:s6().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:Z(K9).optional().describe(`Display modes the app supports.`)});Q({method:$(`ui/notifications/initialized`),params:Q({}).optional()}),Q({csp:q9.optional().describe(`Content Security Policy configuration for UI resources.`),permissions:J9.optional().describe(`Sandbox permissions requested by the UI resource.`),domain:Y().optional().describe(`Dedicated origin for view sandbox. Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists. @@ -207,10 +207,10 @@ - \`true\`: request visible border + background - \`false\`: request no visible border + background -- omitted: host decides border`)}),Q({method:$(`ui/request-display-mode`),params:Q({mode:q9.describe(`The display mode being requested.`)})});var ZPe=Q({mode:q9.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),QPe=g6([$(`model`),$(`app`)]).describe(`Tool visibility scope - who can access the tool.`);Q({resourceUri:Y().optional(),visibility:Z(QPe).optional().describe(`Who can access this tool. Default: ["model", "app"] +- omitted: host decides border`)}),Q({method:$(`ui/request-display-mode`),params:Q({mode:K9.describe(`The display mode being requested.`)})});var tFe=Q({mode:K9.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),nFe=g6([$(`model`),$(`app`)]).describe(`Tool visibility scope - who can access the tool.`);Q({resourceUri:Y().optional(),visibility:Z(nFe).optional().describe(`Who can access this tool. Default: ["model", "app"] - "model": Tool visible to and callable by the agent -- "app": Tool callable by the app from this server only`),csp:f6().optional(),permissions:f6().optional()}),Q({mimeTypes:Z(Y()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),Q({method:$(`ui/download-file`),params:Q({contents:Z(g6([h5,g5])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),Q({method:$(`ui/message`),params:Q({role:$(`user`).describe(`Message role, currently only "user" is supported.`),content:Z(_5).describe(`Message content blocks (text, image, etc.).`)})}),Q({method:$(`ui/notifications/sandbox-resource-ready`),params:Q({html:Y().describe(`HTML content to load into the inner iframe.`),sandbox:Y().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:J9.optional().describe(`CSP configuration from resource metadata.`),permissions:Y9.optional().describe(`Sandbox permissions from resource metadata.`)})});var $Pe=Q({method:$(`ui/notifications/tool-result`),params:E5.describe(`Standard MCP tool execution result.`)}),Z9=Q({toolInfo:Q({id:$6.optional().describe(`JSON-RPC id of the tools/call request.`),tool:C5.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:LPe.optional().describe(`Current color theme preference.`),styles:KPe.optional().describe(`Style configuration for theming the app.`),displayMode:q9.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:Z(q9).optional().describe(`Display modes the host supports.`),containerDimensions:g6([Q({height:X().describe(`Fixed container height in pixels.`)}),Q({maxHeight:g6([X(),c6()]).optional().describe(`Maximum container height in pixels.`)})]).and(g6([Q({width:X().describe(`Fixed container width in pixels.`)}),Q({maxWidth:g6([X(),c6()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other -container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:Y().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:Y().optional().describe(`User's timezone in IANA format.`),userAgent:Y().optional().describe(`Host application identifier.`),platform:g6([$(`web`),$(`desktop`),$(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:Q({touch:s6().optional().describe(`Whether the device supports touch input.`),hover:s6().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:Q({top:X().describe(`Top safe area inset in pixels.`),right:X().describe(`Right safe area inset in pixels.`),bottom:X().describe(`Bottom safe area inset in pixels.`),left:X().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),eFe=Q({method:$(`ui/notifications/host-context-changed`),params:Z9.describe(`Partial context update containing only changed fields.`)});Q({method:$(`ui/update-model-context`),params:Q({content:Z(_5).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:b6(Y(),d6().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),Q({method:$(`ui/initialize`),params:Q({appInfo:d8.describe(`App identification (name and version).`),appCapabilities:XPe.describe(`Features and capabilities this app provides.`),protocolVersion:Y().describe(`Protocol version this app supports.`)})});var tFe=Q({protocolVersion:Y().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:d8.describe(`Host application identification and version.`),hostCapabilities:YPe.describe(`Features and capabilities provided by the host.`),hostContext:Z9.describe(`Rich context about the host environment.`)}).passthrough(),nFe={target:`draft-2020-12`};async function Q9(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](nFe);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function $9(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function rFe(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var iFe=class e extends yPe{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new NPe;_methods=new PPe;setRequestHandler=(...e)=>{let[t,...n]=G9(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=G9(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:HPe,toolinputpartial:UPe,toolresult:$Pe,toolcancelled:WPe,hostcontextchanged:eFe};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),!n.allowUnsafeEval&&b2({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.params),{})),this.setEventHandler(`hostcontextchanged`,void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after transport is established`);this._appCapabilities=rFe(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await $9(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await $9(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Q9(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Q9(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),n}))}))}async sendToolListChanged(e={}){this._assertInitialized(`sendToolListChanged`),await this.notification({method:`notifications/tools/list_changed`,params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler(`toolinput`)}set ontoolinput(e){this.setEventHandler(`toolinput`,e)}get ontoolinputpartial(){return this.getEventHandler(`toolinputpartial`)}set ontoolinputpartial(e){this.setEventHandler(`toolinputpartial`,e)}get ontoolresult(){return this.getEventHandler(`toolresult`)}set ontoolresult(e){this.setEventHandler(`toolresult`,e)}get ontoolcancelled(){return this.getEventHandler(`toolcancelled`)}set ontoolcancelled(e){this.setEventHandler(`toolcancelled`,e)}get onhostcontextchanged(){return this.getEventHandler(`hostcontextchanged`)}set onhostcontextchanged(e){this.setEventHandler(`hostcontextchanged`,e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced(`onteardown`,this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(`ui/resource-teardown`,{params:qPe.shape.params,result:JPe},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized(`callServerTool`),typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized(`readServerResource`),await this.request({method:`resources/read`,params:e},t)}async listServerResources(e,t){return this._assertInitialized(`listServerResources`),await this.request({method:`resources/list`,params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized(`createSamplingMessage`),await this.request({method:`sampling/createMessage`,params:e},t)}sendMessage(e,t){return this._assertInitialized(`sendMessage`),this.request({method:`ui/message`,params:e},VPe,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this._assertInitialized(`updateModelContext`),this.request({method:`ui/update-model-context`,params:e},a8,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},zPe,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},BPe,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this._assertInitialized(`requestDisplayMode`),this.request({method:`ui/request-display-mode`,params:e},ZPe,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new K9(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);this._initializedSent=!1;try{await super.connect(e);let n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:IPe}},tFe,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}};function aFe({appInfo:e,capabilities:t,onAppCreated:n,autoResize:r=!0,strict:i}){let[a,o]=(0,A.useState)(null),[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(null);return(0,A.useEffect)(()=>{let a=!0,s;async function l(){try{let l=new K9(window.parent,window.parent);if(s=new iFe(e,t,{autoResize:r,strict:i}),n?.(s),await s.connect(l),!a){s.close();return}o(s),c(!0),u(null)}catch(e){a&&(o(null),c(!1),u(e instanceof Error?e:Error(`Failed to connect`)))}}return l(),()=>{a=!1,s?.close()}},[]),{app:a,isConnected:s,error:l}}function oFe(){let[e,t]=(0,A.useState)(null),[n,r]=(0,A.useState)(),[i,a]=(0,A.useState)(null);function o(e){try{if(e.isError){let n=e.content?.find(e=>e.type===`text`),r=e.structuredContent??(n?.type===`text`?JSON.parse(n.text):void 0);if(r?.error&&typeof r.error==`object`&&`code`in r.error&&r.error.code===`no_data`&&`message`in r.error&&typeof r.error.message==`string`){t(null),a(r.error.message);return}throw Error(`Tool error`)}let n=Jg(e.structuredContent);t(n),a(null)}catch{a(`This view could not be loaded. Please try again.`)}}let s=aFe({autoResize:!1,appInfo:{name:`Fanout panels`,version:`1.0.0`},capabilities:{},onAppCreated:e=>{e.ontoolresult=o,e.ontoolcancelled=()=>a(`View cancelled.`),e.onhostcontextchanged=e=>r(t=>({...t,...e})),e.onerror=()=>a(`This view could not be refreshed. Please try again.`)}});return(0,A.useEffect)(()=>{s.app&&r(s.app.getHostContext())},[s.app]),{...s,fragment:e,host:n,toolError:i}}function sFe(e,t){let n,r=()=>{let r=e.getBoundingClientRect().height;n!==void 0&&Math.abs(r-n)<2||(n=r,t({height:Math.round(r)}))},i=new ResizeObserver(r);return i.observe(e),r(),()=>i.disconnect()}var cFe=new pee({defaultOptions:{queries:{retry:!1}}});function lFe(){let{app:e,fragment:t,host:n,error:r,toolError:i}=oFe(),a=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(e&&a.current)return sFe(a.current,t=>e.sendSizeChanged(t))},[e]);let o=(0,A.useMemo)(()=>e?qEe(e):void 0,[e]),s=n?.theme===`dark`,c=i??(r?`This view could not be loaded. Please try again.`:null);return(0,z.jsx)(xn,{theme:Nee,cssVariablesResolver:Aee,forceColorScheme:s?`dark`:`light`,children:(0,z.jsx)(Lh,{client:cFe,children:(0,z.jsx)(`div`,{ref:a,role:`main`,"aria-label":`Fanout analysis view`,"data-app-content":!0,children:t&&o&&n?(0,z.jsxs)(z.Fragment,{children:[c&&(0,z.jsx)(xd,{color:`bad`,m:`md`,children:c}),(0,z.jsx)(KEe,{fragment:t,dark:s,onQuery:o.query,drillClient:o.drill,resolveVariables:o.resolveVariables,hostDisplayMode:n.displayMode??`inline`,onDisplayMode:n.availableDisplayModes?.includes(`fullscreen`)?async t=>(await e.requestDisplayMode({mode:t})).mode===t:void 0})]}):c?(0,z.jsx)(xd,{color:`bad`,m:`md`,children:c}):(0,z.jsx)(Rf,{mih:180,children:(0,z.jsx)(el,{size:`sm`,role:`status`,"aria-label":`Loading panel view`})})})})})}(0,Tee.createRoot)(document.getElementById(`root`)).render((0,z.jsx)(A.StrictMode,{children:(0,z.jsx)(lFe,{})})); +- "app": Tool callable by the app from this server only`),csp:f6().optional(),permissions:f6().optional()}),Q({mimeTypes:Z(Y()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),Q({method:$(`ui/download-file`),params:Q({contents:Z(g6([h5,g5])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),Q({method:$(`ui/message`),params:Q({role:$(`user`).describe(`Message role, currently only "user" is supported.`),content:Z(_5).describe(`Message content blocks (text, image, etc.).`)})}),Q({method:$(`ui/notifications/sandbox-resource-ready`),params:Q({html:Y().describe(`HTML content to load into the inner iframe.`),sandbox:Y().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:q9.optional().describe(`CSP configuration from resource metadata.`),permissions:J9.optional().describe(`Sandbox permissions from resource metadata.`)})});var rFe=Q({method:$(`ui/notifications/tool-result`),params:E5.describe(`Standard MCP tool execution result.`)}),X9=Q({toolInfo:Q({id:$6.optional().describe(`JSON-RPC id of the tools/call request.`),tool:C5.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:VPe.optional().describe(`Current color theme preference.`),styles:XPe.optional().describe(`Style configuration for theming the app.`),displayMode:K9.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:Z(K9).optional().describe(`Display modes the host supports.`),containerDimensions:g6([Q({height:X().describe(`Fixed container height in pixels.`)}),Q({maxHeight:g6([X(),c6()]).optional().describe(`Maximum container height in pixels.`)})]).and(g6([Q({width:X().describe(`Fixed container width in pixels.`)}),Q({maxWidth:g6([X(),c6()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other +container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:Y().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:Y().optional().describe(`User's timezone in IANA format.`),userAgent:Y().optional().describe(`Host application identifier.`),platform:g6([$(`web`),$(`desktop`),$(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:Q({touch:s6().optional().describe(`Whether the device supports touch input.`),hover:s6().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:Q({top:X().describe(`Top safe area inset in pixels.`),right:X().describe(`Right safe area inset in pixels.`),bottom:X().describe(`Bottom safe area inset in pixels.`),left:X().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),Z9=Q({method:$(`ui/notifications/host-context-changed`),params:X9.describe(`Partial context update containing only changed fields.`)});Q({method:$(`ui/update-model-context`),params:Q({content:Z(_5).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:b6(Y(),d6().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),Q({method:$(`ui/initialize`),params:Q({appInfo:d8.describe(`App identification (name and version).`),appCapabilities:eFe.describe(`Features and capabilities this app provides.`),protocolVersion:Y().describe(`Protocol version this app supports.`)})});var iFe=Q({protocolVersion:Y().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:d8.describe(`Host application identification and version.`),hostCapabilities:$Pe.describe(`Features and capabilities provided by the host.`),hostContext:X9.describe(`Rich context about the host environment.`)}).passthrough(),aFe={target:`draft-2020-12`};async function Q9(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](aFe);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function $9(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function oFe(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var sFe=class e extends SPe{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new LPe;_methods=new RPe;setRequestHandler=(...e)=>{let[t,...n]=W9(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=W9(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:KPe,toolinputpartial:qPe,toolresult:rFe,toolcancelled:JPe,hostcontextchanged:Z9};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),!n.allowUnsafeEval&&b2({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.params),{})),this.setEventHandler(`hostcontextchanged`,void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after transport is established`);this._appCapabilities=oFe(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await $9(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await $9(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Q9(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Q9(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),n}))}))}async sendToolListChanged(e={}){this._assertInitialized(`sendToolListChanged`),await this.notification({method:`notifications/tools/list_changed`,params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler(`toolinput`)}set ontoolinput(e){this.setEventHandler(`toolinput`,e)}get ontoolinputpartial(){return this.getEventHandler(`toolinputpartial`)}set ontoolinputpartial(e){this.setEventHandler(`toolinputpartial`,e)}get ontoolresult(){return this.getEventHandler(`toolresult`)}set ontoolresult(e){this.setEventHandler(`toolresult`,e)}get ontoolcancelled(){return this.getEventHandler(`toolcancelled`)}set ontoolcancelled(e){this.setEventHandler(`toolcancelled`,e)}get onhostcontextchanged(){return this.getEventHandler(`hostcontextchanged`)}set onhostcontextchanged(e){this.setEventHandler(`hostcontextchanged`,e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced(`onteardown`,this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(`ui/resource-teardown`,{params:ZPe.shape.params,result:QPe},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized(`callServerTool`),typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized(`readServerResource`),await this.request({method:`resources/read`,params:e},t)}async listServerResources(e,t){return this._assertInitialized(`listServerResources`),await this.request({method:`resources/list`,params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized(`createSamplingMessage`),await this.request({method:`sampling/createMessage`,params:e},t)}sendMessage(e,t){return this._assertInitialized(`sendMessage`),this.request({method:`ui/message`,params:e},GPe,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this._assertInitialized(`updateModelContext`),this.request({method:`ui/update-model-context`,params:e},a8,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},UPe,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},WPe,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this._assertInitialized(`requestDisplayMode`),this.request({method:`ui/request-display-mode`,params:e},tFe,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new G9(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);this._initializedSent=!1;try{await super.connect(e);let n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:BPe}},iFe,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}};function cFe({appInfo:e,capabilities:t,onAppCreated:n,autoResize:r=!0,strict:i}){let[a,o]=(0,A.useState)(null),[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(null);return(0,A.useEffect)(()=>{let a=!0,s;async function l(){try{let l=new G9(window.parent,window.parent);if(s=new sFe(e,t,{autoResize:r,strict:i}),n?.(s),await s.connect(l),!a){s.close();return}o(s),c(!0),u(null)}catch(e){a&&(o(null),c(!1),u(e instanceof Error?e:Error(`Failed to connect`)))}}return l(),()=>{a=!1,s?.close()}},[]),{app:a,isConnected:s,error:l}}function lFe(){let[e,t]=(0,A.useState)(null),[n,r]=(0,A.useState)(),[i,a]=(0,A.useState)(null);function o(e){try{if(e.isError){let n=e.content?.find(e=>e.type===`text`),r=e.structuredContent??(n?.type===`text`?JSON.parse(n.text):void 0);if(r?.error&&typeof r.error==`object`&&`code`in r.error&&r.error.code===`no_data`&&`message`in r.error&&typeof r.error.message==`string`){t(null),a(r.error.message);return}throw Error(`Tool error`)}let n=Jg(e.structuredContent);t(n),a(null)}catch{a(`This view could not be loaded. Please try again.`)}}let s=cFe({autoResize:!1,appInfo:{name:`Fanout panels`,version:`1.0.0`},capabilities:{},onAppCreated:e=>{e.ontoolresult=o,e.ontoolcancelled=()=>a(`View cancelled.`),e.onhostcontextchanged=e=>r(t=>({...t,...e})),e.onerror=()=>a(`This view could not be refreshed. Please try again.`)}});return(0,A.useEffect)(()=>{s.app&&r(s.app.getHostContext())},[s.app]),{...s,fragment:e,host:n,toolError:i}}function uFe(e,t){let n,r=()=>{let r=e.getBoundingClientRect().height;n!==void 0&&Math.abs(r-n)<2||(n=r,t({height:Math.round(r)}))},i=new ResizeObserver(r);return i.observe(e),r(),()=>i.disconnect()}var dFe=new pee({defaultOptions:{queries:{retry:!1}}});function fFe(){let{app:e,fragment:t,host:n,error:r,toolError:i}=lFe(),a=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(e&&a.current)return uFe(a.current,t=>e.sendSizeChanged(t))},[e]);let o=(0,A.useMemo)(()=>e?JEe(e):void 0,[e]),s=n?.theme===`dark`,c=i??(r?`This view could not be loaded. Please try again.`:null);return(0,z.jsx)(xn,{theme:Nee,cssVariablesResolver:Aee,forceColorScheme:s?`dark`:`light`,children:(0,z.jsx)(Lh,{client:dFe,children:(0,z.jsx)(`div`,{ref:a,role:`main`,"aria-label":`Fanout analysis view`,"data-app-content":!0,children:t&&o&&n?(0,z.jsxs)(z.Fragment,{children:[c&&(0,z.jsx)(xd,{color:`bad`,m:`md`,children:c}),(0,z.jsx)(qEe,{fragment:t,dark:s,onQuery:o.query,drillClient:o.drill,resolveVariables:o.resolveVariables,hostDisplayMode:n.displayMode??`inline`,onDisplayMode:n.availableDisplayModes?.includes(`fullscreen`)?async t=>(await e.requestDisplayMode({mode:t})).mode===t:void 0})]}):c?(0,z.jsx)(xd,{color:`bad`,m:`md`,children:c}):(0,z.jsx)(Rf,{mih:180,children:(0,z.jsx)(el,{size:`sm`,role:`status`,"aria-label":`Loading panel view`})})})})})}(0,Tee.createRoot)(document.getElementById(`root`)).render((0,z.jsx)(A.StrictMode,{children:(0,z.jsx)(fFe,{})}));
diff --git a/internal/ui/dist/assets/WarningCircle.es-DWFLwubM.js b/internal/ui/dist/assets/WarningCircle.es-BIbVHGEb.js similarity index 98% rename from internal/ui/dist/assets/WarningCircle.es-DWFLwubM.js rename to internal/ui/dist/assets/WarningCircle.es-BIbVHGEb.js index 8ae8da1ec..3e8f1dc3e 100644 --- a/internal/ui/dist/assets/WarningCircle.es-DWFLwubM.js +++ b/internal/ui/dist/assets/WarningCircle.es-BIbVHGEb.js @@ -1 +1 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{M as r,Y as i,a,f as o,w as s}from"./brand-DUaZkIz1.js";import{G as c,J as l,K as u,Q as d,X as f,Y as p,Z as m,q as h}from"./index-CEp3GmPL.js";var g={root:`m_849cf0da`},_=t(),v={underline:`hover`},y=s(e=>{let{underline:t,className:n,unstyled:a,mod:s,...c}=r(`Anchor`,v,e);return(0,_.jsx)(o,{component:`a`,className:i({[g.root]:!a},n),...c,mod:[{underline:t},s],__staticSelector:`Anchor`,unstyled:a})});y.classes=g,y.displayName=`@mantine/core/Anchor`;var b=class extends h{#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),f(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)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}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??c();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){u.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},x=n(e(),1);function S(e,t){let n=d(t),[r]=x.useState(()=>new b(n,e));x.useEffect(()=>{r.setOptions(e)},[r,e]);let i=x.useSyncExternalStore(x.useCallback(e=>r.subscribe(u.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=x.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(p)},[r]);if(i.error&&m(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var C=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z`}))]]),w=x.forwardRef((e,t)=>x.createElement(a,{ref:t,...e,weights:C}));w.displayName=`WarningCircleIcon`;var T=w;export{S as n,y as r,T as t}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{M as r,Y as i,a,f as o,w as s}from"./brand-DUaZkIz1.js";import{G as c,J as l,K as u,Q as d,X as f,Y as p,Z as m,q as h}from"./index-DxHBLqHS.js";var g={root:`m_849cf0da`},_=t(),v={underline:`hover`},y=s(e=>{let{underline:t,className:n,unstyled:a,mod:s,...c}=r(`Anchor`,v,e);return(0,_.jsx)(o,{component:`a`,className:i({[g.root]:!a},n),...c,mod:[{underline:t},s],__staticSelector:`Anchor`,unstyled:a})});y.classes=g,y.displayName=`@mantine/core/Anchor`;var b=class extends h{#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),f(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)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}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??c();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){u.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},x=n(e(),1);function S(e,t){let n=d(t),[r]=x.useState(()=>new b(n,e));x.useEffect(()=>{r.setOptions(e)},[r,e]);let i=x.useSyncExternalStore(x.useCallback(e=>r.subscribe(u.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=x.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(p)},[r]);if(i.error&&m(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var C=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z`}))]]),w=x.forwardRef((e,t)=>x.createElement(a,{ref:t,...e,weights:C}));w.displayName=`WarningCircleIcon`;var T=w;export{S as n,y as r,T as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat-BqevyT9H.js b/internal/ui/dist/assets/chat-DvbFi0gm.js similarity index 99% rename from internal/ui/dist/assets/chat-BqevyT9H.js rename to internal/ui/dist/assets/chat-DvbFi0gm.js index 3a0d9a73a..88fdbe9d9 100644 --- a/internal/ui/dist/assets/chat-BqevyT9H.js +++ b/internal/ui/dist/assets/chat-DvbFi0gm.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-Do9gIdfD.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-CEp3GmPL.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-EHBQhIeL.js","assets/Tooltip-B3r3s_B9.js","assets/index-ADB9ThEc.css"])))=>i.map(i=>d[i]); -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{A as r,C as i,M as a,S as o,T as s,_ as c,a as l,c as u,d,f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,tt as b,u as x,x as S,y as C}from"./brand-DUaZkIz1.js";import{c as w,d as T,g as E,h as D,l as O,m as ee,o as k,p as A,s as te,t as j,u as M}from"./preload-helper-EHBQhIeL.js";import{t as N}from"./Tooltip-B3r3s_B9.js";import{a as P,c as F,d as I,l as L,n as R,r as ne,t as re,u as ie}from"./dashboard-change-chips-DHVvGnTI.js";import{zt as z}from"./index-CEp3GmPL.js";var B=n(e(),1),V=t(),ae=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],H={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`};function U(e){Object.keys(H).forEach(t=>{e.style.setProperty(t,H[t],`important`)})}function oe(e){let t=window.getComputedStyle(e);if(t===null)return null;let n={};for(let e of ae)n[e]=t[e];return n.boxSizing===``?null:{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)}}var W=null;function se(e,t,n=1,r=1/0){W||(W=document.createElement(`textarea`),W.setAttribute(`tabindex`,`-1`),W.setAttribute(`aria-hidden`,`true`),W.setAttribute(`aria-label`,`autosize measurement`),U(W)),W.parentNode===null&&document.body.appendChild(W);let{paddingSize:i,borderSize:a,sizingStyle:o}=e,{boxSizing:s}=o;Object.keys(o).forEach(e=>{W.style[e]=o[e]}),U(W),W.value=t;let c=s===`border-box`?W.scrollHeight+a:W.scrollHeight-i;W.value=t,c=s===`border-box`?W.scrollHeight+a:W.scrollHeight-i,W.value=`x`;let l=W.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);let d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}function ce({maxRows:e,minRows:t,onChange:n,ref:r,...i}){let a=i.value!==void 0,o=(0,B.useRef)(null),s=b(o,r),c=(0,B.useRef)(0),l=(0,B.useRef)(0),u=()=>{let n=o.current;if(!n)return;let r=oe(n);if(!r)return;let[i]=se(r,n.value||n.placeholder||`x`,t,e);c.current!==i&&(c.current=i,n.style.setProperty(`height`,`${i}px`,`important`))},d=(0,B.useEffectEvent)(u),f=e=>{a||u(),n?.(e)};return(0,B.useLayoutEffect)(u),(0,B.useEffect)(()=>{let e=()=>u();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,B.useEffect)(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;l.current=e.offsetWidth;let t=0,n=new ResizeObserver(()=>{o.current&&o.current.offsetWidth!==l.current&&(l.current=o.current.offsetWidth,cancelAnimationFrame(t),t=requestAnimationFrame(d))});return n.observe(e),()=>{cancelAnimationFrame(t),n.disconnect()}},[]),(0,B.useEffect)(()=>{let e=()=>u();return document.fonts.addEventListener(`loadingdone`,e),()=>document.fonts.removeEventListener(`loadingdone`,e)},[]),(0,B.useEffect)(()=>{let e=e=>{if(o.current?.form===e.target&&!a){let e=o.current.value;requestAnimationFrame(()=>{o.current&&e!==o.current.value&&u()})}};return document.body.addEventListener(`reset`,e),()=>document.body.removeEventListener(`reset`,e)},[a]),(0,V.jsx)(`textarea`,{rows:t,...i,onChange:f,ref:s})}var G=s(e=>{let{autosize:t,maxRows:n,minRows:r,__staticSelector:i,resize:o,bottomSection:s,bottomSectionProps:c,...l}=a([`Input`,`InputWrapper`,`Textarea`],null,e),u=t&&I()!==`test`,d=u?{maxRows:n,minRows:r}:{};return(0,V.jsx)(h,{component:u?ce:`textarea`,...l,__staticSelector:i||`Textarea`,__bottomSection:s,__bottomSectionProps:c,multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":o},...d})});G.classes=h.classes,G.displayName=`@mantine/core/Textarea`;var K={root:`m_d08caa0`},q=s(e=>{let t=a(`Typography`,null,e),{classNames:n,className:o,style:s,styles:c,unstyled:l,attributes:u,...d}=t,f=r({name:`Typography`,classes:K,props:t,className:o,style:s,classNames:n,styles:c,unstyled:l,attributes:u});return(0,V.jsx)(i,{...f(`root`),...d})});q.classes=K,q.displayName=`@mantine/core/Typography`;var le=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208.49,152.49l-72,72a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L116,187V40a12,12,0,0,1,24,0V187l51.51-51.52a12,12,0,0,1,17,17Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,144l-72,72L56,144Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M207.39,140.94A8,8,0,0,0,200,136H136V40a8,8,0,0,0-16,0v96H56a8,8,0,0,0-5.66,13.66l72,72a8,8,0,0,0,11.32,0l72-72A8,8,0,0,0,207.39,140.94ZM128,204.69,75.31,152H180.69Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,56,136h64V40a8,8,0,0,1,16,0v96h64a8,8,0,0,1,5.66,13.66Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M204.24,148.24l-72,72a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L122,201.51V40a6,6,0,0,1,12,0V201.51l61.76-61.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M202.83,146.83l-72,72a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L124,206.34V40a4,4,0,0,1,8,0V206.34l65.17-65.17a4,4,0,0,1,5.66,5.66Z`}))]]),ue=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),de=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),fe=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),J=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:le}));J.displayName=`ArrowDownIcon`;var pe=J,Y=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:ue}));Y.displayName=`CaretRightIcon`;var X=Y,me=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:de}));me.displayName=`PaperPlaneTiltIcon`;var he=me,ge=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:fe}));ge.displayName=`StopIcon`;var _e=ge;function ve(e){return e.dashboard.panels.length===1?e.dashboard.panels[0].title:e.dashboard.name}function ye(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Missing panel view`);let t=e;if(!t.view||![`preset`,`query`].includes(t.view.kind)||!/^[a-f0-9]{64}$/.test(t.view.key))throw Error(`Invalid panel view identity`);if(t.dashboard?.version!==1||!Array.isArray(t.dashboard.panels)||!t.dashboard.panels.length||t.dashboard.panels.length>40||!Array.isArray(t.results)||t.dashboard.panels.some(e=>!e||typeof e.id!=`string`||!e.id)||t.results.some(e=>!e||typeof e.id!=`string`))throw Error(`Invalid panel view`);let n=new Set(t.dashboard.panels.map(e=>e.id));if(n.size!==t.dashboard.panels.length||t.results.length!==n.size||new Set(t.results.map(e=>e.id)).size!==n.size||t.results.some(e=>!n.has(e.id)||![`ok`,`empty`,`error`].includes(e.status)))throw Error(`Panel results do not match the view`);if(t.vars!==void 0&&(!t.vars||typeof t.vars!=`object`||Array.isArray(t.vars)||Object.values(t.vars).some(e=>typeof e!=`string`&&!(Array.isArray(e)&&e.every(e=>typeof e==`string`)))))throw Error(`Invalid panel variables`);if(t.trace!==void 0&&(!t.trace?.data||!Array.isArray(t.trace.data.spans)||!Array.isArray(t.trace.data.logs)||!Array.isArray(t.trace.data.services)))throw Error(`Invalid trace detail`);return t}var be=new WeakSet;function xe(e){if(!e||typeof e!=`object`||Array.isArray(e))return;if(be.has(e))return e;let t=e;if(Object.keys(t).sort().join(`,`)===`is_error,resource_uri,tool_input,tool_name,tool_result`&&t.resource_uri===`ui://fanout/panels.html`&&typeof t.tool_name==`string`&&t.tool_name&&typeof t.is_error==`boolean`&&t.tool_input&&typeof t.tool_input==`object`&&!Array.isArray(t.tool_input)){try{ye(t.tool_result)}catch{return}return be.add(t),t}}var Se=16,Ce=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]);function we(e){let t=(0,B.useRef)(null),n=(0,B.useRef)(null),r=(0,B.useRef)(null),i=(0,B.useRef)(!0),a=(0,B.useRef)(e),o=(0,B.useRef)(()=>{}),s=(0,B.useRef)(null),c=(0,B.useRef)(new Set),l=(0,B.useRef)(null),u=(0,B.useRef)(null),[d,f]=(0,B.useState)(!1),p=(0,B.useCallback)(()=>{let e=t.current,n=r.current?.lastElementChild,i=!e||!n||n.getBoundingClientRect().bottom>e.getBoundingClientRect().top+e.clientTop+e.clientHeight+1;f(!!e&&i&&e.scrollHeight-e.clientHeight-e.scrollTop>1)},[]),m=(0,B.useCallback)(()=>{let e=t.current;if(!e)return;let n=e.getBoundingClientRect().top+e.clientTop,r=[...e.querySelectorAll(`[data-chat-anchor]`)].find(e=>e.getBoundingClientRect().bottom>n);l.current=r?{node:r,top:r.getBoundingClientRect().top}:null},[]),h=(0,B.useCallback)((e,t)=>{e.scrollTop=t,u.current=e.scrollTop},[]),g=(0,B.useCallback)(()=>{let e=t.current;if(e){if(r.current){let t=n.current&&parseFloat(getComputedStyle(n.current).paddingBottom)||0;r.current.style.minHeight=`${Math.max(0,e.clientHeight-Se-t)}px`,i.current&&h(e,e.scrollTop+r.current.getBoundingClientRect().top-e.getBoundingClientRect().top-e.clientTop-Se)}if(!i.current){let t=l.current;t?.node.isConnected&&h(e,e.scrollTop+t.node.getBoundingClientRect().top-t.top),m()}p()}},[m,h,p]),_=(0,B.useCallback)(()=>{let e=t.current,i=n.current;if(!e||!i){s.current?.disconnect(),s.current=null,c.current.clear();return}s.current??=new ResizeObserver(g);let a=new Set([e,i,...i.querySelectorAll(`[data-chat-anchor]`)]);r.current&&a.add(r.current);for(let e of c.current)a.has(e)||s.current.unobserve(e);for(let e of a)c.current.has(e)||s.current.observe(e);c.current=a},[g]),v=(0,B.useCallback)(e=>{if(o.current(),t.current=e,u.current=null,l.current=null,i.current=!0,_(),!e)return;let n=!1,r=()=>{i.current=!1,m()},a=e=>{let t=e.target;!e.defaultPrevented&&Ce.has(e.key)&&(t instanceof HTMLElement&&(t.closest(`input, textarea, select, [contenteditable]`)||(e.key===` `?t.closest(`button`):t.closest(`[role=slider]`)))||r())},s=()=>{n=!0},c=()=>{n=!1},d=()=>{n&&e.scrollTop!==u.current&&r(),i.current||m(),p()};e.addEventListener(`scroll`,d,{passive:!0}),e.addEventListener(`wheel`,r,{passive:!0}),e.addEventListener(`touchmove`,r,{passive:!0}),e.addEventListener(`keydown`,a),e.addEventListener(`pointerdown`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c),o.current=()=>{e.removeEventListener(`scroll`,d),e.removeEventListener(`wheel`,r),e.removeEventListener(`touchmove`,r),e.removeEventListener(`keydown`,a),e.removeEventListener(`pointerdown`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),o.current=()=>{}},g()},[g,m,_,p]),y=(0,B.useCallback)(e=>{n.current=e,_()},[_]),b=(0,B.useCallback)(e=>{r.current?.style.removeProperty(`min-height`),r.current=e,_()},[_]);return(0,B.useLayoutEffect)(()=>{a.current!==e&&(a.current=e,i.current=!0,l.current=null),_(),g()}),{scrollRef:v,contentRef:y,turnRef:b,showJump:d,jumpToLatest:(0,B.useCallback)(()=>{let e=t.current;e&&(e.focus({preventScroll:!0}),i.current=!1,h(e,e.scrollHeight),m(),p())},[m,h,p])}}function Te(e=1500){let[t,n]=(0,B.useState)(`idle`),r=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);function i(t){r.current&&clearTimeout(r.current),n(`idle`),(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject(Error(`clipboard unavailable`))).then(()=>n(`copied`),()=>n(`failed`)).finally(()=>{r.current=setTimeout(()=>n(`idle`),e)})}return{state:t,copy:i}}var Z=e=>`${(e/1e3).toFixed(1)} s`;function Ee({receipt:e,running:t=!1,activity:n=``,awaitingAnswer:r=!1}){let[i,a]=(0,B.useState)(!1),o=(0,B.useId)(),s=e.saved,l=s?.receipt.save_check,p=t=>Object.hasOwn(e.panel_titles,t)?e.panel_titles[t]:t,m=Object.values(e.stages).filter(e=>e.state===`complete`).length,h=[e.stages.schema.state===`complete`?`Read telemetry`:void 0,e.panel_count===void 0?void 0:`${e.panel_count} ${e.panel_count===1?`panel`:`panels`}`,l?.checked?`Checked in ${Z(l.elapsed_ms)}`:void 0,s?`Saved v${s.version}`:void 0].filter(Boolean).join(` · `)||`Building dashboard`,g=[...s?O(s.receipt):[],...new Map(e.corrections.map(e=>[e.panel_id,`Fixed ${e.title}`])).values()];return(0,V.jsx)(S,{"data-build-receipt":e.turn_id,"data-dashboard-result":s?.id,"data-chat-anchor":!0,withBorder:!0,radius:`md`,p:`sm`,children:(0,V.jsxs)(u,{gap:6,children:[(0,V.jsxs)(c,{gap:`xs`,justify:`space-between`,children:[(0,V.jsxs)(f,{size:`sm`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[h,(0,V.jsxs)(f,{span:!0,c:`dimmed`,size:`xs`,children:[` · `,m,` stages complete`]})]}),(0,V.jsxs)(d,{component:`button`,variant:`subtle`,color:`gray`,size:`compact-xs`,"aria-expanded":i,"aria-controls":o,onClick:()=>a(e=>!e),children:[`Details`,g.length>4?` (+${g.length-4})`:``]})]}),t&&r&&(0,V.jsxs)(c,{gap:`xs`,"data-build-running":!0,children:[(0,V.jsx)(C,{type:`dots`,size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:n||`Analyzing your system`})]}),(0,V.jsx)(re,{labels:g.slice(0,4)}),e.explanations.map(e=>t?e.split(` · `).filter(e=>!e.endsWith(`: incomplete`)).join(` · `):e).filter(Boolean).map((e,t)=>(0,V.jsx)(f,{size:`xs`,c:`dimmed`,"data-receipt-attention":!0,children:e},t)),s&&(0,V.jsx)(d,{renderRoot:e=>(0,V.jsx)(E,{...e,to:`/dashboards/$dashboardId`,params:{dashboardId:s.id},search:{}}),variant:`subtle`,size:`compact-sm`,color:`gray`,style:{alignSelf:`flex-start`},children:`Open dashboard`}),(0,V.jsx)(ie,{expanded:i,id:o,children:(0,V.jsxs)(u,{gap:4,children:[s&&(0,V.jsxs)(f,{size:`xs`,children:[s.label,` `,s.name,` · opens the current dashboard`]}),Object.entries(e.stages).map(([e,n])=>(0,V.jsxs)(f,{size:`xs`,c:`dimmed`,children:[T[e],`: `,t&&n.state===`incomplete`?`in progress`:n.state,n.elapsed_ms===void 0?``:` · ${Z(n.elapsed_ms)}`]},e)),e.save_attempts.map((e,t)=>e.state===`retried`&&(0,V.jsxs)(f,{size:`xs`,c:`dimmed`,children:[`Save attempt `,t+1,`: retried`]},e.call_id)),!!e.context_counts.deploys&&(0,V.jsxs)(f,{size:`xs`,children:[e.context_counts.deploys,` deploys observed`]}),!!e.context_counts.anomalies&&(0,V.jsxs)(f,{size:`xs`,children:[e.context_counts.anomalies,` anomalies observed`]}),e.panels.map(e=>(0,V.jsxs)(f,{size:`xs`,children:[`Preview · `,p(e.id),`: `,e.status,e.elapsed_ms===void 0?``:` · ${Z(e.elapsed_ms)}`]},e.id)),l&&(0,V.jsxs)(f,{size:`xs`,children:[`Save check: `,l.checked?`checked`:`incomplete`,` · `,Z(l.elapsed_ms)]}),l?.panels.map(e=>(0,V.jsxs)(f,{size:`xs`,children:[`Save · `,p(e.id),`: `,e.status,` · `,e.rows??0,` rows`,e.elapsed_ms===void 0?``:` · ${Z(e.elapsed_ms)}`]},e.id)),g.slice(4).map((e,t)=>(0,V.jsx)(f,{size:`xs`,children:e},t)),e.corrections.map((e,t)=>(0,V.jsxs)(f,{size:`xs`,children:[`Fixed `,e.title,`: `,e.message]},t))]})})]})})}var De=(0,B.lazy)(()=>j(()=>import(`./mcp-app-frame-Do9gIdfD.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Oe=e=>e.tool_result.view.kind===`preset`;function ke(e){let t=new Map,n=new Set,r=[],i=()=>{let e=new Map;for(let t of r){let n=t.content.tool_result.view.key;e.set(n,t)}let i=new Set([...e.values()].map(e=>e.id)),a=[...e.values()].some(e=>Oe(e.content)),o=r.filter(e=>i.has(e.id)).at(-1)?.id;for(let e of r)i.has(e.id)?t.set(e.id,{content:e.content,expanded:Oe(e.content)||!a&&e.id===o}):n.add(e.id);r=[]};for(let t of e)if(t.role===`user`&&i(),t.role===`activity`&&t.activityType===`mcp-app`){let e=xe(t.content);e&&r.push({id:t.id,content:e})}return i(),{views:t,duplicates:n}}function Ae(e,t){return Array.isArray(e)?e.flatMap(e=>{if(!D(e)||typeof e.message!=`string`)return[];let n=typeof e.path==`string`?/^panels\[(\d+)\](?:\.|$)/.exec(e.path)?.[1]:void 0,r=n===void 0?void 0:t?.[Number(n)];return[r&&!e.message.startsWith(r)?`${r}: ${e.message}`:e.message]}):[]}function je(e){let t=new Map,n=new Map,r=new Map,i=`unattributed`;for(let a of e){if(a.role===`user`&&(n.clear(),r.clear(),i=a.id),a.role===`assistant`){i=a.id;for(let e of a.toolCalls??[]){let t=[`create_dashboard`,`replace_dashboard`].includes(e.function.name)?A(e.function.arguments)?.dashboard:void 0,r=D(t)&&Array.isArray(t.panels)?t.panels.map(e=>D(e)&&typeof e.title==`string`?e.title:``):void 0;n.set(e.id,{assistant:i,name:e.function.name,titles:r})}}if(a.role===`tool`){let e=A(a.content);if(!a.error&&!e?.error&&e?.isError!==!0)continue;let o=n.get(a.toolCallId);if(o&&ee.has(o.name)&&M(a))continue;let s=D(e?.error)?e?.error:void 0;if(s?.code===`no_data`||s?.code===`unknown_service`)continue;let c=o?.assistant??i,l=r.get(c)??a.id;r.set(c,l);let u=t.get(l)??[],d=typeof s?.message==`string`?s.message:typeof a.error==`string`&&a.error?a.error:`Could not complete this step. Try again.`,f=[`create_dashboard`,`edit_dashboard`,`replace_dashboard`].includes(o?.name??``)&&(s?.code===`invalid_spec`||s?.code===`dashboard_version_conflict`);u.push({name:k(o?.name??``),message:d,details:f?Ae(e?.problems,o?.titles):[],readOnly:s?.code===`answer_only`,rejected:f}),t.set(l,u)}}return t}function Me({failures:e}){let[t,n]=(0,B.useState)({rejected:!1,failed:!1}),r=e.filter(e=>e.rejected),a=e.filter(e=>!e.readOnly&&!e.rejected),s=[{key:`rejected`,items:r,label:`${r.length} ${r.length===1?`draft`:`drafts`} rejected`},{key:`failed`,items:a,label:`${a.length} ${a.length===1?`step`:`steps`} failed`}];return(0,V.jsxs)(i,{"data-chat-anchor":!0,children:[e.some(e=>e.readOnly)&&(0,V.jsx)(f,{size:`sm`,c:`dimmed`,children:`Not saved: Explain is read-only`}),s.map(({key:e,items:r,label:a})=>r.length>0&&(0,V.jsxs)(i,{children:[(0,V.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t[e],onClick:()=>n(t=>({...t,[e]:!t[e]})),style:{color:`var(--mantine-color-dimmed)`},children:[(0,V.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t[e]?(0,V.jsx)(F,{size:14}):(0,V.jsx)(X,{size:14})}),(0,V.jsx)(`span`,{className:`chat-app-summary`,children:a})]}),t[e]&&(0,V.jsx)(u,{gap:`xs`,pl:`md`,children:r.flatMap((e,t)=>(e.details.length?e.details:[`${e.name}: ${e.message}`]).map((e,n)=>(0,V.jsx)(f,{size:`sm`,c:`dimmed`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:e},`${t}-${n}`)))})]},e))]})}function Ne({view:e}){let[t,n]=(0,B.useState)(e.expanded);(0,B.useEffect)(()=>n(e.expanded),[e.expanded]);let r=e.content.tool_result,i=ve(r),a=[...new Set(r.dashboard.panels.map(e=>e.viz===`timeseries`?`time series`:e.viz.replaceAll(`_`,` `)))].join(`, `),s=r.results.reduce((e,t)=>e+(t.frame?.rows??0),0),c=new Map;for(let e of r.results)e.status!==`ok`&&c.set(e.status,(c.get(e.status)??0)+1);let l=r.dashboard.panels.length>1?[`${r.dashboard.panels.length} panels`,...Array.from(c,([e,t])=>`${t} ${e}`)].join(` · `):c.size?[...c.keys()].join(`, `):`${s} ${s===1?`row`:`rows`}`;return(0,V.jsxs)(S,{"data-chat-app":!0,"data-chat-anchor":!0,withBorder:!0,radius:`lg`,style:{overflow:`hidden`},children:[(0,V.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,V.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t?(0,V.jsx)(F,{size:14}):(0,V.jsx)(X,{size:14})}),(0,V.jsxs)(`span`,{className:`chat-app-summary`,children:[i,` · `,a,` · `,l]})]}),t&&(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(x,{mih:180,children:(0,V.jsx)(C,{size:`sm`})}),children:(0,V.jsx)(De,{content:e.content})})]})}var Pe=[`Summarize system health for the last hour`,`Find the source of elevated errors`,`Map the current service dependencies`,`Show the slowest endpoints`];function Fe(){let{agentAvailable:e,messages:t,messageTimes:n,ready:r,running:a,activity:o,stopped:s,error:l,threadMissing:p,send:h,retry:g,reloadThread:y,newThread:b}=w(),T=te(t),E=t.filter(e=>e.role===`user`).at(-1)?.id,{scrollRef:D,contentRef:O,turnRef:ee,showJump:k,jumpToLatest:A}=we(E);if(!e)return(0,V.jsx)(m,{size:`sm`,py:96,children:(0,V.jsx)(S,{withBorder:!0,radius:`lg`,p:{base:`xl`,sm:40},children:(0,V.jsxs)(u,{gap:`md`,children:[(0,V.jsx)(f,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,V.jsx)(_,{order:1,fz:28,children:`Chat is not configured`}),(0,V.jsx)(f,{c:`dimmed`,children:`Add an AI provider key to enable chat. Telemetry ingest, dashboards, traces, logs, and metrics remain available without it.`}),(0,V.jsx)(d,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let j=ke(t),M=je(t),P=t.filter(e=>j.duplicates.has(e.id)?!1:e.role===`tool`?M.has(e.id):e.role===`assistant`?!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0:e.role===`activity`?e.activityType===`mcp-app`||e.activityType===`agent-outcome`:e.role===`user`),F=t.findIndex(e=>e.id===E),I=t.slice(F+1).some(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.length>0),L=t.slice(F+1).filter(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0).at(-1),R=[];for(let e of P)(e.role===`user`||R.length===0)&&R.push({id:e.id,messages:[]}),R.at(-1).messages.push(e);R.length===0&&R.push({id:`draft`,messages:[]});let ne=e=>M.has(e.id)?(0,V.jsx)(Me,{failures:M.get(e.id)},e.id):(0,V.jsxs)(i,{children:[(0,V.jsx)(Re,{message:e,time:n[e.id],appView:j.views.get(e.id)}),T.has(e.id)&&(0,V.jsx)(i,{mt:`sm`,children:(0,V.jsx)(Ee,{receipt:T.get(e.id),running:a&&e.id===E,awaitingAnswer:!I,activity:o})})]},e.id);return(0,V.jsxs)(i,{className:`chat-pane`,children:[(0,V.jsxs)(i,{className:`chat-viewport`,children:[(0,V.jsx)(i,{className:`chat-scroll`,ref:D,tabIndex:0,role:`log`,"aria-label":`Conversation`,children:(0,V.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,ref:O,children:[p&&(0,V.jsx)(v,{color:`warn`,radius:`lg`,title:`This chat no longer exists`,children:(0,V.jsxs)(c,{justify:`space-between`,children:[(0,V.jsx)(f,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,V.jsx)(d,{size:`compact-sm`,variant:`light`,onClick:b,children:`New chat`})]})}),!p&&!r&&l&&(0,V.jsx)(Q,{message:l,onRetry:y,onNewThread:b}),!p&&!r&&!l&&(0,V.jsxs)(x,{mih:`40vh`,children:[(0,V.jsx)(C,{size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading chat`})]}),!p&&r&&(0,V.jsxs)(V.Fragment,{children:[P.length===0&&(0,V.jsx)(Le,{onSelect:h}),(0,V.jsx)(u,{gap:`lg`,children:R.map((e,t)=>(0,V.jsxs)(u,{gap:`lg`,ref:e.id===E?ee:void 0,"data-chat-turn":e.id===E?E:void 0,children:[e.messages.filter(e=>e.id!==L?.id).map(ne),t===R.length-1&&(0,V.jsxs)(V.Fragment,{children:[L&&(0,V.jsx)(i,{"data-answer-position":!0,children:(0,V.jsx)(Re,{message:L,time:n[L.id]})},`answer-${E??`draft`}`),a&&!I&&!T.has(E??``)&&(0,V.jsxs)(c,{gap:`xs`,role:`status`,children:[(0,V.jsx)(C,{type:`dots`,size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:o||`Analyzing your system`})]}),s&&(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:`Stopped`}),l&&(0,V.jsx)(Q,{message:l,onRetry:g})]})]},e.id))})]})]})}),k&&(0,V.jsx)(N,{label:`Jump to latest`,children:(0,V.jsx)(z,{className:`chat-jump`,variant:`default`,size:36,radius:`xl`,"aria-label":`Jump to latest`,onClick:A,children:(0,V.jsx)(pe,{size:18,"aria-hidden":`true`})})})]}),!p&&(0,V.jsx)(Ie,{})]})}function Q({message:e,onRetry:t,onNewThread:n}){return(0,V.jsx)(v,{color:`bad`,radius:`lg`,title:`Something went wrong`,children:(0,V.jsxs)(c,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,V.jsx)(f,{size:`sm`,children:e}),(0,V.jsxs)(c,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,V.jsx)(d,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,V.jsx)(d,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Ie(){let{input:e,setInput:t,inputRef:n,submit:r,send:a,stop:o,ready:s,running:l}=w();return(0,V.jsx)(i,{className:`chat-composer`,children:(0,V.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},children:[(0,V.jsx)(S,{component:`form`,onSubmit:r,className:`chat-composer-field`,withBorder:!0,radius:24,py:6,pl:`lg`,pr:6,children:(0,V.jsxs)(c,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,V.jsx)(G,{ref:n,"aria-label":`Message Fanout`,value:e,onChange:e=>t(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),a(e))},placeholder:l?`Fanout is working…`:`Ask about health, errors, or latency…`,disabled:!s,autosize:!0,minRows:1,maxRows:8,variant:`unstyled`,flex:1}),l?(0,V.jsx)(N,{label:`Stop`,children:(0,V.jsx)(z,{type:`button`,variant:`default`,size:40,radius:`xl`,"aria-label":`Stop`,onClick:o,children:(0,V.jsx)(_e,{size:16,weight:`fill`})})}):(0,V.jsx)(z,{type:`submit`,variant:`filled`,size:40,radius:`xl`,disabled:!e.trim()||!s,"aria-label":`Send message`,children:(0,V.jsx)(he,{size:17,weight:`fill`})})]})}),(0,V.jsx)(f,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function Le({onSelect:e}){return(0,V.jsxs)(u,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,V.jsx)(g,{size:`large`}),(0,V.jsx)(_,{order:1,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,V.jsx)(c,{justify:`center`,gap:`xs`,mt:`xs`,maw:720,children:Pe.map(t=>(0,V.jsx)(d,{variant:`default`,size:`sm`,radius:`xl`,onClick:()=>void e(t),children:t},t))})]})}function Re({message:e,time:t,appView:n}){if(e.role===`activity`)return e.activityType===`agent-outcome`&&e.content&&typeof e.content==`object`&&`message`in e.content&&typeof e.content.message==`string`?`status`in e.content&&e.content.status===`stopped`?(0,V.jsx)(f,{c:`dimmed`,size:`sm`,"data-chat-anchor":!0,children:e.content.message}):(0,V.jsx)(v,{color:`bad`,title:`Something went wrong`,"data-chat-anchor":!0,children:e.content.message}):e.activityType===`mcp-app`?n?(0,V.jsx)(Ne,{view:n}):(0,V.jsx)(v,{color:`bad`,"data-chat-anchor":!0,children:`This view could not be loaded. Please try again.`}):null;if(e.role===`assistant`&&e.toolCalls?.length)return null;let r=typeof e.content==`string`?e.content:JSON.stringify(e.content);if(!r&&e.role===`assistant`)return null;let a=e.role===`user`,o=t?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(t)):``;return(0,V.jsxs)(i,{className:`chat-message`,"data-chat-anchor":!0,"data-role":a?`user`:`assistant`,children:[a?(0,V.jsx)(S,{radius:`lg`,px:`md`,py:`sm`,bg:`var(--mantine-color-brand-light)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,V.jsx)(f,{style:{whiteSpace:`pre-wrap`},children:r})}):(0,V.jsx)(q,{className:`chat-markdown`,children:(0,V.jsx)(ne,{remarkPlugins:[R],components:Be,children:r})}),(o||!a)&&(0,V.jsxs)(c,{className:`chat-message-meta`,gap:6,justify:a?`flex-end`:`flex-start`,mt:4,h:24,children:[o&&t&&(0,V.jsx)(f,{c:`dimmed`,size:`xs`,title:P(t),children:o}),!a&&(0,V.jsx)(ze,{text:r,label:`Copy message`})]})]})}function ze({text:e,label:t}){let{state:n,copy:r}=Te();return(0,V.jsx)(N,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,V.jsx)(z,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":t,"data-state":n===`idle`?void 0:n,onClick:()=>r(e),children:n===`copied`?(0,V.jsx)(p,{size:13,weight:`bold`}):(0,V.jsx)(y,{size:13})})})}var Be={table:({children:e})=>(0,V.jsx)(i,{className:`chat-table`,children:(0,V.jsx)(L,{striped:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,V.jsx)(L.Thead,{children:e}),tbody:({children:e})=>(0,V.jsx)(L.Tbody,{children:e}),tr:({children:e})=>(0,V.jsx)(L.Tr,{children:e}),th:({children:e})=>(0,V.jsx)(L.Th,{children:e}),td:({children:e})=>(0,V.jsx)(L.Td,{children:e}),pre:({children:e})=>(0,V.jsx)(Ve,{children:e}),a:({href:e,children:t})=>(0,V.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})};function Ve({children:e}){let t=$(e);return(0,V.jsxs)(i,{className:`chat-code`,pos:`relative`,children:[(0,V.jsx)(i,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,V.jsx)(ze,{text:t,label:`Copy code`})}),(0,V.jsx)(`pre`,{children:e})]})}function $(e){return typeof e==`string`?e:Array.isArray(e)?e.map($).join(``):e&&typeof e==`object`&&`props`in e?$(e.props.children):``}export{xe as n,Fe as t}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-Ysb7bM2I.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-DxHBLqHS.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-EHBQhIeL.js","assets/Tooltip-B3r3s_B9.js","assets/index-ADB9ThEc.css"])))=>i.map(i=>d[i]); +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{A as r,C as i,M as a,S as o,T as s,_ as c,a as l,c as u,d,f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,tt as b,u as x,x as S,y as C}from"./brand-DUaZkIz1.js";import{c as w,d as T,g as E,h as D,l as O,m as ee,o as k,p as A,s as te,t as j,u as M}from"./preload-helper-EHBQhIeL.js";import{t as N}from"./Tooltip-B3r3s_B9.js";import{a as P,c as F,d as I,l as L,n as R,r as ne,t as re,u as ie}from"./dashboard-change-chips-Cbk2Ba8I.js";import{zt as z}from"./index-DxHBLqHS.js";var B=n(e(),1),V=t(),ae=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],H={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`};function U(e){Object.keys(H).forEach(t=>{e.style.setProperty(t,H[t],`important`)})}function oe(e){let t=window.getComputedStyle(e);if(t===null)return null;let n={};for(let e of ae)n[e]=t[e];return n.boxSizing===``?null:{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)}}var W=null;function se(e,t,n=1,r=1/0){W||(W=document.createElement(`textarea`),W.setAttribute(`tabindex`,`-1`),W.setAttribute(`aria-hidden`,`true`),W.setAttribute(`aria-label`,`autosize measurement`),U(W)),W.parentNode===null&&document.body.appendChild(W);let{paddingSize:i,borderSize:a,sizingStyle:o}=e,{boxSizing:s}=o;Object.keys(o).forEach(e=>{W.style[e]=o[e]}),U(W),W.value=t;let c=s===`border-box`?W.scrollHeight+a:W.scrollHeight-i;W.value=t,c=s===`border-box`?W.scrollHeight+a:W.scrollHeight-i,W.value=`x`;let l=W.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);let d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}function ce({maxRows:e,minRows:t,onChange:n,ref:r,...i}){let a=i.value!==void 0,o=(0,B.useRef)(null),s=b(o,r),c=(0,B.useRef)(0),l=(0,B.useRef)(0),u=()=>{let n=o.current;if(!n)return;let r=oe(n);if(!r)return;let[i]=se(r,n.value||n.placeholder||`x`,t,e);c.current!==i&&(c.current=i,n.style.setProperty(`height`,`${i}px`,`important`))},d=(0,B.useEffectEvent)(u),f=e=>{a||u(),n?.(e)};return(0,B.useLayoutEffect)(u),(0,B.useEffect)(()=>{let e=()=>u();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,B.useEffect)(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;l.current=e.offsetWidth;let t=0,n=new ResizeObserver(()=>{o.current&&o.current.offsetWidth!==l.current&&(l.current=o.current.offsetWidth,cancelAnimationFrame(t),t=requestAnimationFrame(d))});return n.observe(e),()=>{cancelAnimationFrame(t),n.disconnect()}},[]),(0,B.useEffect)(()=>{let e=()=>u();return document.fonts.addEventListener(`loadingdone`,e),()=>document.fonts.removeEventListener(`loadingdone`,e)},[]),(0,B.useEffect)(()=>{let e=e=>{if(o.current?.form===e.target&&!a){let e=o.current.value;requestAnimationFrame(()=>{o.current&&e!==o.current.value&&u()})}};return document.body.addEventListener(`reset`,e),()=>document.body.removeEventListener(`reset`,e)},[a]),(0,V.jsx)(`textarea`,{rows:t,...i,onChange:f,ref:s})}var G=s(e=>{let{autosize:t,maxRows:n,minRows:r,__staticSelector:i,resize:o,bottomSection:s,bottomSectionProps:c,...l}=a([`Input`,`InputWrapper`,`Textarea`],null,e),u=t&&I()!==`test`,d=u?{maxRows:n,minRows:r}:{};return(0,V.jsx)(h,{component:u?ce:`textarea`,...l,__staticSelector:i||`Textarea`,__bottomSection:s,__bottomSectionProps:c,multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":o},...d})});G.classes=h.classes,G.displayName=`@mantine/core/Textarea`;var K={root:`m_d08caa0`},q=s(e=>{let t=a(`Typography`,null,e),{classNames:n,className:o,style:s,styles:c,unstyled:l,attributes:u,...d}=t,f=r({name:`Typography`,classes:K,props:t,className:o,style:s,classNames:n,styles:c,unstyled:l,attributes:u});return(0,V.jsx)(i,{...f(`root`),...d})});q.classes=K,q.displayName=`@mantine/core/Typography`;var le=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208.49,152.49l-72,72a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L116,187V40a12,12,0,0,1,24,0V187l51.51-51.52a12,12,0,0,1,17,17Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,144l-72,72L56,144Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M207.39,140.94A8,8,0,0,0,200,136H136V40a8,8,0,0,0-16,0v96H56a8,8,0,0,0-5.66,13.66l72,72a8,8,0,0,0,11.32,0l72-72A8,8,0,0,0,207.39,140.94ZM128,204.69,75.31,152H180.69Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,56,136h64V40a8,8,0,0,1,16,0v96h64a8,8,0,0,1,5.66,13.66Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M204.24,148.24l-72,72a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L122,201.51V40a6,6,0,0,1,12,0V201.51l61.76-61.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M202.83,146.83l-72,72a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L124,206.34V40a4,4,0,0,1,8,0V206.34l65.17-65.17a4,4,0,0,1,5.66,5.66Z`}))]]),ue=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),de=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),fe=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),J=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:le}));J.displayName=`ArrowDownIcon`;var pe=J,Y=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:ue}));Y.displayName=`CaretRightIcon`;var X=Y,me=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:de}));me.displayName=`PaperPlaneTiltIcon`;var he=me,ge=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:fe}));ge.displayName=`StopIcon`;var _e=ge;function ve(e){return e.dashboard.panels.length===1?e.dashboard.panels[0].title:e.dashboard.name}function ye(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Missing panel view`);let t=e;if(!t.view||![`preset`,`query`].includes(t.view.kind)||!/^[a-f0-9]{64}$/.test(t.view.key))throw Error(`Invalid panel view identity`);if(t.dashboard?.version!==1||!Array.isArray(t.dashboard.panels)||!t.dashboard.panels.length||t.dashboard.panels.length>40||!Array.isArray(t.results)||t.dashboard.panels.some(e=>!e||typeof e.id!=`string`||!e.id)||t.results.some(e=>!e||typeof e.id!=`string`))throw Error(`Invalid panel view`);let n=new Set(t.dashboard.panels.map(e=>e.id));if(n.size!==t.dashboard.panels.length||t.results.length!==n.size||new Set(t.results.map(e=>e.id)).size!==n.size||t.results.some(e=>!n.has(e.id)||![`ok`,`empty`,`error`].includes(e.status)))throw Error(`Panel results do not match the view`);if(t.vars!==void 0&&(!t.vars||typeof t.vars!=`object`||Array.isArray(t.vars)||Object.values(t.vars).some(e=>typeof e!=`string`&&!(Array.isArray(e)&&e.every(e=>typeof e==`string`)))))throw Error(`Invalid panel variables`);if(t.trace!==void 0&&(!t.trace?.data||!Array.isArray(t.trace.data.spans)||!Array.isArray(t.trace.data.logs)||!Array.isArray(t.trace.data.services)))throw Error(`Invalid trace detail`);return t}var be=new WeakSet;function xe(e){if(!e||typeof e!=`object`||Array.isArray(e))return;if(be.has(e))return e;let t=e;if(Object.keys(t).sort().join(`,`)===`is_error,resource_uri,tool_input,tool_name,tool_result`&&t.resource_uri===`ui://fanout/panels.html`&&typeof t.tool_name==`string`&&t.tool_name&&typeof t.is_error==`boolean`&&t.tool_input&&typeof t.tool_input==`object`&&!Array.isArray(t.tool_input)){try{ye(t.tool_result)}catch{return}return be.add(t),t}}var Se=16,Ce=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]);function we(e){let t=(0,B.useRef)(null),n=(0,B.useRef)(null),r=(0,B.useRef)(null),i=(0,B.useRef)(!0),a=(0,B.useRef)(e),o=(0,B.useRef)(()=>{}),s=(0,B.useRef)(null),c=(0,B.useRef)(new Set),l=(0,B.useRef)(null),u=(0,B.useRef)(null),[d,f]=(0,B.useState)(!1),p=(0,B.useCallback)(()=>{let e=t.current,n=r.current?.lastElementChild,i=!e||!n||n.getBoundingClientRect().bottom>e.getBoundingClientRect().top+e.clientTop+e.clientHeight+1;f(!!e&&i&&e.scrollHeight-e.clientHeight-e.scrollTop>1)},[]),m=(0,B.useCallback)(()=>{let e=t.current;if(!e)return;let n=e.getBoundingClientRect().top+e.clientTop,r=[...e.querySelectorAll(`[data-chat-anchor]`)].find(e=>e.getBoundingClientRect().bottom>n);l.current=r?{node:r,top:r.getBoundingClientRect().top}:null},[]),h=(0,B.useCallback)((e,t)=>{e.scrollTop=t,u.current=e.scrollTop},[]),g=(0,B.useCallback)(()=>{let e=t.current;if(e){if(r.current){let t=n.current&&parseFloat(getComputedStyle(n.current).paddingBottom)||0;r.current.style.minHeight=`${Math.max(0,e.clientHeight-Se-t)}px`,i.current&&h(e,e.scrollTop+r.current.getBoundingClientRect().top-e.getBoundingClientRect().top-e.clientTop-Se)}if(!i.current){let t=l.current;t?.node.isConnected&&h(e,e.scrollTop+t.node.getBoundingClientRect().top-t.top),m()}p()}},[m,h,p]),_=(0,B.useCallback)(()=>{let e=t.current,i=n.current;if(!e||!i){s.current?.disconnect(),s.current=null,c.current.clear();return}s.current??=new ResizeObserver(g);let a=new Set([e,i,...i.querySelectorAll(`[data-chat-anchor]`)]);r.current&&a.add(r.current);for(let e of c.current)a.has(e)||s.current.unobserve(e);for(let e of a)c.current.has(e)||s.current.observe(e);c.current=a},[g]),v=(0,B.useCallback)(e=>{if(o.current(),t.current=e,u.current=null,l.current=null,i.current=!0,_(),!e)return;let n=!1,r=()=>{i.current=!1,m()},a=e=>{let t=e.target;!e.defaultPrevented&&Ce.has(e.key)&&(t instanceof HTMLElement&&(t.closest(`input, textarea, select, [contenteditable]`)||(e.key===` `?t.closest(`button`):t.closest(`[role=slider]`)))||r())},s=()=>{n=!0},c=()=>{n=!1},d=()=>{n&&e.scrollTop!==u.current&&r(),i.current||m(),p()};e.addEventListener(`scroll`,d,{passive:!0}),e.addEventListener(`wheel`,r,{passive:!0}),e.addEventListener(`touchmove`,r,{passive:!0}),e.addEventListener(`keydown`,a),e.addEventListener(`pointerdown`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c),o.current=()=>{e.removeEventListener(`scroll`,d),e.removeEventListener(`wheel`,r),e.removeEventListener(`touchmove`,r),e.removeEventListener(`keydown`,a),e.removeEventListener(`pointerdown`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),o.current=()=>{}},g()},[g,m,_,p]),y=(0,B.useCallback)(e=>{n.current=e,_()},[_]),b=(0,B.useCallback)(e=>{r.current?.style.removeProperty(`min-height`),r.current=e,_()},[_]);return(0,B.useLayoutEffect)(()=>{a.current!==e&&(a.current=e,i.current=!0,l.current=null),_(),g()}),{scrollRef:v,contentRef:y,turnRef:b,showJump:d,jumpToLatest:(0,B.useCallback)(()=>{let e=t.current;e&&(e.focus({preventScroll:!0}),i.current=!1,h(e,e.scrollHeight),m(),p())},[m,h,p])}}function Te(e=1500){let[t,n]=(0,B.useState)(`idle`),r=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);function i(t){r.current&&clearTimeout(r.current),n(`idle`),(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject(Error(`clipboard unavailable`))).then(()=>n(`copied`),()=>n(`failed`)).finally(()=>{r.current=setTimeout(()=>n(`idle`),e)})}return{state:t,copy:i}}var Z=e=>`${(e/1e3).toFixed(1)} s`;function Ee({receipt:e,running:t=!1,activity:n=``,awaitingAnswer:r=!1}){let[i,a]=(0,B.useState)(!1),o=(0,B.useId)(),s=e.saved,l=s?.receipt.save_check,p=t=>Object.hasOwn(e.panel_titles,t)?e.panel_titles[t]:t,m=Object.values(e.stages).filter(e=>e.state===`complete`).length,h=[e.stages.schema.state===`complete`?`Read telemetry`:void 0,e.panel_count===void 0?void 0:`${e.panel_count} ${e.panel_count===1?`panel`:`panels`}`,l?.checked?`Checked in ${Z(l.elapsed_ms)}`:void 0,s?`Saved v${s.version}`:void 0].filter(Boolean).join(` · `)||`Building dashboard`,g=[...s?O(s.receipt):[],...new Map(e.corrections.map(e=>[e.panel_id,`Fixed ${e.title}`])).values()];return(0,V.jsx)(S,{"data-build-receipt":e.turn_id,"data-dashboard-result":s?.id,"data-chat-anchor":!0,withBorder:!0,radius:`md`,p:`sm`,children:(0,V.jsxs)(u,{gap:6,children:[(0,V.jsxs)(c,{gap:`xs`,justify:`space-between`,children:[(0,V.jsxs)(f,{size:`sm`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[h,(0,V.jsxs)(f,{span:!0,c:`dimmed`,size:`xs`,children:[` · `,m,` stages complete`]})]}),(0,V.jsxs)(d,{component:`button`,variant:`subtle`,color:`gray`,size:`compact-xs`,"aria-expanded":i,"aria-controls":o,onClick:()=>a(e=>!e),children:[`Details`,g.length>4?` (+${g.length-4})`:``]})]}),t&&r&&(0,V.jsxs)(c,{gap:`xs`,"data-build-running":!0,children:[(0,V.jsx)(C,{type:`dots`,size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:n||`Analyzing your system`})]}),(0,V.jsx)(re,{labels:g.slice(0,4)}),e.explanations.map(e=>t?e.split(` · `).filter(e=>!e.endsWith(`: incomplete`)).join(` · `):e).filter(Boolean).map((e,t)=>(0,V.jsx)(f,{size:`xs`,c:`dimmed`,"data-receipt-attention":!0,children:e},t)),s&&(0,V.jsx)(d,{renderRoot:e=>(0,V.jsx)(E,{...e,to:`/dashboards/$dashboardId`,params:{dashboardId:s.id},search:{}}),variant:`subtle`,size:`compact-sm`,color:`gray`,style:{alignSelf:`flex-start`},children:`Open dashboard`}),(0,V.jsx)(ie,{expanded:i,id:o,children:(0,V.jsxs)(u,{gap:4,children:[s&&(0,V.jsxs)(f,{size:`xs`,children:[s.label,` `,s.name,` · opens the current dashboard`]}),Object.entries(e.stages).map(([e,n])=>(0,V.jsxs)(f,{size:`xs`,c:`dimmed`,children:[T[e],`: `,t&&n.state===`incomplete`?`in progress`:n.state,n.elapsed_ms===void 0?``:` · ${Z(n.elapsed_ms)}`]},e)),e.save_attempts.map((e,t)=>e.state===`retried`&&(0,V.jsxs)(f,{size:`xs`,c:`dimmed`,children:[`Save attempt `,t+1,`: retried`]},e.call_id)),!!e.context_counts.deploys&&(0,V.jsxs)(f,{size:`xs`,children:[e.context_counts.deploys,` deploys observed`]}),!!e.context_counts.anomalies&&(0,V.jsxs)(f,{size:`xs`,children:[e.context_counts.anomalies,` anomalies observed`]}),e.panels.map(e=>(0,V.jsxs)(f,{size:`xs`,children:[`Preview · `,p(e.id),`: `,e.status,e.elapsed_ms===void 0?``:` · ${Z(e.elapsed_ms)}`]},e.id)),l&&(0,V.jsxs)(f,{size:`xs`,children:[`Save check: `,l.checked?`checked`:`incomplete`,` · `,Z(l.elapsed_ms)]}),l?.panels.map(e=>(0,V.jsxs)(f,{size:`xs`,children:[`Save · `,p(e.id),`: `,e.status,` · `,e.rows??0,` rows`,e.elapsed_ms===void 0?``:` · ${Z(e.elapsed_ms)}`]},e.id)),g.slice(4).map((e,t)=>(0,V.jsx)(f,{size:`xs`,children:e},t)),e.corrections.map((e,t)=>(0,V.jsxs)(f,{size:`xs`,children:[`Fixed `,e.title,`: `,e.message]},t))]})})]})})}var De=(0,B.lazy)(()=>j(()=>import(`./mcp-app-frame-Ysb7bM2I.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Oe=e=>e.tool_result.view.kind===`preset`;function ke(e){let t=new Map,n=new Set,r=[],i=()=>{let e=new Map;for(let t of r){let n=t.content.tool_result.view.key;e.set(n,t)}let i=new Set([...e.values()].map(e=>e.id)),a=[...e.values()].some(e=>Oe(e.content)),o=r.filter(e=>i.has(e.id)).at(-1)?.id;for(let e of r)i.has(e.id)?t.set(e.id,{content:e.content,expanded:Oe(e.content)||!a&&e.id===o}):n.add(e.id);r=[]};for(let t of e)if(t.role===`user`&&i(),t.role===`activity`&&t.activityType===`mcp-app`){let e=xe(t.content);e&&r.push({id:t.id,content:e})}return i(),{views:t,duplicates:n}}function Ae(e,t){return Array.isArray(e)?e.flatMap(e=>{if(!D(e)||typeof e.message!=`string`)return[];let n=typeof e.path==`string`?/^panels\[(\d+)\](?:\.|$)/.exec(e.path)?.[1]:void 0,r=n===void 0?void 0:t?.[Number(n)];return[r&&!e.message.startsWith(r)?`${r}: ${e.message}`:e.message]}):[]}function je(e){let t=new Map,n=new Map,r=new Map,i=`unattributed`;for(let a of e){if(a.role===`user`&&(n.clear(),r.clear(),i=a.id),a.role===`assistant`){i=a.id;for(let e of a.toolCalls??[]){let t=[`create_dashboard`,`replace_dashboard`].includes(e.function.name)?A(e.function.arguments)?.dashboard:void 0,r=D(t)&&Array.isArray(t.panels)?t.panels.map(e=>D(e)&&typeof e.title==`string`?e.title:``):void 0;n.set(e.id,{assistant:i,name:e.function.name,titles:r})}}if(a.role===`tool`){let e=A(a.content);if(!a.error&&!e?.error&&e?.isError!==!0)continue;let o=n.get(a.toolCallId);if(o&&ee.has(o.name)&&M(a))continue;let s=D(e?.error)?e?.error:void 0;if(s?.code===`no_data`||s?.code===`unknown_service`)continue;let c=o?.assistant??i,l=r.get(c)??a.id;r.set(c,l);let u=t.get(l)??[],d=typeof s?.message==`string`?s.message:typeof a.error==`string`&&a.error?a.error:`Could not complete this step. Try again.`,f=[`create_dashboard`,`edit_dashboard`,`replace_dashboard`].includes(o?.name??``)&&(s?.code===`invalid_spec`||s?.code===`dashboard_version_conflict`);u.push({name:k(o?.name??``),message:d,details:f?Ae(e?.problems,o?.titles):[],readOnly:s?.code===`answer_only`,rejected:f}),t.set(l,u)}}return t}function Me({failures:e}){let[t,n]=(0,B.useState)({rejected:!1,failed:!1}),r=e.filter(e=>e.rejected),a=e.filter(e=>!e.readOnly&&!e.rejected),s=[{key:`rejected`,items:r,label:`${r.length} ${r.length===1?`draft`:`drafts`} rejected`},{key:`failed`,items:a,label:`${a.length} ${a.length===1?`step`:`steps`} failed`}];return(0,V.jsxs)(i,{"data-chat-anchor":!0,children:[e.some(e=>e.readOnly)&&(0,V.jsx)(f,{size:`sm`,c:`dimmed`,children:`Not saved: Explain is read-only`}),s.map(({key:e,items:r,label:a})=>r.length>0&&(0,V.jsxs)(i,{children:[(0,V.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t[e],onClick:()=>n(t=>({...t,[e]:!t[e]})),style:{color:`var(--mantine-color-dimmed)`},children:[(0,V.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t[e]?(0,V.jsx)(F,{size:14}):(0,V.jsx)(X,{size:14})}),(0,V.jsx)(`span`,{className:`chat-app-summary`,children:a})]}),t[e]&&(0,V.jsx)(u,{gap:`xs`,pl:`md`,children:r.flatMap((e,t)=>(e.details.length?e.details:[`${e.name}: ${e.message}`]).map((e,n)=>(0,V.jsx)(f,{size:`sm`,c:`dimmed`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:e},`${t}-${n}`)))})]},e))]})}function Ne({view:e}){let[t,n]=(0,B.useState)(e.expanded);(0,B.useEffect)(()=>n(e.expanded),[e.expanded]);let r=e.content.tool_result,i=ve(r),a=[...new Set(r.dashboard.panels.map(e=>e.viz===`timeseries`?`time series`:e.viz.replaceAll(`_`,` `)))].join(`, `),s=r.results.reduce((e,t)=>e+(t.frame?.rows??0),0),c=new Map;for(let e of r.results)e.status!==`ok`&&c.set(e.status,(c.get(e.status)??0)+1);let l=r.dashboard.panels.length>1?[`${r.dashboard.panels.length} panels`,...Array.from(c,([e,t])=>`${t} ${e}`)].join(` · `):c.size?[...c.keys()].join(`, `):`${s} ${s===1?`row`:`rows`}`;return(0,V.jsxs)(S,{"data-chat-app":!0,"data-chat-anchor":!0,withBorder:!0,radius:`lg`,style:{overflow:`hidden`},children:[(0,V.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,V.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t?(0,V.jsx)(F,{size:14}):(0,V.jsx)(X,{size:14})}),(0,V.jsxs)(`span`,{className:`chat-app-summary`,children:[i,` · `,a,` · `,l]})]}),t&&(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(x,{mih:180,children:(0,V.jsx)(C,{size:`sm`})}),children:(0,V.jsx)(De,{content:e.content})})]})}var Pe=[`Summarize system health for the last hour`,`Find the source of elevated errors`,`Map the current service dependencies`,`Show the slowest endpoints`];function Fe(){let{agentAvailable:e,messages:t,messageTimes:n,ready:r,running:a,activity:o,stopped:s,error:l,threadMissing:p,send:h,retry:g,reloadThread:y,newThread:b}=w(),T=te(t),E=t.filter(e=>e.role===`user`).at(-1)?.id,{scrollRef:D,contentRef:O,turnRef:ee,showJump:k,jumpToLatest:A}=we(E);if(!e)return(0,V.jsx)(m,{size:`sm`,py:96,children:(0,V.jsx)(S,{withBorder:!0,radius:`lg`,p:{base:`xl`,sm:40},children:(0,V.jsxs)(u,{gap:`md`,children:[(0,V.jsx)(f,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,V.jsx)(_,{order:1,fz:28,children:`Chat is not configured`}),(0,V.jsx)(f,{c:`dimmed`,children:`Add an AI provider key to enable chat. Telemetry ingest, dashboards, traces, logs, and metrics remain available without it.`}),(0,V.jsx)(d,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let j=ke(t),M=je(t),P=t.filter(e=>j.duplicates.has(e.id)?!1:e.role===`tool`?M.has(e.id):e.role===`assistant`?!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0:e.role===`activity`?e.activityType===`mcp-app`||e.activityType===`agent-outcome`:e.role===`user`),F=t.findIndex(e=>e.id===E),I=t.slice(F+1).some(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.length>0),L=t.slice(F+1).filter(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0).at(-1),R=[];for(let e of P)(e.role===`user`||R.length===0)&&R.push({id:e.id,messages:[]}),R.at(-1).messages.push(e);R.length===0&&R.push({id:`draft`,messages:[]});let ne=e=>M.has(e.id)?(0,V.jsx)(Me,{failures:M.get(e.id)},e.id):(0,V.jsxs)(i,{children:[(0,V.jsx)(Re,{message:e,time:n[e.id],appView:j.views.get(e.id)}),T.has(e.id)&&(0,V.jsx)(i,{mt:`sm`,children:(0,V.jsx)(Ee,{receipt:T.get(e.id),running:a&&e.id===E,awaitingAnswer:!I,activity:o})})]},e.id);return(0,V.jsxs)(i,{className:`chat-pane`,children:[(0,V.jsxs)(i,{className:`chat-viewport`,children:[(0,V.jsx)(i,{className:`chat-scroll`,ref:D,tabIndex:0,role:`log`,"aria-label":`Conversation`,children:(0,V.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,ref:O,children:[p&&(0,V.jsx)(v,{color:`warn`,radius:`lg`,title:`This chat no longer exists`,children:(0,V.jsxs)(c,{justify:`space-between`,children:[(0,V.jsx)(f,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,V.jsx)(d,{size:`compact-sm`,variant:`light`,onClick:b,children:`New chat`})]})}),!p&&!r&&l&&(0,V.jsx)(Q,{message:l,onRetry:y,onNewThread:b}),!p&&!r&&!l&&(0,V.jsxs)(x,{mih:`40vh`,children:[(0,V.jsx)(C,{size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading chat`})]}),!p&&r&&(0,V.jsxs)(V.Fragment,{children:[P.length===0&&(0,V.jsx)(Le,{onSelect:h}),(0,V.jsx)(u,{gap:`lg`,children:R.map((e,t)=>(0,V.jsxs)(u,{gap:`lg`,ref:e.id===E?ee:void 0,"data-chat-turn":e.id===E?E:void 0,children:[e.messages.filter(e=>e.id!==L?.id).map(ne),t===R.length-1&&(0,V.jsxs)(V.Fragment,{children:[L&&(0,V.jsx)(i,{"data-answer-position":!0,children:(0,V.jsx)(Re,{message:L,time:n[L.id]})},`answer-${E??`draft`}`),a&&!I&&!T.has(E??``)&&(0,V.jsxs)(c,{gap:`xs`,role:`status`,children:[(0,V.jsx)(C,{type:`dots`,size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:o||`Analyzing your system`})]}),s&&(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:`Stopped`}),l&&(0,V.jsx)(Q,{message:l,onRetry:g})]})]},e.id))})]})]})}),k&&(0,V.jsx)(N,{label:`Jump to latest`,children:(0,V.jsx)(z,{className:`chat-jump`,variant:`default`,size:36,radius:`xl`,"aria-label":`Jump to latest`,onClick:A,children:(0,V.jsx)(pe,{size:18,"aria-hidden":`true`})})})]}),!p&&(0,V.jsx)(Ie,{})]})}function Q({message:e,onRetry:t,onNewThread:n}){return(0,V.jsx)(v,{color:`bad`,radius:`lg`,title:`Something went wrong`,children:(0,V.jsxs)(c,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,V.jsx)(f,{size:`sm`,children:e}),(0,V.jsxs)(c,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,V.jsx)(d,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,V.jsx)(d,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Ie(){let{input:e,setInput:t,inputRef:n,submit:r,send:a,stop:o,ready:s,running:l}=w();return(0,V.jsx)(i,{className:`chat-composer`,children:(0,V.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},children:[(0,V.jsx)(S,{component:`form`,onSubmit:r,className:`chat-composer-field`,withBorder:!0,radius:24,py:6,pl:`lg`,pr:6,children:(0,V.jsxs)(c,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,V.jsx)(G,{ref:n,"aria-label":`Message Fanout`,value:e,onChange:e=>t(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),a(e))},placeholder:l?`Fanout is working…`:`Ask about health, errors, or latency…`,disabled:!s,autosize:!0,minRows:1,maxRows:8,variant:`unstyled`,flex:1}),l?(0,V.jsx)(N,{label:`Stop`,children:(0,V.jsx)(z,{type:`button`,variant:`default`,size:40,radius:`xl`,"aria-label":`Stop`,onClick:o,children:(0,V.jsx)(_e,{size:16,weight:`fill`})})}):(0,V.jsx)(z,{type:`submit`,variant:`filled`,size:40,radius:`xl`,disabled:!e.trim()||!s,"aria-label":`Send message`,children:(0,V.jsx)(he,{size:17,weight:`fill`})})]})}),(0,V.jsx)(f,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function Le({onSelect:e}){return(0,V.jsxs)(u,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,V.jsx)(g,{size:`large`}),(0,V.jsx)(_,{order:1,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,V.jsx)(c,{justify:`center`,gap:`xs`,mt:`xs`,maw:720,children:Pe.map(t=>(0,V.jsx)(d,{variant:`default`,size:`sm`,radius:`xl`,onClick:()=>void e(t),children:t},t))})]})}function Re({message:e,time:t,appView:n}){if(e.role===`activity`)return e.activityType===`agent-outcome`&&e.content&&typeof e.content==`object`&&`message`in e.content&&typeof e.content.message==`string`?`status`in e.content&&e.content.status===`stopped`?(0,V.jsx)(f,{c:`dimmed`,size:`sm`,"data-chat-anchor":!0,children:e.content.message}):(0,V.jsx)(v,{color:`bad`,title:`Something went wrong`,"data-chat-anchor":!0,children:e.content.message}):e.activityType===`mcp-app`?n?(0,V.jsx)(Ne,{view:n}):(0,V.jsx)(v,{color:`bad`,"data-chat-anchor":!0,children:`This view could not be loaded. Please try again.`}):null;if(e.role===`assistant`&&e.toolCalls?.length)return null;let r=typeof e.content==`string`?e.content:JSON.stringify(e.content);if(!r&&e.role===`assistant`)return null;let a=e.role===`user`,o=t?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(t)):``;return(0,V.jsxs)(i,{className:`chat-message`,"data-chat-anchor":!0,"data-role":a?`user`:`assistant`,children:[a?(0,V.jsx)(S,{radius:`lg`,px:`md`,py:`sm`,bg:`var(--mantine-color-brand-light)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,V.jsx)(f,{style:{whiteSpace:`pre-wrap`},children:r})}):(0,V.jsx)(q,{className:`chat-markdown`,children:(0,V.jsx)(ne,{remarkPlugins:[R],components:Be,children:r})}),(o||!a)&&(0,V.jsxs)(c,{className:`chat-message-meta`,gap:6,justify:a?`flex-end`:`flex-start`,mt:4,h:24,children:[o&&t&&(0,V.jsx)(f,{c:`dimmed`,size:`xs`,title:P(t),children:o}),!a&&(0,V.jsx)(ze,{text:r,label:`Copy message`})]})]})}function ze({text:e,label:t}){let{state:n,copy:r}=Te();return(0,V.jsx)(N,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,V.jsx)(z,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":t,"data-state":n===`idle`?void 0:n,onClick:()=>r(e),children:n===`copied`?(0,V.jsx)(p,{size:13,weight:`bold`}):(0,V.jsx)(y,{size:13})})})}var Be={table:({children:e})=>(0,V.jsx)(i,{className:`chat-table`,children:(0,V.jsx)(L,{striped:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,V.jsx)(L.Thead,{children:e}),tbody:({children:e})=>(0,V.jsx)(L.Tbody,{children:e}),tr:({children:e})=>(0,V.jsx)(L.Tr,{children:e}),th:({children:e})=>(0,V.jsx)(L.Th,{children:e}),td:({children:e})=>(0,V.jsx)(L.Td,{children:e}),pre:({children:e})=>(0,V.jsx)(Ve,{children:e}),a:({href:e,children:t})=>(0,V.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})};function Ve({children:e}){let t=$(e);return(0,V.jsxs)(i,{className:`chat-code`,pos:`relative`,children:[(0,V.jsx)(i,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,V.jsx)(ze,{text:t,label:`Copy code`})}),(0,V.jsx)(`pre`,{children:e})]})}function $(e){return typeof e==`string`?e:Array.isArray(e)?e.map($).join(``):e&&typeof e==`object`&&`props`in e?$(e.props.children):``}export{xe as n,Fe as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-BzKwvTFN.js b/internal/ui/dist/assets/chat._threadId-BzKwvTFN.js deleted file mode 100644 index c2e1842d3..000000000 --- a/internal/ui/dist/assets/chat._threadId-BzKwvTFN.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-BqevyT9H.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-D3lAczL5.js b/internal/ui/dist/assets/chat._threadId-D3lAczL5.js new file mode 100644 index 000000000..102487340 --- /dev/null +++ b/internal/ui/dist/assets/chat._threadId-D3lAczL5.js @@ -0,0 +1 @@ +import{t as e}from"./chat-DvbFi0gm.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-BzKwvTFN.js b/internal/ui/dist/assets/chat.index-BzKwvTFN.js deleted file mode 100644 index c2e1842d3..000000000 --- a/internal/ui/dist/assets/chat.index-BzKwvTFN.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-BqevyT9H.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-D3lAczL5.js b/internal/ui/dist/assets/chat.index-D3lAczL5.js new file mode 100644 index 000000000..102487340 --- /dev/null +++ b/internal/ui/dist/assets/chat.index-D3lAczL5.js @@ -0,0 +1 @@ +import{t as e}from"./chat-DvbFi0gm.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboard-change-chips-DHVvGnTI.js b/internal/ui/dist/assets/dashboard-change-chips-Cbk2Ba8I.js similarity index 99% rename from internal/ui/dist/assets/dashboard-change-chips-DHVvGnTI.js rename to internal/ui/dist/assets/dashboard-change-chips-Cbk2Ba8I.js index c0fdc40a8..259658c63 100644 --- a/internal/ui/dist/assets/dashboard-change-chips-DHVvGnTI.js +++ b/internal/ui/dist/assets/dashboard-change-chips-Cbk2Ba8I.js @@ -1,4 +1,4 @@ -import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,K as s,M as c,P as l,Q as u,T as d,X as f,_ as p,_t as m,a as h,et as g,mt as _,rt as v,ut as y,z as b}from"./brand-DUaZkIz1.js";import{E as x,S,o as C}from"./Tooltip-B3r3s_B9.js";import{It as w}from"./index-CEp3GmPL.js";var T=i(t(),1),E=i(m(),1);function D(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function O(e){return e.current?e.current.scrollHeight:`auto`}function k(e){return typeof e==`number`&&e>0}function ee({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={height:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??D(n);return{transition:`height ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`height`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=O(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),height:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=O(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`height`,height:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({height:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`height`){if(i){let e=O(l);e===u.height?m({}):h({height:e}),p(`entered`),c()}else u.height===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function te(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function A(e){return e.current?e.current.scrollWidth:`auto`}function j({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={width:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??te(n);return{transition:`width ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`width`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=A(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),width:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=A(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`width`,width:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({width:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`width`){if(i){let e=A(l);e===u.width?m({}):h({width:e}),p(`entered`),c()}else u.width===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function ne(){return`development`}var M=r(),N={transitionDuration:200,transitionTimingFunction:`ease`,animateOpacity:!0,orientation:`vertical`,keepMounted:!0,keepMountedMode:`activity`},re=d(e=>{let{children:t,expanded:n,transitionDuration:r,transitionTimingFunction:i,style:a,onTransitionEnd:s,onTransitionStart:d,animateOpacity:f,keepMounted:p,keepMountedMode:m,ref:h,orientation:g,..._}=c(`Collapse`,N,e),v=b(),y=l(),x=u(),C=y.respectReducedMotion&&x?0:r,w=(g===`horizontal`?j:ee)({expanded:n,transitionDuration:C,transitionTimingFunction:i,onTransitionEnd:s,onTransitionStart:d,keepMounted:!1});if(C===0)return p===!0&&(m===`display-none`||v!==`test`)?m===`display-none`?(0,M.jsx)(o,{..._,style:{...S(a,y),...n?{}:{display:`none`}},ref:h,children:t}):(0,M.jsx)(T.Activity,{mode:n?`visible`:`hidden`,children:(0,M.jsx)(o,{..._,style:a,ref:h,children:t})}):n?(0,M.jsx)(o,{..._,style:a,ref:h,children:t}):null;let E=w.state===`exited`,D;return D=p===!1?E?null:t:p===!0?m===`display-none`?t:(0,M.jsx)(T.Activity,{mode:E?`hidden`:`visible`,children:t}):t,(0,M.jsx)(o,{..._,...w.getCollapseProps({style:{opacity:n||!f?1:0,transition:f?`opacity ${C}ms ${i}`:`none`,...S(a,y),...p&&m===`display-none`&&E?{display:`none`}:{}},ref:h}),children:D})});re.displayName=`@mantine/core/Collapse`;var[ie,ae]=x(`Table component was not found in the tree`),oe={table:`m_b23fa0ef`,th:`m_4e7aa4f3`,tr:`m_4e7aa4fd`,td:`m_4e7aa4ef`,tbody:`m_b2404537`,thead:`m_b242d975`,caption:`m_9e5a3ac7`,scrollContainer:`m_a100c15`,scrollContainerInner:`m_62259741`};function se(e,t){if(!t)return;let n={};return t.columnBorder&&e.withColumnBorders&&(n[`data-with-column-border`]=!0),t.rowBorder&&e.withRowBorders&&(n[`data-with-row-border`]=!0),t.striped&&e.striped&&(n[`data-striped`]=e.striped),t.highlightOnHover&&e.highlightOnHover&&(n[`data-hover`]=!0),t.captionSide&&e.captionSide&&(n[`data-side`]=e.captionSide),t.stickyHeader&&e.stickyHeader&&(n[`data-sticky`]=!0),n}function ce(e,t){let n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=d(r=>{let i=c(n,{},r),{classNames:a,className:s,style:l,styles:u,...d}=i,f=ae();return(0,M.jsx)(o,{component:e,...se(f,t),...f.getStyles(e,{className:s,classNames:a,style:l,styles:u,props:i}),...d})});return r.displayName=`@mantine/core/${n}`,r.classes=oe,r}var le=ce(`th`,{columnBorder:!0}),ue=ce(`td`,{columnBorder:!0}),de=ce(`tr`,{rowBorder:!0,striped:!0,highlightOnHover:!0}),fe=ce(`thead`,{stickyHeader:!0}),pe=ce(`tbody`),me=ce(`tfoot`),he=ce(`caption`,{captionSide:!0}),ge={type:`scrollarea`},_e=f((e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":_(t),"--table-max-height":_(n),"--table-overflow":r===`native`?`auto`:void 0}})),ve=d(e=>{let t=c(`TableScrollContainer`,ge,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,children:d,minWidth:f,maxHeight:p,type:m,scrollAreaProps:h,attributes:g,..._}=t,v=a({name:`TableScrollContainer`,classes:oe,props:t,className:r,style:i,classNames:n,styles:s,unstyled:l,attributes:g,vars:u,varsResolver:_e,rootSelector:`scrollContainer`});return(0,M.jsx)(o,{component:m===`scrollarea`?C:`div`,...m===`scrollarea`?p?{offsetScrollbars:`xy`,...h}:{offsetScrollbars:`x`,...h}:{},...v(`scrollContainer`),..._,children:(0,M.jsx)(`div`,{...v(`scrollContainerInner`),children:d})})});ve.classes=oe,ve.varsResolver=_e,ve.displayName=`@mantine/core/TableScrollContainer`;function ye({data:e}){return(0,M.jsxs)(M.Fragment,{children:[e.caption&&(0,M.jsx)(he,{children:e.caption}),e.head&&(0,M.jsx)(fe,{children:(0,M.jsx)(de,{children:e.head.map((e,t)=>(0,M.jsx)(le,{children:e},t))})}),e.body&&(0,M.jsx)(pe,{children:e.body.map((e,t)=>(0,M.jsx)(de,{children:e.map((e,t)=>(0,M.jsx)(ue,{children:e},t))},t))}),e.foot&&(0,M.jsx)(me,{children:(0,M.jsx)(de,{children:e.foot.map((e,t)=>(0,M.jsx)(le,{children:e},t))})})]})}ye.displayName=`@mantine/core/TableDataRenderer`;var be={withRowBorders:!0,verticalSpacing:7},xe=f((e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:i,borderColor:a,stripedColor:o,highlightOnHoverColor:c,striped:l,highlightOnHover:u,stickyHeaderOffset:d,stickyHeader:f})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":y(r),"--table-vertical-spacing":y(i),"--table-border-color":a?s(a,e):void 0,"--table-striped-color":l&&o?s(o,e):void 0,"--table-highlight-on-hover-color":u&&c?s(c,e):void 0,"--table-sticky-header-offset":f?_(d):void 0}})),P=d(e=>{let t=c(`Table`,be,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,horizontalSpacing:d,verticalSpacing:f,captionSide:p,stripedColor:m,highlightOnHoverColor:h,striped:g,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,withTableBorder:b,borderColor:x,layout:S,data:C,children:w,stickyHeader:E,stickyHeaderOffset:D,mod:O,tabularNums:k,attributes:ee,...te}=t,A=a({name:`Table`,props:t,className:r,style:i,classes:oe,classNames:n,styles:s,unstyled:l,attributes:ee,rootSelector:`table`,vars:u,varsResolver:xe,stable:!0}),j=g===!0?`odd`:g||void 0,ne=p||`bottom`,N=(0,T.useMemo)(()=>({getStyles:A,stickyHeader:E,striped:j,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,captionSide:ne}),[A,E,j,_,v,y,ne]);return(0,M.jsx)(ie,{value:N,children:(0,M.jsx)(o,{component:`table`,mod:[{withTableBorder:b,tabularNums:k},O],...A(`table`),...te,children:w||!!C&&(0,M.jsx)(ye,{data:C})})})});P.classes=oe,P.varsResolver=xe,P.displayName=`@mantine/core/Table`,P.Td=ue,P.Th=le,P.Tr=de,P.Thead=fe,P.Tbody=pe,P.Tfoot=me,P.Caption=he,P.ScrollContainer=ve,P.DataRenderer=ye;var Se=new Map([[`bold`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),T.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),Ce=T.forwardRef((e,t)=>T.createElement(h,{ref:t,...e,weights:Se}));Ce.displayName=`CaretDownIcon`;var we=Ce,Te=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Ee(e){return Number.isFinite(e)?e>0&&e<1e-4?`<0.01%`:`${(e*100).toFixed(e>=.1?1:2)}%`:`—`}function De(e){if(!Number.isFinite(e))return`—`;if(e<0)return`-${De(-e)}`;if(e===0)return`0ms`;if(e<.01)return`<0.01ms`;if(e<1)return`${e.toFixed(2)}ms`;if(Math.round(e*10)/10<100)return`${e.toFixed(1)}ms`;if(Math.round(e)<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/100)/10;if(t<10)return`${(e/1e3).toFixed(2)}s`;if(t<60)return`${t.toFixed(1)}s`;let n=Math.round(e/1e3),r=Math.floor(n/60),i=n%60;if(r<60)return i===0?`${r}m`:`${r}m ${i}s`;let a=Math.floor(r/60),o=r%60;return o===0?`${a}h`:`${a}h ${o}m`}function Oe(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.valueOf())?String(e):t.toLocaleString([],{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`})}function ke(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ae=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,je=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Me={};function Ne(e,t){return((t||Me).jsx?je:Ae).test(e)}var Pe=/[ \t\n\f\r]/g;function Fe(e){return typeof e==`object`?e.type===`text`&&Ie(e.value):Ie(e)}function Ie(e){return e.replace(Pe,``)===``}var Le=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Le.prototype.normal={},Le.prototype.property={},Le.prototype.space=void 0;function Re(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Le(n,r,t)}function ze(e){return e.toLowerCase()}var F=class{constructor(e,t){this.attribute=t,this.property=e}};F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0;var Be=n({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>B,commaSeparated:()=>Ue,number:()=>R,overloadedBoolean:()=>He,spaceSeparated:()=>z}),Ve=0,I=We(),L=We(),He=We(),R=We(),z=We(),Ue=We(),B=We();function We(){return 2**++Ve}var Ge=Object.keys(Be),Ke=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),qe(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&ot.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(at,lt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!at.test(e)){let n=e.replace(it,ct);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ke}return new i(r,t)}function ct(e){return`-`+e.toLowerCase()}function lt(e){return e.charAt(1).toUpperCase()}var ut=Re([Ye,Qe,et,tt,nt],`html`),dt=Re([Ye,$e,et,tt,nt],`svg`);function ft(e){return e.join(` `).trim()}var pt=e(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` +import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,K as s,M as c,P as l,Q as u,T as d,X as f,_ as p,_t as m,a as h,et as g,mt as _,rt as v,ut as y,z as b}from"./brand-DUaZkIz1.js";import{E as x,S,o as C}from"./Tooltip-B3r3s_B9.js";import{It as w}from"./index-DxHBLqHS.js";var T=i(t(),1),E=i(m(),1);function D(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function O(e){return e.current?e.current.scrollHeight:`auto`}function k(e){return typeof e==`number`&&e>0}function ee({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={height:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??D(n);return{transition:`height ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`height`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=O(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),height:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=O(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`height`,height:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({height:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`height`){if(i){let e=O(l);e===u.height?m({}):h({height:e}),p(`entered`),c()}else u.height===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function te(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function A(e){return e.current?e.current.scrollWidth:`auto`}function j({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={width:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??te(n);return{transition:`width ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`width`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=A(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),width:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=A(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`width`,width:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({width:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`width`){if(i){let e=A(l);e===u.width?m({}):h({width:e}),p(`entered`),c()}else u.width===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function ne(){return`development`}var M=r(),N={transitionDuration:200,transitionTimingFunction:`ease`,animateOpacity:!0,orientation:`vertical`,keepMounted:!0,keepMountedMode:`activity`},re=d(e=>{let{children:t,expanded:n,transitionDuration:r,transitionTimingFunction:i,style:a,onTransitionEnd:s,onTransitionStart:d,animateOpacity:f,keepMounted:p,keepMountedMode:m,ref:h,orientation:g,..._}=c(`Collapse`,N,e),v=b(),y=l(),x=u(),C=y.respectReducedMotion&&x?0:r,w=(g===`horizontal`?j:ee)({expanded:n,transitionDuration:C,transitionTimingFunction:i,onTransitionEnd:s,onTransitionStart:d,keepMounted:!1});if(C===0)return p===!0&&(m===`display-none`||v!==`test`)?m===`display-none`?(0,M.jsx)(o,{..._,style:{...S(a,y),...n?{}:{display:`none`}},ref:h,children:t}):(0,M.jsx)(T.Activity,{mode:n?`visible`:`hidden`,children:(0,M.jsx)(o,{..._,style:a,ref:h,children:t})}):n?(0,M.jsx)(o,{..._,style:a,ref:h,children:t}):null;let E=w.state===`exited`,D;return D=p===!1?E?null:t:p===!0?m===`display-none`?t:(0,M.jsx)(T.Activity,{mode:E?`hidden`:`visible`,children:t}):t,(0,M.jsx)(o,{..._,...w.getCollapseProps({style:{opacity:n||!f?1:0,transition:f?`opacity ${C}ms ${i}`:`none`,...S(a,y),...p&&m===`display-none`&&E?{display:`none`}:{}},ref:h}),children:D})});re.displayName=`@mantine/core/Collapse`;var[ie,ae]=x(`Table component was not found in the tree`),oe={table:`m_b23fa0ef`,th:`m_4e7aa4f3`,tr:`m_4e7aa4fd`,td:`m_4e7aa4ef`,tbody:`m_b2404537`,thead:`m_b242d975`,caption:`m_9e5a3ac7`,scrollContainer:`m_a100c15`,scrollContainerInner:`m_62259741`};function se(e,t){if(!t)return;let n={};return t.columnBorder&&e.withColumnBorders&&(n[`data-with-column-border`]=!0),t.rowBorder&&e.withRowBorders&&(n[`data-with-row-border`]=!0),t.striped&&e.striped&&(n[`data-striped`]=e.striped),t.highlightOnHover&&e.highlightOnHover&&(n[`data-hover`]=!0),t.captionSide&&e.captionSide&&(n[`data-side`]=e.captionSide),t.stickyHeader&&e.stickyHeader&&(n[`data-sticky`]=!0),n}function ce(e,t){let n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=d(r=>{let i=c(n,{},r),{classNames:a,className:s,style:l,styles:u,...d}=i,f=ae();return(0,M.jsx)(o,{component:e,...se(f,t),...f.getStyles(e,{className:s,classNames:a,style:l,styles:u,props:i}),...d})});return r.displayName=`@mantine/core/${n}`,r.classes=oe,r}var le=ce(`th`,{columnBorder:!0}),ue=ce(`td`,{columnBorder:!0}),de=ce(`tr`,{rowBorder:!0,striped:!0,highlightOnHover:!0}),fe=ce(`thead`,{stickyHeader:!0}),pe=ce(`tbody`),me=ce(`tfoot`),he=ce(`caption`,{captionSide:!0}),ge={type:`scrollarea`},_e=f((e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":_(t),"--table-max-height":_(n),"--table-overflow":r===`native`?`auto`:void 0}})),ve=d(e=>{let t=c(`TableScrollContainer`,ge,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,children:d,minWidth:f,maxHeight:p,type:m,scrollAreaProps:h,attributes:g,..._}=t,v=a({name:`TableScrollContainer`,classes:oe,props:t,className:r,style:i,classNames:n,styles:s,unstyled:l,attributes:g,vars:u,varsResolver:_e,rootSelector:`scrollContainer`});return(0,M.jsx)(o,{component:m===`scrollarea`?C:`div`,...m===`scrollarea`?p?{offsetScrollbars:`xy`,...h}:{offsetScrollbars:`x`,...h}:{},...v(`scrollContainer`),..._,children:(0,M.jsx)(`div`,{...v(`scrollContainerInner`),children:d})})});ve.classes=oe,ve.varsResolver=_e,ve.displayName=`@mantine/core/TableScrollContainer`;function ye({data:e}){return(0,M.jsxs)(M.Fragment,{children:[e.caption&&(0,M.jsx)(he,{children:e.caption}),e.head&&(0,M.jsx)(fe,{children:(0,M.jsx)(de,{children:e.head.map((e,t)=>(0,M.jsx)(le,{children:e},t))})}),e.body&&(0,M.jsx)(pe,{children:e.body.map((e,t)=>(0,M.jsx)(de,{children:e.map((e,t)=>(0,M.jsx)(ue,{children:e},t))},t))}),e.foot&&(0,M.jsx)(me,{children:(0,M.jsx)(de,{children:e.foot.map((e,t)=>(0,M.jsx)(le,{children:e},t))})})]})}ye.displayName=`@mantine/core/TableDataRenderer`;var be={withRowBorders:!0,verticalSpacing:7},xe=f((e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:i,borderColor:a,stripedColor:o,highlightOnHoverColor:c,striped:l,highlightOnHover:u,stickyHeaderOffset:d,stickyHeader:f})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":y(r),"--table-vertical-spacing":y(i),"--table-border-color":a?s(a,e):void 0,"--table-striped-color":l&&o?s(o,e):void 0,"--table-highlight-on-hover-color":u&&c?s(c,e):void 0,"--table-sticky-header-offset":f?_(d):void 0}})),P=d(e=>{let t=c(`Table`,be,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,horizontalSpacing:d,verticalSpacing:f,captionSide:p,stripedColor:m,highlightOnHoverColor:h,striped:g,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,withTableBorder:b,borderColor:x,layout:S,data:C,children:w,stickyHeader:E,stickyHeaderOffset:D,mod:O,tabularNums:k,attributes:ee,...te}=t,A=a({name:`Table`,props:t,className:r,style:i,classes:oe,classNames:n,styles:s,unstyled:l,attributes:ee,rootSelector:`table`,vars:u,varsResolver:xe,stable:!0}),j=g===!0?`odd`:g||void 0,ne=p||`bottom`,N=(0,T.useMemo)(()=>({getStyles:A,stickyHeader:E,striped:j,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,captionSide:ne}),[A,E,j,_,v,y,ne]);return(0,M.jsx)(ie,{value:N,children:(0,M.jsx)(o,{component:`table`,mod:[{withTableBorder:b,tabularNums:k},O],...A(`table`),...te,children:w||!!C&&(0,M.jsx)(ye,{data:C})})})});P.classes=oe,P.varsResolver=xe,P.displayName=`@mantine/core/Table`,P.Td=ue,P.Th=le,P.Tr=de,P.Thead=fe,P.Tbody=pe,P.Tfoot=me,P.Caption=he,P.ScrollContainer=ve,P.DataRenderer=ye;var Se=new Map([[`bold`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),T.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),Ce=T.forwardRef((e,t)=>T.createElement(h,{ref:t,...e,weights:Se}));Ce.displayName=`CaretDownIcon`;var we=Ce,Te=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Ee(e){return Number.isFinite(e)?e>0&&e<1e-4?`<0.01%`:`${(e*100).toFixed(e>=.1?1:2)}%`:`—`}function De(e){if(!Number.isFinite(e))return`—`;if(e<0)return`-${De(-e)}`;if(e===0)return`0ms`;if(e<.01)return`<0.01ms`;if(e<1)return`${e.toFixed(2)}ms`;if(Math.round(e*10)/10<100)return`${e.toFixed(1)}ms`;if(Math.round(e)<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/100)/10;if(t<10)return`${(e/1e3).toFixed(2)}s`;if(t<60)return`${t.toFixed(1)}s`;let n=Math.round(e/1e3),r=Math.floor(n/60),i=n%60;if(r<60)return i===0?`${r}m`:`${r}m ${i}s`;let a=Math.floor(r/60),o=r%60;return o===0?`${a}h`:`${a}h ${o}m`}function Oe(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.valueOf())?String(e):t.toLocaleString([],{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`})}function ke(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ae=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,je=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Me={};function Ne(e,t){return((t||Me).jsx?je:Ae).test(e)}var Pe=/[ \t\n\f\r]/g;function Fe(e){return typeof e==`object`?e.type===`text`&&Ie(e.value):Ie(e)}function Ie(e){return e.replace(Pe,``)===``}var Le=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Le.prototype.normal={},Le.prototype.property={},Le.prototype.space=void 0;function Re(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Le(n,r,t)}function ze(e){return e.toLowerCase()}var F=class{constructor(e,t){this.attribute=t,this.property=e}};F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0;var Be=n({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>B,commaSeparated:()=>Ue,number:()=>R,overloadedBoolean:()=>He,spaceSeparated:()=>z}),Ve=0,I=We(),L=We(),He=We(),R=We(),z=We(),Ue=We(),B=We();function We(){return 2**++Ve}var Ge=Object.keys(Be),Ke=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),qe(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&ot.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(at,lt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!at.test(e)){let n=e.replace(it,ct);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ke}return new i(r,t)}function ct(e){return`-`+e.toLowerCase()}function lt(e){return e.charAt(1).toUpperCase()}var ut=Re([Ye,Qe,et,tt,nt],`html`),dt=Re([Ye,$e,et,tt,nt],`svg`);function ft(e){return e.join(` `).trim()}var pt=e(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),mt=e((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(pt());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),ht=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),gt=e(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(mt()),r=ht();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),_t=yt(`end`),vt=yt(`start`);function yt(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function bt(e){let t=vt(e),n=_t(e);if(t&&n)return{start:t,end:n}}function xt(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ct(e.position):`start`in e||`end`in e?Ct(e):`line`in e||`column`in e?St(e):``}function St(e){return wt(e&&e.line)+`:`+wt(e&&e.column)}function Ct(e){return St(e&&e.start)+`-`+St(e&&e.end)}function wt(e){return e&&typeof e==`number`?e:1}var V=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=xt(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};V.prototype.file=``,V.prototype.name=``,V.prototype.reason=``,V.prototype.message=``,V.prototype.stack=``,V.prototype.column=void 0,V.prototype.line=void 0,V.prototype.ancestors=void 0,V.prototype.cause=void 0,V.prototype.fatal=void 0,V.prototype.place=void 0,V.prototype.ruleId=void 0,V.prototype.source=void 0;var Tt=i(gt(),1),Et={}.hasOwnProperty,Dt=new Map,Ot=/[A-Z]/g,kt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),At=new Set([`td`,`th`]),jt=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Mt(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Ut(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Ht(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?dt:ut,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Nt(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Nt(e,t,n){if(t.type===`element`)return Pt(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Ft(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Lt(e,t,n);if(t.type===`mdxjsEsm`)return It(e,t);if(t.type===`root`)return Rt(e,t,n);if(t.type===`text`)return zt(e,t)}function Pt(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=dt,e.schema=i),e.ancestors.push(t);let a=Yt(e,t.tagName,!1),o=Wt(e,t),s=Kt(e,t);return kt.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Fe(e)})),Bt(e,o,a,t),Vt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ft(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Xt(e,t.position)}function It(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Xt(e,t.position)}function Lt(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=dt,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Yt(e,t.name,!0),o=Gt(e,t),s=Kt(e,t);return Bt(e,o,a,t),Vt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Rt(e,t,n){let r={};return Vt(r,Kt(e,t)),e.create(t,e.Fragment,r,n)}function zt(e,t){return t.value}function Bt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vt(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Ht(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Ut(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=vt(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Wt(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Et.call(t.properties,i)){let a=qt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&At.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Gt(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Xt(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Xt(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Kt(e,t){let n=[],r=-1,i=e.passKeys?new Map:Dt;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(H(e,e.length,0,t),e):t}var ln={}.hasOwnProperty;function un(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function W(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var G=xn(/[A-Za-z]/),K=xn(/[\dA-Za-z]/),mn=xn(/[#-'*+\--9=?A-Z^-~]/);function hn(e){return e!==null&&(e<32||e===127)}var gn=xn(/\d/),_n=xn(/[\dA-Fa-f]/),vn=xn(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function J(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var yn=xn(/\p{P}|\p{S}/u),bn=xn(/\s/);function xn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Sn(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function X(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Y(r)?(e.enter(n),s(r)):t(r)}function s(r){return Y(r)&&a++0&&Y(t)?(e.enter(r),c(t)):l(t)}function c(t){return Y(t)&&o=i?t(e):n(e)}}var wn={tokenize:Tn};function Tn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var En=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){Dn(this,e,t,n,!1)}addBefore(e,t,n){Dn(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function Dn(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var On={tokenize:An},kn={tokenize:jn};function An(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(ro))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function jn(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Mn(e){if(e===null||J(e)||bn(e))return 1;if(yn(e))return 2}function Nn(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};Ln(o,-a),Ln(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=U(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=U(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=U(r,Nn(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=U(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=U(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),H(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n0&&Y(t)?X(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||q(t)?e.check(Xn,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Y(t)?X(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var er={name:`codeIndented`,tokenize:nr},tr={partial:!0,tokenize:rr};function nr(e,t,n){return r;function r(t){return e.enter(`codeIndented`),Cn(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):q(t)?e.attempt(tr,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||q(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function rr(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):q(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):Cn(e,t,a,`linePrefix`,4,4)(o)}function a(e){return q(e)?i(e):n(e)}}var ir={name:`codeText`,previous:or,resolve:ar,tokenize:sr};function ar(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&lr(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),lr(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),lr(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function _r(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||hn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||J(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Y(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function yr(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function br(e,t){let n;return r;function r(i){return q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Y(i)?X(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var xr={name:`definition`,tokenize:Cr},Sr={partial:!0,tokenize:wr};function Cr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return vr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=W(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return J(t)?br(e,l)(t):l(t)}function l(t){return _r(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Sr,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function wr(e,t,n){return r;function r(t){return J(t)?br(e,i)(t):n(t)}function i(t){return yr(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Y(t)?X(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||q(e)?t(e):n(e)}}var Tr={name:`hardBreakEscape`,tokenize:Er};function Er(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Dr={name:`headingAtx`,resolve:Or,tokenize:kr};function Or(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};H(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function kr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||J(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||q(n)?(e.exit(`atxHeading`),t(n)):Y(n)?X(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||J(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Ar=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),jr=[`pre`,`script`,`style`,`textarea`],Mr={concrete:!0,name:`htmlFlow`,resolveTo:Pr,tokenize:Fr},Nr={partial:!0,tokenize:Ir};function Pr(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Fr(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):G(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):G(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return G(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||J(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&jr.includes(l)?(i=1,r.interrupt?t(s):O(s)):Ar.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||K(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Y(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||G(t)?(e.consume(t),b):Y(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Y(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Y(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||J(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Y(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||q(t)?O(t):Y(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),M):q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Nr,ie,k)(t)):t===null||q(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Xn,ee,ie)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||q(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),N):O(t)}function j(t){return t===47?(e.consume(t),o=``,ne):O(t)}function ne(t){if(t===62){let n=o.toLowerCase();return jr.includes(n)?(e.consume(t),re):O(t)}return G(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ne):O(t)}function M(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),N):O(t)}function re(t){return t===null||q(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function Ir(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Bn,t,n)}}var Lr={name:`htmlText`,tokenize:Rr};function Rr(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):G(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):G(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):q(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):q(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):q(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):q(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return G(t)?(e.consume(t),S):n(t)}function S(t){return t===45||K(t)?(e.consume(t),S):C(t)}function C(t){return q(t)?(o=C,j(t)):Y(t)?(e.consume(t),C):A(t)}function w(t){return t===45||K(t)?(e.consume(t),w):t===47||t===62||J(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||G(t)?(e.consume(t),E):q(t)?(o=T,j(t)):Y(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):q(t)?(o=D,j(t)):Y(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):q(t)?(o=O,j(t)):Y(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):q(t)?(o=k,j(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||J(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||J(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return Y(t)?X(e,M,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):M(t)}function M(t){return e.enter(`htmlTextData`),o(t)}}var zr={name:`labelEnd`,resolveAll:Ur,resolveTo:Wr,tokenize:Gr},Br={tokenize:Kr},Vr={tokenize:qr},Hr={tokenize:Jr};function Ur(e){let t=-1,n=[];for(;++t0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(W(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Br,u,o?u:d)(t):t===91?e.attempt(Vr,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Hr,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function Kr(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return J(t)?br(e,a)(t):a(t)}function a(t){return t===41?u(t):_r(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return J(t)?br(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?yr(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return J(t)?br(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function qr(e,t,n){let r=this;return i;function i(t){return vr.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(W(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Jr(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Yr={name:`labelStartImage`,resolveAll:zr.resolveAll,tokenize:Xr};function Xr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var Zr={name:`labelStartLink`,resolveAll:zr.resolveAll,tokenize:Qr};function Qr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var $r={name:`lineEnding`,tokenize:ei};function ei(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}}var ti={name:`thematicBreak`,tokenize:ni};function ni(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Y(t)?X(e,s,`whitespace`)(t):s(t))}}var Z={continuation:{tokenize:oi},exit:ci,name:`list`,tokenize:ai},ri={partial:!0,tokenize:li},ii={partial:!0,tokenize:si};function ai(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:gn(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(ti,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return gn(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Bn,r.interrupt?n:u,e.attempt(ri,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Y(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function oi(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Bn,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Y(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ii,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(Z,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function si(e,t,n){let r=this;return X(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function ci(e){e.exit(this.containerState.type)}function li(e,t,n){let r=this;return X(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Y(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var ui={name:`setextUnderline`,resolveTo:di,tokenize:fi};function di(e,t){let n=new En,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function fi(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Y(t)?X(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var pi={tokenize:mi};function mi(e){let t=this,n=e.attempt(Bn,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(fr,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var hi={resolveAll:yi()},gi=vi(`string`),_i=vi(`text`);function vi(e){return{resolveAll:yi(e===`text`?bi:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++iki,contentInitial:()=>Ci,disable:()=>Ai,document:()=>Si,flow:()=>Ti,flowInitial:()=>wi,insideSpan:()=>Oi,string:()=>Ei,text:()=>Di}),Si={42:Z,43:Z,45:Z,48:Z,49:Z,50:Z,51:Z,52:Z,53:Z,54:Z,55:Z,56:Z,57:Z,62:Hn},Ci={91:xr},wi={[-2]:er,[-1]:er,32:er},Ti={35:Dr,42:ti,45:[ui,ti],60:Mr,61:ui,95:ti,96:Qn,126:Qn},Ei={38:Jn,92:Kn},Di={[-5]:$r,[-4]:$r,[-3]:$r,33:Yr,38:Jn,42:Pn,60:[Rn,Lr],91:Zr,92:[Tr,Kn],93:zr,95:Pn,96:ir},Oi={null:[Pn,hi]},ki={null:[42,95]},Ai={null:[]};function ji(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=U(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Nn(a,l.events,l),l.events):[]}function f(e,t){return Ni(p(e),t)}function p(e){return Mi(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Ni(e,t){let n=-1,r=[],i;for(;++n0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||qi).call(a,void 0,e[0])}for(r.position={start:Wi(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Wi(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++dvoid c({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(n),replace:r,resetScroll:t!==e});return(0,o.jsx)(n,{dashboardId:e,search:s,onSearch:(t,n)=>l(e,t,n),onOpen:(e,t)=>l(e,{},t)})}export{s as component}; \ No newline at end of file +import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{t as n}from"./page-Bq8j74s4.js";import{f as r,g as i,y as a}from"./index-DxHBLqHS.js";var o=e();function s(){let{dashboardId:e}=r.useParams(),s=i(r.useSearch()),c=t(),l=(t,n,r)=>void c({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(n),replace:r,resetScroll:t!==e});return(0,o.jsx)(n,{dashboardId:e,search:s,onSearch:(t,n)=>l(e,t,n),onOpen:(e,t)=>l(e,{},t)})}export{s as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboards.index-D0Pptviw.js b/internal/ui/dist/assets/dashboards.index-hSYxsfH3.js similarity index 68% rename from internal/ui/dist/assets/dashboards.index-D0Pptviw.js rename to internal/ui/dist/assets/dashboards.index-hSYxsfH3.js index 2a958c0fa..4e10e4c83 100644 --- a/internal/ui/dist/assets/dashboards.index-D0Pptviw.js +++ b/internal/ui/dist/assets/dashboards.index-hSYxsfH3.js @@ -1 +1 @@ -import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{t as n}from"./page-CFdV4uPH.js";import{g as r,p as i,y as a}from"./index-CEp3GmPL.js";var o=e();function s(){let e=r(i.useSearch()),s=t();return(0,o.jsx)(n,{search:e,onSearch:()=>void 0,onOpen:(t,n)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(e),replace:n})})}export{s as component}; \ No newline at end of file +import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{t as n}from"./page-Bq8j74s4.js";import{g as r,p as i,y as a}from"./index-DxHBLqHS.js";var o=e();function s(){let e=r(i.useSearch()),s=t();return(0,o.jsx)(n,{search:e,onSearch:()=>void 0,onOpen:(t,n)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(e),replace:n})})}export{s as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/index-CEp3GmPL.js b/internal/ui/dist/assets/index-DxHBLqHS.js similarity index 57% rename from internal/ui/dist/assets/index-CEp3GmPL.js rename to internal/ui/dist/assets/index-DxHBLqHS.js index 22a4b98ac..1c58580c4 100644 --- a/internal/ui/dist/assets/index-CEp3GmPL.js +++ b/internal/ui/dist/assets/index-DxHBLqHS.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-D2AdaqvY.js","assets/useRouter-ByJ6_rwb.js","assets/useNavigate-B1zgPEUp.js","assets/settings-NQwuPzSG.js","assets/brand-DUaZkIz1.js","assets/Tooltip-B3r3s_B9.js","assets/WarningCircle.es-DWFLwubM.js","assets/chat.index-BzKwvTFN.js","assets/chat-BqevyT9H.js","assets/preload-helper-EHBQhIeL.js","assets/dashboard-change-chips-DHVvGnTI.js","assets/chat._threadId-BzKwvTFN.js","assets/dashboards.index-D0Pptviw.js","assets/page-CFdV4uPH.js","assets/dashboards._dashboardId-AkIsvXSZ.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-D2AdaqvY.js","assets/useRouter-ByJ6_rwb.js","assets/useNavigate-B1zgPEUp.js","assets/settings-BSIny0s-.js","assets/brand-DUaZkIz1.js","assets/Tooltip-B3r3s_B9.js","assets/WarningCircle.es-BIbVHGEb.js","assets/chat.index-D3lAczL5.js","assets/chat-DvbFi0gm.js","assets/preload-helper-EHBQhIeL.js","assets/dashboard-change-chips-Cbk2Ba8I.js","assets/chat._threadId-D3lAczL5.js","assets/dashboards.index-hSYxsfH3.js","assets/page-Bq8j74s4.js","assets/dashboards._dashboardId-Br5-Dkdq.js"])))=>i.map(i=>d[i]); import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./useRouter-ByJ6_rwb.js";import{$ as s,A as c,B as l,C as u,F as d,G as f,H as p,I as m,J as h,K as g,L as _,M as v,N as y,P as b,Q as x,R as S,S as C,T as w,U as T,V as ee,W as E,X as D,Y as O,Z as te,_ as ne,_t as re,a as k,at as ie,b as ae,c as oe,ct as se,d as ce,dt as le,f as ue,gt as de,h as fe,ht as pe,i as me,it as he,j as ge,k as _e,l as ve,lt as ye,m as A,mt as j,nt as be,o as xe,ot as Se,p as Ce,pt as we,q as Te,r as Ee,rt as De,st as Oe,t as ke,tt as Ae,u as je,ut as Me,v as Ne,w as Pe,x as Fe,y as Ie,z as Le}from"./brand-DUaZkIz1.js";import{i as Re,n as ze,r as Be,t as Ve}from"./useNavigate-B1zgPEUp.js";import{A as He,C as Ue,D as We,E as Ge,M as Ke,O as qe,T as Je,_ as Ye,a as Xe,b as Ze,c as Qe,f as $e,g as et,i as tt,j as nt,k as rt,n as it,r as at,t as ot,v as st,w as ct,y as lt}from"./preload-helper-EHBQhIeL.js";import{C as ut,E as dt,T as ft,_ as pt,a as mt,c as ht,d as gt,f as _t,g as vt,h as yt,i as bt,l as xt,m as St,n as Ct,o as wt,p as Tt,r as Et,s as Dt,t as Ot,u as kt,v as At,x as jt,y as Mt}from"./Tooltip-B3r3s_B9.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Nt=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&ne(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-Tt&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ne(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,te=O.port2;O.port1.onmessage=E,D=function(){te.postMessage(null)}}else D=function(){_(E,0)};function ne(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ne(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Pt=e(((e,t)=>{t.exports=Nt()})),Ft=e((e=>{var n=Pt(),r=t(),i=re();function a(e){var t=`https://react.dev/errors/`+e;if(1Se||(e.current=xe[Se],xe[Se]=null,Se--)}function Te(e,t){Se++,xe[Se]=e.current,e.current=t}var Ee=Ce(null),De=Ce(null),Oe=Ce(null),ke=Ce(null);function Ae(e,t){switch(Te(Oe,t),Te(De,e),Te(Ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?xp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=xp(t),e=Sp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}we(Ee),Te(Ee,e)}function je(){we(Ee),we(De),we(Oe)}function Me(e){var t=e.memoizedState;t!==null&&(vh._currentValue=t.memoizedState,Te(ke,e)),t=Ee.current;var n=Sp(t,e.type);t!==n&&(Te(De,e),Te(Ee,n))}function Ne(e){De.current===e&&(we(Ee),we(De)),ke.current===e&&(we(ke),vh._currentValue=be)}var Pe,Fe;function Ie(e){if(Pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Pe=t&&t[1]||``,Fe=-1)`:-1i||c[r]!==l[i]){var u=` `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Le=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ie(n):``}function ze(e,t){switch(e.tag){case 26:case 27:case 5:return Ie(e.type);case 16:return Ie(`Lazy`);case 13:return e.child!==t&&t!==null?Ie(`Suspense Fallback`):Ie(`Suspense`);case 19:return Ie(`SuspenseList`);case 0:case 15:return Re(e.type,!1);case 11:return Re(e.type.render,!1);case 1:return Re(e.type,!0);case 31:return Ie(`Activity`);case 30:return Ie(`ViewTransition`);default:return``}}function Be(e){try{var t=``,n=null;do t+=ze(e,n),n=e,e=e.return;while(e);return t}catch(e){return` Error generating stack: `+e.message+` -`+e.stack}}var Ve=Object.prototype.hasOwnProperty,He=n.unstable_scheduleCallback,Ue=n.unstable_cancelCallback,We=n.unstable_shouldYield,Ge=n.unstable_requestPaint,Ke=n.unstable_now,qe=n.unstable_getCurrentPriorityLevel,Je=n.unstable_ImmediatePriority,Ye=n.unstable_UserBlockingPriority,Xe=n.unstable_NormalPriority,Ze=n.unstable_LowPriority,Qe=n.unstable_IdlePriority,$e=n.log,et=n.unstable_setDisableYieldValue,tt=null,nt=null;function rt(e){if(typeof $e==`function`&&et(e),nt&&typeof nt.setStrictMode==`function`)try{nt.setStrictMode(tt,e)}catch{}}var it=Math.clz32?Math.clz32:st,at=Math.log,ot=Math.LN2;function st(e){return e>>>=0,e===0?32:31-(at(e)/ot|0)|0}var ct=256,lt=262144,ut=4194304;function dt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ft(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=dt(n))):i=dt(o):i=dt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=dt(n))):i=dt(o)):i=dt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function pt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function mt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0n;n++)t.push(e);return t}function vt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function yt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0=vr),xr=` `,Sr=!1;function Cr(e,t){switch(e){case`keyup`:return gr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function wr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Tr=!1;function Er(e,t){switch(e){case`compositionend`:return wr(t);case`keypress`:return t.which===32?(Sr=!0,xr):null;case`textInput`:return e=t.data,e===xr&&Sr?null:e;default:return null}}function Dr(e,t){if(Tr)return e===`compositionend`||!_r&&Cr(e,t)?(e=zn(),Rn=Ln=In=null,Tr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Xr(n)}}function Qr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $r(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Yr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yr(e.document)}return t}function ei(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var ti=Nn&&`documentMode`in document&&11>=document.documentMode,ni=null,ri=null,ii=null,ai=!1;function oi(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ai||ni==null||ni!==Yr(r)||(r=ni,`selectionStart`in r&&ei(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ii&&Jr(ii,r)||(ii=r,r=H(ri,`onSelect`),0>=o,i-=o,na=1<<32-it(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),P&&ia(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),P&&ia(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return P&&ia(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),P&&ia(i,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===O&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case E:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===O){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),ho(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===le&&so(l)===r.type){n(e,r.sibling),c=i(r,o.props),ho(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===O?(c=Ui(o.props.children,e.mode,c,o.key),ho(c,o),c.return=e,e=c):(c=Hi(o.type,o.key,o.props,null,e.mode,c),ho(c,o),c.return=e,e=c)}return s(e);case D:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Ki(o,e.mode,c),c.return=e,e=c}return s(e);case le:return o=so(o),_(e,r,o,c)}if(ye(o))return h(e,r,o,c);if(ge(o)){if(l=ge(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,mo(o),c);if(o.$$typeof===ie)return _(e,r,Ma(e,o),c);go(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=Wi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{po=0;var i=_(e,t,n,r);return fo=null,i}catch(t){if(t===to||t===ro)throw t;var a=Ri(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var vo=_o(!0),yo=_o(!1),bo=!1;function xo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function So(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Co(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function wo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,cd&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Fi(e),Pi(e,null,n),t}return ji(e,r,t,n),Fi(e)}function To(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}function Eo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Do=!1;function Oo(){if(Do){var e=Ka;if(e!==null)throw e}}function ko(e,t,n,r){Do=!1;var i=e.updateQueue;bo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(ud&f)===f:(r&f)===f){f!==0&&f===Ga&&(Do=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:bo=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),vd|=o,e.lanes=o,e.memoizedState=d}}function Ao(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function jo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=A.T,s={};s.types=o===null?null:o.types,A.T=s,vc(e,!1,t,n);try{var c=i(),l=A.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?_c(e,t,Ya(c,r),Hd(e)):_c(e,t,r,Hd(e))}catch(n){_c(e,t,{then:function(){},status:`rejected`,reason:n},Hd())}finally{j.p=a,o!==null&&s.types!==null&&(o.types=s.types),A.T=o}}function sc(){}function cc(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=lc(e).queue;oc(e,i,t,be,n===null?sc:function(){return uc(e),n(r)})}function lc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:be,baseState:be,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:be},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function uc(e){var t=lc(e);t.next===null&&(t=e.alternate.memoizedState),_c(e,t.next.queue,{},Hd())}function dc(){return ja(vh)}function fc(){return ms().memoizedState}function pc(){return ms().memoizedState}function mc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Hd();e=Co(n);var r=wo(t,e,n);r!==null&&(Gd(r,t,n),To(r,t,n)),t={cache:Ra()},e.payload=t;return}t=t.return}}function hc(e,t,n){var r=Hd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},yc(e)?bc(t,n):(n=Mi(e,t,n,r),n!==null&&(Gd(n,e,r),xc(n,t,r)))}function gc(e,t,n){_c(e,t,n,Hd())}function _c(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(yc(e))bc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,qr(s,o))return ji(e,t,i,0),ld===null&&Ai(),!1}catch{}if(n=Mi(e,t,i,r),n!==null)return Gd(n,e,r),xc(n,t,r),!0}return!1}function vc(e,t,n,r){if(r={lane:2,revertLane:Gf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},yc(e)){if(t)throw Error(a(479))}else t=Mi(e,n,r,2),t!==null&&Gd(t,e,2)}function yc(e){var t=e.alternate;return e===F||t!==null&&t===F}function bc(e,t){Qo=Zo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}var Sc={readContext:ja,use:_s,useCallback:is,useContext:is,useEffect:is,useImperativeHandle:is,useLayoutEffect:is,useInsertionEffect:is,useMemo:is,useReducer:is,useRef:is,useState:is,useDebugValue:is,useDeferredValue:is,useTransition:is,useSyncExternalStore:is,useId:is,useHostTransitionStatus:is,useFormState:is,useActionState:is,useOptimistic:is,useMemoCache:is,useCacheRefresh:is,useEffectEvent:is},Cc={readContext:ja,use:_s,useCallback:function(e,t){return ps().memoizedState=[e,t===void 0?null:t],e},useContext:ja,useEffect:qs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Gs(4194308,4,$s.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gs(4194308,4,e,t)},useInsertionEffect:function(e,t){Gs(4,2,e,t)},useMemo:function(e,t){var n=ps();t=t===void 0?null:t;var r=e();if($o){rt(!0);try{e()}finally{rt(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ps();if(n!==void 0){var i=n(t);if($o){rt(!0);try{n(t)}finally{rt(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=hc.bind(null,F,e),[r.memoizedState,e]},useRef:function(e){var t=ps();return e={current:e},t.memoizedState=e},useState:function(e){e=ks(e);var t=e.queue,n=gc.bind(null,F,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tc,useDeferredValue:function(e,t){return ic(ps(),e,t)},useTransition:function(){var e=ks(!1);return e=oc.bind(null,F,e.queue,!0,!1),ps().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=F,i=ps();if(P){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),ld===null)throw Error(a(349));ud&127||ws(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,qs(Es.bind(null,r,o,e),[e]),r.flags|=2048,Us(9,{destroy:void 0},Ts.bind(null,r,o,n,t),null),n},useId:function(){var e=ps(),t=ld.identifierPrefix;if(P){var n=ra,r=na;n=(r&~(1<<32-it(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=es++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[Ot]=t,o[kt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(pp(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&yl(t)}}return wl(t),t.subtreeFlags&=-33554433,bl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&yl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=Oe.current,_a(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=la,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||up(e.nodeValue,n)),e||ma(t,!0)}else e=bp(e).createTextNode(r),e[Ot]=t,t.stateNode=e}return wl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=_a(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[Ot]=t}else va(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;wl(t),e=!1}else n=ya(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Uo(t),t):(Uo(t),null);if(t.flags&128)throw Error(a(558))}return wl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=_a(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[Ot]=t}else va(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;wl(t),i=!1}else i=ya(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Uo(t),t):(Uo(t),null)}return Uo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Sl(t,t.updateQueue),wl(t),null);case 4:return je(),e===null&&tp(t.stateNode.containerInfo),t.flags|=67108864,wl(t),null;case 10:return Ta(t.type),wl(t),null;case 19:if(Ko(t),r=t.memoizedState,r===null)return wl(t),null;if(i=!!(t.flags&128),o=r.rendering,o===null){if(i)Cl(r,!1);else{if(_d!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=qo(e),o!==null){for(t.flags|=128,Cl(r,!1),e=o.updateQueue,t.updateQueue=e,Sl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Vi(n,e),n=n.sibling;return Go(t,Wo.current&1|2),P&&ia(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ke()>Dd&&(t.flags|=128,i=!0,Cl(r,!1),t.lanes=4194304)}}else{if(!i){if(e=qo(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Sl(t,e),Cl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!P)return wl(t),null}else 2*Ke()-r.renderingStartTime>Dd&&n!==536870912&&(t.flags|=128,i=!0,Cl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ke(),e.sibling=null,o=Wo.current,o=i?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||P?Go(t,o):(n=o,Te(Lo,t),Te(Wo,n),Ro===null&&(Ro=t)),P&&ia(t,r.treeForkCount),e}return wl(t),null;case 22:case 23:return Uo(t),Io(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(wl(t),t.subtreeFlags&6&&(t.flags|=8192)):wl(t),n=t.updateQueue,n!==null&&Sl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&we(Za),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ta(La),wl(t),null;case 25:return null;case 30:return t.flags|=33554432,wl(t),null}throw Error(a(156,t.tag))}function El(e,t){switch(sa(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ta(La),je(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ne(t),null;case 31:if(t.memoizedState!==null){if(Uo(t),t.alternate===null)throw Error(a(340));va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Uo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ko(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return je(),null;case 10:return Ta(t.type),null;case 22:case 23:return Uo(t),Io(),e!==null&&we(Za),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ta(La),null;case 25:return null;default:return null}}function Dl(e,t){switch(sa(t),t.tag){case 3:Ta(La),je();break;case 26:case 27:case 5:Ne(t);break;case 4:je();break;case 31:t.memoizedState!==null&&Uo(t);break;case 13:Uo(t);break;case 19:Ko(t);break;case 10:Ta(t.type);break;case 22:case 23:Uo(t),Io(),e!==null&&we(Za);break;case 24:Ta(La)}}function Ol(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){wf(t,t.return,e)}}function kl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){wf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){wf(t,t.return,e)}}function Al(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{jo(t,n)}catch(t){wf(e,e.return,t)}}}function jl(e,t,n){n.props=Ac(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){wf(e,t,n)}}function Ml(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=Ci(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Gp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Kp(e);p(e.child,!1,lm,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){wf(e,t,n)}}function Nl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){wf(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){wf(e,t,n)}else n.current=null}}function Pl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n title`))),pp(r,t,n),r[Ot]=e,Vt(r),t=r;break a;case`link`:if(o=nh(`link`,`href`,i).get(t+(n.href||``))){for(s=0;sg&&(o=g,g=h,h=o);var _=Zr(s,h),v=Zr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,A.T=null,n=Fd,Fd=null;var o=jd,s=Nd;if(Ad=0,Md=jd=null,Nd=0,cd&6)throw Error(a(331));var c=cd;if(cd|=4,rd(o.current),Yu(o,o.current,s,n),cd=c,Rf(0,!1),nt&&typeof nt.onPostCommitFiberRoot==`function`)try{nt.onPostCommitFiberRoot(tt,o)}catch{}return!0}finally{j.p=i,A.T=r,bf(e,t)}}function Cf(e,t,n){t=Ji(n,t),t=Ic(e.stateNode,t,2),e=wo(e,t,2),e!==null&&(vt(e,2),Lf(e))}function wf(e,t,n){if(e.tag===3)Cf(e,e,n);else for(;t!==null;){if(t.tag===3){Cf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(kd===null||!kd.has(r))){e=Ji(n,e),n=Lc(2),r=wo(t,n,2),r!==null&&(Rc(n,r,t,e),vt(r,2),Lf(r));break}}t=t.return}}function Tf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new sd;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(hd=!0,i.add(n),e=Ef.bind(null,e,t,n),t.then(e,e))}function Ef(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ld===e&&(ud&n)===n&&(_d===4||_d===3&&(ud&62914560)===ud&&300>Ke()-Td?cd&2?bd|=n:Qd(e,0):bd|=n,Sd===ud&&(Sd=0)),Lf(e)}function Df(e,t){t===0&&(t=gt()),e=Ni(e,t),e!==null&&(vt(e,t),Lf(e))}function Of(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Df(e,n)}function kf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),Df(e,n)}function Af(e,t){return He(e,t)}var jf=null,Mf=null,Nf=!1,Pf=!1,Ff=!1,If=0;function Lf(e){e!==Mf&&e.next===null&&(Mf===null?jf=Mf=e:Mf=Mf.next=e),Pf=!0,Nf||(Nf=!0,Wf())}function Rf(e,t){if(!Ff&&Pf){Ff=!0;do for(var n=!1,r=jf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-it(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Uf(r,a))}else a=ud,a=ft(r,r===ld?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||pt(r,a)||(n=!0,Uf(r,a))}r=r.next}while(n);Ff=!1}}function zf(){Bf()}function Bf(){Pf=Nf=!1;var e=0;If!==0&&Ep()&&(e=If);for(var t=Ke(),n=null,r=jf;r!==null;){var i=r.next,a=Vf(r,t);a===0?(r.next=null,n===null?jf=i:n.next=i,i===null&&(Mf=n)):(n=r,(e!==0||a&3)&&(Pf=!0)),r=i}Ad!==0&&Ad!==5||Rf(e,!1),If!==0&&(If=0)}function Vf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0>>=0,e===0?32:31-(at(e)/ot|0)|0}var ct=256,lt=262144,ut=4194304;function dt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ft(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=dt(n))):i=dt(o):i=dt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=dt(n))):i=dt(o)):i=dt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function pt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function mt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0n;n++)t.push(e);return t}function vt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function yt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0=vr),xr=` `,Sr=!1;function Cr(e,t){switch(e){case`keyup`:return gr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function wr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Tr=!1;function Er(e,t){switch(e){case`compositionend`:return wr(t);case`keypress`:return t.which===32?(Sr=!0,xr):null;case`textInput`:return e=t.data,e===xr&&Sr?null:e;default:return null}}function Dr(e,t){if(Tr)return e===`compositionend`||!_r&&Cr(e,t)?(e=zn(),Rn=Ln=In=null,Tr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Xr(n)}}function Qr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $r(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Yr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yr(e.document)}return t}function ei(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var ti=Nn&&`documentMode`in document&&11>=document.documentMode,ni=null,ri=null,ii=null,ai=!1;function oi(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ai||ni==null||ni!==Yr(r)||(r=ni,`selectionStart`in r&&ei(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ii&&Jr(ii,r)||(ii=r,r=ap(ri,`onSelect`),0>=o,i-=o,na=1<<32-it(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),P&&ia(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),P&&ia(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return P&&ia(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),P&&ia(i,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===O&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case E:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===O){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),ho(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===le&&so(l)===r.type){n(e,r.sibling),c=i(r,o.props),ho(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===O?(c=Ui(o.props.children,e.mode,c,o.key),ho(c,o),c.return=e,e=c):(c=Hi(o.type,o.key,o.props,null,e.mode,c),ho(c,o),c.return=e,e=c)}return s(e);case D:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Ki(o,e.mode,c),c.return=e,e=c}return s(e);case le:return o=so(o),_(e,r,o,c)}if(ye(o))return h(e,r,o,c);if(ge(o)){if(l=ge(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,mo(o),c);if(o.$$typeof===ie)return _(e,r,Ma(e,o),c);go(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=Wi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{po=0;var i=_(e,t,n,r);return fo=null,i}catch(t){if(t===to||t===ro)throw t;var a=Ri(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var vo=_o(!0),yo=_o(!1),bo=!1;function xo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function So(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Co(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function wo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,cd&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Fi(e),Pi(e,null,n),t}return ji(e,r,t,n),Fi(e)}function To(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}function Eo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Do=!1;function Oo(){if(Do){var e=Ka;if(e!==null)throw e}}function ko(e,t,n,r){Do=!1;var i=e.updateQueue;bo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(ud&f)===f:(r&f)===f){f!==0&&f===Ga&&(Do=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:bo=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),vd|=o,e.lanes=o,e.memoizedState=d}}function Ao(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function jo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=A.T,s={};s.types=o===null?null:o.types,A.T=s,vc(e,!1,t,n);try{var c=i(),l=A.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?_c(e,t,Ya(c,r),Hd(e)):_c(e,t,r,Hd(e))}catch(n){_c(e,t,{then:function(){},status:`rejected`,reason:n},Hd())}finally{j.p=a,o!==null&&s.types!==null&&(o.types=s.types),A.T=o}}function sc(){}function cc(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=lc(e).queue;oc(e,i,t,be,n===null?sc:function(){return uc(e),n(r)})}function lc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:be,baseState:be,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:be},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function uc(e){var t=lc(e);t.next===null&&(t=e.alternate.memoizedState),_c(e,t.next.queue,{},Hd())}function dc(){return ja(vh)}function fc(){return ms().memoizedState}function pc(){return ms().memoizedState}function mc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Hd();e=Co(n);var r=wo(t,e,n);r!==null&&(Gd(r,t,n),To(r,t,n)),t={cache:Ra()},e.payload=t;return}t=t.return}}function hc(e,t,n){var r=Hd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},yc(e)?bc(t,n):(n=Mi(e,t,n,r),n!==null&&(Gd(n,e,r),xc(n,t,r)))}function gc(e,t,n){_c(e,t,n,Hd())}function _c(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(yc(e))bc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,qr(s,o))return ji(e,t,i,0),ld===null&&Ai(),!1}catch{}if(n=Mi(e,t,i,r),n!==null)return Gd(n,e,r),xc(n,t,r),!0}return!1}function vc(e,t,n,r){if(r={lane:2,revertLane:Gf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},yc(e)){if(t)throw Error(a(479))}else t=Mi(e,n,r,2),t!==null&&Gd(t,e,2)}function yc(e){var t=e.alternate;return e===F||t!==null&&t===F}function bc(e,t){Qo=Zo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}var Sc={readContext:ja,use:_s,useCallback:is,useContext:is,useEffect:is,useImperativeHandle:is,useLayoutEffect:is,useInsertionEffect:is,useMemo:is,useReducer:is,useRef:is,useState:is,useDebugValue:is,useDeferredValue:is,useTransition:is,useSyncExternalStore:is,useId:is,useHostTransitionStatus:is,useFormState:is,useActionState:is,useOptimistic:is,useMemoCache:is,useCacheRefresh:is,useEffectEvent:is},Cc={readContext:ja,use:_s,useCallback:function(e,t){return ps().memoizedState=[e,t===void 0?null:t],e},useContext:ja,useEffect:qs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Gs(4194308,4,$s.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gs(4194308,4,e,t)},useInsertionEffect:function(e,t){Gs(4,2,e,t)},useMemo:function(e,t){var n=ps();t=t===void 0?null:t;var r=e();if($o){rt(!0);try{e()}finally{rt(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ps();if(n!==void 0){var i=n(t);if($o){rt(!0);try{n(t)}finally{rt(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=hc.bind(null,F,e),[r.memoizedState,e]},useRef:function(e){var t=ps();return e={current:e},t.memoizedState=e},useState:function(e){e=ks(e);var t=e.queue,n=gc.bind(null,F,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tc,useDeferredValue:function(e,t){return ic(ps(),e,t)},useTransition:function(){var e=ks(!1);return e=oc.bind(null,F,e.queue,!0,!1),ps().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=F,i=ps();if(P){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),ld===null)throw Error(a(349));ud&127||ws(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,qs(Es.bind(null,r,o,e),[e]),r.flags|=2048,Us(9,{destroy:void 0},Ts.bind(null,r,o,n,t),null),n},useId:function(){var e=ps(),t=ld.identifierPrefix;if(P){var n=ra,r=na;n=(r&~(1<<32-it(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=es++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[Ot]=t,o[kt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(pp(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&yl(t)}}return wl(t),t.subtreeFlags&=-33554433,bl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&yl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=Oe.current,_a(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=la,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||up(e.nodeValue,n)),e||ma(t,!0)}else e=bp(e).createTextNode(r),e[Ot]=t,t.stateNode=e}return wl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=_a(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[Ot]=t}else va(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;wl(t),e=!1}else n=ya(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Uo(t),t):(Uo(t),null);if(t.flags&128)throw Error(a(558))}return wl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=_a(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[Ot]=t}else va(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;wl(t),i=!1}else i=ya(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Uo(t),t):(Uo(t),null)}return Uo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Sl(t,t.updateQueue),wl(t),null);case 4:return je(),e===null&&tp(t.stateNode.containerInfo),t.flags|=67108864,wl(t),null;case 10:return Ta(t.type),wl(t),null;case 19:if(Ko(t),r=t.memoizedState,r===null)return wl(t),null;if(i=!!(t.flags&128),o=r.rendering,o===null){if(i)Cl(r,!1);else{if(_d!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=qo(e),o!==null){for(t.flags|=128,Cl(r,!1),e=o.updateQueue,t.updateQueue=e,Sl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Vi(n,e),n=n.sibling;return Go(t,Wo.current&1|2),P&&ia(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ke()>Dd&&(t.flags|=128,i=!0,Cl(r,!1),t.lanes=4194304)}}else{if(!i){if(e=qo(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Sl(t,e),Cl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!P)return wl(t),null}else 2*Ke()-r.renderingStartTime>Dd&&n!==536870912&&(t.flags|=128,i=!0,Cl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ke(),e.sibling=null,o=Wo.current,o=i?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||P?Go(t,o):(n=o,Te(Lo,t),Te(Wo,n),Ro===null&&(Ro=t)),P&&ia(t,r.treeForkCount),e}return wl(t),null;case 22:case 23:return Uo(t),Io(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(wl(t),t.subtreeFlags&6&&(t.flags|=8192)):wl(t),n=t.updateQueue,n!==null&&Sl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&we(Za),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ta(La),wl(t),null;case 25:return null;case 30:return t.flags|=33554432,wl(t),null}throw Error(a(156,t.tag))}function El(e,t){switch(sa(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ta(La),je(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ne(t),null;case 31:if(t.memoizedState!==null){if(Uo(t),t.alternate===null)throw Error(a(340));va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Uo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ko(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return je(),null;case 10:return Ta(t.type),null;case 22:case 23:return Uo(t),Io(),e!==null&&we(Za),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ta(La),null;case 25:return null;default:return null}}function Dl(e,t){switch(sa(t),t.tag){case 3:Ta(La),je();break;case 26:case 27:case 5:Ne(t);break;case 4:je();break;case 31:t.memoizedState!==null&&Uo(t);break;case 13:Uo(t);break;case 19:Ko(t);break;case 10:Ta(t.type);break;case 22:case 23:Uo(t),Io(),e!==null&&we(Za);break;case 24:Ta(La)}}function Ol(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){wf(t,t.return,e)}}function kl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){wf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){wf(t,t.return,e)}}function Al(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{jo(t,n)}catch(t){wf(e,e.return,t)}}}function jl(e,t,n){n.props=Ac(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){wf(e,t,n)}}function Ml(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=Ci(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Gp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Kp(e);p(e.child,!1,lm,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){wf(e,t,n)}}function Nl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){wf(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){wf(e,t,n)}else n.current=null}}function Pl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n title`))),pp(r,t,n),r[Ot]=e,Vt(r),t=r;break a;case`link`:if(o=nh(`link`,`href`,i).get(t+(n.href||``))){for(s=0;sg&&(o=g,g=h,h=o);var _=Zr(s,h),v=Zr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,A.T=null,n=Fd,Fd=null;var o=jd,s=Nd;if(Ad=0,Md=jd=null,Nd=0,cd&6)throw Error(a(331));var c=cd;if(cd|=4,rd(o.current),Yu(o,o.current,s,n),cd=c,Rf(0,!1),nt&&typeof nt.onPostCommitFiberRoot==`function`)try{nt.onPostCommitFiberRoot(tt,o)}catch{}return!0}finally{j.p=i,A.T=r,bf(e,t)}}function Cf(e,t,n){t=Ji(n,t),t=Ic(e.stateNode,t,2),e=wo(e,t,2),e!==null&&(vt(e,2),Lf(e))}function wf(e,t,n){if(e.tag===3)Cf(e,e,n);else for(;t!==null;){if(t.tag===3){Cf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(kd===null||!kd.has(r))){e=Ji(n,e),n=Lc(2),r=wo(t,n,2),r!==null&&(Rc(n,r,t,e),vt(r,2),Lf(r));break}}t=t.return}}function Tf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new sd;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(hd=!0,i.add(n),e=Ef.bind(null,e,t,n),t.then(e,e))}function Ef(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ld===e&&(ud&n)===n&&(_d===4||_d===3&&(ud&62914560)===ud&&300>Ke()-Td?cd&2?bd|=n:Qd(e,0):bd|=n,Sd===ud&&(Sd=0)),Lf(e)}function Df(e,t){t===0&&(t=gt()),e=Ni(e,t),e!==null&&(vt(e,t),Lf(e))}function Of(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Df(e,n)}function kf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),Df(e,n)}function Af(e,t){return He(e,t)}var jf=null,Mf=null,Nf=!1,Pf=!1,Ff=!1,If=0;function Lf(e){e!==Mf&&e.next===null&&(Mf===null?jf=Mf=e:Mf=Mf.next=e),Pf=!0,Nf||(Nf=!0,Wf())}function Rf(e,t){if(!Ff&&Pf){Ff=!0;do for(var n=!1,r=jf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-it(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Uf(r,a))}else a=ud,a=ft(r,r===ld?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||pt(r,a)||(n=!0,Uf(r,a))}r=r.next}while(n);Ff=!1}}function zf(){Bf()}function Bf(){Pf=Nf=!1;var e=0;If!==0&&Ep()&&(e=If);for(var t=Ke(),n=null,r=jf;r!==null;){var i=r.next,a=Vf(r,t);a===0?(r.next=null,n===null?jf=i:n.next=i,i===null&&(Mf=n)):(n=r,(e!==0||a&3)&&(Pf=!0)),r=i}Ad!==0&&Ad!==5||Rf(e,!1),If!==0&&(If=0)}function Vf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&gp(d)&&(c=c.responseEnd,o+=u*(cuh){s.length=o;break}f=new Promise(Hp.bind(f)),s.push(f)}}}if(0`u`?null:document;function Im(e,t,n){var r=Fm;if(r&&typeof t==`string`&&t){var i=ln(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Am.has(i)||(Am.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),pp(t,`link`,e),Vt(t),r.head.appendChild(t)))}}function Lm(e){Mm.D(e),Im(`dns-prefetch`,e,null)}function Rm(e,t){Mm.C(e,t),Im(`preconnect`,e,t)}function zm(e,t,n){Mm.L(e,t,n);var r=Fm;if(r&&e&&t){var i=`link[rel="preload"][as="`+ln(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+ln(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+ln(n.imageSizes)+`"]`)):i+=`[href="`+ln(e)+`"]`;var a=i;switch(t){case`style`:a=Gm(e);break;case`script`:a=Ym(e)}if(!(km.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),km.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Km(a))||t===`script`&&r.querySelector(Xm(a))))){var o=r.createElement(`link`);pp(o,`link`,e),t===`style`&&(o[Lt]=!0,o.onload=o.onerror=function(){Ht(o)}),Vt(o),r.head.appendChild(o)}}}function Bm(e,t){Mm.m(e,t);var n=Fm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+ln(r)+`"][href="`+ln(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Ym(e)}if(!km.has(a)&&(e=T({rel:`modulepreload`,href:e},t),km.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Xm(a)))return}r=n.createElement(`link`),pp(r,`link`,e),Vt(r),n.head.appendChild(r)}}}function Vm(e,t,n){Mm.S(e,t,n);var r=Fm;if(r&&e){var i=Bt(r).hoistableStyles,a=Gm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Km(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=km.get(a))&&$m(e,n);var c=o=r.createElement(`link`);Vt(c),pp(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,Qm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Hm(e,t){Mm.X(e,t);var n=Fm;if(n&&e){var r=Bt(n).hoistableScripts,i=Ym(e),a=r.get(i);a||(a=n.querySelector(Xm(i)),a||(e=T({src:e,async:!0},t),(t=km.get(i))&&eh(e,t),a=n.createElement(`script`),Vt(a),pp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Um(e,t){Mm.M(e,t);var n=Fm;if(n&&e){var r=Bt(n).hoistableScripts,i=Ym(e),a=r.get(i);a||(a=n.querySelector(Xm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=km.get(i))&&eh(e,t),a=n.createElement(`script`),Vt(a),pp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Wm(e,t,n,r){var i=(i=Oe.current)?jm(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Gm(n.href),t=Bt(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,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=Gm(n.href);var o=Bt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(Km(e)))?o._p||(s.instance=o,s.state.loading=5):(o=km.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},km.set(e,o)),Jm(i,e,o,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Ym(n),t=Bt(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Gm(e){return`href="`+ln(e)+`"`}function Km(e){return`link[rel="stylesheet"][`+e+`]`}function qm(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Jm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Lt]){r.loading=1;return}}else t=e.createElement(`link`),t[Lt]=!0,t.onload=t.onerror=Ht.bind(null,t),pp(t,`link`,n),Vt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Ym(e){return`[src="`+ln(e)+`"]`}function Xm(e){return`script[async]`+e}function Zm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+ln(n.href)+`"]`);if(r)return t.instance=r,Vt(r),r;var i=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Vt(r),pp(r,`style`,i),Qm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Gm(n.href);var o=e.querySelector(Km(i));if(o)return t.state.loading|=4,t.instance=o,Vt(o),o;r=qm(n),(i=km.get(i))&&$m(r,i),o=(e.ownerDocument||e).createElement(`link`),Vt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),pp(o,`link`,r),t.state.loading|=4,Qm(o,n.precedence,e),t.instance=o;case`script`:return o=Ym(n.src),(i=e.querySelector(Xm(o)))?(t.instance=i,Vt(i),i):(r=n,(i=km.get(o))&&(r=T({},n),eh(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Vt(i),pp(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Qm(r,n.precedence,e));return t.instance}function Qm(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 title`):null)}function ih(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 ah(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function oh(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function sh(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function ch(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=sh(t),e.suspenseyImages.push(t)),e=mh.bind(e),t.decode().then(e,e))}function lh(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=Gm(r.href),a=t.querySelector(Km(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ph.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Vt(a);return}a=t.ownerDocument||t,r=qm(r),(i=km.get(i))&&$m(r,i),a=a.createElement(`link`),Vt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),pp(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=ph.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var uh=0;function dh(e,t){return e.stylesheets&&e.count===0&&gh(e,e.stylesheets),0uh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function fh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)gh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ph(){this.count--,fh(this)}function mh(){this.imgCount--,fh(this)}var hh=null;function gh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,hh=new Map,t.forEach(_h,e),hh=null,ph.call(e))}function _h(e,t){if(!(t.state.loading&4)){var n=hh.get(e);if(n)var r=n.get(null);else{n=new Map,hh.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{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=Ft()})),Lt=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=ct:this.parentRoute||rt();let r=n?ct:t?.path;r&&r!==`/`&&(r=We(r));let i=t?.id||r,a=n?ct:Ge((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:Ge(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=qe(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Ue({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Rt=class extends Lt{constructor(e){super(e)}},M=a(t(),1),N=i(),zt=class extends M.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?M.createElement(this.props.errorComponent??Bt,{error:e[0],reset:this.reset}):this.props.children}};function Bt({error:e}){let[t,n]=M.useState(!1);return(0,N.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,N.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,N.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,N.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,N.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,N.jsx)(`div`,{children:(0,N.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,N.jsx)(`code`,{children:e.message}):null})}):null]})}var Vt=()=>!0,Ht=()=>!1;function Ut({children:e,fallback:t=null}){return(0,N.jsx)(M.Fragment,{children:Wt()?e:t})}function Wt(e=!0){return M.useSyncExternalStore(Gt,Vt,e?Ht:Vt)}function Gt(){return()=>{}}function Kt({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function qt(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Jt=[],Yt=0,{link:Xt,unlink:Zt,propagate:Qt,checkDirty:$t,shallowPropagate:en}=Kt({update(e){return e._update()},notify(e){Jt[nn++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,sn(e))}}),tn=0,nn=0,rn,an=0;function on(e){try{++an,e()}finally{--an||cn()}}function sn(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Zt(n,e)}function cn(){if(!(an>0)){for(;tn{i.get(),n.current?(rn=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=rn,o=t?.compare??Object.is;if(n)rn=i,++Yt,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{rn=a,n&&(i.flags&=-5),sn(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&$t(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&en(e)}}else e&32&&(i.flags=e&-33);return rn!==void 0&&Xt(i,rn,Yt),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Qt(e),en(e),cn())}},i}function un(e){let t=()=>{let t=rn;rn=n,++Yt,n.depsTail=void 0,n.flags=6;try{return e()}finally{rn=t,n.flags&=-5,sn(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&$t(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,sn(this)}};return t(),n}var dn=e((e=>{var n=t();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useState,o=n.useEffect,s=n.useLayoutEffect,c=n.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=n.useSyncExternalStore===void 0?f:n.useSyncExternalStore})),fn=e(((e,t)=>{t.exports=dn()})),pn=e((e=>{var n=t(),r=fn();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=n.useRef,c=n.useEffect,l=n.useMemo,u=n.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),mn=e(((e,t)=>{t.exports=pn()}))();function hn(e,t){return e===t}function gn(e,t=e=>e,n){let r=n?.compare??hn,i=(0,M.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,M.useCallback)(()=>e.get(),[e]);return(0,mn.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var _n={};function vn(e,t){let n=M.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=Ke(n.current,i):i}}function yn(e){let t=o(),n=M.useContext(e.from?Ye:st),r=e.from??n,i=t.stores.getMatchStore(r),a=vn(e,t),s=gn(i,e=>e?a(e):_n);if(s!==_n)return s;(e.shouldThrow??!0)&&rt()}function bn(e){return yn({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function xn(e){let{select:t,...n}=e;return yn({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Sn(e){return yn({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Cn(e){return yn({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function wn(e){return yn({...e,select:t=>e.select?e.select(t.context):t.context})}var Tn=class extends Lt{constructor(e){super(e),this.useMatch=e=>yn({...e,from:this.id}),this.useRouteContext=e=>wn({...e,from:this.id}),this.useSearch=e=>Cn({...e,from:this.id}),this.useParams=e=>Sn({...e,from:this.id}),this.useLoaderDeps=e=>xn({...e,from:this.id}),this.useLoaderData=e=>bn({...e,from:this.id}),this.useNavigate=()=>ze({from:this.fullPath}),this.Link=M.forwardRef((e,t)=>(0,N.jsx)(et,{ref:t,from:this.fullPath,...e}))}};function En(e){return new Tn(e)}var Dn=class extends Rt{constructor(e){super(e),this.useMatch=e=>yn({...e,from:this.id}),this.useRouteContext=e=>wn({...e,from:this.id}),this.useSearch=e=>Cn({...e,from:this.id}),this.useParams=e=>Sn({...e,from:this.id}),this.useLoaderDeps=e=>xn({...e,from:this.id}),this.useLoaderData=e=>bn({...e,from:this.id}),this.useNavigate=()=>ze({from:this.fullPath}),this.Link=M.forwardRef((e,t)=>(0,N.jsx)(et,{ref:t,from:this.fullPath,...e}))}};function On(e){return new Dn(e)}function kn(e){return e=>{let t=En(e);return t.isRoot=!1,t}}function An(e,t){let n,r,i,a=()=>(n||=(i=void 0,e().then(e=>{n=void 0,o.preload=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,i=e})),n),o=function(e){if(i){if(nt(i)&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;if(!sessionStorage.getItem(e))throw sessionStorage.setItem(e,`1`),window.location.reload(),new Promise(()=>{})}throw i}if(!r){if(Be)Be(a());else throw a()}return M.createElement(r,e)};return o.preload=a,o}function jn(e){let t=o(),n=`not-found-${gn(t.stores.location,e=>e.pathname)}-${gn(t.stores.status)}`;return(0,N.jsx)(zt,{getResetKey:()=>n,onCatch:(t,n)=>{if(Je(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Je(t))return e.fallback?.(t);throw t},children:e.children})}function Mn(){return(0,N.jsx)(`p`,{children:`Not Found`})}function Nn(e,t,n){return t.options.notFoundComponent?(0,N.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,N.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,N.jsx)(Mn,{})}function Pn(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,N.jsx)(n,{}):null}var Fn=(e,t)=>e[0]===t[0]&&e[1]===t[1],In=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Ln=M.memo(function({routeId:e}){let t=o();return Rn(t,gn(t.stores.getMatchStore(e)))});function Rn(e,t){let n=e.routesById[t.routeId],r=Pn(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=In(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)),l=(0,N.jsx)(zn,{match:t});s&&(l=(0,N.jsx)(Ut,{fallback:r,children:l})),o&&(l=(0,N.jsx)(jn,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return M.createElement(o,e)},children:l})),i&&(l=(0,N.jsx)(zt,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Je(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:l})),c&&(l=(0,N.jsx)(M.Suspense,{fallback:r,children:l}));let u=n.isRoot&&n.options.shellComponent;return u?(0,N.jsx)(st.Provider,{value:t.routeId,children:(0,N.jsxs)(u,{children:[l,null]})}):(0,N.jsxs)(st.Provider,{value:t.routeId,children:[l,null]})}var zn=M.memo(function({match:e}){let t=o(),n=e.routeId,r=t.routesById[n],i=M.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=M.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,N.jsx)(e,{},i):(0,N.jsx)(Bn,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!In(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Pn(t,r)}if(e.status===`notFound`)return Nn(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Bn=M.memo(function(){let e=o(),t=M.useContext(st),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=gn(a,e=>[!!e._notFound,e.error],{compare:Fn}),i=gn(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return Nn(e,e.routesById[t],r);if(!i)return null;let a=(0,N.jsx)(Ln,{routeId:i});return t===`__root__`?(0,N.jsx)(M.Suspense,{fallback:Pn(e),children:a}):a});function Vn(e,t){let n=e[1];e.length=0,n?.(t)}function Hn({t:e}){let t=o(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Vn(n,!1),n.push(i,a),e(t),M.startTransition(r)}),Re(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(qe(r.publicHref)!==qe(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...Ze(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function Un(){let e=o(),t=e.routesById[ct],n=Pn(e,t),r=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Hn,{t:M.useState()[1]}),e.ssr?(0,N.jsx)(Wn,{}):(0,N.jsx)(M.Suspense,{fallback:n,children:(0,N.jsx)(Wn,{})})]});return e.options.InnerWrap?(0,N.jsx)(e.options.InnerWrap,{children:r}):r}function Wn(){let e=o(),t=e._rendered,n=gn(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;Re(()=>{t[0]===n&&Vn(t,!0)},[t,n]);let a=i?(0,N.jsx)(Ln,{routeId:i}):null;return e.options.disableGlobalCatchBoundary?a:(0,N.jsx)(zt,{getResetKey:()=>r,onCatch:void 0,children:a})}var Gn=e=>({createMutableStore:ln,createReadonlyStore:ln,batch:on}),Kn=e=>new qn(e),qn=class extends lt{constructor(e){super(e,Gn)}};function Jn({router:e,children:t,...r}){He(r)&&e.update({...e.options,...r,context:{...e.options.context,...r.context}});let i=(0,N.jsx)(n.Provider,{value:e,children:t});return e.options.Wrap?(0,N.jsx)(e.options.Wrap,{children:i}):i}function Yn({router:e,...t}){return(0,N.jsx)(Jn,{router:e,...t,children:(0,N.jsx)(Un,{})})}function Xn(e){let t=o({warn:e?.router===void 0}),n=e?.router||t;return gn(n.stores.__store,vn(e,n))}function Zn(e){return typeof e!=`string`||!e.includes(`var(--mantine-scale)`)?e:e.match(/^calc\((.*?)\)$/)?.[1].split(`*`)[0].trim()}function Qn(e){let t=Zn(e);return typeof t==`number`?t:typeof t==`string`?t.includes(`calc`)||t.includes(`var`)?t:t.includes(`px`)?Number(t.replace(`px`,``)):t.includes(`rem`)?Number(t.replace(`rem`,``))*16:t.includes(`em`)?Number(t.replace(`em`,``))*16:Number(t):NaN}function $n(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function er(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].disabled)return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].disabled)return e}return e}function tr(e,t,n){for(let n=e+1;n{n?.(s);let c=Array.from($n(s.currentTarget,e)?.querySelectorAll(t)||[]).filter(t=>nr(s.currentTarget,t,e)),l=c.findIndex(e=>s.currentTarget===e),u=tr(l,c,r),d=er(l,c,r),f=a===`rtl`?d:u,p=a===`rtl`?u:d;switch(s.key){case`ArrowRight`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[f].focus(),i&&c[f].click());break;case`ArrowLeft`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[p].focus(),i&&c[p].click());break;case`ArrowUp`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[d].focus(),i&&c[d].click());break;case`ArrowDown`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[u].focus(),i&&c[u].click());break;case`Home`:s.stopPropagation(),s.preventDefault(),c[tr(-1,c,!1)]?.focus();break;case`End`:s.stopPropagation(),s.preventDefault(),c[er(c.length,c,!1)]?.focus()}}}var ir=()=>{};function ar(e,t={active:!0}){return typeof e!=`function`||!t.active?t.onKeyDown||ir:n=>{n.key===`Escape`&&(e(n),t.onTrigger?.())}}function or(e,t){return n=>{e?.(n),t?.(n)}}function sr(e,t){return e in t?Qn(t[e]):Qn(e)}function cr(e,t){let n=e.map(e=>({value:e,px:sr(e,t)}));return n.sort((e,t)=>e.px-t.px),n}function lr(e,t,n){return n?Array.from($n(n,t)?.querySelectorAll(e)||[]).findIndex(e=>e===n):null}var ur=[`mousedown`,`touchstart`];function dr(e,t,n,r=!0,i=!1){let a=(0,M.useRef)(null),o=t||ur,s=(0,M.useEffectEvent)(t=>{let{target:r}=t??{};if(!document.body.contains(r)&&r?.tagName!==`HTML`)return;let i=t.composedPath();Array.isArray(n)?n.every(e=>!!e&&!i.includes(e))&&e(t):a.current&&!i.includes(a.current)&&e(t)}),c=o.join(`,`);return(0,M.useEffect)(()=>{if(!r)return;let e=c.split(`,`);return e.forEach(e=>document.addEventListener(e,s,i)),()=>{e.forEach(e=>document.removeEventListener(e,s,i))}},[c,r,i]),a}function fr(e,t){return ie(`(prefers-color-scheme: dark)`,e===`dark`,t)?`dark`:`light`}function pr(e,t,n={leading:!1}){let[r,i]=(0,M.useState)(e),a=(0,M.useRef)(!1),o=(0,M.useRef)(null),s=(0,M.useRef)(!1),c=(0,M.useRef)(e);c.current=e;let l=(0,M.useCallback)(()=>{window.clearTimeout(o.current),o.current=null},[]),u=(0,M.useCallback)(()=>{l(),s.current=!1},[]),d=(0,M.useCallback)(()=>{o.current&&(u(),s.current=!1,i(c.current))},[]);return(0,M.useEffect)(()=>{a.current&&(l(),!s.current&&n.leading?(s.current=!0,i(e),o.current=window.setTimeout(()=>{s.current=!1},t)):o.current=window.setTimeout(()=>{s.current=!1,i(e)},t))},[e,n.leading,t]),(0,M.useEffect)(()=>(a.current=!0,u),[]),[r,u,{cancel:u,flush:d}]}function mr({opened:e,shouldReturnFocus:t=!0}){let n=(0,M.useRef)(null),r=()=>{n.current&&`focus`in n.current&&typeof n.current.focus==`function`&&n.current?.focus({preventScroll:!0})};return De(()=>{let i=-1,a=e=>{e.key===`Tab`&&window.clearTimeout(i)};if(document.addEventListener(`keydown`,a),e)n.current=document.activeElement;else if(t){let e=document.activeElement;i=window.setTimeout(()=>{let t=document.activeElement;(t===null||t===document.body||t===e)&&r()},10)}return()=>{window.clearTimeout(i),document.removeEventListener(`keydown`,a)}},[e,t]),r}var hr=/input|select|textarea|button|object/,gr=`a, input, select, textarea, button, object, [tabindex]`;function _r(e){return e.style.display===`none`}function vr(e){if(e.getAttribute(`aria-hidden`)||e.getAttribute(`hidden`)||e.getAttribute(`type`)===`hidden`)return!1;let t=e;for(;t&&t!==document.body&&t.nodeType!==11;){if(_r(t))return!1;t=t.parentNode}return!0}function yr(e){let t=e.getAttribute(`tabindex`);return t===null&&(t=void 0),parseInt(t,10)}function br(e){let t=e.nodeName.toLowerCase(),n=!Number.isNaN(yr(e));return(hr.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&vr(e)}function xr(e){let t=yr(e);return(Number.isNaN(t)||t>=0)&&br(e)}function Sr(e){return Array.from(e.querySelectorAll(gr)).filter(xr)}function Cr(e,t){let n=Sr(e);if(!n.length){t.preventDefault();return}let r=n[t.shiftKey?0:n.length-1],i=e.getRootNode(),a=r===i.activeElement||e===i.activeElement,o=i.activeElement;if(o.tagName===`INPUT`&&o.getAttribute(`type`)===`radio`&&(a=n.filter(e=>e.getAttribute(`type`)===`radio`&&e.getAttribute(`name`)===o.getAttribute(`name`)).includes(r)),!a)return;t.preventDefault();let s=n[t.shiftKey?n.length-1:0];s&&s.focus()}function wr(e=!0){let t=(0,M.useRef)(null),n=e=>{let t=e.querySelector(`[data-autofocus]`);if(!t){let n=Array.from(e.querySelectorAll(gr));t=n.find(xr)||n.find(br)||null,!t&&br(e)&&(t=e)}t?t.focus({preventScroll:!0}):console.warn(`[@mantine/hooks/use-focus-trap] Failed to find focusable element within provided node`,e)},r=(0,M.useCallback)(r=>{if(e){if(r===null){t.current=null;return}t.current!==r&&(setTimeout(()=>{r.getRootNode()?n(r):console.warn(`[@mantine/hooks/use-focus-trap] Ref node is not part of the dom`,r)}),t.current=r)}},[e]);return(0,M.useEffect)(()=>{if(!e)return;t.current&&setTimeout(()=>{t.current&&n(t.current)});let r=e=>{e.key===`Tab`&&t.current&&Cr(t.current,e)};return document.addEventListener(`keydown`,r),()=>document.removeEventListener(`keydown`,r)},[e]),r}function Tr(e,t,n){let r=(0,M.useEffectEvent)(t);(0,M.useEffect)(()=>(window.addEventListener(e,r,n),()=>window.removeEventListener(e,r,n)),[e])}function Er({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){let[i,a]=(0,M.useState)(t===void 0?n:t);return e===void 0?[i,(e,...t)=>{a(e),r?.(e,...t)},!1]:[e,r,!0]}function Dr(e=!1,t={}){let[n,r]=(0,M.useState)(e),i=(0,M.useCallback)(()=>{r(e=>e||(t.onOpen?.(),!0))},[t.onOpen]),a=(0,M.useCallback)(()=>{r(e=>e&&(t.onClose?.(),!1))},[t.onClose]);return[n,{open:i,close:a,toggle:(0,M.useCallback)(()=>{n?a():i()},[a,i,n]),set:r}]}var Or=[`mouse`,`touch`],kr=10;function Ar(e,t={}){let{threshold:n=400,events:r=Or,cancelOnMove:i=!1,onStart:a,onFinish:o,onCancel:s}=t,c=(0,M.useRef)(!1),l=(0,M.useRef)(!1),u=(0,M.useRef)(-1),d=(0,M.useRef)(null);(0,M.useEffect)(()=>()=>window.clearTimeout(u.current),[]);let f=r.join(`,`);return(0,M.useMemo)(()=>{if(typeof e!=`function`)return{};let t=i!==!1,f=i===!0?kr:i===!1?0:i,p=t=>{(Nr(t)||Mr(t))&&(a&&a(t),d.current=jr(t),l.current=!0,u.current=window.setTimeout(()=>{e(t),c.current=!0},n))},m=e=>{(Nr(e)||Mr(e))&&(c.current?o&&o(e):l.current&&s&&s(e),c.current=!1,l.current=!1,d.current=null,u.current!==-1&&(window.clearTimeout(u.current),u.current=-1))},h=e=>{if(!t||!l.current||c.current)return;let n=jr(e);if(!n||!d.current)return;let r=n.x-d.current.x,i=n.y-d.current.y;Math.sqrt(r*r+i*i)>f&&m(e)},g={};return r.includes(`mouse`)&&(g.onMouseDown=p,g.onMouseUp=m,g.onMouseLeave=m,t&&(g.onMouseMove=h)),r.includes(`touch`)&&(g.onTouchStart=p,g.onTouchEnd=m,g.onTouchCancel=m,t&&(g.onTouchMove=h)),g},[e,n,s,o,a,i,f])}function jr(e){if(Mr(e)){let t=e.touches[0]??e.changedTouches[0];return t?{x:t.clientX,y:t.clientY}:null}return{x:e.clientX,y:e.clientY}}function Mr(e){return window.TouchEvent?e.nativeEvent instanceof TouchEvent:`touches`in e.nativeEvent}function Nr(e){return e.nativeEvent instanceof MouseEvent}function Pr(e){return e===`auto`||e===`dark`||e===`light`}function Fr({key:e=`mantine-color-scheme-value`}={}){let t;return{get:t=>{if(typeof window>`u`)return t;try{let n=window.localStorage.getItem(e);return Pr(n)?n:t}catch{return t}},set:t=>{try{window.localStorage.setItem(e,t)}catch(e){console.warn(`[@mantine/core] Local storage color scheme manager was unable to save color scheme.`,e)}},subscribe:n=>{t=t=>{t.storageArea===window.localStorage&&t.key===e&&Pr(t.newValue)&&n(t.newValue)},window.addEventListener(`storage`,t)},unsubscribe:()=>{window.removeEventListener(`storage`,t)},clear:()=>{window.localStorage.removeItem(e)}}}function Ir({color:e,theme:t,autoContrast:n,colorScheme:r}){return(typeof n==`boolean`?n:t.autoContrast)&&Te({color:e||t.primaryColor,theme:t,colorScheme:r}).isLight?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function Lr(e,t,n){return Ir({color:n===`dark`?e.dark:e.light,theme:t,colorScheme:n,autoContrast:!0})}function Rr(e,t){let n=e.colors[e.primaryColor];return f(n)?e.autoContrast?Lr(n,e,t):`var(--mantine-color-white)`:Ir({color:n[h(e,t)],theme:e,autoContrast:null})}function zr(e){let t=document.createElement(`style`);return t.setAttribute(`data-mantine-styles`,`inline`),t.innerHTML=`*, *::before, *::after {transition: none !important;}`,t.setAttribute(`data-mantine-disable-transition`,`true`),e&&t.setAttribute(`nonce`,e),document.head.appendChild(t),()=>document.querySelectorAll(`[data-mantine-disable-transition]`).forEach(e=>e.remove())}function Br({keepTransitions:e}={}){let t=(0,M.useRef)(ir),n=(0,M.useRef)(-1),r=(0,M.use)(m),i=l(),a=(0,M.useRef)(i?.());if(!r)throw Error(`[@mantine/core] MantineProvider was not found in tree`);let o=i=>{r.setColorScheme(i),t.current=e?()=>{}:zr(a.current),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t.current?.()},10)},s=()=>{r.clearColorScheme(),t.current=e?()=>{}:zr(a.current),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t.current?.()},10)},c=fr(`light`,{getInitialValueInEffect:!1}),u=r.colorScheme===`auto`?c:r.colorScheme,d=(0,M.useCallback)(()=>o(u===`light`?`dark`:`light`),[o,u]);return(0,M.useEffect)(()=>()=>{t.current?.(),window.clearTimeout(n.current)},[]),{colorScheme:r.colorScheme,setColorScheme:o,clearColorScheme:s,toggleColorScheme:d}}function Vr(e,t){let n=typeof window<`u`&&`matchMedia`in window&&window.matchMedia(`(prefers-color-scheme: dark)`)?.matches,r=e===`auto`?n?`dark`:`light`:e;t()?.setAttribute(`data-mantine-color-scheme`,r)}function Hr({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:r}){let i=(0,M.useRef)(null),[a,o]=(0,M.useState)(()=>e.get(t)),s=r||a,c=(0,M.useCallback)(t=>{r||(Vr(t,n),o(t),e.set(t))},[e.set,s,r]),l=(0,M.useCallback)(()=>{o(t),Vr(t,n),e.clear()},[e.clear,t]);return(0,M.useEffect)(()=>(e.subscribe(c),e.unsubscribe),[e.subscribe,e.unsubscribe]),he(()=>{Vr(e.get(t),n)},[]),(0,M.useEffect)(()=>{if(r)return Vr(r,n),()=>{};r===void 0&&Vr(a,n),typeof window<`u`&&`matchMedia`in window&&(i.current=window.matchMedia(`(prefers-color-scheme: dark)`));let e=e=>{a===`auto`&&Vr(e.matches?`dark`:`light`,n)};return i.current?.addEventListener(`change`,e),()=>i.current?.removeEventListener(`change`,e)},[a,r]),{colorScheme:s,setColorScheme:c,clearColorScheme:l}}function Ur(e,t={getInitialValueInEffect:!0}){let n=fr(e,t),{colorScheme:r}=Br();return r===`auto`?n:r}function Wr(e){return Object.entries(e).map(([e,t])=>`${e}: ${t};`).join(``)}function Gr(e,t){let n=t?[t]:[`:root`,`:host`],r=Wr(e.variables),i=r?`${n.join(`, `)}{${r}}`:``,a=Wr(e.dark),o=Wr(e.light),s=e=>n.map(t=>t===`:host`?`${t}([data-mantine-color-scheme="${e}"])`:`${t}[data-mantine-color-scheme="${e}"]`).join(`, `);return`${i}\n\n${a?`${s(`dark`)}{${a}}`:``}\n\n${o?`${s(`light`)}{${o}}`:``}`}function Kr({theme:e,color:t,colorScheme:n,name:r=t,withColorValues:i=!0}){if(!e.colors[t])return{};if(n===`light`){let n=h(e,`light`),a={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-filled)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${n})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${n===9?8:n+1})`,[`--mantine-color-${r}-light`]:`var(--mantine-color-${r}-1)`,[`--mantine-color-${r}-light-hover`]:`var(--mantine-color-${r}-2)`,[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-9)`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${n})`,[`--mantine-color-${r}-outline-hover`]:p(e.colors[t][n],.05)};return i?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...a}:a}let a=h(e,`dark`),o={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-4)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${a})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${a===9?8:a+1})`,[`--mantine-color-${r}-light`]:E(e.colors[t][9],.5),[`--mantine-color-${r}-light-hover`]:E(e.colors[t][9],.3),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-0)`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${Math.max(a-4,0)})`,[`--mantine-color-${r}-outline-hover`]:p(e.colors[t][Math.max(a-4,0)],.05)};return i?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...o}:o}function qr(e,t,n){de(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}var Jr=e=>{let t=h(e,`light`),n=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:j(e.defaultRadius),r={variables:{"--mantine-z-index-app":`100`,"--mantine-z-index-modal":`200`,"--mantine-z-index-popover":`300`,"--mantine-z-index-overlay":`400`,"--mantine-z-index-max":`9999`,"--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-webkit-font-smoothing":e.fontSmoothing?`antialiased`:`unset`,"--mantine-moz-font-smoothing":e.fontSmoothing?`grayscale`:`unset`,"--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-line-height":e.lineHeights.md,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":e.headings.fontWeight,"--mantine-heading-text-wrap":e.headings.textWrap,"--mantine-radius-default":n,"--mantine-primary-color-filled":`var(--mantine-color-${e.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${e.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${e.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${e.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${e.primaryColor}-light-color)`},light:{"--mantine-color-scheme":`light`,"--mantine-primary-color-contrast":Rr(e,`light`),"--mantine-color-bright":`var(--mantine-color-black)`,"--mantine-color-text":e.black,"--mantine-color-body":e.white,"--mantine-color-error":`var(--mantine-color-red-6)`,"--mantine-color-success":`var(--mantine-color-teal-8)`,"--mantine-color-placeholder":`var(--mantine-color-gray-5)`,"--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-${t})`,"--mantine-color-default":`var(--mantine-color-white)`,"--mantine-color-default-hover":`var(--mantine-color-gray-0)`,"--mantine-color-default-color":`var(--mantine-color-black)`,"--mantine-color-default-border":`var(--mantine-color-gray-4)`,"--mantine-color-dimmed":`var(--mantine-color-gray-6)`,"--mantine-color-disabled":`var(--mantine-color-gray-2)`,"--mantine-color-disabled-color":`var(--mantine-color-gray-5)`,"--mantine-color-disabled-border":`var(--mantine-color-gray-3)`},dark:{"--mantine-color-scheme":`dark`,"--mantine-primary-color-contrast":Rr(e,`dark`),"--mantine-color-bright":`var(--mantine-color-white)`,"--mantine-color-text":`var(--mantine-color-dark-0)`,"--mantine-color-body":`var(--mantine-color-dark-7)`,"--mantine-color-error":`var(--mantine-color-red-8)`,"--mantine-color-success":`var(--mantine-color-teal-8)`,"--mantine-color-placeholder":`var(--mantine-color-dark-3)`,"--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-4)`,"--mantine-color-default":`var(--mantine-color-dark-6)`,"--mantine-color-default-hover":`var(--mantine-color-dark-5)`,"--mantine-color-default-color":`var(--mantine-color-white)`,"--mantine-color-default-border":`var(--mantine-color-dark-4)`,"--mantine-color-dimmed":`var(--mantine-color-dark-2)`,"--mantine-color-disabled":`var(--mantine-color-dark-6)`,"--mantine-color-disabled-color":`var(--mantine-color-dark-3)`,"--mantine-color-disabled-border":`var(--mantine-color-dark-4)`}};qr(r.variables,e.breakpoints,`breakpoint`),qr(r.variables,e.spacing,`spacing`),qr(r.variables,e.fontSizes,`font-size`),qr(r.variables,e.lineHeights,`line-height`),qr(r.variables,e.shadows,`shadow`),qr(r.variables,e.radius,`radius`),qr(r.variables,e.fontWeights,`font-weight`),e.colors[e.primaryColor].forEach((t,n)=>{r.variables[`--mantine-primary-color-${n}`]=`var(--mantine-color-${e.primaryColor}-${n})`}),de(e.colors).forEach(t=>{let n=e.colors[t];if(f(n)){Object.assign(r.light,Kr({theme:e,name:n.name,color:n.light,colorScheme:`light`,withColorValues:!0})),Object.assign(r.dark,Kr({theme:e,name:n.name,color:n.dark,colorScheme:`dark`,withColorValues:!0})),r.light[`--mantine-color-${n.name}-contrast`]=Lr(n,e,`light`),r.dark[`--mantine-color-${n.name}-contrast`]=Lr(n,e,`dark`);return}n.forEach((e,n)=>{r.variables[`--mantine-color-${t}-${n}`]=e}),Object.assign(r.light,Kr({theme:e,color:t,colorScheme:`light`,withColorValues:!1})),Object.assign(r.dark,Kr({theme:e,color:t,colorScheme:`dark`,withColorValues:!1}))});let i=e.headings.sizes;return de(i).forEach(t=>{r.variables[`--mantine-${t}-font-size`]=i[t].fontSize,r.variables[`--mantine-${t}-line-height`]=i[t].lineHeight,r.variables[`--mantine-${t}-font-weight`]=i[t].fontWeight||e.headings.fontWeight}),r};function Yr(){let e=b(),t=l(),n=de(e.breakpoints).reduce((t,n)=>{let r=e.breakpoints[n].includes(`px`),i=Qn(e.breakpoints[n]);return`${t}@media (max-width: ${r?`${i-.1}px`:we(i-.1)}) {.mantine-visible-from-${n} {display: none !important;}}@media (min-width: ${r?`${i}px`:we(i)}) {.mantine-hidden-from-${n} {display: none !important;}}`},``);return(0,N.jsx)(`style`,{"data-mantine-styles":`classes`,nonce:t?.(),dangerouslySetInnerHTML:{__html:n}})}function Xr({theme:e,generator:t}){let n=Jr(e),r=t?.(e);return r?pe(n,r):n}var Zr=Jr(d);function Qr(e){let t={variables:{},light:{},dark:{}};return de(e.variables).forEach(n=>{Zr.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),de(e.light).forEach(n=>{Zr.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),de(e.dark).forEach(n=>{Zr.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function $r(e){return Gr({variables:{},dark:{"--mantine-color-scheme":`dark`},light:{"--mantine-color-scheme":`light`}},e)}function ei({cssVariablesSelector:e,deduplicateCssVariables:t}){let n=b(),r=l(),i=Xr({theme:n,generator:S()}),a=(e===void 0||e===`:root`||e===`:host`)&&t,o=Gr(a?Qr(i):i,e);return o?(0,N.jsx)(`style`,{"data-mantine-styles":!0,nonce:r?.(),dangerouslySetInnerHTML:{__html:`${o}${a?``:$r(e)}`}}):null}ei.displayName=`@mantine/CssVariables`;function ti({respectReducedMotion:e,getRootElement:t}){he(()=>{e&&t()?.setAttribute(`data-respect-reduced-motion`,`true`)},[e])}function ni({theme:e,children:t,getStyleNonce:n,withStaticClasses:r=!0,withGlobalClasses:i=!0,deduplicateCssVariables:a=!0,withCssVariables:o=!0,cssVariablesSelector:s,classNamesPrefix:c=`mantine`,colorSchemeManager:l=Fr(),defaultColorScheme:u=`light`,getRootElement:d=()=>document.documentElement,cssVariablesResolver:f,forceColorScheme:p,stylesTransform:h,env:g,deduplicateInlineStyles:_=!1}){let{colorScheme:v,setColorScheme:b,clearColorScheme:x}=Hr({defaultColorScheme:u,forceColorScheme:p,manager:l,getRootElement:d});return ti({respectReducedMotion:e?.respectReducedMotion||!1,getRootElement:d}),(0,N.jsx)(m,{value:{colorScheme:v,setColorScheme:b,clearColorScheme:x,getRootElement:d,classNamesPrefix:c,getStyleNonce:n,cssVariablesResolver:f,cssVariablesSelector:s??`:root`,withStaticClasses:r,stylesTransform:h,env:g,deduplicateInlineStyles:_},children:(0,N.jsxs)(y,{theme:e,children:[o&&(0,N.jsx)(ei,{cssVariablesSelector:s,deduplicateCssVariables:a}),i&&(0,N.jsx)(Yr,{}),t]})})}ni.displayName=`@mantine/core/MantineProvider`;function ri(e){return e}var ii={root:`m_515a97f8`},ai=w(e=>{let t=v(`VisuallyHidden`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,attributes:l,...d}=t,f=c({name:`VisuallyHidden`,classes:ii,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:l});return(0,N.jsx)(u,{component:`span`,...f(`root`),...d})});ai.classes=ii,ai.displayName=`@mantine/core/VisuallyHidden`;function oi({open:e,close:t,openDelay:n,closeDelay:r}){let i=(0,M.useRef)(-1),a=(0,M.useRef)(-1),o=()=>{window.clearTimeout(i.current),window.clearTimeout(a.current)};return(0,M.useEffect)(()=>o,[]),{openDropdown:()=>{o(),n===0||n===void 0?e():i.current=window.setTimeout(e,n)},closeDropdown:()=>{o(),r===0||r===void 0?t():a.current=window.setTimeout(t,r)}}}var si={root:`m_9814e45f`},ci={zIndex:ft(`modal`)},li=D((e,{gradient:t,color:n,backgroundOpacity:r,blur:i,radius:a,zIndex:o})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&T(n||`#000`,r??.6)||void 0,"--overlay-filter":i?`blur(${j(i)})`:void 0,"--overlay-radius":a===void 0?void 0:Oe(a),"--overlay-z-index":o?.toString()}})),ui=Pe(e=>{let t=v(`Overlay`,ci,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,fixed:l,center:d,children:f,radius:p,zIndex:m,gradient:h,blur:g,color:_,backgroundOpacity:y,mod:b,attributes:x,...S}=t,C=c({name:`Overlay`,props:t,classes:si,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:x,vars:s,varsResolver:li});return(0,N.jsx)(u,{...C(`root`),mod:[{center:d,fixed:l},b],...S,children:f})});ui.classes=si,ui.varsResolver=li,ui.displayName=`@mantine/core/Overlay`;var[di,fi]=dt(`Popover component was not found in the tree`);function pi({childProps:e,disabled:t,opened:n,longPressDelay:r=500,setReference:i,open:a}){let o=(0,M.useRef)(!1),s=(0,M.useRef)(!1),c=(0,M.useRef)(null),l=(0,M.useRef)(t);l.current=t;let u=(e,t,n)=>{i({getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t,toJSON:()=>void 0}),contextElement:n}),a()},d=or(e.onMouseDown,e=>{t||e.button===2&&e.stopPropagation()}),f=or(e.onContextMenu,e=>{t||e.defaultPrevented||(e.preventDefault(),!s.current&&(u(e.clientX,e.clientY,e.currentTarget),o.current&&(s.current=!0)))}),p=Ar(e=>{if(l.current||s.current)return;let t=e,n=t.touches[0]??t.changedTouches[0];n&&(u(n.clientX,n.clientY,c.current),s.current=!0)},{threshold:r,events:[`touch`],cancelOnMove:!0,onStart:e=>{o.current=!0,s.current=!1,c.current=e.currentTarget},onFinish:e=>{o.current=!1,s.current=!1,l.current||e.preventDefault()},onCancel:()=>{o.current=!1,s.current=!1}});return{onContextMenu:f,onMouseDown:d,onTouchStart:or(e.onTouchStart,p.onTouchStart),onTouchEnd:or(e.onTouchEnd,p.onTouchEnd),onTouchCancel:or(e.onTouchCancel,p.onTouchCancel),onTouchMove:or(e.onTouchMove,p.onTouchMove),style:t?e.style:{...e.style,WebkitTouchCallout:`none`,WebkitUserSelect:`none`,userSelect:`none`},"data-expanded":n?!0:void 0}}function mi(e){let{children:t,disabled:n,longPressDelay:r}=v(`PopoverContextMenu`,null,e),i=te(t);if(!i)throw Error(`Popover.ContextMenu component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let a=fi(),o=pi({childProps:i.props,disabled:n||a.disabled,opened:a.opened,longPressDelay:r,setReference:a.reference,open:()=>{a.opened||a.onToggle()}});return(0,M.cloneElement)(i,o)}mi.displayName=`@mantine/core/PopoverContextMenu`;function hi({children:e,active:t=!0,refProp:n=`ref`,innerRef:r}){let i=wr(t),a=Ae(i,r),o=te(e);return o?(0,M.cloneElement)(o,{[n]:a}):e}function gi(e){return(0,N.jsx)(ai,{tabIndex:-1,"data-autofocus":!0,...e})}hi.displayName=`@mantine/core/FocusTrap`,gi.displayName=`@mantine/core/FocusTrapInitialFocus`,hi.InitialFocus=gi;var _i={dropdown:`m_38a85659`,arrow:`m_a31dc6c1`,overlay:`m_3d7bc908`},vi=w(e=>{let t=v(`PopoverDropdown`,null,e),{className:n,style:r,vars:i,children:a,onKeyDownCapture:o,variant:s,classNames:c,styles:l,ref:d,...f}=t,p=fi(),{dir:m}=jt(),h=p.arrowPosition===`merge`&&p.withArrow?mt({position:p.placement,dir:m}):void 0,g=mr({opened:p.opened,shouldReturnFocus:p.returnFocus}),_=p.withRoles?{"aria-labelledby":p.getTargetId(),id:p.getDropdownId(),role:`dialog`,tabIndex:-1}:{},y=Ae(d,p.floating);return p.disabled?null:(0,N.jsx)(Ct,{...p.portalProps,withinPortal:p.withinPortal,children:(0,N.jsx)(ae,{mounted:p.opened,...p.transitionProps,transition:p.transitionProps?.transition||`fade`,duration:p.transitionProps?.duration??150,keepMounted:p.keepMounted,keepMountedMode:p.keepMountedMode,exitDuration:typeof p.transitionProps?.exitDuration==`number`?p.transitionProps.exitDuration:p.transitionProps?.duration,children:e=>(0,N.jsx)(hi,{active:p.trapFocus&&p.opened,innerRef:y,children:(0,N.jsxs)(u,{..._,...f,variant:s,onKeyDownCapture:ar(()=>{p.onClose?.(),p.onDismiss?.()},{active:p.closeOnEscape,onTrigger:g,onKeyDown:o}),"data-position":p.placement,"data-fixed":p.floatingStrategy===`fixed`||void 0,...p.getStyles(`dropdown`,{className:n,props:t,classNames:c,styles:l,style:[{...e,...h,zIndex:p.zIndex,top:p.y??0,left:p.x??0,width:p.width===`target`?void 0:j(p.width),...p.referenceHidden?{display:`none`}:null},p.resolvedStyles?.dropdown,l?.dropdown,r]}),children:[a,(0,N.jsx)(bt,{ref:p.arrowRef,arrowX:p.arrowX,arrowY:p.arrowY,visible:p.withArrow,position:p.placement,arrowSize:p.arrowSize,arrowRadius:p.arrowRadius,arrowOffset:p.arrowOffset,arrowPosition:p.arrowPosition,...p.getStyles(`arrow`,{props:t,classNames:c,styles:l})})]})})})})});vi.classes=_i,vi.displayName=`@mantine/core/PopoverDropdown`;var yi={refProp:`ref`,popupType:`dialog`},bi=w(e=>{let{children:t,refProp:n,popupType:r,ref:i,...a}=v(`PopoverTarget`,yi,e),o=te(t);if(!o)throw Error(`Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let s=a,c=fi(),l=Ae(c.reference,ut(o),i),u=c.withRoles?{"aria-haspopup":r,"aria-expanded":c.opened,"aria-controls":c.opened?c.getDropdownId():void 0,id:c.getTargetId()}:{},d=o.props;return(0,M.cloneElement)(o,{...s,...u,...c.targetProps,className:O(c.targetProps.className,s.className,d.className),[n]:l,...c.controlled?null:{onClick:e=>{c.onToggle(),d.onClick?.(e)}}})});bi.displayName=`@mantine/core/PopoverTarget`;function xi(e){if(e===void 0)return{shift:!0,flip:!0};let t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function Si(e,t,n,r){let i=xi(e.middlewares),a=[vt(e.offset),Tt()];if(i.flip&&!n){let e=typeof i.flip==`boolean`?{}:i.flip,t=r?{fallbackStrategy:`initialPlacement`,...e}:e;a.push(_t(t))}if(i.shift){let t=typeof i.shift==`boolean`?{}:i.shift;a.push(pt(n=>{let r=n.placement.startsWith(`top`)||n.placement.startsWith(`bottom`);return{limiter:yt(),padding:5,...e.width===`target`&&r?{mainAxis:!1}:null,...t}}))}return i.inline&&a.push(typeof i.inline==`boolean`?St():St(i.inline)),a.push(gt({element:e.arrowRef,padding:e.arrowOffset})),(i.size||e.width===`target`)&&a.push(At({...typeof i.size==`boolean`?{}:i.size,apply({rects:n,availableWidth:r,availableHeight:a,...o}){let s=t().refs.floating.current?.style??{};i.size&&(typeof i.size==`object`&&i.size.apply?i.size.apply({rects:n,availableWidth:r,availableHeight:a,...o}):Object.assign(s,{maxWidth:`${r}px`,maxHeight:`${a}px`})),e.width===`target`&&Object.assign(s,{width:`${n.reference.width}px`})}})),a}function Ci(e){let[t,n]=Er({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=(0,M.useRef)(t),i=(0,M.useRef)(!1),[a,o]=(0,M.useState)(null),s=e.preventPositionChangeWhenVisible!==!1,c=(0,M.useRef)(t);t!==c.current&&(c.current=t,t&&a!==null&&o(null));let l=(0,M.useRef)(e.position);e.position!==l.current&&(l.current=e.position,i.current=!1,a!==null&&o(null));let u=(0,M.useCallback)(()=>o(null),[]),d=()=>{t&&!e.disabled&&n(!1)},f=()=>{e.disabled||n(!t)},p=ht({open:t,strategy:e.strategy,placement:s?a??e.position:e.position,middleware:Si(e,()=>p,s&&a!==null,s),whileElementsMounted:e.keepMounted?void 0:Mt});(0,M.useEffect)(()=>{if(!e.keepMounted)return;let n=p.refs.reference.current,r=p.refs.floating.current;if(t&&n&&r)return Mt(n,r,p.update)},[e.keepMounted,t,p.update,p.elements.reference,p.elements.floating]),he(()=>{if(!t){i.current=!1;return}if(!s||a!==null)return;let e=p.refs.floating.current;if(e&&e.offsetHeight!==0&&e.offsetWidth!==0){if(!i.current){i.current=!0,p.update();return}p.isPositioned&&o(p.placement)}},[s,t,p.isPositioned,p.placement,a,p.update]);let m=(0,M.useRef)(p.placement);return he(()=>{m.current!==p.placement&&(m.current=p.placement,e.onPositionChange?.(p.placement))},[p.placement]),De(()=>{t!==r.current&&(t?e.onOpen?.():e.onClose?.()),r.current=t},[t,e.onClose,e.onOpen]),{floating:p,controlled:typeof e.opened==`boolean`,opened:t,onClose:d,onToggle:f,resetLockedPlacement:u}}var wi={position:`bottom`,offset:8,transitionProps:{transition:`fade`,duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:`side`,closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,hideDetached:!0,preventPositionChangeWhenVisible:!0,clickOutsideEvents:[`mousedown`,`touchstart`],clickOutsideCapture:!1,zIndex:ft(`popover`),__staticSelector:`Popover`,width:`max-content`},Ti=D((e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:Oe(t),"--popover-shadow":se(n)}}));function Ei(e){let t=v(`Popover`,wi,e),{children:n,position:r,offset:i,onPositionChange:a,opened:o,transitionProps:s,onExitTransitionEnd:l,onEnterTransitionEnd:u,width:d,middlewares:f,withArrow:p,arrowSize:m,arrowOffset:h,arrowRadius:g,arrowPosition:_,unstyled:y,classNames:b,styles:x,closeOnClickOutside:S,withinPortal:C,portalProps:w,closeOnEscape:T,clickOutsideEvents:ee,clickOutsideCapture:E,trapFocus:D,onClose:O,onDismiss:te,onOpen:ne,onChange:re,zIndex:k,radius:ie,shadow:oe,id:se,defaultOpened:ce,__staticSelector:le,withRoles:ue,disabled:de,returnFocus:fe,variant:pe,keepMounted:me,keepMountedMode:he,vars:_e,floatingStrategy:ve,withOverlay:ye,overlayProps:A,hideDetached:j,attributes:xe,preventPositionChangeWhenVisible:Se,...Ce}=t,we=c({name:le,props:t,classes:_i,classNames:b,styles:x,unstyled:y,attributes:xe,rootSelector:`dropdown`,vars:_e,varsResolver:Ti}),{resolvedStyles:Te}=ge({classNames:b,styles:x,props:t}),Ee=(0,M.useRef)(null),[De,Oe]=(0,M.useState)(null),[ke,Ae]=(0,M.useState)(null),{dir:je}=jt(),Me=Le(),Ne=be(se),Pe=Ci({middlewares:f,width:d,position:Et(je,r),offset:typeof i==`number`?i+(p?m/2:0):i,arrowRef:Ee,arrowOffset:h,onPositionChange:a,opened:o,defaultOpened:ce,onChange:re,onOpen:ne,onClose:O,onDismiss:te,strategy:ve,disabled:de,preventPositionChangeWhenVisible:Se,keepMounted:me});dr(()=>{S&&(Pe.onClose(),te?.())},ee,[De,ke],!0,E);let Fe=(0,M.useCallback)(e=>{Oe(e),Pe.floating.refs.setReference(e)},[Pe.floating.refs.setReference]),Ie=(0,M.useCallback)(e=>{Ae(e),Pe.floating.refs.setFloating(e)},[Pe.floating.refs.setFloating]),Re=(0,M.useCallback)(()=>{s?.onExited?.(),l?.(),Pe.resetLockedPlacement()},[s?.onExited,l,Pe.resetLockedPlacement]),ze=(0,M.useCallback)(()=>{s?.onEntered?.(),u?.()},[s?.onEntered,u]);return(0,N.jsxs)(di,{value:{returnFocus:fe,disabled:de,controlled:Pe.controlled,reference:Fe,floating:Ie,x:Pe.floating.x,y:Pe.floating.y,arrowX:Pe.floating?.middlewareData?.arrow?.x,arrowY:Pe.floating?.middlewareData?.arrow?.y,opened:Pe.opened,arrowRef:Ee,transitionProps:{...s,onExited:Re,onEntered:ze},width:d,withArrow:p,arrowSize:m,arrowOffset:h,arrowRadius:g,arrowPosition:_,placement:Pe.floating.placement,trapFocus:D,withinPortal:C,portalProps:w,zIndex:k,radius:ie,shadow:oe,closeOnEscape:T,onDismiss:te,onClose:Pe.onClose,onToggle:Pe.onToggle,getTargetId:()=>Ne,getDropdownId:()=>`${Ne}-dropdown`,withRoles:ue,targetProps:Ce,__staticSelector:le,classNames:b,styles:x,unstyled:y,variant:pe,keepMounted:me,keepMountedMode:he,getStyles:we,resolvedStyles:Te,floatingStrategy:ve,referenceHidden:j&&Me!==`test`?Pe.floating.middlewareData.hide?.referenceHidden:!1},children:[n,ye&&(0,N.jsx)(ae,{transition:`fade`,mounted:Pe.opened,duration:s?.duration||250,exitDuration:s?.exitDuration||250,children:e=>(0,N.jsx)(Ct,{withinPortal:C,children:(0,N.jsx)(ui,{...A,...we(`overlay`,{className:A?.className,style:[e,A?.style]})})})})]})}Ei.Target=bi,Ei.Dropdown=vi,Ei.ContextMenu=mi,Ei.varsResolver=Ti,Ei.displayName=`@mantine/core/Popover`,Ei.extend=e=>e,Ei.withProps=e=>{let t=t=>(0,N.jsx)(Ei,{...e,...t});return t.extend=Ei.extend,t.displayName=`WithProps(${Ei.displayName})`,t};var Di={root:`m_8d3f4000`,icon:`m_8d3afb97`,loader:`m_302b9fb1`,group:`m_1a0f1b21`,groupSection:`m_437b6484`},Oi={orientation:`horizontal`},ki=D((e,{borderWidth:t})=>({group:{"--ai-border-width":j(t)}})),Ai=w(e=>{let t=v(`ActionIconGroup`,Oi,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,orientation:s,vars:l,borderWidth:d,variant:f,mod:p,attributes:m,...h}=t,g=c({name:`ActionIconGroup`,props:t,classes:Di,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:m,vars:l,varsResolver:ki,rootSelector:`group`});return(0,N.jsx)(u,{...g(`group`),variant:f,mod:[{orientation:s},p],role:`group`,...h})});Ai.classes=Di,Ai.varsResolver=ki,Ai.displayName=`@mantine/core/ActionIconGroup`;var ji=D((e,{radius:t,color:n,gradient:r,variant:i,autoContrast:a,size:o})=>{let s=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:a});return{groupSection:{"--section-height":ye(o,`section-height`),"--section-padding-x":ye(o,`section-padding-x`),"--section-fz":Se(o),"--section-radius":t===void 0?void 0:Oe(t),"--section-bg":n||i?s.background:void 0,"--section-color":s.color,"--section-bd":n||i?s.border:void 0}}}),Mi=w(e=>{let t=v(`ActionIconGroupSection`,null,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,vars:s,variant:l,gradient:d,radius:f,autoContrast:p,attributes:m,...h}=t,g=c({name:`ActionIconGroupSection`,props:t,classes:Di,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:m,vars:s,varsResolver:ji,rootSelector:`groupSection`});return(0,N.jsx)(u,{...g(`groupSection`),variant:l,...h})});Mi.classes=Di,Mi.varsResolver=ji,Mi.displayName=`@mantine/core/ActionIconGroupSection`;var Ni=D((e,{size:t,radius:n,variant:r,gradient:i,color:a,autoContrast:o})=>{let s=e.variantColorResolver({color:a||e.primaryColor,theme:e,gradient:i,variant:r||`filled`,autoContrast:o});return{root:{"--ai-size":ye(t,`ai-size`),"--ai-radius":n===void 0?void 0:Oe(n),"--ai-bg":a||r?s.background:void 0,"--ai-hover":a||r?s.hover:void 0,"--ai-hover-color":a||r?s.hoverColor:void 0,"--ai-color":s.color,"--ai-bd":a||r?s.border:void 0}}}),Pi=Pe(e=>{let t=v(`ActionIcon`,null,e),{className:n,unstyled:r,variant:i,classNames:a,styles:o,style:s,loading:l,loaderProps:d,size:f,color:p,radius:m,__staticSelector:h,gradient:g,vars:_,children:y,disabled:b,"data-disabled":x,autoContrast:S,mod:w,attributes:T,...ee}=t,E=c({name:[`ActionIcon`,h],props:t,className:n,style:s,classes:Di,classNames:a,styles:o,unstyled:r,attributes:T,vars:_,varsResolver:Ni});return(0,N.jsxs)(C,{...E(`root`,{active:!b&&!l&&!x}),"aria-busy":l||void 0,...ee,unstyled:r,variant:i,size:f,disabled:b||l,mod:[{loading:l,disabled:b||x},w],children:[typeof l==`boolean`&&(0,N.jsx)(ae,{mounted:l,transition:`slide-down`,duration:150,children:e=>(0,N.jsx)(u,{component:`span`,...E(`loader`,{style:e}),"aria-hidden":!0,children:(0,N.jsx)(Ie,{color:`var(--ai-color)`,size:`calc(var(--ai-size) * 0.55)`,...d})})}),(0,N.jsx)(u,{component:`span`,mod:{loading:l},...E(`icon`),children:y})]})});Pi.classes=Di,Pi.varsResolver=Ni,Pi.displayName=`@mantine/core/ActionIcon`,Pi.Group=Ai,Pi.GroupSection=Mi;var[Fi,Ii]=dt(`ModalBase component was not found in tree`);function Li({opened:e,transitionDuration:t}){let[n,r]=(0,M.useState)(e),i=(0,M.useRef)(-1),a=x()?0:t;return(0,M.useEffect)(()=>(e?(r(!0),window.clearTimeout(i.current)):a===0?r(!1):i.current=window.setTimeout(()=>r(!1),a),()=>window.clearTimeout(i.current)),[e,a]),n}function Ri({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:i,onClose:a,returnFocus:o,handledEscapeEvents:s}){let c=be(e),[l,u]=(0,M.useState)(!1),[d,f]=(0,M.useState)(!1),p=Li({opened:n,transitionDuration:typeof t?.duration==`number`?t?.duration:200});return Tr(`keydown`,e=>{e.key===`Escape`&&i&&!e.isComposing&&n&&!s?.has(e)&&e.target?.getAttribute(`data-mantine-stop-propagation`)!==`true`&&(s?.add(e),a())},{capture:!0}),mr({opened:n,shouldReturnFocus:r&&o}),{_id:c,titleMounted:l,bodyMounted:d,shouldLockScroll:p,setTitleMounted:u,setBodyMounted:f}}var zi=function(){return zi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return pa;var t=ha(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},_a=fa(),va=`data-scroll-locked`,ya=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` .${Wi} { overflow: hidden ${r}; @@ -51,9 +51,9 @@ Error generating stack: `+e.message+` `)}var _l=function(e){sl(t,e);function t(t,n,r,i,a){var o=this.constructor,s=e.call(this,gl(t,{name:n,index:r,operation:i,tree:a}))||this;return s.name=n,s.index=r,s.operation=i,s.tree=a,Object.setPrototypeOf(s,o.prototype),s.message=gl(t,{name:n,index:r,operation:i,tree:a}),s}return t}(Error),vl=r({JsonPatchError:()=>yl,_areEquals:()=>kl,applyOperation:()=>wl,applyPatch:()=>Tl,applyReducer:()=>El,deepClone:()=>bl,getValueByPointer:()=>Cl,validate:()=>Ol,validator:()=>Dl}),yl=_l,bl=dl,xl={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=Cl(n,this.path);r&&=dl(r);var i=wl(n,{op:`remove`,path:this.from}).removed;return wl(n,{op:`add`,path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=Cl(n,this.from);return wl(n,{op:`add`,path:this.path,value:dl(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:kl(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},Sl={add:function(e,t,n){return fl(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:xl.move,copy:xl.copy,test:xl.test,_get:xl._get};function Cl(e,t){if(t==``)return e;var n={op:`_get`,path:t};return wl(e,n),n.value}function wl(e,t,n,r,i,a){if(n===void 0&&(n=!1),r===void 0&&(r=!0),i===void 0&&(i=!0),a===void 0&&(a=0),n&&(typeof n==`function`?n(t,0,e,t.path):Dl(t,0)),t.path===``){var o={newDocument:e};if(t.op===`add`)return o.newDocument=t.value,o;if(t.op===`replace`)return o.newDocument=t.value,o.removed=e,o;if(t.op===`move`||t.op===`copy`)return o.newDocument=Cl(e,t.from),t.op===`move`&&(o.removed=e),o;if(t.op===`test`){if(o.test=kl(e,t.value),o.test===!1)throw new yl(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o.newDocument=e,o}if(t.op===`remove`)return o.removed=e,o.newDocument=null,o;if(t.op===`_get`)return t.value=e,o;if(n)throw new yl("Operation `op` property is not one of operations defined in RFC-6902",`OPERATION_OP_INVALID`,a,t,e);return o}r||(e=dl(e));var s=(t.path||``).split(`/`),c=e,l=1,u=s.length,d=void 0,f=void 0,p=void 0;for(p=typeof n==`function`?n:Dl;;){if(f=s[l],f&&f.indexOf(`~`)!=-1&&(f=ml(f)),i&&(f==`__proto__`||f==`prototype`&&l>0&&s[l-1]==`constructor`))throw TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&d===void 0&&(c[f]===void 0?d=s.slice(0,l).join(`/`):l==u-1&&(d=t.path),d!==void 0&&p(t,0,e,d)),l++,Array.isArray(c)){if(f===`-`)f=c.length;else if(n&&!fl(f))throw new yl(`Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index`,`OPERATION_PATH_ILLEGAL_ARRAY_INDEX`,a,t,e);else fl(f)&&(f=~~f);if(l>=u){if(n&&t.op===`add`&&f>c.length)throw new yl(`The specified index MUST NOT be greater than the number of elements in the array`,`OPERATION_VALUE_OUT_OF_BOUNDS`,a,t,e);var o=Sl[t.op].call(t,c,f,e);if(o.test===!1)throw new yl(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}}else if(l>=u){var o=xl[t.op].call(t,c,f,e);if(o.test===!1)throw new yl(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}if(c=c[f],n&&l0)throw new yl('Operation `path` property must start with "/"',`OPERATION_PATH_INVALID`,t,e,n);if((e.op===`move`||e.op===`copy`)&&typeof e.from!=`string`)throw new yl("Operation `from` property is not present (applicable in `move` and `copy` operations)",`OPERATION_FROM_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&e.value===void 0)throw new yl("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&hl(e.value))throw new yl("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED`,t,e,n);if(n){if(e.op==`add`){var i=e.path.split(`/`).length,a=r.split(`/`).length;if(i!==a+1&&i!==a)throw new yl("Cannot perform an `add` operation at the desired path",`OPERATION_PATH_CANNOT_ADD`,t,e,n)}else if(e.op===`replace`||e.op===`remove`||e.op===`_get`){if(e.path!==r)throw new yl(`Cannot perform the operation at a path that does not exist`,`OPERATION_PATH_UNRESOLVABLE`,t,e,n)}else if(e.op===`move`||e.op===`copy`){var o=Ol([{op:`_get`,path:e.from,value:void 0}],n);if(o&&o.name===`OPERATION_PATH_UNRESOLVABLE`)throw new yl(`Cannot perform the operation from a path that does not exist`,`OPERATION_FROM_UNRESOLVABLE`,t,e,n)}}}function Ol(e,t,n){try{if(!Array.isArray(e))throw new yl(`Patch sequence must be an array`,`SEQUENCE_NOT_AN_ARRAY`);if(t)Tl(dl(t),dl(e),n||!0);else{n||=Dl;for(var r=0;rVl,generate:()=>zl,observe:()=>Rl,unobserve:()=>Ll}),jl=new WeakMap,Ml=function(){function e(e){this.observers=new Map,this.obj=e}return e}(),Nl=function(){function e(e,t){this.callback=e,this.observer=t}return e}();function Pl(e){return jl.get(e)}function Fl(e,t){return e.observers.get(t)}function Il(e,t){e.observers.delete(t.callback)}function Ll(e,t){t.unobserve()}function Rl(e,t){var n=[],r,i=Pl(e);if(!i)i=new Ml(e),jl.set(e,i);else{var a=Fl(i,t);r=a&&a.observer}if(r)return r;if(r={},i.value=dl(e),t){r.callback=t,r.next=null;var o=function(){zl(r)},s=function(){clearTimeout(r.next),r.next=setTimeout(o)};typeof window<`u`&&(window.addEventListener(`mouseup`,s),window.addEventListener(`keyup`,s),window.addEventListener(`mousedown`,s),window.addEventListener(`keydown`,s),window.addEventListener(`change`,s))}return r.patches=n,r.object=e,r.unobserve=function(){zl(r),clearTimeout(r.next),Il(i,r),typeof window<`u`&&(window.removeEventListener(`mouseup`,s),window.removeEventListener(`keyup`,s),window.removeEventListener(`mousedown`,s),window.removeEventListener(`keydown`,s),window.removeEventListener(`change`,s))},i.observers.set(t,new Nl(t,r)),r}function zl(e,t){t===void 0&&(t=!1);var n=jl.get(e.object);Bl(n.value,e.object,e.patches,``,t),e.patches.length&&Tl(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function Bl(e,t,n,r,i){if(t!==e){typeof t.toJSON==`function`&&(t=t.toJSON());for(var a=ul(t),o=ul(e),s=!1,c=o.length-1;c>=0;c--){var l=o[c],u=e[l];if(ll(t,l)&&(t[l]!==void 0||u===void 0||Array.isArray(t)!==!1)){var d=t[l];typeof u==`object`&&u&&typeof d==`object`&&d&&Array.isArray(u)===Array.isArray(d)?Bl(u,d,n,r+`/`+pl(l),i):u!==d&&(i&&n.push({op:`test`,path:r+`/`+pl(l),value:dl(u)}),n.push({op:`replace`,path:r+`/`+pl(l),value:dl(d)}))}else Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:`test`,path:r+`/`+pl(l),value:dl(u)}),n.push({op:`remove`,path:r+`/`+pl(l)}),s=!0):(i&&n.push({op:`test`,path:r,value:e}),n.push({op:`replace`,path:r,value:t}))}if(s||a.length!=o.length)for(var c=0;c0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Jl(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Yl(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof Xl?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function Ql(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof ql==`function`?ql(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function $l(e){return typeof e==`function`}function eu(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var tu=eu(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription: `+t.map(function(e,t){return t+1+`) `+e.toString()}).join(` `):``,this.name=`UnsubscriptionError`,this.errors=t}});function nu(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var ru=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a){if(this._parentage=null,Array.isArray(a))try{for(var o=ql(a),s=o.next();!s.done;s=o.next())s.value.remove(this)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this)}var c=this.initialTeardown;if($l(c))try{c()}catch(e){i=e instanceof tu?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=ql(l),d=u.next();!d.done;d=u.next()){var f=d.value;try{ou(f)}catch(e){i??=[],e instanceof tu?i=Yl(Yl([],Jl(i)),Jl(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new tu(i)}},e.prototype.add=function(t){if(t&&t!==this){if(this.closed)ou(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&nu(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&nu(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e}(),iu=ru.EMPTY;function au(e){return e instanceof ru||e&&`closed`in e&&$l(e.remove)&&$l(e.add)&&$l(e.unsubscribe)}function ou(e){$l(e)?e():e.unsubscribe()}var su={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},cu={setTimeout:function(e,t){var n=[...arguments].slice(2),r=cu.delegate;return r?.setTimeout?r.setTimeout.apply(r,Yl([e,t],Jl(n))):setTimeout.apply(void 0,Yl([e,t],Jl(n)))},clearTimeout:function(e){return(cu.delegate?.clearTimeout||clearTimeout)(e)},delegate:void 0};function lu(e){cu.setTimeout(function(){var t=su.onUnhandledError;if(t)t(e);else throw e})}function uu(){}var du=(function(){return mu(`C`,void 0,void 0)})();function fu(e){return mu(`E`,void 0,e)}function pu(e){return mu(`N`,e,void 0)}function mu(e,t,n){return{kind:e,value:t,error:n}}var hu=null;function gu(e){if(su.useDeprecatedSynchronousErrorHandling){var t=!hu;if(t&&(hu={errorThrown:!1,error:null}),e(),t){var n=hu,r=n.errorThrown,i=n.error;if(hu=null,r)throw i}}else e()}function _u(e){su.useDeprecatedSynchronousErrorHandling&&hu&&(hu.errorThrown=!0,hu.error=e)}var vu=function(e){Wl(t,e);function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,au(t)&&t.add(n)):n.destination=Eu,n}return t.create=function(e,t,n){return new Su(e,t,n)},t.prototype.next=function(e){this.isStopped?Tu(pu(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?Tu(fu(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?Tu(du,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(ru),yu=Function.prototype.bind;function bu(e,t){return yu.call(e,t)}var xu=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){Cu(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Cu(e)}else Cu(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Cu(e)}},e}(),Su=function(e){Wl(t,e);function t(t,n,r){var i=e.call(this)||this,a;if($l(t)||!t)a={next:t??void 0,error:n??void 0,complete:r??void 0};else{var o;i&&su.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&bu(t.next,o),error:t.error&&bu(t.error,o),complete:t.complete&&bu(t.complete,o)}):a=t}return i.destination=new xu(a),i}return t}(vu);function Cu(e){su.useDeprecatedSynchronousErrorHandling?_u(e):lu(e)}function wu(e){throw e}function Tu(e,t){var n=su.onStoppedNotification;n&&cu.setTimeout(function(){return n(e,t)})}var Eu={closed:!0,next:uu,error:wu,complete:uu},Du=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})();function Ou(e){return e}function ku(){return Au([...arguments])}function Au(e){return e.length===0?Ou:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var ju=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this,i=Pu(e)?e:new Su(e,t,n);return gu(function(){var e=r,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?r._subscribe(i):r._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return t=Mu(t),new t(function(t,r){var i=new Su({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){return this.source?.subscribe(e)},e.prototype[Du]=function(){return this},e.prototype.pipe=function(){return Au([...arguments])(this)},e.prototype.toPromise=function(e){var t=this;return e=Mu(e),new e(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function Mu(e){return e??su.Promise??Promise}function Nu(e){return e&&$l(e.next)&&$l(e.error)&&$l(e.complete)}function Pu(e){return e&&e instanceof vu||Nu(e)&&au(e)}function Fu(e){return $l(e?.lift)}function Iu(e){return function(t){if(Fu(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}function Lu(e,t,n,r,i){return new Ru(e,t,n,r,i)}var Ru=function(e){Wl(t,e);function t(t,n,r,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)==null||t.call(this))}},t}(vu),zu=eu(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}}),Bu=function(e){Wl(t,e);function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return t.prototype.lift=function(e){var t=new Vu(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new zu},t.prototype.next=function(e){var t=this;gu(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||=Array.from(t.observers);try{for(var i=ql(t.currentObservers),a=i.next();!a.done;a=i.next())a.value.next(e)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;gu(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;gu(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){return this.observers?.length>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,a=n.observers;return r||i?iu:(this.currentObservers=null,a.push(e),new ru(function(){t.currentObservers=null,nu(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new ju;return e.source=this,e},t.create=function(e,t){return new Vu(e,t)},t}(ju),Vu=function(e){Wl(t,e);function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return t.prototype.next=function(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)},t.prototype.error=function(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)},t.prototype.complete=function(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)},t.prototype._subscribe=function(e){return this.source?.subscribe(e)??iu},t}(Bu),Hu={now:function(){return(Hu.delegate||Date).now()},delegate:void 0},Uu=function(e){Wl(t,e);function t(t,n,r){t===void 0&&(t=1/0),n===void 0&&(n=1/0),r===void 0&&(r=Hu);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,o=n._timestampProvider,s=n._windowTime;r||(i.push(t),!a&&i.push(o.now()+s)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this,r=n._infiniteTimeWindow,i=n._buffer.slice(),a=0;a=0}function Hd(e){for(var t=[`topLevel`],n=0,r,i,a,o=function(e){return t.push(e)},s=function(e){return t[t.length-1]=e},c=function(e){r??(r=n,i=t.length,a=e)},l=function(e){e===a&&(r=void 0,i=void 0,a=void 0)},u=function(){return t.pop()},d=function(){return n--},f=function(e){if(`0`<=e&&e<=`9`){o(`number`);return}switch(e){case`"`:o(`string`);return;case`-`:o(`numberNeedsDigit`);return;case`t`:o(`true`);return;case`f`:o(`false`);return;case`n`:o(`null`);return;case`[`:o(`arrayNeedsValue`);return;case`{`:o(`objectNeedsKey`);return}},p=e.length;n`9`)&&(d(),u());break;case`numberNeedsDigit`:s(`number`);break;case`numberNeedsExponent`:s(m===`+`||m===`-`?`numberNeedsDigit`:`number`);break;case`true`:case`false`:case`null`:(m<`a`||m>`z`)&&(d(),u());break;case`arrayNeedsValue`:m===`]`?u():Vd(m)||(l(`collectionItem`),s(`arrayNeedsComma`),f(m));break;case`arrayNeedsComma`:m===`]`?u():m===`,`&&(c(`collectionItem`),s(`arrayNeedsValue`));break;case`objectNeedsKey`:m===`}`?u():m===`"`&&(c(`collectionItem`),s(`objectNeedsColon`),o(`string`));break;case`objectNeedsColon`:m===`:`&&s(`objectNeedsValue`);break;case`objectNeedsValue`:Vd(m)||(l(`collectionItem`),s(`objectNeedsComma`),f(m));break;case`objectNeedsComma`:m===`}`?u():m===`,`&&(c(`collectionItem`),s(`objectNeedsKey`))}}i!=null&&(t.length=i);for(var h=[r==null?e:e.slice(0,r)],g=function(t){return h.push(t.slice(e.length-e.lastIndexOf(t[0])))},_=t.length-1;_>=0;_--)switch(t[_]){case`string`:h.push(`"`);break;case`numberNeedsDigit`:case`numberNeedsExponent`:h.push(`0`);break;case`true`:g(`true`);break;case`false`:g(`false`);break;case`null`:g(`null`);break;case`arrayNeedsValue`:case`arrayNeedsComma`:h.push(`]`);break;case`objectNeedsKey`:case`objectNeedsColon`:case`objectNeedsValue`:case`objectNeedsComma`:h.push(`}`)}return h.join(``)}function Ud(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 Wd(e,t=`|`){return e.map(e=>vf(e)).join(t)}function Gd(e,t){return typeof t==`bigint`?t.toString():t}var Kd=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function qd(e){return new Kd(e)}function Jd(e){return e==null}function Yd(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Xd(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){let e=t._zod.def.shape[a];return r?r(e,a):e}):rf(e,a,r?r(n.value,a):n.value))}}function of(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?nf(e,n,()=>t[n]):rf(e,n,r.value))}}function sf(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function cf(e){return JSON.stringify(e)}function lf(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var uf=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function df(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ff=qd(()=>{if(sp.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function pf(e){if(df(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return df(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function mf(e){return pf(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var hf=new Set([`string`,`number`,`symbol`]);function gf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _f(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function B(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 vf(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function yf(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var bf={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},xf={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Sf(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`);let i={};return af(i,e,Cf(e,t)),_f(e,sf(n,{shape:i,checks:[]}))}function Cf(e,t){let n=tf(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function wf(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`);let i=new Set(Cf(e,t)),a={};return af(a,e,Reflect.ownKeys(tf(e)).filter(e=>!i.has(e))),_f(e,sf(n,{shape:a,checks:[]}))}function Tf(e,t){if(!pf(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=tf(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return _f(e,sf(e._zod.def,{shape:Ef(e,t)}))}function Ef(e,t){let n={};return af(n,e,Reflect.ownKeys(tf(e))),of(n,t),n}function Df(e,t){if(!pf(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return _f(e,sf(e._zod.def,{shape:Ef(e,t)}))}function Of(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return af(n,e,Reflect.ownKeys(tf(e))),af(n,t,Reflect.ownKeys(tf(t))),_f(e,sf(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function kf(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Cf(t,n)):void 0,o={};return af(o,t,Reflect.ownKeys(tf(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),_f(t,sf(t._zod.def,{shape:o,checks:[]}))}function Af(e,t,n){let r=n?new Set(Cf(t,n)):void 0,i={};return af(i,t,Reflect.ownKeys(tf(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),_f(t,sf(t._zod.def,{shape:i}))}function jf(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Pf(e){return typeof e==`string`?e:e?.message}function Ff(e,t,n){var r;for(let i=t;ie;return t[V]=!0,t}var ep,tp=Object.freeze({status:`aborted`}),np={value:void 0,enumerable:!1},rp=`captureStackTrace`in Error?Error:null;function ip(e){let t=rp;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return rp=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function H(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){np.value=new a(r);try{Object.defineProperty(n,"_zod",np)}finally{np.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Hf(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?ip(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var ap=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},op=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ep=globalThis).__zod_globalConfig??(ep.__zod_globalConfig={});var sp=globalThis.__zod_globalConfig;function cp(e){return e&&Object.assign(sp,e),sp}function lp(){let e=this._zod;return e.message??=JSON.stringify(e.def,Gd,2),e.message}function up(e){this._zod.message=e}var dp={get:lp,set:up,enumerable:!0,configurable:!0},fp={value:void 0,enumerable:!1},pp=new WeakSet([Object.prototype,Error.prototype]),mp=(e,t)=>{e.name=`$ZodError`,fp.value=t,Object.defineProperty(e,"issues",fp),fp.value=void 0,Object.defineProperty(e,"message",dp);let n=Object.getPrototypeOf(e);pp.has(n)||(pp.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},hp=H(`$ZodError`,mp);H(`$ZodError`,mp,void 0,{Parent:Error});function gp(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function _p(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?gp(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function vp(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ap;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>If(e,o,cp())));throw uf(n,a?.callee??t),n}return s.value};return t},xp=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>If(e,o,cp())));throw uf(n,a?.callee??t),n}return s.value};return t},Sp=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 ap;return a.issues.length?Cp(e,a.issues,i):{success:!0,data:a.value}};function Cp(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>If(e,n,cp()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var wp=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Cp(e,a.issues,i):{success:!0,data:a.value}},Tp=Symbol.for(`zod.compile.invalid`),Ep=Symbol.for(`zod.compile.fallback`),Dp=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Tp)return!0;if(r.definite===!0&&n===void 0)return!1}return Op(e,t,n)});function Op(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Ep]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new ap;return a.issues.length===0}var kp=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Ap=e=>{let t=bp(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,yp(n,a))};return n},jp=e=>{let t=bp(e),n=(e,r,i,a)=>t(e,r,i,yp(n,a));return n},Mp=e=>{let t=xp(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,yp(n,a))};return n},Np=e=>{let t=xp(e),n=async(e,r,i,a)=>await t(e,r,i,yp(n,a));return n},Pp=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Sp(e)(t,n,i)},Fp=e=>(t,n,r)=>Sp(e)(t,n,r),Ip=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return wp(e)(t,n,i)},Lp=e=>async(t,n,r)=>wp(e)(t,n,r),Rp=/^[cC][0-9a-z]{6,}$/,zp=/^[0-9a-z]+$/,Bp=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Vp=/^[0-9a-vA-V]{20}$/,Hp=/^[A-Za-z0-9]{27}$/,Up=/^[a-zA-Z0-9_-]{21}$/;function Wp(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Gp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Kp=/^([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})$/,qp=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)$/,Jp=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Yp=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Xp(){return new RegExp(Yp,`u`)}var Zp=/^(?:(?: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])$/,Qp=/^(([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}|:))$/,$p=/^((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])$/,em=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tm=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nm=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,rm=/^https?$/,im=/^\+[1-9]\d{6,14}$/,am=`(?:(?:\\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])))`;function om(e){return RegExp(`^${e}$`)}var sm=om(am);function cm(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function lm(e){return RegExp(`^${cm(e)}$`)}function um(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${cm({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${cm({precision:e.precision})}`:n;return RegExp(`^${am}T(?:${r})$`)}var dm=/^[\s\S]{0,}$/,fm=/^-?\d+$/,pm=/^-?\d+(?:\.\d+)?$/,mm=/^(?:true|false)$/i,hm=/^null$/i,gm=/^undefined$/i,_m=/^[^A-Z]*$/,vm=/^[^a-z]*$/,ym=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bm=e=>{let t=e.value;return!Jd(t)&&t.length!==void 0},xm={number:`number`,bigint:`bigint`,object:`date`},Sm=H(`$ZodCheckLessThan`,(e,t)=>{ym.init(e,t);let n=xm[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{ym.init(e,t);let n=xm[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:xm[typeof r.value]??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})}}),wm=H(`$ZodCheckMultipleOf`,(e,t)=>{ym.init(e,t),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`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Xd(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})}}),Tm=H(`$ZodCheckNumberFormat`,(e,t)=>{ym.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=bf[t.format];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}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Em=H(`$ZodCheckMaxLength`,(e,t)=>{var n;ym.init(e,t),(n=e._zod.def).when??(n.when=bm),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Rf(r):i)<=t.maximum)return;let a=zf(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Dm=H(`$ZodCheckMinLength`,(e,t)=>{var n;ym.init(e,t),(n=e._zod.def).when??(n.when=bm),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i=t.minimum)return;let a=zf(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Om=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;ym.init(e,t),(n=e._zod.def).when??(n.when=bm),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Rf(r):i;if(a===t.length)return;let o=zf(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),km=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ym.init(e,t),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=()=>{})}),Am=H(`$ZodCheckRegex`,(e,t)=>{km.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})}}),jm=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=_m,km.init(e,t)}),Mm=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=vm,km.init(e,t)}),Nm=H(`$ZodCheckIncludes`,(e,t)=>{ym.init(e,t);let n=gf(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),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})}}),Pm=H(`$ZodCheckStartsWith`,(e,t)=>{ym.init(e,t);let n=RegExp(`^${gf(t.prefix)}.*`);t.pattern??=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})}}),Fm=H(`$ZodCheckEndsWith`,(e,t)=>{ym.init(e,t);let n=RegExp(`.*${gf(t.suffix)}$`);t.pattern??=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})}}),Im=H(`$ZodCheckOverwrite`,(e,t)=>{ym.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Lm=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` + `.indexOf(e)>=0}function Hd(e){for(var t=[`topLevel`],n=0,r,i,a,o=function(e){return t.push(e)},s=function(e){return t[t.length-1]=e},c=function(e){r??(r=n,i=t.length,a=e)},l=function(e){e===a&&(r=void 0,i=void 0,a=void 0)},u=function(){return t.pop()},d=function(){return n--},f=function(e){if(`0`<=e&&e<=`9`){o(`number`);return}switch(e){case`"`:o(`string`);return;case`-`:o(`numberNeedsDigit`);return;case`t`:o(`true`);return;case`f`:o(`false`);return;case`n`:o(`null`);return;case`[`:o(`arrayNeedsValue`);return;case`{`:o(`objectNeedsKey`);return}},p=e.length;n`9`)&&(d(),u());break;case`numberNeedsDigit`:s(`number`);break;case`numberNeedsExponent`:s(m===`+`||m===`-`?`numberNeedsDigit`:`number`);break;case`true`:case`false`:case`null`:(m<`a`||m>`z`)&&(d(),u());break;case`arrayNeedsValue`:m===`]`?u():Vd(m)||(l(`collectionItem`),s(`arrayNeedsComma`),f(m));break;case`arrayNeedsComma`:m===`]`?u():m===`,`&&(c(`collectionItem`),s(`arrayNeedsValue`));break;case`objectNeedsKey`:m===`}`?u():m===`"`&&(c(`collectionItem`),s(`objectNeedsColon`),o(`string`));break;case`objectNeedsColon`:m===`:`&&s(`objectNeedsValue`);break;case`objectNeedsValue`:Vd(m)||(l(`collectionItem`),s(`objectNeedsComma`),f(m));break;case`objectNeedsComma`:m===`}`?u():m===`,`&&(c(`collectionItem`),s(`objectNeedsKey`))}}i!=null&&(t.length=i);for(var h=[r==null?e:e.slice(0,r)],g=function(t){return h.push(t.slice(e.length-e.lastIndexOf(t[0])))},_=t.length-1;_>=0;_--)switch(t[_]){case`string`:h.push(`"`);break;case`numberNeedsDigit`:case`numberNeedsExponent`:h.push(`0`);break;case`true`:g(`true`);break;case`false`:g(`false`);break;case`null`:g(`null`);break;case`arrayNeedsValue`:case`arrayNeedsComma`:h.push(`]`);break;case`objectNeedsKey`:case`objectNeedsColon`:case`objectNeedsValue`:case`objectNeedsComma`:h.push(`}`)}return h.join(``)}function Ud(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 Wd(e,t=`|`){return e.map(e=>vf(e)).join(t)}function Gd(e,t){return typeof t==`bigint`?t.toString():t}var Kd=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function qd(e){return new Kd(e)}function Jd(e){return e==null}function Yd(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Xd(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){let e=t._zod.def.shape[a];return r?r(e,a):e}):rf(e,a,r?r(n.value,a):n.value))}}function of(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?nf(e,n,()=>t[n]):rf(e,n,r.value))}}function sf(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function cf(e){return JSON.stringify(e)}function lf(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var uf=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function df(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ff=qd(()=>{if(cp.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function pf(e){if(df(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return df(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function mf(e){return pf(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var hf=new Set([`string`,`number`,`symbol`]);function gf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _f(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function B(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 vf(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function yf(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var bf={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},xf={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Sf(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`);let i={};return af(i,e,Cf(e,t)),_f(e,sf(n,{shape:i,checks:[]}))}function Cf(e,t){let n=tf(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function wf(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`);let i=new Set(Cf(e,t)),a={};return af(a,e,Reflect.ownKeys(tf(e)).filter(e=>!i.has(e))),_f(e,sf(n,{shape:a,checks:[]}))}function Tf(e,t){if(!pf(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=tf(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return _f(e,sf(e._zod.def,{shape:Ef(e,t)}))}function Ef(e,t){let n={};return af(n,e,Reflect.ownKeys(tf(e))),of(n,t),n}function Df(e,t){if(!pf(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return _f(e,sf(e._zod.def,{shape:Ef(e,t)}))}function Of(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return af(n,e,Reflect.ownKeys(tf(e))),af(n,t,Reflect.ownKeys(tf(t))),_f(e,sf(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function kf(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Cf(t,n)):void 0,o={};return af(o,t,Reflect.ownKeys(tf(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),_f(t,sf(t._zod.def,{shape:o,checks:[]}))}function Af(e,t,n){let r=n?new Set(Cf(t,n)):void 0,i={};return af(i,t,Reflect.ownKeys(tf(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),_f(t,sf(t._zod.def,{shape:i}))}function jf(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Pf(e){return typeof e==`string`?e:e?.message}function Ff(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function If(e,t,n){var r;for(let i=t;ie;return t[$f]=!0,t}var tp,np=Object.freeze({status:`aborted`}),rp={value:void 0,enumerable:!1},ip=`captureStackTrace`in Error?Error:null;function ap(e){let t=ip;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ip=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function H(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){rp.value=new a(r);try{Object.defineProperty(n,"_zod",rp)}finally{rp.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Uf(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?ap(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var op=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},sp=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(tp=globalThis).__zod_globalConfig??(tp.__zod_globalConfig={});var cp=globalThis.__zod_globalConfig;function lp(e){return e&&Object.assign(cp,e),cp}function up(){let e=this._zod;return e.message??=JSON.stringify(e.def,Gd,2),e.message}function dp(e){this._zod.message=e}var fp={get:up,set:dp,enumerable:!0,configurable:!0},pp={value:void 0,enumerable:!1},mp=new WeakSet([Object.prototype,Error.prototype]),hp=(e,t)=>{e.name=`$ZodError`,pp.value=t,Object.defineProperty(e,"issues",pp),pp.value=void 0,Object.defineProperty(e,"message",fp);let n=Object.getPrototypeOf(e);mp.has(n)||(mp.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},gp=H(`$ZodError`,hp);H(`$ZodError`,hp,void 0,{Parent:Error});function _p(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function vp(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?_p(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function yp(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new op;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Lf(e,o,lp())));throw uf(n,a?.callee??t),n}return s.value};return t},Sp=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Lf(e,o,lp())));throw uf(n,a?.callee??t),n}return s.value};return t},Cp=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 op;return a.issues.length?wp(e,a.issues,i):{success:!0,data:a.value}};function wp(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Lf(e,n,lp()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Tp=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?wp(e,a.issues,i):{success:!0,data:a.value}},Ep=Symbol.for(`zod.compile.invalid`),Dp=Symbol.for(`zod.compile.fallback`),Op=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Ep)return!0;if(r.definite===!0&&n===void 0)return!1}return kp(e,t,n)});function kp(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Dp]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new op;return a.issues.length===0}var Ap=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},jp=e=>{let t=xp(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,bp(n,a))};return n},Mp=e=>{let t=xp(e),n=(e,r,i,a)=>t(e,r,i,bp(n,a));return n},Np=e=>{let t=Sp(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,bp(n,a))};return n},Pp=e=>{let t=Sp(e),n=async(e,r,i,a)=>await t(e,r,i,bp(n,a));return n},Fp=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Cp(e)(t,n,i)},Ip=e=>(t,n,r)=>Cp(e)(t,n,r),Lp=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Tp(e)(t,n,i)},Rp=e=>async(t,n,r)=>Tp(e)(t,n,r),zp=/^[cC][0-9a-z]{6,}$/,Bp=/^[0-9a-z]+$/,Vp=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Hp=/^[0-9a-vA-V]{20}$/,Up=/^[A-Za-z0-9]{27}$/,Wp=/^[a-zA-Z0-9_-]{21}$/;function Gp(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Kp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qp=/^([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})$/,Jp=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)$/,Yp=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Xp=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Zp(){return new RegExp(Xp,`u`)}var Qp=/^(?:(?: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])$/,$p=/^(([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}|:))$/,em=/^((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])$/,tm=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nm=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rm=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,im=/^https?$/,am=/^\+[1-9]\d{6,14}$/,om=`(?:(?:\\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])))`;function sm(e){return RegExp(`^${e}$`)}var cm=sm(om);function lm(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function um(e){return RegExp(`^${lm(e)}$`)}function dm(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${lm({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${lm({precision:e.precision})}`:n;return RegExp(`^${om}T(?:${r})$`)}var fm=/^[\s\S]{0,}$/,pm=/^-?\d+$/,mm=/^-?\d+(?:\.\d+)?$/,hm=/^(?:true|false)$/i,gm=/^null$/i,_m=/^undefined$/i,vm=/^[^A-Z]*$/,ym=/^[^a-z]*$/,bm=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),xm=e=>{let t=e.value;return!Jd(t)&&t.length!==void 0},Sm={number:`number`,bigint:`bigint`,object:`date`},Cm=H(`$ZodCheckLessThan`,(e,t)=>{bm.init(e,t);let n=Sm[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{bm.init(e,t);let n=Sm[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Sm[typeof r.value]??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})}}),Tm=H(`$ZodCheckMultipleOf`,(e,t)=>{bm.init(e,t),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`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Xd(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})}}),Em=H(`$ZodCheckNumberFormat`,(e,t)=>{bm.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=bf[t.format];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}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Dm=H(`$ZodCheckMaxLength`,(e,t)=>{var n;bm.init(e,t),(n=e._zod.def).when??(n.when=xm),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?zf(r):i)<=t.maximum)return;let a=Bf(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Om=H(`$ZodCheckMinLength`,(e,t)=>{var n;bm.init(e,t),(n=e._zod.def).when??(n.when=xm),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i=t.minimum)return;let a=Bf(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),km=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;bm.init(e,t),(n=e._zod.def).when??(n.when=xm),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?zf(r):i;if(a===t.length)return;let o=Bf(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Am=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;bm.init(e,t),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=()=>{})}),jm=H(`$ZodCheckRegex`,(e,t)=>{Am.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})}}),Mm=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=vm,Am.init(e,t)}),Nm=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ym,Am.init(e,t)}),Pm=H(`$ZodCheckIncludes`,(e,t)=>{bm.init(e,t);let n=gf(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),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})}}),Fm=H(`$ZodCheckStartsWith`,(e,t)=>{bm.init(e,t);let n=RegExp(`^${gf(t.prefix)}.*`);t.pattern??=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})}}),Im=H(`$ZodCheckEndsWith`,(e,t)=>{bm.init(e,t);let n=RegExp(`.*${gf(t.suffix)}$`);t.pattern??=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})}}),Lm=H(`$ZodCheckOverwrite`,(e,t)=>{bm.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Rm=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` `).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?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(` -`)}\n};`)(...Object.values(this.closed))}},Rm={major:4,minor:6,patch:5},zm=H(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Rm;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=jf(t),a;for(let o of n){if(o._zod.def.when){if(Mf(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new ap;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ff(t.issues,n,e),i||=jf(t,n))});else{if(t.issues.length===n)continue;Ff(t.issues,n,e),i||=jf(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(jf(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new ap;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new ap;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Wf(this,`~standard`,Hm(this))},set"~standard"(e){Uf(this,`~standard`,e)}}),Bm=(e,t)=>e.issues.length?{issues:e.issues.map(e=>If(e,t,cp()))}:{value:e.value};async function Vm(e,t){let n={async:!0};return Bm(await e._zod.run({value:t,issues:[]},n),n)}function Hm(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Bm(r,n)}catch{}return Vm(e,t)},vendor:`zod`,version:1}}var Um=H(`$ZodString`,(e,t)=>{zm.init(e,t),e._zod.pattern=t.pattern??dm,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}}),Wm=H(`$ZodStringFormat`,(e,t)=>{km.init(e,t),Um.init(e,t)}),Gm=H(`$ZodGUID`,(e,t)=>{t.pattern??=Kp,Wm.init(e,t)}),Km=H(`$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??=qp(e)}else t.pattern??=qp();Wm.init(e,t)}),qm=H(`$ZodEmail`,(e,t)=>{t.pattern??=Jp,Wm.init(e,t)});function Jm(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Ym(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Jm(e)||2:Xm(e,t)}function Xm(e,t){if(!t.normalize&&t.protocol?.source===rm.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Zm=/[\t\n\r]/g;function Qm(e){return e.replace(Zm,``)}function $m(e,t){return t.lastIndex=0,t.test(e.hostname)}function eh(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var th=H(`$ZodURL`,(e,t)=>{Wm.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Ym(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Qm(r);return}t.hostname&&!$m(i,t.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&&!eh(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Qm(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),nh=H(`$ZodEmoji`,(e,t)=>{t.pattern??=Xp(),Wm.init(e,t)}),rh=H(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Up:Wp(t.length),Wm.init(e,t)}),ih=H(`$ZodCUID`,(e,t)=>{t.pattern??=Rp,Wm.init(e,t)}),ah=H(`$ZodCUID2`,(e,t)=>{t.pattern??=zp,Wm.init(e,t)}),oh=H(`$ZodULID`,(e,t)=>{t.pattern??=Bp,Wm.init(e,t)}),sh=H(`$ZodXID`,(e,t)=>{t.pattern??=Vp,Wm.init(e,t)}),ch=H(`$ZodKSUID`,(e,t)=>{t.pattern??=Hp,Wm.init(e,t)}),lh=H(`$ZodISODateTime`,(e,t)=>{t.pattern??=um(t),Wm.init(e,t)}),uh=H(`$ZodISODate`,(e,t)=>{t.pattern??=sm,Wm.init(e,t)}),dh=H(`$ZodISOTime`,(e,t)=>{t.pattern??=lm(t),Wm.init(e,t)}),fh=H(`$ZodISODuration`,(e,t)=>{t.pattern??=Gp,Wm.init(e,t)}),ph=H(`$ZodIPv4`,(e,t)=>{t.pattern??=Zp,Wm.init(e,t)}),mh=/^[0-9a-fA-F:.]+$/;function hh(e){return mh.test(e)?Jm(`http://[${e}]`):!1}var gh=H(`$ZodIPv6`,(e,t)=>{t.pattern??=Qp,Wm.init(e,t),e._zod.check=n=>{hh(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),_h=H(`$ZodCIDRv4`,(e,t)=>{t.pattern??=$p,Wm.init(e,t)});function vh(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:hh(n)}var yh=H(`$ZodCIDRv6`,(e,t)=>{t.pattern??=em,Wm.init(e,t),e._zod.check=n=>{vh(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function bh(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var xh=/^[0-9a-zA-Z+/]*={0,2}$/,Sh=H(`$ZodBase64`,(e,t)=>{t.pattern??=xh,Wm.init(e,t),e._zod.check=n=>{bh(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Ch=/^[A-Za-z0-9_-]*$/;function wh(e){if(!Ch.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return bh(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Th=H(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ch,Wm.init(e,t),e._zod.check=n=>{wh(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Eh=H(`$ZodE164`,(e,t)=>{t.pattern??=im,Wm.init(e,t)});function Dh(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 Oh=H(`$ZodJWT`,(e,t)=>{Wm.init(e,t),e._zod.check=n=>{Dh(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),kh=H(`$ZodNumber`,(e,t)=>{zm.init(e,t),e._zod.pattern=pm,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:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Ah=H(`$ZodNumberFormat`,(e,t)=>{Tm.init(e,t),kh.init(e,t)}),jh=H(`$ZodBoolean`,(e,t)=>{zm.init(e,t),e._zod.pattern=mm,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}}),Mh=H(`$ZodUndefined`,(e,t)=>{zm.init(e,t),e._zod.pattern=gm,e._zod.values=new Set([void 0]),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}}),Nh=H(`$ZodNull`,(e,t)=>{zm.init(e,t),e._zod.pattern=hm,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}}),Ph=H(`$ZodAny`,(e,t)=>{zm.init(e,t),e._zod.parse=e=>e}),Fh=H(`$ZodUnknown`,(e,t)=>{zm.init(e,t),e._zod.parse=e=>e}),Ih=H(`$ZodNever`,(e,t)=>{zm.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Lh(e,t,n){e.issues.length&&t.issues.push(...Nf(n,e.issues)),t.value[n]=e.value}var Rh=H(`$ZodArray`,(e,t)=>{zm.init(e,t);let n=sp.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;eLh(t,r,e)));else if(Lh(c,r,e),s&&c.issues.length!==0&&jf(c))break}return o.length?Promise.all(o).then(()=>r):r}});function zh(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Nf(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Bh=[];function Vh(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Bh,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=yf(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Hh(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(jf(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>zh(e,n,i,t,d,f))):zh(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Uh=H(`$ZodObject`,(e,t)=>{zm.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=qd(()=>Vh(t));Zf(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||$d(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=df,o=t.catchall,s,c=sp.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(jf(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>zh(n,t,e,r,a,o))):zh(s,t,e,r,a,o)}return o?Hh(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Wh=H(`$ZodObjectJIT`,(e,t)=>{Uh.init(e,t);let n=e._zod.parse,r=qd(()=>Vh(t)),i=sp.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Lm([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>` +`)}\n};`)(...Object.values(this.closed))}},zm={major:4,minor:6,patch:6},Bm=H(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zm;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=jf(t),a;for(let o of n){if(o._zod.def.when){if(Mf(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new op;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(If(t.issues,n,e),i||=jf(t,n))});else{if(t.issues.length===n)continue;If(t.issues,n,e),i||=jf(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(jf(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new op;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new op;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Gf(this,`~standard`,Um(this))},set"~standard"(e){Wf(this,`~standard`,e)}}),Vm=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Lf(e,t,lp()))}:{value:e.value};async function Hm(e,t){let n={async:!0};return Vm(await e._zod.run({value:t,issues:[]},n),n)}function Um(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Vm(r,n)}catch{}return Hm(e,t)},vendor:`zod`,version:1}}var Wm=H(`$ZodString`,(e,t)=>{Bm.init(e,t),e._zod.pattern=t.pattern??fm,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}}),Gm=H(`$ZodStringFormat`,(e,t)=>{Am.init(e,t),Wm.init(e,t)}),Km=H(`$ZodGUID`,(e,t)=>{t.pattern??=qp,Gm.init(e,t)}),qm=H(`$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??=Jp(e)}else t.pattern??=Jp();Gm.init(e,t)}),Jm=H(`$ZodEmail`,(e,t)=>{t.pattern??=Yp,Gm.init(e,t)});function Ym(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Xm(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Ym(e)||2:Zm(e,t)}function Zm(e,t){if(!t.normalize&&t.protocol?.source===im.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Qm=/[\t\n\r]/g;function $m(e){return e.replace(Qm,``)}function eh(e,t){return t.lastIndex=0,t.test(e.hostname)}function th(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var nh=H(`$ZodURL`,(e,t)=>{Gm.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Xm(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=$m(r);return}t.hostname&&!eh(i,t.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&&!th(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:$m(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),rh=H(`$ZodEmoji`,(e,t)=>{t.pattern??=Zp(),Gm.init(e,t)}),ih=H(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Wp:Gp(t.length),Gm.init(e,t)}),ah=H(`$ZodCUID`,(e,t)=>{t.pattern??=zp,Gm.init(e,t)}),oh=H(`$ZodCUID2`,(e,t)=>{t.pattern??=Bp,Gm.init(e,t)}),sh=H(`$ZodULID`,(e,t)=>{t.pattern??=Vp,Gm.init(e,t)}),ch=H(`$ZodXID`,(e,t)=>{t.pattern??=Hp,Gm.init(e,t)}),lh=H(`$ZodKSUID`,(e,t)=>{t.pattern??=Up,Gm.init(e,t)}),uh=H(`$ZodISODateTime`,(e,t)=>{t.pattern??=dm(t),Gm.init(e,t)}),dh=H(`$ZodISODate`,(e,t)=>{t.pattern??=cm,Gm.init(e,t)}),fh=H(`$ZodISOTime`,(e,t)=>{t.pattern??=um(t),Gm.init(e,t)}),ph=H(`$ZodISODuration`,(e,t)=>{t.pattern??=Kp,Gm.init(e,t)}),mh=H(`$ZodIPv4`,(e,t)=>{t.pattern??=Qp,Gm.init(e,t)}),hh=/^[0-9a-fA-F:.]+$/;function gh(e){return hh.test(e)?Ym(`http://[${e}]`):!1}var _h=H(`$ZodIPv6`,(e,t)=>{t.pattern??=$p,Gm.init(e,t),e._zod.check=n=>{gh(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),vh=H(`$ZodCIDRv4`,(e,t)=>{t.pattern??=em,Gm.init(e,t)});function yh(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:gh(n)}var bh=H(`$ZodCIDRv6`,(e,t)=>{t.pattern??=tm,Gm.init(e,t),e._zod.check=n=>{yh(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function xh(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Sh=/^[0-9a-zA-Z+/]*={0,2}$/,Ch=H(`$ZodBase64`,(e,t)=>{t.pattern??=Sh,Gm.init(e,t),e._zod.check=n=>{xh(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),wh=/^[A-Za-z0-9_-]*$/;function Th(e){if(!wh.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return xh(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Eh=H(`$ZodBase64URL`,(e,t)=>{t.pattern??=wh,Gm.init(e,t),e._zod.check=n=>{Th(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Dh=H(`$ZodE164`,(e,t)=>{t.pattern??=am,Gm.init(e,t)});function Oh(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 kh=H(`$ZodJWT`,(e,t)=>{Gm.init(e,t),e._zod.check=n=>{Oh(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Ah=H(`$ZodNumber`,(e,t)=>{Bm.init(e,t),e._zod.pattern=mm,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:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),jh=H(`$ZodNumberFormat`,(e,t)=>{Em.init(e,t),Ah.init(e,t)}),Mh=H(`$ZodBoolean`,(e,t)=>{Bm.init(e,t),e._zod.pattern=hm,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}}),Nh=H(`$ZodUndefined`,(e,t)=>{Bm.init(e,t),e._zod.pattern=_m,e._zod.values=new Set([void 0]),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}}),Ph=H(`$ZodNull`,(e,t)=>{Bm.init(e,t),e._zod.pattern=gm,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}}),Fh=H(`$ZodAny`,(e,t)=>{Bm.init(e,t),e._zod.parse=e=>e}),Ih=H(`$ZodUnknown`,(e,t)=>{Bm.init(e,t),e._zod.parse=e=>e}),Lh=H(`$ZodNever`,(e,t)=>{Bm.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Rh(e,t){let n=Ff(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Ff(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,If(n.issues,t,e),n}}return i(n,a)}}var zh=e=>Array.isArray(e)?e.length:-1;function Bh(e,t,n){e.issues.length&&t.issues.push(...Nf(n,e.issues)),t.value[n]=e.value}var Vh=H(`$ZodArray`,(e,t)=>{Bm.init(e,t);let n=cp.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;eBh(t,r,e)));else if(Bh(c,r,e),s&&c.issues.length!==0&&jf(c))break}return o.length?Promise.all(o).then(()=>r):r},Rh(e,zh)});function Hh(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Nf(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Uh=[];function Wh(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Uh,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=yf(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Gh(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(jf(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Hh(e,n,i,t,d,f))):Hh(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Kh=H(`$ZodObject`,(e,t)=>{Bm.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=qd(()=>Wh(t));Qf(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||$d(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=df,o=t.catchall,s,c=cp.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(jf(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Hh(n,t,e,r,a,o))):Hh(s,t,e,r,a,o)}return o?Gh(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),qh=H(`$ZodObjectJIT`,(e,t)=>{Kh.init(e,t);let n=e._zod.parse,r=qd(()=>Wh(t)),i=cp.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Rm([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>` let ${e}_ab = false; for (let i = 0; i < ${e}.issues.length; i++) { const iss = ${e}.issues[i]; @@ -103,11 +103,11 @@ Error generating stack: `+e.message+` newResult[${r}] = ${n}.value; } - `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=df,c=!sp.jitless,l=c&&ff.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Hh([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Gh(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=>!jf(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=>If(e,r,cp())))}),t)}var Kh=H(`$ZodUnion`,(e,t)=>{zm.init(e,t),Zf(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),Zf(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Zf(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),Zf(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Yd(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Gh(t,r,e,i)):Gh(o,r,e,i)}});function qh(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Jh=H(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Kh.init(e,t);let n=e._zod.parse;Zf(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||$d(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=ef(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=qd(()=>qh(t));e._zod.parse=(i,a)=>{let o=i.value;if(!df(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Yh=H(`$ZodIntersection`,(e,t)=>{zm.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])=>Zh(e,t,n)):Zh(e,i,a)}});function Xh(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(pf(e)&&pf(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Xh(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{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Xh(t.value,n.value);if(!c.valid){if(jf(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Qh=H(`$ZodRecord`,(e,t)=>{zm.init(e,t);let n=sp.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!pf(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>If(e,i,cp())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Nf(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Nf(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&pm.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>If(e,i,cp())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Nf(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Nf(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),$h=H(`$ZodEnum`,(e,t)=>{zm.init(e,t);let n=Ud(t.entries),r=new Set(n);e._zod.values=r,Zf(e,`pattern`,e=>{let t=Ud(e.def.entries).filter(e=>hf.has(typeof e));return RegExp(t.length?`^(${t.map(e=>gf(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),eg=H(`$ZodLiteral`,(e,t)=>{zm.init(e,t);let n=new Set(t.values);e._zod.values=n,Zf(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?gf(e):e?gf(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),tg=H(`$ZodTransform`,(e,t)=>{zm.init(e,t),e._zod.optin=`optional`,sp.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new op(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 ap;return n.value=i,n}});function ng(e,t){return e.value=t.issues.length?void 0:t.value,e}var rg=H(`$ZodOptional`,(e,t)=>{zm.init(e,t),Zf(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,Zf(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),Zf(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Yd(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ng(e,t)):ng(e,r)}return t.innerType._zod.run(e,n)}}),ig=H(`$ZodExactOptional`,(e,t)=>{rg.init(e,t),Zf(e,`values`,e=>e.def.innerType._zod.values),Zf(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ag=H(`$ZodNullable`,(e,t)=>{zm.init(e,t),Zf(e,`optin`,e=>e.def.innerType._zod.optin),Zf(e,`optout`,e=>e.def.innerType._zod.optout),Zf(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Yd(t.source)}|null)$`):void 0}),Zf(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),og=H(`$ZodDefault`,(e,t)=>{zm.init(e,t),e._zod.optin=`defaulted`,Zf(e,`values`,e=>e.def.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=>sg(e,t)):sg(r,t)}});function sg(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var cg=H(`$ZodPrefault`,(e,t)=>{zm.init(e,t),e._zod.optin=`defaulted`,Zf(e,`values`,e=>e.def.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))}),lg=H(`$ZodNonOptional`,(e,t)=>{zm.init(e,t),Zf(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>ug(t,e)):ug(i,e)}});function ug(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function dg(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>If(e,r,cp()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var fg=H(`$ZodCatch`,(e,t)=>{zm.init(e,t),Zf(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),Zf(e,`optout`,e=>e.def.innerType._zod.optout),Zf(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>dg(e,r,t,n)):dg(e,r,t,n)}}),pg=H(`$ZodPipe`,(e,t)=>{zm.init(e,t),Zf(e,`values`,e=>e.def.in._zod.values),Zf(e,`optin`,e=>e.def.in._zod.optin),Zf(e,`optout`,e=>e.def.out._zod.optout),Zf(e,`propValues`,e=>e.def.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=>mg(e,t.in,n)):mg(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>mg(e,t.out,n)):mg(r,t.out,n)}});function mg(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var hg=H(`$ZodPreprocess`,(e,t)=>{pg.init(e,t)}),gg=H(`$ZodReadonly`,(e,t)=>{zm.init(e,t),Zf(e,`propValues`,e=>e.def.innerType._zod.propValues),Zf(e,`values`,e=>e.def.innerType._zod.values),Zf(e,`optin`,e=>e.def.innerType?._zod?.optin),Zf(e,`optout`,e=>e.def.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(_g):_g(r)}});function _g(e){return e.memo||(e.value=Object.freeze(e.value)),e}var vg=H(`$ZodLazy`,(e,t)=>{zm.init(e,t),Qd(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Zf(e,`pattern`,e=>e.innerType?._zod?.pattern),Zf(e,`propValues`,e=>e.innerType?._zod?.propValues),Zf(e,`optin`,e=>e.innerType?._zod?.optin??void 0),Zf(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),yg=H(`$ZodCustom`,(e,t)=>{ym.init(e,t),zm.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=>bg(t,n,r,e));bg(i,n,r,e)}});function bg(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(Vf(e))}}var xg=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Sg=`~memo`,Cg=[];function wg(e){return typeof e==`object`&&!!e}function Tg(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Eg=new WeakMap,Dg=0,Og=1,kg=2;function Ag(e,t,n){let r=Eg.get(e);if(r!==void 0)return r?kg:Dg;if(t.has(e))return kg;t.add(e);let i=Dg,a=e=>{if(i!==kg&&e?._zod){let r=Ag(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Dg;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Og:o.value?._zod?Ag(o.value,t,n):Dg;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ef(c);s(e?o(e,!0):Og),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Ag(r,t,!1):Og);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),jg(e,i)}function jg(e,t){return t!==Og&&Eg.set(e,t===kg),t}function Mg(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ng,Pg=[],Fg={alloc(e,t,n){let r=Ng;if(!r)return n;Ng=void 0;let i={value:n,issues:null};return r.set(t.value,i),Pg.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Lg(n,e.value))throw new xg;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Ag(e,new Set,!1);if(i===Dg)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===kg||r?n=!0:r=!0}let l=s.value;if(!wg(l))return t(s,c);let u=c[Sg];u||(u={buckets:new WeakMap,backEdges:void 0},c[Sg]=u);let d;i===c?d=a:(d=Mg(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Tg(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ng=d;let p=Pg.length,m=t(s,c);Ng=void 0;let h=Pg.length>p?Pg.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Tg(e.issues):Cg),e)):(h&&(h.issues=m.issues.length?Tg(m.issues):Cg),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ig(){return Fg}function Lg(e,t){let n=e[Sg]?.backEdges;return n!==void 0&&wg(t)&&n.has(t)}var Rg=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Bf(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${vf(e.values[0])}`:`Invalid option: expected one of ${Wd(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Wd(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function zg(){return{localeError:Rg()}}var Bg,Vg=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 Hg(){return new Vg}(Bg=globalThis).__zod_globalRegistry??(Bg.__zod_globalRegistry=Hg());var Ug=globalThis.__zod_globalRegistry;function Wg(e){return e.checks&&=[...e.checks],e}function Gg(e,t){return new e(Wg({type:`string`,...B(t)}))}function Kg(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...B(t)})}function qg(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...B(t)})}function Jg(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...B(t)})}function Yg(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...B(t)})}function Xg(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...B(t)})}function Zg(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...B(t)})}function Qg(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...B(t)})}function $g(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...B(t)})}function e_(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...B(t)})}function t_(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...B(t)})}function n_(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...B(t)})}function r_(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...B(t)})}function i_(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...B(t)})}function a_(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...B(t)})}function o_(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...B(t)})}function s_(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...B(t)})}function c_(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...B(t)})}function l_(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...B(t)})}function u_(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...B(t)})}function d_(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...B(t)})}function f_(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...B(t)})}function p_(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...B(t)})}function m_(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...B(t)})}function h_(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...B(t)})}function g_(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...B(t)})}function __(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...B(t)})}function v_(e,t){return new e(Wg({type:`number`,checks:[],...B(t)}))}function y_(e,t){return new e(Wg({type:`number`,coerce:!0,checks:[],...B(t)}))}function b_(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...B(t)})}function x_(e,t){return new e({type:`boolean`,...B(t)})}function S_(e,t){return new e({type:`undefined`,...B(t)})}function C_(e,t){return new e({type:`null`,...B(t)})}function w_(e){return new e({type:`any`})}function T_(e){return new e({type:`unknown`})}function E_(e,t){return new e({type:`never`,...B(t)})}function D_(e,t){return new Sm({check:`less_than`,...B(t),value:e,inclusive:!1})}function O_(e,t){return new Sm({check:`less_than`,...B(t),value:e,inclusive:!0})}function k_(e,t){return new Cm({check:`greater_than`,...B(t),value:e,inclusive:!1})}function A_(e,t){return new Cm({check:`greater_than`,...B(t),value:e,inclusive:!0})}function j_(e,t){return new wm({check:`multiple_of`,...B(t),value:e})}function M_(e,t){return new Em({check:`max_length`,...B(t),maximum:e})}function N_(e,t){return new Dm({check:`min_length`,...B(t),minimum:e})}function P_(e,t){return new Om({check:`length_equals`,...B(t),length:e})}function F_(e,t){return new Am({check:`string_format`,format:`regex`,...B(t),pattern:e})}function I_(e){return new jm({check:`string_format`,format:`lowercase`,...B(e)})}function L_(e){return new Mm({check:`string_format`,format:`uppercase`,...B(e)})}function R_(e,t){return new Nm({check:`string_format`,format:`includes`,...B(t),includes:e})}function z_(e,t){return new Pm({check:`string_format`,format:`starts_with`,...B(t),prefix:e})}function B_(e,t){return new Fm({check:`string_format`,format:`ends_with`,...B(t),suffix:e})}function V_(e){return new Im({check:`overwrite`,tx:e})}function H_(e){return V_(t=>t.normalize(e))}function U_(){return V_(e=>e.trim())}function W_(){return V_(e=>e.toLowerCase())}function G_(){return V_(e=>e.toUpperCase())}function K_(){return V_(e=>lf(e))}function q_(e,t,n){return new e({type:`array`,element:t,...B(n)})}function J_(e,t,n){let r=B(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Y_(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...B(n)})}function X_(e,t){let n=Z_(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Vf(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Vf(r))}},e(t.value,t)),t);return n}function Z_(e,t){let n=new ym({check:`custom`,...B(t)});return n._zod.check=e,n}function Q_(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&$d(e,t,n[t]);return e}function $_(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??Ug,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function ev(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function tv(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,tv(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Q_(o.schema,c),t.io===`input`&&dv(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function nv(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function rv(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${nv(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+nv(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(`/`)}/ + `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=df,c=!cp.jitless,l=c&&ff.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Gh([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Jh(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=>!jf(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=>Lf(e,r,lp())))}),t)}var Yh=H(`$ZodUnion`,(e,t)=>{Bm.init(e,t),Qf(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),Qf(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Qf(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),Qf(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Yd(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Jh(t,r,e,i)):Jh(o,r,e,i)}});function Xh(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Zh=H(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Yh.init(e,t);let n=e._zod.parse;Qf(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||$d(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=ef(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=qd(()=>Xh(t));e._zod.parse=(i,a)=>{let o=i.value;if(!df(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Qh=H(`$ZodIntersection`,(e,t)=>{Bm.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])=>eg(e,t,n)):eg(e,i,a)}});function $h(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(pf(e)&&pf(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=$h(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{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=$h(t.value,n.value);if(!c.valid){if(jf(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var tg=H(`$ZodRecord`,(e,t)=>{Bm.init(e,t);let n=cp.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!pf(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Lf(e,i,lp())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Nf(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Nf(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&mm.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Lf(e,i,lp())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Nf(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Nf(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),ng=H(`$ZodEnum`,(e,t)=>{Bm.init(e,t);let n=Ud(t.entries),r=new Set(n);e._zod.values=r,Qf(e,`pattern`,e=>{let t=Ud(e.def.entries).filter(e=>hf.has(typeof e));return RegExp(t.length?`^(${t.map(e=>gf(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),rg=H(`$ZodLiteral`,(e,t)=>{Bm.init(e,t);let n=new Set(t.values);e._zod.values=n,Qf(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?gf(e):e?gf(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),ig=H(`$ZodTransform`,(e,t)=>{Bm.init(e,t),e._zod.optin=`optional`,cp.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new sp(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 op;return n.value=i,n}});function ag(e,t){return e.value=t.issues.length?void 0:t.value,e}var og=H(`$ZodOptional`,(e,t)=>{Bm.init(e,t),Qf(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,Qf(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),Qf(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Yd(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ag(e,t)):ag(e,r)}return t.innerType._zod.run(e,n)}}),sg=H(`$ZodExactOptional`,(e,t)=>{og.init(e,t),Qf(e,`values`,e=>e.def.innerType._zod.values),Qf(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),cg=H(`$ZodNullable`,(e,t)=>{Bm.init(e,t),Qf(e,`optin`,e=>e.def.innerType._zod.optin),Qf(e,`optout`,e=>e.def.innerType._zod.optout),Qf(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Yd(t.source)}|null)$`):void 0}),Qf(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),lg=H(`$ZodDefault`,(e,t)=>{Bm.init(e,t),e._zod.optin=`defaulted`,Qf(e,`values`,e=>e.def.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=>ug(e,t)):ug(r,t)}});function ug(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var dg=H(`$ZodPrefault`,(e,t)=>{Bm.init(e,t),e._zod.optin=`defaulted`,Qf(e,`values`,e=>e.def.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))}),fg=H(`$ZodNonOptional`,(e,t)=>{Bm.init(e,t),Qf(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>pg(t,e)):pg(i,e)}});function pg(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function mg(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Lf(e,r,lp()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var hg=H(`$ZodCatch`,(e,t)=>{Bm.init(e,t),Qf(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),Qf(e,`optout`,e=>e.def.innerType._zod.optout),Qf(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>mg(e,r,t,n)):mg(e,r,t,n)}}),gg=H(`$ZodPipe`,(e,t)=>{Bm.init(e,t),Qf(e,`values`,e=>e.def.in._zod.values),Qf(e,`optin`,e=>e.def.in._zod.optin),Qf(e,`optout`,e=>e.def.out._zod.optout),Qf(e,`propValues`,e=>e.def.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=>_g(e,t.in,n)):_g(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>_g(e,t.out,n)):_g(r,t.out,n)}});function _g(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var vg=H(`$ZodPreprocess`,(e,t)=>{gg.init(e,t)}),yg=H(`$ZodReadonly`,(e,t)=>{Bm.init(e,t),Qf(e,`propValues`,e=>e.def.innerType._zod.propValues),Qf(e,`values`,e=>e.def.innerType._zod.values),Qf(e,`optin`,e=>e.def.innerType?._zod?.optin),Qf(e,`optout`,e=>e.def.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(bg):bg(r)}});function bg(e){return e.memo||(e.value=Object.freeze(e.value)),e}var xg=H(`$ZodLazy`,(e,t)=>{Bm.init(e,t),Qd(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Qf(e,`pattern`,e=>e.innerType?._zod?.pattern),Qf(e,`propValues`,e=>e.innerType?._zod?.propValues),Qf(e,`optin`,e=>e.innerType?._zod?.optin??void 0),Qf(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Sg=H(`$ZodCustom`,(e,t)=>{bm.init(e,t),Bm.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=>Cg(t,n,r,e));Cg(i,n,r,e)}});function Cg(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(Hf(e))}}var wg=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Tg=`~memo`,Eg=[];function Dg(e){return typeof e==`object`&&!!e}function Og(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var kg=new WeakMap,Ag=0,jg=1,Mg=2;function Ng(e,t,n){let r=kg.get(e);if(r!==void 0)return r?Mg:Ag;if(t.has(e))return Mg;t.add(e);let i=Ag,a=e=>{if(i!==Mg&&e?._zod){let r=Ng(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Ag;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?jg:o.value?._zod?Ng(o.value,t,n):Ag;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ef(c);s(e?o(e,!0):jg),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Ng(r,t,!1):jg);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Pg(e,i)}function Pg(e,t){return t!==jg&&kg.set(e,t===Mg),t}function Fg(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ig,Lg=[],Rg={alloc(e,t,n){let r=Ig;if(!r)return n;Ig=void 0;let i={value:n,issues:null};return r.set(t.value,i),Lg.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Bg(n,e.value))throw new wg;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Ng(e,new Set,!1);if(i===Ag)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Mg||r?n=!0:r=!0}let l=s.value;if(!Dg(l))return t(s,c);let u=c[Tg];u||(u={buckets:new WeakMap,backEdges:void 0},c[Tg]=u);let d;i===c?d=a:(d=Fg(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Og(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ig=d;let p=Lg.length,m=t(s,c);Ig=void 0;let h=Lg.length>p?Lg.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Og(e.issues):Eg),e)):(h&&(h.issues=m.issues.length?Og(m.issues):Eg),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function zg(){return Rg}function Bg(e,t){let n=e[Tg]?.backEdges;return n!==void 0&&Dg(t)&&n.has(t)}var Vg=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Vf(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${vf(e.values[0])}`:`Invalid option: expected one of ${Wd(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Wd(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Hg(){return{localeError:Vg()}}var Ug,Wg=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 Gg(){return new Wg}(Ug=globalThis).__zod_globalRegistry??(Ug.__zod_globalRegistry=Gg());var Kg=globalThis.__zod_globalRegistry;function qg(e){return e.checks&&=[...e.checks],e}function Jg(e,t){return new e(qg({type:`string`,...B(t)}))}function Yg(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...B(t)})}function Xg(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...B(t)})}function Zg(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...B(t)})}function Qg(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...B(t)})}function $g(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...B(t)})}function e_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...B(t)})}function t_(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...B(t)})}function n_(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...B(t)})}function r_(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...B(t)})}function i_(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...B(t)})}function a_(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...B(t)})}function o_(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...B(t)})}function s_(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...B(t)})}function c_(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...B(t)})}function l_(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...B(t)})}function u_(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...B(t)})}function d_(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...B(t)})}function f_(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...B(t)})}function p_(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...B(t)})}function m_(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...B(t)})}function h_(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...B(t)})}function g_(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...B(t)})}function __(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...B(t)})}function v_(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...B(t)})}function y_(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...B(t)})}function b_(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...B(t)})}function x_(e,t){return new e(qg({type:`number`,checks:[],...B(t)}))}function S_(e,t){return new e(qg({type:`number`,coerce:!0,checks:[],...B(t)}))}function C_(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...B(t)})}function w_(e,t){return new e({type:`boolean`,...B(t)})}function T_(e,t){return new e({type:`undefined`,...B(t)})}function E_(e,t){return new e({type:`null`,...B(t)})}function D_(e){return new e({type:`any`})}function O_(e){return new e({type:`unknown`})}function k_(e,t){return new e({type:`never`,...B(t)})}function A_(e,t){return new Cm({check:`less_than`,...B(t),value:e,inclusive:!1})}function j_(e,t){return new Cm({check:`less_than`,...B(t),value:e,inclusive:!0})}function M_(e,t){return new wm({check:`greater_than`,...B(t),value:e,inclusive:!1})}function N_(e,t){return new wm({check:`greater_than`,...B(t),value:e,inclusive:!0})}function P_(e,t){return new Tm({check:`multiple_of`,...B(t),value:e})}function F_(e,t){return new Dm({check:`max_length`,...B(t),maximum:e})}function I_(e,t){return new Om({check:`min_length`,...B(t),minimum:e})}function L_(e,t){return new km({check:`length_equals`,...B(t),length:e})}function R_(e,t){return new jm({check:`string_format`,format:`regex`,...B(t),pattern:e})}function z_(e){return new Mm({check:`string_format`,format:`lowercase`,...B(e)})}function B_(e){return new Nm({check:`string_format`,format:`uppercase`,...B(e)})}function V_(e,t){return new Pm({check:`string_format`,format:`includes`,...B(t),includes:e})}function H_(e,t){return new Fm({check:`string_format`,format:`starts_with`,...B(t),prefix:e})}function U_(e,t){return new Im({check:`string_format`,format:`ends_with`,...B(t),suffix:e})}function W_(e){return new Lm({check:`overwrite`,tx:e})}function G_(e){return W_(t=>t.normalize(e))}function K_(){return W_(e=>e.trim())}function q_(){return W_(e=>e.toLowerCase())}function J_(){return W_(e=>e.toUpperCase())}function Y_(){return W_(e=>lf(e))}function X_(e,t,n){return new e({type:`array`,element:t,...B(n)})}function Z_(e,t,n){let r=B(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Q_(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...B(n)})}function $_(e,t){let n=ev(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Hf(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Hf(r))}},e(t.value,t)),t);return n}function ev(e,t){let n=new bm({check:`custom`,...B(t)});return n._zod.check=e,n}function tv(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&$d(e,t,n[t]);return e}function nv(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??Kg,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function rv(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function iv(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,iv(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&tv(o.schema,c),t.io===`input`&&mv(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function av(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function ov(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${av(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+av(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(`/`)}/ -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}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function iv(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;iv(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var av=new Set([`type`,`properties`,`required`,`additionalProperties`]),ov=[`oneOf`,`anyOf`];function sv(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function cv(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!av.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??sv(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}$d(n,r,e.length===1?e[0]:cv(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=sv(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function lv(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of av)if(t in e)return;let n=t.filter(e=>ov.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=cv(t);else{let e=n[0],i=ov.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>cv([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Q_(e,r))}function uv(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)):Q_(i,s),Q_(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())iv(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])lv(e)}}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)}Q_(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,$d(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:pv(t,`input`,e.processors),output:pv(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function dv(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 dv(r.element,n);if(r.type===`set`)return dv(r.valueType,n);if(r.type===`lazy`)return dv(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`||r.type===`catch`)return dv(r.innerType,n);if(r.type===`intersection`)return dv(r.left,n)||dv(r.right,n);if(r.type===`record`||r.type===`map`)return dv(r.keyType,n)||dv(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:dv(r.in,n)||dv(r.out,n);if(r.type===`object`){for(let e in r.shape)if(dv(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(dv(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(dv(e,n))return!0;return!!(r.rest&&dv(r.rest,n))}return!1}var fv=(e,t={})=>n=>{let r=$_({...n,processors:t});return tv(e,r),rv(r,e),uv(r,e)},pv=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=$_({...i??{},target:a,io:t,processors:n});return tv(e,o),rv(o,e),uv(o,e)},mv=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},hv=(e,t,n)=>{(e[t]===void 0||n{mv(e,`minimum`,t),hv(e,`maximum`,t)},_v=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},vv=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},yv=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},bv=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},xv=(e,t)=>mv(e,`minimum`,t.minimum),Sv=(e,t)=>hv(e,`maximum`,t.maximum),Cv=e=>(t,n)=>{bv(t,n.format);let[r,i]=e[n.format];mv(t,`minimum`,r),hv(t,`maximum`,i)},wv={greater_than:(e,t)=>mv(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>hv(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>_v(e,t.value),number_format:Cv(bf),bigint_format:Cv(xf),min_length:xv,max_length:Sv,length_equals:(e,t)=>gv(e,t.length),min_size:xv,max_size:Sv,size_equals:(e,t)=>gv(e,t.size),string_format:(e,t)=>{bv(e,t.format),t.pattern&&vv(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>yv(e,t.mime)};function Tv(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)wv[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&mv(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&mv(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&hv(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&hv(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&_v(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&yv(t,i.mime);for(let e of i.patterns??[])vv(t,e);return t}var Ev={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Dv=new Map([[xh,tm],[Ch,nm]]),Ov=e=>Dv.get(e)??e,kv=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Tv(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ev[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Ov);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}))])}},Av=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Tv(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):ev(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},jv=(e,t,n,r)=>{n.type=`boolean`},Mv=(e,t,n,r)=>{ev(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Nv=(e,t,n,r)=>{ev(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},Pv=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Fv=(e,t,n,r)=>{ev(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Iv=(e,t,n,r)=>{ev(e,t,n,r,`Void cannot be represented in JSON Schema`)},Lv=(e,t,n,r)=>{n.not={}},Rv=(e,t,n,r)=>{},zv=(e,t,n,r)=>{},Bv=(e,t,n,r)=>{ev(e,t,n,r,`Date cannot be represented in JSON Schema`)},Vv=(e,t,n,r)=>{let i=e._zod.def,a=Ud(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Hv=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(ev(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(ev(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},Uv=(e,t,n,r)=>{ev(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Wv=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Gv=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=Tv(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},Kv=(e,t,n,r)=>{n.type=`boolean`},qv=(e,t,n,r)=>{ev(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Jv=(e,t,n,r)=>{ev(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Yv=(e,t,n,r)=>{ev(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Xv=(e,t,n,r)=>{ev(e,t,n,r,`Map cannot be represented in JSON Schema`)},Zv=(e,t,n,r)=>{ev(e,t,n,r,`Set cannot be represented in JSON Schema`)},Qv=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Tv(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=tv(a.element,t,{...r,path:[...r.path,`items`]})};function $v(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?$v(t.out):t.type===`catch`?$v(t.innerType):e._zod.optin}var ey=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&ev(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)$d(i.properties,e,tv(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?$v(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=tv(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ty=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>tv(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ny=(e,t,n,r)=>{let i=e._zod.def,a=tv(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=tv(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},ry=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>tv(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?tv(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?$v(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=Tv(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function iy(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=iy(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>iy(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?pm:fm).source),p):p}var ay=new WeakMap;function oy(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of ay.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=iy(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var sy=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Tv(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=tv(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)$d(i.patternProperties,Ov(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=tv(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=ay.get(t);n||(n=[],ay.set(t,n),t.deferred.push(()=>oy(t))),n.push(e)}i.additionalProperties=tv(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&$v(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},cy=(e,t,n,r)=>{let i=e._zod.def,a=tv(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`}]},ly=(e,t,n,r)=>{let i=e._zod.def;tv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},uy=Symbol();function dy(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(ev(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),uy):JSON.parse(o)}var fy=(e,t,n,r)=>{let i=e._zod.def;tv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=dy(i.defaultValue,e,t,n,r);o!==uy&&(n.default=o)},py=(e,t,n,r)=>{let i=e._zod.def;tv(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=dy(i.defaultValue,e,t,n,r);o!==uy&&(n._prefault=o)},my=(e,t,n,r)=>{let i=e._zod.def;tv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{ev(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},hy=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;tv(o,t,r);let s=t.seen.get(e);s.ref=o},gy=(e,t,n,r)=>{let i=e._zod.def;tv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},_y=(e,t,n,r)=>{let i=e._zod.def;tv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},vy=(e,t,n,r)=>{let i=e._zod.def;tv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},yy=(e,t,n,r)=>{let i=e._zod.innerType;tv(i,t,r);let a=t.seen.get(e);a.ref=i},by={string:kv,number:Av,boolean:jv,bigint:Mv,symbol:Nv,null:Pv,undefined:Fv,void:Iv,never:Lv,any:Rv,unknown:zv,date:Bv,enum:Vv,literal:Hv,nan:Uv,template_literal:Wv,file:Gv,success:Kv,custom:qv,function:Jv,transform:Yv,map:Xv,set:Zv,array:Qv,object:ey,union:ty,intersection:ny,tuple:ry,record:sy,nullable:cy,nonoptional:ly,default:fy,prefault:py,catch:my,pipe:hy,readonly:gy,promise:_y,optional:vy,lazy:yy};function xy(e,t){if(`_idmap`in e){let n=e,r=$_({...t,processors:by}),i={};for(let e of n._idmap.entries()){let[t,n]=e;tv(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;rv(r,n),$d(a,t,uv(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=$_({...t,processors:by});return tv(e,n),rv(n,e),uv(n,e)}var Sy=new WeakSet([Object.prototype,Error.prototype]);function Cy(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var wy=H(`ZodError`,(e,t)=>{hp.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Sy.has(n)||(Sy.add(n),Cy(n,`format`,e=>t=>vp(e,t)),Cy(n,`flatten`,e=>t=>_p(e,t)),Cy(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Gd,2)}),Cy(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Gd,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Ty=bp(wy),Ey=xp(wy),Dy=Sp(wy),Oy=wp(wy),ky=Ap(wy),Ay=jp(wy),jy=Mp(wy),My=Np(wy),Ny=Pp(wy),Py=Fp(wy),Fy=Ip(wy),Iy=Lp(wy);function Ly(){sp.localeError||cp(zg())}function Ry(){sp.memoizer||cp({memoizer:Ig()})}var zy=H(`ZodType`,(e,t)=>(Ly(),zm.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(sf(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return _f(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(mx(e,t))},superRefine(e,t){return this.check(hx(e,t))},overwrite(e){return this.check(V_(e))},optional(){return Kb(this)},exactOptional(){return Jb(this)},nullable(){return Xb(this)},nullish(){return Kb(Xb(this))},nonoptional(e){return nx(this,e)},array(){return kb(this)},or(e){return Nb([this,e])},and(e){return Lb(this,e)},transform(e){return ox(this,Wb(e))},default(e){return Qb(this,e)},prefault(e){return ex(this,e)},catch(e){return ix(this,e)},pipe(e){return ox(this,e)},readonly(){return lx(this)},describe(e){let t=this.clone();return Ug.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ug.get(this);let t=this.clone();return Ug.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Wf(this,`~standard`,{...Hm(this),jsonSchema:{input:pv(this,`input`),output:pv(this,`output`)}})},set"~standard"(e){Uf(this,`~standard`,e)},parse:function e(t,n){return Ty(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ey(this,t,n,{callee:e})},safeParse(e,t){return Dy(this,e,t)},async safeParseAsync(e,t){return Oy(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Uf(this,`spa`,e)},validate(e,t){return Dp(this,e,t)},validateAsync(e,t){return kp(this,e,t)},encode:function e(t,n){return ky(this,t,n,{callee:e})},decode:function e(t,n){return Ay(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await jy(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await My(this,t,n,{callee:e})},safeEncode(e,t){return Ny(this,e,t)},safeDecode(e,t){return Py(this,e,t)},async safeEncodeAsync(e,t){return Fy(this,e,t)},async safeDecodeAsync(e,t){return Iy(this,e,t)},toJSONSchema(e){return fv(this,{})(e)},get description(){return Ug.get(this)?.description},get _def(){return this._zod.def}}),By=H(`_ZodString`,(e,t)=>{Um.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kv(e,t,n,r)},Gf({format:e=>Tv(e).format??null,minLength:e=>Tv(e).minimum??null,maxLength:e=>Tv(e).maximum??null},{regex(...e){return this.check(F_(...e))},includes(...e){return this.check(R_(...e))},startsWith(...e){return this.check(z_(...e))},endsWith(...e){return this.check(B_(...e))},min(...e){return this.check(N_(...e))},max(...e){return this.check(M_(...e))},length(...e){return this.check(P_(...e))},nonempty(...e){return this.check(N_(1,...e))},lowercase(e){return this.check(I_(e))},uppercase(e){return this.check(L_(e))},trim(){return this.check(U_())},normalize(...e){return this.check(H_(...e))},toLowerCase(){return this.check(W_())},toUpperCase(){return this.check(G_())},slugify(){return this.check(K_())}})),Vy=H(`ZodString`,(e,t)=>{Um.init(e,t),By.init(e,t)},{email(e){return this.check(Kg(qy,e))},url(e){return this.check(Qg(Zy,e))},jwt(e){return this.check(p_(pb,e))},emoji(e){return this.check($g($y,e))},guid(e){return this.check(qg(Yy,e))},uuid(e){return this.check(Jg(Xy,e))},uuidv4(e){return this.check(Yg(Xy,e))},uuidv6(e){return this.check(Xg(Xy,e))},uuidv7(e){return this.check(Zg(Xy,e))},nanoid(e){return this.check(e_(eb,e))},cuid(e){return this.check(t_(tb,e))},cuid2(e){return this.check(n_(nb,e))},ulid(e){return this.check(r_(rb,e))},base64(e){return this.check(u_(ub,e))},base64url(e){return this.check(d_(db,e))},xid(e){return this.check(i_(ib,e))},ksuid(e){return this.check(a_(ab,e))},ipv4(e){return this.check(o_(ob,e))},ipv6(e){return this.check(s_(sb,e))},cidrv4(e){return this.check(c_(cb,e))},cidrv6(e){return this.check(l_(lb,e))},e164(e){return this.check(f_(fb,e))},datetime(e){return this.check(m_(Uy,e))},date(e){return this.check(h_(Wy,e))},time(e){return this.check(g_(Gy,e))},duration(e){return this.check(__(Ky,e))}});function U(e){return Gg(Vy,e)}var Hy=H(`ZodStringFormat`,(e,t)=>{Wm.init(e,t),By.init(e,t)}),Uy=H(`ZodISODateTime`,(e,t)=>{lh.init(e,t),Hy.init(e,t)}),Wy=H(`ZodISODate`,(e,t)=>{uh.init(e,t),Hy.init(e,t)}),Gy=H(`ZodISOTime`,(e,t)=>{dh.init(e,t),Hy.init(e,t)}),Ky=H(`ZodISODuration`,(e,t)=>{fh.init(e,t),Hy.init(e,t)}),qy=H(`ZodEmail`,(e,t)=>{qm.init(e,t),Hy.init(e,t)});function Jy(e){return Kg(qy,e)}var Yy=H(`ZodGUID`,(e,t)=>{Gm.init(e,t),Hy.init(e,t)}),Xy=H(`ZodUUID`,(e,t)=>{Km.init(e,t),Hy.init(e,t)}),Zy=H(`ZodURL`,(e,t)=>{th.init(e,t),Hy.init(e,t)});function Qy(e){return Qg(Zy,e)}var $y=H(`ZodEmoji`,(e,t)=>{nh.init(e,t),Hy.init(e,t)}),eb=H(`ZodNanoID`,(e,t)=>{rh.init(e,t),Hy.init(e,t)}),tb=H(`ZodCUID`,(e,t)=>{ih.init(e,t),Hy.init(e,t)}),nb=H(`ZodCUID2`,(e,t)=>{ah.init(e,t),Hy.init(e,t)}),rb=H(`ZodULID`,(e,t)=>{oh.init(e,t),Hy.init(e,t)}),ib=H(`ZodXID`,(e,t)=>{sh.init(e,t),Hy.init(e,t)}),ab=H(`ZodKSUID`,(e,t)=>{ch.init(e,t),Hy.init(e,t)}),ob=H(`ZodIPv4`,(e,t)=>{ph.init(e,t),Hy.init(e,t)}),sb=H(`ZodIPv6`,(e,t)=>{gh.init(e,t),Hy.init(e,t)}),cb=H(`ZodCIDRv4`,(e,t)=>{_h.init(e,t),Hy.init(e,t)}),lb=H(`ZodCIDRv6`,(e,t)=>{yh.init(e,t),Hy.init(e,t)}),ub=H(`ZodBase64`,(e,t)=>{Sh.init(e,t),Hy.init(e,t)}),db=H(`ZodBase64URL`,(e,t)=>{Th.init(e,t),Hy.init(e,t)}),fb=H(`ZodE164`,(e,t)=>{Eh.init(e,t),Hy.init(e,t)}),pb=H(`ZodJWT`,(e,t)=>{Oh.init(e,t),Hy.init(e,t)}),mb=H(`ZodNumber`,(e,t)=>{kh.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Av(e,t,n,r),e.isFinite=!0},Gf({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Tv(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Tv(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Tv(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Tv(e).format??null},{gt(e,t){return this.check(k_(e,t))},gte(e,t){return this.check(A_(e,t))},min(e,t){return this.check(A_(e,t))},lt(e,t){return this.check(D_(e,t))},lte(e,t){return this.check(O_(e,t))},max(e,t){return this.check(O_(e,t))},int(e){return this.check(W(e))},safe(e){return this.check(W(e))},positive(e){return this.check(k_(0,e))},nonnegative(e){return this.check(A_(0,e))},negative(e){return this.check(D_(0,e))},nonpositive(e){return this.check(O_(0,e))},multipleOf(e,t){return this.check(j_(e,t))},step(e,t){return this.check(j_(e,t))},finite(){return this}}));function hb(e){return v_(mb,e)}var gb=H(`ZodNumberFormat`,(e,t)=>{Ah.init(e,t),mb.init(e,t)});function W(e){return b_(gb,e)}var _b=H(`ZodBoolean`,(e,t)=>{jh.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jv(e,t,n,r)});function vb(e){return x_(_b,e)}var yb=H(`ZodUndefined`,(e,t)=>{Mh.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fv(e,t,n,r)});function bb(e){return S_(yb,e)}var xb=H(`ZodNull`,(e,t)=>{Nh.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pv(e,t,n,r)});function Sb(e){return C_(xb,e)}var Cb=H(`ZodAny`,(e,t)=>{Ph.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function G(){return w_(Cb)}var wb=H(`ZodUnknown`,(e,t)=>{Fh.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Tb(){return T_(wb)}var Eb=H(`ZodNever`,(e,t)=>{Ih.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lv(e,t,n,r)});function Db(e){return E_(Eb,e)}var Ob=H(`ZodArray`,(e,t)=>{Ry(),Rh.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qv(e,t,n,r),e.element=t.element},{min(e,t){return this.check(N_(e,t))},nonempty(e){return this.check(N_(1,e))},max(e,t){return this.check(M_(e,t))},length(e,t){return this.check(P_(e,t))},unwrap(){return this.element}});function kb(e,t){return q_(Ob,e,t)}var Ab=H(`ZodObject`,(e,t)=>{Ry(),Wh.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ey(e,t,n,r),Qf(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Vb(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(sf(this._zod.def,{catchall:e}))},passthrough(){return this.clone(sf(this._zod.def,{catchall:Tb()}))},loose(){return this.clone(sf(this._zod.def,{catchall:Tb()}))},strict(){return this.clone(sf(this._zod.def,{catchall:Db()}))},strip(){return this.clone(sf(this._zod.def,{catchall:void 0}))},extend(e){return Tf(this,e)},safeExtend(e){return Df(this,e)},merge(e){return Of(this,e)},pick(e){return Sf(this,e)},omit(e){return wf(this,e)},partial(...e){return kf(Gb,this,e[0])},exactPartial(...e){return kf(qb,this,e[0],`exactPartial`)},required(...e){return Af(tx,this,e[0])}});function jb(e,t){return new Ab({type:`object`,shape:e??{},...B(t)})}function K(e,t){return new Ab({type:`object`,shape:e,catchall:Tb(),...B(t)})}var Mb=H(`ZodUnion`,(e,t)=>{Kh.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ty(e,t,n,r),e.options=t.options});function Nb(e,t){return new Mb({type:`union`,options:e,...B(t)})}var Pb=H(`ZodDiscriminatedUnion`,(e,t)=>{Mb.init(e,t),Jh.init(e,t)});function Fb(e,t,n){return new Pb({type:`union`,options:t,discriminator:e,...B(n)})}var Ib=H(`ZodIntersection`,(e,t)=>{Yh.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ny(e,t,n,r)});function Lb(e,t){return new Ib({type:`intersection`,left:e,right:t})}var Rb=H(`ZodRecord`,(e,t)=>{Ry(),Qh.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sy(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function zb(e,t,n){return!t||!t._zod?new Rb({type:`record`,keyType:U(),valueType:e,...B(t)}):new Rb({type:`record`,keyType:e,valueType:t,...B(n)})}var Bb=H(`ZodEnum`,(e,t)=>{$h.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vv(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 Bb({...t,checks:[],...B(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 Bb({...t,checks:[],...B(r),entries:i})}});function Vb(e,t){return new Bb({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...B(t)})}var Hb=H(`ZodLiteral`,(e,t)=>{eg.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hv(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 q(e,t){return new Hb({type:`literal`,values:Array.isArray(e)?e:[e],...B(t)})}var Ub=H(`ZodTransform`,(e,t)=>{Ry(),tg.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yv(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new op(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Vf(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Vf(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Wb(e){return new Ub({type:`transform`,transform:e})}var Gb=H(`ZodOptional`,(e,t)=>{rg.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kb(e){return new Gb({type:`optional`,innerType:e})}var qb=H(`ZodExactOptional`,(e,t)=>{ig.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jb(e){return new qb({type:`optional`,innerType:e})}var Yb=H(`ZodNullable`,(e,t)=>{ag.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xb(e){return new Yb({type:`nullable`,innerType:e})}var Zb=H(`ZodDefault`,(e,t)=>{og.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Qb(e,t){return new Zb({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():mf(t)}})}var $b=H(`ZodPrefault`,(e,t)=>{cg.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>py(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ex(e,t){return new $b({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():mf(t)}})}var tx=H(`ZodNonOptional`,(e,t)=>{lg.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ly(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nx(e,t){return new tx({type:`nonoptional`,innerType:e,...B(t)})}var rx=H(`ZodCatch`,(e,t)=>{fg.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>my(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ix(e,t){return new rx({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:$f(t)})}var ax=H(`ZodPipe`,(e,t)=>{pg.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hy(e,t,n,r),e.in=t.in,e.out=t.out});function ox(e,t){return new ax({type:`pipe`,in:e,out:t})}var sx=H(`ZodPreprocess`,(e,t)=>{ax.init(e,t),hg.init(e,t)}),cx=H(`ZodReadonly`,(e,t)=>{gg.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lx(e){return new cx({type:`readonly`,innerType:e})}var ux=H(`ZodLazy`,(e,t)=>{vg.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yy(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function dx(e){return new ux({type:`lazy`,getter:e})}var fx=H(`ZodCustom`,(e,t)=>{yg.init(e,t),zy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qv(e,t,n,r)});function px(e,t){return J_(fx,e??(()=>!0),t)}function mx(e,t={}){return Y_(fx,e,t)}function hx(e,t){return X_(e,t)}function gx(e,t){return new sx({type:`pipe`,in:Wb(e),out:t})}var _x=Vb(I),J=px(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),vx=U(),yx=Vb([`developer`,`system`,`assistant`,`user`]),bx=K({type:q(I.TEXT_MESSAGE_START),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U(),role:yx.optional(),name:U().optional()}),xx=K({type:q(I.TEXT_MESSAGE_CONTENT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U(),delta:U()}),Sx=K({type:q(I.TEXT_MESSAGE_END),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U()}),Cx=K({type:q(I.TEXT_MESSAGE_CHUNK),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U().optional(),role:yx.optional(),delta:U().optional(),name:U().optional()}),wx=K({type:q(I.TOOL_CALL_START),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),toolCallId:U(),toolCallName:U(),parentMessageId:U().optional()}),Tx=K({type:q(I.TOOL_CALL_ARGS),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),toolCallId:U(),delta:U()}),Ex=K({type:q(I.TOOL_CALL_END),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),toolCallId:U()}),Dx=K({type:q(I.TOOL_CALL_CHUNK),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),toolCallId:U().optional(),toolCallName:U().optional(),parentMessageId:U().optional(),delta:U().optional()}),Ox=K({type:q(`text`),id:U().optional(),text:U(),metadata:G().refine(e=>e!==null).optional()}),kx=Fb(`type`,[K({type:q(`data`),value:U(),mimeType:U()}),K({type:q(`url`),value:U(),mimeType:U().optional()}),K({type:q(`file`),value:U(),provider:U().optional(),mimeType:U().optional()})]),Ax=Fb(`type`,[Ox,K({type:q(`image`),id:U().optional(),source:kx,metadata:G().refine(e=>e!==null).optional()}),K({type:q(`audio`),id:U().optional(),source:kx,metadata:G().refine(e=>e!==null).optional()}),K({type:q(`video`),id:U().optional(),source:kx,metadata:G().refine(e=>e!==null).optional()}),K({type:q(`document`),id:U().optional(),source:kx,metadata:G().refine(e=>e!==null).optional()})]),jx=K({type:q(I.TOOL_CALL_RESULT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U(),toolCallId:U(),content:Nb([U(),kb(Ax)]),role:q(`tool`).optional()}),Mx=G(),Nx=K({type:q(I.STATE_SNAPSHOT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),snapshot:Mx.refine(e=>e!==void 0)}),Px=U().regex(RegExp(`^(/([^/~]|~[01])*)*$`)),Fx=kb(Fb(`op`,[K({op:q(`add`),path:Px,value:G().refine(e=>e!==void 0)}).meta({specOpen:!0}),K({op:q(`remove`),path:Px}).meta({specOpen:!0}),K({op:q(`replace`),path:Px,value:G().refine(e=>e!==void 0)}).meta({specOpen:!0}),K({op:q(`move`),from:Px,path:Px}).meta({specOpen:!0}),K({op:q(`copy`),from:Px,path:Px}).meta({specOpen:!0}),K({op:q(`test`),path:Px,value:G().refine(e=>e!==void 0)}).meta({specOpen:!0})])),Ix=K({type:q(I.STATE_DELTA),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),delta:Fx}),Lx=K({subagentRunId:vx.optional(),id:U(),role:q(`developer`),name:U().optional(),encryptedValue:U().optional(),metadata:J.optional(),content:U()}),Rx=K({subagentRunId:vx.optional(),id:U(),role:q(`system`),name:U().optional(),encryptedValue:U().optional(),metadata:J.optional(),content:U()}),zx=K({name:U(),arguments:U()}),Bx=K({id:U(),type:q(`function`),function:zx,encryptedValue:U().optional(),metadata:J.optional()}),Vx=Fb(`role`,[Lx,Rx,K({subagentRunId:vx.optional(),id:U(),role:q(`assistant`),name:U().optional(),encryptedValue:U().optional(),metadata:J.optional(),content:U().optional(),toolCalls:kb(Bx).optional()}),K({subagentRunId:vx.optional(),id:U(),role:q(`user`),name:U().optional(),encryptedValue:U().optional(),metadata:J.optional(),content:Nb([U(),kb(Ax)])}),K({subagentRunId:vx.optional(),id:U(),role:q(`tool`),content:Nb([U(),kb(Ax)]),toolCallId:U(),error:U().optional(),encryptedValue:U().optional(),metadata:J.optional()}),K({subagentRunId:vx.optional(),id:U(),role:q(`activity`),activityType:U(),content:px(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),metadata:J.optional()}),K({subagentRunId:vx.optional(),id:U(),role:q(`reasoning`),content:U(),encryptedValue:U().optional(),metadata:J.optional()})]),Hx=K({type:q(I.MESSAGES_SNAPSHOT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),messages:kb(Vx)}),Ux=K({type:q(I.ACTIVITY_SNAPSHOT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U(),activityType:U(),content:px(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),replace:vb().optional()}),Wx=K({type:q(I.ACTIVITY_DELTA),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U(),activityType:U(),patch:Fx}),Gx=K({type:q(I.RAW),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),event:G().refine(e=>e!==void 0),source:U().optional()}),Kx=K({type:q(I.CUSTOM),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),name:U(),value:G().refine(e=>e!==void 0)}),qx=K({name:U(),description:U(),parameters:G().refine(e=>e!==null).optional(),metadata:J.optional()}),Jx=K({description:U(),value:U()}),Yx=K({interruptId:U(),status:Vb([`resolved`,`cancelled`]),payload:G().refine(e=>e!==null).optional(),metadata:J.optional()}),Xx=K({threadId:U(),runId:U(),protocolVersion:U().optional(),parentRunId:U().optional(),state:Mx.refine(e=>e!==null).nullable().transform(e=>e??void 0).optional(),messages:kb(Vx),tools:kb(qx).default(()=>[]),context:kb(Jx).default(()=>[]),forwardedProps:G().refine(e=>e!==null).optional(),resume:kb(Yx).optional()}),Zx=K({type:q(I.RUN_STARTED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),threadId:U(),runId:U(),protocolVersion:U().optional(),parentRunId:U().optional(),input:Xx.optional()}),Qx=K({type:q(`success`),pendingToolCallIds:kb(U()).optional()}),$x=K({subagentRunId:vx.optional(),id:U(),reason:U(),message:U().optional(),toolCallId:U().optional(),responseSchema:px(e=>typeof e==`object`&&!!e&&!Array.isArray(e)).optional(),expiresAt:U().optional(),metadata:J.optional()}),eS=Fb(`type`,[Qx,K({type:q(`interrupt`),interrupts:kb($x).min(1)}),K({type:q(`cancelled`)})]),tS=K({provider:U().optional(),model:U().optional(),inputTokens:W().min(0).max(9007199254740991).optional(),outputTokens:W().min(0).max(9007199254740991).optional(),totalTokens:W().min(0).max(9007199254740991).optional(),reasoningTokens:W().min(0).max(9007199254740991).optional(),cachedInputTokens:W().min(0).max(9007199254740991).optional(),cacheWriteInputTokens:W().min(0).max(9007199254740991).optional()}),nS=K({type:q(I.RUN_FINISHED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),threadId:U(),runId:U(),result:G().refine(e=>e!==null).optional(),outcome:eS.optional(),usage:kb(tS).optional()}),rS=K({type:q(I.RUN_ERROR),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),message:U(),code:U().optional(),usage:kb(tS).optional()}),iS=K({type:q(I.STEP_STARTED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),stepName:U()}),aS=K({type:q(I.STEP_FINISHED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),stepName:U()}),oS=K({type:q(I.REASONING_START),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U()}),sS=K({type:q(I.REASONING_MESSAGE_START),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U(),role:q(`reasoning`)}),cS=K({type:q(I.REASONING_MESSAGE_CONTENT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U(),delta:U()}),lS=K({type:q(I.REASONING_MESSAGE_END),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U()}),uS=K({type:q(I.REASONING_MESSAGE_CHUNK),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U().optional(),delta:U().optional()}),dS=K({type:q(I.REASONING_END),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),messageId:U()}),fS=Vb([`tool-call`,`message`]),pS=K({type:q(I.REASONING_ENCRYPTED_VALUE),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx.optional(),subtype:fS,entityId:U(),encryptedValue:U()}),mS=K({type:q(I.SUBAGENT_STARTED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx,name:U(),description:U().optional(),parentSubagentRunId:vx.optional(),parentToolCallId:U().optional(),parentMessageId:U().optional()}),hS=Fb(`type`,[K({type:q(`success`)}),K({type:q(`suspended`),interruptIds:kb(U()).optional()})]),gS=Fb(`type`,[bx,xx,Sx,Cx,wx,Tx,Ex,Dx,jx,Nx,Ix,Hx,Ux,Wx,Gx,Kx,Zx,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,pS,mS,K({type:q(I.SUBAGENT_FINISHED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx,result:G().refine(e=>e!==null).optional(),outcome:hS.optional()}),K({type:q(I.SUBAGENT_ERROR),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:vx,message:U(),code:U().optional()})]);Vb([`developer`,`system`,`assistant`,`user`,`tool`,`activity`,`reasoning`]);var _S=K({name:U(),description:U().optional()}),vS=K({name:U().optional(),type:U().optional(),description:U().optional(),version:U().optional(),provider:U().optional(),documentationUrl:U().optional(),metadata:J.optional()}),yS=K({streaming:vb().optional(),websocket:vb().optional(),httpBinary:vb().optional(),pushNotifications:vb().optional(),resumable:vb().optional()}),bS=K({supported:vb().optional(),items:kb(qx).optional(),parallelCalls:vb().optional(),clientProvided:vb().optional()}),xS=K({structuredOutput:vb().optional(),supportedMimeTypes:kb(U()).optional()}),SS=K({snapshots:vb().optional(),deltas:vb().optional(),memory:vb().optional(),persistentState:vb().optional()}),CS=K({supported:vb().optional(),delegation:vb().optional(),handoffs:vb().optional(),subagents:kb(_S).optional()}),wS=K({supported:vb().optional(),streaming:vb().optional(),encrypted:vb().optional()}),TS=K({image:vb().optional(),audio:vb().optional(),video:vb().optional(),pdf:vb().optional(),file:vb().optional()}),ES=K({image:vb().optional(),audio:vb().optional()}),DS=K({input:TS.optional(),output:ES.optional()}),OS=K({codeExecution:vb().optional(),sandboxed:vb().optional(),maxIterations:W().min(0).max(9007199254740991).optional(),maxExecutionTime:W().min(0).max(9007199254740991).optional()}),kS=K({supported:vb().optional(),approvals:vb().optional(),interventions:vb().optional(),feedback:vb().optional(),interrupts:vb().optional(),approveWithEdits:vb().optional()});K({identity:vS.optional(),transport:yS.optional(),tools:bS.optional(),output:xS.optional(),state:SS.optional(),multiAgent:CS.optional(),reasoning:wS.optional(),multimodal:DS.optional(),execution:OS.optional(),humanInTheLoop:kS.optional(),custom:px(e=>typeof e==`object`&&!!e&&!Array.isArray(e)).optional()}),K({subagentRunId:vx.optional()}),K({type:_x,timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional()}),K({subagentRunId:vx.optional(),id:U(),role:U(),name:U().optional(),encryptedValue:U().optional(),metadata:J.optional()}),J.optional();function AS(){let e=this.buf,t=this.pos,n=0,r=0;for(let i=0;i<28;i+=7){let a=e[t++];if(n|=(a&127)<>4,!(i&128)){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(r|=(a&127)<=jS&&(i+=r/jS|0,r%=jS)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?LS(r,i):IS(r,i)}function NS(e,t){let n=IS(e,t),r=n.hi&2147483648;r&&(n=LS(n.lo,n.hi));let i=PS(n.lo,n.hi);return r?`-`+i:i}function PS(e,t){if({lo:e,hi:t}=FS(e,t),t<=2097151)return String(jS*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+RS(o)+RS(a)}function FS(e,t){return{lo:e>>>0,hi:t>>>0}}function IS(e,t){return{lo:e|0,hi:t|0}}function LS(e,t){return t=~t,e?e=~e+1:t+=1,IS(e,t)}var RS=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function zS(){let e=this.buf[this.pos++];if(!(e&128))return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}var BS=VS();function VS(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(globalThis.Deno||globalThis.Bun||typeof process!=`object`||{}.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||ri||ta.call(e)),GS(i)}return WS}function qS(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}var JS;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(JS||={});var Y=class{constructor(e){this.stackPos=[],this.encodeUtf8Into=e?qS(e):KS().encodeUtf8Into,this.buffer=ZS,this.viewCache=QS,this.pos=0}ensureCapacity(e){let t=this.pos+e;if(t>this.buffer.length){let e=this.buffer.length||YS;for(;e0&&n.set(this.buffer),this.buffer=n}}view(){let e=this.buffer,t=this.viewCache;if(t.byteLength===e.byteLength)return t;let n=new DataView(e.buffer);return this.viewCache=n,n}finish(){let e=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],e}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(XS),this.buffer[this.pos++]=0,this}join(){let e=this.stackPos.pop();if(e===void 0)throw Error(`invalid state, fork stack empty`);let t=this.pos-e-XS,n=eC(t);return n>XS&&(this.ensureCapacity(n-XS),this.buffer.copyWithin(e+n,e+XS,this.pos)),this.pos=e,this.uint32(t),this.pos+=t,this}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.ensureCapacity(e.length),this.buffer.set(e,this.pos),this.pos+=e.length,this}uint32(e){if(nC(e),this.ensureCapacity(5),e<128)return this.buffer[this.pos++]=e,this;for(;e>127;)this.buffer[this.pos++]=e&127|128,e>>>=7;return this.buffer[this.pos++]=e,this}int32(e){if(tC(e),e>=0)return this.uint32(e);this.ensureCapacity(10);for(let t=0;t<9;t++)this.buffer[this.pos++]=e&127|128,e>>=7;return this.buffer[this.pos++]=1,this}bool(e){return this.ensureCapacity(1),this.buffer[this.pos++]=+!!e,this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){typeof e!=`string`&&(e=String(e));let t=e.length;if(t<=$S){this.ensureCapacity(t+1);let n=this.buffer,r=this.pos;n[r++]=t;let i=0;for(;i127)break;n[r++]=t}if(i==t)return this.pos=r,this}this.ensureCapacity(t*3+5);let n=eC(t),r=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(e,r.subarray(i+n)),o=eC(a);return o!=n&&r.copyWithin(i+o,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(e){return rC(e),this.ensureCapacity(4),this.view().setFloat32(this.pos,e,!0),this.pos+=4,this}double(e){return this.ensureCapacity(8),this.view().setFloat64(this.pos,e,!0),this.pos+=8,this}fixed32(e){return nC(e),this.ensureCapacity(4),this.view().setUint32(this.pos,e,!0),this.pos+=4,this}sfixed32(e){return tC(e),this.ensureCapacity(4),this.view().setInt32(this.pos,e,!0),this.pos+=4,this}sint32(e){return tC(e),this.uint32((e<<1^e>>31)>>>0)}sfixed64(e){let t=BS.enc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}fixed64(e){let t=BS.uEnc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}int64(e){let t=BS.enc(e);return this.writeVarint64(t.lo,t.hi)}sint64(e){let t=BS.enc(e),n=t.hi>>31,r=t.lo<<1^n,i=(t.hi<<1|t.lo>>>31)^n;return this.writeVarint64(r,i)}uint64(e){let t=BS.uEnc(e);return this.writeVarint64(t.lo,t.hi)}writeVarint64(e,t){this.ensureCapacity(10);let n=this.buffer,r=this.pos;for(let i=0;i<28;i+=7){let a=e>>>i,o=!(!(a>>>7)&&t==0);if(n[r++]=(o?a|128:a)&255,!o)return this.pos=r,this}let i=e>>>28&15|(t&7)<<4,a=!!(t>>3);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this;for(let e=3;e<31;e+=7){let i=t>>>e,a=!!(i>>>7);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this}return n[r++]=t>>>31&1,this.pos=r,this}},YS=128,XS=1,ZS=new Uint8Array,QS=new DataView(ZS.buffer),$S=32;function eC(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var X=class{constructor(e,t=KS().decodeUtf8){this.decodeUtf8=t,this.varint64Lo=0,this.varint64Hi=0,this.varint64=AS,this.uint32=zS,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.pos,t=this.uint32(),n=this.pos-e;if(n>5||n==5&&this.buf[this.pos-1]>15)throw Error(`illegal tag: varint overflows uint32`);let r=t>>>3,i=t&7;if(r<=0||i>5)throw Error(`illegal tag: field no `+r+` wire type `+i);return[r,i]}skip(e,t,n=100){let r=this.pos;switch(e){case JS.Varint:for(;this.buf[this.pos++]&128;);break;case JS.Bit64:this.pos+=4;case JS.Bit32:this.pos+=4;break;case JS.LengthDelimited:let r=this.uint32();this.pos+=r;break;case JS.StartGroup:if(n<=0)throw Error(`maximum recursion depth reached`);for(;;){let[e,r]=this.tag();if(r===JS.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(r,e,n-1)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return this.varint64(),BS.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),BS.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let e=this.varint64Lo,t=this.varint64Hi,n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,BS.dec(e,t)}bool(){let e=this.buf[this.pos];return e<128?(this.pos++,e!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return BS.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return BS.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(e){let t=this.bytes(),n=t.length;if(n<=$S){let r=Array(n);for(let i=0;i127)return this.decodeUtf8(t,e);r[i]=n}return String.fromCharCode.apply(String,r)}return this.decodeUtf8(t,e)}};function tC(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid int32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int32: `+e)}function nC(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid uint32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint32: `+e)}function rC(e){if(typeof e==`string`){let t=e;if(e=Number(e),Number.isNaN(e)&&t!==`NaN`)throw Error(`invalid float32: `+t)}else if(typeof e!=`number`)throw Error(`invalid float32: `+typeof e);if(!Number.isFinite(Math.fround(e))&&Number.isFinite(e))throw Error(`invalid float32: `+e)}var iC=function(e){return e[e.NULL_VALUE=0]=`NULL_VALUE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function aC(){return{fields:{}}}var oC={encode(e,t=new Y){return Object.entries(e.fields).forEach(([e,n])=>{n!==void 0&&cC.encode({key:e,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=aC();for(;n.pos>>3){case 1:{if(e!==10)break;let t=cC.decode(n,n.uint32());t.value!==void 0&&(i.fields[t.key]=t.value);continue}}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return oC.fromPartial(e??{})},fromPartial(e){let t=aC();return t.fields=Object.entries(e.fields??{}).reduce((e,[t,n])=>(n!==void 0&&(e[t]=n),e),{}),t},wrap(e){let t=aC();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function sC(){return{key:``,value:void 0}}var cC={encode(e,t=new Y){return e.key!==``&&t.uint32(10).string(e.key),e.value!==void 0&&Z.encode(Z.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=sC();for(;n.pos>>3){case 1:if(e!==10)break;i.key=n.string();continue;case 2:if(e!==18)break;i.value=Z.unwrap(Z.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return cC.fromPartial(e??{})},fromPartial(e){let t=sC();return t.key=e.key??``,t.value=e.value??void 0,t}};function lC(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Z={encode(e,t=new Y){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&oC.encode(oC.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&dC.encode(dC.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=lC();for(;n.pos>>3){case 1:if(e!==8)break;i.nullValue=n.int32();continue;case 2:if(e!==17)break;i.numberValue=n.double();continue;case 3:if(e!==26)break;i.stringValue=n.string();continue;case 4:if(e!==32)break;i.boolValue=n.bool();continue;case 5:if(e!==42)break;i.structValue=oC.unwrap(oC.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.listValue=dC.unwrap(dC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Z.fromPartial(e??{})},fromPartial(e){let t=lC();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=lC();if(e===null)t.nullValue=iC.NULL_VALUE;else if(typeof e==`boolean`)t.boolValue=e;else if(typeof e==`number`)t.numberValue=e;else if(typeof e==`string`)t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e==`object`)t.structValue=e;else if(e!==void 0)throw new globalThis.Error(`Unsupported any value type: `+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function uC(){return{values:[]}}var dC={encode(e,t=new Y){for(let n of e.values)Z.encode(Z.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=uC();for(;n.pos>>3){case 1:if(e!==10)break;i.values.push(Z.unwrap(Z.decode(n,n.uint32())));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return dC.fromPartial(e??{})},fromPartial(e){let t=uC();return t.values=e.values?.map(e=>e)||[],t},wrap(e){let t=uC();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty(`values`)&&globalThis.Array.isArray(e.values)?e.values:e}},fC=function(e){return e[e.ADD=0]=`ADD`,e[e.REMOVE=1]=`REMOVE`,e[e.REPLACE=2]=`REPLACE`,e[e.MOVE=3]=`MOVE`,e[e.COPY=4]=`COPY`,e[e.TEST=5]=`TEST`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function pC(){return{op:0,path:``,from:void 0,value:void 0}}var mC={encode(e,t=new Y){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==``&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&Z.encode(Z.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=pC();for(;n.pos>>3){case 1:if(e!==8)break;i.op=n.int32();continue;case 2:if(e!==18)break;i.path=n.string();continue;case 3:if(e!==26)break;i.from=n.string();continue;case 4:if(e!==34)break;i.value=Z.unwrap(Z.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return mC.fromPartial(e??{})},fromPartial(e){let t=pC();return t.op=e.op??0,t.path=e.path??``,t.from=e.from??void 0,t.value=e.value??void 0,t}};function hC(){return{text:``,id:void 0,metadata:void 0}}var gC={encode(e,t=new Y){return e.text!==``&&t.uint32(10).string(e.text),e.id!==void 0&&t.uint32(18).string(e.id),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(26).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=hC();for(;n.pos>>3){case 1:if(e!==10)break;i.text=n.string();continue;case 2:if(e!==18)break;i.id=n.string();continue;case 3:if(e!==26)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return gC.fromPartial(e??{})},fromPartial(e){let t=hC();return t.text=e.text??``,t.id=e.id??void 0,t.metadata=e.metadata??void 0,t}};function _C(){return{source:void 0,metadata:void 0,id:void 0}}var vC={encode(e,t=new Y){return e.source!==void 0&&EC.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=_C();for(;n.pos>>3){case 1:if(e!==10)break;i.source=EC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return vC.fromPartial(e??{})},fromPartial(e){let t=_C();return t.source=e.source!==void 0&&e.source!==null?EC.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function yC(){return{value:``,mimeType:``}}var bC={encode(e,t=new Y){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==``&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=yC();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return bC.fromPartial(e??{})},fromPartial(e){let t=yC();return t.value=e.value??``,t.mimeType=e.mimeType??``,t}};function xC(){return{value:``,mimeType:void 0}}var SC={encode(e,t=new Y){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=xC();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return SC.fromPartial(e??{})},fromPartial(e){let t=xC();return t.value=e.value??``,t.mimeType=e.mimeType??void 0,t}};function CC(){return{value:``,provider:void 0,mimeType:void 0}}var wC={encode(e,t=new Y){return e.value!==``&&t.uint32(10).string(e.value),e.provider!==void 0&&t.uint32(18).string(e.provider),e.mimeType!==void 0&&t.uint32(26).string(e.mimeType),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=CC();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.provider=n.string();continue;case 3:if(e!==26)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return wC.fromPartial(e??{})},fromPartial(e){let t=CC();return t.value=e.value??``,t.provider=e.provider??void 0,t.mimeType=e.mimeType??void 0,t}};function TC(){return{data:void 0,url:void 0,file:void 0}}var EC={encode(e,t=new Y){return e.data!==void 0&&bC.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&SC.encode(e.url,t.uint32(18).fork()).join(),e.file!==void 0&&wC.encode(e.file,t.uint32(26).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=TC();for(;n.pos>>3){case 1:if(e!==10)break;i.data=bC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.url=SC.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.file=wC.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return EC.fromPartial(e??{})},fromPartial(e){let t=TC();return t.data=e.data!==void 0&&e.data!==null?bC.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?SC.fromPartial(e.url):void 0,t.file=e.file!==void 0&&e.file!==null?wC.fromPartial(e.file):void 0,t}};function DC(){return{source:void 0,metadata:void 0,id:void 0}}var OC={encode(e,t=new Y){return e.source!==void 0&&EC.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=DC();for(;n.pos>>3){case 1:if(e!==10)break;i.source=EC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return OC.fromPartial(e??{})},fromPartial(e){let t=DC();return t.source=e.source!==void 0&&e.source!==null?EC.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function kC(){return{source:void 0,metadata:void 0,id:void 0}}var AC={encode(e,t=new Y){return e.source!==void 0&&EC.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=kC();for(;n.pos>>3){case 1:if(e!==10)break;i.source=EC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return AC.fromPartial(e??{})},fromPartial(e){let t=kC();return t.source=e.source!==void 0&&e.source!==null?EC.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function jC(){return{source:void 0,metadata:void 0,id:void 0}}var MC={encode(e,t=new Y){return e.source!==void 0&&EC.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=jC();for(;n.pos>>3){case 1:if(e!==10)break;i.source=EC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return MC.fromPartial(e??{})},fromPartial(e){let t=jC();return t.source=e.source!==void 0&&e.source!==null?EC.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function NC(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var PC={encode(e,t=new Y){return e.text!==void 0&&gC.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&vC.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&OC.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&AC.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&MC.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=NC();for(;n.pos>>3){case 1:if(e!==10)break;i.text=gC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.image=vC.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.audio=OC.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.video=AC.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.document=MC.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return PC.fromPartial(e??{})},fromPartial(e){let t=NC();return t.text=e.text!==void 0&&e.text!==null?gC.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?vC.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?OC.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?AC.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?MC.fromPartial(e.document):void 0,t}};function FC(){return{id:``,type:``,function:void 0,metadata:void 0,encryptedValue:void 0}}var IC={encode(e,t=new Y){return e.id!==``&&t.uint32(10).string(e.id),e.type!==``&&t.uint32(18).string(e.type),e.function!==void 0&&RC.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&oC.encode(oC.wrap(e.metadata),t.uint32(34).fork()).join(),e.encryptedValue!==void 0&&t.uint32(42).string(e.encryptedValue),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=FC();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.type=n.string();continue;case 3:if(e!==26)break;i.function=RC.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.metadata=oC.unwrap(oC.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.encryptedValue=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return IC.fromPartial(e??{})},fromPartial(e){let t=FC();return t.id=e.id??``,t.type=e.type??``,t.function=e.function!==void 0&&e.function!==null?RC.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t.encryptedValue=e.encryptedValue??void 0,t}};function LC(){return{name:``,arguments:``}}var RC={encode(e,t=new Y){return e.name!==``&&t.uint32(10).string(e.name),e.arguments!==``&&t.uint32(18).string(e.arguments),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=LC();for(;n.pos>>3){case 1:if(e!==10)break;i.name=n.string();continue;case 2:if(e!==18)break;i.arguments=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return RC.fromPartial(e??{})},fromPartial(e){let t=LC();return t.name=e.name??``,t.arguments=e.arguments??``,t}};function zC(){return{id:``,role:``,content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0,encryptedValue:void 0,activityType:void 0,activityContent:void 0}}var BC={encode(e,t=new Y){e.id!==``&&t.uint32(10).string(e.id),e.role!==``&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let n of e.toolCalls)IC.encode(n,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let n of e.contentParts)PC.encode(n,t.uint32(66).fork()).join();return e.metadata!==void 0&&oC.encode(oC.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),e.encryptedValue!==void 0&&t.uint32(90).string(e.encryptedValue),e.activityType!==void 0&&t.uint32(98).string(e.activityType),e.activityContent!==void 0&&oC.encode(oC.wrap(e.activityContent),t.uint32(106).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=zC();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.role=n.string();continue;case 3:if(e!==26)break;i.content=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.toolCalls.push(IC.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.toolCallId=n.string();continue;case 7:if(e!==58)break;i.error=n.string();continue;case 8:if(e!==66)break;i.contentParts.push(PC.decode(n,n.uint32()));continue;case 9:if(e!==74)break;i.metadata=oC.unwrap(oC.decode(n,n.uint32()));continue;case 10:if(e!==82)break;i.subagentRunId=n.string();continue;case 11:if(e!==90)break;i.encryptedValue=n.string();continue;case 12:if(e!==98)break;i.activityType=n.string();continue;case 13:if(e!==106)break;i.activityContent=oC.unwrap(oC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return BC.fromPartial(e??{})},fromPartial(e){let t=zC();return t.id=e.id??``,t.role=e.role??``,t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(e=>IC.fromPartial(e))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(e=>PC.fromPartial(e))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t.encryptedValue=e.encryptedValue??void 0,t.activityType=e.activityType??void 0,t.activityContent=e.activityContent??void 0,t}};function VC(){return{name:``,description:``,parameters:void 0,metadata:void 0}}var HC={encode(e,t=new Y){return e.name!==``&&t.uint32(10).string(e.name),e.description!==``&&t.uint32(18).string(e.description),e.parameters!==void 0&&Z.encode(Z.wrap(e.parameters),t.uint32(26).fork()).join(),e.metadata!==void 0&&oC.encode(oC.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=VC();for(;n.pos>>3){case 1:if(e!==10)break;i.name=n.string();continue;case 2:if(e!==18)break;i.description=n.string();continue;case 3:if(e!==26)break;i.parameters=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=oC.unwrap(oC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return HC.fromPartial(e??{})},fromPartial(e){let t=VC();return t.name=e.name??``,t.description=e.description??``,t.parameters=e.parameters??void 0,t.metadata=e.metadata??void 0,t}};function UC(){return{description:``,value:``}}var WC={encode(e,t=new Y){return e.description!==``&&t.uint32(10).string(e.description),e.value!==``&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=UC();for(;n.pos>>3){case 1:if(e!==10)break;i.description=n.string();continue;case 2:if(e!==18)break;i.value=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return WC.fromPartial(e??{})},fromPartial(e){let t=UC();return t.description=e.description??``,t.value=e.value??``,t}};function GC(){return{interruptId:``,status:``,payload:void 0,metadata:void 0}}var KC={encode(e,t=new Y){return e.interruptId!==``&&t.uint32(10).string(e.interruptId),e.status!==``&&t.uint32(18).string(e.status),e.payload!==void 0&&Z.encode(Z.wrap(e.payload),t.uint32(26).fork()).join(),e.metadata!==void 0&&oC.encode(oC.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=GC();for(;n.pos>>3){case 1:if(e!==10)break;i.interruptId=n.string();continue;case 2:if(e!==18)break;i.status=n.string();continue;case 3:if(e!==26)break;i.payload=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=oC.unwrap(oC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return KC.fromPartial(e??{})},fromPartial(e){let t=GC();return t.interruptId=e.interruptId??``,t.status=e.status??``,t.payload=e.payload??void 0,t.metadata=e.metadata??void 0,t}};function qC(){return{threadId:``,runId:``,parentRunId:void 0,state:void 0,messages:[],tools:[],context:[],forwardedProps:void 0,resume:[],protocolVersion:void 0}}var JC={encode(e,t=new Y){e.threadId!==``&&t.uint32(10).string(e.threadId),e.runId!==``&&t.uint32(18).string(e.runId),e.parentRunId!==void 0&&t.uint32(26).string(e.parentRunId),e.state!==void 0&&Z.encode(Z.wrap(e.state),t.uint32(34).fork()).join();for(let n of e.messages)BC.encode(n,t.uint32(42).fork()).join();for(let n of e.tools)HC.encode(n,t.uint32(50).fork()).join();for(let n of e.context)WC.encode(n,t.uint32(58).fork()).join();e.forwardedProps!==void 0&&Z.encode(Z.wrap(e.forwardedProps),t.uint32(66).fork()).join();for(let n of e.resume)KC.encode(n,t.uint32(74).fork()).join();return e.protocolVersion!==void 0&&t.uint32(82).string(e.protocolVersion),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=qC();for(;n.pos>>3){case 1:if(e!==10)break;i.threadId=n.string();continue;case 2:if(e!==18)break;i.runId=n.string();continue;case 3:if(e!==26)break;i.parentRunId=n.string();continue;case 4:if(e!==34)break;i.state=Z.unwrap(Z.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.messages.push(BC.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.tools.push(HC.decode(n,n.uint32()));continue;case 7:if(e!==58)break;i.context.push(WC.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.forwardedProps=Z.unwrap(Z.decode(n,n.uint32()));continue;case 9:if(e!==74)break;i.resume.push(KC.decode(n,n.uint32()));continue;case 10:if(e!==82)break;i.protocolVersion=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return JC.fromPartial(e??{})},fromPartial(e){let t=qC();return t.threadId=e.threadId??``,t.runId=e.runId??``,t.parentRunId=e.parentRunId??void 0,t.state=e.state??void 0,t.messages=e.messages?.map(e=>BC.fromPartial(e))||[],t.tools=e.tools?.map(e=>HC.fromPartial(e))||[],t.context=e.context?.map(e=>WC.fromPartial(e))||[],t.forwardedProps=e.forwardedProps??void 0,t.resume=e.resume?.map(e=>KC.fromPartial(e))||[],t.protocolVersion=e.protocolVersion??void 0,t}};function YC(){return{id:``,reason:``,message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var XC={encode(e,t=new Y){return e.id!==``&&t.uint32(10).string(e.id),e.reason!==``&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&Z.encode(Z.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=YC();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.reason=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.toolCallId=n.string();continue;case 5:if(e!==42)break;i.responseSchema=Z.unwrap(Z.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.expiresAt=n.string();continue;case 7:if(e!==58)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return XC.fromPartial(e??{})},fromPartial(e){let t=YC();return t.id=e.id??``,t.reason=e.reason??``,t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}},ZC=function(e){return e[e.TEXT_MESSAGE_START=0]=`TEXT_MESSAGE_START`,e[e.TEXT_MESSAGE_CONTENT=1]=`TEXT_MESSAGE_CONTENT`,e[e.TEXT_MESSAGE_END=2]=`TEXT_MESSAGE_END`,e[e.TOOL_CALL_START=3]=`TOOL_CALL_START`,e[e.TOOL_CALL_ARGS=4]=`TOOL_CALL_ARGS`,e[e.TOOL_CALL_END=5]=`TOOL_CALL_END`,e[e.STATE_SNAPSHOT=6]=`STATE_SNAPSHOT`,e[e.STATE_DELTA=7]=`STATE_DELTA`,e[e.MESSAGES_SNAPSHOT=8]=`MESSAGES_SNAPSHOT`,e[e.RAW=9]=`RAW`,e[e.CUSTOM=10]=`CUSTOM`,e[e.RUN_STARTED=11]=`RUN_STARTED`,e[e.RUN_FINISHED=12]=`RUN_FINISHED`,e[e.RUN_ERROR=13]=`RUN_ERROR`,e[e.STEP_STARTED=14]=`STEP_STARTED`,e[e.STEP_FINISHED=15]=`STEP_FINISHED`,e[e.SUBAGENT_STARTED=16]=`SUBAGENT_STARTED`,e[e.SUBAGENT_FINISHED=17]=`SUBAGENT_FINISHED`,e[e.SUBAGENT_ERROR=18]=`SUBAGENT_ERROR`,e[e.TEXT_MESSAGE_CHUNK=19]=`TEXT_MESSAGE_CHUNK`,e[e.TOOL_CALL_CHUNK=20]=`TOOL_CALL_CHUNK`,e[e.TOOL_CALL_RESULT=21]=`TOOL_CALL_RESULT`,e[e.ACTIVITY_SNAPSHOT=22]=`ACTIVITY_SNAPSHOT`,e[e.ACTIVITY_DELTA=23]=`ACTIVITY_DELTA`,e[e.REASONING_START=24]=`REASONING_START`,e[e.REASONING_MESSAGE_START=25]=`REASONING_MESSAGE_START`,e[e.REASONING_MESSAGE_CONTENT=26]=`REASONING_MESSAGE_CONTENT`,e[e.REASONING_MESSAGE_END=27]=`REASONING_MESSAGE_END`,e[e.REASONING_MESSAGE_CHUNK=28]=`REASONING_MESSAGE_CHUNK`,e[e.REASONING_END=29]=`REASONING_END`,e[e.REASONING_ENCRYPTED_VALUE=30]=`REASONING_ENCRYPTED_VALUE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function QC(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var Q={encode(e,t=new Y){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&Z.encode(Z.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&oC.encode(oC.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=QC();for(;n.pos>>3){case 1:if(e!==8)break;i.type=n.int32();continue;case 2:if(e!==16)break;i.timestamp=dT(n.int64());continue;case 3:if(e!==26)break;i.rawEvent=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=oC.unwrap(oC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Q.fromPartial(e??{})},fromPartial(e){let t=QC();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function $C(){return{baseEvent:void 0,messageId:``,role:void 0,name:void 0,subagentRunId:void 0}}var ew={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=$C();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ew.fromPartial(e??{})},fromPartial(e){let t=$C();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function tw(){return{baseEvent:void 0,messageId:``,delta:``,subagentRunId:void 0}}var nw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=tw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return nw.fromPartial(e??{})},fromPartial(e){let t=tw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function rw(){return{baseEvent:void 0,messageId:``,subagentRunId:void 0}}var iw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=rw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return iw.fromPartial(e??{})},fromPartial(e){let t=rw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function aw(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var ow={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=aw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue;case 5:if(e!==42)break;i.name=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ow.fromPartial(e??{})},fromPartial(e){let t=aw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function sw(){return{baseEvent:void 0,toolCallId:``,toolCallName:``,parentMessageId:void 0,subagentRunId:void 0}}var cw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.toolCallName!==``&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=sw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return cw.fromPartial(e??{})},fromPartial(e){let t=sw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.toolCallName=e.toolCallName??``,t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function lw(){return{baseEvent:void 0,toolCallId:``,delta:``,subagentRunId:void 0}}var uw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=lw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return uw.fromPartial(e??{})},fromPartial(e){let t=lw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function dw(){return{baseEvent:void 0,toolCallId:``,subagentRunId:void 0}}var fw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=dw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return fw.fromPartial(e??{})},fromPartial(e){let t=dw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function pw(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var mw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=pw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.delta=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return mw.fromPartial(e??{})},fromPartial(e){let t=pw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function hw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,toolCallId:``,content:void 0,role:void 0,contentParts:[]}}var gw={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.toolCallId!==``&&t.uint32(34).string(e.toolCallId),e.content!==void 0&&t.uint32(42).string(e.content),e.role!==void 0&&t.uint32(50).string(e.role);for(let n of e.contentParts)PC.encode(n,t.uint32(58).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=hw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.toolCallId=n.string();continue;case 5:if(e!==42)break;i.content=n.string();continue;case 6:if(e!==50)break;i.role=n.string();continue;case 7:if(e!==58)break;i.contentParts.push(PC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return gw.fromPartial(e??{})},fromPartial(e){let t=hw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.toolCallId=e.toolCallId??``,t.content=e.content??void 0,t.role=e.role??void 0,t.contentParts=e.contentParts?.map(e=>PC.fromPartial(e))||[],t}};function _w(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var vw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Z.encode(Z.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=_w();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.snapshot=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return vw.fromPartial(e??{})},fromPartial(e){let t=_w();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function yw(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var bw={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.delta)mC.encode(n,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=yw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.delta.push(mC.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return bw.fromPartial(e??{})},fromPartial(e){let t=yw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(e=>mC.fromPartial(e))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function xw(){return{baseEvent:void 0,messages:[]}}var Sw={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.messages)BC.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=xw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messages.push(BC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Sw.fromPartial(e??{})},fromPartial(e){let t=xw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(e=>BC.fromPartial(e))||[],t}};function Cw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,activityType:``,content:void 0,replace:void 0}}var ww={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.activityType!==``&&t.uint32(34).string(e.activityType),e.content!==void 0&&oC.encode(oC.wrap(e.content),t.uint32(42).fork()).join(),e.replace!==void 0&&t.uint32(48).bool(e.replace),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Cw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.activityType=n.string();continue;case 5:if(e!==42)break;i.content=oC.unwrap(oC.decode(n,n.uint32()));continue;case 6:if(e!==48)break;i.replace=n.bool();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ww.fromPartial(e??{})},fromPartial(e){let t=Cw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.activityType=e.activityType??``,t.content=e.content??void 0,t.replace=e.replace??void 0,t}};function Tw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,activityType:``,patch:[]}}var Ew={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.activityType!==``&&t.uint32(34).string(e.activityType);for(let n of e.patch)mC.encode(n,t.uint32(42).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Tw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.activityType=n.string();continue;case 5:if(e!==42)break;i.patch.push(mC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ew.fromPartial(e??{})},fromPartial(e){let t=Tw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.activityType=e.activityType??``,t.patch=e.patch?.map(e=>mC.fromPartial(e))||[],t}};function Dw(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Ow={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Z.encode(Z.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Dw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.event=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.source=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ow.fromPartial(e??{})},fromPartial(e){let t=Dw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function kw(){return{baseEvent:void 0,name:``,value:void 0,subagentRunId:void 0}}var Aw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==``&&t.uint32(18).string(e.name),e.value!==void 0&&Z.encode(Z.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=kw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.name=n.string();continue;case 3:if(e!==26)break;i.value=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Aw.fromPartial(e??{})},fromPartial(e){let t=kw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.name=e.name??``,t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function jw(){return{baseEvent:void 0,threadId:``,runId:``,parentRunId:void 0,input:void 0,protocolVersion:void 0}}var Mw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),e.parentRunId!==void 0&&t.uint32(34).string(e.parentRunId),e.input!==void 0&&JC.encode(e.input,t.uint32(42).fork()).join(),e.protocolVersion!==void 0&&t.uint32(50).string(e.protocolVersion),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=jw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue;case 4:if(e!==34)break;i.parentRunId=n.string();continue;case 5:if(e!==42)break;i.input=JC.decode(n,n.uint32());continue;case 6:if(e!==50)break;i.protocolVersion=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Mw.fromPartial(e??{})},fromPartial(e){let t=jw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t.parentRunId=e.parentRunId??void 0,t.input=e.input!==void 0&&e.input!==null?JC.fromPartial(e.input):void 0,t.protocolVersion=e.protocolVersion??void 0,t}};function Nw(){return{baseEvent:void 0,threadId:``,runId:``,result:void 0,outcome:``,interrupts:[],usage:[],pendingToolCallIds:[]}}var Pw={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),e.result!==void 0&&Z.encode(Z.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==``&&t.uint32(42).string(e.outcome);for(let n of e.interrupts)XC.encode(n,t.uint32(50).fork()).join();for(let n of e.usage)uT.encode(n,t.uint32(58).fork()).join();for(let n of e.pendingToolCallIds)t.uint32(66).string(n);return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Nw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue;case 4:if(e!==34)break;i.result=Z.unwrap(Z.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.outcome=n.string();continue;case 6:if(e!==50)break;i.interrupts.push(XC.decode(n,n.uint32()));continue;case 7:if(e!==58)break;i.usage.push(uT.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.pendingToolCallIds.push(n.string());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Pw.fromPartial(e??{})},fromPartial(e){let t=Nw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interrupts=e.interrupts?.map(e=>XC.fromPartial(e))||[],t.usage=e.usage?.map(e=>uT.fromPartial(e))||[],t.pendingToolCallIds=e.pendingToolCallIds?.map(e=>e)||[],t}};function Fw(){return{baseEvent:void 0,code:void 0,message:``,usage:[]}}var Iw={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==``&&t.uint32(26).string(e.message);for(let n of e.usage)uT.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Fw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.code=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.usage.push(uT.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Iw.fromPartial(e??{})},fromPartial(e){let t=Fw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??``,t.usage=e.usage?.map(e=>uT.fromPartial(e))||[],t}};function Lw(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Rw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Lw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Rw.fromPartial(e??{})},fromPartial(e){let t=Lw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function zw(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Bw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=zw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Bw.fromPartial(e??{})},fromPartial(e){let t=zw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Vw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``}}var Hw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Vw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Hw.fromPartial(e??{})},fromPartial(e){let t=Vw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t}};function Uw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,role:``}}var Ww={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.role!==``&&t.uint32(34).string(e.role),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Uw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.role=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ww.fromPartial(e??{})},fromPartial(e){let t=Uw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.role=e.role??``,t}};function Gw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,delta:``}}var Kw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.delta!==``&&t.uint32(34).string(e.delta),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Gw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Kw.fromPartial(e??{})},fromPartial(e){let t=Gw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.delta=e.delta??``,t}};function qw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``}}var Jw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=qw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Jw.fromPartial(e??{})},fromPartial(e){let t=qw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t}};function Yw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:void 0,delta:void 0}}var Xw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==void 0&&t.uint32(26).string(e.messageId),e.delta!==void 0&&t.uint32(34).string(e.delta),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Yw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Xw.fromPartial(e??{})},fromPartial(e){let t=Yw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??void 0,t.delta=e.delta??void 0,t}};function Zw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``}}var Qw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Zw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Qw.fromPartial(e??{})},fromPartial(e){let t=Zw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t}};function $w(){return{baseEvent:void 0,subagentRunId:void 0,subtype:``,entityId:``,encryptedValue:``}}var eT={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.subtype!==``&&t.uint32(26).string(e.subtype),e.entityId!==``&&t.uint32(34).string(e.entityId),e.encryptedValue!==``&&t.uint32(42).string(e.encryptedValue),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=$w();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.subtype=n.string();continue;case 4:if(e!==34)break;i.entityId=n.string();continue;case 5:if(e!==42)break;i.encryptedValue=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return eT.fromPartial(e??{})},fromPartial(e){let t=$w();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.subtype=e.subtype??``,t.entityId=e.entityId??``,t.encryptedValue=e.encryptedValue??``,t}};function tT(){return{baseEvent:void 0,subagentRunId:``,name:``,description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var nT={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.name!==``&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=tT();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.name=n.string();continue;case 4:if(e!==34)break;i.description=n.string();continue;case 5:if(e!==42)break;i.parentSubagentRunId=n.string();continue;case 6:if(e!==50)break;i.parentToolCallId=n.string();continue;case 7:if(e!==58)break;i.parentMessageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return nT.fromPartial(e??{})},fromPartial(e){let t=tT();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.name=e.name??``,t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function rT(){return{baseEvent:void 0,subagentRunId:``,result:void 0,outcome:``,interruptIds:[]}}var iT={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&Z.encode(Z.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==``&&t.uint32(34).string(e.outcome);for(let n of e.interruptIds)t.uint32(42).string(n);return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=rT();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.result=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.outcome=n.string();continue;case 5:if(e!==42)break;i.interruptIds.push(n.string());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return iT.fromPartial(e??{})},fromPartial(e){let t=rT();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interruptIds=e.interruptIds?.map(e=>e)||[],t}};function aT(){return{baseEvent:void 0,subagentRunId:``,message:``,code:void 0}}var oT={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.message!==``&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=aT();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.code=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return oT.fromPartial(e??{})},fromPartial(e){let t=aT();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.message=e.message??``,t.code=e.code??void 0,t}};function sT(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0,toolCallResult:void 0,activitySnapshot:void 0,activityDelta:void 0,reasoningStart:void 0,reasoningMessageStart:void 0,reasoningMessageContent:void 0,reasoningMessageEnd:void 0,reasoningMessageChunk:void 0,reasoningEnd:void 0,reasoningEncryptedValue:void 0}}var cT={encode(e,t=new Y){return e.textMessageStart!==void 0&&ew.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&nw.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&iw.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&cw.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&uw.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&fw.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&vw.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&bw.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Sw.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Ow.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Aw.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Mw.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Pw.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Iw.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Rw.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Bw.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&ow.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&mw.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&nT.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&iT.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&oT.encode(e.subagentError,t.uint32(170).fork()).join(),e.toolCallResult!==void 0&&gw.encode(e.toolCallResult,t.uint32(178).fork()).join(),e.activitySnapshot!==void 0&&ww.encode(e.activitySnapshot,t.uint32(186).fork()).join(),e.activityDelta!==void 0&&Ew.encode(e.activityDelta,t.uint32(194).fork()).join(),e.reasoningStart!==void 0&&Hw.encode(e.reasoningStart,t.uint32(202).fork()).join(),e.reasoningMessageStart!==void 0&&Ww.encode(e.reasoningMessageStart,t.uint32(210).fork()).join(),e.reasoningMessageContent!==void 0&&Kw.encode(e.reasoningMessageContent,t.uint32(218).fork()).join(),e.reasoningMessageEnd!==void 0&&Jw.encode(e.reasoningMessageEnd,t.uint32(226).fork()).join(),e.reasoningMessageChunk!==void 0&&Xw.encode(e.reasoningMessageChunk,t.uint32(234).fork()).join(),e.reasoningEnd!==void 0&&Qw.encode(e.reasoningEnd,t.uint32(242).fork()).join(),e.reasoningEncryptedValue!==void 0&&eT.encode(e.reasoningEncryptedValue,t.uint32(250).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=sT();for(;n.pos>>3){case 1:if(e!==10)break;i.textMessageStart=ew.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.textMessageContent=nw.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.textMessageEnd=iw.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.toolCallStart=cw.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.toolCallArgs=uw.decode(n,n.uint32());continue;case 6:if(e!==50)break;i.toolCallEnd=fw.decode(n,n.uint32());continue;case 7:if(e!==58)break;i.stateSnapshot=vw.decode(n,n.uint32());continue;case 8:if(e!==66)break;i.stateDelta=bw.decode(n,n.uint32());continue;case 9:if(e!==74)break;i.messagesSnapshot=Sw.decode(n,n.uint32());continue;case 10:if(e!==82)break;i.raw=Ow.decode(n,n.uint32());continue;case 11:if(e!==90)break;i.custom=Aw.decode(n,n.uint32());continue;case 12:if(e!==98)break;i.runStarted=Mw.decode(n,n.uint32());continue;case 13:if(e!==106)break;i.runFinished=Pw.decode(n,n.uint32());continue;case 14:if(e!==114)break;i.runError=Iw.decode(n,n.uint32());continue;case 15:if(e!==122)break;i.stepStarted=Rw.decode(n,n.uint32());continue;case 16:if(e!==130)break;i.stepFinished=Bw.decode(n,n.uint32());continue;case 17:if(e!==138)break;i.textMessageChunk=ow.decode(n,n.uint32());continue;case 18:if(e!==146)break;i.toolCallChunk=mw.decode(n,n.uint32());continue;case 19:if(e!==154)break;i.subagentStarted=nT.decode(n,n.uint32());continue;case 20:if(e!==162)break;i.subagentFinished=iT.decode(n,n.uint32());continue;case 21:if(e!==170)break;i.subagentError=oT.decode(n,n.uint32());continue;case 22:if(e!==178)break;i.toolCallResult=gw.decode(n,n.uint32());continue;case 23:if(e!==186)break;i.activitySnapshot=ww.decode(n,n.uint32());continue;case 24:if(e!==194)break;i.activityDelta=Ew.decode(n,n.uint32());continue;case 25:if(e!==202)break;i.reasoningStart=Hw.decode(n,n.uint32());continue;case 26:if(e!==210)break;i.reasoningMessageStart=Ww.decode(n,n.uint32());continue;case 27:if(e!==218)break;i.reasoningMessageContent=Kw.decode(n,n.uint32());continue;case 28:if(e!==226)break;i.reasoningMessageEnd=Jw.decode(n,n.uint32());continue;case 29:if(e!==234)break;i.reasoningMessageChunk=Xw.decode(n,n.uint32());continue;case 30:if(e!==242)break;i.reasoningEnd=Qw.decode(n,n.uint32());continue;case 31:if(e!==250)break;i.reasoningEncryptedValue=eT.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return cT.fromPartial(e??{})},fromPartial(e){let t=sT();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?ew.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?nw.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?iw.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?cw.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?uw.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?fw.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?vw.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?bw.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Sw.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Ow.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Aw.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Mw.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Pw.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Iw.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Rw.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Bw.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?ow.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?mw.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?nT.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?iT.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?oT.fromPartial(e.subagentError):void 0,t.toolCallResult=e.toolCallResult!==void 0&&e.toolCallResult!==null?gw.fromPartial(e.toolCallResult):void 0,t.activitySnapshot=e.activitySnapshot!==void 0&&e.activitySnapshot!==null?ww.fromPartial(e.activitySnapshot):void 0,t.activityDelta=e.activityDelta!==void 0&&e.activityDelta!==null?Ew.fromPartial(e.activityDelta):void 0,t.reasoningStart=e.reasoningStart!==void 0&&e.reasoningStart!==null?Hw.fromPartial(e.reasoningStart):void 0,t.reasoningMessageStart=e.reasoningMessageStart!==void 0&&e.reasoningMessageStart!==null?Ww.fromPartial(e.reasoningMessageStart):void 0,t.reasoningMessageContent=e.reasoningMessageContent!==void 0&&e.reasoningMessageContent!==null?Kw.fromPartial(e.reasoningMessageContent):void 0,t.reasoningMessageEnd=e.reasoningMessageEnd!==void 0&&e.reasoningMessageEnd!==null?Jw.fromPartial(e.reasoningMessageEnd):void 0,t.reasoningMessageChunk=e.reasoningMessageChunk!==void 0&&e.reasoningMessageChunk!==null?Xw.fromPartial(e.reasoningMessageChunk):void 0,t.reasoningEnd=e.reasoningEnd!==void 0&&e.reasoningEnd!==null?Qw.fromPartial(e.reasoningEnd):void 0,t.reasoningEncryptedValue=e.reasoningEncryptedValue!==void 0&&e.reasoningEncryptedValue!==null?eT.fromPartial(e.reasoningEncryptedValue):void 0,t}};function lT(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0,cacheWriteInputTokens:void 0}}var uT={encode(e,t=new Y){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),e.cacheWriteInputTokens!==void 0&&t.uint32(64).int64(e.cacheWriteInputTokens),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=lT();for(;n.pos>>3){case 1:if(e!==10)break;i.provider=n.string();continue;case 2:if(e!==18)break;i.model=n.string();continue;case 3:if(e!==24)break;i.inputTokens=dT(n.int64());continue;case 4:if(e!==32)break;i.outputTokens=dT(n.int64());continue;case 5:if(e!==40)break;i.totalTokens=dT(n.int64());continue;case 6:if(e!==48)break;i.reasoningTokens=dT(n.int64());continue;case 7:if(e!==56)break;i.cachedInputTokens=dT(n.int64());continue;case 8:if(e!==64)break;i.cacheWriteInputTokens=dT(n.int64());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return uT.fromPartial(e??{})},fromPartial(e){let t=lT();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t.cacheWriteInputTokens=e.cacheWriteInputTokens??void 0,t}};function dT(e){let t=globalThis.Number(e.toString());if(t>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error(`Value is larger than Number.MAX_SAFE_INTEGER`);if(te&&typeof e==`object`?e:void 0,pT=e=>Array.isArray(e)?e:[],mT=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS,hT=()=>{mT()||console.warn(`[ag-ui][proto] Dropped a content part this build does not know: the protocol has a variant this SDK predates.`)};new Set(Object.values(I));var gT={textMessageStart:`TEXT_MESSAGE_START`,textMessageContent:`TEXT_MESSAGE_CONTENT`,textMessageEnd:`TEXT_MESSAGE_END`,textMessageChunk:`TEXT_MESSAGE_CHUNK`,toolCallStart:`TOOL_CALL_START`,toolCallArgs:`TOOL_CALL_ARGS`,toolCallEnd:`TOOL_CALL_END`,toolCallChunk:`TOOL_CALL_CHUNK`,toolCallResult:`TOOL_CALL_RESULT`,stateSnapshot:`STATE_SNAPSHOT`,stateDelta:`STATE_DELTA`,messagesSnapshot:`MESSAGES_SNAPSHOT`,activitySnapshot:`ACTIVITY_SNAPSHOT`,activityDelta:`ACTIVITY_DELTA`,raw:`RAW`,custom:`CUSTOM`,runStarted:`RUN_STARTED`,runFinished:`RUN_FINISHED`,runError:`RUN_ERROR`,stepStarted:`STEP_STARTED`,stepFinished:`STEP_FINISHED`,reasoningStart:`REASONING_START`,reasoningMessageStart:`REASONING_MESSAGE_START`,reasoningMessageContent:`REASONING_MESSAGE_CONTENT`,reasoningMessageEnd:`REASONING_MESSAGE_END`,reasoningMessageChunk:`REASONING_MESSAGE_CHUNK`,reasoningEnd:`REASONING_END`,reasoningEncryptedValue:`REASONING_ENCRYPTED_VALUE`,subagentStarted:`SUBAGENT_STARTED`,subagentFinished:`SUBAGENT_FINISHED`,subagentError:`SUBAGENT_ERROR`},_T=new Set([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]),vT=e=>{let t=fT(e);if(t){if([t.data,t.url,t.file].filter(Boolean).length>1)throw Error(`Invalid event: source carries more than one arm`);if(t.data){let e=t.data;return{type:`data`,value:e.value,mimeType:e.mimeType}}if(t.url){let e=t.url;return{type:`url`,value:e.value,mimeType:e.mimeType}}if(t.file){let e=t.file;return{type:`file`,value:e.value,provider:e.provider,mimeType:e.mimeType}}}},yT=e=>{let t=fT(e);if(t){if([t.text,t.image,t.audio,t.video,t.document].filter(Boolean).length>1)throw Error(`Invalid event: content part carries more than one arm`);if(t.text){let e=t.text;return{type:`text`,id:e.id,text:e.text,metadata:e.metadata}}if(t.image){let e=t.image;return e.source!==void 0&&vT(e.source)===void 0?void 0:{type:`image`,id:e.id,source:vT(e.source),metadata:e.metadata}}if(t.audio){let e=t.audio;return e.source!==void 0&&vT(e.source)===void 0?void 0:{type:`audio`,id:e.id,source:vT(e.source),metadata:e.metadata}}if(t.video){let e=t.video;return e.source!==void 0&&vT(e.source)===void 0?void 0:{type:`video`,id:e.id,source:vT(e.source),metadata:e.metadata}}if(t.document){let e=t.document;return e.source!==void 0&&vT(e.source)===void 0?void 0:{type:`document`,id:e.id,source:vT(e.source),metadata:e.metadata}}}},bT=new Set([`activity`]),xT=new Set([`user`,`tool`]),ST=new Set([`developer`,`system`,`assistant`,`user`,`tool`,`activity`,`reasoning`]),CT=e=>{let t=fT(e)??{},n={...t},r=typeof t.role==`string`?t.role:``,i=ST.has(r),a=i?xT.has(r):pT(t.contentParts).length>0,o=i?bT.has(r):!a&&t.activityContent!==void 0;if(!i&&(t.content===void 0?0:1)+ +(pT(t.contentParts).length>0)+(t.activityContent===void 0?0:1)>1)throw Error(`Invalid event: message carries more than one content form`);if(i){if(!a&&pT(t.contentParts).length>0)throw Error(`Invalid event: message carries content parts for a role that has none`);if(t.activityContent!==void 0&&!o)throw Error(`Invalid event: message carries activity content for a non-activity role`);if(o&&t.content!==void 0)throw Error(`Invalid event: activity content cannot ride with other content forms`);if(a&&t.content!==void 0&&pT(t.contentParts).length>0)throw Error(`Invalid event: message carries both string content and content parts`)}return a&&t.content===void 0&&(n.content=pT(t.contentParts).map(e=>{let t=yT(e);return t===void 0&&hT(),t}).filter(e=>e!==void 0)),o&&t.activityContent!==void 0&&(n.content=t.activityContent),delete n.activityContent,delete n.contentParts,pT(t.toolCalls).length===0&&delete n.toolCalls,Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),n},wT=e=>{if(Array.isArray(e)){for(let t of e)wT(t);return}let t=fT(e);if(t)for(let e of Object.keys(t))t[e]===void 0?delete t[e]:wT(t[e])},TT=e=>{let t=fT(e);if(!t)return;let n={};return t.threadId!==void 0&&(n.threadId=t.threadId),t.runId!==void 0&&(n.runId=t.runId),t.protocolVersion!==void 0&&(n.protocolVersion=t.protocolVersion),t.parentRunId!==void 0&&(n.parentRunId=t.parentRunId),t.state!==void 0&&(n.state=t.state),n.messages=pT(t.messages).map(CT).filter(e=>e!==void 0),n.tools=pT(t.tools),n.context=pT(t.context),t.forwardedProps!==void 0&&(n.forwardedProps=t.forwardedProps),n.resume=pT(t.resume),n},ET={TextMessageStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},BaseEvent:{singular:new Set([3,4]),descend:{},google:{3:`google.protobuf.Value`,4:`google.protobuf.Struct`}},TextMessageContentEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},TextMessageEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallArgsEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},StateSnapshotEvent:{singular:new Set([1,2]),descend:{1:`BaseEvent`},google:{2:`google.protobuf.Value`}},StateDeltaEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,2:`JsonPatchOperation`}},JsonPatchOperation:{singular:new Set([4]),descend:{},google:{4:`google.protobuf.Value`}},MessagesSnapshotEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,2:`Message`}},Message:{singular:new Set([9,13]),descend:{5:`ToolCall`,8:`InputContent`},google:{9:`google.protobuf.Struct`,13:`google.protobuf.Struct`}},ToolCall:{singular:new Set([3,4]),descend:{},google:{4:`google.protobuf.Struct`}},InputContent:{singular:new Set([1,2,3,4,5]),descend:{1:`TextInputPart`,2:`ImageInputPart`,3:`AudioInputPart`,4:`VideoInputPart`,5:`DocumentInputPart`},arms:new Set([1,2,3,4,5])},TextInputPart:{singular:new Set([3]),descend:{},google:{3:`google.protobuf.Value`}},ImageInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},InputContentSource:{singular:new Set([1,2,3]),descend:{},arms:new Set([1,2,3])},AudioInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},VideoInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},DocumentInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},RawEvent:{singular:new Set([1,2]),descend:{1:`BaseEvent`},google:{2:`google.protobuf.Value`}},CustomEvent:{singular:new Set([1,3]),descend:{1:`BaseEvent`},google:{3:`google.protobuf.Value`}},RunStartedEvent:{singular:new Set([1,5]),descend:{1:`BaseEvent`,5:`RunAgentInput`}},RunAgentInput:{singular:new Set([4,8]),descend:{5:`Message`,6:`Tool`,9:`ResumeEntry`},google:{4:`google.protobuf.Value`,8:`google.protobuf.Value`}},Tool:{singular:new Set([3,4]),descend:{},google:{3:`google.protobuf.Value`,4:`google.protobuf.Struct`}},ResumeEntry:{singular:new Set([3,4]),descend:{},google:{3:`google.protobuf.Value`,4:`google.protobuf.Struct`}},RunFinishedEvent:{singular:new Set([1,4]),descend:{1:`BaseEvent`,6:`Interrupt`},google:{4:`google.protobuf.Value`}},Interrupt:{singular:new Set([5,7]),descend:{},google:{5:`google.protobuf.Value`,7:`google.protobuf.Value`}},RunErrorEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},StepStartedEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},StepFinishedEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},TextMessageChunkEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallChunkEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},SubagentStartedEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},SubagentFinishedEvent:{singular:new Set([1,3]),descend:{1:`BaseEvent`},google:{3:`google.protobuf.Value`}},SubagentErrorEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallResultEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,7:`InputContent`}},ActivitySnapshotEvent:{singular:new Set([1,5]),descend:{1:`BaseEvent`},google:{5:`google.protobuf.Struct`}},ActivityDeltaEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,5:`JsonPatchOperation`}},ReasoningStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageContentEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageChunkEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningEncryptedValueEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},"google.protobuf.Struct":{singular:new Set,descend:{1:`google.protobuf.Struct.FieldsEntry`}},"google.protobuf.Struct.FieldsEntry":{singular:new Set([2]),descend:{2:`google.protobuf.Value`}},"google.protobuf.Value":{singular:new Set([5,6]),descend:{5:`google.protobuf.Struct`,6:`google.protobuf.ListValue`},arms:new Set([1,2,3,4,5,6]),armWireTypes:{1:0,2:1,3:2,4:0,5:2,6:2}},"google.protobuf.ListValue":{singular:new Set,descend:{1:`google.protobuf.Value`}}},DT={1:`TextMessageStartEvent`,2:`TextMessageContentEvent`,3:`TextMessageEndEvent`,4:`ToolCallStartEvent`,5:`ToolCallArgsEvent`,6:`ToolCallEndEvent`,7:`StateSnapshotEvent`,8:`StateDeltaEvent`,9:`MessagesSnapshotEvent`,10:`RawEvent`,11:`CustomEvent`,12:`RunStartedEvent`,13:`RunFinishedEvent`,14:`RunErrorEvent`,15:`StepStartedEvent`,16:`StepFinishedEvent`,17:`TextMessageChunkEvent`,18:`ToolCallChunkEvent`,19:`SubagentStartedEvent`,20:`SubagentFinishedEvent`,21:`SubagentErrorEvent`,22:`ToolCallResultEvent`,23:`ActivitySnapshotEvent`,24:`ActivityDeltaEvent`,25:`ReasoningStartEvent`,26:`ReasoningMessageStartEvent`,27:`ReasoningMessageContentEvent`,28:`ReasoningMessageEndEvent`,29:`ReasoningMessageChunkEvent`,30:`ReasoningEndEvent`,31:`ReasoningEncryptedValueEvent`};function OT(e,t){let n=0,r=0;for(;;){if(t.offset>=e.length)throw Error(`Invalid event`);let i=e[t.offset++];if(r<28?n+=(i&127)*2**r:r===28&&(n+=(i&15)*2**28),r+=7,!(i&128))return n}}function kT(e,t){let n={offset:0},r=0,i=0;for(;n.offsete.length)throw Error(`Invalid event`);if(r===0){if(t.arms?.has(o)){if(i!==0&&i!==o)throw Error(`Invalid event`);i=o}let r=t.descend[o];if(r!==void 0){let t=ET[r];t!==void 0&&kT(e.subarray(n.offset,n.offset+a),t)}}n.offset+=a}else if(s===5)n.offset+=4;else throw Error(`Invalid event`);if(n.offset>e.length)throw Error(`Invalid event`)}if(r!==0)throw Error(`Invalid event`)}function AT(e){let t=new Set,n={offset:0},r=0;for(;n.offset0&&!t.has(a))throw Error(`Invalid event`);t.add(a)}if(o===0)OT(e,n);else if(o===1)n.offset+=8;else if(o===2){let t=OT(e,n);if(n.offset+t>e.length)throw Error(`Invalid event`);if(r===0){let r=DT[a];if(r!==void 0){let i=ET[r];i!==void 0&&kT(e.subarray(n.offset,n.offset+t),i)}}n.offset+=t}else if(o===5)n.offset+=4;else throw Error(`Invalid event`);if(n.offset>e.length)throw Error(`Invalid event`)}if(r!==0)throw Error(`Invalid event`)}function jT(e){if(e.length===1)return e[0];let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}function MT(e,t){let n=new X(e),r=[],i=new Map,a,o=!1;for(;n.pos1||n!==t){s.push(new Y().uint32(e.number*8+2).bytes(n).finish()),o=!0;continue}}s.push(e.raw)}return o?jT(s):e}var NT=class extends Error{constructor(e=`Unknown event type`){super(e),this.name=`AGUIUnknownEventTypeError`}};function PT(e,t,n,r){let i=0,a=0,o=0;for(;;){if(t.offset>=e.length||o>=n)return-1;let s=e[t.offset++];if(o+=1,o===n&&s>r)return-1;if(i+=(s&127)*2**a,a+=7,!(s&128))return i}}var FT=(e,t)=>PT(e,t,5,15),IT=(e,t)=>PT(e,t,10,1);function LT(e){let t={offset:0},n=[];for(;t.offsete.length)return!1;t.offset+=n}else return!1;if(t.offset>e.length)return!1}return n.length===0}function RT(e){let t={offset:0},n=[],r=0;for(;t.offsete.length)return!1;if(s){if(_T.has(a)||!LT(e.subarray(t.offset,t.offset+n)))return!1;r+=1}t.offset+=n}else return!1;if(t.offset>e.length)return!1}return n.length===0&&r>0}function zT(e){AT(e);let t=cT.decode(MT(e,{singular:_T,descend:DT})),n=Object.entries(t).filter(([,e])=>e!==void 0);if(n.length!==1)throw n.length===0&&RT(e)?new NT:Error(`Invalid event`);let r=n[0],i=gT[r[0]];if(i===void 0)throw Error(`Invalid event`);let a=r[1],o=fT(a.baseEvent);if(!o)throw Error(`Invalid event`);let s=ZC[o.type];if(s!==i)throw Error(`Invalid event: envelope carries `+i+` but the base event declares `+String(s));if(a.type=i,a.timestamp=o.timestamp,a.rawEvent=o.rawEvent,o.metadata!==void 0&&(a.metadata=o.metadata),delete a.baseEvent,a.type===`MESSAGES_SNAPSHOT`&&Array.isArray(a.messages)&&(a.messages=a.messages.map(CT).filter(e=>e!==void 0)),a.type===`RUN_FINISHED`){let e=a,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,n={};n.pendingToolCallIds=e.pendingToolCallIds,delete e.pendingToolCallIds,n.interrupts=e.interrupts,delete e.interrupts,delete e.outcome,t===void 0&&(pT(n.pendingToolCallIds).length>0&&(e.pendingToolCallIds=n.pendingToolCallIds),pT(n.interrupts).length>0&&(e.interrupts=n.interrupts)),t===`success`&&(e.outcome={type:`success`,...pT(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{},...pT(n.interrupts).length>0?{interrupts:n.interrupts}:{}}),t===`interrupt`&&(e.outcome={type:`interrupt`,interrupts:pT(n.interrupts),...pT(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{}}),t===`cancelled`&&(e.outcome={type:`cancelled`,...pT(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{},...pT(n.interrupts).length>0?{interrupts:n.interrupts}:{}}),t!==void 0&&![`success`,`interrupt`,`cancelled`].includes(t)&&(e.outcome={type:t,...pT(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{},...pT(n.interrupts).length>0?{interrupts:n.interrupts}:{}})}if(a.type===`SUBAGENT_FINISHED`){let e=a,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,n={};n.interruptIds=e.interruptIds,delete e.interruptIds,delete e.outcome,t===void 0&&pT(n.interruptIds).length>0&&(e.interruptIds=n.interruptIds),t===`success`&&(e.outcome={type:`success`,...pT(n.interruptIds).length>0?{interruptIds:n.interruptIds}:{}}),t===`suspended`&&(e.outcome={type:`suspended`,...pT(n.interruptIds).length>0?{interruptIds:n.interruptIds}:{}}),t!==void 0&&![`success`,`suspended`].includes(t)&&(e.outcome={type:t,...pT(n.interruptIds).length>0?{interruptIds:n.interruptIds}:{}})}if(a.type===`STATE_DELTA`&&Array.isArray(a.delta)&&(a.delta=a.delta.map(e=>{let t=fC[e.op];return e.op=typeof t==`string`&&t!==`UNRECOGNIZED`?t.toLowerCase():String(e.op),Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]}),e})),a.type===`ACTIVITY_DELTA`&&Array.isArray(a.patch)&&(a.patch=a.patch.map(e=>{let t=fC[e.op];return e.op=typeof t==`string`&&t!==`UNRECOGNIZED`?t.toLowerCase():String(e.op),Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]}),e})),a.type===`RUN_FINISHED`&&Array.isArray(a.usage)&&a.usage.length===0&&delete a.usage,a.type===`RUN_ERROR`&&Array.isArray(a.usage)&&a.usage.length===0&&delete a.usage,a.type===`TOOL_CALL_RESULT`){let e=a;if(e.content!==void 0&&pT(e.contentParts).length>0)throw Error(`Invalid event: content carries both string content and content parts`);e.content===void 0&&(e.content=pT(e.contentParts).map(e=>{let t=yT(e);return t===void 0&&hT(),t}).filter(e=>e!==void 0)),delete e.contentParts}return a.type===`RUN_STARTED`&&a.input!==void 0&&(a.input=TT(a.input)),wT(a),a}var BT=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,VT=e=>{if(typeof e!=`string`)throw TypeError(`Invalid argument expected string`);let t=e.match(BT);if(!t)throw Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},HT=e=>e===`*`||e===`x`||e===`X`,UT=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},WT=(e,t)=>typeof e==typeof t?[e,t]:[String(e),String(t)],GT=(e,t)=>{if(HT(e)||HT(t))return 0;let[n,r]=WT(UT(e),UT(t));return n>r?1:n{for(let n=0;n{let n=VT(e),r=VT(t),i=n.pop(),a=r.pop(),o=KT(n,r);return o===0?i&&a?KT(i.split(`.`),a.split(`.`)):i||a?i?-1:1:0:o},JT=e=>typeof e==`string`&&/^[v\d]/.test(e)&&BT.test(e);Object.freeze({status:`aborted`});function $(e,t,n){function r(n,r){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r);for(let e in o.prototype)e in n||Object.defineProperty(n,e,{value:o.prototype[e].bind(n)});n._zod.constr=o,n._zod.def=r}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 YT=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},XT={};function ZT(e){return e&&Object.assign(XT,e),XT}function QT(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 $T(e,t){return typeof t==`bigint`?t.toString():t}function eE(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function tE(e){return e==null}function nE(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function rE(e,t,n){Object.defineProperty(e,t,{get(){{let r=n();return e[t]=r,r}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function iE(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function aE(e){return JSON.stringify(e)}var oE=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function sE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var cE=eE(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function lE(e){if(sE(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return sE(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}var uE=new Set([`string`,`number`,`symbol`]);function dE(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fE(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function pE(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 mE(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function hE(e,t){let n={},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=r.shape[e])}return fE(e,{...e._zod.def,shape:n,checks:[]})}function gE(e,t){let n={...e._zod.def.shape},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return fE(e,{...e._zod.def,shape:n,checks:[]})}function _E(e,t){if(!lE(t))throw Error(`Invalid input to extend: expected a plain object`);return fE(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return iE(this,`shape`,n),n},checks:[]})}function vE(e,t){return fE(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return iE(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function yE(e,t,n){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 fE(t,{...t._zod.def,shape:i,checks:[]})}function bE(e,t,n){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 fE(t,{...t._zod.def,shape:i,checks:[]})}function xE(e,t=0){for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function CE(e){return typeof e==`string`?e:e?.message}function wE(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=CE(e.inst?._zod.def?.error?.(e))??CE(t?.error?.(e))??CE(n.customError?.(e))??CE(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function TE(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function EE(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var DE=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,$T,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},OE=$(`$ZodError`,DE),kE=$(`$ZodError`,DE,{Parent:Error});function AE(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 jE(e,t){let n=t||function(e){return e.message},r={_errors:[]},i=e=>{for(let t of e.issues)if(t.code===`invalid_union`&&t.errors.length)t.errors.map(e=>i({issues:e}));else if(t.code===`invalid_key`)i({issues:t.issues});else if(t.code===`invalid_element`)i({issues:t.issues});else if(t.path.length===0)r._errors.push(n(t));else{let e=r,i=0;for(;i(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 YT;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>wE(e,a,ZT())));throw oE(t,i?.callee),t}return o.value},NE=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=>wE(e,a,ZT())));throw oE(t,i?.callee),t}return o.value},PE=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 YT;return a.issues.length?{success:!1,error:new(e??OE)(a.issues.map(e=>wE(e,i,ZT())))}:{success:!0,data:a.value}},FE=PE(kE),IE=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=>wE(e,i,ZT())))}:{success:!0,data:a.value}},LE=IE(kE),RE=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),zE=$(`$ZodCheckMaxLength`,(e,t)=>{var n;RE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!tE(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=TE(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),BE=$(`$ZodCheckMinLength`,(e,t)=>{var n;RE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!tE(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=TE(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),VE=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;RE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!tE(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=TE(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})}}),HE=$(`$ZodCheckOverwrite`,(e,t)=>{RE.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),UE=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(` +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}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function sv(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;sv(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var cv=new Set([`type`,`properties`,`required`,`additionalProperties`]),lv=[`oneOf`,`anyOf`];function uv(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function dv(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!cv.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??uv(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}$d(n,r,e.length===1?e[0]:dv(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=uv(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function fv(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of cv)if(t in e)return;let n=t.filter(e=>lv.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=dv(t);else{let e=n[0],i=lv.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>dv([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,tv(e,r))}function pv(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)):tv(i,s),tv(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())sv(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])fv(e)}}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)}tv(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,$d(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:gv(t,`input`,e.processors),output:gv(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function mv(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 mv(r.element,n);if(r.type===`set`)return mv(r.valueType,n);if(r.type===`lazy`)return mv(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`||r.type===`catch`)return mv(r.innerType,n);if(r.type===`intersection`)return mv(r.left,n)||mv(r.right,n);if(r.type===`record`||r.type===`map`)return mv(r.keyType,n)||mv(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:mv(r.in,n)||mv(r.out,n);if(r.type===`object`){for(let e in r.shape)if(mv(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(mv(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(mv(e,n))return!0;return!!(r.rest&&mv(r.rest,n))}return!1}var hv=(e,t={})=>n=>{let r=nv({...n,processors:t});return iv(e,r),ov(r,e),pv(r,e)},gv=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=nv({...i??{},target:a,io:t,processors:n});return iv(e,o),ov(o,e),pv(o,e)},_v=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},vv=(e,t,n)=>{(e[t]===void 0||n{_v(e,`minimum`,t),vv(e,`maximum`,t)},bv=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},xv=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Sv=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Cv=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},wv=(e,t)=>_v(e,`minimum`,t.minimum),Tv=(e,t)=>vv(e,`maximum`,t.maximum),Ev=e=>(t,n)=>{Cv(t,n.format);let[r,i]=e[n.format];_v(t,`minimum`,r),vv(t,`maximum`,i)},Dv={greater_than:(e,t)=>_v(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>vv(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>bv(e,t.value),number_format:Ev(bf),bigint_format:Ev(xf),min_length:wv,max_length:Tv,length_equals:(e,t)=>yv(e,t.length),min_size:wv,max_size:Tv,size_equals:(e,t)=>yv(e,t.size),string_format:(e,t)=>{Cv(e,t.format),t.pattern&&xv(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Sv(e,t.mime)};function Ov(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Dv[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&_v(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&_v(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&vv(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&vv(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&bv(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Sv(t,i.mime);for(let e of i.patterns??[])xv(t,e);return t}var kv={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Av=new Map([[Sh,nm],[wh,rm]]),jv=e=>Av.get(e)??e,Mv=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Ov(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=kv[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(jv);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}))])}},Nv=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Ov(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):rv(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Pv=(e,t,n,r)=>{n.type=`boolean`},Fv=(e,t,n,r)=>{rv(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Iv=(e,t,n,r)=>{rv(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},Lv=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Rv=(e,t,n,r)=>{rv(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},zv=(e,t,n,r)=>{rv(e,t,n,r,`Void cannot be represented in JSON Schema`)},Bv=(e,t,n,r)=>{n.not={}},Vv=(e,t,n,r)=>{},Hv=(e,t,n,r)=>{},Uv=(e,t,n,r)=>{rv(e,t,n,r,`Date cannot be represented in JSON Schema`)},Wv=(e,t,n,r)=>{let i=e._zod.def,a=Ud(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Gv=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(rv(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(rv(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},Kv=(e,t,n,r)=>{rv(e,t,n,r,`NaN cannot be represented in JSON Schema`)},qv=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Jv=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=Ov(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},Yv=(e,t,n,r)=>{n.type=`boolean`},Xv=(e,t,n,r)=>{rv(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Zv=(e,t,n,r)=>{rv(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Qv=(e,t,n,r)=>{rv(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},$v=(e,t,n,r)=>{rv(e,t,n,r,`Map cannot be represented in JSON Schema`)},ey=(e,t,n,r)=>{rv(e,t,n,r,`Set cannot be represented in JSON Schema`)},ty=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Ov(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=iv(a.element,t,{...r,path:[...r.path,`items`]})};function ny(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?ny(t.out):t.type===`catch`?ny(t.innerType):e._zod.optin}var ry=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&rv(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)$d(i.properties,e,iv(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?ny(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=iv(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},iy=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>iv(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ay=(e,t,n,r)=>{let i=e._zod.def,a=iv(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=iv(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},oy=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>iv(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?iv(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?ny(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=Ov(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function sy(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=sy(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>sy(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?mm:pm).source),p):p}var cy=new WeakMap;function ly(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of cy.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=sy(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var uy=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Ov(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=iv(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)$d(i.patternProperties,jv(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=iv(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=cy.get(t);n||(n=[],cy.set(t,n),t.deferred.push(()=>ly(t))),n.push(e)}i.additionalProperties=iv(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&ny(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},dy=(e,t,n,r)=>{let i=e._zod.def,a=iv(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`}]},fy=(e,t,n,r)=>{let i=e._zod.def;iv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},py=Symbol();function my(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(rv(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),py):JSON.parse(o)}var hy=(e,t,n,r)=>{let i=e._zod.def;iv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=my(i.defaultValue,e,t,n,r);o!==py&&(n.default=o)},gy=(e,t,n,r)=>{let i=e._zod.def;iv(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=my(i.defaultValue,e,t,n,r);o!==py&&(n._prefault=o)},_y=(e,t,n,r)=>{let i=e._zod.def;iv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{rv(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},vy=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;iv(o,t,r);let s=t.seen.get(e);s.ref=o},yy=(e,t,n,r)=>{let i=e._zod.def;iv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},by=(e,t,n,r)=>{let i=e._zod.def;iv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},xy=(e,t,n,r)=>{let i=e._zod.def;iv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Sy=(e,t,n,r)=>{let i=e._zod.innerType;iv(i,t,r);let a=t.seen.get(e);a.ref=i},Cy={string:Mv,number:Nv,boolean:Pv,bigint:Fv,symbol:Iv,null:Lv,undefined:Rv,void:zv,never:Bv,any:Vv,unknown:Hv,date:Uv,enum:Wv,literal:Gv,nan:Kv,template_literal:qv,file:Jv,success:Yv,custom:Xv,function:Zv,transform:Qv,map:$v,set:ey,array:ty,object:ry,union:iy,intersection:ay,tuple:oy,record:uy,nullable:dy,nonoptional:fy,default:hy,prefault:gy,catch:_y,pipe:vy,readonly:yy,promise:by,optional:xy,lazy:Sy};function wy(e,t){if(`_idmap`in e){let n=e,r=nv({...t,processors:Cy}),i={};for(let e of n._idmap.entries()){let[t,n]=e;iv(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;ov(r,n),$d(a,t,pv(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=nv({...t,processors:Cy});return iv(e,n),ov(n,e),pv(n,e)}var Ty=new WeakSet([Object.prototype,Error.prototype]);function Ey(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Dy=H(`ZodError`,(e,t)=>{gp.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Ty.has(n)||(Ty.add(n),Ey(n,`format`,e=>t=>yp(e,t)),Ey(n,`flatten`,e=>t=>vp(e,t)),Ey(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Gd,2)}),Ey(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Gd,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Oy=xp(Dy),ky=Sp(Dy),Ay=Cp(Dy),jy=Tp(Dy),My=jp(Dy),Ny=Mp(Dy),Py=Np(Dy),Fy=Pp(Dy),Iy=Fp(Dy),Ly=Ip(Dy),Ry=Lp(Dy),zy=Rp(Dy);function By(){cp.localeError||lp(Hg())}function Vy(){cp.memoizer||lp({memoizer:zg()})}var Hy=H(`ZodType`,(e,t)=>(By(),Bm.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(sf(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return _f(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(_x(e,t))},superRefine(e,t){return this.check(vx(e,t))},overwrite(e){return this.check(W_(e))},optional(){return Yb(this)},exactOptional(){return Zb(this)},nullable(){return $b(this)},nullish(){return Yb($b(this))},nonoptional(e){return ax(this,e)},array(){return Mb(this)},or(e){return Ib([this,e])},and(e){return Bb(this,e)},transform(e){return lx(this,qb(e))},default(e){return tx(this,e)},prefault(e){return rx(this,e)},catch(e){return sx(this,e)},pipe(e){return lx(this,e)},readonly(){return fx(this)},describe(e){let t=this.clone();return Kg.add(t,{description:e}),t},meta(...e){if(e.length===0)return Kg.get(this);let t=this.clone();return Kg.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Gf(this,`~standard`,{...Um(this),jsonSchema:{input:gv(this,`input`),output:gv(this,`output`)}})},set"~standard"(e){Wf(this,`~standard`,e)},parse:function e(t,n){return Oy(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ky(this,t,n,{callee:e})},safeParse(e,t){return Ay(this,e,t)},async safeParseAsync(e,t){return jy(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Wf(this,`spa`,e)},validate(e,t){return Op(this,e,t)},validateAsync(e,t){return Ap(this,e,t)},encode:function e(t,n){return My(this,t,n,{callee:e})},decode:function e(t,n){return Ny(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Py(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Fy(this,t,n,{callee:e})},safeEncode(e,t){return Iy(this,e,t)},safeDecode(e,t){return Ly(this,e,t)},async safeEncodeAsync(e,t){return Ry(this,e,t)},async safeDecodeAsync(e,t){return zy(this,e,t)},toJSONSchema(e){return hv(this,{})(e)},get description(){return Kg.get(this)?.description},get _def(){return this._zod.def}}),Uy=H(`_ZodString`,(e,t)=>{Wm.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mv(e,t,n,r)},Kf({format:e=>Ov(e).format??null,minLength:e=>Ov(e).minimum??null,maxLength:e=>Ov(e).maximum??null},{regex(...e){return this.check(R_(...e))},includes(...e){return this.check(V_(...e))},startsWith(...e){return this.check(H_(...e))},endsWith(...e){return this.check(U_(...e))},min(...e){return this.check(I_(...e))},max(...e){return this.check(F_(...e))},length(...e){return this.check(L_(...e))},nonempty(...e){return this.check(I_(1,...e))},lowercase(e){return this.check(z_(e))},uppercase(e){return this.check(B_(e))},trim(){return this.check(K_())},normalize(...e){return this.check(G_(...e))},toLowerCase(){return this.check(q_())},toUpperCase(){return this.check(J_())},slugify(){return this.check(Y_())}})),Wy=H(`ZodString`,(e,t)=>{Wm.init(e,t),Uy.init(e,t)},{email(e){return this.check(Yg(Xy,e))},url(e){return this.check(t_(eb,e))},jwt(e){return this.check(g_(gb,e))},emoji(e){return this.check(n_(nb,e))},guid(e){return this.check(Xg(Qy,e))},uuid(e){return this.check(Zg($y,e))},uuidv4(e){return this.check(Qg($y,e))},uuidv6(e){return this.check($g($y,e))},uuidv7(e){return this.check(e_($y,e))},nanoid(e){return this.check(r_(rb,e))},cuid(e){return this.check(i_(ib,e))},cuid2(e){return this.check(a_(ab,e))},ulid(e){return this.check(o_(ob,e))},base64(e){return this.check(p_(pb,e))},base64url(e){return this.check(m_(mb,e))},xid(e){return this.check(s_(sb,e))},ksuid(e){return this.check(c_(cb,e))},ipv4(e){return this.check(l_(lb,e))},ipv6(e){return this.check(u_(ub,e))},cidrv4(e){return this.check(d_(db,e))},cidrv6(e){return this.check(f_(fb,e))},e164(e){return this.check(h_(hb,e))},datetime(e){return this.check(__(Ky,e))},date(e){return this.check(v_(qy,e))},time(e){return this.check(y_(Jy,e))},duration(e){return this.check(b_(Yy,e))}});function U(e){return Jg(Wy,e)}var Gy=H(`ZodStringFormat`,(e,t)=>{Gm.init(e,t),Uy.init(e,t)}),Ky=H(`ZodISODateTime`,(e,t)=>{uh.init(e,t),Gy.init(e,t)}),qy=H(`ZodISODate`,(e,t)=>{dh.init(e,t),Gy.init(e,t)}),Jy=H(`ZodISOTime`,(e,t)=>{fh.init(e,t),Gy.init(e,t)}),Yy=H(`ZodISODuration`,(e,t)=>{ph.init(e,t),Gy.init(e,t)}),Xy=H(`ZodEmail`,(e,t)=>{Jm.init(e,t),Gy.init(e,t)});function Zy(e){return Yg(Xy,e)}var Qy=H(`ZodGUID`,(e,t)=>{Km.init(e,t),Gy.init(e,t)}),$y=H(`ZodUUID`,(e,t)=>{qm.init(e,t),Gy.init(e,t)}),eb=H(`ZodURL`,(e,t)=>{nh.init(e,t),Gy.init(e,t)});function tb(e){return t_(eb,e)}var nb=H(`ZodEmoji`,(e,t)=>{rh.init(e,t),Gy.init(e,t)}),rb=H(`ZodNanoID`,(e,t)=>{ih.init(e,t),Gy.init(e,t)}),ib=H(`ZodCUID`,(e,t)=>{ah.init(e,t),Gy.init(e,t)}),ab=H(`ZodCUID2`,(e,t)=>{oh.init(e,t),Gy.init(e,t)}),ob=H(`ZodULID`,(e,t)=>{sh.init(e,t),Gy.init(e,t)}),sb=H(`ZodXID`,(e,t)=>{ch.init(e,t),Gy.init(e,t)}),cb=H(`ZodKSUID`,(e,t)=>{lh.init(e,t),Gy.init(e,t)}),lb=H(`ZodIPv4`,(e,t)=>{mh.init(e,t),Gy.init(e,t)}),ub=H(`ZodIPv6`,(e,t)=>{_h.init(e,t),Gy.init(e,t)}),db=H(`ZodCIDRv4`,(e,t)=>{vh.init(e,t),Gy.init(e,t)}),fb=H(`ZodCIDRv6`,(e,t)=>{bh.init(e,t),Gy.init(e,t)}),pb=H(`ZodBase64`,(e,t)=>{Ch.init(e,t),Gy.init(e,t)}),mb=H(`ZodBase64URL`,(e,t)=>{Eh.init(e,t),Gy.init(e,t)}),hb=H(`ZodE164`,(e,t)=>{Dh.init(e,t),Gy.init(e,t)}),gb=H(`ZodJWT`,(e,t)=>{kh.init(e,t),Gy.init(e,t)}),_b=H(`ZodNumber`,(e,t)=>{Ah.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nv(e,t,n,r),e.isFinite=!0},Kf({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Ov(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Ov(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Ov(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Ov(e).format??null},{gt(e,t){return this.check(M_(e,t))},gte(e,t){return this.check(N_(e,t))},min(e,t){return this.check(N_(e,t))},lt(e,t){return this.check(A_(e,t))},lte(e,t){return this.check(j_(e,t))},max(e,t){return this.check(j_(e,t))},int(e){return this.check(W(e))},safe(e){return this.check(W(e))},positive(e){return this.check(M_(0,e))},nonnegative(e){return this.check(N_(0,e))},negative(e){return this.check(A_(0,e))},nonpositive(e){return this.check(j_(0,e))},multipleOf(e,t){return this.check(P_(e,t))},step(e,t){return this.check(P_(e,t))},finite(){return this}}));function vb(e){return x_(_b,e)}var yb=H(`ZodNumberFormat`,(e,t)=>{jh.init(e,t),_b.init(e,t)});function W(e){return C_(yb,e)}var bb=H(`ZodBoolean`,(e,t)=>{Mh.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pv(e,t,n,r)});function xb(e){return w_(bb,e)}var Sb=H(`ZodUndefined`,(e,t)=>{Nh.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rv(e,t,n,r)});function Cb(e){return T_(Sb,e)}var wb=H(`ZodNull`,(e,t)=>{Ph.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lv(e,t,n,r)});function Tb(e){return E_(wb,e)}var Eb=H(`ZodAny`,(e,t)=>{Fh.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function G(){return D_(Eb)}var Db=H(`ZodUnknown`,(e,t)=>{Ih.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ob(){return O_(Db)}var kb=H(`ZodNever`,(e,t)=>{Lh.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bv(e,t,n,r)});function Ab(e){return k_(kb,e)}var jb=H(`ZodArray`,(e,t)=>{Vy(),Vh.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ty(e,t,n,r),e.element=t.element},{min(e,t){return this.check(I_(e,t))},nonempty(e){return this.check(I_(1,e))},max(e,t){return this.check(F_(e,t))},length(e,t){return this.check(L_(e,t))},unwrap(){return this.element}});function Mb(e,t){return X_(jb,e,t)}var Nb=H(`ZodObject`,(e,t)=>{Vy(),qh.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ry(e,t,n,r),V(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Wb(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(sf(this._zod.def,{catchall:e}))},passthrough(){return this.clone(sf(this._zod.def,{catchall:Ob()}))},loose(){return this.clone(sf(this._zod.def,{catchall:Ob()}))},strict(){return this.clone(sf(this._zod.def,{catchall:Ab()}))},strip(){return this.clone(sf(this._zod.def,{catchall:void 0}))},extend(e){return Tf(this,e)},safeExtend(e){return Df(this,e)},merge(e){return Of(this,e)},pick(e){return Sf(this,e)},omit(e){return wf(this,e)},partial(...e){return kf(Jb,this,e[0])},exactPartial(...e){return kf(Xb,this,e[0],`exactPartial`)},required(...e){return Af(ix,this,e[0])}});function Pb(e,t){return new Nb({type:`object`,shape:e??{},...B(t)})}function K(e,t){return new Nb({type:`object`,shape:e,catchall:Ob(),...B(t)})}var Fb=H(`ZodUnion`,(e,t)=>{Yh.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>iy(e,t,n,r),e.options=t.options});function Ib(e,t){return new Fb({type:`union`,options:e,...B(t)})}var Lb=H(`ZodDiscriminatedUnion`,(e,t)=>{Fb.init(e,t),Zh.init(e,t)});function Rb(e,t,n){return new Lb({type:`union`,options:t,discriminator:e,...B(n)})}var zb=H(`ZodIntersection`,(e,t)=>{Qh.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ay(e,t,n,r)});function Bb(e,t){return new zb({type:`intersection`,left:e,right:t})}var Vb=H(`ZodRecord`,(e,t)=>{Vy(),tg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uy(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Hb(e,t,n){return!t||!t._zod?new Vb({type:`record`,keyType:U(),valueType:e,...B(t)}):new Vb({type:`record`,keyType:e,valueType:t,...B(n)})}var Ub=H(`ZodEnum`,(e,t)=>{ng.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wv(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 Ub({...t,checks:[],...B(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 Ub({...t,checks:[],...B(r),entries:i})}});function Wb(e,t){return new Ub({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...B(t)})}var Gb=H(`ZodLiteral`,(e,t)=>{rg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gv(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 q(e,t){return new Gb({type:`literal`,values:Array.isArray(e)?e:[e],...B(t)})}var Kb=H(`ZodTransform`,(e,t)=>{Vy(),ig.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qv(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new sp(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Hf(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Hf(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function qb(e){return new Kb({type:`transform`,transform:e})}var Jb=H(`ZodOptional`,(e,t)=>{og.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yb(e){return new Jb({type:`optional`,innerType:e})}var Xb=H(`ZodExactOptional`,(e,t)=>{sg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Zb(e){return new Xb({type:`optional`,innerType:e})}var Qb=H(`ZodNullable`,(e,t)=>{cg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $b(e){return new Qb({type:`nullable`,innerType:e})}var ex=H(`ZodDefault`,(e,t)=>{lg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function tx(e,t){return new ex({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():mf(t)}})}var nx=H(`ZodPrefault`,(e,t)=>{dg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rx(e,t){return new nx({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():mf(t)}})}var ix=H(`ZodNonOptional`,(e,t)=>{fg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ax(e,t){return new ix({type:`nonoptional`,innerType:e,...B(t)})}var ox=H(`ZodCatch`,(e,t)=>{hg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_y(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sx(e,t){return new ox({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ep(t)})}var cx=H(`ZodPipe`,(e,t)=>{gg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vy(e,t,n,r),e.in=t.in,e.out=t.out});function lx(e,t){return new cx({type:`pipe`,in:e,out:t})}var ux=H(`ZodPreprocess`,(e,t)=>{cx.init(e,t),vg.init(e,t)}),dx=H(`ZodReadonly`,(e,t)=>{yg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fx(e){return new dx({type:`readonly`,innerType:e})}var px=H(`ZodLazy`,(e,t)=>{xg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sy(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function mx(e){return new px({type:`lazy`,getter:e})}var hx=H(`ZodCustom`,(e,t)=>{Sg.init(e,t),Hy.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xv(e,t,n,r)});function gx(e,t){return Z_(hx,e??(()=>!0),t)}function _x(e,t={}){return Q_(hx,e,t)}function vx(e,t){return $_(e,t)}function yx(e,t){return new ux({type:`pipe`,in:qb(e),out:t})}var bx=Wb(I),J=gx(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),xx=U(),Sx=Wb([`developer`,`system`,`assistant`,`user`]),Cx=K({type:q(I.TEXT_MESSAGE_START),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U(),role:Sx.optional(),name:U().optional()}),wx=K({type:q(I.TEXT_MESSAGE_CONTENT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U(),delta:U()}),Tx=K({type:q(I.TEXT_MESSAGE_END),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U()}),Ex=K({type:q(I.TEXT_MESSAGE_CHUNK),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U().optional(),role:Sx.optional(),delta:U().optional(),name:U().optional()}),Dx=K({type:q(I.TOOL_CALL_START),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),toolCallId:U(),toolCallName:U(),parentMessageId:U().optional()}),Ox=K({type:q(I.TOOL_CALL_ARGS),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),toolCallId:U(),delta:U()}),kx=K({type:q(I.TOOL_CALL_END),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),toolCallId:U()}),Ax=K({type:q(I.TOOL_CALL_CHUNK),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),toolCallId:U().optional(),toolCallName:U().optional(),parentMessageId:U().optional(),delta:U().optional()}),jx=K({type:q(`text`),id:U().optional(),text:U(),metadata:G().refine(e=>e!==null).optional()}),Mx=Rb(`type`,[K({type:q(`data`),value:U(),mimeType:U()}),K({type:q(`url`),value:U(),mimeType:U().optional()}),K({type:q(`file`),value:U(),provider:U().optional(),mimeType:U().optional()})]),Nx=Rb(`type`,[jx,K({type:q(`image`),id:U().optional(),source:Mx,metadata:G().refine(e=>e!==null).optional()}),K({type:q(`audio`),id:U().optional(),source:Mx,metadata:G().refine(e=>e!==null).optional()}),K({type:q(`video`),id:U().optional(),source:Mx,metadata:G().refine(e=>e!==null).optional()}),K({type:q(`document`),id:U().optional(),source:Mx,metadata:G().refine(e=>e!==null).optional()})]),Px=K({type:q(I.TOOL_CALL_RESULT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U(),toolCallId:U(),content:Ib([U(),Mb(Nx)]),role:q(`tool`).optional()}),Fx=G(),Ix=K({type:q(I.STATE_SNAPSHOT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),snapshot:Fx.refine(e=>e!==void 0)}),Lx=U().regex(RegExp(`^(/([^/~]|~[01])*)*$`)),Rx=Mb(Rb(`op`,[K({op:q(`add`),path:Lx,value:G().refine(e=>e!==void 0)}).meta({specOpen:!0}),K({op:q(`remove`),path:Lx}).meta({specOpen:!0}),K({op:q(`replace`),path:Lx,value:G().refine(e=>e!==void 0)}).meta({specOpen:!0}),K({op:q(`move`),from:Lx,path:Lx}).meta({specOpen:!0}),K({op:q(`copy`),from:Lx,path:Lx}).meta({specOpen:!0}),K({op:q(`test`),path:Lx,value:G().refine(e=>e!==void 0)}).meta({specOpen:!0})])),zx=K({type:q(I.STATE_DELTA),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),delta:Rx}),Bx=K({subagentRunId:xx.optional(),id:U(),role:q(`developer`),name:U().optional(),encryptedValue:U().optional(),metadata:J.optional(),content:U()}),Vx=K({subagentRunId:xx.optional(),id:U(),role:q(`system`),name:U().optional(),encryptedValue:U().optional(),metadata:J.optional(),content:U()}),Hx=K({name:U(),arguments:U()}),Ux=K({id:U(),type:q(`function`),function:Hx,encryptedValue:U().optional(),metadata:J.optional()}),Wx=Rb(`role`,[Bx,Vx,K({subagentRunId:xx.optional(),id:U(),role:q(`assistant`),name:U().optional(),encryptedValue:U().optional(),metadata:J.optional(),content:U().optional(),toolCalls:Mb(Ux).optional()}),K({subagentRunId:xx.optional(),id:U(),role:q(`user`),name:U().optional(),encryptedValue:U().optional(),metadata:J.optional(),content:Ib([U(),Mb(Nx)])}),K({subagentRunId:xx.optional(),id:U(),role:q(`tool`),content:Ib([U(),Mb(Nx)]),toolCallId:U(),error:U().optional(),encryptedValue:U().optional(),metadata:J.optional()}),K({subagentRunId:xx.optional(),id:U(),role:q(`activity`),activityType:U(),content:gx(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),metadata:J.optional()}),K({subagentRunId:xx.optional(),id:U(),role:q(`reasoning`),content:U(),encryptedValue:U().optional(),metadata:J.optional()})]),Gx=K({type:q(I.MESSAGES_SNAPSHOT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),messages:Mb(Wx)}),Kx=K({type:q(I.ACTIVITY_SNAPSHOT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U(),activityType:U(),content:gx(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),replace:xb().optional()}),qx=K({type:q(I.ACTIVITY_DELTA),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U(),activityType:U(),patch:Rx}),Jx=K({type:q(I.RAW),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),event:G().refine(e=>e!==void 0),source:U().optional()}),Yx=K({type:q(I.CUSTOM),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),name:U(),value:G().refine(e=>e!==void 0)}),Xx=K({name:U(),description:U(),parameters:G().refine(e=>e!==null).optional(),metadata:J.optional()}),Zx=K({description:U(),value:U()}),Qx=K({interruptId:U(),status:Wb([`resolved`,`cancelled`]),payload:G().refine(e=>e!==null).optional(),metadata:J.optional()}),$x=K({threadId:U(),runId:U(),protocolVersion:U().optional(),parentRunId:U().optional(),state:Fx.refine(e=>e!==null).nullable().transform(e=>e??void 0).optional(),messages:Mb(Wx),tools:Mb(Xx).default(()=>[]),context:Mb(Zx).default(()=>[]),forwardedProps:G().refine(e=>e!==null).optional(),resume:Mb(Qx).optional()}),eS=K({type:q(I.RUN_STARTED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),threadId:U(),runId:U(),protocolVersion:U().optional(),parentRunId:U().optional(),input:$x.optional()}),tS=K({type:q(`success`),pendingToolCallIds:Mb(U()).optional()}),nS=K({subagentRunId:xx.optional(),id:U(),reason:U(),message:U().optional(),toolCallId:U().optional(),responseSchema:gx(e=>typeof e==`object`&&!!e&&!Array.isArray(e)).optional(),expiresAt:U().optional(),metadata:J.optional()}),rS=Rb(`type`,[tS,K({type:q(`interrupt`),interrupts:Mb(nS).min(1)}),K({type:q(`cancelled`)})]),iS=K({provider:U().optional(),model:U().optional(),inputTokens:W().min(0).max(9007199254740991).optional(),outputTokens:W().min(0).max(9007199254740991).optional(),totalTokens:W().min(0).max(9007199254740991).optional(),reasoningTokens:W().min(0).max(9007199254740991).optional(),cachedInputTokens:W().min(0).max(9007199254740991).optional(),cacheWriteInputTokens:W().min(0).max(9007199254740991).optional()}),aS=K({type:q(I.RUN_FINISHED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),threadId:U(),runId:U(),result:G().refine(e=>e!==null).optional(),outcome:rS.optional(),usage:Mb(iS).optional()}),oS=K({type:q(I.RUN_ERROR),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),message:U(),code:U().optional(),usage:Mb(iS).optional()}),sS=K({type:q(I.STEP_STARTED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),stepName:U()}),cS=K({type:q(I.STEP_FINISHED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),stepName:U()}),lS=K({type:q(I.REASONING_START),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U()}),uS=K({type:q(I.REASONING_MESSAGE_START),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U(),role:q(`reasoning`)}),dS=K({type:q(I.REASONING_MESSAGE_CONTENT),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U(),delta:U()}),fS=K({type:q(I.REASONING_MESSAGE_END),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U()}),pS=K({type:q(I.REASONING_MESSAGE_CHUNK),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U().optional(),delta:U().optional()}),mS=K({type:q(I.REASONING_END),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),messageId:U()}),hS=Wb([`tool-call`,`message`]),gS=K({type:q(I.REASONING_ENCRYPTED_VALUE),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx.optional(),subtype:hS,entityId:U(),encryptedValue:U()}),_S=K({type:q(I.SUBAGENT_STARTED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx,name:U(),description:U().optional(),parentSubagentRunId:xx.optional(),parentToolCallId:U().optional(),parentMessageId:U().optional()}),vS=Rb(`type`,[K({type:q(`success`)}),K({type:q(`suspended`),interruptIds:Mb(U()).optional()})]),yS=Rb(`type`,[Cx,wx,Tx,Ex,Dx,Ox,kx,Ax,Px,Ix,zx,Gx,Kx,qx,Jx,Yx,eS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,gS,_S,K({type:q(I.SUBAGENT_FINISHED),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx,result:G().refine(e=>e!==null).optional(),outcome:vS.optional()}),K({type:q(I.SUBAGENT_ERROR),timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional(),subagentRunId:xx,message:U(),code:U().optional()})]);Wb([`developer`,`system`,`assistant`,`user`,`tool`,`activity`,`reasoning`]);var bS=K({name:U(),description:U().optional()}),xS=K({name:U().optional(),type:U().optional(),description:U().optional(),version:U().optional(),provider:U().optional(),documentationUrl:U().optional(),metadata:J.optional()}),SS=K({streaming:xb().optional(),websocket:xb().optional(),httpBinary:xb().optional(),pushNotifications:xb().optional(),resumable:xb().optional()}),CS=K({supported:xb().optional(),items:Mb(Xx).optional(),parallelCalls:xb().optional(),clientProvided:xb().optional()}),wS=K({structuredOutput:xb().optional(),supportedMimeTypes:Mb(U()).optional()}),TS=K({snapshots:xb().optional(),deltas:xb().optional(),memory:xb().optional(),persistentState:xb().optional()}),ES=K({supported:xb().optional(),delegation:xb().optional(),handoffs:xb().optional(),subagents:Mb(bS).optional()}),DS=K({supported:xb().optional(),streaming:xb().optional(),encrypted:xb().optional()}),OS=K({image:xb().optional(),audio:xb().optional(),video:xb().optional(),pdf:xb().optional(),file:xb().optional()}),kS=K({image:xb().optional(),audio:xb().optional()}),AS=K({input:OS.optional(),output:kS.optional()}),jS=K({codeExecution:xb().optional(),sandboxed:xb().optional(),maxIterations:W().min(0).max(9007199254740991).optional(),maxExecutionTime:W().min(0).max(9007199254740991).optional()}),MS=K({supported:xb().optional(),approvals:xb().optional(),interventions:xb().optional(),feedback:xb().optional(),interrupts:xb().optional(),approveWithEdits:xb().optional()});K({identity:xS.optional(),transport:SS.optional(),tools:CS.optional(),output:wS.optional(),state:TS.optional(),multiAgent:ES.optional(),reasoning:DS.optional(),multimodal:AS.optional(),execution:jS.optional(),humanInTheLoop:MS.optional(),custom:gx(e=>typeof e==`object`&&!!e&&!Array.isArray(e)).optional()}),K({subagentRunId:xx.optional()}),K({type:bx,timestamp:W().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:G().refine(e=>e!==null).optional(),metadata:J.optional()}),K({subagentRunId:xx.optional(),id:U(),role:U(),name:U().optional(),encryptedValue:U().optional(),metadata:J.optional()}),J.optional();function NS(){let e=this.buf,t=this.pos,n=0,r=0;for(let i=0;i<28;i+=7){let a=e[t++];if(n|=(a&127)<>4,!(i&128)){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(r|=(a&127)<=PS&&(i+=r/PS|0,r%=PS)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?BS(r,i):zS(r,i)}function IS(e,t){let n=zS(e,t),r=n.hi&2147483648;r&&(n=BS(n.lo,n.hi));let i=LS(n.lo,n.hi);return r?`-`+i:i}function LS(e,t){if({lo:e,hi:t}=RS(e,t),t<=2097151)return String(PS*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+VS(o)+VS(a)}function RS(e,t){return{lo:e>>>0,hi:t>>>0}}function zS(e,t){return{lo:e|0,hi:t|0}}function BS(e,t){return t=~t,e?e=~e+1:t+=1,zS(e,t)}var VS=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function HS(){let e=this.buf[this.pos++];if(!(e&128))return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}var US=WS();function WS(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(globalThis.Deno||globalThis.Bun||typeof process!=`object`||{}.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||ri||ta.call(e)),JS(i)}return qS}function XS(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}var ZS;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(ZS||={});var Y=class{constructor(e){this.stackPos=[],this.encodeUtf8Into=e?XS(e):YS().encodeUtf8Into,this.buffer=eC,this.viewCache=tC,this.pos=0}ensureCapacity(e){let t=this.pos+e;if(t>this.buffer.length){let e=this.buffer.length||QS;for(;e0&&n.set(this.buffer),this.buffer=n}}view(){let e=this.buffer,t=this.viewCache;if(t.byteLength===e.byteLength)return t;let n=new DataView(e.buffer);return this.viewCache=n,n}finish(){let e=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],e}fork(){return this.stackPos.push(this.pos),this.ensureCapacity($S),this.buffer[this.pos++]=0,this}join(){let e=this.stackPos.pop();if(e===void 0)throw Error(`invalid state, fork stack empty`);let t=this.pos-e-$S,n=rC(t);return n>$S&&(this.ensureCapacity(n-$S),this.buffer.copyWithin(e+n,e+$S,this.pos)),this.pos=e,this.uint32(t),this.pos+=t,this}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.ensureCapacity(e.length),this.buffer.set(e,this.pos),this.pos+=e.length,this}uint32(e){if(aC(e),this.ensureCapacity(5),e<128)return this.buffer[this.pos++]=e,this;for(;e>127;)this.buffer[this.pos++]=e&127|128,e>>>=7;return this.buffer[this.pos++]=e,this}int32(e){if(iC(e),e>=0)return this.uint32(e);this.ensureCapacity(10);for(let t=0;t<9;t++)this.buffer[this.pos++]=e&127|128,e>>=7;return this.buffer[this.pos++]=1,this}bool(e){return this.ensureCapacity(1),this.buffer[this.pos++]=+!!e,this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){typeof e!=`string`&&(e=String(e));let t=e.length;if(t<=nC){this.ensureCapacity(t+1);let n=this.buffer,r=this.pos;n[r++]=t;let i=0;for(;i127)break;n[r++]=t}if(i==t)return this.pos=r,this}this.ensureCapacity(t*3+5);let n=rC(t),r=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(e,r.subarray(i+n)),o=rC(a);return o!=n&&r.copyWithin(i+o,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(e){return oC(e),this.ensureCapacity(4),this.view().setFloat32(this.pos,e,!0),this.pos+=4,this}double(e){return this.ensureCapacity(8),this.view().setFloat64(this.pos,e,!0),this.pos+=8,this}fixed32(e){return aC(e),this.ensureCapacity(4),this.view().setUint32(this.pos,e,!0),this.pos+=4,this}sfixed32(e){return iC(e),this.ensureCapacity(4),this.view().setInt32(this.pos,e,!0),this.pos+=4,this}sint32(e){return iC(e),this.uint32((e<<1^e>>31)>>>0)}sfixed64(e){let t=US.enc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}fixed64(e){let t=US.uEnc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}int64(e){let t=US.enc(e);return this.writeVarint64(t.lo,t.hi)}sint64(e){let t=US.enc(e),n=t.hi>>31,r=t.lo<<1^n,i=(t.hi<<1|t.lo>>>31)^n;return this.writeVarint64(r,i)}uint64(e){let t=US.uEnc(e);return this.writeVarint64(t.lo,t.hi)}writeVarint64(e,t){this.ensureCapacity(10);let n=this.buffer,r=this.pos;for(let i=0;i<28;i+=7){let a=e>>>i,o=!(!(a>>>7)&&t==0);if(n[r++]=(o?a|128:a)&255,!o)return this.pos=r,this}let i=e>>>28&15|(t&7)<<4,a=!!(t>>3);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this;for(let e=3;e<31;e+=7){let i=t>>>e,a=!!(i>>>7);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this}return n[r++]=t>>>31&1,this.pos=r,this}},QS=128,$S=1,eC=new Uint8Array,tC=new DataView(eC.buffer),nC=32;function rC(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var X=class{constructor(e,t=YS().decodeUtf8){this.decodeUtf8=t,this.varint64Lo=0,this.varint64Hi=0,this.varint64=NS,this.uint32=HS,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.pos,t=this.uint32(),n=this.pos-e;if(n>5||n==5&&this.buf[this.pos-1]>15)throw Error(`illegal tag: varint overflows uint32`);let r=t>>>3,i=t&7;if(r<=0||i>5)throw Error(`illegal tag: field no `+r+` wire type `+i);return[r,i]}skip(e,t,n=100){let r=this.pos;switch(e){case ZS.Varint:for(;this.buf[this.pos++]&128;);break;case ZS.Bit64:this.pos+=4;case ZS.Bit32:this.pos+=4;break;case ZS.LengthDelimited:let r=this.uint32();this.pos+=r;break;case ZS.StartGroup:if(n<=0)throw Error(`maximum recursion depth reached`);for(;;){let[e,r]=this.tag();if(r===ZS.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(r,e,n-1)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return this.varint64(),US.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),US.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let e=this.varint64Lo,t=this.varint64Hi,n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,US.dec(e,t)}bool(){let e=this.buf[this.pos];return e<128?(this.pos++,e!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return US.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return US.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(e){let t=this.bytes(),n=t.length;if(n<=nC){let r=Array(n);for(let i=0;i127)return this.decodeUtf8(t,e);r[i]=n}return String.fromCharCode.apply(String,r)}return this.decodeUtf8(t,e)}};function iC(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid int32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int32: `+e)}function aC(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid uint32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint32: `+e)}function oC(e){if(typeof e==`string`){let t=e;if(e=Number(e),Number.isNaN(e)&&t!==`NaN`)throw Error(`invalid float32: `+t)}else if(typeof e!=`number`)throw Error(`invalid float32: `+typeof e);if(!Number.isFinite(Math.fround(e))&&Number.isFinite(e))throw Error(`invalid float32: `+e)}var sC=function(e){return e[e.NULL_VALUE=0]=`NULL_VALUE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function cC(){return{fields:{}}}var lC={encode(e,t=new Y){return Object.entries(e.fields).forEach(([e,n])=>{n!==void 0&&dC.encode({key:e,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=cC();for(;n.pos>>3){case 1:{if(e!==10)break;let t=dC.decode(n,n.uint32());t.value!==void 0&&(i.fields[t.key]=t.value);continue}}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return lC.fromPartial(e??{})},fromPartial(e){let t=cC();return t.fields=Object.entries(e.fields??{}).reduce((e,[t,n])=>(n!==void 0&&(e[t]=n),e),{}),t},wrap(e){let t=cC();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function uC(){return{key:``,value:void 0}}var dC={encode(e,t=new Y){return e.key!==``&&t.uint32(10).string(e.key),e.value!==void 0&&Z.encode(Z.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=uC();for(;n.pos>>3){case 1:if(e!==10)break;i.key=n.string();continue;case 2:if(e!==18)break;i.value=Z.unwrap(Z.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return dC.fromPartial(e??{})},fromPartial(e){let t=uC();return t.key=e.key??``,t.value=e.value??void 0,t}};function fC(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Z={encode(e,t=new Y){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&lC.encode(lC.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&mC.encode(mC.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=fC();for(;n.pos>>3){case 1:if(e!==8)break;i.nullValue=n.int32();continue;case 2:if(e!==17)break;i.numberValue=n.double();continue;case 3:if(e!==26)break;i.stringValue=n.string();continue;case 4:if(e!==32)break;i.boolValue=n.bool();continue;case 5:if(e!==42)break;i.structValue=lC.unwrap(lC.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.listValue=mC.unwrap(mC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Z.fromPartial(e??{})},fromPartial(e){let t=fC();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=fC();if(e===null)t.nullValue=sC.NULL_VALUE;else if(typeof e==`boolean`)t.boolValue=e;else if(typeof e==`number`)t.numberValue=e;else if(typeof e==`string`)t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e==`object`)t.structValue=e;else if(e!==void 0)throw new globalThis.Error(`Unsupported any value type: `+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function pC(){return{values:[]}}var mC={encode(e,t=new Y){for(let n of e.values)Z.encode(Z.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=pC();for(;n.pos>>3){case 1:if(e!==10)break;i.values.push(Z.unwrap(Z.decode(n,n.uint32())));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return mC.fromPartial(e??{})},fromPartial(e){let t=pC();return t.values=e.values?.map(e=>e)||[],t},wrap(e){let t=pC();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty(`values`)&&globalThis.Array.isArray(e.values)?e.values:e}},hC=function(e){return e[e.ADD=0]=`ADD`,e[e.REMOVE=1]=`REMOVE`,e[e.REPLACE=2]=`REPLACE`,e[e.MOVE=3]=`MOVE`,e[e.COPY=4]=`COPY`,e[e.TEST=5]=`TEST`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function gC(){return{op:0,path:``,from:void 0,value:void 0}}var _C={encode(e,t=new Y){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==``&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&Z.encode(Z.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=gC();for(;n.pos>>3){case 1:if(e!==8)break;i.op=n.int32();continue;case 2:if(e!==18)break;i.path=n.string();continue;case 3:if(e!==26)break;i.from=n.string();continue;case 4:if(e!==34)break;i.value=Z.unwrap(Z.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return _C.fromPartial(e??{})},fromPartial(e){let t=gC();return t.op=e.op??0,t.path=e.path??``,t.from=e.from??void 0,t.value=e.value??void 0,t}};function vC(){return{text:``,id:void 0,metadata:void 0}}var yC={encode(e,t=new Y){return e.text!==``&&t.uint32(10).string(e.text),e.id!==void 0&&t.uint32(18).string(e.id),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(26).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=vC();for(;n.pos>>3){case 1:if(e!==10)break;i.text=n.string();continue;case 2:if(e!==18)break;i.id=n.string();continue;case 3:if(e!==26)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return yC.fromPartial(e??{})},fromPartial(e){let t=vC();return t.text=e.text??``,t.id=e.id??void 0,t.metadata=e.metadata??void 0,t}};function bC(){return{source:void 0,metadata:void 0,id:void 0}}var xC={encode(e,t=new Y){return e.source!==void 0&&kC.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=bC();for(;n.pos>>3){case 1:if(e!==10)break;i.source=kC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return xC.fromPartial(e??{})},fromPartial(e){let t=bC();return t.source=e.source!==void 0&&e.source!==null?kC.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function SC(){return{value:``,mimeType:``}}var CC={encode(e,t=new Y){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==``&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=SC();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return CC.fromPartial(e??{})},fromPartial(e){let t=SC();return t.value=e.value??``,t.mimeType=e.mimeType??``,t}};function wC(){return{value:``,mimeType:void 0}}var TC={encode(e,t=new Y){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=wC();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return TC.fromPartial(e??{})},fromPartial(e){let t=wC();return t.value=e.value??``,t.mimeType=e.mimeType??void 0,t}};function EC(){return{value:``,provider:void 0,mimeType:void 0}}var DC={encode(e,t=new Y){return e.value!==``&&t.uint32(10).string(e.value),e.provider!==void 0&&t.uint32(18).string(e.provider),e.mimeType!==void 0&&t.uint32(26).string(e.mimeType),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=EC();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.provider=n.string();continue;case 3:if(e!==26)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return DC.fromPartial(e??{})},fromPartial(e){let t=EC();return t.value=e.value??``,t.provider=e.provider??void 0,t.mimeType=e.mimeType??void 0,t}};function OC(){return{data:void 0,url:void 0,file:void 0}}var kC={encode(e,t=new Y){return e.data!==void 0&&CC.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&TC.encode(e.url,t.uint32(18).fork()).join(),e.file!==void 0&&DC.encode(e.file,t.uint32(26).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=OC();for(;n.pos>>3){case 1:if(e!==10)break;i.data=CC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.url=TC.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.file=DC.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return kC.fromPartial(e??{})},fromPartial(e){let t=OC();return t.data=e.data!==void 0&&e.data!==null?CC.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?TC.fromPartial(e.url):void 0,t.file=e.file!==void 0&&e.file!==null?DC.fromPartial(e.file):void 0,t}};function AC(){return{source:void 0,metadata:void 0,id:void 0}}var jC={encode(e,t=new Y){return e.source!==void 0&&kC.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=AC();for(;n.pos>>3){case 1:if(e!==10)break;i.source=kC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return jC.fromPartial(e??{})},fromPartial(e){let t=AC();return t.source=e.source!==void 0&&e.source!==null?kC.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function MC(){return{source:void 0,metadata:void 0,id:void 0}}var NC={encode(e,t=new Y){return e.source!==void 0&&kC.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=MC();for(;n.pos>>3){case 1:if(e!==10)break;i.source=kC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return NC.fromPartial(e??{})},fromPartial(e){let t=MC();return t.source=e.source!==void 0&&e.source!==null?kC.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function PC(){return{source:void 0,metadata:void 0,id:void 0}}var FC={encode(e,t=new Y){return e.source!==void 0&&kC.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=PC();for(;n.pos>>3){case 1:if(e!==10)break;i.source=kC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return FC.fromPartial(e??{})},fromPartial(e){let t=PC();return t.source=e.source!==void 0&&e.source!==null?kC.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function IC(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var LC={encode(e,t=new Y){return e.text!==void 0&&yC.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&xC.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&jC.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&NC.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&FC.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=IC();for(;n.pos>>3){case 1:if(e!==10)break;i.text=yC.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.image=xC.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.audio=jC.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.video=NC.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.document=FC.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return LC.fromPartial(e??{})},fromPartial(e){let t=IC();return t.text=e.text!==void 0&&e.text!==null?yC.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?xC.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?jC.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?NC.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?FC.fromPartial(e.document):void 0,t}};function RC(){return{id:``,type:``,function:void 0,metadata:void 0,encryptedValue:void 0}}var zC={encode(e,t=new Y){return e.id!==``&&t.uint32(10).string(e.id),e.type!==``&&t.uint32(18).string(e.type),e.function!==void 0&&VC.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&lC.encode(lC.wrap(e.metadata),t.uint32(34).fork()).join(),e.encryptedValue!==void 0&&t.uint32(42).string(e.encryptedValue),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=RC();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.type=n.string();continue;case 3:if(e!==26)break;i.function=VC.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.metadata=lC.unwrap(lC.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.encryptedValue=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return zC.fromPartial(e??{})},fromPartial(e){let t=RC();return t.id=e.id??``,t.type=e.type??``,t.function=e.function!==void 0&&e.function!==null?VC.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t.encryptedValue=e.encryptedValue??void 0,t}};function BC(){return{name:``,arguments:``}}var VC={encode(e,t=new Y){return e.name!==``&&t.uint32(10).string(e.name),e.arguments!==``&&t.uint32(18).string(e.arguments),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=BC();for(;n.pos>>3){case 1:if(e!==10)break;i.name=n.string();continue;case 2:if(e!==18)break;i.arguments=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return VC.fromPartial(e??{})},fromPartial(e){let t=BC();return t.name=e.name??``,t.arguments=e.arguments??``,t}};function HC(){return{id:``,role:``,content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0,encryptedValue:void 0,activityType:void 0,activityContent:void 0}}var UC={encode(e,t=new Y){e.id!==``&&t.uint32(10).string(e.id),e.role!==``&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let n of e.toolCalls)zC.encode(n,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let n of e.contentParts)LC.encode(n,t.uint32(66).fork()).join();return e.metadata!==void 0&&lC.encode(lC.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),e.encryptedValue!==void 0&&t.uint32(90).string(e.encryptedValue),e.activityType!==void 0&&t.uint32(98).string(e.activityType),e.activityContent!==void 0&&lC.encode(lC.wrap(e.activityContent),t.uint32(106).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=HC();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.role=n.string();continue;case 3:if(e!==26)break;i.content=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.toolCalls.push(zC.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.toolCallId=n.string();continue;case 7:if(e!==58)break;i.error=n.string();continue;case 8:if(e!==66)break;i.contentParts.push(LC.decode(n,n.uint32()));continue;case 9:if(e!==74)break;i.metadata=lC.unwrap(lC.decode(n,n.uint32()));continue;case 10:if(e!==82)break;i.subagentRunId=n.string();continue;case 11:if(e!==90)break;i.encryptedValue=n.string();continue;case 12:if(e!==98)break;i.activityType=n.string();continue;case 13:if(e!==106)break;i.activityContent=lC.unwrap(lC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return UC.fromPartial(e??{})},fromPartial(e){let t=HC();return t.id=e.id??``,t.role=e.role??``,t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(e=>zC.fromPartial(e))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(e=>LC.fromPartial(e))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t.encryptedValue=e.encryptedValue??void 0,t.activityType=e.activityType??void 0,t.activityContent=e.activityContent??void 0,t}};function WC(){return{name:``,description:``,parameters:void 0,metadata:void 0}}var GC={encode(e,t=new Y){return e.name!==``&&t.uint32(10).string(e.name),e.description!==``&&t.uint32(18).string(e.description),e.parameters!==void 0&&Z.encode(Z.wrap(e.parameters),t.uint32(26).fork()).join(),e.metadata!==void 0&&lC.encode(lC.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=WC();for(;n.pos>>3){case 1:if(e!==10)break;i.name=n.string();continue;case 2:if(e!==18)break;i.description=n.string();continue;case 3:if(e!==26)break;i.parameters=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=lC.unwrap(lC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return GC.fromPartial(e??{})},fromPartial(e){let t=WC();return t.name=e.name??``,t.description=e.description??``,t.parameters=e.parameters??void 0,t.metadata=e.metadata??void 0,t}};function KC(){return{description:``,value:``}}var qC={encode(e,t=new Y){return e.description!==``&&t.uint32(10).string(e.description),e.value!==``&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=KC();for(;n.pos>>3){case 1:if(e!==10)break;i.description=n.string();continue;case 2:if(e!==18)break;i.value=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return qC.fromPartial(e??{})},fromPartial(e){let t=KC();return t.description=e.description??``,t.value=e.value??``,t}};function JC(){return{interruptId:``,status:``,payload:void 0,metadata:void 0}}var YC={encode(e,t=new Y){return e.interruptId!==``&&t.uint32(10).string(e.interruptId),e.status!==``&&t.uint32(18).string(e.status),e.payload!==void 0&&Z.encode(Z.wrap(e.payload),t.uint32(26).fork()).join(),e.metadata!==void 0&&lC.encode(lC.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=JC();for(;n.pos>>3){case 1:if(e!==10)break;i.interruptId=n.string();continue;case 2:if(e!==18)break;i.status=n.string();continue;case 3:if(e!==26)break;i.payload=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=lC.unwrap(lC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return YC.fromPartial(e??{})},fromPartial(e){let t=JC();return t.interruptId=e.interruptId??``,t.status=e.status??``,t.payload=e.payload??void 0,t.metadata=e.metadata??void 0,t}};function XC(){return{threadId:``,runId:``,parentRunId:void 0,state:void 0,messages:[],tools:[],context:[],forwardedProps:void 0,resume:[],protocolVersion:void 0}}var ZC={encode(e,t=new Y){e.threadId!==``&&t.uint32(10).string(e.threadId),e.runId!==``&&t.uint32(18).string(e.runId),e.parentRunId!==void 0&&t.uint32(26).string(e.parentRunId),e.state!==void 0&&Z.encode(Z.wrap(e.state),t.uint32(34).fork()).join();for(let n of e.messages)UC.encode(n,t.uint32(42).fork()).join();for(let n of e.tools)GC.encode(n,t.uint32(50).fork()).join();for(let n of e.context)qC.encode(n,t.uint32(58).fork()).join();e.forwardedProps!==void 0&&Z.encode(Z.wrap(e.forwardedProps),t.uint32(66).fork()).join();for(let n of e.resume)YC.encode(n,t.uint32(74).fork()).join();return e.protocolVersion!==void 0&&t.uint32(82).string(e.protocolVersion),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=XC();for(;n.pos>>3){case 1:if(e!==10)break;i.threadId=n.string();continue;case 2:if(e!==18)break;i.runId=n.string();continue;case 3:if(e!==26)break;i.parentRunId=n.string();continue;case 4:if(e!==34)break;i.state=Z.unwrap(Z.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.messages.push(UC.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.tools.push(GC.decode(n,n.uint32()));continue;case 7:if(e!==58)break;i.context.push(qC.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.forwardedProps=Z.unwrap(Z.decode(n,n.uint32()));continue;case 9:if(e!==74)break;i.resume.push(YC.decode(n,n.uint32()));continue;case 10:if(e!==82)break;i.protocolVersion=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ZC.fromPartial(e??{})},fromPartial(e){let t=XC();return t.threadId=e.threadId??``,t.runId=e.runId??``,t.parentRunId=e.parentRunId??void 0,t.state=e.state??void 0,t.messages=e.messages?.map(e=>UC.fromPartial(e))||[],t.tools=e.tools?.map(e=>GC.fromPartial(e))||[],t.context=e.context?.map(e=>qC.fromPartial(e))||[],t.forwardedProps=e.forwardedProps??void 0,t.resume=e.resume?.map(e=>YC.fromPartial(e))||[],t.protocolVersion=e.protocolVersion??void 0,t}};function QC(){return{id:``,reason:``,message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var $C={encode(e,t=new Y){return e.id!==``&&t.uint32(10).string(e.id),e.reason!==``&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&Z.encode(Z.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=QC();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.reason=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.toolCallId=n.string();continue;case 5:if(e!==42)break;i.responseSchema=Z.unwrap(Z.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.expiresAt=n.string();continue;case 7:if(e!==58)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return $C.fromPartial(e??{})},fromPartial(e){let t=QC();return t.id=e.id??``,t.reason=e.reason??``,t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}},ew=function(e){return e[e.TEXT_MESSAGE_START=0]=`TEXT_MESSAGE_START`,e[e.TEXT_MESSAGE_CONTENT=1]=`TEXT_MESSAGE_CONTENT`,e[e.TEXT_MESSAGE_END=2]=`TEXT_MESSAGE_END`,e[e.TOOL_CALL_START=3]=`TOOL_CALL_START`,e[e.TOOL_CALL_ARGS=4]=`TOOL_CALL_ARGS`,e[e.TOOL_CALL_END=5]=`TOOL_CALL_END`,e[e.STATE_SNAPSHOT=6]=`STATE_SNAPSHOT`,e[e.STATE_DELTA=7]=`STATE_DELTA`,e[e.MESSAGES_SNAPSHOT=8]=`MESSAGES_SNAPSHOT`,e[e.RAW=9]=`RAW`,e[e.CUSTOM=10]=`CUSTOM`,e[e.RUN_STARTED=11]=`RUN_STARTED`,e[e.RUN_FINISHED=12]=`RUN_FINISHED`,e[e.RUN_ERROR=13]=`RUN_ERROR`,e[e.STEP_STARTED=14]=`STEP_STARTED`,e[e.STEP_FINISHED=15]=`STEP_FINISHED`,e[e.SUBAGENT_STARTED=16]=`SUBAGENT_STARTED`,e[e.SUBAGENT_FINISHED=17]=`SUBAGENT_FINISHED`,e[e.SUBAGENT_ERROR=18]=`SUBAGENT_ERROR`,e[e.TEXT_MESSAGE_CHUNK=19]=`TEXT_MESSAGE_CHUNK`,e[e.TOOL_CALL_CHUNK=20]=`TOOL_CALL_CHUNK`,e[e.TOOL_CALL_RESULT=21]=`TOOL_CALL_RESULT`,e[e.ACTIVITY_SNAPSHOT=22]=`ACTIVITY_SNAPSHOT`,e[e.ACTIVITY_DELTA=23]=`ACTIVITY_DELTA`,e[e.REASONING_START=24]=`REASONING_START`,e[e.REASONING_MESSAGE_START=25]=`REASONING_MESSAGE_START`,e[e.REASONING_MESSAGE_CONTENT=26]=`REASONING_MESSAGE_CONTENT`,e[e.REASONING_MESSAGE_END=27]=`REASONING_MESSAGE_END`,e[e.REASONING_MESSAGE_CHUNK=28]=`REASONING_MESSAGE_CHUNK`,e[e.REASONING_END=29]=`REASONING_END`,e[e.REASONING_ENCRYPTED_VALUE=30]=`REASONING_ENCRYPTED_VALUE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function tw(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var Q={encode(e,t=new Y){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&Z.encode(Z.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&lC.encode(lC.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=tw();for(;n.pos>>3){case 1:if(e!==8)break;i.type=n.int32();continue;case 2:if(e!==16)break;i.timestamp=mT(n.int64());continue;case 3:if(e!==26)break;i.rawEvent=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=lC.unwrap(lC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Q.fromPartial(e??{})},fromPartial(e){let t=tw();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function nw(){return{baseEvent:void 0,messageId:``,role:void 0,name:void 0,subagentRunId:void 0}}var rw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=nw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return rw.fromPartial(e??{})},fromPartial(e){let t=nw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function iw(){return{baseEvent:void 0,messageId:``,delta:``,subagentRunId:void 0}}var aw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=iw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return aw.fromPartial(e??{})},fromPartial(e){let t=iw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function ow(){return{baseEvent:void 0,messageId:``,subagentRunId:void 0}}var sw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=ow();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return sw.fromPartial(e??{})},fromPartial(e){let t=ow();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function cw(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var lw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=cw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue;case 5:if(e!==42)break;i.name=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return lw.fromPartial(e??{})},fromPartial(e){let t=cw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function uw(){return{baseEvent:void 0,toolCallId:``,toolCallName:``,parentMessageId:void 0,subagentRunId:void 0}}var dw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.toolCallName!==``&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=uw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return dw.fromPartial(e??{})},fromPartial(e){let t=uw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.toolCallName=e.toolCallName??``,t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function fw(){return{baseEvent:void 0,toolCallId:``,delta:``,subagentRunId:void 0}}var pw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=fw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return pw.fromPartial(e??{})},fromPartial(e){let t=fw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function mw(){return{baseEvent:void 0,toolCallId:``,subagentRunId:void 0}}var hw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=mw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return hw.fromPartial(e??{})},fromPartial(e){let t=mw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function gw(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var _w={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=gw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.delta=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return _w.fromPartial(e??{})},fromPartial(e){let t=gw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function vw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,toolCallId:``,content:void 0,role:void 0,contentParts:[]}}var yw={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.toolCallId!==``&&t.uint32(34).string(e.toolCallId),e.content!==void 0&&t.uint32(42).string(e.content),e.role!==void 0&&t.uint32(50).string(e.role);for(let n of e.contentParts)LC.encode(n,t.uint32(58).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=vw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.toolCallId=n.string();continue;case 5:if(e!==42)break;i.content=n.string();continue;case 6:if(e!==50)break;i.role=n.string();continue;case 7:if(e!==58)break;i.contentParts.push(LC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return yw.fromPartial(e??{})},fromPartial(e){let t=vw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.toolCallId=e.toolCallId??``,t.content=e.content??void 0,t.role=e.role??void 0,t.contentParts=e.contentParts?.map(e=>LC.fromPartial(e))||[],t}};function bw(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var xw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Z.encode(Z.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=bw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.snapshot=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return xw.fromPartial(e??{})},fromPartial(e){let t=bw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Sw(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var Cw={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.delta)_C.encode(n,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Sw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.delta.push(_C.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Cw.fromPartial(e??{})},fromPartial(e){let t=Sw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(e=>_C.fromPartial(e))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function ww(){return{baseEvent:void 0,messages:[]}}var Tw={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.messages)UC.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=ww();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messages.push(UC.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Tw.fromPartial(e??{})},fromPartial(e){let t=ww();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(e=>UC.fromPartial(e))||[],t}};function Ew(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,activityType:``,content:void 0,replace:void 0}}var Dw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.activityType!==``&&t.uint32(34).string(e.activityType),e.content!==void 0&&lC.encode(lC.wrap(e.content),t.uint32(42).fork()).join(),e.replace!==void 0&&t.uint32(48).bool(e.replace),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Ew();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.activityType=n.string();continue;case 5:if(e!==42)break;i.content=lC.unwrap(lC.decode(n,n.uint32()));continue;case 6:if(e!==48)break;i.replace=n.bool();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Dw.fromPartial(e??{})},fromPartial(e){let t=Ew();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.activityType=e.activityType??``,t.content=e.content??void 0,t.replace=e.replace??void 0,t}};function Ow(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,activityType:``,patch:[]}}var kw={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.activityType!==``&&t.uint32(34).string(e.activityType);for(let n of e.patch)_C.encode(n,t.uint32(42).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Ow();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.activityType=n.string();continue;case 5:if(e!==42)break;i.patch.push(_C.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return kw.fromPartial(e??{})},fromPartial(e){let t=Ow();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.activityType=e.activityType??``,t.patch=e.patch?.map(e=>_C.fromPartial(e))||[],t}};function Aw(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var jw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Z.encode(Z.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Aw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.event=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.source=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return jw.fromPartial(e??{})},fromPartial(e){let t=Aw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Mw(){return{baseEvent:void 0,name:``,value:void 0,subagentRunId:void 0}}var Nw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==``&&t.uint32(18).string(e.name),e.value!==void 0&&Z.encode(Z.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Mw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.name=n.string();continue;case 3:if(e!==26)break;i.value=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Nw.fromPartial(e??{})},fromPartial(e){let t=Mw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.name=e.name??``,t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Pw(){return{baseEvent:void 0,threadId:``,runId:``,parentRunId:void 0,input:void 0,protocolVersion:void 0}}var Fw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),e.parentRunId!==void 0&&t.uint32(34).string(e.parentRunId),e.input!==void 0&&ZC.encode(e.input,t.uint32(42).fork()).join(),e.protocolVersion!==void 0&&t.uint32(50).string(e.protocolVersion),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Pw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue;case 4:if(e!==34)break;i.parentRunId=n.string();continue;case 5:if(e!==42)break;i.input=ZC.decode(n,n.uint32());continue;case 6:if(e!==50)break;i.protocolVersion=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Fw.fromPartial(e??{})},fromPartial(e){let t=Pw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t.parentRunId=e.parentRunId??void 0,t.input=e.input!==void 0&&e.input!==null?ZC.fromPartial(e.input):void 0,t.protocolVersion=e.protocolVersion??void 0,t}};function Iw(){return{baseEvent:void 0,threadId:``,runId:``,result:void 0,outcome:``,interrupts:[],usage:[],pendingToolCallIds:[]}}var Lw={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),e.result!==void 0&&Z.encode(Z.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==``&&t.uint32(42).string(e.outcome);for(let n of e.interrupts)$C.encode(n,t.uint32(50).fork()).join();for(let n of e.usage)pT.encode(n,t.uint32(58).fork()).join();for(let n of e.pendingToolCallIds)t.uint32(66).string(n);return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Iw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue;case 4:if(e!==34)break;i.result=Z.unwrap(Z.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.outcome=n.string();continue;case 6:if(e!==50)break;i.interrupts.push($C.decode(n,n.uint32()));continue;case 7:if(e!==58)break;i.usage.push(pT.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.pendingToolCallIds.push(n.string());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Lw.fromPartial(e??{})},fromPartial(e){let t=Iw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interrupts=e.interrupts?.map(e=>$C.fromPartial(e))||[],t.usage=e.usage?.map(e=>pT.fromPartial(e))||[],t.pendingToolCallIds=e.pendingToolCallIds?.map(e=>e)||[],t}};function Rw(){return{baseEvent:void 0,code:void 0,message:``,usage:[]}}var zw={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==``&&t.uint32(26).string(e.message);for(let n of e.usage)pT.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Rw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.code=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.usage.push(pT.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return zw.fromPartial(e??{})},fromPartial(e){let t=Rw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??``,t.usage=e.usage?.map(e=>pT.fromPartial(e))||[],t}};function Bw(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Vw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Bw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Vw.fromPartial(e??{})},fromPartial(e){let t=Bw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Hw(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Uw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Hw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Uw.fromPartial(e??{})},fromPartial(e){let t=Hw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Ww(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``}}var Gw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Ww();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Gw.fromPartial(e??{})},fromPartial(e){let t=Ww();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t}};function Kw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,role:``}}var qw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.role!==``&&t.uint32(34).string(e.role),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Kw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.role=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return qw.fromPartial(e??{})},fromPartial(e){let t=Kw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.role=e.role??``,t}};function Jw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,delta:``}}var Yw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.delta!==``&&t.uint32(34).string(e.delta),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Jw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Yw.fromPartial(e??{})},fromPartial(e){let t=Jw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.delta=e.delta??``,t}};function Xw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``}}var Zw={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Xw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Zw.fromPartial(e??{})},fromPartial(e){let t=Xw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t}};function Qw(){return{baseEvent:void 0,subagentRunId:void 0,messageId:void 0,delta:void 0}}var $w={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==void 0&&t.uint32(26).string(e.messageId),e.delta!==void 0&&t.uint32(34).string(e.delta),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Qw();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return $w.fromPartial(e??{})},fromPartial(e){let t=Qw();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??void 0,t.delta=e.delta??void 0,t}};function eT(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``}}var tT={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=eT();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return tT.fromPartial(e??{})},fromPartial(e){let t=eT();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t}};function nT(){return{baseEvent:void 0,subagentRunId:void 0,subtype:``,entityId:``,encryptedValue:``}}var rT={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.subtype!==``&&t.uint32(26).string(e.subtype),e.entityId!==``&&t.uint32(34).string(e.entityId),e.encryptedValue!==``&&t.uint32(42).string(e.encryptedValue),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=nT();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.subtype=n.string();continue;case 4:if(e!==34)break;i.entityId=n.string();continue;case 5:if(e!==42)break;i.encryptedValue=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return rT.fromPartial(e??{})},fromPartial(e){let t=nT();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.subtype=e.subtype??``,t.entityId=e.entityId??``,t.encryptedValue=e.encryptedValue??``,t}};function iT(){return{baseEvent:void 0,subagentRunId:``,name:``,description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var aT={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.name!==``&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=iT();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.name=n.string();continue;case 4:if(e!==34)break;i.description=n.string();continue;case 5:if(e!==42)break;i.parentSubagentRunId=n.string();continue;case 6:if(e!==50)break;i.parentToolCallId=n.string();continue;case 7:if(e!==58)break;i.parentMessageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return aT.fromPartial(e??{})},fromPartial(e){let t=iT();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.name=e.name??``,t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function oT(){return{baseEvent:void 0,subagentRunId:``,result:void 0,outcome:``,interruptIds:[]}}var sT={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&Z.encode(Z.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==``&&t.uint32(34).string(e.outcome);for(let n of e.interruptIds)t.uint32(42).string(n);return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=oT();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.result=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.outcome=n.string();continue;case 5:if(e!==42)break;i.interruptIds.push(n.string());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return sT.fromPartial(e??{})},fromPartial(e){let t=oT();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interruptIds=e.interruptIds?.map(e=>e)||[],t}};function cT(){return{baseEvent:void 0,subagentRunId:``,message:``,code:void 0}}var lT={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.message!==``&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=cT();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.code=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return lT.fromPartial(e??{})},fromPartial(e){let t=cT();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.message=e.message??``,t.code=e.code??void 0,t}};function uT(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0,toolCallResult:void 0,activitySnapshot:void 0,activityDelta:void 0,reasoningStart:void 0,reasoningMessageStart:void 0,reasoningMessageContent:void 0,reasoningMessageEnd:void 0,reasoningMessageChunk:void 0,reasoningEnd:void 0,reasoningEncryptedValue:void 0}}var dT={encode(e,t=new Y){return e.textMessageStart!==void 0&&rw.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&aw.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&sw.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&dw.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&pw.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&hw.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&xw.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Cw.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Tw.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&jw.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Nw.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Fw.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Lw.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&zw.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Vw.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Uw.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&lw.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&_w.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&aT.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&sT.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&lT.encode(e.subagentError,t.uint32(170).fork()).join(),e.toolCallResult!==void 0&&yw.encode(e.toolCallResult,t.uint32(178).fork()).join(),e.activitySnapshot!==void 0&&Dw.encode(e.activitySnapshot,t.uint32(186).fork()).join(),e.activityDelta!==void 0&&kw.encode(e.activityDelta,t.uint32(194).fork()).join(),e.reasoningStart!==void 0&&Gw.encode(e.reasoningStart,t.uint32(202).fork()).join(),e.reasoningMessageStart!==void 0&&qw.encode(e.reasoningMessageStart,t.uint32(210).fork()).join(),e.reasoningMessageContent!==void 0&&Yw.encode(e.reasoningMessageContent,t.uint32(218).fork()).join(),e.reasoningMessageEnd!==void 0&&Zw.encode(e.reasoningMessageEnd,t.uint32(226).fork()).join(),e.reasoningMessageChunk!==void 0&&$w.encode(e.reasoningMessageChunk,t.uint32(234).fork()).join(),e.reasoningEnd!==void 0&&tT.encode(e.reasoningEnd,t.uint32(242).fork()).join(),e.reasoningEncryptedValue!==void 0&&rT.encode(e.reasoningEncryptedValue,t.uint32(250).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=uT();for(;n.pos>>3){case 1:if(e!==10)break;i.textMessageStart=rw.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.textMessageContent=aw.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.textMessageEnd=sw.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.toolCallStart=dw.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.toolCallArgs=pw.decode(n,n.uint32());continue;case 6:if(e!==50)break;i.toolCallEnd=hw.decode(n,n.uint32());continue;case 7:if(e!==58)break;i.stateSnapshot=xw.decode(n,n.uint32());continue;case 8:if(e!==66)break;i.stateDelta=Cw.decode(n,n.uint32());continue;case 9:if(e!==74)break;i.messagesSnapshot=Tw.decode(n,n.uint32());continue;case 10:if(e!==82)break;i.raw=jw.decode(n,n.uint32());continue;case 11:if(e!==90)break;i.custom=Nw.decode(n,n.uint32());continue;case 12:if(e!==98)break;i.runStarted=Fw.decode(n,n.uint32());continue;case 13:if(e!==106)break;i.runFinished=Lw.decode(n,n.uint32());continue;case 14:if(e!==114)break;i.runError=zw.decode(n,n.uint32());continue;case 15:if(e!==122)break;i.stepStarted=Vw.decode(n,n.uint32());continue;case 16:if(e!==130)break;i.stepFinished=Uw.decode(n,n.uint32());continue;case 17:if(e!==138)break;i.textMessageChunk=lw.decode(n,n.uint32());continue;case 18:if(e!==146)break;i.toolCallChunk=_w.decode(n,n.uint32());continue;case 19:if(e!==154)break;i.subagentStarted=aT.decode(n,n.uint32());continue;case 20:if(e!==162)break;i.subagentFinished=sT.decode(n,n.uint32());continue;case 21:if(e!==170)break;i.subagentError=lT.decode(n,n.uint32());continue;case 22:if(e!==178)break;i.toolCallResult=yw.decode(n,n.uint32());continue;case 23:if(e!==186)break;i.activitySnapshot=Dw.decode(n,n.uint32());continue;case 24:if(e!==194)break;i.activityDelta=kw.decode(n,n.uint32());continue;case 25:if(e!==202)break;i.reasoningStart=Gw.decode(n,n.uint32());continue;case 26:if(e!==210)break;i.reasoningMessageStart=qw.decode(n,n.uint32());continue;case 27:if(e!==218)break;i.reasoningMessageContent=Yw.decode(n,n.uint32());continue;case 28:if(e!==226)break;i.reasoningMessageEnd=Zw.decode(n,n.uint32());continue;case 29:if(e!==234)break;i.reasoningMessageChunk=$w.decode(n,n.uint32());continue;case 30:if(e!==242)break;i.reasoningEnd=tT.decode(n,n.uint32());continue;case 31:if(e!==250)break;i.reasoningEncryptedValue=rT.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return dT.fromPartial(e??{})},fromPartial(e){let t=uT();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?rw.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?aw.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?sw.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?dw.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?pw.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?hw.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?xw.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Cw.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Tw.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?jw.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Nw.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Fw.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Lw.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?zw.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Vw.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Uw.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?lw.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?_w.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?aT.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?sT.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?lT.fromPartial(e.subagentError):void 0,t.toolCallResult=e.toolCallResult!==void 0&&e.toolCallResult!==null?yw.fromPartial(e.toolCallResult):void 0,t.activitySnapshot=e.activitySnapshot!==void 0&&e.activitySnapshot!==null?Dw.fromPartial(e.activitySnapshot):void 0,t.activityDelta=e.activityDelta!==void 0&&e.activityDelta!==null?kw.fromPartial(e.activityDelta):void 0,t.reasoningStart=e.reasoningStart!==void 0&&e.reasoningStart!==null?Gw.fromPartial(e.reasoningStart):void 0,t.reasoningMessageStart=e.reasoningMessageStart!==void 0&&e.reasoningMessageStart!==null?qw.fromPartial(e.reasoningMessageStart):void 0,t.reasoningMessageContent=e.reasoningMessageContent!==void 0&&e.reasoningMessageContent!==null?Yw.fromPartial(e.reasoningMessageContent):void 0,t.reasoningMessageEnd=e.reasoningMessageEnd!==void 0&&e.reasoningMessageEnd!==null?Zw.fromPartial(e.reasoningMessageEnd):void 0,t.reasoningMessageChunk=e.reasoningMessageChunk!==void 0&&e.reasoningMessageChunk!==null?$w.fromPartial(e.reasoningMessageChunk):void 0,t.reasoningEnd=e.reasoningEnd!==void 0&&e.reasoningEnd!==null?tT.fromPartial(e.reasoningEnd):void 0,t.reasoningEncryptedValue=e.reasoningEncryptedValue!==void 0&&e.reasoningEncryptedValue!==null?rT.fromPartial(e.reasoningEncryptedValue):void 0,t}};function fT(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0,cacheWriteInputTokens:void 0}}var pT={encode(e,t=new Y){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),e.cacheWriteInputTokens!==void 0&&t.uint32(64).int64(e.cacheWriteInputTokens),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=fT();for(;n.pos>>3){case 1:if(e!==10)break;i.provider=n.string();continue;case 2:if(e!==18)break;i.model=n.string();continue;case 3:if(e!==24)break;i.inputTokens=mT(n.int64());continue;case 4:if(e!==32)break;i.outputTokens=mT(n.int64());continue;case 5:if(e!==40)break;i.totalTokens=mT(n.int64());continue;case 6:if(e!==48)break;i.reasoningTokens=mT(n.int64());continue;case 7:if(e!==56)break;i.cachedInputTokens=mT(n.int64());continue;case 8:if(e!==64)break;i.cacheWriteInputTokens=mT(n.int64());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return pT.fromPartial(e??{})},fromPartial(e){let t=fT();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t.cacheWriteInputTokens=e.cacheWriteInputTokens??void 0,t}};function mT(e){let t=globalThis.Number(e.toString());if(t>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error(`Value is larger than Number.MAX_SAFE_INTEGER`);if(te&&typeof e==`object`?e:void 0,gT=e=>Array.isArray(e)?e:[],_T=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS,vT=()=>{_T()||console.warn(`[ag-ui][proto] Dropped a content part this build does not know: the protocol has a variant this SDK predates.`)};new Set(Object.values(I));var yT={textMessageStart:`TEXT_MESSAGE_START`,textMessageContent:`TEXT_MESSAGE_CONTENT`,textMessageEnd:`TEXT_MESSAGE_END`,textMessageChunk:`TEXT_MESSAGE_CHUNK`,toolCallStart:`TOOL_CALL_START`,toolCallArgs:`TOOL_CALL_ARGS`,toolCallEnd:`TOOL_CALL_END`,toolCallChunk:`TOOL_CALL_CHUNK`,toolCallResult:`TOOL_CALL_RESULT`,stateSnapshot:`STATE_SNAPSHOT`,stateDelta:`STATE_DELTA`,messagesSnapshot:`MESSAGES_SNAPSHOT`,activitySnapshot:`ACTIVITY_SNAPSHOT`,activityDelta:`ACTIVITY_DELTA`,raw:`RAW`,custom:`CUSTOM`,runStarted:`RUN_STARTED`,runFinished:`RUN_FINISHED`,runError:`RUN_ERROR`,stepStarted:`STEP_STARTED`,stepFinished:`STEP_FINISHED`,reasoningStart:`REASONING_START`,reasoningMessageStart:`REASONING_MESSAGE_START`,reasoningMessageContent:`REASONING_MESSAGE_CONTENT`,reasoningMessageEnd:`REASONING_MESSAGE_END`,reasoningMessageChunk:`REASONING_MESSAGE_CHUNK`,reasoningEnd:`REASONING_END`,reasoningEncryptedValue:`REASONING_ENCRYPTED_VALUE`,subagentStarted:`SUBAGENT_STARTED`,subagentFinished:`SUBAGENT_FINISHED`,subagentError:`SUBAGENT_ERROR`},bT=new Set([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]),xT=e=>{let t=hT(e);if(t){if([t.data,t.url,t.file].filter(Boolean).length>1)throw Error(`Invalid event: source carries more than one arm`);if(t.data){let e=t.data;return{type:`data`,value:e.value,mimeType:e.mimeType}}if(t.url){let e=t.url;return{type:`url`,value:e.value,mimeType:e.mimeType}}if(t.file){let e=t.file;return{type:`file`,value:e.value,provider:e.provider,mimeType:e.mimeType}}}},ST=e=>{let t=hT(e);if(t){if([t.text,t.image,t.audio,t.video,t.document].filter(Boolean).length>1)throw Error(`Invalid event: content part carries more than one arm`);if(t.text){let e=t.text;return{type:`text`,id:e.id,text:e.text,metadata:e.metadata}}if(t.image){let e=t.image;return e.source!==void 0&&xT(e.source)===void 0?void 0:{type:`image`,id:e.id,source:xT(e.source),metadata:e.metadata}}if(t.audio){let e=t.audio;return e.source!==void 0&&xT(e.source)===void 0?void 0:{type:`audio`,id:e.id,source:xT(e.source),metadata:e.metadata}}if(t.video){let e=t.video;return e.source!==void 0&&xT(e.source)===void 0?void 0:{type:`video`,id:e.id,source:xT(e.source),metadata:e.metadata}}if(t.document){let e=t.document;return e.source!==void 0&&xT(e.source)===void 0?void 0:{type:`document`,id:e.id,source:xT(e.source),metadata:e.metadata}}}},CT=new Set([`activity`]),wT=new Set([`user`,`tool`]),TT=new Set([`developer`,`system`,`assistant`,`user`,`tool`,`activity`,`reasoning`]),ET=e=>{let t=hT(e)??{},n={...t},r=typeof t.role==`string`?t.role:``,i=TT.has(r),a=i?wT.has(r):gT(t.contentParts).length>0,o=i?CT.has(r):!a&&t.activityContent!==void 0;if(!i&&(t.content===void 0?0:1)+ +(gT(t.contentParts).length>0)+(t.activityContent===void 0?0:1)>1)throw Error(`Invalid event: message carries more than one content form`);if(i){if(!a&&gT(t.contentParts).length>0)throw Error(`Invalid event: message carries content parts for a role that has none`);if(t.activityContent!==void 0&&!o)throw Error(`Invalid event: message carries activity content for a non-activity role`);if(o&&t.content!==void 0)throw Error(`Invalid event: activity content cannot ride with other content forms`);if(a&&t.content!==void 0&&gT(t.contentParts).length>0)throw Error(`Invalid event: message carries both string content and content parts`)}return a&&t.content===void 0&&(n.content=gT(t.contentParts).map(e=>{let t=ST(e);return t===void 0&&vT(),t}).filter(e=>e!==void 0)),o&&t.activityContent!==void 0&&(n.content=t.activityContent),delete n.activityContent,delete n.contentParts,gT(t.toolCalls).length===0&&delete n.toolCalls,Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),n},DT=e=>{if(Array.isArray(e)){for(let t of e)DT(t);return}let t=hT(e);if(t)for(let e of Object.keys(t))t[e]===void 0?delete t[e]:DT(t[e])},OT=e=>{let t=hT(e);if(!t)return;let n={};return t.threadId!==void 0&&(n.threadId=t.threadId),t.runId!==void 0&&(n.runId=t.runId),t.protocolVersion!==void 0&&(n.protocolVersion=t.protocolVersion),t.parentRunId!==void 0&&(n.parentRunId=t.parentRunId),t.state!==void 0&&(n.state=t.state),n.messages=gT(t.messages).map(ET).filter(e=>e!==void 0),n.tools=gT(t.tools),n.context=gT(t.context),t.forwardedProps!==void 0&&(n.forwardedProps=t.forwardedProps),n.resume=gT(t.resume),n},kT={TextMessageStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},BaseEvent:{singular:new Set([3,4]),descend:{},google:{3:`google.protobuf.Value`,4:`google.protobuf.Struct`}},TextMessageContentEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},TextMessageEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallArgsEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},StateSnapshotEvent:{singular:new Set([1,2]),descend:{1:`BaseEvent`},google:{2:`google.protobuf.Value`}},StateDeltaEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,2:`JsonPatchOperation`}},JsonPatchOperation:{singular:new Set([4]),descend:{},google:{4:`google.protobuf.Value`}},MessagesSnapshotEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,2:`Message`}},Message:{singular:new Set([9,13]),descend:{5:`ToolCall`,8:`InputContent`},google:{9:`google.protobuf.Struct`,13:`google.protobuf.Struct`}},ToolCall:{singular:new Set([3,4]),descend:{},google:{4:`google.protobuf.Struct`}},InputContent:{singular:new Set([1,2,3,4,5]),descend:{1:`TextInputPart`,2:`ImageInputPart`,3:`AudioInputPart`,4:`VideoInputPart`,5:`DocumentInputPart`},arms:new Set([1,2,3,4,5])},TextInputPart:{singular:new Set([3]),descend:{},google:{3:`google.protobuf.Value`}},ImageInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},InputContentSource:{singular:new Set([1,2,3]),descend:{},arms:new Set([1,2,3])},AudioInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},VideoInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},DocumentInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},RawEvent:{singular:new Set([1,2]),descend:{1:`BaseEvent`},google:{2:`google.protobuf.Value`}},CustomEvent:{singular:new Set([1,3]),descend:{1:`BaseEvent`},google:{3:`google.protobuf.Value`}},RunStartedEvent:{singular:new Set([1,5]),descend:{1:`BaseEvent`,5:`RunAgentInput`}},RunAgentInput:{singular:new Set([4,8]),descend:{5:`Message`,6:`Tool`,9:`ResumeEntry`},google:{4:`google.protobuf.Value`,8:`google.protobuf.Value`}},Tool:{singular:new Set([3,4]),descend:{},google:{3:`google.protobuf.Value`,4:`google.protobuf.Struct`}},ResumeEntry:{singular:new Set([3,4]),descend:{},google:{3:`google.protobuf.Value`,4:`google.protobuf.Struct`}},RunFinishedEvent:{singular:new Set([1,4]),descend:{1:`BaseEvent`,6:`Interrupt`},google:{4:`google.protobuf.Value`}},Interrupt:{singular:new Set([5,7]),descend:{},google:{5:`google.protobuf.Value`,7:`google.protobuf.Value`}},RunErrorEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},StepStartedEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},StepFinishedEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},TextMessageChunkEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallChunkEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},SubagentStartedEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},SubagentFinishedEvent:{singular:new Set([1,3]),descend:{1:`BaseEvent`},google:{3:`google.protobuf.Value`}},SubagentErrorEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallResultEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,7:`InputContent`}},ActivitySnapshotEvent:{singular:new Set([1,5]),descend:{1:`BaseEvent`},google:{5:`google.protobuf.Struct`}},ActivityDeltaEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,5:`JsonPatchOperation`}},ReasoningStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageContentEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageChunkEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningEncryptedValueEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},"google.protobuf.Struct":{singular:new Set,descend:{1:`google.protobuf.Struct.FieldsEntry`}},"google.protobuf.Struct.FieldsEntry":{singular:new Set([2]),descend:{2:`google.protobuf.Value`}},"google.protobuf.Value":{singular:new Set([5,6]),descend:{5:`google.protobuf.Struct`,6:`google.protobuf.ListValue`},arms:new Set([1,2,3,4,5,6]),armWireTypes:{1:0,2:1,3:2,4:0,5:2,6:2}},"google.protobuf.ListValue":{singular:new Set,descend:{1:`google.protobuf.Value`}}},AT={1:`TextMessageStartEvent`,2:`TextMessageContentEvent`,3:`TextMessageEndEvent`,4:`ToolCallStartEvent`,5:`ToolCallArgsEvent`,6:`ToolCallEndEvent`,7:`StateSnapshotEvent`,8:`StateDeltaEvent`,9:`MessagesSnapshotEvent`,10:`RawEvent`,11:`CustomEvent`,12:`RunStartedEvent`,13:`RunFinishedEvent`,14:`RunErrorEvent`,15:`StepStartedEvent`,16:`StepFinishedEvent`,17:`TextMessageChunkEvent`,18:`ToolCallChunkEvent`,19:`SubagentStartedEvent`,20:`SubagentFinishedEvent`,21:`SubagentErrorEvent`,22:`ToolCallResultEvent`,23:`ActivitySnapshotEvent`,24:`ActivityDeltaEvent`,25:`ReasoningStartEvent`,26:`ReasoningMessageStartEvent`,27:`ReasoningMessageContentEvent`,28:`ReasoningMessageEndEvent`,29:`ReasoningMessageChunkEvent`,30:`ReasoningEndEvent`,31:`ReasoningEncryptedValueEvent`};function jT(e,t){let n=0,r=0;for(;;){if(t.offset>=e.length)throw Error(`Invalid event`);let i=e[t.offset++];if(r<28?n+=(i&127)*2**r:r===28&&(n+=(i&15)*2**28),r+=7,!(i&128))return n}}function MT(e,t){let n={offset:0},r=0,i=0;for(;n.offsete.length)throw Error(`Invalid event`);if(r===0){if(t.arms?.has(o)){if(i!==0&&i!==o)throw Error(`Invalid event`);i=o}let r=t.descend[o];if(r!==void 0){let t=kT[r];t!==void 0&&MT(e.subarray(n.offset,n.offset+a),t)}}n.offset+=a}else if(s===5)n.offset+=4;else throw Error(`Invalid event`);if(n.offset>e.length)throw Error(`Invalid event`)}if(r!==0)throw Error(`Invalid event`)}function NT(e){let t=new Set,n={offset:0},r=0;for(;n.offset0&&!t.has(a))throw Error(`Invalid event`);t.add(a)}if(o===0)jT(e,n);else if(o===1)n.offset+=8;else if(o===2){let t=jT(e,n);if(n.offset+t>e.length)throw Error(`Invalid event`);if(r===0){let r=AT[a];if(r!==void 0){let i=kT[r];i!==void 0&&MT(e.subarray(n.offset,n.offset+t),i)}}n.offset+=t}else if(o===5)n.offset+=4;else throw Error(`Invalid event`);if(n.offset>e.length)throw Error(`Invalid event`)}if(r!==0)throw Error(`Invalid event`)}function PT(e){if(e.length===1)return e[0];let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}function FT(e,t){let n=new X(e),r=[],i=new Map,a,o=!1;for(;n.pos1||n!==t){s.push(new Y().uint32(e.number*8+2).bytes(n).finish()),o=!0;continue}}s.push(e.raw)}return o?PT(s):e}var IT=class extends Error{constructor(e=`Unknown event type`){super(e),this.name=`AGUIUnknownEventTypeError`}};function LT(e,t,n,r){let i=0,a=0,o=0;for(;;){if(t.offset>=e.length||o>=n)return-1;let s=e[t.offset++];if(o+=1,o===n&&s>r)return-1;if(i+=(s&127)*2**a,a+=7,!(s&128))return i}}var RT=(e,t)=>LT(e,t,5,15),zT=(e,t)=>LT(e,t,10,1);function BT(e){let t={offset:0},n=[];for(;t.offsete.length)return!1;t.offset+=n}else return!1;if(t.offset>e.length)return!1}return n.length===0}function VT(e){let t={offset:0},n=[],r=0;for(;t.offsete.length)return!1;if(s){if(bT.has(a)||!BT(e.subarray(t.offset,t.offset+n)))return!1;r+=1}t.offset+=n}else return!1;if(t.offset>e.length)return!1}return n.length===0&&r>0}function HT(e){NT(e);let t=dT.decode(FT(e,{singular:bT,descend:AT})),n=Object.entries(t).filter(([,e])=>e!==void 0);if(n.length!==1)throw n.length===0&&VT(e)?new IT:Error(`Invalid event`);let r=n[0],i=yT[r[0]];if(i===void 0)throw Error(`Invalid event`);let a=r[1],o=hT(a.baseEvent);if(!o)throw Error(`Invalid event`);let s=ew[o.type];if(s!==i)throw Error(`Invalid event: envelope carries `+i+` but the base event declares `+String(s));if(a.type=i,a.timestamp=o.timestamp,a.rawEvent=o.rawEvent,o.metadata!==void 0&&(a.metadata=o.metadata),delete a.baseEvent,a.type===`MESSAGES_SNAPSHOT`&&Array.isArray(a.messages)&&(a.messages=a.messages.map(ET).filter(e=>e!==void 0)),a.type===`RUN_FINISHED`){let e=a,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,n={};n.pendingToolCallIds=e.pendingToolCallIds,delete e.pendingToolCallIds,n.interrupts=e.interrupts,delete e.interrupts,delete e.outcome,t===void 0&&(gT(n.pendingToolCallIds).length>0&&(e.pendingToolCallIds=n.pendingToolCallIds),gT(n.interrupts).length>0&&(e.interrupts=n.interrupts)),t===`success`&&(e.outcome={type:`success`,...gT(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{},...gT(n.interrupts).length>0?{interrupts:n.interrupts}:{}}),t===`interrupt`&&(e.outcome={type:`interrupt`,interrupts:gT(n.interrupts),...gT(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{}}),t===`cancelled`&&(e.outcome={type:`cancelled`,...gT(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{},...gT(n.interrupts).length>0?{interrupts:n.interrupts}:{}}),t!==void 0&&![`success`,`interrupt`,`cancelled`].includes(t)&&(e.outcome={type:t,...gT(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{},...gT(n.interrupts).length>0?{interrupts:n.interrupts}:{}})}if(a.type===`SUBAGENT_FINISHED`){let e=a,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,n={};n.interruptIds=e.interruptIds,delete e.interruptIds,delete e.outcome,t===void 0&&gT(n.interruptIds).length>0&&(e.interruptIds=n.interruptIds),t===`success`&&(e.outcome={type:`success`,...gT(n.interruptIds).length>0?{interruptIds:n.interruptIds}:{}}),t===`suspended`&&(e.outcome={type:`suspended`,...gT(n.interruptIds).length>0?{interruptIds:n.interruptIds}:{}}),t!==void 0&&![`success`,`suspended`].includes(t)&&(e.outcome={type:t,...gT(n.interruptIds).length>0?{interruptIds:n.interruptIds}:{}})}if(a.type===`STATE_DELTA`&&Array.isArray(a.delta)&&(a.delta=a.delta.map(e=>{let t=hC[e.op];return e.op=typeof t==`string`&&t!==`UNRECOGNIZED`?t.toLowerCase():String(e.op),Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]}),e})),a.type===`ACTIVITY_DELTA`&&Array.isArray(a.patch)&&(a.patch=a.patch.map(e=>{let t=hC[e.op];return e.op=typeof t==`string`&&t!==`UNRECOGNIZED`?t.toLowerCase():String(e.op),Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]}),e})),a.type===`RUN_FINISHED`&&Array.isArray(a.usage)&&a.usage.length===0&&delete a.usage,a.type===`RUN_ERROR`&&Array.isArray(a.usage)&&a.usage.length===0&&delete a.usage,a.type===`TOOL_CALL_RESULT`){let e=a;if(e.content!==void 0&&gT(e.contentParts).length>0)throw Error(`Invalid event: content carries both string content and content parts`);e.content===void 0&&(e.content=gT(e.contentParts).map(e=>{let t=ST(e);return t===void 0&&vT(),t}).filter(e=>e!==void 0)),delete e.contentParts}return a.type===`RUN_STARTED`&&a.input!==void 0&&(a.input=OT(a.input)),DT(a),a}var UT=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,WT=e=>{if(typeof e!=`string`)throw TypeError(`Invalid argument expected string`);let t=e.match(UT);if(!t)throw Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},GT=e=>e===`*`||e===`x`||e===`X`,KT=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},qT=(e,t)=>typeof e==typeof t?[e,t]:[String(e),String(t)],JT=(e,t)=>{if(GT(e)||GT(t))return 0;let[n,r]=qT(KT(e),KT(t));return n>r?1:n{for(let n=0;n{let n=WT(e),r=WT(t),i=n.pop(),a=r.pop(),o=YT(n,r);return o===0?i&&a?YT(i.split(`.`),a.split(`.`)):i||a?i?-1:1:0:o},ZT=e=>typeof e==`string`&&/^[v\d]/.test(e)&&UT.test(e);Object.freeze({status:`aborted`});function $(e,t,n){function r(n,r){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r);for(let e in o.prototype)e in n||Object.defineProperty(n,e,{value:o.prototype[e].bind(n)});n._zod.constr=o,n._zod.def=r}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 QT=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},$T={};function eE(e){return e&&Object.assign($T,e),$T}function tE(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 nE(e,t){return typeof t==`bigint`?t.toString():t}function rE(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function iE(e){return e==null}function aE(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function oE(e,t,n){Object.defineProperty(e,t,{get(){{let r=n();return e[t]=r,r}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function sE(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function cE(e){return JSON.stringify(e)}var lE=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function uE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var dE=rE(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function fE(e){if(uE(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return uE(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}var pE=new Set([`string`,`number`,`symbol`]);function mE(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function hE(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function gE(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 _E(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function vE(e,t){let n={},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=r.shape[e])}return hE(e,{...e._zod.def,shape:n,checks:[]})}function yE(e,t){let n={...e._zod.def.shape},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return hE(e,{...e._zod.def,shape:n,checks:[]})}function bE(e,t){if(!fE(t))throw Error(`Invalid input to extend: expected a plain object`);return hE(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return sE(this,`shape`,n),n},checks:[]})}function xE(e,t){return hE(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return sE(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function SE(e,t,n){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 hE(t,{...t._zod.def,shape:i,checks:[]})}function CE(e,t,n){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 hE(t,{...t._zod.def,shape:i,checks:[]})}function wE(e,t=0){for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function EE(e){return typeof e==`string`?e:e?.message}function DE(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=EE(e.inst?._zod.def?.error?.(e))??EE(t?.error?.(e))??EE(n.customError?.(e))??EE(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function OE(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function kE(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var AE=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,nE,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},jE=$(`$ZodError`,AE),ME=$(`$ZodError`,AE,{Parent:Error});function NE(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 PE(e,t){let n=t||function(e){return e.message},r={_errors:[]},i=e=>{for(let t of e.issues)if(t.code===`invalid_union`&&t.errors.length)t.errors.map(e=>i({issues:e}));else if(t.code===`invalid_key`)i({issues:t.issues});else if(t.code===`invalid_element`)i({issues:t.issues});else if(t.path.length===0)r._errors.push(n(t));else{let e=r,i=0;for(;i(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 QT;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>DE(e,a,eE())));throw lE(t,i?.callee),t}return o.value},IE=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=>DE(e,a,eE())));throw lE(t,i?.callee),t}return o.value},LE=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 QT;return a.issues.length?{success:!1,error:new(e??jE)(a.issues.map(e=>DE(e,i,eE())))}:{success:!0,data:a.value}},RE=LE(ME),zE=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=>DE(e,i,eE())))}:{success:!0,data:a.value}},BE=zE(ME),VE=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),HE=$(`$ZodCheckMaxLength`,(e,t)=>{var n;VE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!iE(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=OE(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),UE=$(`$ZodCheckMinLength`,(e,t)=>{var n;VE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!iE(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=OE(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),WE=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;VE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!iE(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=OE(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})}}),GE=$(`$ZodCheckOverwrite`,(e,t)=>{VE.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),KE=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(` `).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(` -`))}},WE={major:4,minor:0,patch:0},GE=$(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=WE;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=xE(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 YT;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=xE(e,t))});else{if(e.issues.length===t)continue;r||=xE(e,t)}}return i?i.then(()=>e):e};e._zod.run=(n,i)=>{let a=e._zod.parse(n,i);if(a instanceof Promise){if(i.async===!1)throw new YT;return a.then(e=>t(e,r,i))}return t(a,r,i)}}e[`~standard`]={validate:t=>{try{let n=FE(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return LE(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}}),KE=$(`$ZodUnknown`,(e,t)=>{GE.init(e,t),e._zod.parse=e=>e}),qE=$(`$ZodNever`,(e,t)=>{GE.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function JE(e,t,n){e.issues.length&&t.issues.push(...SE(n,e.issues)),t.value[n]=e.value}var YE=$(`$ZodArray`,(e,t)=>{GE.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;eJE(t,n,e))):JE(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function XE(e,t,n){e.issues.length&&t.issues.push(...SE(n,e.issues)),t.value[n]=e.value}function ZE(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...SE(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}var QE=$(`$ZodObject`,(e,t)=>{GE.init(e,t);let n=eE(()=>{let e=Object.keys(t.shape);for(let n of e)if(!(t.shape[n]instanceof GE))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=mE(t.shape);return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}});rE(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=e=>{let t=new UE([`shape`,`payload`,`ctx`]),r=n.value,i=e=>{let t=aE(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 r.keys)a[e]=`key_${o++}`;t.write(`const newResult = {}`);for(let e of r.keys)if(r.optionalKeys.has(e)){let n=a[e];t.write(`const ${n} = ${i(e)};`);let r=aE(e);t.write(` +`))}},qE={major:4,minor:0,patch:0},JE=$(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qE;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=wE(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 QT;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=wE(e,t))});else{if(e.issues.length===t)continue;r||=wE(e,t)}}return i?i.then(()=>e):e};e._zod.run=(n,i)=>{let a=e._zod.parse(n,i);if(a instanceof Promise){if(i.async===!1)throw new QT;return a.then(e=>t(e,r,i))}return t(a,r,i)}}e[`~standard`]={validate:t=>{try{let n=RE(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return BE(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}}),YE=$(`$ZodUnknown`,(e,t)=>{JE.init(e,t),e._zod.parse=e=>e}),XE=$(`$ZodNever`,(e,t)=>{JE.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function ZE(e,t,n){e.issues.length&&t.issues.push(...TE(n,e.issues)),t.value[n]=e.value}var QE=$(`$ZodArray`,(e,t)=>{JE.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;eZE(t,n,e))):ZE(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function $E(e,t,n){e.issues.length&&t.issues.push(...TE(n,e.issues)),t.value[n]=e.value}function eD(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...TE(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}var tD=$(`$ZodObject`,(e,t)=>{JE.init(e,t);let n=rE(()=>{let e=Object.keys(t.shape);for(let n of e)if(!(t.shape[n]instanceof JE))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=_E(t.shape);return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}});oE(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=e=>{let t=new KE([`shape`,`payload`,`ctx`]),r=n.value,i=e=>{let t=cE(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 r.keys)a[e]=`key_${o++}`;t.write(`const newResult = {}`);for(let e of r.keys)if(r.optionalKeys.has(e)){let n=a[e];t.write(`const ${n} = ${i(e)};`);let r=cE(e);t.write(` if (${n}.issues.length) { if (input[${r}] === undefined) { if (${r} in input) { @@ -129,8 +129,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. `)}else{let n=a[e];t.write(`const ${n} = ${i(e)};`),t.write(` if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ ...iss, - path: iss.path ? [${aE(e)}, ...iss.path] : [${aE(e)}] - })));`),t.write(`newResult[${aE(e)}] = ${n}.value`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},i,a=sE,o=!XT.jitless,s=o&&cE.value,c=t.catchall,l;e._zod.parse=(u,d)=>{l??=n.value;let f=u.value;if(!a(f))return u.issues.push({expected:`object`,code:`invalid_type`,input:f,inst:e}),u;let p=[];if(o&&s&&d?.async===!1&&d.jitless!==!0)i||=r(t.shape),u=i(u,d);else{u.value={};let e=l.shape;for(let t of l.keys){let n=e[t],r=n._zod.run({value:f[t],issues:[]},d),i=n._zod.optin===`optional`&&n._zod.optout===`optional`;r instanceof Promise?p.push(r.then(e=>i?ZE(e,u,t,f):XE(e,u,t))):i?ZE(r,u,t,f):XE(r,u,t)}}if(!c)return p.length?Promise.all(p).then(()=>u):u;let m=[],h=l.keySet,g=c._zod,_=g.def.type;for(let e of Object.keys(f)){if(h.has(e))continue;if(_===`never`){m.push(e);continue}let t=g.run({value:f[e],issues:[]},d);t instanceof Promise?p.push(t.then(t=>XE(t,u,e))):XE(t,u,e)}return m.length&&u.issues.push({code:`unrecognized_keys`,keys:m,input:f,inst:e}),p.length?Promise.all(p).then(()=>u):u}});function $E(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>wE(e,r,ZT())))}),t}var eD=$(`$ZodUnion`,(e,t)=>{GE.init(e,t),rE(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),rE(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),rE(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),rE(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=>nE(e.source)).join(`|`)})$`)}}),e._zod.parse=(n,r)=>{let i=!1,a=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},r);if(t instanceof Promise)a.push(t),i=!0;else{if(t.issues.length===0)return t;a.push(t)}}return i?Promise.all(a).then(t=>$E(t,n,e,r)):$E(a,n,e,r)}}),tD=$(`$ZodIntersection`,(e,t)=>{GE.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])=>rD(e,t,n)):rD(e,i,a)}});function nD(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(lE(e)&&lE(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=nD(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{GE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!lE(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){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(...SE(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...SE(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}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(s.issues.length){n.issues.push({origin:`record`,code:`invalid_key`,issues:s.issues.map(e=>wE(e,r,ZT())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;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(...SE(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...SE(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),aD=$(`$ZodEnum`,(e,t)=>{GE.init(e,t);let n=QT(t.entries);e._zod.values=new Set(n),e._zod.pattern=RegExp(`^(${n.filter(e=>uE.has(typeof e)).map(e=>typeof e==`string`?dE(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,r)=>{let i=t.value;return e._zod.values.has(i)||t.issues.push({code:`invalid_value`,values:n,input:i,inst:e}),t}}),oD=$(`$ZodLiteral`,(e,t)=>{GE.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?dE(e):e?e.toString():String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),sD=$(`$ZodTransform`,(e,t)=>{GE.init(e,t),e._zod.parse=(e,n)=>{let r=t.transform(e.value,e);if(n.async)return(r instanceof Promise?r:Promise.resolve(r)).then(t=>(e.value=t,e));if(r instanceof Promise)throw new YT;return e.value=r,e}}),cD=$(`$ZodOptional`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,rE(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),rE(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${nE(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>t.innerType._zod.optin===`optional`?t.innerType._zod.run(e,n):e.value===void 0?e:t.innerType._zod.run(e,n)}),lD=$(`$ZodNullable`,(e,t)=>{GE.init(e,t),rE(e._zod,`optin`,()=>t.innerType._zod.optin),rE(e._zod,`optout`,()=>t.innerType._zod.optout),rE(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${nE(e.source)}|null)$`):void 0}),rE(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)}),uD=$(`$ZodDefault`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,rE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(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=>dD(e,t)):dD(r,t)}});function dD(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var fD=$(`$ZodPrefault`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,rE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),pD=$(`$ZodNonOptional`,(e,t)=>{GE.init(e,t),rE(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=>mD(t,e)):mD(i,e)}});function mD(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 hD=$(`$ZodCatch`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,rE(e._zod,`optout`,()=>t.innerType._zod.optout),rE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(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=>wE(e,n,ZT()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>wE(e,n,ZT()))},input:e.value}),e.issues=[]),e)}}),gD=$(`$ZodPipe`,(e,t)=>{GE.init(e,t),rE(e._zod,`values`,()=>t.in._zod.values),rE(e._zod,`optin`,()=>t.in._zod.optin),rE(e._zod,`optout`,()=>t.out._zod.optout),e._zod.parse=(e,n)=>{let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>_D(e,t,n)):_D(r,t,n)}});function _D(e,t,n){return xE(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}var vD=$(`$ZodReadonly`,(e,t)=>{GE.init(e,t),rE(e._zod,`propValues`,()=>t.innerType._zod.propValues),rE(e._zod,`values`,()=>t.innerType._zod.values),rE(e._zod,`optin`,()=>t.innerType._zod.optin),rE(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(yD):yD(r)}});function yD(e){return e.value=Object.freeze(e.value),e}var bD=$(`$ZodLazy`,(e,t)=>{GE.init(e,t),rE(e._zod,`innerType`,()=>t.getter()),rE(e._zod,`pattern`,()=>e._zod.innerType._zod.pattern),rE(e._zod,`propValues`,()=>e._zod.innerType._zod.propValues),rE(e._zod,`optin`,()=>e._zod.innerType._zod.optin),rE(e._zod,`optout`,()=>e._zod.innerType._zod.optout),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),xD=$(`$ZodCustom`,(e,t)=>{RE.init(e,t),GE.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=>SD(t,n,r,e));SD(i,n,r,e)}});function SD(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(EE(e))}}var CD=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,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)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function wD(){return new CD}var TD=wD();function ED(e){return new e({type:`unknown`})}function DD(e,t){return new e({type:`never`,...pE(t)})}function OD(e,t){return new zE({check:`max_length`,...pE(t),maximum:e})}function kD(e,t){return new BE({check:`min_length`,...pE(t),minimum:e})}function AD(e,t){return new VE({check:`length_equals`,...pE(t),length:e})}function jD(e){return new HE({check:`overwrite`,tx:e})}function MD(e,t,n){return new e({type:`array`,element:t,...pE(n)})}function ND(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...pE(n)})}var PD=(e,t)=>{OE.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>jE(e,t)},flatten:{value:t=>AE(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,PD);var FD=$(`ZodError`,PD,{Parent:Error}),ID=ME(FD),LD=NE(FD),RD=PE(FD),zD=IE(FD),BD=$(`ZodType`,(e,t)=>(GE.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),e.clone=(t,n)=>fE(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>ID(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>RD(e,t,n),e.parseAsync=async(t,n)=>LD(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>zD(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(CO(t,n)),e.superRefine=t=>e.check(wO(t)),e.overwrite=t=>e.check(jD(t)),e.optional=()=>aO(e),e.nullable=()=>sO(e),e.nullish=()=>aO(sO(e)),e.nonoptional=t=>pO(e,t),e.array=()=>KD(e),e.or=t=>YD([e,t]),e.and=t=>ZD(e,t),e.transform=t=>_O(e,rO(t)),e.default=t=>lO(e,t),e.prefault=t=>dO(e,t),e.catch=t=>hO(e,t),e.pipe=t=>_O(e,t),e.readonly=()=>yO(e),e.describe=t=>{let n=e.clone();return TD.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return TD.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return TD.get(e);let n=e.clone();return TD.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),VD=$(`ZodUnknown`,(e,t)=>{KE.init(e,t),BD.init(e,t)});function HD(){return ED(VD)}var UD=$(`ZodNever`,(e,t)=>{qE.init(e,t),BD.init(e,t)});function WD(e){return DD(UD,e)}var GD=$(`ZodArray`,(e,t)=>{YE.init(e,t),BD.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(kD(t,n)),e.nonempty=t=>e.check(kD(1,t)),e.max=(t,n)=>e.check(OD(t,n)),e.length=(t,n)=>e.check(AD(t,n)),e.unwrap=()=>e.element});function KD(e,t){return MD(GD,e,t)}var qD=$(`ZodObject`,(e,t)=>{QE.init(e,t),BD.init(e,t),rE(e,`shape`,()=>t.shape),e.keyof=()=>eO(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:HD()}),e.loose=()=>e.clone({...e._zod.def,catchall:HD()}),e.strict=()=>e.clone({...e._zod.def,catchall:WD()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>_E(e,t),e.merge=t=>vE(e,t),e.pick=t=>hE(e,t),e.omit=t=>gE(e,t),e.partial=(...t)=>yE(iO,e,t[0]),e.required=(...t)=>bE(fO,e,t[0])}),JD=$(`ZodUnion`,(e,t)=>{eD.init(e,t),BD.init(e,t),e.options=t.options});function YD(e,t){return new JD({type:`union`,options:e,...pE(t)})}var XD=$(`ZodIntersection`,(e,t)=>{tD.init(e,t),BD.init(e,t)});function ZD(e,t){return new XD({type:`intersection`,left:e,right:t})}var QD=$(`ZodRecord`,(e,t)=>{iD.init(e,t),BD.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType}),$D=$(`ZodEnum`,(e,t)=>{aD.init(e,t),BD.init(e,t),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 $D({...t,checks:[],...pE(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 $D({...t,checks:[],...pE(r),entries:i})}});function eO(e,t){return new $D({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...pE(t)})}var tO=$(`ZodLiteral`,(e,t)=>{oD.init(e,t),BD.init(e,t),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]}})}),nO=$(`ZodTransform`,(e,t)=>{sD.init(e,t),BD.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=r=>{if(typeof r==`string`)n.issues.push(EE(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,t.continue??=!0,n.issues.push(EE(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function rO(e){return new nO({type:`transform`,transform:e})}var iO=$(`ZodOptional`,(e,t)=>{cD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function aO(e){return new iO({type:`optional`,innerType:e})}var oO=$(`ZodNullable`,(e,t)=>{lD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sO(e){return new oO({type:`nullable`,innerType:e})}var cO=$(`ZodDefault`,(e,t)=>{uD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lO(e,t){return new cO({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}var uO=$(`ZodPrefault`,(e,t)=>{fD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function dO(e,t){return new uO({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}var fO=$(`ZodNonOptional`,(e,t)=>{pD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function pO(e,t){return new fO({type:`nonoptional`,innerType:e,...pE(t)})}var mO=$(`ZodCatch`,(e,t)=>{hD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hO(e,t){return new mO({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var gO=$(`ZodPipe`,(e,t)=>{gD.init(e,t),BD.init(e,t),e.in=t.in,e.out=t.out});function _O(e,t){return new gO({type:`pipe`,in:e,out:t})}var vO=$(`ZodReadonly`,(e,t)=>{vD.init(e,t),BD.init(e,t)});function yO(e){return new vO({type:`readonly`,innerType:e})}var bO=$(`ZodLazy`,(e,t)=>{bD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.getter()}),xO=$(`ZodCustom`,(e,t)=>{xD.init(e,t),BD.init(e,t)});function SO(e){let t=new RE({check:`custom`});return t._zod.check=e,t}function CO(e,t={}){return ND(xO,e,t)}function wO(e){let t=SO(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(EE(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(EE(r))}},e(n.value,n)));return t}var TO=`@ag-ui/client`;function EO(e){if(!e.metadata||!Object.prototype.hasOwnProperty.call(e.metadata,TO))return;let t=e.metadata?.[TO];if(!t||typeof t!=`object`||Array.isArray(t))return[];if(!Object.prototype.hasOwnProperty.call(t,`authoritativeActivityTypes`))return;let n=t.authoritativeActivityTypes;return n===null?null:Array.isArray(n)&&n.every(e=>typeof e==`string`)?n:[]}var DO=e=>{if(typeof structuredClone==`function`)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function OO(){return Qc()}function kO(e){return e instanceof TypeError&&/read[- ]?only|not extensible|cannot add property|cannot delete property|can't be deleted|unable to delete property|object is frozen|is not writable/i.test(e.message)}function AO(e){if(Object.freeze(e),typeof e==`object`&&e)for(let t of Object.values(e))typeof t==`object`&&t&&!Object.isFrozen(t)&&AO(t);return e}var jO=524288;function MO(e,t,n){let r=0,i=[e,t],a=new WeakSet;for(;i.length>0;){let e=i.pop();if(typeof e==`string`){if(r+=e.length,r>n)return!0}else if(typeof e==`object`&&e){if(a.has(e))continue;if(a.add(e),Array.isArray(e))for(let t=0;tn)return!0;i.push(e[o])}}}}return!1}async function NO(e,t,n,r){let i=typeof process<`u`&&!0,a=i&&!!{}.VITEST_WORKER_ID,o=i&&!!{}.VITEST_WORKER_ID,s=o&&!MO(t,n,jO),c=s?DO(t):t,l=s?DO(n):n,u=!1,d=!1,f;for(let t of e)try{s&&(AO(c),AO(l));let e=await r(t,c,l);if(e===void 0)continue;let n=!1;if(e.messages!==void 0&&e.messages!==c&&(c=DO(e.messages),u=!0,n=!0),e.state!==void 0&&e.state!==l&&(l=DO(e.state),d=!0,n=!0),s&&n&&MO(c,l,jO)&&(s=!1),f=e.stopPropagation,f===!0)break}catch(e){if(a&&e instanceof TypeError)throw e;s&&o&&kO(e)?console.error(`AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.`,e):console.error(`Subscriber error:`,e);continue}return{...u?{messages:Object.isFrozen(c)?DO(c):c}:{},...d?{state:Object.isFrozen(l)?DO(l):l}:{},...f===void 0?{}:{stopPropagation:f}}}function PO(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,n=e.lifecycle??!0,r=e.verbose??!1;return{enabled:t||n,events:t,lifecycle:n,verbose:r}}function FO(e){if(e instanceof IO)return e;if(e===!0)return new IO(PO(!0))}var IO=class{constructor(e){this.config=e}event(e,t,n,r){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof n==`string`?n:JSON.stringify(n)):console.debug(`[${e}] ${t}`,r??n))}lifecycle(e,t,n){this.config.lifecycle&&(n?console.debug(`[${e}] ${t}`,n):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function LO(e){return e.enabled?new IO(e):void 0}function RO(e,t,n){if(t){let r=e.find(e=>e.id===t);if(r?.role===`assistant`)return r;r&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${r.role}' message, not assistant — falling back to toolCallId`);let i={id:r?n:t,role:`assistant`,toolCalls:[]};return e.push(i),i}let r={id:n,role:`assistant`,toolCalls:[]};return e.push(r),r}function zO(e,t){return!e||t.metadata===void 0?!1:(e.metadata=il(e.metadata,DO(t.metadata)),!0)}var BO=(e,t,n,r,i)=>{let a=FO(i),o=DO(n.messages),s=DO(e.state),c={},l=[],u=new Set,d=e=>{let t=e.outcome?.type===`success`?e.outcome.pendingToolCallIds:void 0;return t!==void 0&&t.length>0?[...t]:l.filter(e=>!u.has(e))},f=e=>{e.messages!==void 0&&(o=e.messages,c.messages=e.messages),e.state!==void 0&&(s=e.state,c.state=e.state)},p=()=>{let e=DO(c);return c={},e.messages!==void 0||e.state!==void 0?Sd(e):Wu};return t.pipe(Nd(async t=>{let i=await NO(r,o,s,(r,i,a)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:a}));if(f(i),i.stopPropagation===!0?a?.event(`APPLY`,`Event dropped:`,t,{type:t.type,reason:`stopPropagation by subscriber`}):a?.event(`APPLY`,`Event applied:`,t,{type:t.type,subscribers:r.length}),i.stopPropagation===!0)return p();switch(t.type){case I.TEXT_MESSAGE_START:{let i=await NO(r,o,s,(r,i,a)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:e,role:n=`assistant`,name:r,subagentRunId:i}=t,a=o.find(t=>t.id===e);if(a?.role===`activity`)return console.warn(`TEXT_MESSAGE_START: Message '${e}' is an activity message — message ids must be unique across activity and text messages`),p();let s=a;if(!s){let t={id:e,role:n,content:``,...r!==void 0&&{name:r},...i!=null&&{subagentRunId:i}};o.push(t),s=t}let c=zO(s,t);(!a||c)&&f({messages:o})}return p()}case I.TEXT_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${i}'`),p();if(c.role===`activity`)return console.warn(`TEXT_MESSAGE_CONTENT: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),p();let l=await NO(r,o,s,(r,i,a)=>r.onTextMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,textMessageBuffer:typeof c.content==`string`?c.content:``}));return f(l),l.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,zO(c,t),f({messages:o})),p()}case I.TEXT_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${i}'`),p();if(a.role===`activity`)return console.warn(`TEXT_MESSAGE_END: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),p();let c=await NO(r,o,s,(r,i,o)=>r.onTextMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,textMessageBuffer:typeof a.content==`string`?a.content:``}));return f(c),c.stopPropagation!==!0&&zO(a,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),p()}case I.TOOL_CALL_START:{let i=await NO(r,o,s,(r,i,a)=>r.onToolCallStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{toolCallId:e,toolCallName:n,parentMessageId:r,subagentRunId:i}=t;l.includes(e)||l.push(e);let a=o.find(t=>t.toolCalls?.some(t=>t.id===e))?.toolCalls?.find(t=>t.id===e);if(a){let r=a.function.name!==n;return r&&(console.warn(`TOOL_CALL_START: tool call '${e}' already exists with name '${a.function.name}' — updating it to '${n}'`),a.function.name=n),(zO(a,t)||r)&&f({messages:o}),p()}let s=new Set(o.map(e=>e.id)),c=RO(o,r,e);!s.has(c.id)&&i!=null&&c.subagentRunId===void 0&&(c.subagentRunId=i),c.toolCalls??=[];let u={id:e,type:`function`,function:{name:n,arguments:``}};c.toolCalls.push(u),zO(u,t),f({messages:o})}return p()}case I.TOOL_CALL_ARGS:{let{toolCallId:i,delta:a}=t,c=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!c)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${i}'`),p();let l=c.toolCalls?.find(e=>e.id===i);if(!l)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),p();let u=await NO(r,o,s,(r,i,a)=>{let o=l.function.arguments,s=l.function.name,c={};try{c=Hd(o)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallBuffer:o,toolCallName:s,partialToolCallArgs:c})});return f(u),u.stopPropagation!==!0&&(l.function.arguments+=a,zO(l,t),f({messages:o})),p()}case I.TOOL_CALL_END:{let{toolCallId:i}=t,a=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!a)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${i}'`),p();let c=a.toolCalls?.find(e=>e.id===i);if(!c)return console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),p();let l=await NO(r,o,s,(r,i,a)=>{let o=c.function.arguments,s=c.function.name,l={};try{l=JSON.parse(o)}catch{}return r.onToolCallEndEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallName:s,toolCallArgs:l})});return f(l),l.stopPropagation!==!0&&zO(c,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewToolCall?.({toolCall:c,messages:o,state:s,agent:n,input:e})})),p()}case I.TOOL_CALL_RESULT:{let i=await NO(r,o,s,(r,i,a)=>r.onToolCallResultEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:i,toolCallId:a,content:c,role:l,subagentRunId:d}=t;u.add(a);let p={id:i,toolCallId:a,role:l||`tool`,content:c,...d!=null&&{subagentRunId:d}};zO(p,t);let m=o.findIndex(e=>e.role===`assistant`&&e.toolCalls?.some(e=>e.id===a));if(m===-1)o.push(p);else{let e=m+1;for(;e{t.onNewMessage?.({message:p,messages:o,state:s,agent:n,input:e})})),f({messages:o})}return p()}case I.STATE_SNAPSHOT:{let i=await NO(r,o,s,(r,i,a)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{snapshot:e}=t;s=e,f({state:s})}return p()}case I.STATE_DELTA:{let i=await NO(r,o,s,(r,i,a)=>r.onStateDeltaEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{delta:e}=t;try{s=Hl.applyPatch(s,e,!0,!1).newDocument,f({state:s})}catch(t){let n=t instanceof Error?t.message:String(t);console.warn(`Failed to apply state patch:\nCurrent state: ${JSON.stringify(s,null,2)}\nPatch operations: ${JSON.stringify(e,null,2)}\nError: ${n}`)}}return p()}case I.MESSAGES_SNAPSHOT:{let i=await NO(r,o,s,(r,i,a)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messages:e}=t,n=e.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}),r=new Map(n.map(e=>[e.id,e])),i=EO(t),a=n.some(e=>e.role===`activity`),s=n.some(e=>e.role===`reasoning`),c=e=>e.role===`activity`&&(i?!i.includes(e.activityType):i!==null&&!a)||e.role===`reasoning`&&!s;o=o.filter(e=>r.has(e.id)||c(e)).map(e=>r.get(e.id)??e);let l=new Set(o.map(e=>e.id));for(let e of n)l.has(e.id)||o.push(e);f({messages:o})}return p()}case I.ACTIVITY_SNAPSHOT:{let i=t,a=o.findIndex(e=>e.id===i.messageId),c=a>=0?o[a]:void 0,l=c?.role===`activity`?c:void 0,u=i.replace??!0,d=await NO(r,o,s,(t,r,a)=>t.onActivitySnapshotEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:l,existingMessage:c}));if(f(d),d.stopPropagation!==!0){let t={id:i.messageId,role:`activity`,activityType:i.activityType,content:DO(i.content),...i.subagentRunId!=null&&{subagentRunId:i.subagentRunId}},c,d;a===-1?(o.push(t),c=t,d=t):l?(u&&(o[a]={...l,activityType:i.activityType,content:DO(i.content),subagentRunId:i.subagentRunId},i.subagentRunId??delete o[a].subagentRunId),d=o[a]):u&&(o[a]=t,c=t,d=t),zO(d,i),f({messages:o}),c&&await Promise.all(r.map(t=>t.onNewMessage?.({message:c,messages:o,state:s,agent:n,input:e})))}return p()}case I.ACTIVITY_DELTA:{let i=t,a=o.findIndex(e=>e.id===i.messageId);if(a===-1)return p();let c=o[a];if(c.role!==`activity`)return console.warn(`ACTIVITY_DELTA: Message '${i.messageId}' is not an activity message`),p();let l=c,u=await NO(r,o,s,(t,r,a)=>t.onActivityDeltaEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:l}));if(f(u),u.stopPropagation!==!0)try{zO(l,i)&&f({messages:o});let e=DO(l.content??{}),t=Hl.applyPatch(e,i.patch??[],!0,!1).newDocument;o[a]={...l,content:DO(t),activityType:i.activityType},f({messages:o})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`Failed to apply activity patch for '${i.messageId}': ${t}`)}return p()}case I.RAW:return f(await NO(r,o,s,(r,i,a)=>r.onRawEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.CUSTOM:return f(await NO(r,o,s,(r,i,a)=>r.onCustomEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.RUN_STARTED:{let i=await NO(r,o,s,(r,i,a)=>r.onRunStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),l=[],u=new Set,i.stopPropagation!==!0){let e=t;if(e.input?.messages){for(let t of e.input.messages){let e=t;if(t.subagentRunId===null){let n={...t};delete n.subagentRunId,e=n}o.find(t=>t.id===e.id)||o.push(e)}f({messages:o})}}return p()}case I.RUN_FINISHED:{let i=t,a=i.outcome?.type===`interrupt`?{event:i,outcome:`interrupt`,interrupts:i.outcome.interrupts}:i.outcome?.type===`cancelled`?{event:i,outcome:`cancelled`}:{event:i,outcome:`success`,result:i.result,pendingToolCallIds:d(i)},c=await NO(r,o,s,(t,r,i)=>t.onRunFinishedEvent?.({...a,messages:r,state:i,agent:n,input:e}));return f(c),c.stopPropagation!==!0&&(n.pendingInterrupts=a.outcome===`interrupt`?a.interrupts.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}):[]),p()}case I.RUN_ERROR:return f(await NO(r,o,s,(r,i,a)=>r.onRunErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.STEP_STARTED:return f(await NO(r,o,s,(r,i,a)=>r.onStepStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.STEP_FINISHED:return f(await NO(r,o,s,(r,i,a)=>r.onStepFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.TEXT_MESSAGE_CHUNK:throw Error(`TEXT_MESSAGE_CHUNK must be transformed before being applied`);case I.TOOL_CALL_CHUNK:throw Error(`TOOL_CALL_CHUNK must be transformed before being applied`);case I.REASONING_START:return f(await NO(r,o,s,(r,i,a)=>r.onReasoningStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.REASONING_MESSAGE_START:{let i=await NO(r,o,s,(r,i,a)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:e,subagentRunId:n}=t,r=o.find(t=>t.id===e);if(r?.role===`activity`)return console.warn(`REASONING_MESSAGE_START: Message '${e}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let i=r;if(!i){let t={id:e,role:`reasoning`,content:``,...n!=null&&{subagentRunId:n}};o.push(t),i=t}let a=zO(i,t);(!r||a)&&f({messages:o})}return p()}case I.REASONING_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${i}'`),p();if(c.role===`activity`)return console.warn(`REASONING_MESSAGE_CONTENT: Message '${i}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let l=await NO(r,o,s,(r,i,a)=>r.onReasoningMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,reasoningMessageBuffer:typeof c.content==`string`?c.content:``}));return f(l),l.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,zO(c,t),f({messages:o})),p()}case I.REASONING_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${i}'`),p();if(a.role===`activity`)return console.warn(`REASONING_MESSAGE_END: Message '${i}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let c=await NO(r,o,s,(r,i,o)=>r.onReasoningMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,reasoningMessageBuffer:typeof a.content==`string`?a.content:``}));return f(c),c.stopPropagation!==!0&&zO(a,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),p()}case I.REASONING_MESSAGE_CHUNK:throw Error(`REASONING_MESSAGE_CHUNK must be transformed before being applied`);case I.REASONING_END:return f(await NO(r,o,s,(r,i,a)=>r.onReasoningEndEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:a,encryptedValue:l}=t,u=await NO(r,o,s,(r,i,a)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(u),u.stopPropagation!==!0){let e=!1;if(i===`tool-call`){for(let t of o)if(t.role===`assistant`&&t.toolCalls){let n=t.toolCalls.find(e=>e.id===a);if(n){n.encryptedValue=l,e=!0;break}}}else{let t=o.find(e=>e.id===a);t?.role!==`activity`&&t&&(t.encryptedValue=l,e=!0)}e&&(c.messages=o)}return p()}case I.SUBAGENT_STARTED:return f(await NO(r,o,s,(r,i,a)=>r.onSubagentStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.SUBAGENT_FINISHED:return f(await NO(r,o,s,(r,i,a)=>r.onSubagentFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.SUBAGENT_ERROR:return f(await NO(r,o,s,(r,i,a)=>r.onSubagentErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p()}return t.type,p()}),Od(),r.length>0?Id({}):e=>e)};function VO(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][compat] Converting deprecated ${e} to ${t}. The old shape leaves the protocol after its shim window — see the repo-root DEPRECATIONS.md. Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)}var HO=e=>t=>{let n=FO(e),r=new Set,i=new Set,a=new Set,o=new Set,s={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},c=!1,l=!1,u=!1,d=new Map,f=e=>{let t=d.get(e);return t||(t=new Map,d.set(e,t)),t},p=()=>{for(let e of d.values())if(e.size>0)return!0;return!1},m=new Map,h=new Set,g=!1,_=!1,v=()=>{_=!1,r.clear(),i.clear(),a.clear(),o.clear(),s.message.clear(),s.toolCall.clear(),s.activity.clear(),s.reasoning.clear(),d.clear(),m.clear(),h.clear(),c=!1,l=!1,g=!0},y=(e,t)=>{let n=e??[];if(Array.isArray(n))for(let e of n){if(!e||typeof e.id!=`string`)continue;if(e.subagentRunId===null)return new L(`Cannot send a message (id '${e.id}') with 'subagentRunId: null'. The field is optional — omit it entirely.`);let n=e.role===`reasoning`?s.reasoning:e.role===`activity`?s.activity:s.message;(t||!n.has(e.id))&&n.set(e.id,{subagentRunId:e.subagentRunId});for(let n of e.toolCalls??[])n&&typeof n.id==`string`&&(t||!s.toolCall.has(n.id))&&s.toolCall.set(n.id,{subagentRunId:e.subagentRunId??void 0})}},b=(e,t,n,r,i)=>{if(t!==void 0&&n&&n.subagentRunId!==t)return new L(`Cannot send '${e}': subagentRunId '${t}' does not match the ${r} '${i}' opener's subagent '${n.subagentRunId??`(the parent agent)`}'.`)};return t.pipe(Dd(e=>{let t=e.type;if(n?.event(`VERIFY`,`Event:`,e,{type:e.type}),l&&t!==I.RUN_STARTED)return z(()=>new L(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(c&&t!==I.RUN_ERROR&&t!==I.RUN_STARTED)return z(()=>new L(`Cannot send event type '${t}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(!u){if(u=!0,t!==I.RUN_STARTED&&t!==I.RUN_ERROR)return z(()=>new L(`First event must be 'RUN_STARTED'`))}else if(t===I.RUN_STARTED){if(g&&!c&&!l)return z(()=>new L(`Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run.`));(c||l)&&v()}if(e.subagentRunId===null){_||(_=!0,VO(`subagentRunId: null`,`an absent field`));let{subagentRunId:t,...n}=e;e=n}if(t===I.SUBAGENT_STARTED||t===I.SUBAGENT_FINISHED||t===I.SUBAGENT_ERROR){let n=t===I.SUBAGENT_STARTED?[`description`,`parentSubagentRunId`,`parentToolCallId`,`parentMessageId`]:t===I.SUBAGENT_FINISHED?[`outcome`]:[`code`];for(let r of n)if(e[r]===null)return z(()=>new L(`Cannot send '${t}' with '${r}: null'. The field is optional — omit it entirely.`));let r=e.outcome;if(r!=null&&r.type!==`success`&&r.type!==`suspended`)return z(()=>new L(`Cannot send '${t}' with outcome type '${String(r.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(r&&r.interruptIds===null)return z(()=>new L(`Cannot send '${t}' with 'outcome.interruptIds: null'. The field is optional — omit it entirely.`));if(r&&Array.isArray(r.interruptIds)&&r.interruptIds.some(e=>typeof e!=`string`))return z(()=>new L(`Cannot send '${t}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(t===I.RUN_FINISHED){let t=e.outcome;if(t?.type===`interrupt`&&Array.isArray(t.interrupts)){for(let e of t.interrupts)if(e&&e.subagentRunId===null)return z(()=>new L(`Cannot send 'RUN_FINISHED' with an interrupt (id '${e.id}') carrying 'subagentRunId: null'. The field is optional — omit it entirely.`))}}switch(t){case I.TEXT_MESSAGE_START:{let n=e.messageId;if(r.has(n))return z(()=>new L(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${n}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let i=s.message.get(n);if(i){let r=b(t,e.subagentRunId,i,`message`,n);if(r)return z(()=>r)}return r.add(n),i||s.message.set(n,{subagentRunId:e.subagentRunId}),Sd(e)}case I.TEXT_MESSAGE_CONTENT:{let n=e.messageId;if(!r.has(n))return z(()=>new L(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${n}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let i=b(t,e.subagentRunId,s.message.get(n),`message`,n);return i?z(()=>i):Sd(e)}case I.TEXT_MESSAGE_END:{let n=e.messageId;if(!r.has(n))return z(()=>new L(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${n}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let i=b(t,e.subagentRunId,s.message.get(n),`message`,n);return i?z(()=>i):(r.delete(n),Sd(e))}case I.TOOL_CALL_START:{let n=e.toolCallId;if(i.has(n))return z(()=>new L(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${n}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let r=e.parentMessageId,a=e.subagentRunId,o;if(r!==void 0){let e=s.message.get(r);if(e){if(a!==void 0&&a!==e.subagentRunId)return z(()=>new L(`Cannot send 'TOOL_CALL_START': subagentRunId '${a}' does not match its parent message '${r}' owner '${e.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`));o=e}}let c=s.toolCall.get(n);if(c){let e=b(t,a,c,`tool call`,n);if(e)return z(()=>e);if(a===void 0&&o&&o.subagentRunId!==c.subagentRunId)return z(()=>new L(`Cannot send 'TOOL_CALL_START': tool call '${n}' is owned by '${c.subagentRunId??`(the parent agent)`}' but its parent message '${r}' is owned by '${o.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`))}return i.add(n),c||s.toolCall.set(n,a===void 0?o??{subagentRunId:void 0}:{subagentRunId:a}),Sd(e)}case I.TOOL_CALL_ARGS:{let n=e.toolCallId;if(!i.has(n))return z(()=>new L(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${n}'. Start a tool call with 'TOOL_CALL_START' first.`));let r=b(t,e.subagentRunId,s.toolCall.get(n),`tool call`,n);return r?z(()=>r):Sd(e)}case I.TOOL_CALL_END:{let n=e.toolCallId;if(!i.has(n))return z(()=>new L(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${n}'. A 'TOOL_CALL_START' event must be sent first.`));let r=b(t,e.subagentRunId,s.toolCall.get(n),`tool call`,n);return r?z(()=>r):(i.delete(n),Sd(e))}case I.STEP_STARTED:{let t=e.stepName,n=e.subagentRunId;return f(n).has(t)?z(()=>new L(`Step "${t}" is already active for 'STEP_STARTED'${n===void 0?``:` in subagent '${n}'`}`)):(f(n).set(t,!0),Sd(e))}case I.STEP_FINISHED:{let t=e.stepName,n=e.subagentRunId;if(!f(n).has(t)){let e,r=!1;for(let[i,a]of d)if(i!==n&&a.has(t)){e=i,r=!0;break}return z(r?()=>new L(`Cannot send 'STEP_FINISHED' for step "${t}" attributed to ${n===void 0?`the parent agent`:`subagent '${n}'`}: that step is open under ${e===void 0?`the parent agent`:`subagent '${e}'`}. A step must be finished by whoever started it.`):()=>new L(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}return f(n).delete(t),Sd(e)}case I.ACTIVITY_SNAPSHOT:{let t=e.messageId;return(!s.activity.has(t)||e.replace!==!1)&&s.activity.set(t,{subagentRunId:e.subagentRunId}),Sd(e)}case I.TOOL_CALL_RESULT:{let t=e.messageId;return typeof t==`string`&&s.message.set(t,{subagentRunId:e.subagentRunId}),Sd(e)}case I.REASONING_START:case I.REASONING_MESSAGE_START:{let n=e.messageId,r=t===I.REASONING_START,i=r?a:o;if(i.has(n))return z(()=>new L(r?`Cannot send 'REASONING_START' event: A reasoning span with ID '${n}' is already in progress. Complete it with 'REASONING_END' first.`:`Cannot send 'REASONING_MESSAGE_START' event: A reasoning message with ID '${n}' is already in progress. Complete it with 'REASONING_MESSAGE_END' first.`));let c=s.reasoning.get(n);if(c){let r=b(t,e.subagentRunId,c,`reasoning message`,n);if(r)return z(()=>r)}return i.add(n),c||s.reasoning.set(n,{subagentRunId:e.subagentRunId}),Sd(e)}case I.REASONING_MESSAGE_CONTENT:case I.REASONING_MESSAGE_END:case I.REASONING_END:{let n=e.messageId,r=t===I.REASONING_END,i=r?a:o;if(!i.has(n))return z(()=>new L(r?`Cannot send 'REASONING_END' event: No active reasoning span found with ID '${n}'. A 'REASONING_START' event must be sent first.`:`Cannot send '${t}' event: No active reasoning message found with ID '${n}'. Start a reasoning message with 'REASONING_MESSAGE_START' first.`));let c=b(t,e.subagentRunId,s.reasoning.get(n),`reasoning message`,n);return c?z(()=>c):((t===I.REASONING_END||t===I.REASONING_MESSAGE_END)&&i.delete(n),Sd(e))}case I.REASONING_ENCRYPTED_VALUE:{let n=e.entityId,r=e.subtype,i=r===`tool-call`?s.toolCall.get(n):r===`message`?s.message.get(n)??s.reasoning.get(n):s.reasoning.get(n),a=r===`tool-call`?`tool call`:r===`message`?`message`:`reasoning message`,o=b(t,e.subagentRunId,i,a,n);return o?z(()=>o):Sd(e)}case I.ACTIVITY_DELTA:{let n=e.messageId,r=b(t,e.subagentRunId,s.activity.get(n),`activity`,n);return r?z(()=>r):Sd(e)}case I.SUBAGENT_STARTED:{if(typeof e.subagentRunId!=`string`)return z(()=>new L(`Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'.`));if(typeof e.name!=`string`)return z(()=>new L(`Cannot send 'SUBAGENT_STARTED' without a 'name'.`));let t=e.subagentRunId,n=e.parentSubagentRunId;return m.has(t)?z(()=>new L(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):h.has(t)?z(()=>new L(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):n!==void 0&&!m.has(n)&&!h.has(n)?z(()=>new L(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${n}' has not been started in this run.`)):(m.set(t,!0),Sd(e))}case I.SUBAGENT_FINISHED:case I.SUBAGENT_ERROR:{if(typeof e.subagentRunId!=`string`)return z(()=>new L(`Cannot send '${t}' without a 'subagentRunId'.`));if(t===I.SUBAGENT_ERROR&&typeof e.message!=`string`)return z(()=>new L(`Cannot send 'SUBAGENT_ERROR' without a 'message'.`));let n=e.subagentRunId;return m.has(n)?(m.delete(n),h.add(n),Sd(e)):z(()=>new L(`Cannot send '${t}': no active subagent found with ID '${n}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case I.MESSAGES_SNAPSHOT:{let t=y(e.messages,!0);if(t)return z(()=>t)}return Sd(e);case I.RUN_STARTED:g=!0;{let t=y((e.input??{}).messages,!1);if(t)return z(()=>t)}return Sd(e);case I.RUN_FINISHED:if(p()){let e=[];for(let[t,n]of d)for(let r of n.keys())e.push(t===void 0?r:`${r} (subagent '${t}')`);let t=e.join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while steps are still active: ${t}`))}if(r.size>0){let e=Array.from(r.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(o.size>0){let e=Array.from(o.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while reasoning messages are still active: ${e}`))}if(a.size>0){let e=Array.from(a.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while reasoning spans are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}if(m.size>0){let e=Array.from(m.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while subagents are still active: ${e}`))}return c=!0,Sd(e);case I.RUN_ERROR:return l=!0,Sd(e);case I.CUSTOM:return Sd(e);default:return Sd(e)}}))},UO=function(e){return e.HEADERS=`headers`,e.DATA=`data`,e}({}),WO=e=>Ad(()=>xd(e())).pipe(Rd(e=>{if(!e.ok){let t=e.headers.get(`content-type`)||``;return xd(e.text()).pipe(Dd(n=>{let r=n;if(t.includes(`application/json`))try{r=JSON.parse(n)}catch{}let i=Error(`HTTP ${e.status}: ${typeof r==`string`?r:JSON.stringify(r)}`);return i.status=e.status,i.payload=r,z(()=>i)}))}let t={type:UO.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new ju(e=>{let r=!1;return e.next(t),(async()=>{try{for(;!e.closed;){let{done:t,value:i}=await n.read();if(t){r=!0;break}let a={type:UO.DATA,data:i};e.next(a)}e.complete()}catch(t){r=!0,e.error(t)}})(),()=>{r||n.cancel().catch(e=>{e?.name!==`AbortError`&&console.warn(`Failed to cancel HTTP response stream:`,e)})}}):z(()=>Error(`Failed to getReader() from response`))})),GO=10485760,KO=(e,t)=>{let n=FO(t),r=new Bu,i=new TextDecoder(`utf-8`,{fatal:!1}),a=``;e.subscribe({next:e=>{if(e.type!==UO.HEADERS&&e.type===UO.DATA&&e.data){let t=i.decode(e.data,{stream:!0});a+=t;let n=a.split(/\n\n/);a=n.pop()||``;for(let e of n)o(e);if(a.length>GO){r.error(Error(`SSE buffer size exceeded maximum limit of ${GO/1048576} MB`));return}}},error:e=>r.error(e),complete:()=>{a&&(a+=i.decode(),o(a)),r.complete()}});function o(e){let t=e.split(` + path: iss.path ? [${cE(e)}, ...iss.path] : [${cE(e)}] + })));`),t.write(`newResult[${cE(e)}] = ${n}.value`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},i,a=uE,o=!$T.jitless,s=o&&dE.value,c=t.catchall,l;e._zod.parse=(u,d)=>{l??=n.value;let f=u.value;if(!a(f))return u.issues.push({expected:`object`,code:`invalid_type`,input:f,inst:e}),u;let p=[];if(o&&s&&d?.async===!1&&d.jitless!==!0)i||=r(t.shape),u=i(u,d);else{u.value={};let e=l.shape;for(let t of l.keys){let n=e[t],r=n._zod.run({value:f[t],issues:[]},d),i=n._zod.optin===`optional`&&n._zod.optout===`optional`;r instanceof Promise?p.push(r.then(e=>i?eD(e,u,t,f):$E(e,u,t))):i?eD(r,u,t,f):$E(r,u,t)}}if(!c)return p.length?Promise.all(p).then(()=>u):u;let m=[],h=l.keySet,g=c._zod,_=g.def.type;for(let e of Object.keys(f)){if(h.has(e))continue;if(_===`never`){m.push(e);continue}let t=g.run({value:f[e],issues:[]},d);t instanceof Promise?p.push(t.then(t=>$E(t,u,e))):$E(t,u,e)}return m.length&&u.issues.push({code:`unrecognized_keys`,keys:m,input:f,inst:e}),p.length?Promise.all(p).then(()=>u):u}});function nD(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>DE(e,r,eE())))}),t}var rD=$(`$ZodUnion`,(e,t)=>{JE.init(e,t),oE(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),oE(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),oE(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),oE(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=>aE(e.source)).join(`|`)})$`)}}),e._zod.parse=(n,r)=>{let i=!1,a=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},r);if(t instanceof Promise)a.push(t),i=!0;else{if(t.issues.length===0)return t;a.push(t)}}return i?Promise.all(a).then(t=>nD(t,n,e,r)):nD(a,n,e,r)}}),iD=$(`$ZodIntersection`,(e,t)=>{JE.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])=>oD(e,t,n)):oD(e,i,a)}});function aD(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(fE(e)&&fE(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=aD(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{JE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!fE(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){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(...TE(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...TE(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}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(s.issues.length){n.issues.push({origin:`record`,code:`invalid_key`,issues:s.issues.map(e=>DE(e,r,eE())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;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(...TE(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...TE(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),cD=$(`$ZodEnum`,(e,t)=>{JE.init(e,t);let n=tE(t.entries);e._zod.values=new Set(n),e._zod.pattern=RegExp(`^(${n.filter(e=>pE.has(typeof e)).map(e=>typeof e==`string`?mE(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,r)=>{let i=t.value;return e._zod.values.has(i)||t.issues.push({code:`invalid_value`,values:n,input:i,inst:e}),t}}),lD=$(`$ZodLiteral`,(e,t)=>{JE.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?mE(e):e?e.toString():String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),uD=$(`$ZodTransform`,(e,t)=>{JE.init(e,t),e._zod.parse=(e,n)=>{let r=t.transform(e.value,e);if(n.async)return(r instanceof Promise?r:Promise.resolve(r)).then(t=>(e.value=t,e));if(r instanceof Promise)throw new QT;return e.value=r,e}}),dD=$(`$ZodOptional`,(e,t)=>{JE.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,oE(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),oE(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${aE(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>t.innerType._zod.optin===`optional`?t.innerType._zod.run(e,n):e.value===void 0?e:t.innerType._zod.run(e,n)}),fD=$(`$ZodNullable`,(e,t)=>{JE.init(e,t),oE(e._zod,`optin`,()=>t.innerType._zod.optin),oE(e._zod,`optout`,()=>t.innerType._zod.optout),oE(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${aE(e.source)}|null)$`):void 0}),oE(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)}),pD=$(`$ZodDefault`,(e,t)=>{JE.init(e,t),e._zod.optin=`optional`,oE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(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=>mD(e,t)):mD(r,t)}});function mD(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var hD=$(`$ZodPrefault`,(e,t)=>{JE.init(e,t),e._zod.optin=`optional`,oE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),gD=$(`$ZodNonOptional`,(e,t)=>{JE.init(e,t),oE(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=>_D(t,e)):_D(i,e)}});function _D(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 vD=$(`$ZodCatch`,(e,t)=>{JE.init(e,t),e._zod.optin=`optional`,oE(e._zod,`optout`,()=>t.innerType._zod.optout),oE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(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=>DE(e,n,eE()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>DE(e,n,eE()))},input:e.value}),e.issues=[]),e)}}),yD=$(`$ZodPipe`,(e,t)=>{JE.init(e,t),oE(e._zod,`values`,()=>t.in._zod.values),oE(e._zod,`optin`,()=>t.in._zod.optin),oE(e._zod,`optout`,()=>t.out._zod.optout),e._zod.parse=(e,n)=>{let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>bD(e,t,n)):bD(r,t,n)}});function bD(e,t,n){return wE(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}var xD=$(`$ZodReadonly`,(e,t)=>{JE.init(e,t),oE(e._zod,`propValues`,()=>t.innerType._zod.propValues),oE(e._zod,`values`,()=>t.innerType._zod.values),oE(e._zod,`optin`,()=>t.innerType._zod.optin),oE(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(SD):SD(r)}});function SD(e){return e.value=Object.freeze(e.value),e}var CD=$(`$ZodLazy`,(e,t)=>{JE.init(e,t),oE(e._zod,`innerType`,()=>t.getter()),oE(e._zod,`pattern`,()=>e._zod.innerType._zod.pattern),oE(e._zod,`propValues`,()=>e._zod.innerType._zod.propValues),oE(e._zod,`optin`,()=>e._zod.innerType._zod.optin),oE(e._zod,`optout`,()=>e._zod.innerType._zod.optout),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),wD=$(`$ZodCustom`,(e,t)=>{VE.init(e,t),JE.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=>TD(t,n,r,e));TD(i,n,r,e)}});function TD(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(kE(e))}}var ED=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,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)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function DD(){return new ED}var OD=DD();function kD(e){return new e({type:`unknown`})}function AD(e,t){return new e({type:`never`,...gE(t)})}function jD(e,t){return new HE({check:`max_length`,...gE(t),maximum:e})}function MD(e,t){return new UE({check:`min_length`,...gE(t),minimum:e})}function ND(e,t){return new WE({check:`length_equals`,...gE(t),length:e})}function PD(e){return new GE({check:`overwrite`,tx:e})}function FD(e,t,n){return new e({type:`array`,element:t,...gE(n)})}function ID(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...gE(n)})}var LD=(e,t)=>{jE.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>PE(e,t)},flatten:{value:t=>NE(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,LD);var RD=$(`ZodError`,LD,{Parent:Error}),zD=FE(RD),BD=IE(RD),VD=LE(RD),HD=zE(RD),UD=$(`ZodType`,(e,t)=>(JE.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),e.clone=(t,n)=>hE(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>zD(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>VD(e,t,n),e.parseAsync=async(t,n)=>BD(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>HD(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(EO(t,n)),e.superRefine=t=>e.check(DO(t)),e.overwrite=t=>e.check(PD(t)),e.optional=()=>cO(e),e.nullable=()=>uO(e),e.nullish=()=>cO(uO(e)),e.nonoptional=t=>gO(e,t),e.array=()=>YD(e),e.or=t=>QD([e,t]),e.and=t=>eO(e,t),e.transform=t=>bO(e,oO(t)),e.default=t=>fO(e,t),e.prefault=t=>mO(e,t),e.catch=t=>vO(e,t),e.pipe=t=>bO(e,t),e.readonly=()=>SO(e),e.describe=t=>{let n=e.clone();return OD.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return OD.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return OD.get(e);let n=e.clone();return OD.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),WD=$(`ZodUnknown`,(e,t)=>{YE.init(e,t),UD.init(e,t)});function GD(){return kD(WD)}var KD=$(`ZodNever`,(e,t)=>{XE.init(e,t),UD.init(e,t)});function qD(e){return AD(KD,e)}var JD=$(`ZodArray`,(e,t)=>{QE.init(e,t),UD.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(MD(t,n)),e.nonempty=t=>e.check(MD(1,t)),e.max=(t,n)=>e.check(jD(t,n)),e.length=(t,n)=>e.check(ND(t,n)),e.unwrap=()=>e.element});function YD(e,t){return FD(JD,e,t)}var XD=$(`ZodObject`,(e,t)=>{tD.init(e,t),UD.init(e,t),oE(e,`shape`,()=>t.shape),e.keyof=()=>rO(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:GD()}),e.loose=()=>e.clone({...e._zod.def,catchall:GD()}),e.strict=()=>e.clone({...e._zod.def,catchall:qD()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>bE(e,t),e.merge=t=>xE(e,t),e.pick=t=>vE(e,t),e.omit=t=>yE(e,t),e.partial=(...t)=>SE(sO,e,t[0]),e.required=(...t)=>CE(hO,e,t[0])}),ZD=$(`ZodUnion`,(e,t)=>{rD.init(e,t),UD.init(e,t),e.options=t.options});function QD(e,t){return new ZD({type:`union`,options:e,...gE(t)})}var $D=$(`ZodIntersection`,(e,t)=>{iD.init(e,t),UD.init(e,t)});function eO(e,t){return new $D({type:`intersection`,left:e,right:t})}var tO=$(`ZodRecord`,(e,t)=>{sD.init(e,t),UD.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType}),nO=$(`ZodEnum`,(e,t)=>{cD.init(e,t),UD.init(e,t),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 nO({...t,checks:[],...gE(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 nO({...t,checks:[],...gE(r),entries:i})}});function rO(e,t){return new nO({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...gE(t)})}var iO=$(`ZodLiteral`,(e,t)=>{lD.init(e,t),UD.init(e,t),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]}})}),aO=$(`ZodTransform`,(e,t)=>{uD.init(e,t),UD.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=r=>{if(typeof r==`string`)n.issues.push(kE(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,t.continue??=!0,n.issues.push(kE(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function oO(e){return new aO({type:`transform`,transform:e})}var sO=$(`ZodOptional`,(e,t)=>{dD.init(e,t),UD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function cO(e){return new sO({type:`optional`,innerType:e})}var lO=$(`ZodNullable`,(e,t)=>{fD.init(e,t),UD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function uO(e){return new lO({type:`nullable`,innerType:e})}var dO=$(`ZodDefault`,(e,t)=>{pD.init(e,t),UD.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fO(e,t){return new dO({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}var pO=$(`ZodPrefault`,(e,t)=>{hD.init(e,t),UD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function mO(e,t){return new pO({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}var hO=$(`ZodNonOptional`,(e,t)=>{gD.init(e,t),UD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function gO(e,t){return new hO({type:`nonoptional`,innerType:e,...gE(t)})}var _O=$(`ZodCatch`,(e,t)=>{vD.init(e,t),UD.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vO(e,t){return new _O({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var yO=$(`ZodPipe`,(e,t)=>{yD.init(e,t),UD.init(e,t),e.in=t.in,e.out=t.out});function bO(e,t){return new yO({type:`pipe`,in:e,out:t})}var xO=$(`ZodReadonly`,(e,t)=>{xD.init(e,t),UD.init(e,t)});function SO(e){return new xO({type:`readonly`,innerType:e})}var CO=$(`ZodLazy`,(e,t)=>{CD.init(e,t),UD.init(e,t),e.unwrap=()=>e._zod.def.getter()}),wO=$(`ZodCustom`,(e,t)=>{wD.init(e,t),UD.init(e,t)});function TO(e){let t=new VE({check:`custom`});return t._zod.check=e,t}function EO(e,t={}){return ID(wO,e,t)}function DO(e){let t=TO(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(kE(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(kE(r))}},e(n.value,n)));return t}var OO=`@ag-ui/client`;function kO(e){if(!e.metadata||!Object.prototype.hasOwnProperty.call(e.metadata,OO))return;let t=e.metadata?.[OO];if(!t||typeof t!=`object`||Array.isArray(t))return[];if(!Object.prototype.hasOwnProperty.call(t,`authoritativeActivityTypes`))return;let n=t.authoritativeActivityTypes;return n===null?null:Array.isArray(n)&&n.every(e=>typeof e==`string`)?n:[]}var AO=e=>{if(typeof structuredClone==`function`)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function jO(){return Qc()}function MO(e){return e instanceof TypeError&&/read[- ]?only|not extensible|cannot add property|cannot delete property|can't be deleted|unable to delete property|object is frozen|is not writable/i.test(e.message)}function NO(e){if(Object.freeze(e),typeof e==`object`&&e)for(let t of Object.values(e))typeof t==`object`&&t&&!Object.isFrozen(t)&&NO(t);return e}var PO=524288;function FO(e,t,n){let r=0,i=[e,t],a=new WeakSet;for(;i.length>0;){let e=i.pop();if(typeof e==`string`){if(r+=e.length,r>n)return!0}else if(typeof e==`object`&&e){if(a.has(e))continue;if(a.add(e),Array.isArray(e))for(let t=0;tn)return!0;i.push(e[o])}}}}return!1}async function IO(e,t,n,r){let i=typeof process<`u`&&!0,a=i&&!!{}.VITEST_WORKER_ID,o=i&&!!{}.VITEST_WORKER_ID,s=o&&!FO(t,n,PO),c=s?AO(t):t,l=s?AO(n):n,u=!1,d=!1,f;for(let t of e)try{s&&(NO(c),NO(l));let e=await r(t,c,l);if(e===void 0)continue;let n=!1;if(e.messages!==void 0&&e.messages!==c&&(c=AO(e.messages),u=!0,n=!0),e.state!==void 0&&e.state!==l&&(l=AO(e.state),d=!0,n=!0),s&&n&&FO(c,l,PO)&&(s=!1),f=e.stopPropagation,f===!0)break}catch(e){if(a&&e instanceof TypeError)throw e;s&&o&&MO(e)?console.error(`AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.`,e):console.error(`Subscriber error:`,e);continue}return{...u?{messages:Object.isFrozen(c)?AO(c):c}:{},...d?{state:Object.isFrozen(l)?AO(l):l}:{},...f===void 0?{}:{stopPropagation:f}}}function LO(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,n=e.lifecycle??!0,r=e.verbose??!1;return{enabled:t||n,events:t,lifecycle:n,verbose:r}}function RO(e){if(e instanceof zO)return e;if(e===!0)return new zO(LO(!0))}var zO=class{constructor(e){this.config=e}event(e,t,n,r){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof n==`string`?n:JSON.stringify(n)):console.debug(`[${e}] ${t}`,r??n))}lifecycle(e,t,n){this.config.lifecycle&&(n?console.debug(`[${e}] ${t}`,n):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function BO(e){return e.enabled?new zO(e):void 0}function VO(e,t,n){if(t){let r=e.find(e=>e.id===t);if(r?.role===`assistant`)return r;r&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${r.role}' message, not assistant — falling back to toolCallId`);let i={id:r?n:t,role:`assistant`,toolCalls:[]};return e.push(i),i}let r={id:n,role:`assistant`,toolCalls:[]};return e.push(r),r}function HO(e,t){return!e||t.metadata===void 0?!1:(e.metadata=il(e.metadata,AO(t.metadata)),!0)}var UO=(e,t,n,r,i)=>{let a=RO(i),o=AO(n.messages),s=AO(e.state),c={},l=[],u=new Set,d=e=>{let t=e.outcome?.type===`success`?e.outcome.pendingToolCallIds:void 0;return t!==void 0&&t.length>0?[...t]:l.filter(e=>!u.has(e))},f=e=>{e.messages!==void 0&&(o=e.messages,c.messages=e.messages),e.state!==void 0&&(s=e.state,c.state=e.state)},p=()=>{let e=AO(c);return c={},e.messages!==void 0||e.state!==void 0?Sd(e):Wu};return t.pipe(Nd(async t=>{let i=await IO(r,o,s,(r,i,a)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:a}));if(f(i),i.stopPropagation===!0?a?.event(`APPLY`,`Event dropped:`,t,{type:t.type,reason:`stopPropagation by subscriber`}):a?.event(`APPLY`,`Event applied:`,t,{type:t.type,subscribers:r.length}),i.stopPropagation===!0)return p();switch(t.type){case I.TEXT_MESSAGE_START:{let i=await IO(r,o,s,(r,i,a)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:e,role:n=`assistant`,name:r,subagentRunId:i}=t,a=o.find(t=>t.id===e);if(a?.role===`activity`)return console.warn(`TEXT_MESSAGE_START: Message '${e}' is an activity message — message ids must be unique across activity and text messages`),p();let s=a;if(!s){let t={id:e,role:n,content:``,...r!==void 0&&{name:r},...i!=null&&{subagentRunId:i}};o.push(t),s=t}let c=HO(s,t);(!a||c)&&f({messages:o})}return p()}case I.TEXT_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${i}'`),p();if(c.role===`activity`)return console.warn(`TEXT_MESSAGE_CONTENT: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),p();let l=await IO(r,o,s,(r,i,a)=>r.onTextMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,textMessageBuffer:typeof c.content==`string`?c.content:``}));return f(l),l.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,HO(c,t),f({messages:o})),p()}case I.TEXT_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${i}'`),p();if(a.role===`activity`)return console.warn(`TEXT_MESSAGE_END: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),p();let c=await IO(r,o,s,(r,i,o)=>r.onTextMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,textMessageBuffer:typeof a.content==`string`?a.content:``}));return f(c),c.stopPropagation!==!0&&HO(a,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),p()}case I.TOOL_CALL_START:{let i=await IO(r,o,s,(r,i,a)=>r.onToolCallStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{toolCallId:e,toolCallName:n,parentMessageId:r,subagentRunId:i}=t;l.includes(e)||l.push(e);let a=o.find(t=>t.toolCalls?.some(t=>t.id===e))?.toolCalls?.find(t=>t.id===e);if(a){let r=a.function.name!==n;return r&&(console.warn(`TOOL_CALL_START: tool call '${e}' already exists with name '${a.function.name}' — updating it to '${n}'`),a.function.name=n),(HO(a,t)||r)&&f({messages:o}),p()}let s=new Set(o.map(e=>e.id)),c=VO(o,r,e);!s.has(c.id)&&i!=null&&c.subagentRunId===void 0&&(c.subagentRunId=i),c.toolCalls??=[];let u={id:e,type:`function`,function:{name:n,arguments:``}};c.toolCalls.push(u),HO(u,t),f({messages:o})}return p()}case I.TOOL_CALL_ARGS:{let{toolCallId:i,delta:a}=t,c=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!c)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${i}'`),p();let l=c.toolCalls?.find(e=>e.id===i);if(!l)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),p();let u=await IO(r,o,s,(r,i,a)=>{let o=l.function.arguments,s=l.function.name,c={};try{c=Hd(o)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallBuffer:o,toolCallName:s,partialToolCallArgs:c})});return f(u),u.stopPropagation!==!0&&(l.function.arguments+=a,HO(l,t),f({messages:o})),p()}case I.TOOL_CALL_END:{let{toolCallId:i}=t,a=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!a)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${i}'`),p();let c=a.toolCalls?.find(e=>e.id===i);if(!c)return console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),p();let l=await IO(r,o,s,(r,i,a)=>{let o=c.function.arguments,s=c.function.name,l={};try{l=JSON.parse(o)}catch{}return r.onToolCallEndEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallName:s,toolCallArgs:l})});return f(l),l.stopPropagation!==!0&&HO(c,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewToolCall?.({toolCall:c,messages:o,state:s,agent:n,input:e})})),p()}case I.TOOL_CALL_RESULT:{let i=await IO(r,o,s,(r,i,a)=>r.onToolCallResultEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:i,toolCallId:a,content:c,role:l,subagentRunId:d}=t;u.add(a);let p={id:i,toolCallId:a,role:l||`tool`,content:c,...d!=null&&{subagentRunId:d}};HO(p,t);let m=o.findIndex(e=>e.role===`assistant`&&e.toolCalls?.some(e=>e.id===a));if(m===-1)o.push(p);else{let e=m+1;for(;e{t.onNewMessage?.({message:p,messages:o,state:s,agent:n,input:e})})),f({messages:o})}return p()}case I.STATE_SNAPSHOT:{let i=await IO(r,o,s,(r,i,a)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{snapshot:e}=t;s=e,f({state:s})}return p()}case I.STATE_DELTA:{let i=await IO(r,o,s,(r,i,a)=>r.onStateDeltaEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{delta:e}=t;try{s=Hl.applyPatch(s,e,!0,!1).newDocument,f({state:s})}catch(t){let n=t instanceof Error?t.message:String(t);console.warn(`Failed to apply state patch:\nCurrent state: ${JSON.stringify(s,null,2)}\nPatch operations: ${JSON.stringify(e,null,2)}\nError: ${n}`)}}return p()}case I.MESSAGES_SNAPSHOT:{let i=await IO(r,o,s,(r,i,a)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messages:e}=t,n=e.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}),r=new Map(n.map(e=>[e.id,e])),i=kO(t),a=n.some(e=>e.role===`activity`),s=n.some(e=>e.role===`reasoning`),c=e=>e.role===`activity`&&(i?!i.includes(e.activityType):i!==null&&!a)||e.role===`reasoning`&&!s;o=o.filter(e=>r.has(e.id)||c(e)).map(e=>r.get(e.id)??e);let l=new Set(o.map(e=>e.id));for(let e of n)l.has(e.id)||o.push(e);f({messages:o})}return p()}case I.ACTIVITY_SNAPSHOT:{let i=t,a=o.findIndex(e=>e.id===i.messageId),c=a>=0?o[a]:void 0,l=c?.role===`activity`?c:void 0,u=i.replace??!0,d=await IO(r,o,s,(t,r,a)=>t.onActivitySnapshotEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:l,existingMessage:c}));if(f(d),d.stopPropagation!==!0){let t={id:i.messageId,role:`activity`,activityType:i.activityType,content:AO(i.content),...i.subagentRunId!=null&&{subagentRunId:i.subagentRunId}},c,d;a===-1?(o.push(t),c=t,d=t):l?(u&&(o[a]={...l,activityType:i.activityType,content:AO(i.content),subagentRunId:i.subagentRunId},i.subagentRunId??delete o[a].subagentRunId),d=o[a]):u&&(o[a]=t,c=t,d=t),HO(d,i),f({messages:o}),c&&await Promise.all(r.map(t=>t.onNewMessage?.({message:c,messages:o,state:s,agent:n,input:e})))}return p()}case I.ACTIVITY_DELTA:{let i=t,a=o.findIndex(e=>e.id===i.messageId);if(a===-1)return p();let c=o[a];if(c.role!==`activity`)return console.warn(`ACTIVITY_DELTA: Message '${i.messageId}' is not an activity message`),p();let l=c,u=await IO(r,o,s,(t,r,a)=>t.onActivityDeltaEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:l}));if(f(u),u.stopPropagation!==!0)try{HO(l,i)&&f({messages:o});let e=AO(l.content??{}),t=Hl.applyPatch(e,i.patch??[],!0,!1).newDocument;o[a]={...l,content:AO(t),activityType:i.activityType},f({messages:o})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`Failed to apply activity patch for '${i.messageId}': ${t}`)}return p()}case I.RAW:return f(await IO(r,o,s,(r,i,a)=>r.onRawEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.CUSTOM:return f(await IO(r,o,s,(r,i,a)=>r.onCustomEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.RUN_STARTED:{let i=await IO(r,o,s,(r,i,a)=>r.onRunStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),l=[],u=new Set,i.stopPropagation!==!0){let e=t;if(e.input?.messages){for(let t of e.input.messages){let e=t;if(t.subagentRunId===null){let n={...t};delete n.subagentRunId,e=n}o.find(t=>t.id===e.id)||o.push(e)}f({messages:o})}}return p()}case I.RUN_FINISHED:{let i=t,a=i.outcome?.type===`interrupt`?{event:i,outcome:`interrupt`,interrupts:i.outcome.interrupts}:i.outcome?.type===`cancelled`?{event:i,outcome:`cancelled`}:{event:i,outcome:`success`,result:i.result,pendingToolCallIds:d(i)},c=await IO(r,o,s,(t,r,i)=>t.onRunFinishedEvent?.({...a,messages:r,state:i,agent:n,input:e}));return f(c),c.stopPropagation!==!0&&(n.pendingInterrupts=a.outcome===`interrupt`?a.interrupts.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}):[]),p()}case I.RUN_ERROR:return f(await IO(r,o,s,(r,i,a)=>r.onRunErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.STEP_STARTED:return f(await IO(r,o,s,(r,i,a)=>r.onStepStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.STEP_FINISHED:return f(await IO(r,o,s,(r,i,a)=>r.onStepFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.TEXT_MESSAGE_CHUNK:throw Error(`TEXT_MESSAGE_CHUNK must be transformed before being applied`);case I.TOOL_CALL_CHUNK:throw Error(`TOOL_CALL_CHUNK must be transformed before being applied`);case I.REASONING_START:return f(await IO(r,o,s,(r,i,a)=>r.onReasoningStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.REASONING_MESSAGE_START:{let i=await IO(r,o,s,(r,i,a)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:e,subagentRunId:n}=t,r=o.find(t=>t.id===e);if(r?.role===`activity`)return console.warn(`REASONING_MESSAGE_START: Message '${e}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let i=r;if(!i){let t={id:e,role:`reasoning`,content:``,...n!=null&&{subagentRunId:n}};o.push(t),i=t}let a=HO(i,t);(!r||a)&&f({messages:o})}return p()}case I.REASONING_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${i}'`),p();if(c.role===`activity`)return console.warn(`REASONING_MESSAGE_CONTENT: Message '${i}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let l=await IO(r,o,s,(r,i,a)=>r.onReasoningMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,reasoningMessageBuffer:typeof c.content==`string`?c.content:``}));return f(l),l.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,HO(c,t),f({messages:o})),p()}case I.REASONING_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${i}'`),p();if(a.role===`activity`)return console.warn(`REASONING_MESSAGE_END: Message '${i}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let c=await IO(r,o,s,(r,i,o)=>r.onReasoningMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,reasoningMessageBuffer:typeof a.content==`string`?a.content:``}));return f(c),c.stopPropagation!==!0&&HO(a,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),p()}case I.REASONING_MESSAGE_CHUNK:throw Error(`REASONING_MESSAGE_CHUNK must be transformed before being applied`);case I.REASONING_END:return f(await IO(r,o,s,(r,i,a)=>r.onReasoningEndEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:a,encryptedValue:l}=t,u=await IO(r,o,s,(r,i,a)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(u),u.stopPropagation!==!0){let e=!1;if(i===`tool-call`){for(let t of o)if(t.role===`assistant`&&t.toolCalls){let n=t.toolCalls.find(e=>e.id===a);if(n){n.encryptedValue=l,e=!0;break}}}else{let t=o.find(e=>e.id===a);t?.role!==`activity`&&t&&(t.encryptedValue=l,e=!0)}e&&(c.messages=o)}return p()}case I.SUBAGENT_STARTED:return f(await IO(r,o,s,(r,i,a)=>r.onSubagentStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.SUBAGENT_FINISHED:return f(await IO(r,o,s,(r,i,a)=>r.onSubagentFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.SUBAGENT_ERROR:return f(await IO(r,o,s,(r,i,a)=>r.onSubagentErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p()}return t.type,p()}),Od(),r.length>0?Id({}):e=>e)};function WO(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][compat] Converting deprecated ${e} to ${t}. The old shape leaves the protocol after its shim window — see the repo-root DEPRECATIONS.md. Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)}var GO=e=>t=>{let n=RO(e),r=new Set,i=new Set,a=new Set,o=new Set,s={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},c=!1,l=!1,u=!1,d=new Map,f=e=>{let t=d.get(e);return t||(t=new Map,d.set(e,t)),t},p=()=>{for(let e of d.values())if(e.size>0)return!0;return!1},m=new Map,h=new Set,g=!1,_=!1,v=()=>{_=!1,r.clear(),i.clear(),a.clear(),o.clear(),s.message.clear(),s.toolCall.clear(),s.activity.clear(),s.reasoning.clear(),d.clear(),m.clear(),h.clear(),c=!1,l=!1,g=!0},y=(e,t)=>{let n=e??[];if(Array.isArray(n))for(let e of n){if(!e||typeof e.id!=`string`)continue;if(e.subagentRunId===null)return new L(`Cannot send a message (id '${e.id}') with 'subagentRunId: null'. The field is optional — omit it entirely.`);let n=e.role===`reasoning`?s.reasoning:e.role===`activity`?s.activity:s.message;(t||!n.has(e.id))&&n.set(e.id,{subagentRunId:e.subagentRunId});for(let n of e.toolCalls??[])n&&typeof n.id==`string`&&(t||!s.toolCall.has(n.id))&&s.toolCall.set(n.id,{subagentRunId:e.subagentRunId??void 0})}},b=(e,t,n,r,i)=>{if(t!==void 0&&n&&n.subagentRunId!==t)return new L(`Cannot send '${e}': subagentRunId '${t}' does not match the ${r} '${i}' opener's subagent '${n.subagentRunId??`(the parent agent)`}'.`)};return t.pipe(Dd(e=>{let t=e.type;if(n?.event(`VERIFY`,`Event:`,e,{type:e.type}),l&&t!==I.RUN_STARTED)return z(()=>new L(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(c&&t!==I.RUN_ERROR&&t!==I.RUN_STARTED)return z(()=>new L(`Cannot send event type '${t}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(!u){if(u=!0,t!==I.RUN_STARTED&&t!==I.RUN_ERROR)return z(()=>new L(`First event must be 'RUN_STARTED'`))}else if(t===I.RUN_STARTED){if(g&&!c&&!l)return z(()=>new L(`Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run.`));(c||l)&&v()}if(e.subagentRunId===null){_||(_=!0,WO(`subagentRunId: null`,`an absent field`));let{subagentRunId:t,...n}=e;e=n}if(t===I.SUBAGENT_STARTED||t===I.SUBAGENT_FINISHED||t===I.SUBAGENT_ERROR){let n=t===I.SUBAGENT_STARTED?[`description`,`parentSubagentRunId`,`parentToolCallId`,`parentMessageId`]:t===I.SUBAGENT_FINISHED?[`outcome`]:[`code`];for(let r of n)if(e[r]===null)return z(()=>new L(`Cannot send '${t}' with '${r}: null'. The field is optional — omit it entirely.`));let r=e.outcome;if(r!=null&&r.type!==`success`&&r.type!==`suspended`)return z(()=>new L(`Cannot send '${t}' with outcome type '${String(r.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(r&&r.interruptIds===null)return z(()=>new L(`Cannot send '${t}' with 'outcome.interruptIds: null'. The field is optional — omit it entirely.`));if(r&&Array.isArray(r.interruptIds)&&r.interruptIds.some(e=>typeof e!=`string`))return z(()=>new L(`Cannot send '${t}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(t===I.RUN_FINISHED){let t=e.outcome;if(t?.type===`interrupt`&&Array.isArray(t.interrupts)){for(let e of t.interrupts)if(e&&e.subagentRunId===null)return z(()=>new L(`Cannot send 'RUN_FINISHED' with an interrupt (id '${e.id}') carrying 'subagentRunId: null'. The field is optional — omit it entirely.`))}}switch(t){case I.TEXT_MESSAGE_START:{let n=e.messageId;if(r.has(n))return z(()=>new L(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${n}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let i=s.message.get(n);if(i){let r=b(t,e.subagentRunId,i,`message`,n);if(r)return z(()=>r)}return r.add(n),i||s.message.set(n,{subagentRunId:e.subagentRunId}),Sd(e)}case I.TEXT_MESSAGE_CONTENT:{let n=e.messageId;if(!r.has(n))return z(()=>new L(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${n}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let i=b(t,e.subagentRunId,s.message.get(n),`message`,n);return i?z(()=>i):Sd(e)}case I.TEXT_MESSAGE_END:{let n=e.messageId;if(!r.has(n))return z(()=>new L(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${n}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let i=b(t,e.subagentRunId,s.message.get(n),`message`,n);return i?z(()=>i):(r.delete(n),Sd(e))}case I.TOOL_CALL_START:{let n=e.toolCallId;if(i.has(n))return z(()=>new L(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${n}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let r=e.parentMessageId,a=e.subagentRunId,o;if(r!==void 0){let e=s.message.get(r);if(e){if(a!==void 0&&a!==e.subagentRunId)return z(()=>new L(`Cannot send 'TOOL_CALL_START': subagentRunId '${a}' does not match its parent message '${r}' owner '${e.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`));o=e}}let c=s.toolCall.get(n);if(c){let e=b(t,a,c,`tool call`,n);if(e)return z(()=>e);if(a===void 0&&o&&o.subagentRunId!==c.subagentRunId)return z(()=>new L(`Cannot send 'TOOL_CALL_START': tool call '${n}' is owned by '${c.subagentRunId??`(the parent agent)`}' but its parent message '${r}' is owned by '${o.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`))}return i.add(n),c||s.toolCall.set(n,a===void 0?o??{subagentRunId:void 0}:{subagentRunId:a}),Sd(e)}case I.TOOL_CALL_ARGS:{let n=e.toolCallId;if(!i.has(n))return z(()=>new L(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${n}'. Start a tool call with 'TOOL_CALL_START' first.`));let r=b(t,e.subagentRunId,s.toolCall.get(n),`tool call`,n);return r?z(()=>r):Sd(e)}case I.TOOL_CALL_END:{let n=e.toolCallId;if(!i.has(n))return z(()=>new L(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${n}'. A 'TOOL_CALL_START' event must be sent first.`));let r=b(t,e.subagentRunId,s.toolCall.get(n),`tool call`,n);return r?z(()=>r):(i.delete(n),Sd(e))}case I.STEP_STARTED:{let t=e.stepName,n=e.subagentRunId;return f(n).has(t)?z(()=>new L(`Step "${t}" is already active for 'STEP_STARTED'${n===void 0?``:` in subagent '${n}'`}`)):(f(n).set(t,!0),Sd(e))}case I.STEP_FINISHED:{let t=e.stepName,n=e.subagentRunId;if(!f(n).has(t)){let e,r=!1;for(let[i,a]of d)if(i!==n&&a.has(t)){e=i,r=!0;break}return z(r?()=>new L(`Cannot send 'STEP_FINISHED' for step "${t}" attributed to ${n===void 0?`the parent agent`:`subagent '${n}'`}: that step is open under ${e===void 0?`the parent agent`:`subagent '${e}'`}. A step must be finished by whoever started it.`):()=>new L(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}return f(n).delete(t),Sd(e)}case I.ACTIVITY_SNAPSHOT:{let t=e.messageId;return(!s.activity.has(t)||e.replace!==!1)&&s.activity.set(t,{subagentRunId:e.subagentRunId}),Sd(e)}case I.TOOL_CALL_RESULT:{let t=e.messageId;return typeof t==`string`&&s.message.set(t,{subagentRunId:e.subagentRunId}),Sd(e)}case I.REASONING_START:case I.REASONING_MESSAGE_START:{let n=e.messageId,r=t===I.REASONING_START,i=r?a:o;if(i.has(n))return z(()=>new L(r?`Cannot send 'REASONING_START' event: A reasoning span with ID '${n}' is already in progress. Complete it with 'REASONING_END' first.`:`Cannot send 'REASONING_MESSAGE_START' event: A reasoning message with ID '${n}' is already in progress. Complete it with 'REASONING_MESSAGE_END' first.`));let c=s.reasoning.get(n);if(c){let r=b(t,e.subagentRunId,c,`reasoning message`,n);if(r)return z(()=>r)}return i.add(n),c||s.reasoning.set(n,{subagentRunId:e.subagentRunId}),Sd(e)}case I.REASONING_MESSAGE_CONTENT:case I.REASONING_MESSAGE_END:case I.REASONING_END:{let n=e.messageId,r=t===I.REASONING_END,i=r?a:o;if(!i.has(n))return z(()=>new L(r?`Cannot send 'REASONING_END' event: No active reasoning span found with ID '${n}'. A 'REASONING_START' event must be sent first.`:`Cannot send '${t}' event: No active reasoning message found with ID '${n}'. Start a reasoning message with 'REASONING_MESSAGE_START' first.`));let c=b(t,e.subagentRunId,s.reasoning.get(n),`reasoning message`,n);return c?z(()=>c):((t===I.REASONING_END||t===I.REASONING_MESSAGE_END)&&i.delete(n),Sd(e))}case I.REASONING_ENCRYPTED_VALUE:{let n=e.entityId,r=e.subtype,i=r===`tool-call`?s.toolCall.get(n):r===`message`?s.message.get(n)??s.reasoning.get(n):s.reasoning.get(n),a=r===`tool-call`?`tool call`:r===`message`?`message`:`reasoning message`,o=b(t,e.subagentRunId,i,a,n);return o?z(()=>o):Sd(e)}case I.ACTIVITY_DELTA:{let n=e.messageId,r=b(t,e.subagentRunId,s.activity.get(n),`activity`,n);return r?z(()=>r):Sd(e)}case I.SUBAGENT_STARTED:{if(typeof e.subagentRunId!=`string`)return z(()=>new L(`Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'.`));if(typeof e.name!=`string`)return z(()=>new L(`Cannot send 'SUBAGENT_STARTED' without a 'name'.`));let t=e.subagentRunId,n=e.parentSubagentRunId;return m.has(t)?z(()=>new L(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):h.has(t)?z(()=>new L(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):n!==void 0&&!m.has(n)&&!h.has(n)?z(()=>new L(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${n}' has not been started in this run.`)):(m.set(t,!0),Sd(e))}case I.SUBAGENT_FINISHED:case I.SUBAGENT_ERROR:{if(typeof e.subagentRunId!=`string`)return z(()=>new L(`Cannot send '${t}' without a 'subagentRunId'.`));if(t===I.SUBAGENT_ERROR&&typeof e.message!=`string`)return z(()=>new L(`Cannot send 'SUBAGENT_ERROR' without a 'message'.`));let n=e.subagentRunId;return m.has(n)?(m.delete(n),h.add(n),Sd(e)):z(()=>new L(`Cannot send '${t}': no active subagent found with ID '${n}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case I.MESSAGES_SNAPSHOT:{let t=y(e.messages,!0);if(t)return z(()=>t)}return Sd(e);case I.RUN_STARTED:g=!0;{let t=y((e.input??{}).messages,!1);if(t)return z(()=>t)}return Sd(e);case I.RUN_FINISHED:if(p()){let e=[];for(let[t,n]of d)for(let r of n.keys())e.push(t===void 0?r:`${r} (subagent '${t}')`);let t=e.join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while steps are still active: ${t}`))}if(r.size>0){let e=Array.from(r.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(o.size>0){let e=Array.from(o.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while reasoning messages are still active: ${e}`))}if(a.size>0){let e=Array.from(a.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while reasoning spans are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}if(m.size>0){let e=Array.from(m.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while subagents are still active: ${e}`))}return c=!0,Sd(e);case I.RUN_ERROR:return l=!0,Sd(e);case I.CUSTOM:return Sd(e);default:return Sd(e)}}))},KO=function(e){return e.HEADERS=`headers`,e.DATA=`data`,e}({}),qO=e=>Ad(()=>xd(e())).pipe(Rd(e=>{if(!e.ok){let t=e.headers.get(`content-type`)||``;return xd(e.text()).pipe(Dd(n=>{let r=n;if(t.includes(`application/json`))try{r=JSON.parse(n)}catch{}let i=Error(`HTTP ${e.status}: ${typeof r==`string`?r:JSON.stringify(r)}`);return i.status=e.status,i.payload=r,z(()=>i)}))}let t={type:KO.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new ju(e=>{let r=!1;return e.next(t),(async()=>{try{for(;!e.closed;){let{done:t,value:i}=await n.read();if(t){r=!0;break}let a={type:KO.DATA,data:i};e.next(a)}e.complete()}catch(t){r=!0,e.error(t)}})(),()=>{r||n.cancel().catch(e=>{e?.name!==`AbortError`&&console.warn(`Failed to cancel HTTP response stream:`,e)})}}):z(()=>Error(`Failed to getReader() from response`))})),JO=10485760,YO=(e,t)=>{let n=RO(t),r=new Bu,i=new TextDecoder(`utf-8`,{fatal:!1}),a=``;e.subscribe({next:e=>{if(e.type!==KO.HEADERS&&e.type===KO.DATA&&e.data){let t=i.decode(e.data,{stream:!0});a+=t;let n=a.split(/\n\n/);a=n.pop()||``;for(let e of n)o(e);if(a.length>JO){r.error(Error(`SSE buffer size exceeded maximum limit of ${JO/1048576} MB`));return}}},error:e=>r.error(e),complete:()=>{a&&(a+=i.decode(),o(a)),r.complete()}});function o(e){let t=e.split(` `),i=[];for(let e of t)e.startsWith(`data:`)&&i.push(e.slice(5).replace(/^ /,``));if(i.length>0)try{let e=i.join(` -`),t=JSON.parse(e);n?.event(`SSE`,`Event received:`,t,{type:t?.type}),r.next(t)}catch(e){r.error(e)}}return r.asObservable()},qO=10485760,JO=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS,YO=(e,t)=>{let n=FO(t),r=new Bu,i=new Uint8Array,a=!1;e.subscribe({next:e=>{if(e.type!==UO.HEADERS&&e.type===UO.DATA&&e.data){let t=new Uint8Array(i.length+e.data.length);t.set(i,0),t.set(e.data,i.length),i=t,o()}},error:e=>r.error(e),complete:()=>{if(o(),!a){if(i.length>0){r.error(Error(`The binary stream ended mid-frame: ${i.length} trailing bytes could not be read as a complete message.`));return}r.complete()}}});function o(){if(!a)for(;i.length>=4;){let e=4+new DataView(i.buffer,i.byteOffset,4).getUint32(0,!1);if(e>qO){r.error(Error(`Protobuf message size exceeded maximum limit of ${qO/1048576} MB`));return}if(i.length{let n=FO(t),r=new Bu,i=new Uu(1),a=!1,o,s=!1,c=()=>{s=!0,o?.unsubscribe()},l=e=>{c(),r.error(e)},u=()=>{c(),r.complete()};return o=e.subscribe({next:e=>{if(i.next(e),e.type===UO.HEADERS&&!a){a=!0;let t=e.headers.get(`content-type`);n?.lifecycle(`HTTP`,`Stream format detected:`,{contentType:t,parser:t===`application/vnd.ag-ui.event+proto`?`protobuf`:`sse`}),t===`application/vnd.ag-ui.event+proto`?YO(i,n).subscribe({next:e=>r.next(e),error:e=>l(e),complete:()=>u()}):KO(i,n).subscribe({next:e=>{if(typeof e!=`object`||!e||Array.isArray(e)){let t=Error(`Invalid event: the frame is not a JSON object.`);n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),l(t);return}let t=e;if(typeof t.type!=`string`||t.type.length===0){let t=Error(`Invalid event: the frame carries no event type.`);n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),l(t);return}n?.event(`HTTP`,`Event received:`,e,{type:t.type}),r.next(e)},error:e=>{if(e?.name===`AbortError`){r.next({type:I.RUN_ERROR,message:e.message||`Request aborted`,code:`abort`,rawEvent:e}),u();return}return l(e)},complete:()=>u()})}else a||l(Error(`No headers event received before data events`))},error:e=>{i.error(e),l(e)},complete:()=>{i.complete()}}),s&&o.unsubscribe(),r.asObservable()},ZO={TextMessageStart:`TextMessageStart`,TextMessageContent:`TextMessageContent`,TextMessageEnd:`TextMessageEnd`,ActionExecutionStart:`ActionExecutionStart`,ActionExecutionArgs:`ActionExecutionArgs`,ActionExecutionEnd:`ActionExecutionEnd`,ActionExecutionResult:`ActionExecutionResult`,AgentStateMessage:`AgentStateMessage`,MetaEvent:`MetaEvent`,RunStarted:`RunStarted`,RunFinished:`RunFinished`,RunError:`RunError`,NodeStarted:`NodeStarted`,NodeFinished:`NodeFinished`},QO=e=>{if(typeof e==`string`)return e;if(!Array.isArray(e))return;let t=e.filter(e=>e.type===`text`).map(e=>e.text).filter(e=>e.length>0);if(t.length!==0)return t.join(` -`)};function $O(e,t){return ol(t)&&ek(`[ag-ui][legacy] The result of tool call '${e}' carries content parts the legacy protocol cannot represent; only its text parts are bridged and the rest is dropped.`),al(t)}var ek=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(e)},tk=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=!1,p=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(Dd(r=>{switch(r.type){case I.TEXT_MESSAGE_START:{let e=r;return[{type:ZO.TextMessageStart,messageId:e.messageId,role:e.role}]}case I.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:ZO.TextMessageContent,messageId:e.messageId,content:e.delta}]}case I.TEXT_MESSAGE_END:{let e=r;return[{type:ZO.TextMessageEnd,messageId:e.messageId}]}case I.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:ZO.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case I.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return ek(`[ag-ui][legacy] TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let f=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(Hd(d.function.arguments));e.tool_argument&&e.tool_argument in t?(p({...i,[e.state_key]:t[e.tool_argument]}),f=!0):e.tool_argument||(p({...i,[e.state_key]:t}),f=!0)}catch{}}return[{type:ZO.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...f?[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case I.TOOL_CALL_END:{let e=r;return[{type:ZO.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case I.TOOL_CALL_RESULT:{let e=r,t=d[e.toolCallId];return(t===void 0||t===``)&&ek(`[ag-ui][legacy] No usable tool name was seen for tool call '${e.toolCallId}' (${t===void 0?`no TOOL_CALL_START reached this bridge`:`its TOOL_CALL_START carried an empty toolCallName`}), so its result is being bridged with the fabricated action name "unknown". Downstream consumers route on that name.`),[{type:ZO.ActionExecutionResult,actionExecutionId:e.toolCallId,result:$O(e.toolCallId,e.content),actionName:t||`unknown`}]}case I.RAW:return f||(f=!0,ek(`[ag-ui][legacy] Dropping RAW events: the legacy runtime protocol has no equivalent, so the provider payloads they carry do not reach the legacy stream. Reported once per stream.`)),[];case I.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:ZO.MetaEvent,name:e.name,value:e.value}]}case I.STATE_SNAPSHOT:return p(r.snapshot),[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case I.STATE_DELTA:{let c=r,l;try{l=Hl.applyPatch(i,c.delta,!0,!1).newDocument}catch(e){let t=e instanceof Error?e.message:String(e);return ek(`[ag-ui][legacy] Failed to apply state patch:\nCurrent state: ${JSON.stringify(i,null,2)}\nPatch operations: ${JSON.stringify(c.delta,null,2)}\nError: ${t}`),[]}return p(l),[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]}case I.MESSAGES_SNAPSHOT:return c=r.messages,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case I.RUN_STARTED:return[];case I.RUN_FINISHED:{if(c&&(i.messages=c),Object.keys(i).length===0)return[];let r=null;if(c)try{r=nk(c)}catch(e){return[{type:ZO.RunError,message:e.message}]}return[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...r?{messages:r}:{}}),active:!1}]}case I.RUN_ERROR:{let e=r;return[{type:ZO.RunError,message:e.message,code:e.code}]}case I.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case I.STEP_FINISHED:return u=[],l=null,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function nk(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=QO(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r;try{r=JSON.parse(e.function.arguments)}catch(t){throw Error(`Failed to parse arguments for tool call '${e.id}' (${e.function.name}): ${t.message}`)}let i={id:e.id,name:e.function.name,arguments:r,parentMessageId:n.id};t.push(i)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:$O(n.toolCallId,n.content),actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var rk=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,ik=e=>e===`tool`?`toolCallId`:`messageId`,ak=(e,t,n,r,i)=>{if(r!==void 0&&r!==i)throw Error(`Cannot continue ${e} '${t}': chunk ${n} '${r}' does not match the open stream's ${n} ${i===void 0?`(absent)`:`'${i}'`}.`)},ok=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},sk=(e,t)=>{let n=ok(e,t);return t.rawEvent===void 0?n:{...n,rawEvent:t.rawEvent}},ck=e=>new Set(Object.keys(e.shape)),lk=ck(Cx),uk=ck(Dx),dk=ck(uS),fk=(e,t)=>{let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n},pk=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][transform] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)},mk=(e,t,n,r)=>{if(t===void 0||n||e.length===0)return;let i=e[e.length-1],a=Object.keys(t).filter(e=>Object.prototype.hasOwnProperty.call(i,e));a.length>0&&pk(`A ${r} carried ${a.map(e=>`'${e}'`).join(`, `)}, which the synthesized ${String(i.type)} already describes. The synthesized value is kept and the chunk's is dropped — this stage does not judge a described field, so the producer's value cannot be substituted for its own.`),e[e.length-1]={...t,...i}},hk=e=>t=>{let n=FO(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:I.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:I.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:I.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&rk(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${ik(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(Dd(e=>{switch(e.type){case I.TEXT_MESSAGE_START:case I.TEXT_MESSAGE_CONTENT:case I.TEXT_MESSAGE_END:case I.TOOL_CALL_START:case I.TOOL_CALL_ARGS:case I.TOOL_CALL_END:case I.TOOL_CALL_RESULT:case I.STATE_SNAPSHOT:case I.STATE_DELTA:case I.CUSTOM:case I.STEP_STARTED:case I.STEP_FINISHED:case I.REASONING_START:case I.REASONING_MESSAGE_START:case I.REASONING_MESSAGE_CONTENT:case I.REASONING_MESSAGE_END:case I.REASONING_END:return[...i(e.subagentRunId??void 0),e];case I.RUN_STARTED:case I.RUN_FINISHED:case I.RUN_ERROR:case I.MESSAGES_SNAPSHOT:return[...a(),e];case I.RAW:case I.ACTIVITY_SNAPSHOT:case I.ACTIVITY_DELTA:case I.REASONING_ENCRYPTED_VALUE:case I.SUBAGENT_STARTED:return[e];case I.SUBAGENT_FINISHED:case I.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case I.TEXT_MESSAGE_CHUNK:{let t=e,a=fk(e,lk),o=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`text`&&(t.messageId===void 0||t.messageId===c.fields.messageId))ak(`text message`,c.fields.messageId,`role`,t.role,c.fields.role),ak(`text message`,c.fields.messageId,`name`,t.name,c.fields.name),d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,role:t.role===void 0?`assistant`:t.role,name:t.name,subagentRunId:t.subagentRunId},r.set(o,{kind:`text`,fields:d});let e=ok({type:I.TEXT_MESSAGE_START,messageId:t.messageId,role:d.role,...t.name!==void 0&&{name:t.name},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:I.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`TEXT_MESSAGE_CHUNK`),l}case I.TOOL_CALL_CHUNK:{let t=e,a=fk(e,uk),o=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===c.fields.toolCallId))ak(`tool call`,c.fields.toolCallId,`toolCallName`,t.toolCallName,c.fields.toolCallName),ak(`tool call`,c.fields.toolCallId,`parentMessageId`,t.parentMessageId,c.fields.parentMessageId),d=c.fields;else{if(l.push(...i(o)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);d={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`tool`,fields:d});let e=ok({type:I.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,...t.parentMessageId!==void 0&&{parentMessageId:t.parentMessageId},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:I.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:d.toolCallId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`TOOL_CALL_CHUNK`),l}case I.REASONING_MESSAGE_CHUNK:{let t=e,a=fk(e,dk),o=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===c.fields.messageId))d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`reasoning`,fields:d});let e=ok({type:I.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:I.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`REASONING_MESSAGE_CHUNK`),l}}return e.type,[e]}),Ld(()=>{a()}))},gk=Symbol(`agui.strip.drop`);function _k(e){let t=e;for(;;){if(t instanceof iO||t instanceof oO||t instanceof cO||t instanceof vO||t instanceof mO){t=t.unwrap();continue}if(t instanceof gO){t=t.def.in;continue}if(t instanceof bO){t=t.def.getter();continue}return t}}function vk(e){let t=e.def;return typeof t?.discriminator==`string`?t.discriminator:void 0}function yk(e){let t=e,n=Array.isArray(t.def?.values)?t.def.values:t.values?Array.from(t.values):void 0;return n&&n.length===1?n[0]:t.value}function bk(e){let t=_k(e);return t instanceof tO?yk(t):void 0}function xk(e,t,n,r){let i=_k(t);if(i instanceof qD){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.shape,a=e,o={},s=i.meta()?.specOpen===!0;for(let e of Object.keys(a)){let i=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(i===void 0){if(s){o[e]=a[e];continue}r.push(`${n}/${e}`);continue}let c=r.length,l=xk(a[e],i,`${n}/${e}`,r);if(l===gk){if(r.length=c,i.safeParse(void 0).success){r.push(`${n}/${e}`);continue}return gk}o[e]=l}return o}if(i instanceof GD){if(!Array.isArray(e))return e;let t=i.element,a=[];return e.forEach((e,i)=>{let o=r.length,s=xk(e,t,`${n}/${i}`,r);if(s===gk){r.length=o,r.push(`${n}/${i}`);return}a.push(s)}),a}if(i instanceof QD){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.def.valueType,a=e,o={};for(let e of Object.keys(a)){let i=r.length,s=xk(a[e],t,`${n}/${e}`,r);if(s===gk){r.length=i,r.push(`${n}/${e}`);continue}o[e]=s}return o}if(i instanceof JD){let t=i.options,a=vk(i);if(a!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))return e;let i=e[a];for(let o of t){let t=_k(o);if(!(t instanceof qD))continue;let s=t.shape;if(bk(s[a])===i)return xk(e,o,n,r)}return gk}let o=t.filter(e=>_k(e)instanceof qD),s=typeof e==`object`&&!!e&&!Array.isArray(e);if(o.length>1&&s)return e;for(let i of t){let t=_k(i);if(t instanceof GD&&Array.isArray(e)||t instanceof qD&&s)return xk(e,i,n,r)}return e}return e}function Sk(e,t){let n=[],r=xk(e,t,``,n);if(r===gk)throw Error(`Internal error: the stripper found the whole value unrecognisable, which the schemas are not supposed to allow — schema/stripper mismatch.`);return{value:r,stripped:n}}var Ck=new Set(Object.values(I));function wk(e){return Ck.has(e.type)}var Tk=new Map(gS.options.map(e=>{let t=e.shape;return[String(yk(t.type)),e]})),Ek=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS;function Dk(e){Ek()||console.warn(`[ag-ui][enforce] ${e}`)}var Ok=e=>t=>{let n=FO(e);return t.pipe(Dd(e=>{if(!wk(e))return Dk(`Dropping unrecognised event '${String(e.type)}': no middleware translated it and the protocol does not describe it.`),n?.event(`ENFORCE`,`Unrecognised event dropped:`,e,{type:e.type}),Wu;let t=Tk.get(e.type);if(t===void 0)throw Error(`No validator for recognised event type '${String(e.type)}'`);let{value:r,stripped:i}=Sk(e,t);for(let t of i)Dk(`Removed unrecognised material at '${t}' on ${String(e.type)}. Nothing handled it; see the repo-root DEPRECATIONS.md if it is a retired shape.`);return Sd(t.parse(r))}))};function kk(e){let{value:t,stripped:n}=Sk(nl(e,`RunAgentInput`),Xx);for(let e of n)Dk(`Removed unrecognised material at '${e}' from the outgoing input.`);return Xx.parse(t)}var Ak=class{runNext(e,t){return t.run(e).pipe(hk(!1))}runNextWithState(e,t){let n=DO(e.messages||[]),r=DO(e.state===void 0?{}:e.state),i=new Uu;return BO(e,i,t,[]).subscribe({next:e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)},error:()=>{}}),this.runNext(e,t).pipe(Nd(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:DO(n),state:DO(r)})))}},jk=class extends Ak{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Mk(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function Nk(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function Pk(e){let t=Mk(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:((typeof process>`u`||!{}.SUPPRESS_TRANSFORMATION_WARNINGS)&&console.warn(`[ag-ui][compat] A binary content part carries only an id ('${e.id??``}') and cannot be converted to a modern media part; a 1.0 peer will not accept it. Provide data or a url. See the repo-root DEPRECATIONS.md.`),e)}function Fk(e,t,n){if(typeof e!=`object`||!e||!(`type`in e)||e.type!==t.type||!(`source`in e))return!1;let r=e.source;return typeof r!=`object`||!r||!(`type`in r)||r.type!==t.source.type||!(`value`in r)||r.value!==t.source.value||!(`mimeType`in r)||r.mimeType!==t.source.mimeType?!1:!n||`metadata`in e&&typeof e.metadata==`object`&&e.metadata!==null&&`filename`in e.metadata&&e.metadata.filename===n}function Ik(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.flatMap(e=>{if(Nk(e)){let n=Pk(e);return n.type!==`binary`&&t.some(t=>Fk(t,n,e.filename))?[]:[n]}return[e]});return{...e,content:n}}var Lk=`THINKING_START`,Rk=`THINKING_END`,zk=`THINKING_TEXT_MESSAGE_START`,Bk=`THINKING_TEXT_MESSAGE_CONTENT`,Vk=`THINKING_TEXT_MESSAGE_END`;function Hk(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Uk={event:[`rawEvent`,`subagentRunId`],[I.RUN_STARTED]:[`parentRunId`,`input`],[I.RUN_FINISHED]:[`result`,`outcome`],[I.RUN_ERROR]:[`usage`],[I.SUBAGENT_FINISHED]:[`result`],[I.TOOL_CALL_START]:[`parentMessageId`],[I.TOOL_CALL_CHUNK]:[`parentMessageId`],[I.TOOL_CALL_RESULT]:[`role`],"RUN_FINISHED.outcome":[`pendingToolCallIds`],"RUN_FINISHED.usage[]":[`provider`,`reasoningTokens`,`cachedInputTokens`,`cacheWriteInputTokens`],RunAgentInput:[`forwardedProps`],Tool:[`parameters`],ResumeEntry:[`payload`],"input content":[`metadata`]},Wk=new Map(Object.entries(Uk).filter(([e])=>Object.values(I).includes(e))),Gk=e=>VO(e,`an absent field`);function Kk(e,t,n,r){if(!Hk(e))return e;let i;for(let a of t)e[a]===null&&(r(n===void 0?`${a}: null`:`${n}.${a}: null`),i??={...e},delete i[a]);return i??e}function qk(e,t,n){if(!Hk(e)||!Array.isArray(e[t]))return e;let r=e[t],i=r.map(n);return i.some((e,t)=>e!==r[t])?{...e,[t]:i}:e}function Jk(e,t){return qk(e,`content`,e=>{if(!Hk(e))return e;switch(e.type){case`image`:case`audio`:case`video`:case`document`:return Kk(e,Uk[`input content`],`${e.type} input content`,t);default:return e}})}function Yk(e,t=Gk){let n=Kk(e,Uk.RunAgentInput,`RunAgentInput`,t);return n=qk(n,`tools`,e=>Kk(e,Uk.Tool,`Tool`,t)),n=qk(n,`resume`,e=>Kk(e,Uk.ResumeEntry,`ResumeEntry`,t)),qk(n,`messages`,e=>Jk(e,t))}var Xk=class extends Ak{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun=new Set,this.noticeNullOncePerRun=e=>{this.nullsNoticedThisRun.has(e)||(this.nullsNoticedThisRun.add(e),VO(e,`an absent field`))}}warn(e,t){VO(e,t)}mintedContinuationId(e,t){if(t!==null)return t;let n=OO();return this.warnAside(`Minting a messageId ('${n}') for ${e}: no THINKING opener preceded it, so there was no id to continue. The id is this client's invention, not the producer's, and verification will reject the translated event for naming something nothing opened.`),n}warnAside(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][compat] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun.clear(),e.messages=e.messages.map(Ik),t.run(e).pipe(Td(e=>this.transformEvent(e)))}transformEvent(e){let t=this.noticeNullOncePerRun;e.type===I.RUN_STARTED&&this.nullsNoticedThisRun.clear(),e=Kk(e,Uk.event,void 0,t);let n=Wk.get(e.type);switch(n&&(e=Kk(e,n,e.type,t)),e.type){case Lk:{this.currentReasoningId=OO();let{title:t,...n}=e;return this.warn(Lk,I.REASONING_START),t!==void 0&&this.warnAside(`Dropping ${Lk}.title ${JSON.stringify(t)}: ${I.REASONING_START} has no title field, so the span's label cannot be carried and nothing downstream can recover it.`),{...n,type:I.REASONING_START,messageId:this.currentReasoningId}}case zk:return this.currentMessageId=OO(),this.warn(zk,I.REASONING_MESSAGE_START),{...e,type:I.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case Bk:{let{delta:t,...n}=e;return this.warn(Bk,I.REASONING_MESSAGE_CONTENT),{...n,type:I.REASONING_MESSAGE_CONTENT,messageId:this.mintedContinuationId(Bk,this.currentMessageId),delta:t}}case Vk:{let t=this.mintedContinuationId(Vk,this.currentMessageId);return this.currentMessageId=null,this.warn(Vk,I.REASONING_MESSAGE_END),{...e,type:I.REASONING_MESSAGE_END,messageId:t}}case Rk:{let t=this.mintedContinuationId(Rk,this.currentReasoningId);return this.currentReasoningId=null,this.warn(Rk,I.REASONING_END),{...e,type:I.REASONING_END,messageId:t}}case I.RUN_FINISHED:{let n=e,r=Kk(n.outcome,Uk[`RUN_FINISHED.outcome`],`RUN_FINISHED.outcome`,t);return qk(r===n.outcome?n:{...n,outcome:r},`usage`,e=>Kk(e,Uk[`RUN_FINISHED.usage[]`],`RUN_FINISHED.usage[]`,t))}case I.MESSAGES_SNAPSHOT:{let t=e;return Array.isArray(t.messages)?{...t,messages:t.messages.map(e=>this.upgradeInboundMessage(e))}:e}case I.RUN_STARTED:{let n=Yk(e.input,t),r=n===e.input?e:{...e,input:n},i=r;return!i.input||!Array.isArray(i.input.messages)?r:{...i,input:{...i.input,messages:i.input.messages.map(e=>this.upgradeInboundMessage(e))}}}default:return e}}upgradeInboundMessage(e){e=Jk(e,this.noticeNullOncePerRun);let t=e.content;return!Array.isArray(t)||!t.some(e=>typeof e==`object`&&!!e&&e.type===`binary`)?e:(this.warn(`binary input content`,`the modern media content parts`),Ik(e))}},Zk=()=>e=>Ad(()=>{let t=new Xk;return e.pipe(Td(e=>t.transformEvent(e)))});function Qk(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}function $k(){return typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS}function eA(e){$k()||console.warn(`[ag-ui][compat] Flattening message content for a <=0.0.39 peer DROPS non-text parts (${e.join(`, `)}). The peer cannot receive them; upgrade it to keep media content. See the repo-root DEPRECATIONS.md.`)}function tA(e){$k()||console.warn(`[ag-ui][compat] Not flattening message content for a <=0.0.39 peer: ${e} content part(s) claim type "text" but carry a malformed 'text' value. That is a defect in the message, not media the peer cannot represent, and a downgrade must not repair it — the content is passed on unchanged so the outgoing enforcement boundary reports it. See the repo-root DEPRECATIONS.md.`)}function nA(e){let t=e.content;if(Array.isArray(t)){let n=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`,r=e=>n(e)&&typeof e.text==`string`,i=t.filter(e=>n(e)&&!r(e));if(i.length>0)return tA(i.length),e;let a=t.filter(e=>!r(e)).map(e=>typeof e==`object`&&e&&`type`in e?String(e.type):typeof e);a.length>0&&eA(a);let o=t.filter(r).map(e=>e.text).join(``);return{...e,content:o}}return typeof t==`string`?e:t===void 0?{...e,content:``}:e}var rA=class extends Ak{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(nA)};return this.runNext(i,t)}},iA=`THINKING_START`,aA=`THINKING_END`,oA=`THINKING_TEXT_MESSAGE_START`,sA=`THINKING_TEXT_MESSAGE_CONTENT`,cA=`THINKING_TEXT_MESSAGE_END`,lA=class extends Ak{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Td(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case iA:{this.currentReasoningId=OO();let{title:t,...n}=e;return this.warnAboutTransformation(iA,I.REASONING_START),{...n,type:I.REASONING_START,messageId:this.currentReasoningId}}case oA:return this.currentMessageId=OO(),this.warnAboutTransformation(oA,I.REASONING_MESSAGE_START),{...e,type:I.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case sA:{let{delta:t,...n}=e;return this.warnAboutTransformation(sA,I.REASONING_MESSAGE_CONTENT),{...n,type:I.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??OO(),delta:t}}case cA:{let t=this.currentMessageId??OO();return this.warnAboutTransformation(cA,I.REASONING_MESSAGE_END),{...e,type:I.REASONING_MESSAGE_END,messageId:t}}case aA:{let t=this.currentReasoningId??OO();return this.warnAboutTransformation(aA,I.REASONING_END),{...e,type:I.REASONING_END,messageId:t}}default:return e}}},uA=`SUBAGENT_STARTED`,dA=`SUBAGENT_FINISHED`,fA=`SUBAGENT_ERROR`;function pA(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function mA(e){return e.map(e=>pA(e))}var hA=class extends Ak{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>pA(e))};return this.runNext(n,t).pipe(Bd(e=>{let t=e.type;(t===uA||t===dA||t===fA)&&this.warnDroppedLifecycleEvent(t)}),jd(e=>{let t=e.type;return t!==uA&&t!==dA&&t!==fA}),Td(e=>{let t=pA(e);if(t.type===I.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:mA(e.messages)}}if(t.type===I.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>pA(e))}}}if(t.type===I.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:mA(e.input.messages)}}}return t}))}},gA=`1.0.2`,_A=!1,vA=new WeakSet,yA=(e,t)=>/^\d+\.\d+$/.test(e)?qT(e,t)>0?`newer`:`not-newer`:`uninterpretable`,bA=e=>{let t=e.protocolVersion;if(t!==void 0&&t!==`1.0`)switch(yA(t,`1.0`)){case`uninterpretable`:console.warn(`[ag-ui] The producer declared protocol version '${t}', which this client cannot interpret.`);return;case`newer`:console.warn(`[ag-ui] The producer speaks protocol ${t}; this client speaks 1.0. Unrecognised material will be stripped with warnings.`);return;case`not-newer`:return}},xA=class e{resolvePeerCeiling(t){if(this.resolvingPeerCeiling)return gA;let n=Object.getOwnPropertyDescriptor(this,`maxVersion`),r=Object.getOwnPropertyDescriptor(this,`maxProtocolVersion`),i=Object.getPrototypeOf(this);for(;i&&i!==e.prototype;)n??=Object.getOwnPropertyDescriptor(i,`maxVersion`),r??=Object.getOwnPropertyDescriptor(i,`maxProtocolVersion`),i=Object.getPrototypeOf(i);if(t===`maxVersion`&&n)return gA;let a=t===`maxProtocolVersion`?n:r;if(!a)return gA;this.resolvingPeerCeiling=!0;try{return a.get?a.get.call(this):a.value}finally{this.resolvingPeerCeiling=!1}}get maxProtocolVersion(){return this.resolvePeerCeiling(`maxProtocolVersion`)}get maxVersion(){return!this.resolvingPeerCeiling&&!_A&&(_A=!0,console.warn(`[ag-ui] AbstractAgent.maxVersion is deprecated — use maxProtocolVersion. Same value; the new name says whose version it is and that it is a ceiling.`)),this.resolvePeerCeiling(`maxVersion`)}get debug(){return this._debug}set debug(e){this._debug=PO(e),this._debugLogger=LO(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?LO(PO(!0)):void 0:e}resolvedCeilingDuringConstruction(){let e=this.maxProtocolVersion;if(typeof e!=`string`||!JT(e))throw new L(`maxProtocolVersion resolved to ${JSON.stringify(e)} during construction, which is not a version this client can compare. A ceiling read from an instance field is not available yet — return a literal from the getter.`);return e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.resolvingPeerCeiling=!1,this.agentId=e,this.description=t??``,this.threadId=n??Qc(),this.messages=DO(r??[]),this.state=DO(i??{}),this._debug=PO(a),this._debugLogger=LO(this._debug);let o=this.resolvedCeilingDuringConstruction();qT(o,`0.0.39`)<=0&&this.middlewares.unshift(new rA),qT(o,`0.0.45`)<=0&&this.middlewares.unshift(new lA),qT(o,`0.0.57`)<=0&&this.middlewares.unshift(new hA)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new jk(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Qc();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>bA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];vA.add(n),await this.onInitialize(n,a),this.activeRunDetach$=new Bu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await wd(ku(()=>[...this.middlewares,new Xk].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),Ok(this.debugLogger),hk(this.debugLogger),HO(this.debugLogger),e=>e.pipe(zd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Md(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Ld(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Sd(null)));let s=DO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new rl}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Qc();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>bA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new Bu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await wd(ku(()=>Ad(()=>this.connect(n)),e=>Ok(this.debugLogger)(Zk()(e)),hk(this.debugLogger),HO(this.debugLogger),e=>e.pipe(zd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Md(e=>(this.isRunning=!1,e instanceof rl?Wu:this.onError(n,e,a))),Ld(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Sd(null)),{defaultValue:void 0});let s=DO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}applyBeforeSourceError(e,t,n){return Ad(()=>{let r,i=t.pipe(Md(e=>(r={error:e},Wu)));return this.processApplyEvents(e,this.apply(e,i,n),n).pipe(Fd(Ad(()=>{let e=r;return e?z(()=>e.error):Wu})))})}apply(e,t,n){return BO(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Bd(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state!==void 0&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=DO(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Qc(),...qT(this.maxProtocolVersion,gA)>=0&&{protocolVersion:`1.0`},tools:DO(e?.tools??[]),context:DO(e?.context??[]),forwardedProps:DO(e?.forwardedProps??{}),state:DO(this.state),messages:n,...e?.resume===void 0?{}:{resume:DO(e.resume)}}}async onInitialize(e,t){if(vA.has(e)&&this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new L(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let t of this.pendingInterrupts)if(Qk(t)&&(e.resume??[]).find(e=>e.interruptId===t.id)?.status!==`cancelled`)throw new L(`Interrupt ${t.id} expired at ${t.expiresAt} and can no longer be answered. Cancel it to continue the thread.`)}let n=await NO(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages.filter(e=>e.role!==`activity`),t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state!==void 0&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return xd(NO(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(Td(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await NO(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=DO(this.messages),e.state=DO(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=DO(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=DO(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=DO(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Qc();let t=this.prepareRunAgentInput(e);return[...this.middlewares,new Xk].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t).pipe(Ok(this.debugLogger),hk(this.debugLogger),HO(this.debugLogger),tk(this.threadId,t.runId,this.agentId),e=>e.pipe(Td(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function SA(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var CA=class extends xA{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(SA(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=DO(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return XO(WO(()=>this.fetch(this.url,this.requestInit(kk(e)))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=DO(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},wA=M.createContext(void 0),TA=e=>{let t=M.useContext(wA);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},EA=({client:e,children:t})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,N.jsx)(wA.Provider,{value:e,children:t})),DA={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},OA=new class{#e=DA;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 kA(e){setTimeout(e,0)}var AA=typeof window>`u`||`Deno`in globalThis;function jA(){}function MA(e,t){return typeof e==`function`?e(t):e}function NA(e){return typeof e==`number`&&e>=0&&e!==1/0}function PA(e,t){return Math.max(e+(t||0)-Date.now(),0)}function FA(e,t){return typeof e==`function`?e(t):e}function IA(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==RA(o,t.options))return!1}else if(!BA(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 LA(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(zA(t.options.mutationKey)!==zA(a))return!1}else if(!BA(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function RA(e,t){return(t?.queryKeyHashFn||zA)(e)}function zA(e){return JSON.stringify(e,(e,t)=>GA(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function BA(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n500)return t;let r=WA(e)&&WA(t);if(!r&&!(GA(e)&&GA(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{OA.setTimeout(t,e)})}function JA(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:HA(e,t)}function YA(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function XA(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ZA=Symbol();function QA(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ZA?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function $A(e,t){return typeof e==`function`?e(...t):!!e}function ej(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 tj=()=>AA,nj=()=>tj(),rj=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(){}},ij=new class extends rj{#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`}},aj=kA;function oj(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=aj,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 sj=oj(),cj=new class extends rj{#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 lj(e){return Math.min(1e3*2**e,3e4)}function uj(e){return(e??`online`)!==`online`||cj.isOnline()}var dj=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function fj(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(jA);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new dj(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>ij.isFocused()&&(e.networkMode===`always`||cj.isOnline())&&e.canRun(),p=()=>uj(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(nj()?0:3),a=e.retryDelay??lj,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&nf()?void 0:g(f)).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var pj=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),NA(this.gcTime)&&(this.#e=OA.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(nj()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(OA.clearTimeout(this.#e),this.#e=void 0)}};function mj(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=>{ej(e,()=>t.signal,()=>n=!0)},u=QA(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?XA:YA;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?gj:hj,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:hj(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function hj(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 gj(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function _j(e,t){return t?hj(e,t)!=null:!1}function vj(e,t){return!t||!e.getPreviousPageParam?!1:gj(e,t)!=null}var yj=class extends pj{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sj(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sj(this.options);e.data!==void 0&&(this.setState(xj(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=JA(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(jA).catch(jA):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>FA(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ZA||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>FA(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!PA(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=QA(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?mj(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=fj({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof dj&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof dj){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...bj(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xj(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),sj.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function bj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:uj(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xj(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sj(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 Cj=class extends rj{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tj(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ej(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ej(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 FA(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&&!UA(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Dj(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||FA(this.options.enabled,this.#t)!==FA(t.enabled,this.#t)||FA(this.options.staleTime,this.#t)!==FA(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||FA(this.options.enabled,this.#t)!==FA(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return UA(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(jA)),t}#h(e){return!nj()&&FA(this.options.enabled,this.#t)!==!1&&NA(e)}#g(){this.#b();let e=FA(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=PA(this.#r.dataUpdatedAt,e)+1;this.#u=OA.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return FA(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=OA.setInterval(()=>{(this.options.refetchIntervalInBackground||ij.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(OA.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(OA.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Tj(e,t),o=i&&Dj(e,n,t,r);(a||o)&&(l={...l,...bj(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=JA(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=JA(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Oj(e,t),refetch:this.refetch,isEnabled:FA(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),UA(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();sj.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function wj(e,t){return FA(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||FA(t.retryOnMount,e)!==!1)}function Tj(e,t){return wj(e,t)||e.state.data!==void 0&&Ej(e,t,t.refetchOnMount)}function Ej(e,t,n){if(FA(t.enabled,e)!==!1&&FA(t.staleTime,e)!==`static`){let r=FA(n,e);return r===`always`||r!==!1&&Oj(e,t)}return!1}function Dj(e,t,n,r){return(e!==t||FA(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Oj(e,n)}function Oj(e,t){return FA(t.enabled,e)!==!1&&e.isStaleByTime(FA(t.staleTime,e))}var kj=class extends Cj{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:_j(t,n.data),hasPreviousPage:vj(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Aj=class extends pj{#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||jj(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=fj({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),sj.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function jj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Mj=class extends rj{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Aj({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=Nj(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=Nj(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=Nj(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Nj(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){sj.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=>LA(t,e))}findAll(e={}){return this.getAll().filter(t=>LA(e,t))}notify(e){sj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return sj.batch(()=>Promise.all(e.map(e=>e.continue().catch(jA))))}};function Nj(e){return e.options.scope?.id}var Pj=class extends rj{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??RA(r,t),a=this.get(i);return a||(a=new yj({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){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){sj.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=>IA(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>IA(e,t)):t}notify(e){sj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){sj.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sj.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Fj=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Pj,this.#t=e.mutationCache||new Mj,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ij.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=cj.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(FA(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=MA(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return sj.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;sj.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return sj.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=sj.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(jA).catch(jA)}invalidateQueries(e,t={}){return sj.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=sj.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(jA)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(jA)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(FA(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(FA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(jA).catch(jA)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(jA).catch(jA)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return cj.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(zA(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{BA(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(zA(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{BA(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||=RA(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===ZA&&(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()}},Ij=M.createContext(!1),Lj=()=>M.useContext(Ij);Ij.Provider;function Rj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var zj=M.createContext(Rj()),Bj=()=>M.useContext(zj),Vj=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?$A(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Hj=e=>{M.useEffect(()=>{e.clearReset()},[e])},Uj=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||$A(n,[e.error,r])),Wj=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))}},Gj=(e,t)=>e?.suspense&&t.isPending,Kj=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function qj(e,t,n){let r=Lj(),i=Bj(),a=TA(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Wj(o),Vj(o,i,s),Hj(i);let[l]=M.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(M.useSyncExternalStore(M.useCallback(e=>{let t=d?l.subscribe(sj.batchCalls(e)):jA;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),M.useEffect(()=>{l.setOptions(o)},[o,l]),Gj(o,u))throw Kj(o,l,i);if(Uj({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Jj(e,t){return qj(e,Cj,t)}function Yj(e,t){return qj(e,kj,t)}var Xj=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),Zj=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),Qj=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,44H160a43.86,43.86,0,0,0-32,13.85A43.86,43.86,0,0,0,96,44H24A12,12,0,0,0,12,56V200a12,12,0,0,0,12,12H96a20,20,0,0,1,20,20,12,12,0,0,0,24,0,20,20,0,0,1,20-20h72a12,12,0,0,0,12-12V56A12,12,0,0,0,232,44ZM96,188H36V68H96a20,20,0,0,1,20,20V192.81A43.79,43.79,0,0,0,96,188Zm124,0H160a43.71,43.71,0,0,0-20,4.83V88a20,20,0,0,1,20-20h60Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,56V200H160a32,32,0,0,0-32,32,32,32,0,0,0-32-32H24V56H96a32,32,0,0,1,32,32,32,32,0,0,1,32-32Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240,56V200a8,8,0,0,1-8,8H160a24,24,0,0,0-24,23.94,7.9,7.9,0,0,1-5.12,7.55A8,8,0,0,1,120,232a24,24,0,0,0-24-24H24a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H88a32,32,0,0,1,32,32v87.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V80a32,32,0,0,1,32-32h64A8,8,0,0,1,240,56Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,50H160a38,38,0,0,0-32,17.55A38,38,0,0,0,96,50H24a6,6,0,0,0-6,6V200a6,6,0,0,0,6,6H96a26,26,0,0,1,26,26,6,6,0,0,0,12,0,26,26,0,0,1,26-26h72a6,6,0,0,0,6-6V56A6,6,0,0,0,232,50ZM96,194H30V62H96a26,26,0,0,1,26,26V204.31A37.86,37.86,0,0,0,96,194Zm130,0H160a37.87,37.87,0,0,0-26,10.32V88a26,26,0,0,1,26-26h66Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,52H160a36,36,0,0,0-32,19.54A36,36,0,0,0,96,52H24a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H96a28,28,0,0,1,28,28,4,4,0,0,0,8,0,28,28,0,0,1,28-28h72a4,4,0,0,0,4-4V56A4,4,0,0,0,232,52ZM96,196H28V60H96a28,28,0,0,1,28,28V209.4A35.93,35.93,0,0,0,96,196Zm132,0H160a35.94,35.94,0,0,0-28,13.41V88a28,28,0,0,1,28-28h68Z`}))]]),$j=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128ZM60,112a16,16,0,1,0,16,16A16,16,0,0,0,60,112Zm136,0a16,16,0,1,0,16,16A16,16,0,0,0,196,112Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240,96v64a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V96A16,16,0,0,1,32,80H224A16,16,0,0,1,240,96Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V96A16,16,0,0,0,224,80ZM60,140a12,12,0,1,1,12-12A12,12,0,0,1,60,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,196,140Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM60,118a10,10,0,1,0,10,10A10,10,0,0,0,60,118Zm136,0a10,10,0,1,0,10,10A10,10,0,0,0,196,118Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-76-8a8,8,0,1,0,8,8A8,8,0,0,0,60,120Zm136,0a8,8,0,1,0,8,8A8,8,0,0,0,196,120Z`}))]]),eM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),tM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),nM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),rM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240.49,15.51a12,12,0,0,0-17,0L173.94,65.09l-2.54-2.55a36.05,36.05,0,0,0-50.91,0L100,83l-3.51-3.52a12,12,0,0,0-17,17L83,100,62.54,120.49a36,36,0,0,0,0,50.91l2.55,2.54L15.51,223.51a12,12,0,0,0,17,17l49.57-49.58,2.54,2.55a36.06,36.06,0,0,0,50.91,0L156,173l3.51,3.52a12,12,0,0,0,17-17L173,156l20.49-20.49a36,36,0,0,0,0-50.91l-2.55-2.54,49.58-49.57A12,12,0,0,0,240.49,15.51Zm-121.95,161a12,12,0,0,1-17,0L79.51,154.43a12,12,0,0,1,0-17L100,117l39,39Zm58-57.95h0L156,139l-39-39,20.49-20.49a12,12,0,0,1,17,0l22.06,22.06a12,12,0,0,1,0,17ZM85.27,33.37a12,12,0,0,1,21.46-10.74l8,16A12,12,0,1,1,93.27,49.37Zm-68,57.26a12,12,0,0,1,16.1-5.36l16,8a12,12,0,1,1-10.74,21.46l-16-8A12,12,0,0,1,17.27,90.63Zm221.46,74.74a12,12,0,0,1-16.1,5.36l-16-8a12,12,0,0,1,10.74-21.46l16,8A12,12,0,0,1,238.73,165.37Zm-68,57.26a12,12,0,1,1-21.46,10.74l-8-16a12,12,0,0,1,21.46-10.74Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M185,127,127,185a24,24,0,0,1-33.94,0L71,162.91A24,24,0,0,1,71,129L129,71a24,24,0,0,1,33.94,0L185,93.09A24,24,0,0,1,185,127Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32.06,32.06,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94h0L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22a16,16,0,0,1,0,22.63ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM29,103.43l20,8A8,8,0,1,0,55,96.57l-20-8A8,8,0,0,0,29,103.43ZM227,152.57l-20-8A8,8,0,1,0,201,159.43l20,8A8,8,0,0,0,227,152.57ZM159.43,201A8,8,0,0,0,144.57,207l8,20A8,8,0,1,0,167.43,221ZM237.91,18.52a8,8,0,0,0-11.5-.18L174,70.75l-5.38-5.38a32,32,0,0,0-45.28,0L106.14,82.54a4,4,0,0,0,0,5.66l61.7,61.66a4,4,0,0,0,5.66,0l16.74-16.74a32.76,32.76,0,0,0,9.81-22.52,31.82,31.82,0,0,0-9.37-23.17l-5.38-5.37,52.2-52.17A8.22,8.22,0,0,0,237.91,18.52ZM85.64,90.34a8,8,0,0,0-11.49.18,8.22,8.22,0,0,0,.41,11.37L80.67,108,65.34,123.31A31.82,31.82,0,0,0,56,146.47,32.75,32.75,0,0,0,65.77,169l5,4.94L18.49,226.13a8.21,8.21,0,0,0-.61,11.1,8,8,0,0,0,11.72.43L82,185.25l5.37,5.38a32.1,32.1,0,0,0,45.29,0L148,175.31l6.34,6.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M236.24,19.76a6,6,0,0,0-8.48,0L173.94,73.57l-6.79-6.78a30,30,0,0,0-42.42,0L100,91.51l-7.76-7.75a6,6,0,0,0-8.48,8.48L91.51,100,66.79,124.73a30,30,0,0,0,0,42.42l6.78,6.79L19.76,227.76a6,6,0,1,0,8.48,8.48l53.82-53.81,6.79,6.78a30,30,0,0,0,42.42,0L156,164.49l7.76,7.75a6,6,0,0,0,8.48-8.48L164.49,156l24.72-24.73a30,30,0,0,0,0-42.42l-6.78-6.79,53.81-53.82A6,6,0,0,0,236.24,19.76Zm-113.45,161a18,18,0,0,1-25.46,0L75.27,158.67a18,18,0,0,1,0-25.46L100,108.49,147.51,156Zm57.94-57.94L156,147.51,108.49,100l24.72-24.73a18,18,0,0,1,25.46,0l22.06,22.06a18,18,0,0,1,0,25.46ZM90.43,34.23a6,6,0,0,1,11.14-4.46l8,20a6,6,0,1,1-11.14,4.46Zm-64,59.54a6,6,0,0,1,7.8-3.34l20,8a6,6,0,1,1-4.46,11.14l-20-8A6,6,0,0,1,26.43,93.77Zm203.14,68.46a6,6,0,0,1-7.8,3.34l-20-8a6,6,0,0,1,4.46-11.14l20,8A6,6,0,0,1,229.57,162.23Zm-64,59.54a6,6,0,1,1-11.14,4.46l-8-20a6,6,0,0,1,11.14-4.46Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32,32,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22A16,16,0,0,1,179.31,121.37ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M234.83,21.17a4,4,0,0,0-5.66,0L173.94,76.4l-8.2-8.2a28,28,0,0,0-39.6,0L100,94.34l-9.17-9.17a4,4,0,0,0-5.66,5.66L94.34,100,68.2,126.14a28,28,0,0,0,0,39.6l8.2,8.2L21.17,229.17a4,4,0,0,0,5.66,5.66L82.06,179.6l8.2,8.2a28,28,0,0,0,39.6,0L156,161.66l9.17,9.17a4,4,0,0,0,5.66-5.66L161.66,156l26.14-26.14a28,28,0,0,0,0-39.6l-8.2-8.2,55.23-55.23A4,4,0,0,0,234.83,21.17Zm-110.63,161a20,20,0,0,1-28.28,0L73.86,160.08a20,20,0,0,1,0-28.28L100,105.66,150.34,156Zm57.94-57.94L156,150.34,105.66,100,131.8,73.86a20,20,0,0,1,28.28,0l22.06,22.06A20,20,0,0,1,182.14,124.2ZM92.29,33.49a4,4,0,1,1,7.42-3l8,20a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,104,56a4,4,0,0,1-3.71-2.51Zm-64,61a4,4,0,0,1,5.2-2.22l20,8A4,4,0,0,1,52,108a3.91,3.91,0,0,1-1.49-.29l-20-8A4,4,0,0,1,28.29,94.51Zm199.42,67A4,4,0,0,1,224,164a3.91,3.91,0,0,1-1.49-.29l-20-8a4,4,0,1,1,3-7.42l20,8A4,4,0,0,1,227.71,161.49Zm-64,61a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,160,228a4,4,0,0,1-3.71-2.51l-8-20a4,4,0,0,1,7.42-3Z`}))]]),iM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),aM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),oM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z`}))]]),sM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),cM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z`}))]]),lM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z`}))]]),uM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:Xj}));uM.displayName=`ArrowLeftIcon`;var dM=uM,fM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:Zj}));fM.displayName=`ArrowRightIcon`;var pM=fM,mM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:Qj}));mM.displayName=`BookOpenIcon`;var hM=mM,gM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:$j}));gM.displayName=`DotsThreeIcon`;var _M=gM,vM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:eM}));vM.displayName=`MagnifyingGlassIcon`;var yM=vM,bM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:tM}));bM.displayName=`MoonIcon`;var xM=bM,SM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:nM}));SM.displayName=`PencilSimpleIcon`;var CM=SM,wM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:rM}));wM.displayName=`PlugsConnectedIcon`;var TM=wM,EM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:iM}));EM.displayName=`PlusIcon`;var DM=EM,OM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:aM}));OM.displayName=`SignOutIcon`;var kM=OM,AM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:oM}));AM.displayName=`SparkleIcon`;var jM=AM,MM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:sM}));MM.displayName=`SunIcon`;var NM=MM,PM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:cM}));PM.displayName=`TrashIcon`;var FM=PM,IM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:lM}));IM.displayName=`UserPlusIcon`;var LM=IM,RM=class extends Error{status;problems;code;constructor(e,t,n=[],r=``){super(e),this.status=t,this.problems=n,this.code=r}},zM=`fanout:unauthorized`;function BM(){let e=new URLSearchParams(window.location.search).get(`return_to`);if(!e)return``;let t=new URL(e,window.location.origin);return t.origin!==window.location.origin||t.pathname!==`/api/auth/oauth/authorize`?``:`${t.pathname}${t.search}`}function VM(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function HM(){window.dispatchEvent(new Event(zM))}async function UM(e,t={}){let n=new Headers(t.headers);n.set(`Fanout-Request`,`1`);let r=await fetch(e,{...t,headers:n,credentials:`same-origin`});if(r.status===401&&HM(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw new RM(e.message??`You do not have permission to perform this action.`,r.status,[],e.code??``)}return r}async function WM(){let e=await UM(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&HM(),window.location.assign(`/`)}var GM=(0,M.createContext)(null);function KM(){let e=(0,M.useContext)(GM);if(!e)throw Error(`Fanout runtime status is unavailable`);return e}var qM=(0,M.createContext)(null);function JM(){let e=(0,M.useContext)(qM);if(!e)throw Error(`Fanout viewer is unavailable`);return e}function YM(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||t.id===``||t.status!==`active`&&t.status!==`suspended`?null:{id:t.id,email:typeof t.email==`string`?t.email:``,display_name:typeof t.display_name==`string`?t.display_name:``,status:t.status,role:typeof t.role==`string`?t.role:``}}async function XM(e,t){let n=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:t===void 0?void 0:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t),credentials:`same-origin`}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.message??`Request failed (${n.status})`);return r}function ZM({children:e,wide:t=!1}){return(0,N.jsx)(u,{mih:`100dvh`,style:{background:`radial-gradient(circle at 50% -12%, var(--mantine-color-brand-light), transparent 38%), linear-gradient(180deg, var(--mantine-color-default-hover), var(--mantine-color-body) 62%)`},children:(0,N.jsx)(je,{mih:`100dvh`,px:`md`,py:48,children:(0,N.jsx)(ve,{size:t?680:480,w:`100%`,children:(0,N.jsx)(Fe,{radius:28,p:{base:24,sm:40},style:{background:`var(--mantine-color-body)`,border:`1px solid var(--mantine-color-default-border)`,boxShadow:`var(--mantine-shadow-xl)`},children:e})})})})}function QM(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function $M(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function eN({children:e}){let t=ze(),[n,r]=(0,M.useState)(null),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(`none`),[c,l]=(0,M.useState)(null),[d,f]=(0,M.useState)(!1),[p,m]=(0,M.useState)(``),[h,g]=(0,M.useState)(``),[_,v]=(0,M.useState)(QM),[y,b]=(0,M.useState)($M),[x,S]=(0,M.useState)(``),[C,w]=(0,M.useState)(!1),[T,ee]=(0,M.useState)(0),[E,D]=(0,M.useState)(()=>Date.now()),[O,te]=(0,M.useState)(!1),[re,k]=(0,M.useState)(``),[ie,ae]=(0,M.useState)(null),[se,le]=(0,M.useState)(!1),de=(0,M.useRef)(null),fe=BM(),pe=o===`user`;async function he(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){s(`none`),l(null);return}let t=await e.json().catch(()=>null);s(VM(t)),l(YM(t))}async function ge(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;l(YM(await e.json().catch(()=>null)))}catch{}}(0,M.useEffect)(()=>{let e=new URL(window.location.href);(e.searchParams.has(`setup_token`)||e.searchParams.has(`login_token`))&&(e.searchParams.delete(`setup_token`),e.searchParams.delete(`login_token`),t({href:e.pathname+e.search+e.hash,replace:!0}))},[t]),(0,M.useEffect)(()=>{XM(`/api/auth/status`).then(r).catch(e=>k(String(e))).finally(()=>a(!0)),he().catch(()=>s(`none`)).finally(()=>f(!0));let e=()=>{s(`none`),l(null)};return window.addEventListener(zM,e),()=>window.removeEventListener(zM,e)},[]),(0,M.useEffect)(()=>{d&&o===`none`&&y&&(te(!0),k(``),XM(`/api/auth/link/verify`,{token:y}).then(()=>{s(`user`),ge()}).catch(e=>k(e instanceof Error?e.message:String(e))).finally(()=>{b(``),te(!1)}))},[y,d,o]),(0,M.useEffect)(()=>{pe&&d&&fe&&window.location.replace(fe)},[pe,fe,d]),(0,M.useEffect)(()=>{if(T<=Date.now())return;let e=setInterval(()=>{D(Date.now()),Date.now()>=T&&clearInterval(e)},1e3);return()=>clearInterval(e)},[T]);let _e=Math.max(0,Math.ceil((T-E)/1e3));(0,M.useEffect)(()=>{C&&!O&&re&&de.current?.querySelector(`input`)?.focus()},[O,C,re]);async function ve(e){try{await navigator.clipboard.writeText(e),le(!0)}catch{k(`Clipboard access failed. Select and copy the token manually.`)}}if(ie?.ingest_token)return(0,N.jsx)(ZM,{wide:!0,children:(0,N.jsxs)(oe,{gap:`lg`,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Setup complete`}),(0,N.jsx)(xe,{order:1,mt:`xs`,fz:{base:28,sm:32},lh:1.08,children:`Save your ingest token`})]}),(0,N.jsx)(ue,{c:`dimmed`,children:`Fanout shows this token once. Store it with your collector secrets before continuing.`}),(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,N.jsx)(ms,{block:!0,children:ie.suggested_endpoint??window.location.origin})]}),(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`Header`}),(0,N.jsxs)(ms,{block:!0,children:[ie.ingest_header_name??`Authorization`,`: Bearer `,ie.ingest_token]})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),(0,N.jsxs)(ne,{grow:!0,align:`stretch`,children:[(0,N.jsx)(ce,{variant:`light`,radius:`md`,leftSection:se?(0,N.jsx)(me,{size:16,weight:`bold`}):(0,N.jsx)(Ee,{size:16}),onClick:()=>void ve(`${ie.ingest_header_name??`Authorization`}: Bearer ${ie.ingest_token}`),children:se?`Copied`:`Copy header`}),(0,N.jsx)(ce,{radius:`md`,rightSection:(0,N.jsx)(pM,{size:16,weight:`bold`}),onClick:()=>{s(`user`),ae(null),ge()},children:`Continue to Fanout`})]}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ve(ie.ingest_token??``),children:`Copy token only`})]})});if(!d||!i||y)return(0,N.jsx)(je,{mih:`100dvh`,children:(0,N.jsx)(Ie,{size:`sm`})});if(!n)return(0,N.jsx)(ZM,{children:(0,N.jsxs)(oe,{gap:`lg`,children:[(0,N.jsx)(ke,{}),(0,N.jsx)(xe,{order:1,children:`Fanout is unavailable`}),(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re||`Authentication status could not be loaded.`})]})});if(pe&&fe)return null;if(pe)return(0,N.jsx)(GM.Provider,{value:n,children:(0,N.jsx)(qM.Provider,{value:c??{id:``,email:p,display_name:h,status:`active`,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=fe?`/api/auth/oidc/start?return_to=${encodeURIComponent(fe)}`:`/api/auth/oidc/start`;return(0,N.jsx)(ZM,{children:(0,N.jsxs)(oe,{gap:28,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(oe,{gap:10,children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Secure workspace`}),(0,N.jsx)(xe,{order:1,fz:{base:28,sm:32},lh:1.08,children:`Sign in`}),(0,N.jsx)(ue,{c:`dimmed`,size:`md`,lh:1.6,children:`Use your organization's identity provider to continue.`})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),(0,N.jsx)(ce,{component:`a`,href:e,size:`md`,radius:`md`,rightSection:(0,N.jsx)(pM,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function ye(){te(!0),k(``);try{await XM(`/api/auth/code/send`,{email:p}),w(!0),S(``),ee(Date.now()+3e4),D(Date.now())}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}async function A(e){te(!0),k(``);try{await XM(`/api/auth/code/verify`,{email:p,code:e}),s(`user`),w(!1),S(``),ee(0),ge()}catch(e){S(``),k(e instanceof Error?e.message:String(e))}finally{te(!1)}}function j(){w(!1),S(``),k(``)}async function be(e){e.preventDefault(),te(!0),k(``);try{if(n?.setup_required){let e=await XM(`/api/auth/setup`,{email:p,display_name:h,setup_token:_});e.ingest_token?ae(e):(s(`user`),ge())}else if(C){await A(x);return}else{await ye();return}}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}let Se=C&&!n?.setup_required,we=n?.setup_required?`Create the first admin`:Se?`Check your email`:n?.self_signup?`Sign in or create an account`:`Sign in`,Te=n?.setup_required?`Use the one-time token printed by the Fanout process.`:n?.smtp_configured?Se?`We sent a code to ${p}.`:n?.self_signup?`Enter your email to sign in or create a viewer account. No password needed.`:`Enter your email and we’ll send a short verification code. No password needed.`:`Email delivery is not configured. Ask the operator to run fanout login-link with your email address.`;return(0,N.jsx)(ZM,{children:(0,N.jsxs)(oe,{gap:28,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(oe,{gap:10,children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:n?.setup_required?`One-time setup`:`Secure workspace`}),(0,N.jsx)(xe,{order:1,fz:{base:28,sm:32},lh:1.08,children:we}),Te&&(0,N.jsx)(ue,{c:`dimmed`,size:`md`,lh:1.6,maw:390,children:Te})]}),(0,N.jsx)(`form`,{onSubmit:be,children:(0,N.jsxs)(oe,{gap:`md`,children:[(0,N.jsx)(Gc,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:p,onChange:e=>m(e.currentTarget.value),disabled:C,variant:`filled`,radius:`md`,size:`md`,autoFocus:!C}),n?.setup_required&&(0,N.jsx)(Gc,{label:`Display name`,placeholder:`Your display name`,value:h,onChange:e=>g(e.currentTarget.value),variant:`filled`,radius:`md`,size:`md`}),n?.setup_required&&(0,N.jsx)(Gc,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:_,onChange:e=>v(e.currentTarget.value),autoComplete:`one-time-code`,variant:`filled`,radius:`md`,size:`md`}),Se&&(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`Verification code`}),(0,N.jsx)(u,{ref:de,children:(0,N.jsx)(Wc,{length:6,type:`number`,oneTimeCode:!0,autoFocus:!0,value:x,onChange:S,onComplete:e=>void A(e),disabled:O,error:!!re,size:`md`,radius:`md`,"aria-label":`Verification code`,getInputProps:e=>({"aria-label":`Digit ${e+1}`})})}),(0,N.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,N.jsxs)(ue,{c:`dimmed`,size:`xs`,children:[`Sent to `,p]}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,leftSection:(0,N.jsx)(dM,{size:12,weight:`bold`}),onClick:j,disabled:O,children:`Change email`})]}),(0,N.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,children:`Codes expire in 5 minutes`}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ye(),disabled:O||_e>0,children:_e>0?`Resend in ${_e}s`:`Resend code`})]})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),Se?(0,N.jsx)(ce,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:O||x.length<6,rightSection:(0,N.jsx)(pM,{size:17,weight:`bold`}),children:`Verify code`}):(0,N.jsx)(ce,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:!n||!n.setup_required&&!n.smtp_configured,leftSection:n?.setup_required?(0,N.jsx)(LM,{size:17,weight:`bold`}):void 0,rightSection:n?.setup_required?void 0:(0,N.jsx)(pM,{size:17,weight:`bold`}),children:n?.setup_required?`Create admin`:`Send code`})]})})]})})}var tN=[`agent-threads`];async function nN(e){let t=await UM(e);if(!t.ok)throw Error(`Request failed (${t.status})`);return t.json()}var rN=[];for(let e=0;e<256;++e)rN.push((e+256).toString(16).slice(1));function iN(e,t=0){return(rN[e[t+0]]+rN[e[t+1]]+rN[e[t+2]]+rN[e[t+3]]+`-`+rN[e[t+4]]+rN[e[t+5]]+`-`+rN[e[t+6]]+rN[e[t+7]]+`-`+rN[e[t+8]]+rN[e[t+9]]+`-`+rN[e[t+10]]+rN[e[t+11]]+rN[e[t+12]]+rN[e[t+13]]+rN[e[t+14]]+rN[e[t+15]]).toLowerCase()}var aN=new Uint8Array(16);function oN(){return crypto.getRandomValues(aN)}var sN={};function cN(e,t,n){let r;if(e)r=uN(e.random??e.rng?.()??oN(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=oN();lN(sN,e,i),r=uN(i,sN.msecs,sN.seq,t,n)}return t??iN(r)}function lN(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=dN(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function uN(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=dN(e),r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}function dN(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function fN(){return cN()}var pN=[`dashboards`],mN=3e4;async function hN(e,t){let{json:n,...r}=t??{},i=new Headers(r.headers),a=r.body;n!==void 0&&(i.set(`content-type`,`application/json`),a=JSON.stringify(n));let o=await UM(e,{...r,headers:i,body:a}),s=await o.json().catch(()=>({}));if(!o.ok)throw new RM(s.message??`Request failed (${o.status})`,o.status,s.problems??[],s.code??``);return s}var gN=e=>`/api/dashboards/${encodeURIComponent(e)}`,_N=()=>hN(`/api/dashboards`).then(e=>e.dashboards),vN=(e,t)=>hN(gN(e),{signal:t}),yN=(e,t)=>hN(`${gN(e)}/versions`,{signal:t}).then(e=>e.versions),bN=(e,t,n)=>hN(`${gN(e)}/versions/${t}`,{signal:n}),xN=(e,t)=>hN(`${gN(e)}/versions/${t}/restore`,{method:`POST`}),SN=(e,t,n,r)=>hN(gN(e),{method:`PUT`,json:{spec:t,base_version:n,message:r}}),CN=(e,t,n,r)=>hN(gN(e),{method:`PATCH`,json:{operations:t,base_version:n,message:r}}),wN=(e,t)=>hN(`/api/panels/query`,{method:`POST`,json:e,signal:t}).then(e=>e.results),TN=e=>hN(`/api/telemetry/schema`,{signal:e}),EN=(e,t)=>hN(`/api/annotations`,{method:`POST`,json:e,signal:t}),DN=(e,t)=>hN(`/api/panels/variables/resolve`,{method:`POST`,json:e,signal:t}).then(e=>e.options),ON=(e,t)=>hN(`/api/panels/exemplars`,{method:`POST`,json:e,signal:t});function kN(e,t){let n=new URLSearchParams({namespace:e.namespace??``,from:e.window_from,to:e.window_to,limit:`200`});return hN(`/api/traces/${encodeURIComponent(e.trace_id??``)}?${n}`,{signal:t})}function AN(){let{setColorScheme:e}=Br(),t=Ur(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,M.useState)(!1);return(0,N.jsx)(Ot,{label:`Switch to ${n} theme`,opened:r,children:(0,N.jsx)(Pi,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onFocus:()=>i(!0),onBlur:()=>i(!1),onClick:()=>{i(!1),e(n)},children:t===`dark`?(0,N.jsx)(NM,{size:17,weight:`bold`}):(0,N.jsx)(xM,{size:17,weight:`bold`})})})}var jN={home:`https://fanout.run/start/what-fanout-is`,ingest:`https://fanout.run/start/send-telemetry`,connect:`https://fanout.run/guides/connect-over-mcp`};async function MN(e,t){let n=new URLSearchParams({page_size:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await UM(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function NN({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=TA(),[f,p]=(0,M.useState)(``),[m]=pr(f.trim(),250),[h,g]=(0,M.useState)(null),[_,v]=(0,M.useState)(null),[y,b]=(0,M.useState)(``),[x,S]=(0,M.useState)(``),[w,T]=(0,M.useState)(!1),ee=(0,M.useRef)(null);(0,M.useImperativeHandle)(u,()=>({focusSearch:()=>ee.current?.focus()}),[]),(0,M.useEffect)(()=>{r&&requestAnimationFrame(()=>ee.current?.focus())},[r]);let E=Yj({queryKey:[...tN,m],queryFn:({pageParam:e})=>MN(m,e),initialPageParam:``,getNextPageParam:e=>e.next_cursor??void 0,enabled:e}),D=Jj({queryKey:pN,queryFn:_N,refetchInterval:3e4,staleTime:mN}),O=(0,M.useMemo)(()=>E.data?.pages.flatMap(e=>e.items)??[],[E.data]),te=(0,M.useMemo)(()=>zN(O),[O]),re=Jj({queryKey:[`telemetry-schema`,`1h`],queryFn:()=>nN(`/api/telemetry/schema?window=1h`),enabled:!!m&&!!l,staleTime:6e4}),k=(0,M.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(re.data?.services??[]).map(e=>e.value).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[re.data,m]),ie=(0,M.useMemo)(()=>{let e=D.data??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[D.data,m]);function ae(e){S(``),b(e.title),g(e)}async function se(){if(h&&y.trim()){T(!0),S(``);try{let e=await UM(`/api/agent/threads/${encodeURIComponent(h.id)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:y.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:tN}),g(null)}catch(e){S(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{T(!1)}}}async function le(){if(_){T(!0),S(``);try{let e=await UM(`/api/agent/threads/${encodeURIComponent(_.id)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.id;v(null),await d.invalidateQueries({queryKey:tN}),await d.invalidateQueries({queryKey:pN}),o(t)}catch(e){S(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{T(!1)}}}return(0,N.jsxs)(oe,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,N.jsx)(ce,{leftSection:(0,N.jsx)(DM,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,N.jsx)(wt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,N.jsxs)(oe,{gap:`lg`,pb:`sm`,children:[e&&(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(PN,{children:`Chats`}),E.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),E.isError&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!E.isLoading&&!E.isError&&O.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),te.map(e=>(0,N.jsxs)(oe,{gap:2,children:[te.length>1&&(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,N.jsx)(FN,{thread:e,active:e.id===t,onSelect:()=>a(e.id),onRename:()=>ae(e),onDelete:()=>{S(``),v(e)}},e.id))]},e.label)),E.hasNextPage&&(0,N.jsx)(ce,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:E.isFetchingNextPage,onClick:()=>void E.fetchNextPage(),children:`See all`})]}),m&&l&&re.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),m&&l&&(re.isSuccess||re.isError)&&(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(PN,{children:`Services`}),re.isError&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,children:`Services could not be searched`}),re.isSuccess&&k.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,children:`No matching services`}),k.map(e=>(0,N.jsx)(C,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,N.jsx)(ue,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(PN,{children:`Dashboards`}),D.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),D.isError&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!D.isLoading&&!D.isError&&m&&ie.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),ie.map(e=>{let t=e.id===n;return(0,N.jsxs)(oe,{gap:0,children:[(0,N.jsx)(C,{component:`a`,href:`/dashboards/${encodeURIComponent(e.id)}`,className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),s(e.id))},children:(0,N.jsxs)(ne,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,N.jsx)(ue,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,N.jsx)(cs,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})}),e.origin&&(0,N.jsx)(C,{component:`a`,href:`/chat/${encodeURIComponent(e.origin.thread_id)}`,"data-request-provenance":!0,px:`sm`,pb:`xs`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),a(e.origin.thread_id))},children:(0,N.jsxs)(ue,{size:`xs`,c:`dimmed`,lineClamp:2,children:[`Built from: `,e.origin.request_excerpt]})})]},e.id)}),e&&(0,N.jsx)(ce,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,N.jsx)(jM,{size:14,weight:`fill`}),onClick:c,children:D.data?.length===0?`New dashboard`:`Create with AI`})]})]})}),(0,N.jsx)(Gc,{ref:ee,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,N.jsx)(yM,{size:15}),rightSection:(0,N.jsx)(Ls,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,N.jsx)(Rc,{opened:h!==null,onClose:()=>!w&&g(null),title:`Rename chat`,centered:!0,children:(0,N.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),se()},children:(0,N.jsxs)(oe,{children:[(0,N.jsx)(Gc,{label:`Name`,value:y,onChange:e=>b(e.currentTarget.value),maxLength:120,autoFocus:!0}),x&&(0,N.jsx)(Ce,{color:`bad`,children:x}),(0,N.jsxs)(ne,{justify:`flex-end`,children:[(0,N.jsx)(ce,{variant:`default`,onClick:()=>g(null),disabled:w,children:`Cancel`}),(0,N.jsx)(ce,{type:`submit`,loading:w,disabled:!y.trim(),children:`Save`})]})]})})}),(0,N.jsx)(Rc,{opened:_!==null,onClose:()=>!w&&v(null),title:`Delete chat?`,centered:!0,children:(0,N.jsxs)(oe,{children:[(0,N.jsxs)(ue,{size:`sm`,children:[`This permanently removes `,(0,N.jsx)(ue,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),x&&(0,N.jsx)(Ce,{color:`bad`,children:x}),(0,N.jsxs)(ne,{justify:`flex-end`,children:[(0,N.jsx)(ce,{variant:`default`,onClick:()=>v(null),disabled:w,children:`Cancel`}),(0,N.jsx)(ce,{color:`bad`,loading:w,onClick:()=>void le(),children:`Delete`})]})]})})]})}function PN({children:e}){return(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function FN({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,N.jsx)(u,{"data-active":t||void 0,className:`rail-row`,children:(0,N.jsxs)(ne,{gap:2,wrap:`nowrap`,children:[(0,N.jsx)(C,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,N.jsxs)(oe,{gap:0,children:[(0,N.jsx)(ue,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,children:BN(e.updated_at)})]})}),(0,N.jsxs)(Sc,{position:`bottom-end`,withinPortal:!0,children:[(0,N.jsx)(Sc.Target,{children:(0,N.jsx)(Pi,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,N.jsx)(_M,{size:18,weight:`bold`})})}),(0,N.jsxs)(Sc.Dropdown,{children:[(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(CM,{size:15}),onClick:r,children:`Rename`}),(0,N.jsx)(Sc.Item,{color:`bad`,leftSection:(0,N.jsx)(FM,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function IN(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function LN(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var RN=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function zN(e){let t=LN(new Date),n=new Map;for(let r of e){let e=Math.floor((t-LN(IN(r.updated_at)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return RN.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function BN(e){let t=IN(e),n=LN(new Date);return Math.floor((n-LN(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function VN({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=Qe(),s=ze(),c=Xn({select:e=>e.location.pathname}),{dashboardId:l}=Sn({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=Dr(!1),[p,m]=(0,M.useState)(!1),[h,g]=(0,M.useState)(``),_=(0,M.useRef)(null),v=ie(`(max-width: 62em)`),y=(0,M.useRef)(v);y.current=v,(0,M.useEffect)(()=>{f.close()},[c]),(0,M.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{}}),onCreateDashboard:()=>o(tt),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,N.jsxs)(Jo,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,N.jsx)(Jo.Header,{children:(0,N.jsxs)(ne,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,N.jsxs)(ne,{gap:`sm`,wrap:`nowrap`,children:[(0,N.jsx)(ds,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,N.jsx)(ke,{size:`small`})]}),(0,N.jsxs)(ne,{gap:`xs`,wrap:`nowrap`,children:[(0,N.jsx)(Ot,{label:`Documentation`,children:(0,N.jsx)(Pi,{component:`a`,href:jN.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,N.jsx)(hM,{size:17,weight:`bold`})})}),(0,N.jsx)(AN,{}),(0,N.jsx)(HN,{onError:g})]})]})}),(0,N.jsx)(Jo.Navbar,{p:`sm`,children:(0,N.jsx)(NN,{ref:_,...b})}),(0,N.jsx)(Ps,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,N.jsx)(ke,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,N.jsx)(NN,{...b,autoFocusSearch:d&&p})}),(0,N.jsxs)(Jo.Main,{children:[h&&(0,N.jsx)(Ce,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function HN({onError:e}){let t=ze(),n=JM(),r=(n.display_name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,N.jsxs)(Sc,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,N.jsx)(Sc.Target,{children:(0,N.jsx)(Pi,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`${r} account menu`,children:(0,N.jsx)(as,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,N.jsxs)(Sc.Dropdown,{children:[(0,N.jsx)(Sc.Label,{children:n.email||`Signed in`}),(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(TM,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,N.jsx)(Sc.Divider,{}),(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(kM,{size:15}),onClick:()=>void WM().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function UN(){let{agent_available:e}=KM(),t=ze(),n=TA(),{threadId:r}=Sn({strict:!1}),[i,a]=(0,M.useState)(fN),o=(0,M.useRef)(new Set),s=r??i,[c,l]=(0,M.useState)([]),[u,d]=(0,M.useState)({}),[f,p]=(0,M.useState)(``),[m,h]=(0,M.useState)(!1),[g,_]=(0,M.useState)(!1),[v,y]=(0,M.useState)(``),[b,x]=(0,M.useState)(!1),S=(0,M.useRef)(!1),[C,w]=(0,M.useState)(``),[T,ee]=(0,M.useState)(``),[E,D]=(0,M.useState)(0),O=(0,M.useRef)(null),te=(0,M.useRef)({}),ne=(0,M.useRef)(null),re=(0,M.useRef)(new Map),k=(0,M.useMemo)(()=>new CA({url:`/api/agent/runs`,threadId:s,fetch:(e,t)=>UM(e,t)}),[s]),ie=!e||f===s;function ae(){re.current.clear(),y(``)}function oe(e){return S.current||e instanceof Error&&e.name===`AbortError`}(0,M.useEffect)(()=>{let t=!0;if(l([]),te.current={},d({}),p(``),h(!1),_(!1),S.current=!1,x(!1),ae(),ee(``),!e){p(s);return}!r||o.current.has(s)?(k.setMessages([]),p(s)):UM(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}k.setMessages(e.messages??[]),l(e.messages??[]),p(s)}}).catch(()=>{t&&(O.current=null,ee(`This chat could not be restored. Start a new chat or try again.`))});let i=k.subscribe({onMessagesChanged:({messages:e})=>l([...e]),onRunInitialized:()=>{S.current=!1,x(!1),_(!0),ee(``)},onTextMessageContentEvent:({event:e})=>{e.delta&&y(``)},onToolCallStartEvent:({event:e})=>{re.current.set(e.toolCallId,at(e.toolCallName)),y(at(e.toolCallName))},onToolCallResultEvent:({event:e,messages:t})=>{re.current.delete(e.toolCallId),y([...re.current.values()].at(-1)??`Analyzing your system`);let r=$e(e.toolCallId,e.content,t);r&&(n.invalidateQueries({queryKey:pN}),n.invalidateQueries({queryKey:[`dashboard`,r.id]}),n.invalidateQueries({queryKey:[`dashboard-versions`,r.id]}))},onRunErrorEvent:({event:e})=>{e.code===`abort`||S.current?(ee(``),x(!0)):(console.warn(`Agent run error`,e.code),ee(Xe(e.code))),_(!1),ae()},onRunFinalized:({messages:e})=>{let t=[...e];l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),ae(),o.current.delete(s),n.invalidateQueries({queryKey:tN})},onRunFailed:e=>{oe(e.error)?(ee(``),x(!0)):(console.error(`Agent run failed`,e),ee(Xe())),_(!1),ae(),o.current.delete(s),n.invalidateQueries({queryKey:tN})}});return()=>{t=!1,i.unsubscribe(),k.abortRun()}},[k,e,n,E,s]),(0,M.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ne.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ne.current?.focus()))),e.key===`Escape`&&n===ne.current&&(w(``),ne.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function se(){_(!0),ee(``);try{let{context:e=[],...t}=te.current;await k.runAgent({context:e,forwardedProps:t})}catch(e){oe(e)?(ee(``),x(!0)):(console.error(`Agent run failed`,e),ee(Xe())),_(!1),ae(),o.current.delete(s)}}async function ce(n,i){let a=n.trim();if(!e||!a||g||!ie||m)return;te.current={...i},r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let c={id:fN(),role:`user`,content:a};k.addMessage(c),l([...k.messages]),d(e=>({...e,[c.id]:Date.now()})),w(``),await se()}(0,M.useEffect)(()=>{let e=O.current;ie&&r&&e&&(O.current=null,ce(e.text,e.options))},[ie,r,s]);function le(e){e.preventDefault(),ce(C)}function ue(){S.current=!0,ee(``),x(!0),k.abortRun(),_(!1),ae(),o.current.delete(s)}function de(){!g&&k.messages.some(e=>e.role===`user`)&&se()}function fe(n,r){if(!e)return;let i=fN();o.current.add(i),O.current=n?{text:n,options:{...r}}:null,t({to:`/chat/$threadId`,params:{threadId:i}})}function pe(){k.abortRun(),O.current=null,te.current={},a(fN()),t({to:`/chat`})}function me(e){O.current=null,te.current={},t({to:`/chat/$threadId`,params:{threadId:e}})}function he(){D(e=>e+1)}return(0,N.jsx)(it.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:ie,running:g,activity:v,stopped:b,input:C,setInput:w,error:T,inputRef:ne,send:ce,submit:le,stop:ue,retry:de,reloadThread:he,openChat:fe,newThread:pe,selectThread:me},children:(0,N.jsx)(VN,{children:(0,N.jsx)(Bn,{})})})}function WN(){let e=(0,M.useMemo)(()=>new Fj,[]);return(0,N.jsx)(EA,{client:e,children:(0,N.jsx)(eN,{children:(0,N.jsx)(UN,{})})})}var GN=On({component:WN,notFoundComponent:()=>(0,N.jsx)(Ve,{to:`/`,replace:!0})}),KN=kn(`/`)({component:An(()=>ot(()=>import(`./routes-D2AdaqvY.js`),__vite__mapDeps([0,1,2])),`component`)}),qN=kn(`/settings`)({component:An(()=>ot(()=>import(`./settings-NQwuPzSG.js`),__vite__mapDeps([3,1,4,5,6])),`component`)}),JN=kn(`/chat/`)({component:An(()=>ot(()=>import(`./chat.index-BzKwvTFN.js`),__vite__mapDeps([7,8,1,4,9,5,10])),`component`)}),YN=kn(`/chat/$threadId`)({component:An(()=>ot(()=>import(`./chat._threadId-BzKwvTFN.js`),__vite__mapDeps([11,8,1,4,9,5,10])),`component`)});function XN(e){try{let t=typeof e==`string`?e:JSON.stringify(e);if(!t||t.length>4096)return;let n=typeof e==`string`?JSON.parse(e):e;if(!n||typeof n!=`object`)return;let r=n;return typeof r.panel_id!=`string`||!/^([a-z][a-z0-9_]{0,39})$/.test(r.panel_id)||r.kind!==`traces`&&r.kind!==`logs`||typeof r.from!=`string`||typeof r.to!=`string`||!Number.isFinite(Date.parse(r.from))||!Number.isFinite(Date.parse(r.to))||Date.parse(r.from)>=Date.parse(r.to)||Date.parse(r.to)-Date.parse(r.from)>2592e6||typeof r.window_from!=`string`||typeof r.window_to!=`string`||!Number.isFinite(Date.parse(r.window_from))||!Number.isFinite(Date.parse(r.window_to))||Date.parse(r.window_from)>=Date.parse(r.window_to)||Date.parse(r.window_to)-Date.parse(r.window_from)>2592e6||Date.parse(r.from)Date.parse(r.window_to)||!r.dimensions||Array.isArray(r.dimensions)||typeof r.dimensions!=`object`||Object.keys(r.dimensions).length>3||Object.values(r.dimensions).some(e=>typeof e!=`string`||e.length>500)||r.trace_id!==void 0&&(typeof r.trace_id!=`string`||r.trace_id.length>128)||r.namespace!==void 0&&(typeof r.namespace!=`string`||r.namespace.length>200)||r.bucket&&(!Number.isFinite(r.bucket.lower)||r.bucket.lower<0||r.bucket.upper!==void 0&&(!Number.isFinite(r.bucket.upper)||r.bucket.upper<=r.bucket.lower))?void 0:{panel_id:r.panel_id,kind:r.kind,from:r.from,to:r.to,window_from:r.window_from,window_to:r.window_to,dimensions:r.dimensions,trace_id:r.trace_id,namespace:r.namespace,bucket:r.bucket}}catch{return}}function ZN(e,t,n){if(!e.drill&&e.viz!==`service_map`&&!n.trace_id||t.from_ms===void 0||t.to_ms===void 0)return;let r=t.from_ms,i=t.to_ms;if(n.from!==void 0&&n.to!==void 0&&(r=Math.max(r,Date.parse(n.from)),i=Math.min(i,Date.parse(n.to))),n.time!==void 0&&!n.trace_id){let e=/^(\d+)(s|m|h|d)$/.exec(t.interval??``),a=e?Number(e[1])*{s:1e3,m:6e4,h:36e5,d:864e5}[e[2]]:6e4;r=Math.max(r,n.time),i=Math.min(i,n.time+a)}return XN(JSON.stringify({panel_id:e.id,kind:n.trace_id||e.viz===`service_map`?`traces`:e.drill,from:n.from&&Date.parse(n.from)===r?n.from:new Date(r).toISOString(),to:n.to&&Date.parse(n.to)===i?n.to:new Date(i).toISOString(),window_from:new Date(t.from_ms).toISOString(),window_to:new Date(t.to_ms).toISOString(),dimensions:n.dimensions,trace_id:n.trace_id,namespace:n.namespace,bucket:n.bucket}))}function QN(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))for(let e of Array.isArray(r)?r:[r]){if(e===void 0)continue;let r=typeof e==`string`&&/^[{"]/.test(e);t.append(n,r||typeof e==`object`&&e?JSON.stringify(e):String(e))}let n=t.toString();return n?`?${n}`:``}function $N(e){let t=Object.create(null),n=e=>{if(e.startsWith(`{`)||e.startsWith(`"`))try{let t=JSON.parse(e);if(typeof t==`string`)return/^[{"]/.test(t)?t:e;if(typeof t==`object`&&t&&!Array.isArray(t))return t}catch{}return e},r=new URLSearchParams(e);for(let e of new Set(r.keys())){let i=r.getAll(e).map(n);t[e]=i.length===1?i[0]:i}return t}var eP=[`5m`,`15m`,`1h`,`3h`,`6h`,`12h`,`24h`,`2d`,`7d`,`30d`],tP=[`off`,`10s`,`30s`,`1m`,`5m`],nP=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}[Tt](?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:[Zz]|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/.test(e)||Number.isNaN(Date.parse(e)))return!1;let[t,n,r]=e.slice(0,10).split(`-`).map(Number),i=new Date(0);return i.setUTCFullYear(t,n-1,r),i.setUTCHours(0,0,0,0),i.getUTCFullYear()===t&&i.getUTCMonth()===n-1&&i.getUTCDate()===r},rP=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):void 0;function iP(e){let t={};typeof e.range==`string`&&eP.includes(e.range)?t.range=e.range:nP(e.from)&&nP(e.to)&&Date.parse(e.from)typeof e==`string`)&&(i[e]=t)}}else{let t=rP(n);t!==void 0&&(i[e]=t)}}}Object.keys(i).length>0&&(t.vars=i);let a=XN(e.drill);return a&&(t.drill=JSON.stringify(a)),t}function aP(e){let t={};e.drill&&(t.drill=JSON.parse(e.drill)),e.range&&(t.range=e.range),e.from&&e.to&&(t.from=e.from,t.to=e.to),e.compare&&(t.compare=e.compare),e.view&&(t.view=e.view),e.edit&&(t.edit=e.edit);for(let[n,r]of Object.entries(e.vars??{}))t[`var-${n}`]=Array.isArray(r)?{values:r}:r;return t}function oP(e,t){let n=new URL(e);return n.search=QN(aP({...iP($N(n.search)),drill:JSON.stringify(t)})),n.href}function sP(e,t){let n=e.time.refresh??`30s`;return t.from&&t.to?{from:t.from,to:t.to,refresh:n}:t.range?{range:t.range,refresh:n}:{...e.time,refresh:n}}var cP=kn(`/dashboards/`)({component:An(()=>ot(()=>import(`./dashboards.index-D0Pptviw.js`),__vite__mapDeps([12,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>aP(iP(e))}),lP=kn(`/dashboards/$dashboardId`)({component:An(()=>ot(()=>import(`./dashboards._dashboardId-AkIsvXSZ.js`),__vite__mapDeps([14,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>aP(iP(e))}),uP=KN.update({id:`/`,path:`/`,getParentRoute:()=>GN}),dP=qN.update({id:`/settings`,path:`/settings`,getParentRoute:()=>GN}),fP=JN.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>GN}),pP=YN.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>GN}),mP=cP.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>GN}),hP={IndexRoute:uP,SettingsRoute:dP,ChatThreadIdRoute:pP,DashboardsDashboardIdRoute:lP.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>GN}),ChatIndexRoute:fP,DashboardsIndexRoute:mP},gP=Kn({routeTree:GN._addFileChildren(hP)._addFileTypes(),parseSearch:$N,stringifySearch:QN,defaultPreload:`intent`,scrollRestoration:!0}),_P=[`#fafafa`,`#e6e4de`,`#bfbdb6`,`#8b8e99`,`#565b69`,`#1d2433`,`#131721`,`#0b0e14`,`#080a10`,`#05070b`],vP=[`#f3ecfd`,`#ece3fb`,`#dcc9f7`,`#d2a6ff`,`#bf94ec`,`#a97ce0`,`#9163d6`,`#7c4dcc`,`#5b32a3`,`#40236f`],yP=[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],bP=[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],xP=[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],SP=[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`],CP={dark:{text:`#bfbdb6`,muted:`#8b8e99`,grid:`#1d2433`,surface:`#131721`,border:`#626777`},light:{text:`#4a5058`,muted:`#6b7280`,grid:`#eceef0`,surface:`#fcfcfc`,border:`#8c939d`}},wP={dark:[`#3987e5`,`#d95926`,`#199e70`,`#9085e9`,`#c98500`,`#d55181`],light:[`#2a78d6`,`#eb6834`,`#1baf7a`,`#4a3aa7`,`#eda100`,`#e87ba4`]},TP={micro:11,small:12,body:14,title:16,section:22,page:32},EP={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`},DP={brand:vP,ok:yP,warn:bP,bad:xP,info:SP},OP={light:7,dark:5};function kP(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function AP(e){let t=kP(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function jP(e){return Object.fromEntries(Object.entries(DP).map(([t,n])=>[`--fanout-color-${t}-contrast`,AP(n[OP[e]])]))}function MP(e){return t=>{let n=t.color??FP.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(DP,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var NP=.25,PP={xs:9,sm:10,md:11,lg:13,xl:16},FP={primaryColor:`brand`,primaryShade:OP,autoContrast:!0,luminanceThreshold:NP,colors:{dark:_P,brand:vP,ok:yP,warn:bP,bad:xP,info:SP},defaultRadius:`md`,fontFamily:EP.body,fontFamilyMonospace:EP.display,headings:{fontFamily:EP.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:RP(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:RP(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:LP(t.size)})},Menu:{defaultProps:{withInitialFocusPlaceholder:!1}},Drawer:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}},Modal:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}}}},IP=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":CP.light.muted,...jP(`light`)},dark:jP(`dark`)});function LP(e){let t=PP[e??`md`];return t===void 0||t>=TP.micro?{}:{"--badge-fz":`${TP.micro/16}rem`}}function RP(e,t){return!e||e===FP.primaryColor?{[t]:`var(--fanout-color-${FP.primaryColor}-contrast)`}:{}}var zP=MP(ee),BP=ri({...FP,variantColorResolver:zP});(0,$c.createRoot)(document.getElementById(`root`)).render((0,N.jsx)(M.StrictMode,{children:(0,N.jsx)(ni,{theme:BP,defaultColorScheme:`auto`,cssVariablesResolver:IP,children:(0,N.jsx)(Yn,{router:gP})})}));export{Wy as $,CN as A,Gc as At,RM as B,Ei as Bt,pN as C,Qy as Ct,bN as D,h_ as Dt,kN as E,y_ as Et,DN as F,ms as Ft,jj as G,Er as Gt,CM as H,ai as Ht,xN as I,cs as It,zA as J,Qn as Jt,sj as K,cr as Kt,nN as L,F as Lt,ON as M,Sc as Mt,wN as N,Ls as Nt,_N as O,m_ as Ot,SN as P,Ps as Pt,TA as Q,JM as R,so as Rt,jN as S,Tb as St,TN as T,xy as Tt,_M as U,Ur as Ut,FM as V,hi as Vt,Jj as W,Ir as Wt,UA as X,on as Xt,jA as Y,gn as Yt,$A as Z,ln as Zt,eP as _,Kb as _t,CP as a,G as at,ZN as b,U as bt,yP as c,Fb as ct,bP as d,dx as dt,Uy as et,lP as f,q as ft,iP as g,jb as gt,sP as h,hb as ht,vP as i,bb as it,EN as j,Rc as jt,yN as k,tp as kt,wP as l,Jy as lt,oP as m,Db as mt,kP as n,Vb as nt,EP as o,kb as ot,cP as p,K as pt,rj as q,rr as qt,xP as r,Sb as rt,SP as s,vb as st,AP as t,mb as tt,TP as u,Lb as ut,tP as v,gx as vt,vN as w,Dy as wt,XN as x,Nb as xt,aP as y,zb as yt,UM as z,Pi as zt}; \ No newline at end of file +`),t=JSON.parse(e);n?.event(`SSE`,`Event received:`,t,{type:t?.type}),r.next(t)}catch(e){r.error(e)}}return r.asObservable()},XO=10485760,ZO=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS,QO=(e,t)=>{let n=RO(t),r=new Bu,i=new Uint8Array,a=!1;e.subscribe({next:e=>{if(e.type!==KO.HEADERS&&e.type===KO.DATA&&e.data){let t=new Uint8Array(i.length+e.data.length);t.set(i,0),t.set(e.data,i.length),i=t,o()}},error:e=>r.error(e),complete:()=>{if(o(),!a){if(i.length>0){r.error(Error(`The binary stream ended mid-frame: ${i.length} trailing bytes could not be read as a complete message.`));return}r.complete()}}});function o(){if(!a)for(;i.length>=4;){let e=4+new DataView(i.buffer,i.byteOffset,4).getUint32(0,!1);if(e>XO){r.error(Error(`Protobuf message size exceeded maximum limit of ${XO/1048576} MB`));return}if(i.length{let n=RO(t),r=new Bu,i=new Uu(1),a=!1,o,s=!1,c=()=>{s=!0,o?.unsubscribe()},l=e=>{c(),r.error(e)},u=()=>{c(),r.complete()};return o=e.subscribe({next:e=>{if(i.next(e),e.type===KO.HEADERS&&!a){a=!0;let t=e.headers.get(`content-type`);n?.lifecycle(`HTTP`,`Stream format detected:`,{contentType:t,parser:t===`application/vnd.ag-ui.event+proto`?`protobuf`:`sse`}),t===`application/vnd.ag-ui.event+proto`?QO(i,n).subscribe({next:e=>r.next(e),error:e=>l(e),complete:()=>u()}):YO(i,n).subscribe({next:e=>{if(typeof e!=`object`||!e||Array.isArray(e)){let t=Error(`Invalid event: the frame is not a JSON object.`);n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),l(t);return}let t=e;if(typeof t.type!=`string`||t.type.length===0){let t=Error(`Invalid event: the frame carries no event type.`);n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),l(t);return}n?.event(`HTTP`,`Event received:`,e,{type:t.type}),r.next(e)},error:e=>{if(e?.name===`AbortError`){r.next({type:I.RUN_ERROR,message:e.message||`Request aborted`,code:`abort`,rawEvent:e}),u();return}return l(e)},complete:()=>u()})}else a||l(Error(`No headers event received before data events`))},error:e=>{i.error(e),l(e)},complete:()=>{i.complete()}}),s&&o.unsubscribe(),r.asObservable()},ek={TextMessageStart:`TextMessageStart`,TextMessageContent:`TextMessageContent`,TextMessageEnd:`TextMessageEnd`,ActionExecutionStart:`ActionExecutionStart`,ActionExecutionArgs:`ActionExecutionArgs`,ActionExecutionEnd:`ActionExecutionEnd`,ActionExecutionResult:`ActionExecutionResult`,AgentStateMessage:`AgentStateMessage`,MetaEvent:`MetaEvent`,RunStarted:`RunStarted`,RunFinished:`RunFinished`,RunError:`RunError`,NodeStarted:`NodeStarted`,NodeFinished:`NodeFinished`},tk=e=>{if(typeof e==`string`)return e;if(!Array.isArray(e))return;let t=e.filter(e=>e.type===`text`).map(e=>e.text).filter(e=>e.length>0);if(t.length!==0)return t.join(` +`)};function nk(e,t){return ol(t)&&rk(`[ag-ui][legacy] The result of tool call '${e}' carries content parts the legacy protocol cannot represent; only its text parts are bridged and the rest is dropped.`),al(t)}var rk=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(e)},ik=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=!1,p=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(Dd(r=>{switch(r.type){case I.TEXT_MESSAGE_START:{let e=r;return[{type:ek.TextMessageStart,messageId:e.messageId,role:e.role}]}case I.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:ek.TextMessageContent,messageId:e.messageId,content:e.delta}]}case I.TEXT_MESSAGE_END:{let e=r;return[{type:ek.TextMessageEnd,messageId:e.messageId}]}case I.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:ek.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case I.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return rk(`[ag-ui][legacy] TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let f=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(Hd(d.function.arguments));e.tool_argument&&e.tool_argument in t?(p({...i,[e.state_key]:t[e.tool_argument]}),f=!0):e.tool_argument||(p({...i,[e.state_key]:t}),f=!0)}catch{}}return[{type:ek.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...f?[{type:ek.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case I.TOOL_CALL_END:{let e=r;return[{type:ek.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case I.TOOL_CALL_RESULT:{let e=r,t=d[e.toolCallId];return(t===void 0||t===``)&&rk(`[ag-ui][legacy] No usable tool name was seen for tool call '${e.toolCallId}' (${t===void 0?`no TOOL_CALL_START reached this bridge`:`its TOOL_CALL_START carried an empty toolCallName`}), so its result is being bridged with the fabricated action name "unknown". Downstream consumers route on that name.`),[{type:ek.ActionExecutionResult,actionExecutionId:e.toolCallId,result:nk(e.toolCallId,e.content),actionName:t||`unknown`}]}case I.RAW:return f||(f=!0,rk(`[ag-ui][legacy] Dropping RAW events: the legacy runtime protocol has no equivalent, so the provider payloads they carry do not reach the legacy stream. Reported once per stream.`)),[];case I.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:ek.MetaEvent,name:e.name,value:e.value}]}case I.STATE_SNAPSHOT:return p(r.snapshot),[{type:ek.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case I.STATE_DELTA:{let c=r,l;try{l=Hl.applyPatch(i,c.delta,!0,!1).newDocument}catch(e){let t=e instanceof Error?e.message:String(e);return rk(`[ag-ui][legacy] Failed to apply state patch:\nCurrent state: ${JSON.stringify(i,null,2)}\nPatch operations: ${JSON.stringify(c.delta,null,2)}\nError: ${t}`),[]}return p(l),[{type:ek.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]}case I.MESSAGES_SNAPSHOT:return c=r.messages,[{type:ek.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case I.RUN_STARTED:return[];case I.RUN_FINISHED:{if(c&&(i.messages=c),Object.keys(i).length===0)return[];let r=null;if(c)try{r=ak(c)}catch(e){return[{type:ek.RunError,message:e.message}]}return[{type:ek.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...r?{messages:r}:{}}),active:!1}]}case I.RUN_ERROR:{let e=r;return[{type:ek.RunError,message:e.message,code:e.code}]}case I.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:ek.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case I.STEP_FINISHED:return u=[],l=null,[{type:ek.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function ak(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=tk(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r;try{r=JSON.parse(e.function.arguments)}catch(t){throw Error(`Failed to parse arguments for tool call '${e.id}' (${e.function.name}): ${t.message}`)}let i={id:e.id,name:e.function.name,arguments:r,parentMessageId:n.id};t.push(i)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:nk(n.toolCallId,n.content),actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var ok=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,sk=e=>e===`tool`?`toolCallId`:`messageId`,ck=(e,t,n,r,i)=>{if(r!==void 0&&r!==i)throw Error(`Cannot continue ${e} '${t}': chunk ${n} '${r}' does not match the open stream's ${n} ${i===void 0?`(absent)`:`'${i}'`}.`)},lk=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},uk=(e,t)=>{let n=lk(e,t);return t.rawEvent===void 0?n:{...n,rawEvent:t.rawEvent}},dk=e=>new Set(Object.keys(e.shape)),fk=dk(Ex),pk=dk(Ax),mk=dk(pS),hk=(e,t)=>{let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n},gk=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][transform] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)},_k=(e,t,n,r)=>{if(t===void 0||n||e.length===0)return;let i=e[e.length-1],a=Object.keys(t).filter(e=>Object.prototype.hasOwnProperty.call(i,e));a.length>0&&gk(`A ${r} carried ${a.map(e=>`'${e}'`).join(`, `)}, which the synthesized ${String(i.type)} already describes. The synthesized value is kept and the chunk's is dropped — this stage does not judge a described field, so the producer's value cannot be substituted for its own.`),e[e.length-1]={...t,...i}},vk=e=>t=>{let n=RO(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:I.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:I.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:I.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&ok(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${sk(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(Dd(e=>{switch(e.type){case I.TEXT_MESSAGE_START:case I.TEXT_MESSAGE_CONTENT:case I.TEXT_MESSAGE_END:case I.TOOL_CALL_START:case I.TOOL_CALL_ARGS:case I.TOOL_CALL_END:case I.TOOL_CALL_RESULT:case I.STATE_SNAPSHOT:case I.STATE_DELTA:case I.CUSTOM:case I.STEP_STARTED:case I.STEP_FINISHED:case I.REASONING_START:case I.REASONING_MESSAGE_START:case I.REASONING_MESSAGE_CONTENT:case I.REASONING_MESSAGE_END:case I.REASONING_END:return[...i(e.subagentRunId??void 0),e];case I.RUN_STARTED:case I.RUN_FINISHED:case I.RUN_ERROR:case I.MESSAGES_SNAPSHOT:return[...a(),e];case I.RAW:case I.ACTIVITY_SNAPSHOT:case I.ACTIVITY_DELTA:case I.REASONING_ENCRYPTED_VALUE:case I.SUBAGENT_STARTED:return[e];case I.SUBAGENT_FINISHED:case I.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case I.TEXT_MESSAGE_CHUNK:{let t=e,a=hk(e,fk),o=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`text`&&(t.messageId===void 0||t.messageId===c.fields.messageId))ck(`text message`,c.fields.messageId,`role`,t.role,c.fields.role),ck(`text message`,c.fields.messageId,`name`,t.name,c.fields.name),d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,role:t.role===void 0?`assistant`:t.role,name:t.name,subagentRunId:t.subagentRunId},r.set(o,{kind:`text`,fields:d});let e=lk({type:I.TEXT_MESSAGE_START,messageId:t.messageId,role:d.role,...t.name!==void 0&&{name:t.name},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=uk({...a,type:I.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return _k(l,a,u,`TEXT_MESSAGE_CHUNK`),l}case I.TOOL_CALL_CHUNK:{let t=e,a=hk(e,pk),o=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===c.fields.toolCallId))ck(`tool call`,c.fields.toolCallId,`toolCallName`,t.toolCallName,c.fields.toolCallName),ck(`tool call`,c.fields.toolCallId,`parentMessageId`,t.parentMessageId,c.fields.parentMessageId),d=c.fields;else{if(l.push(...i(o)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);d={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`tool`,fields:d});let e=lk({type:I.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,...t.parentMessageId!==void 0&&{parentMessageId:t.parentMessageId},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=uk({...a,type:I.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:d.toolCallId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return _k(l,a,u,`TOOL_CALL_CHUNK`),l}case I.REASONING_MESSAGE_CHUNK:{let t=e,a=hk(e,mk),o=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===c.fields.messageId))d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`reasoning`,fields:d});let e=lk({type:I.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=uk({...a,type:I.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return _k(l,a,u,`REASONING_MESSAGE_CHUNK`),l}}return e.type,[e]}),Ld(()=>{a()}))},yk=Symbol(`agui.strip.drop`);function bk(e){let t=e;for(;;){if(t instanceof sO||t instanceof lO||t instanceof dO||t instanceof xO||t instanceof _O){t=t.unwrap();continue}if(t instanceof yO){t=t.def.in;continue}if(t instanceof CO){t=t.def.getter();continue}return t}}function xk(e){let t=e.def;return typeof t?.discriminator==`string`?t.discriminator:void 0}function Sk(e){let t=e,n=Array.isArray(t.def?.values)?t.def.values:t.values?Array.from(t.values):void 0;return n&&n.length===1?n[0]:t.value}function Ck(e){let t=bk(e);return t instanceof iO?Sk(t):void 0}function wk(e,t,n,r){let i=bk(t);if(i instanceof XD){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.shape,a=e,o={},s=i.meta()?.specOpen===!0;for(let e of Object.keys(a)){let i=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(i===void 0){if(s){o[e]=a[e];continue}r.push(`${n}/${e}`);continue}let c=r.length,l=wk(a[e],i,`${n}/${e}`,r);if(l===yk){if(r.length=c,i.safeParse(void 0).success){r.push(`${n}/${e}`);continue}return yk}o[e]=l}return o}if(i instanceof JD){if(!Array.isArray(e))return e;let t=i.element,a=[];return e.forEach((e,i)=>{let o=r.length,s=wk(e,t,`${n}/${i}`,r);if(s===yk){r.length=o,r.push(`${n}/${i}`);return}a.push(s)}),a}if(i instanceof tO){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.def.valueType,a=e,o={};for(let e of Object.keys(a)){let i=r.length,s=wk(a[e],t,`${n}/${e}`,r);if(s===yk){r.length=i,r.push(`${n}/${e}`);continue}o[e]=s}return o}if(i instanceof ZD){let t=i.options,a=xk(i);if(a!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))return e;let i=e[a];for(let o of t){let t=bk(o);if(!(t instanceof XD))continue;let s=t.shape;if(Ck(s[a])===i)return wk(e,o,n,r)}return yk}let o=t.filter(e=>bk(e)instanceof XD),s=typeof e==`object`&&!!e&&!Array.isArray(e);if(o.length>1&&s)return e;for(let i of t){let t=bk(i);if(t instanceof JD&&Array.isArray(e)||t instanceof XD&&s)return wk(e,i,n,r)}return e}return e}function Tk(e,t){let n=[],r=wk(e,t,``,n);if(r===yk)throw Error(`Internal error: the stripper found the whole value unrecognisable, which the schemas are not supposed to allow — schema/stripper mismatch.`);return{value:r,stripped:n}}var Ek=new Set(Object.values(I));function Dk(e){return Ek.has(e.type)}var Ok=new Map(yS.options.map(e=>{let t=e.shape;return[String(Sk(t.type)),e]})),kk=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS;function Ak(e){kk()||console.warn(`[ag-ui][enforce] ${e}`)}var jk=e=>t=>{let n=RO(e);return t.pipe(Dd(e=>{if(!Dk(e))return Ak(`Dropping unrecognised event '${String(e.type)}': no middleware translated it and the protocol does not describe it.`),n?.event(`ENFORCE`,`Unrecognised event dropped:`,e,{type:e.type}),Wu;let t=Ok.get(e.type);if(t===void 0)throw Error(`No validator for recognised event type '${String(e.type)}'`);let{value:r,stripped:i}=Tk(e,t);for(let t of i)Ak(`Removed unrecognised material at '${t}' on ${String(e.type)}. Nothing handled it; see the repo-root DEPRECATIONS.md if it is a retired shape.`);return Sd(t.parse(r))}))};function Mk(e){let{value:t,stripped:n}=Tk(nl(e,`RunAgentInput`),$x);for(let e of n)Ak(`Removed unrecognised material at '${e}' from the outgoing input.`);return $x.parse(t)}var Nk=class{runNext(e,t){return t.run(e).pipe(vk(!1))}runNextWithState(e,t){let n=AO(e.messages||[]),r=AO(e.state===void 0?{}:e.state),i=new Uu;return UO(e,i,t,[]).subscribe({next:e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)},error:()=>{}}),this.runNext(e,t).pipe(Nd(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:AO(n),state:AO(r)})))}},Pk=class extends Nk{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Fk(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function Ik(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function Lk(e){let t=Fk(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:((typeof process>`u`||!{}.SUPPRESS_TRANSFORMATION_WARNINGS)&&console.warn(`[ag-ui][compat] A binary content part carries only an id ('${e.id??``}') and cannot be converted to a modern media part; a 1.0 peer will not accept it. Provide data or a url. See the repo-root DEPRECATIONS.md.`),e)}function Rk(e,t,n){if(typeof e!=`object`||!e||!(`type`in e)||e.type!==t.type||!(`source`in e))return!1;let r=e.source;return typeof r!=`object`||!r||!(`type`in r)||r.type!==t.source.type||!(`value`in r)||r.value!==t.source.value||!(`mimeType`in r)||r.mimeType!==t.source.mimeType?!1:!n||`metadata`in e&&typeof e.metadata==`object`&&e.metadata!==null&&`filename`in e.metadata&&e.metadata.filename===n}function zk(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.flatMap(e=>{if(Ik(e)){let n=Lk(e);return n.type!==`binary`&&t.some(t=>Rk(t,n,e.filename))?[]:[n]}return[e]});return{...e,content:n}}var Bk=`THINKING_START`,Vk=`THINKING_END`,Hk=`THINKING_TEXT_MESSAGE_START`,Uk=`THINKING_TEXT_MESSAGE_CONTENT`,Wk=`THINKING_TEXT_MESSAGE_END`;function Gk(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Kk={event:[`rawEvent`,`subagentRunId`],[I.RUN_STARTED]:[`parentRunId`,`input`],[I.RUN_FINISHED]:[`result`,`outcome`],[I.RUN_ERROR]:[`usage`],[I.SUBAGENT_FINISHED]:[`result`],[I.TOOL_CALL_START]:[`parentMessageId`],[I.TOOL_CALL_CHUNK]:[`parentMessageId`],[I.TOOL_CALL_RESULT]:[`role`],"RUN_FINISHED.outcome":[`pendingToolCallIds`],"RUN_FINISHED.usage[]":[`provider`,`reasoningTokens`,`cachedInputTokens`,`cacheWriteInputTokens`],RunAgentInput:[`forwardedProps`],Tool:[`parameters`],ResumeEntry:[`payload`],"input content":[`metadata`]},qk=new Map(Object.entries(Kk).filter(([e])=>Object.values(I).includes(e))),Jk=e=>WO(e,`an absent field`);function Yk(e,t,n,r){if(!Gk(e))return e;let i;for(let a of t)e[a]===null&&(r(n===void 0?`${a}: null`:`${n}.${a}: null`),i??={...e},delete i[a]);return i??e}function Xk(e,t,n){if(!Gk(e)||!Array.isArray(e[t]))return e;let r=e[t],i=r.map(n);return i.some((e,t)=>e!==r[t])?{...e,[t]:i}:e}function Zk(e,t){return Xk(e,`content`,e=>{if(!Gk(e))return e;switch(e.type){case`image`:case`audio`:case`video`:case`document`:return Yk(e,Kk[`input content`],`${e.type} input content`,t);default:return e}})}function Qk(e,t=Jk){let n=Yk(e,Kk.RunAgentInput,`RunAgentInput`,t);return n=Xk(n,`tools`,e=>Yk(e,Kk.Tool,`Tool`,t)),n=Xk(n,`resume`,e=>Yk(e,Kk.ResumeEntry,`ResumeEntry`,t)),Xk(n,`messages`,e=>Zk(e,t))}var $k=class extends Nk{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun=new Set,this.noticeNullOncePerRun=e=>{this.nullsNoticedThisRun.has(e)||(this.nullsNoticedThisRun.add(e),WO(e,`an absent field`))}}warn(e,t){WO(e,t)}mintedContinuationId(e,t){if(t!==null)return t;let n=jO();return this.warnAside(`Minting a messageId ('${n}') for ${e}: no THINKING opener preceded it, so there was no id to continue. The id is this client's invention, not the producer's, and verification will reject the translated event for naming something nothing opened.`),n}warnAside(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][compat] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun.clear(),e.messages=e.messages.map(zk),t.run(e).pipe(Td(e=>this.transformEvent(e)))}transformEvent(e){let t=this.noticeNullOncePerRun;e.type===I.RUN_STARTED&&this.nullsNoticedThisRun.clear(),e=Yk(e,Kk.event,void 0,t);let n=qk.get(e.type);switch(n&&(e=Yk(e,n,e.type,t)),e.type){case Bk:{this.currentReasoningId=jO();let{title:t,...n}=e;return this.warn(Bk,I.REASONING_START),t!==void 0&&this.warnAside(`Dropping ${Bk}.title ${JSON.stringify(t)}: ${I.REASONING_START} has no title field, so the span's label cannot be carried and nothing downstream can recover it.`),{...n,type:I.REASONING_START,messageId:this.currentReasoningId}}case Hk:return this.currentMessageId=jO(),this.warn(Hk,I.REASONING_MESSAGE_START),{...e,type:I.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case Uk:{let{delta:t,...n}=e;return this.warn(Uk,I.REASONING_MESSAGE_CONTENT),{...n,type:I.REASONING_MESSAGE_CONTENT,messageId:this.mintedContinuationId(Uk,this.currentMessageId),delta:t}}case Wk:{let t=this.mintedContinuationId(Wk,this.currentMessageId);return this.currentMessageId=null,this.warn(Wk,I.REASONING_MESSAGE_END),{...e,type:I.REASONING_MESSAGE_END,messageId:t}}case Vk:{let t=this.mintedContinuationId(Vk,this.currentReasoningId);return this.currentReasoningId=null,this.warn(Vk,I.REASONING_END),{...e,type:I.REASONING_END,messageId:t}}case I.RUN_FINISHED:{let n=e,r=Yk(n.outcome,Kk[`RUN_FINISHED.outcome`],`RUN_FINISHED.outcome`,t);return Xk(r===n.outcome?n:{...n,outcome:r},`usage`,e=>Yk(e,Kk[`RUN_FINISHED.usage[]`],`RUN_FINISHED.usage[]`,t))}case I.MESSAGES_SNAPSHOT:{let t=e;return Array.isArray(t.messages)?{...t,messages:t.messages.map(e=>this.upgradeInboundMessage(e))}:e}case I.RUN_STARTED:{let n=Qk(e.input,t),r=n===e.input?e:{...e,input:n},i=r;return!i.input||!Array.isArray(i.input.messages)?r:{...i,input:{...i.input,messages:i.input.messages.map(e=>this.upgradeInboundMessage(e))}}}default:return e}}upgradeInboundMessage(e){e=Zk(e,this.noticeNullOncePerRun);let t=e.content;return!Array.isArray(t)||!t.some(e=>typeof e==`object`&&!!e&&e.type===`binary`)?e:(this.warn(`binary input content`,`the modern media content parts`),zk(e))}},eA=()=>e=>Ad(()=>{let t=new $k;return e.pipe(Td(e=>t.transformEvent(e)))});function tA(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}function nA(){return typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS}function rA(e){nA()||console.warn(`[ag-ui][compat] Flattening message content for a <=0.0.39 peer DROPS non-text parts (${e.join(`, `)}). The peer cannot receive them; upgrade it to keep media content. See the repo-root DEPRECATIONS.md.`)}function iA(e){nA()||console.warn(`[ag-ui][compat] Not flattening message content for a <=0.0.39 peer: ${e} content part(s) claim type "text" but carry a malformed 'text' value. That is a defect in the message, not media the peer cannot represent, and a downgrade must not repair it — the content is passed on unchanged so the outgoing enforcement boundary reports it. See the repo-root DEPRECATIONS.md.`)}function aA(e){let t=e.content;if(Array.isArray(t)){let n=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`,r=e=>n(e)&&typeof e.text==`string`,i=t.filter(e=>n(e)&&!r(e));if(i.length>0)return iA(i.length),e;let a=t.filter(e=>!r(e)).map(e=>typeof e==`object`&&e&&`type`in e?String(e.type):typeof e);a.length>0&&rA(a);let o=t.filter(r).map(e=>e.text).join(``);return{...e,content:o}}return typeof t==`string`?e:t===void 0?{...e,content:``}:e}var oA=class extends Nk{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(aA)};return this.runNext(i,t)}},sA=`THINKING_START`,cA=`THINKING_END`,lA=`THINKING_TEXT_MESSAGE_START`,uA=`THINKING_TEXT_MESSAGE_CONTENT`,dA=`THINKING_TEXT_MESSAGE_END`,fA=class extends Nk{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Td(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case sA:{this.currentReasoningId=jO();let{title:t,...n}=e;return this.warnAboutTransformation(sA,I.REASONING_START),{...n,type:I.REASONING_START,messageId:this.currentReasoningId}}case lA:return this.currentMessageId=jO(),this.warnAboutTransformation(lA,I.REASONING_MESSAGE_START),{...e,type:I.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case uA:{let{delta:t,...n}=e;return this.warnAboutTransformation(uA,I.REASONING_MESSAGE_CONTENT),{...n,type:I.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??jO(),delta:t}}case dA:{let t=this.currentMessageId??jO();return this.warnAboutTransformation(dA,I.REASONING_MESSAGE_END),{...e,type:I.REASONING_MESSAGE_END,messageId:t}}case cA:{let t=this.currentReasoningId??jO();return this.warnAboutTransformation(cA,I.REASONING_END),{...e,type:I.REASONING_END,messageId:t}}default:return e}}},pA=`SUBAGENT_STARTED`,mA=`SUBAGENT_FINISHED`,hA=`SUBAGENT_ERROR`;function gA(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function _A(e){return e.map(e=>gA(e))}var vA=class extends Nk{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>gA(e))};return this.runNext(n,t).pipe(Bd(e=>{let t=e.type;(t===pA||t===mA||t===hA)&&this.warnDroppedLifecycleEvent(t)}),jd(e=>{let t=e.type;return t!==pA&&t!==mA&&t!==hA}),Td(e=>{let t=gA(e);if(t.type===I.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:_A(e.messages)}}if(t.type===I.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>gA(e))}}}if(t.type===I.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:_A(e.input.messages)}}}return t}))}},yA=`1.0.2`,bA=!1,xA=new WeakSet,SA=(e,t)=>/^\d+\.\d+$/.test(e)?XT(e,t)>0?`newer`:`not-newer`:`uninterpretable`,CA=e=>{let t=e.protocolVersion;if(t!==void 0&&t!==`1.0`)switch(SA(t,`1.0`)){case`uninterpretable`:console.warn(`[ag-ui] The producer declared protocol version '${t}', which this client cannot interpret.`);return;case`newer`:console.warn(`[ag-ui] The producer speaks protocol ${t}; this client speaks 1.0. Unrecognised material will be stripped with warnings.`);return;case`not-newer`:return}},wA=class e{resolvePeerCeiling(t){if(this.resolvingPeerCeiling)return yA;let n=Object.getOwnPropertyDescriptor(this,`maxVersion`),r=Object.getOwnPropertyDescriptor(this,`maxProtocolVersion`),i=Object.getPrototypeOf(this);for(;i&&i!==e.prototype;)n??=Object.getOwnPropertyDescriptor(i,`maxVersion`),r??=Object.getOwnPropertyDescriptor(i,`maxProtocolVersion`),i=Object.getPrototypeOf(i);if(t===`maxVersion`&&n)return yA;let a=t===`maxProtocolVersion`?n:r;if(!a)return yA;this.resolvingPeerCeiling=!0;try{return a.get?a.get.call(this):a.value}finally{this.resolvingPeerCeiling=!1}}get maxProtocolVersion(){return this.resolvePeerCeiling(`maxProtocolVersion`)}get maxVersion(){return!this.resolvingPeerCeiling&&!bA&&(bA=!0,console.warn(`[ag-ui] AbstractAgent.maxVersion is deprecated — use maxProtocolVersion. Same value; the new name says whose version it is and that it is a ceiling.`)),this.resolvePeerCeiling(`maxVersion`)}get debug(){return this._debug}set debug(e){this._debug=LO(e),this._debugLogger=BO(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?BO(LO(!0)):void 0:e}resolvedCeilingDuringConstruction(){let e=this.maxProtocolVersion;if(typeof e!=`string`||!ZT(e))throw new L(`maxProtocolVersion resolved to ${JSON.stringify(e)} during construction, which is not a version this client can compare. A ceiling read from an instance field is not available yet — return a literal from the getter.`);return e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.resolvingPeerCeiling=!1,this.agentId=e,this.description=t??``,this.threadId=n??Qc(),this.messages=AO(r??[]),this.state=AO(i??{}),this._debug=LO(a),this._debugLogger=BO(this._debug);let o=this.resolvedCeilingDuringConstruction();XT(o,`0.0.39`)<=0&&this.middlewares.unshift(new oA),XT(o,`0.0.45`)<=0&&this.middlewares.unshift(new fA),XT(o,`0.0.57`)<=0&&this.middlewares.unshift(new vA)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new Pk(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Qc();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>CA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];xA.add(n),await this.onInitialize(n,a),this.activeRunDetach$=new Bu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await wd(ku(()=>[...this.middlewares,new $k].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),jk(this.debugLogger),vk(this.debugLogger),GO(this.debugLogger),e=>e.pipe(zd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Md(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Ld(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Sd(null)));let s=AO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new rl}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Qc();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>CA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new Bu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await wd(ku(()=>Ad(()=>this.connect(n)),e=>jk(this.debugLogger)(eA()(e)),vk(this.debugLogger),GO(this.debugLogger),e=>e.pipe(zd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Md(e=>(this.isRunning=!1,e instanceof rl?Wu:this.onError(n,e,a))),Ld(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Sd(null)),{defaultValue:void 0});let s=AO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}applyBeforeSourceError(e,t,n){return Ad(()=>{let r,i=t.pipe(Md(e=>(r={error:e},Wu)));return this.processApplyEvents(e,this.apply(e,i,n),n).pipe(Fd(Ad(()=>{let e=r;return e?z(()=>e.error):Wu})))})}apply(e,t,n){return UO(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Bd(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state!==void 0&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=AO(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Qc(),...XT(this.maxProtocolVersion,yA)>=0&&{protocolVersion:`1.0`},tools:AO(e?.tools??[]),context:AO(e?.context??[]),forwardedProps:AO(e?.forwardedProps??{}),state:AO(this.state),messages:n,...e?.resume===void 0?{}:{resume:AO(e.resume)}}}async onInitialize(e,t){if(xA.has(e)&&this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new L(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let t of this.pendingInterrupts)if(tA(t)&&(e.resume??[]).find(e=>e.interruptId===t.id)?.status!==`cancelled`)throw new L(`Interrupt ${t.id} expired at ${t.expiresAt} and can no longer be answered. Cancel it to continue the thread.`)}let n=await IO(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages.filter(e=>e.role!==`activity`),t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state!==void 0&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return xd(IO(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(Td(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await IO(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=AO(this.messages),e.state=AO(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=AO(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=AO(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=AO(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Qc();let t=this.prepareRunAgentInput(e);return[...this.middlewares,new $k].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t).pipe(jk(this.debugLogger),vk(this.debugLogger),GO(this.debugLogger),ik(this.threadId,t.runId,this.agentId),e=>e.pipe(Td(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function TA(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var EA=class extends wA{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(TA(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=AO(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return $O(qO(()=>this.fetch(this.url,this.requestInit(Mk(e)))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=AO(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},DA=M.createContext(void 0),OA=e=>{let t=M.useContext(DA);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},kA=({client:e,children:t})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,N.jsx)(DA.Provider,{value:e,children:t})),AA={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},jA=new class{#e=AA;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 MA(e){setTimeout(e,0)}var NA=typeof window>`u`||`Deno`in globalThis;function PA(){}function FA(e,t){return typeof e==`function`?e(t):e}function IA(e){return typeof e==`number`&&e>=0&&e!==1/0}function LA(e,t){return Math.max(e+(t||0)-Date.now(),0)}function RA(e,t){return typeof e==`function`?e(t):e}function zA(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==VA(o,t.options))return!1}else if(!UA(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 BA(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(HA(t.options.mutationKey)!==HA(a))return!1}else if(!UA(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function VA(e,t){return(t?.queryKeyHashFn||HA)(e)}function HA(e){return JSON.stringify(e,(e,t)=>JA(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function UA(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n500)return t;let r=qA(e)&&qA(t);if(!r&&!(JA(e)&&JA(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{jA.setTimeout(t,e)})}function ZA(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:GA(e,t)}function QA(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function $A(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ej=Symbol();function tj(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ej?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function nj(e,t){return typeof e==`function`?e(...t):!!e}function rj(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 ij=()=>NA,aj=()=>ij(),oj=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(){}},sj=new class extends oj{#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`}},cj=MA;function lj(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=cj,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 uj=lj(),dj=new class extends oj{#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 fj(e){return Math.min(1e3*2**e,3e4)}function pj(e){return(e??`online`)!==`online`||dj.isOnline()}var mj=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function hj(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(PA);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new mj(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>sj.isFocused()&&(e.networkMode===`always`||dj.isOnline())&&e.canRun(),p=()=>pj(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(aj()?0:3),a=e.retryDelay??fj,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&nf()?void 0:g(f)).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var gj=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),IA(this.gcTime)&&(this.#e=jA.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(aj()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(jA.clearTimeout(this.#e),this.#e=void 0)}};function _j(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=>{rj(e,()=>t.signal,()=>n=!0)},u=tj(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?$A:QA;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?yj:vj,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:vj(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function vj(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 yj(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function bj(e,t){return t?vj(e,t)!=null:!1}function xj(e,t){return!t||!e.getPreviousPageParam?!1:yj(e,t)!=null}var Sj=class extends gj{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Tj(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Tj(this.options);e.data!==void 0&&(this.setState(wj(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ZA(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(PA).catch(PA):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>RA(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ej||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>RA(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!LA(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=tj(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?_j(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=hj({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof mj&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof mj){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Cj(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...wj(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),uj.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Cj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pj(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function wj(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Tj(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 Ej=class extends oj{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Oj(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return kj(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return kj(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 RA(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&&!KA(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Aj(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||RA(this.options.enabled,this.#t)!==RA(t.enabled,this.#t)||RA(this.options.staleTime,this.#t)!==RA(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||RA(this.options.enabled,this.#t)!==RA(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return KA(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(PA)),t}#h(e){return!aj()&&RA(this.options.enabled,this.#t)!==!1&&IA(e)}#g(){this.#b();let e=RA(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=LA(this.#r.dataUpdatedAt,e)+1;this.#u=jA.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return RA(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=jA.setInterval(()=>{(this.options.refetchIntervalInBackground||sj.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(jA.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(jA.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Oj(e,t),o=i&&Aj(e,n,t,r);(a||o)&&(l={...l,...Cj(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=ZA(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=ZA(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:jj(e,t),refetch:this.refetch,isEnabled:RA(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),KA(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();uj.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Dj(e,t){return RA(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||RA(t.retryOnMount,e)!==!1)}function Oj(e,t){return Dj(e,t)||e.state.data!==void 0&&kj(e,t,t.refetchOnMount)}function kj(e,t,n){if(RA(t.enabled,e)!==!1&&RA(t.staleTime,e)!==`static`){let r=RA(n,e);return r===`always`||r!==!1&&jj(e,t)}return!1}function Aj(e,t,n,r){return(e!==t||RA(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&jj(e,n)}function jj(e,t){return RA(t.enabled,e)!==!1&&e.isStaleByTime(RA(t.staleTime,e))}var Mj=class extends Ej{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:bj(t,n.data),hasPreviousPage:xj(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Nj=class extends gj{#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||Pj(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=hj({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),uj.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Pj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Fj=class extends oj{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Nj({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=Ij(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=Ij(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=Ij(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Ij(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){uj.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=>BA(t,e))}findAll(e={}){return this.getAll().filter(t=>BA(e,t))}notify(e){uj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return uj.batch(()=>Promise.all(e.map(e=>e.continue().catch(PA))))}};function Ij(e){return e.options.scope?.id}var Lj=class extends oj{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??VA(r,t),a=this.get(i);return a||(a=new Sj({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){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){uj.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=>zA(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>zA(e,t)):t}notify(e){uj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){uj.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){uj.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Rj=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Lj,this.#t=e.mutationCache||new Fj,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=sj.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=dj.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(RA(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=FA(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return uj.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;uj.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return uj.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=uj.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(PA).catch(PA)}invalidateQueries(e,t={}){return uj.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=uj.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(PA)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(PA)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(RA(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(RA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(PA).catch(PA)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(PA).catch(PA)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return dj.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(HA(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{UA(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(HA(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{UA(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||=VA(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===ej&&(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()}},zj=M.createContext(!1),Bj=()=>M.useContext(zj);zj.Provider;function Vj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Hj=M.createContext(Vj()),Uj=()=>M.useContext(Hj),Wj=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?nj(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Gj=e=>{M.useEffect(()=>{e.clearReset()},[e])},Kj=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||nj(n,[e.error,r])),qj=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))}},Jj=(e,t)=>e?.suspense&&t.isPending,Yj=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Xj(e,t,n){let r=Bj(),i=Uj(),a=OA(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,qj(o),Wj(o,i,s),Gj(i);let[l]=M.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(M.useSyncExternalStore(M.useCallback(e=>{let t=d?l.subscribe(uj.batchCalls(e)):PA;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),M.useEffect(()=>{l.setOptions(o)},[o,l]),Jj(o,u))throw Yj(o,l,i);if(Kj({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Zj(e,t){return Xj(e,Ej,t)}function Qj(e,t){return Xj(e,Mj,t)}var $j=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),eM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),tM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,44H160a43.86,43.86,0,0,0-32,13.85A43.86,43.86,0,0,0,96,44H24A12,12,0,0,0,12,56V200a12,12,0,0,0,12,12H96a20,20,0,0,1,20,20,12,12,0,0,0,24,0,20,20,0,0,1,20-20h72a12,12,0,0,0,12-12V56A12,12,0,0,0,232,44ZM96,188H36V68H96a20,20,0,0,1,20,20V192.81A43.79,43.79,0,0,0,96,188Zm124,0H160a43.71,43.71,0,0,0-20,4.83V88a20,20,0,0,1,20-20h60Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,56V200H160a32,32,0,0,0-32,32,32,32,0,0,0-32-32H24V56H96a32,32,0,0,1,32,32,32,32,0,0,1,32-32Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240,56V200a8,8,0,0,1-8,8H160a24,24,0,0,0-24,23.94,7.9,7.9,0,0,1-5.12,7.55A8,8,0,0,1,120,232a24,24,0,0,0-24-24H24a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H88a32,32,0,0,1,32,32v87.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V80a32,32,0,0,1,32-32h64A8,8,0,0,1,240,56Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,50H160a38,38,0,0,0-32,17.55A38,38,0,0,0,96,50H24a6,6,0,0,0-6,6V200a6,6,0,0,0,6,6H96a26,26,0,0,1,26,26,6,6,0,0,0,12,0,26,26,0,0,1,26-26h72a6,6,0,0,0,6-6V56A6,6,0,0,0,232,50ZM96,194H30V62H96a26,26,0,0,1,26,26V204.31A37.86,37.86,0,0,0,96,194Zm130,0H160a37.87,37.87,0,0,0-26,10.32V88a26,26,0,0,1,26-26h66Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,52H160a36,36,0,0,0-32,19.54A36,36,0,0,0,96,52H24a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H96a28,28,0,0,1,28,28,4,4,0,0,0,8,0,28,28,0,0,1,28-28h72a4,4,0,0,0,4-4V56A4,4,0,0,0,232,52ZM96,196H28V60H96a28,28,0,0,1,28,28V209.4A35.93,35.93,0,0,0,96,196Zm132,0H160a35.94,35.94,0,0,0-28,13.41V88a28,28,0,0,1,28-28h68Z`}))]]),nM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128ZM60,112a16,16,0,1,0,16,16A16,16,0,0,0,60,112Zm136,0a16,16,0,1,0,16,16A16,16,0,0,0,196,112Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240,96v64a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V96A16,16,0,0,1,32,80H224A16,16,0,0,1,240,96Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V96A16,16,0,0,0,224,80ZM60,140a12,12,0,1,1,12-12A12,12,0,0,1,60,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,196,140Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM60,118a10,10,0,1,0,10,10A10,10,0,0,0,60,118Zm136,0a10,10,0,1,0,10,10A10,10,0,0,0,196,118Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-76-8a8,8,0,1,0,8,8A8,8,0,0,0,60,120Zm136,0a8,8,0,1,0,8,8A8,8,0,0,0,196,120Z`}))]]),rM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),iM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),aM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),oM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240.49,15.51a12,12,0,0,0-17,0L173.94,65.09l-2.54-2.55a36.05,36.05,0,0,0-50.91,0L100,83l-3.51-3.52a12,12,0,0,0-17,17L83,100,62.54,120.49a36,36,0,0,0,0,50.91l2.55,2.54L15.51,223.51a12,12,0,0,0,17,17l49.57-49.58,2.54,2.55a36.06,36.06,0,0,0,50.91,0L156,173l3.51,3.52a12,12,0,0,0,17-17L173,156l20.49-20.49a36,36,0,0,0,0-50.91l-2.55-2.54,49.58-49.57A12,12,0,0,0,240.49,15.51Zm-121.95,161a12,12,0,0,1-17,0L79.51,154.43a12,12,0,0,1,0-17L100,117l39,39Zm58-57.95h0L156,139l-39-39,20.49-20.49a12,12,0,0,1,17,0l22.06,22.06a12,12,0,0,1,0,17ZM85.27,33.37a12,12,0,0,1,21.46-10.74l8,16A12,12,0,1,1,93.27,49.37Zm-68,57.26a12,12,0,0,1,16.1-5.36l16,8a12,12,0,1,1-10.74,21.46l-16-8A12,12,0,0,1,17.27,90.63Zm221.46,74.74a12,12,0,0,1-16.1,5.36l-16-8a12,12,0,0,1,10.74-21.46l16,8A12,12,0,0,1,238.73,165.37Zm-68,57.26a12,12,0,1,1-21.46,10.74l-8-16a12,12,0,0,1,21.46-10.74Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M185,127,127,185a24,24,0,0,1-33.94,0L71,162.91A24,24,0,0,1,71,129L129,71a24,24,0,0,1,33.94,0L185,93.09A24,24,0,0,1,185,127Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32.06,32.06,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94h0L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22a16,16,0,0,1,0,22.63ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM29,103.43l20,8A8,8,0,1,0,55,96.57l-20-8A8,8,0,0,0,29,103.43ZM227,152.57l-20-8A8,8,0,1,0,201,159.43l20,8A8,8,0,0,0,227,152.57ZM159.43,201A8,8,0,0,0,144.57,207l8,20A8,8,0,1,0,167.43,221ZM237.91,18.52a8,8,0,0,0-11.5-.18L174,70.75l-5.38-5.38a32,32,0,0,0-45.28,0L106.14,82.54a4,4,0,0,0,0,5.66l61.7,61.66a4,4,0,0,0,5.66,0l16.74-16.74a32.76,32.76,0,0,0,9.81-22.52,31.82,31.82,0,0,0-9.37-23.17l-5.38-5.37,52.2-52.17A8.22,8.22,0,0,0,237.91,18.52ZM85.64,90.34a8,8,0,0,0-11.49.18,8.22,8.22,0,0,0,.41,11.37L80.67,108,65.34,123.31A31.82,31.82,0,0,0,56,146.47,32.75,32.75,0,0,0,65.77,169l5,4.94L18.49,226.13a8.21,8.21,0,0,0-.61,11.1,8,8,0,0,0,11.72.43L82,185.25l5.37,5.38a32.1,32.1,0,0,0,45.29,0L148,175.31l6.34,6.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M236.24,19.76a6,6,0,0,0-8.48,0L173.94,73.57l-6.79-6.78a30,30,0,0,0-42.42,0L100,91.51l-7.76-7.75a6,6,0,0,0-8.48,8.48L91.51,100,66.79,124.73a30,30,0,0,0,0,42.42l6.78,6.79L19.76,227.76a6,6,0,1,0,8.48,8.48l53.82-53.81,6.79,6.78a30,30,0,0,0,42.42,0L156,164.49l7.76,7.75a6,6,0,0,0,8.48-8.48L164.49,156l24.72-24.73a30,30,0,0,0,0-42.42l-6.78-6.79,53.81-53.82A6,6,0,0,0,236.24,19.76Zm-113.45,161a18,18,0,0,1-25.46,0L75.27,158.67a18,18,0,0,1,0-25.46L100,108.49,147.51,156Zm57.94-57.94L156,147.51,108.49,100l24.72-24.73a18,18,0,0,1,25.46,0l22.06,22.06a18,18,0,0,1,0,25.46ZM90.43,34.23a6,6,0,0,1,11.14-4.46l8,20a6,6,0,1,1-11.14,4.46Zm-64,59.54a6,6,0,0,1,7.8-3.34l20,8a6,6,0,1,1-4.46,11.14l-20-8A6,6,0,0,1,26.43,93.77Zm203.14,68.46a6,6,0,0,1-7.8,3.34l-20-8a6,6,0,0,1,4.46-11.14l20,8A6,6,0,0,1,229.57,162.23Zm-64,59.54a6,6,0,1,1-11.14,4.46l-8-20a6,6,0,0,1,11.14-4.46Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32,32,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22A16,16,0,0,1,179.31,121.37ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M234.83,21.17a4,4,0,0,0-5.66,0L173.94,76.4l-8.2-8.2a28,28,0,0,0-39.6,0L100,94.34l-9.17-9.17a4,4,0,0,0-5.66,5.66L94.34,100,68.2,126.14a28,28,0,0,0,0,39.6l8.2,8.2L21.17,229.17a4,4,0,0,0,5.66,5.66L82.06,179.6l8.2,8.2a28,28,0,0,0,39.6,0L156,161.66l9.17,9.17a4,4,0,0,0,5.66-5.66L161.66,156l26.14-26.14a28,28,0,0,0,0-39.6l-8.2-8.2,55.23-55.23A4,4,0,0,0,234.83,21.17Zm-110.63,161a20,20,0,0,1-28.28,0L73.86,160.08a20,20,0,0,1,0-28.28L100,105.66,150.34,156Zm57.94-57.94L156,150.34,105.66,100,131.8,73.86a20,20,0,0,1,28.28,0l22.06,22.06A20,20,0,0,1,182.14,124.2ZM92.29,33.49a4,4,0,1,1,7.42-3l8,20a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,104,56a4,4,0,0,1-3.71-2.51Zm-64,61a4,4,0,0,1,5.2-2.22l20,8A4,4,0,0,1,52,108a3.91,3.91,0,0,1-1.49-.29l-20-8A4,4,0,0,1,28.29,94.51Zm199.42,67A4,4,0,0,1,224,164a3.91,3.91,0,0,1-1.49-.29l-20-8a4,4,0,1,1,3-7.42l20,8A4,4,0,0,1,227.71,161.49Zm-64,61a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,160,228a4,4,0,0,1-3.71-2.51l-8-20a4,4,0,0,1,7.42-3Z`}))]]),sM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),cM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),lM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z`}))]]),uM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),dM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z`}))]]),fM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z`}))]]),pM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:$j}));pM.displayName=`ArrowLeftIcon`;var mM=pM,hM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:eM}));hM.displayName=`ArrowRightIcon`;var gM=hM,_M=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:tM}));_M.displayName=`BookOpenIcon`;var vM=_M,yM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:nM}));yM.displayName=`DotsThreeIcon`;var bM=yM,xM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:rM}));xM.displayName=`MagnifyingGlassIcon`;var SM=xM,CM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:iM}));CM.displayName=`MoonIcon`;var wM=CM,TM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:aM}));TM.displayName=`PencilSimpleIcon`;var EM=TM,DM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:oM}));DM.displayName=`PlugsConnectedIcon`;var OM=DM,kM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:sM}));kM.displayName=`PlusIcon`;var AM=kM,jM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:cM}));jM.displayName=`SignOutIcon`;var MM=jM,NM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:lM}));NM.displayName=`SparkleIcon`;var PM=NM,FM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:uM}));FM.displayName=`SunIcon`;var IM=FM,LM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:dM}));LM.displayName=`TrashIcon`;var RM=LM,zM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:fM}));zM.displayName=`UserPlusIcon`;var BM=zM,VM=class extends Error{status;problems;code;constructor(e,t,n=[],r=``){super(e),this.status=t,this.problems=n,this.code=r}},HM=`fanout:unauthorized`;function UM(){let e=new URLSearchParams(window.location.search).get(`return_to`);if(!e)return``;let t=new URL(e,window.location.origin);return t.origin!==window.location.origin||t.pathname!==`/api/auth/oauth/authorize`?``:`${t.pathname}${t.search}`}function WM(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function GM(){window.dispatchEvent(new Event(HM))}async function KM(e,t={}){let n=new Headers(t.headers);n.set(`Fanout-Request`,`1`);let r=await fetch(e,{...t,headers:n,credentials:`same-origin`});if(r.status===401&&GM(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw new VM(e.message??`You do not have permission to perform this action.`,r.status,[],e.code??``)}return r}async function qM(){let e=await KM(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&GM(),window.location.assign(`/`)}var JM=(0,M.createContext)(null);function YM(){let e=(0,M.useContext)(JM);if(!e)throw Error(`Fanout runtime status is unavailable`);return e}var XM=(0,M.createContext)(null);function ZM(){let e=(0,M.useContext)(XM);if(!e)throw Error(`Fanout viewer is unavailable`);return e}function QM(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||t.id===``||t.status!==`active`&&t.status!==`suspended`?null:{id:t.id,email:typeof t.email==`string`?t.email:``,display_name:typeof t.display_name==`string`?t.display_name:``,status:t.status,role:typeof t.role==`string`?t.role:``}}async function $M(e,t){let n=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:t===void 0?void 0:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t),credentials:`same-origin`}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.message??`Request failed (${n.status})`);return r}function eN({children:e,wide:t=!1}){return(0,N.jsx)(u,{mih:`100dvh`,style:{background:`radial-gradient(circle at 50% -12%, var(--mantine-color-brand-light), transparent 38%), linear-gradient(180deg, var(--mantine-color-default-hover), var(--mantine-color-body) 62%)`},children:(0,N.jsx)(je,{mih:`100dvh`,px:`md`,py:48,children:(0,N.jsx)(ve,{size:t?680:480,w:`100%`,children:(0,N.jsx)(Fe,{radius:28,p:{base:24,sm:40},style:{background:`var(--mantine-color-body)`,border:`1px solid var(--mantine-color-default-border)`,boxShadow:`var(--mantine-shadow-xl)`},children:e})})})})}function tN(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function nN(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function rN({children:e}){let t=ze(),[n,r]=(0,M.useState)(null),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(`none`),[c,l]=(0,M.useState)(null),[d,f]=(0,M.useState)(!1),[p,m]=(0,M.useState)(``),[h,g]=(0,M.useState)(``),[_,v]=(0,M.useState)(tN),[y,b]=(0,M.useState)(nN),[x,S]=(0,M.useState)(``),[C,w]=(0,M.useState)(!1),[T,ee]=(0,M.useState)(0),[E,D]=(0,M.useState)(()=>Date.now()),[O,te]=(0,M.useState)(!1),[re,k]=(0,M.useState)(``),[ie,ae]=(0,M.useState)(null),[se,le]=(0,M.useState)(!1),de=(0,M.useRef)(null),fe=UM(),pe=o===`user`;async function he(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){s(`none`),l(null);return}let t=await e.json().catch(()=>null);s(WM(t)),l(QM(t))}async function ge(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;l(QM(await e.json().catch(()=>null)))}catch{}}(0,M.useEffect)(()=>{let e=new URL(window.location.href);(e.searchParams.has(`setup_token`)||e.searchParams.has(`login_token`))&&(e.searchParams.delete(`setup_token`),e.searchParams.delete(`login_token`),t({href:e.pathname+e.search+e.hash,replace:!0}))},[t]),(0,M.useEffect)(()=>{$M(`/api/auth/status`).then(r).catch(e=>k(String(e))).finally(()=>a(!0)),he().catch(()=>s(`none`)).finally(()=>f(!0));let e=()=>{s(`none`),l(null)};return window.addEventListener(HM,e),()=>window.removeEventListener(HM,e)},[]),(0,M.useEffect)(()=>{d&&o===`none`&&y&&(te(!0),k(``),$M(`/api/auth/link/verify`,{token:y}).then(()=>{s(`user`),ge()}).catch(e=>k(e instanceof Error?e.message:String(e))).finally(()=>{b(``),te(!1)}))},[y,d,o]),(0,M.useEffect)(()=>{pe&&d&&fe&&window.location.replace(fe)},[pe,fe,d]),(0,M.useEffect)(()=>{if(T<=Date.now())return;let e=setInterval(()=>{D(Date.now()),Date.now()>=T&&clearInterval(e)},1e3);return()=>clearInterval(e)},[T]);let _e=Math.max(0,Math.ceil((T-E)/1e3));(0,M.useEffect)(()=>{C&&!O&&re&&de.current?.querySelector(`input`)?.focus()},[O,C,re]);async function ve(e){try{await navigator.clipboard.writeText(e),le(!0)}catch{k(`Clipboard access failed. Select and copy the token manually.`)}}if(ie?.ingest_token)return(0,N.jsx)(eN,{wide:!0,children:(0,N.jsxs)(oe,{gap:`lg`,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Setup complete`}),(0,N.jsx)(xe,{order:1,mt:`xs`,fz:{base:28,sm:32},lh:1.08,children:`Save your ingest token`})]}),(0,N.jsx)(ue,{c:`dimmed`,children:`Fanout shows this token once. Store it with your collector secrets before continuing.`}),(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,N.jsx)(ms,{block:!0,children:ie.suggested_endpoint??window.location.origin})]}),(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`Header`}),(0,N.jsxs)(ms,{block:!0,children:[ie.ingest_header_name??`Authorization`,`: Bearer `,ie.ingest_token]})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),(0,N.jsxs)(ne,{grow:!0,align:`stretch`,children:[(0,N.jsx)(ce,{variant:`light`,radius:`md`,leftSection:se?(0,N.jsx)(me,{size:16,weight:`bold`}):(0,N.jsx)(Ee,{size:16}),onClick:()=>void ve(`${ie.ingest_header_name??`Authorization`}: Bearer ${ie.ingest_token}`),children:se?`Copied`:`Copy header`}),(0,N.jsx)(ce,{radius:`md`,rightSection:(0,N.jsx)(gM,{size:16,weight:`bold`}),onClick:()=>{s(`user`),ae(null),ge()},children:`Continue to Fanout`})]}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ve(ie.ingest_token??``),children:`Copy token only`})]})});if(!d||!i||y)return(0,N.jsx)(je,{mih:`100dvh`,children:(0,N.jsx)(Ie,{size:`sm`})});if(!n)return(0,N.jsx)(eN,{children:(0,N.jsxs)(oe,{gap:`lg`,children:[(0,N.jsx)(ke,{}),(0,N.jsx)(xe,{order:1,children:`Fanout is unavailable`}),(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re||`Authentication status could not be loaded.`})]})});if(pe&&fe)return null;if(pe)return(0,N.jsx)(JM.Provider,{value:n,children:(0,N.jsx)(XM.Provider,{value:c??{id:``,email:p,display_name:h,status:`active`,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=fe?`/api/auth/oidc/start?return_to=${encodeURIComponent(fe)}`:`/api/auth/oidc/start`;return(0,N.jsx)(eN,{children:(0,N.jsxs)(oe,{gap:28,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(oe,{gap:10,children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Secure workspace`}),(0,N.jsx)(xe,{order:1,fz:{base:28,sm:32},lh:1.08,children:`Sign in`}),(0,N.jsx)(ue,{c:`dimmed`,size:`md`,lh:1.6,children:`Use your organization's identity provider to continue.`})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),(0,N.jsx)(ce,{component:`a`,href:e,size:`md`,radius:`md`,rightSection:(0,N.jsx)(gM,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function ye(){te(!0),k(``);try{await $M(`/api/auth/code/send`,{email:p}),w(!0),S(``),ee(Date.now()+3e4),D(Date.now())}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}async function A(e){te(!0),k(``);try{await $M(`/api/auth/code/verify`,{email:p,code:e}),s(`user`),w(!1),S(``),ee(0),ge()}catch(e){S(``),k(e instanceof Error?e.message:String(e))}finally{te(!1)}}function j(){w(!1),S(``),k(``)}async function be(e){e.preventDefault(),te(!0),k(``);try{if(n?.setup_required){let e=await $M(`/api/auth/setup`,{email:p,display_name:h,setup_token:_});e.ingest_token?ae(e):(s(`user`),ge())}else if(C){await A(x);return}else{await ye();return}}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}let Se=C&&!n?.setup_required,we=n?.setup_required?`Create the first admin`:Se?`Check your email`:n?.self_signup?`Sign in or create an account`:`Sign in`,Te=n?.setup_required?`Use the one-time token printed by the Fanout process.`:n?.smtp_configured?Se?`We sent a code to ${p}.`:n?.self_signup?`Enter your email to sign in or create a viewer account. No password needed.`:`Enter your email and we’ll send a short verification code. No password needed.`:`Email delivery is not configured. Ask the operator to run fanout login-link with your email address.`;return(0,N.jsx)(eN,{children:(0,N.jsxs)(oe,{gap:28,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(oe,{gap:10,children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:n?.setup_required?`One-time setup`:`Secure workspace`}),(0,N.jsx)(xe,{order:1,fz:{base:28,sm:32},lh:1.08,children:we}),Te&&(0,N.jsx)(ue,{c:`dimmed`,size:`md`,lh:1.6,maw:390,children:Te})]}),(0,N.jsx)(`form`,{onSubmit:be,children:(0,N.jsxs)(oe,{gap:`md`,children:[(0,N.jsx)(Gc,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:p,onChange:e=>m(e.currentTarget.value),disabled:C,variant:`filled`,radius:`md`,size:`md`,autoFocus:!C}),n?.setup_required&&(0,N.jsx)(Gc,{label:`Display name`,placeholder:`Your display name`,value:h,onChange:e=>g(e.currentTarget.value),variant:`filled`,radius:`md`,size:`md`}),n?.setup_required&&(0,N.jsx)(Gc,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:_,onChange:e=>v(e.currentTarget.value),autoComplete:`one-time-code`,variant:`filled`,radius:`md`,size:`md`}),Se&&(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`Verification code`}),(0,N.jsx)(u,{ref:de,children:(0,N.jsx)(Wc,{length:6,type:`number`,oneTimeCode:!0,autoFocus:!0,value:x,onChange:S,onComplete:e=>void A(e),disabled:O,error:!!re,size:`md`,radius:`md`,"aria-label":`Verification code`,getInputProps:e=>({"aria-label":`Digit ${e+1}`})})}),(0,N.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,N.jsxs)(ue,{c:`dimmed`,size:`xs`,children:[`Sent to `,p]}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,leftSection:(0,N.jsx)(mM,{size:12,weight:`bold`}),onClick:j,disabled:O,children:`Change email`})]}),(0,N.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,children:`Codes expire in 5 minutes`}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ye(),disabled:O||_e>0,children:_e>0?`Resend in ${_e}s`:`Resend code`})]})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),Se?(0,N.jsx)(ce,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:O||x.length<6,rightSection:(0,N.jsx)(gM,{size:17,weight:`bold`}),children:`Verify code`}):(0,N.jsx)(ce,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:!n||!n.setup_required&&!n.smtp_configured,leftSection:n?.setup_required?(0,N.jsx)(BM,{size:17,weight:`bold`}):void 0,rightSection:n?.setup_required?void 0:(0,N.jsx)(gM,{size:17,weight:`bold`}),children:n?.setup_required?`Create admin`:`Send code`})]})})]})})}var iN=[`agent-threads`];async function aN(e){let t=await KM(e);if(!t.ok)throw Error(`Request failed (${t.status})`);return t.json()}var oN=[];for(let e=0;e<256;++e)oN.push((e+256).toString(16).slice(1));function sN(e,t=0){return(oN[e[t+0]]+oN[e[t+1]]+oN[e[t+2]]+oN[e[t+3]]+`-`+oN[e[t+4]]+oN[e[t+5]]+`-`+oN[e[t+6]]+oN[e[t+7]]+`-`+oN[e[t+8]]+oN[e[t+9]]+`-`+oN[e[t+10]]+oN[e[t+11]]+oN[e[t+12]]+oN[e[t+13]]+oN[e[t+14]]+oN[e[t+15]]).toLowerCase()}var cN=new Uint8Array(16);function lN(){return crypto.getRandomValues(cN)}var uN={};function dN(e,t,n){let r;if(e)r=pN(e.random??e.rng?.()??lN(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=lN();fN(uN,e,i),r=pN(i,uN.msecs,uN.seq,t,n)}return t??sN(r)}function fN(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=mN(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function pN(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=mN(e),r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}function mN(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function hN(){return dN()}var gN=[`dashboards`],_N=3e4;async function vN(e,t){let{json:n,...r}=t??{},i=new Headers(r.headers),a=r.body;n!==void 0&&(i.set(`content-type`,`application/json`),a=JSON.stringify(n));let o=await KM(e,{...r,headers:i,body:a}),s=await o.json().catch(()=>({}));if(!o.ok)throw new VM(s.message??`Request failed (${o.status})`,o.status,s.problems??[],s.code??``);return s}var yN=e=>`/api/dashboards/${encodeURIComponent(e)}`,bN=()=>vN(`/api/dashboards`).then(e=>e.dashboards),xN=(e,t)=>vN(yN(e),{signal:t}),SN=(e,t)=>vN(`${yN(e)}/versions`,{signal:t}).then(e=>e.versions),CN=(e,t,n)=>vN(`${yN(e)}/versions/${t}`,{signal:n}),wN=(e,t)=>vN(`${yN(e)}/versions/${t}/restore`,{method:`POST`}),TN=(e,t,n,r)=>vN(yN(e),{method:`PUT`,json:{spec:t,base_version:n,message:r}}),EN=(e,t,n,r)=>vN(yN(e),{method:`PATCH`,json:{operations:t,base_version:n,message:r}}),DN=(e,t)=>vN(`/api/panels/query`,{method:`POST`,json:e,signal:t}).then(e=>e.results),ON=e=>vN(`/api/telemetry/schema`,{signal:e}),kN=(e,t)=>vN(`/api/annotations`,{method:`POST`,json:e,signal:t}),AN=(e,t)=>vN(`/api/panels/variables/resolve`,{method:`POST`,json:e,signal:t}).then(e=>e.options),jN=(e,t)=>vN(`/api/panels/exemplars`,{method:`POST`,json:e,signal:t});function MN(e,t){let n=new URLSearchParams({namespace:e.namespace??``,from:e.window_from,to:e.window_to,limit:`200`});return vN(`/api/traces/${encodeURIComponent(e.trace_id??``)}?${n}`,{signal:t})}function NN(){let{setColorScheme:e}=Br(),t=Ur(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,M.useState)(!1);return(0,N.jsx)(Ot,{label:`Switch to ${n} theme`,opened:r,children:(0,N.jsx)(Pi,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onFocus:()=>i(!0),onBlur:()=>i(!1),onClick:()=>{i(!1),e(n)},children:t===`dark`?(0,N.jsx)(IM,{size:17,weight:`bold`}):(0,N.jsx)(wM,{size:17,weight:`bold`})})})}var PN={home:`https://fanout.run/start/what-fanout-is`,ingest:`https://fanout.run/start/send-telemetry`,connect:`https://fanout.run/guides/connect-over-mcp`};async function FN(e,t){let n=new URLSearchParams({page_size:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await KM(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function IN({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=OA(),[f,p]=(0,M.useState)(``),[m]=pr(f.trim(),250),[h,g]=(0,M.useState)(null),[_,v]=(0,M.useState)(null),[y,b]=(0,M.useState)(``),[x,S]=(0,M.useState)(``),[w,T]=(0,M.useState)(!1),ee=(0,M.useRef)(null);(0,M.useImperativeHandle)(u,()=>({focusSearch:()=>ee.current?.focus()}),[]),(0,M.useEffect)(()=>{r&&requestAnimationFrame(()=>ee.current?.focus())},[r]);let E=Qj({queryKey:[...iN,m],queryFn:({pageParam:e})=>FN(m,e),initialPageParam:``,getNextPageParam:e=>e.next_cursor??void 0,enabled:e}),D=Zj({queryKey:gN,queryFn:bN,refetchInterval:3e4,staleTime:_N}),O=(0,M.useMemo)(()=>E.data?.pages.flatMap(e=>e.items)??[],[E.data]),te=(0,M.useMemo)(()=>HN(O),[O]),re=Zj({queryKey:[`telemetry-schema`,`1h`],queryFn:()=>aN(`/api/telemetry/schema?window=1h`),enabled:!!m&&!!l,staleTime:6e4}),k=(0,M.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(re.data?.services??[]).map(e=>e.value).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[re.data,m]),ie=(0,M.useMemo)(()=>{let e=D.data??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[D.data,m]);function ae(e){S(``),b(e.title),g(e)}async function se(){if(h&&y.trim()){T(!0),S(``);try{let e=await KM(`/api/agent/threads/${encodeURIComponent(h.id)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:y.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:iN}),g(null)}catch(e){S(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{T(!1)}}}async function le(){if(_){T(!0),S(``);try{let e=await KM(`/api/agent/threads/${encodeURIComponent(_.id)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.id;v(null),await d.invalidateQueries({queryKey:iN}),await d.invalidateQueries({queryKey:gN}),o(t)}catch(e){S(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{T(!1)}}}return(0,N.jsxs)(oe,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,N.jsx)(ce,{leftSection:(0,N.jsx)(AM,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,N.jsx)(wt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,N.jsxs)(oe,{gap:`lg`,pb:`sm`,children:[e&&(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(LN,{children:`Chats`}),E.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),E.isError&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!E.isLoading&&!E.isError&&O.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),te.map(e=>(0,N.jsxs)(oe,{gap:2,children:[te.length>1&&(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,N.jsx)(RN,{thread:e,active:e.id===t,onSelect:()=>a(e.id),onRename:()=>ae(e),onDelete:()=>{S(``),v(e)}},e.id))]},e.label)),E.hasNextPage&&(0,N.jsx)(ce,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:E.isFetchingNextPage,onClick:()=>void E.fetchNextPage(),children:`See all`})]}),m&&l&&re.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),m&&l&&(re.isSuccess||re.isError)&&(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(LN,{children:`Services`}),re.isError&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,children:`Services could not be searched`}),re.isSuccess&&k.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,children:`No matching services`}),k.map(e=>(0,N.jsx)(C,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,N.jsx)(ue,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(LN,{children:`Dashboards`}),D.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),D.isError&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!D.isLoading&&!D.isError&&m&&ie.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),ie.map(e=>{let t=e.id===n;return(0,N.jsxs)(oe,{gap:0,children:[(0,N.jsx)(C,{component:`a`,href:`/dashboards/${encodeURIComponent(e.id)}`,className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),s(e.id))},children:(0,N.jsxs)(ne,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,N.jsx)(ue,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,N.jsx)(cs,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})}),e.origin&&(0,N.jsx)(C,{component:`a`,href:`/chat/${encodeURIComponent(e.origin.thread_id)}`,"data-request-provenance":!0,px:`sm`,pb:`xs`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),a(e.origin.thread_id))},children:(0,N.jsxs)(ue,{size:`xs`,c:`dimmed`,lineClamp:2,children:[`Built from: `,e.origin.request_excerpt]})})]},e.id)}),e&&(0,N.jsx)(ce,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,N.jsx)(PM,{size:14,weight:`fill`}),onClick:c,children:D.data?.length===0?`New dashboard`:`Create with AI`})]})]})}),(0,N.jsx)(Gc,{ref:ee,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,N.jsx)(SM,{size:15}),rightSection:(0,N.jsx)(Ls,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,N.jsx)(Rc,{opened:h!==null,onClose:()=>!w&&g(null),title:`Rename chat`,centered:!0,children:(0,N.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),se()},children:(0,N.jsxs)(oe,{children:[(0,N.jsx)(Gc,{label:`Name`,value:y,onChange:e=>b(e.currentTarget.value),maxLength:120,autoFocus:!0}),x&&(0,N.jsx)(Ce,{color:`bad`,children:x}),(0,N.jsxs)(ne,{justify:`flex-end`,children:[(0,N.jsx)(ce,{variant:`default`,onClick:()=>g(null),disabled:w,children:`Cancel`}),(0,N.jsx)(ce,{type:`submit`,loading:w,disabled:!y.trim(),children:`Save`})]})]})})}),(0,N.jsx)(Rc,{opened:_!==null,onClose:()=>!w&&v(null),title:`Delete chat?`,centered:!0,children:(0,N.jsxs)(oe,{children:[(0,N.jsxs)(ue,{size:`sm`,children:[`This permanently removes `,(0,N.jsx)(ue,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),x&&(0,N.jsx)(Ce,{color:`bad`,children:x}),(0,N.jsxs)(ne,{justify:`flex-end`,children:[(0,N.jsx)(ce,{variant:`default`,onClick:()=>v(null),disabled:w,children:`Cancel`}),(0,N.jsx)(ce,{color:`bad`,loading:w,onClick:()=>void le(),children:`Delete`})]})]})})]})}function LN({children:e}){return(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function RN({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,N.jsx)(u,{"data-active":t||void 0,className:`rail-row`,children:(0,N.jsxs)(ne,{gap:2,wrap:`nowrap`,children:[(0,N.jsx)(C,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,N.jsxs)(oe,{gap:0,children:[(0,N.jsx)(ue,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,children:UN(e.updated_at)})]})}),(0,N.jsxs)(Sc,{position:`bottom-end`,withinPortal:!0,children:[(0,N.jsx)(Sc.Target,{children:(0,N.jsx)(Pi,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,N.jsx)(bM,{size:18,weight:`bold`})})}),(0,N.jsxs)(Sc.Dropdown,{children:[(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(EM,{size:15}),onClick:r,children:`Rename`}),(0,N.jsx)(Sc.Item,{color:`bad`,leftSection:(0,N.jsx)(RM,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function zN(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function BN(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var VN=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function HN(e){let t=BN(new Date),n=new Map;for(let r of e){let e=Math.floor((t-BN(zN(r.updated_at)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return VN.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function UN(e){let t=zN(e),n=BN(new Date);return Math.floor((n-BN(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function WN({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=Qe(),s=ze(),c=Xn({select:e=>e.location.pathname}),{dashboardId:l}=Sn({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=Dr(!1),[p,m]=(0,M.useState)(!1),[h,g]=(0,M.useState)(``),_=(0,M.useRef)(null),v=ie(`(max-width: 62em)`),y=(0,M.useRef)(v);y.current=v,(0,M.useEffect)(()=>{f.close()},[c]),(0,M.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{}}),onCreateDashboard:()=>o(tt),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,N.jsxs)(Jo,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,N.jsx)(Jo.Header,{children:(0,N.jsxs)(ne,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,N.jsxs)(ne,{gap:`sm`,wrap:`nowrap`,children:[(0,N.jsx)(ds,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,N.jsx)(ke,{size:`small`})]}),(0,N.jsxs)(ne,{gap:`xs`,wrap:`nowrap`,children:[(0,N.jsx)(Ot,{label:`Documentation`,children:(0,N.jsx)(Pi,{component:`a`,href:PN.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,N.jsx)(vM,{size:17,weight:`bold`})})}),(0,N.jsx)(NN,{}),(0,N.jsx)(GN,{onError:g})]})]})}),(0,N.jsx)(Jo.Navbar,{p:`sm`,children:(0,N.jsx)(IN,{ref:_,...b})}),(0,N.jsx)(Ps,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,N.jsx)(ke,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,N.jsx)(IN,{...b,autoFocusSearch:d&&p})}),(0,N.jsxs)(Jo.Main,{children:[h&&(0,N.jsx)(Ce,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function GN({onError:e}){let t=ze(),n=ZM(),r=(n.display_name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,N.jsxs)(Sc,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,N.jsx)(Sc.Target,{children:(0,N.jsx)(Pi,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`${r} account menu`,children:(0,N.jsx)(as,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,N.jsxs)(Sc.Dropdown,{children:[(0,N.jsx)(Sc.Label,{children:n.email||`Signed in`}),(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(OM,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,N.jsx)(Sc.Divider,{}),(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(MM,{size:15}),onClick:()=>void qM().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function KN(){let{agent_available:e}=YM(),t=ze(),n=OA(),{threadId:r}=Sn({strict:!1}),[i,a]=(0,M.useState)(hN),o=(0,M.useRef)(new Set),s=r??i,[c,l]=(0,M.useState)([]),[u,d]=(0,M.useState)({}),[f,p]=(0,M.useState)(``),[m,h]=(0,M.useState)(!1),[g,_]=(0,M.useState)(!1),[v,y]=(0,M.useState)(``),[b,x]=(0,M.useState)(!1),S=(0,M.useRef)(!1),[C,w]=(0,M.useState)(``),[T,ee]=(0,M.useState)(``),[E,D]=(0,M.useState)(0),O=(0,M.useRef)(null),te=(0,M.useRef)({}),ne=(0,M.useRef)(null),re=(0,M.useRef)(new Map),k=(0,M.useMemo)(()=>new EA({url:`/api/agent/runs`,threadId:s,fetch:(e,t)=>KM(e,t)}),[s]),ie=!e||f===s;function ae(){re.current.clear(),y(``)}function oe(e){return S.current||e instanceof Error&&e.name===`AbortError`}(0,M.useEffect)(()=>{let t=!0;if(l([]),te.current={},d({}),p(``),h(!1),_(!1),S.current=!1,x(!1),ae(),ee(``),!e){p(s);return}!r||o.current.has(s)?(k.setMessages([]),p(s)):KM(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}k.setMessages(e.messages??[]),l(e.messages??[]),p(s)}}).catch(()=>{t&&(O.current=null,ee(`This chat could not be restored. Start a new chat or try again.`))});let i=k.subscribe({onMessagesChanged:({messages:e})=>l([...e]),onRunInitialized:()=>{S.current=!1,x(!1),_(!0),ee(``)},onTextMessageContentEvent:({event:e})=>{e.delta&&y(``)},onToolCallStartEvent:({event:e})=>{re.current.set(e.toolCallId,at(e.toolCallName)),y(at(e.toolCallName))},onToolCallResultEvent:({event:e,messages:t})=>{re.current.delete(e.toolCallId),y([...re.current.values()].at(-1)??`Analyzing your system`);let r=$e(e.toolCallId,e.content,t);r&&(n.invalidateQueries({queryKey:gN}),n.invalidateQueries({queryKey:[`dashboard`,r.id]}),n.invalidateQueries({queryKey:[`dashboard-versions`,r.id]}))},onRunErrorEvent:({event:e})=>{e.code===`abort`||S.current?(ee(``),x(!0)):(console.warn(`Agent run error`,e.code),ee(Xe(e.code))),_(!1),ae()},onRunFinalized:({messages:e})=>{let t=[...e];l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),ae(),o.current.delete(s),n.invalidateQueries({queryKey:iN})},onRunFailed:e=>{oe(e.error)?(ee(``),x(!0)):(console.error(`Agent run failed`,e),ee(Xe())),_(!1),ae(),o.current.delete(s),n.invalidateQueries({queryKey:iN})}});return()=>{t=!1,i.unsubscribe(),k.abortRun()}},[k,e,n,E,s]),(0,M.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ne.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ne.current?.focus()))),e.key===`Escape`&&n===ne.current&&(w(``),ne.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function se(){_(!0),ee(``);try{let{context:e=[],...t}=te.current;await k.runAgent({context:e,forwardedProps:t})}catch(e){oe(e)?(ee(``),x(!0)):(console.error(`Agent run failed`,e),ee(Xe())),_(!1),ae(),o.current.delete(s)}}async function ce(n,i){let a=n.trim();if(!e||!a||g||!ie||m)return;te.current={...i},r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let c={id:hN(),role:`user`,content:a};k.addMessage(c),l([...k.messages]),d(e=>({...e,[c.id]:Date.now()})),w(``),await se()}(0,M.useEffect)(()=>{let e=O.current;ie&&r&&e&&(O.current=null,ce(e.text,e.options))},[ie,r,s]);function le(e){e.preventDefault(),ce(C)}function ue(){S.current=!0,ee(``),x(!0),k.abortRun(),_(!1),ae(),o.current.delete(s)}function de(){!g&&k.messages.some(e=>e.role===`user`)&&se()}function fe(n,r){if(!e)return;let i=hN();o.current.add(i),O.current=n?{text:n,options:{...r}}:null,t({to:`/chat/$threadId`,params:{threadId:i}})}function pe(){k.abortRun(),O.current=null,te.current={},a(hN()),t({to:`/chat`})}function me(e){O.current=null,te.current={},t({to:`/chat/$threadId`,params:{threadId:e}})}function he(){D(e=>e+1)}return(0,N.jsx)(it.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:ie,running:g,activity:v,stopped:b,input:C,setInput:w,error:T,inputRef:ne,send:ce,submit:le,stop:ue,retry:de,reloadThread:he,openChat:fe,newThread:pe,selectThread:me},children:(0,N.jsx)(WN,{children:(0,N.jsx)(Bn,{})})})}function qN(){let e=(0,M.useMemo)(()=>new Rj,[]);return(0,N.jsx)(kA,{client:e,children:(0,N.jsx)(rN,{children:(0,N.jsx)(KN,{})})})}var JN=On({component:qN,notFoundComponent:()=>(0,N.jsx)(Ve,{to:`/`,replace:!0})}),YN=kn(`/`)({component:An(()=>ot(()=>import(`./routes-D2AdaqvY.js`),__vite__mapDeps([0,1,2])),`component`)}),XN=kn(`/settings`)({component:An(()=>ot(()=>import(`./settings-BSIny0s-.js`),__vite__mapDeps([3,1,4,5,6])),`component`)}),ZN=kn(`/chat/`)({component:An(()=>ot(()=>import(`./chat.index-D3lAczL5.js`),__vite__mapDeps([7,8,1,4,9,5,10])),`component`)}),QN=kn(`/chat/$threadId`)({component:An(()=>ot(()=>import(`./chat._threadId-D3lAczL5.js`),__vite__mapDeps([11,8,1,4,9,5,10])),`component`)});function $N(e){try{let t=typeof e==`string`?e:JSON.stringify(e);if(!t||t.length>4096)return;let n=typeof e==`string`?JSON.parse(e):e;if(!n||typeof n!=`object`)return;let r=n;return typeof r.panel_id!=`string`||!/^([a-z][a-z0-9_]{0,39})$/.test(r.panel_id)||r.kind!==`traces`&&r.kind!==`logs`||typeof r.from!=`string`||typeof r.to!=`string`||!Number.isFinite(Date.parse(r.from))||!Number.isFinite(Date.parse(r.to))||Date.parse(r.from)>=Date.parse(r.to)||Date.parse(r.to)-Date.parse(r.from)>2592e6||typeof r.window_from!=`string`||typeof r.window_to!=`string`||!Number.isFinite(Date.parse(r.window_from))||!Number.isFinite(Date.parse(r.window_to))||Date.parse(r.window_from)>=Date.parse(r.window_to)||Date.parse(r.window_to)-Date.parse(r.window_from)>2592e6||Date.parse(r.from)Date.parse(r.window_to)||!r.dimensions||Array.isArray(r.dimensions)||typeof r.dimensions!=`object`||Object.keys(r.dimensions).length>3||Object.values(r.dimensions).some(e=>typeof e!=`string`||e.length>500)||r.trace_id!==void 0&&(typeof r.trace_id!=`string`||r.trace_id.length>128)||r.namespace!==void 0&&(typeof r.namespace!=`string`||r.namespace.length>200)||r.bucket&&(!Number.isFinite(r.bucket.lower)||r.bucket.lower<0||r.bucket.upper!==void 0&&(!Number.isFinite(r.bucket.upper)||r.bucket.upper<=r.bucket.lower))?void 0:{panel_id:r.panel_id,kind:r.kind,from:r.from,to:r.to,window_from:r.window_from,window_to:r.window_to,dimensions:r.dimensions,trace_id:r.trace_id,namespace:r.namespace,bucket:r.bucket}}catch{return}}function eP(e,t,n){if(!e.drill&&e.viz!==`service_map`&&!n.trace_id||t.from_ms===void 0||t.to_ms===void 0)return;let r=t.from_ms,i=t.to_ms;if(n.from!==void 0&&n.to!==void 0&&(r=Math.max(r,Date.parse(n.from)),i=Math.min(i,Date.parse(n.to))),n.time!==void 0&&!n.trace_id){let e=/^(\d+)(s|m|h|d)$/.exec(t.interval??``),a=e?Number(e[1])*{s:1e3,m:6e4,h:36e5,d:864e5}[e[2]]:6e4;r=Math.max(r,n.time),i=Math.min(i,n.time+a)}return $N(JSON.stringify({panel_id:e.id,kind:n.trace_id||e.viz===`service_map`?`traces`:e.drill,from:n.from&&Date.parse(n.from)===r?n.from:new Date(r).toISOString(),to:n.to&&Date.parse(n.to)===i?n.to:new Date(i).toISOString(),window_from:new Date(t.from_ms).toISOString(),window_to:new Date(t.to_ms).toISOString(),dimensions:n.dimensions,trace_id:n.trace_id,namespace:n.namespace,bucket:n.bucket}))}function tP(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))for(let e of Array.isArray(r)?r:[r]){if(e===void 0)continue;let r=typeof e==`string`&&/^[{"]/.test(e);t.append(n,r||typeof e==`object`&&e?JSON.stringify(e):String(e))}let n=t.toString();return n?`?${n}`:``}function nP(e){let t=Object.create(null),n=e=>{if(e.startsWith(`{`)||e.startsWith(`"`))try{let t=JSON.parse(e);if(typeof t==`string`)return/^[{"]/.test(t)?t:e;if(typeof t==`object`&&t&&!Array.isArray(t))return t}catch{}return e},r=new URLSearchParams(e);for(let e of new Set(r.keys())){let i=r.getAll(e).map(n);t[e]=i.length===1?i[0]:i}return t}var rP=[`5m`,`15m`,`1h`,`3h`,`6h`,`12h`,`24h`,`2d`,`7d`,`30d`],iP=[`off`,`10s`,`30s`,`1m`,`5m`],aP=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}[Tt](?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:[Zz]|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/.test(e)||Number.isNaN(Date.parse(e)))return!1;let[t,n,r]=e.slice(0,10).split(`-`).map(Number),i=new Date(0);return i.setUTCFullYear(t,n-1,r),i.setUTCHours(0,0,0,0),i.getUTCFullYear()===t&&i.getUTCMonth()===n-1&&i.getUTCDate()===r},oP=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):void 0;function sP(e){let t={};typeof e.range==`string`&&rP.includes(e.range)?t.range=e.range:aP(e.from)&&aP(e.to)&&Date.parse(e.from)typeof e==`string`)&&(i[e]=t)}}else{let t=oP(n);t!==void 0&&(i[e]=t)}}}Object.keys(i).length>0&&(t.vars=i);let a=$N(e.drill);return a&&(t.drill=JSON.stringify(a)),t}function cP(e){let t={};e.drill&&(t.drill=JSON.parse(e.drill)),e.range&&(t.range=e.range),e.from&&e.to&&(t.from=e.from,t.to=e.to),e.compare&&(t.compare=e.compare),e.view&&(t.view=e.view),e.edit&&(t.edit=e.edit);for(let[n,r]of Object.entries(e.vars??{}))t[`var-${n}`]=Array.isArray(r)?{values:r}:r;return t}function lP(e,t){let n=new URL(e);return n.search=tP(cP({...sP(nP(n.search)),drill:JSON.stringify(t)})),n.href}function uP(e,t){let n=e.time.refresh??`30s`;return t.from&&t.to?{from:t.from,to:t.to,refresh:n}:t.range?{range:t.range,refresh:n}:{...e.time,refresh:n}}var dP=kn(`/dashboards/`)({component:An(()=>ot(()=>import(`./dashboards.index-hSYxsfH3.js`),__vite__mapDeps([12,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>cP(sP(e))}),fP=kn(`/dashboards/$dashboardId`)({component:An(()=>ot(()=>import(`./dashboards._dashboardId-Br5-Dkdq.js`),__vite__mapDeps([14,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>cP(sP(e))}),pP=YN.update({id:`/`,path:`/`,getParentRoute:()=>JN}),mP=XN.update({id:`/settings`,path:`/settings`,getParentRoute:()=>JN}),hP=ZN.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>JN}),gP=QN.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>JN}),_P=dP.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>JN}),vP={IndexRoute:pP,SettingsRoute:mP,ChatThreadIdRoute:gP,DashboardsDashboardIdRoute:fP.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>JN}),ChatIndexRoute:hP,DashboardsIndexRoute:_P},yP=Kn({routeTree:JN._addFileChildren(vP)._addFileTypes(),parseSearch:nP,stringifySearch:tP,defaultPreload:`intent`,scrollRestoration:!0}),bP=[`#fafafa`,`#e6e4de`,`#bfbdb6`,`#8b8e99`,`#565b69`,`#1d2433`,`#131721`,`#0b0e14`,`#080a10`,`#05070b`],xP=[`#f3ecfd`,`#ece3fb`,`#dcc9f7`,`#d2a6ff`,`#bf94ec`,`#a97ce0`,`#9163d6`,`#7c4dcc`,`#5b32a3`,`#40236f`],SP=[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],CP=[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],wP=[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],TP=[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`],EP={dark:{text:`#bfbdb6`,muted:`#8b8e99`,grid:`#1d2433`,surface:`#131721`,border:`#626777`},light:{text:`#4a5058`,muted:`#6b7280`,grid:`#eceef0`,surface:`#fcfcfc`,border:`#8c939d`}},DP={dark:[`#3987e5`,`#d95926`,`#199e70`,`#9085e9`,`#c98500`,`#d55181`],light:[`#2a78d6`,`#eb6834`,`#1baf7a`,`#4a3aa7`,`#eda100`,`#e87ba4`]},OP={micro:11,small:12,body:14,title:16,section:22,page:32},kP={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`},AP={brand:xP,ok:SP,warn:CP,bad:wP,info:TP},jP={light:7,dark:5};function MP(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function NP(e){let t=MP(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function PP(e){return Object.fromEntries(Object.entries(AP).map(([t,n])=>[`--fanout-color-${t}-contrast`,NP(n[jP[e]])]))}function FP(e){return t=>{let n=t.color??RP.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(AP,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var IP=.25,LP={xs:9,sm:10,md:11,lg:13,xl:16},RP={primaryColor:`brand`,primaryShade:jP,autoContrast:!0,luminanceThreshold:IP,colors:{dark:bP,brand:xP,ok:SP,warn:CP,bad:wP,info:TP},defaultRadius:`md`,fontFamily:kP.body,fontFamilyMonospace:kP.display,headings:{fontFamily:kP.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:VP(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:VP(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:BP(t.size)})},Menu:{defaultProps:{withInitialFocusPlaceholder:!1}},Drawer:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}},Modal:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}}}},zP=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":EP.light.muted,...PP(`light`)},dark:PP(`dark`)});function BP(e){let t=LP[e??`md`];return t===void 0||t>=OP.micro?{}:{"--badge-fz":`${OP.micro/16}rem`}}function VP(e,t){return!e||e===RP.primaryColor?{[t]:`var(--fanout-color-${RP.primaryColor}-contrast)`}:{}}var HP=FP(ee),UP=ri({...RP,variantColorResolver:HP});(0,$c.createRoot)(document.getElementById(`root`)).render((0,N.jsx)(M.StrictMode,{children:(0,N.jsx)(ni,{theme:UP,defaultColorScheme:`auto`,cssVariablesResolver:zP,children:(0,N.jsx)(Yn,{router:yP})})}));export{qy as $,EN as A,Gc as At,VM as B,Ei as Bt,gN as C,tb as Ct,CN as D,v_ as Dt,MN as E,S_ as Et,AN as F,ms as Ft,Pj as G,Er as Gt,EM as H,ai as Ht,wN as I,cs as It,HA as J,Qn as Jt,uj as K,cr as Kt,aN as L,F as Lt,jN as M,Sc as Mt,DN as N,Ls as Nt,bN as O,__ as Ot,TN as P,Ps as Pt,OA as Q,ZM as R,so as Rt,PN as S,Ob as St,ON as T,wy as Tt,bM as U,Ur as Ut,RM as V,hi as Vt,Zj as W,Ir as Wt,KA as X,on as Xt,PA as Y,gn as Yt,nj as Z,ln as Zt,rP as _,Yb as _t,EP as a,G as at,eP as b,U as bt,SP as c,Rb as ct,CP as d,mx as dt,Ky as et,fP as f,q as ft,sP as g,Pb as gt,uP as h,vb as ht,xP as i,Cb as it,kN as j,Rc as jt,SN as k,np as kt,DP as l,Zy as lt,lP as m,Ab as mt,MP as n,Wb as nt,kP as o,Mb as ot,dP as p,K as pt,oj as q,rr as qt,wP as r,Tb as rt,TP as s,xb as st,NP as t,_b as tt,OP as u,Bb as ut,iP as v,yx as vt,xN as w,Ay as wt,$N as x,Ib as xt,cP as y,Hb as yt,KM as z,Pi as zt}; \ No newline at end of file diff --git a/internal/ui/dist/assets/mcp-app-frame-Do9gIdfD.js b/internal/ui/dist/assets/mcp-app-frame-Ysb7bM2I.js similarity index 99% rename from internal/ui/dist/assets/mcp-app-frame-Do9gIdfD.js rename to internal/ui/dist/assets/mcp-app-frame-Ysb7bM2I.js index feb31a054..cdb47615f 100644 --- a/internal/ui/dist/assets/mcp-app-frame-Do9gIdfD.js +++ b/internal/ui/dist/assets/mcp-app-frame-Ysb7bM2I.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,d as i,f as a,p as o,u as s,y as c}from"./brand-DUaZkIz1.js";import{n as l}from"./chat-BqevyT9H.js";import{$ as u,Ct as d,Dt as f,Et as p,Ot as m,St as h,Tt as g,Ut as _,Vt as v,_t as y,at as b,bt as x,ct as S,dt as ee,et as C,ft as w,gt as T,ht as E,it as te,kt as ne,lt as re,mt as ie,nt as D,ot as O,pt as k,rt as ae,st as A,tt as oe,ut as se,vt as ce,wt as le,xt as j,yt as M,z as ue}from"./index-CEp3GmPL.js";var de={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`},fe;fe||={};function pe(e){return m(C,e)}function me(e){return f(u,e)}function he(e){return p(oe,e)}function N(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function P(e,t){if(!Array.isArray(e))return[];let n=new Set(t);return e.filter(e=>{if(typeof e!=`string`||/[\s;'\"]/.test(e))return!1;let t=e.match(/^([a-z]+):\/\/([^/]+)$/i);return!!(t&&n.has(t[1].toLowerCase()))})}function ge(e){let t=N(N(N(e)?.ui)?.csp),n=P(t?.connectDomains,[`http`,`https`,`ws`,`wss`]),r=P(t?.resourceDomains,[`http`,`https`]),i=P(t?.frameDomains,[`http`,`https`]),a=P(t?.baseUriDomains,[`http`,`https`]),o=r.length?` ${r.join(` `)}`:``,s=[`default-src 'none'`,`worker-src blob:`,`script-src 'self' 'unsafe-inline'${o}`,`style-src 'self' 'unsafe-inline'${o}`,`img-src 'self' data:${o}`,`media-src 'self' data:${o}`,`font-src 'self' data:${o}`,`connect-src ${n.length?n.join(` `):`'none'`}`];return i.length&&s.push(`frame-src ${i.join(` `)}`),a.length&&s.push(`base-uri ${a.join(` `)}`),`${s.join(`; `)};`}var _e=Object.create,ve=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyNames,F=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty,Se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ce=(e,t)=>{let n={};for(var r in e)ve(n,r,{get:e[r],enumerable:!0});return t&&ve(n,Symbol.toStringTag,{value:`Module`}),n},we=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=be(t),a=0,o=i.length,s;at[e]).bind(null,s),enumerable:!(r=ye(t,s))||r.enumerable});return e},Te=(e,t,n)=>(n=e==null?{}:_e(F(e)),we(t||!e||!e.__esModule?ve(n,`default`,{value:e,enumerable:!0}):n,e)),Ee=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),De=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),Oe=new Set([`https://json-schema.org/draft-07/schema`,`http://json-schema.org/draft-07/schema`]),ke=new Set([`https://json-schema.org/draft-06/schema`,`http://json-schema.org/draft-06/schema`]);function Ae(e){return typeof e==`string`&&De.has(e.replace(/#$/,``))}function je(e,t){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let n=e.$schema.replace(/#$/,``);if(Ee.has(n))return`2020-12`;if(De.has(n))return`2019-09`;if(Oe.has(n)||ke.has(n))return`draft-7`;throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var Me=`2025-11-25`,Ne=[Me,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],Pe=`io.modelcontextprotocol/related-task`,Fe=`io.modelcontextprotocol/protocolVersion`,Ie=`io.modelcontextprotocol/clientInfo`,Le=`io.modelcontextprotocol/serverInfo`,Re=`io.modelcontextprotocol/clientCapabilities`,ze=`io.modelcontextprotocol/subscriptionId`,Be=`io.modelcontextprotocol/logLevel`,Ve=ee(()=>j([x(),E(),A(),ae(),M(x(),Ve),O(Ve)])),I=M(x(),Ve),He=O(Ve),Ue=j([x(),E().int()]),We=x(),Ge=T({ttl:E().optional()}),Ke=T({taskId:x()}),qe=k({progressToken:Ue.optional(),[Pe]:Ke.optional()}),L=T({_meta:qe.optional()}),Je=L.extend({task:Ge.optional()}),R=T({method:x(),params:L.loose().optional()}),z=T({_meta:qe.optional()}),B=T({method:x(),params:z.loose().optional()}),Ye=k({get[Le](){return H.optional().catch(void 0)}}),V=k({_meta:Ye.optional()}),Xe=j([x(),E().int()]),Ze=T({jsonrpc:w(`2.0`),id:Xe,...R.shape}).strict(),Qe=T({jsonrpc:w(`2.0`),...B.shape}).strict(),$e=T({jsonrpc:w(`2.0`),id:Xe,result:V}).strict(),et=T({jsonrpc:w(`2.0`),id:Xe.optional(),error:T({code:E().int(),message:x(),data:h().optional()})}).strict(),tt=j([Ze,Qe,$e,et]),nt=j([$e,et]),rt=V.strict(),it=z.extend({requestId:Xe.optional(),reason:x().optional()}),at=B.extend({method:w(`notifications/cancelled`),params:it}),ot=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),st=T({icons:O(ot).optional()}),ct=T({name:x(),title:x().optional()}),H=ct.extend({...ct.shape,...st.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),lt=se(T({applyDefaults:A().optional()}),I),ut=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:lt.optional(),url:I.optional()}),I.optional())),dt=k({list:I.optional(),cancel:I.optional(),requests:k({sampling:k({createMessage:I.optional()}).optional(),elicitation:k({create:I.optional()}).optional()}).optional()}),ft=k({list:I.optional(),cancel:I.optional(),requests:k({tools:k({call:I.optional()}).optional()}).optional()}),pt=T({experimental:M(x(),I).optional(),sampling:T({context:I.optional(),tools:I.optional()}).optional(),elicitation:ut.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:dt.optional(),extensions:M(x(),I).optional()}),mt=L.extend({protocolVersion:x(),capabilities:pt,clientInfo:H}),ht=R.extend({method:w(`initialize`),params:mt}),gt=T({experimental:M(x(),I).optional(),logging:I.optional(),completions:I.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ft.optional(),extensions:M(x(),I).optional()}),_t=V.extend({protocolVersion:x(),capabilities:gt,serverInfo:H,instructions:x().optional()}),vt=B.extend({method:w(`notifications/initialized`),params:z.optional()}),yt=R.extend({method:w(`server/discover`),params:L.optional()}),bt=V.extend({supportedVersions:O(x()),capabilities:gt,instructions:x().optional()}),xt=R.extend({method:w(`ping`),params:L.optional()}),St=T({progress:E(),total:y(E()),message:y(x())}),Ct=T({...z.shape,...St.shape,progressToken:Ue}),wt=B.extend({method:w(`notifications/progress`),params:Ct}),Tt=L.extend({cursor:We.optional()}),Et=R.extend({params:Tt.optional()}),Dt=V.extend({nextCursor:We.optional()}),Ot=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),kt=Ot.extend({text:x()}),At=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),jt=Ot.extend({blob:At}),Mt=D([`user`,`assistant`]),Nt=T({audience:O(Mt).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Pt=T({...ct.shape,...st.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Nt.optional(),_meta:y(k({}))}),Ft=T({...ct.shape,...st.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Nt.optional(),_meta:y(k({}))}),It=Et.extend({method:w(`resources/list`)}),Lt=Dt.extend({resources:O(Pt)}),U=Et.extend({method:w(`resources/templates/list`)}),W=Dt.extend({resourceTemplates:O(Ft)}),Rt=L.extend({uri:x()}),zt=Rt,Bt=R.extend({method:w(`resources/read`),params:zt}),Vt=V.extend({contents:O(j([kt,jt]))}),Ht=B.extend({method:w(`notifications/resources/list_changed`),params:z.optional()}),Ut=Rt,Wt=R.extend({method:w(`resources/subscribe`),params:Ut}),Gt=Rt,Kt=R.extend({method:w(`resources/unsubscribe`),params:Gt}),qt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Jt=L.extend({notifications:qt}),Yt=R.extend({method:w(`subscriptions/listen`),params:Jt}),Xt=z.extend({notifications:qt}),Zt=B.extend({method:w(`notifications/subscriptions/acknowledged`),params:Xt}),Qt=Ye.extend({[ze]:Xe}),$t=V.extend({_meta:Qt}),en=z.extend({uri:x()}),tn=B.extend({method:w(`notifications/resources/updated`),params:en}),G=T({name:x(),description:y(x()),required:y(A())}),nn=T({...ct.shape,...st.shape,description:y(x()),arguments:y(O(G)),_meta:y(k({}))}),rn=Et.extend({method:w(`prompts/list`)}),an=Dt.extend({prompts:O(nn)}),on=L.extend({name:x(),arguments:M(x(),x()).optional()}),sn=R.extend({method:w(`prompts/get`),params:on}),cn=T({type:w(`text`),text:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),K=T({type:w(`image`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),ln=T({type:w(`audio`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),un=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),dn=T({type:w(`resource`),resource:j([kt,jt]),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),fn=Pt.extend({type:w(`resource_link`)}),pn=j([cn,K,ln,fn,dn]),mn=T({role:Mt,content:pn}),hn=V.extend({description:x().optional(),messages:O(mn)}),gn=B.extend({method:w(`notifications/prompts/list_changed`),params:z.optional()}),_n=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),vn=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),yn=T({...ct.shape,...st.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),Ve).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:k({$schema:x().optional()}).optional(),annotations:_n.optional(),execution:vn.optional(),_meta:M(x(),h()).optional()}),bn=Et.extend({method:w(`tools/list`)}),xn=Dt.extend({tools:O(yn)}),Sn=V.extend({content:O(pn).default([]),structuredContent:h().optional(),isError:A().optional()}),Cn=Sn.or(V.extend({toolResult:h()})),wn=Je.extend({name:x(),arguments:M(x(),h()).optional()}),Tn=R.extend({method:w(`tools/call`),params:wn}),En=B.extend({method:w(`notifications/tools/list_changed`),params:z.optional()}),Dn=T({autoRefresh:A().default(!0),debounceMs:E().int().nonnegative().default(300)}),On=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),kn=L.extend({level:On}),An=R.extend({method:w(`logging/setLevel`),params:kn}),jn=z.extend({level:On,logger:x().optional(),data:h()}),Mn=B.extend({method:w(`notifications/message`),params:jn}),Nn=T({name:x().optional()}),Pn=T({hints:O(Nn).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),Fn=T({mode:D([`auto`,`required`,`none`]).optional()}),In=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(pn),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),Ln=S(`type`,[cn,K,ln]),Rn=S(`type`,[cn,K,ln,un,In]),zn=T({role:Mt,content:j([Rn,O(Rn)]),_meta:M(x(),h()).optional()}),Bn=Je.extend({messages:O(zn),modelPreferences:Pn.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:I.optional(),tools:O(yn).optional(),toolChoice:Fn.optional()}),Vn=R.extend({method:w(`sampling/createMessage`),params:Bn}),Hn=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:Mt,content:Ln}),Un=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:Mt,content:j([Rn,O(Rn)])}),Wn=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),Gn=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Kn=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),qn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Jn=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Yn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Xn=j([qn,Jn]),Zn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),Qn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),$n=j([Zn,Qn]),er=j([Yn,Xn,$n]),tr=j([er,Wn,Gn,Kn]),nr=Je.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),tr),required:O(x()).optional()}).catchall(h())}),rr=Je.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),ir=j([nr,rr]),ar=R.extend({method:w(`elicitation/create`),params:ir}),or=z.extend({elicitationId:x()}),sr=B.extend({method:w(`notifications/elicitation/complete`),params:or}),cr=V.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),lr=T({type:w(`ref/resource`),uri:x()}),ur=T({type:w(`ref/prompt`),name:x()}),dr=L.extend({ref:j([ur,lr]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),fr=R.extend({method:w(`completion/complete`),params:dr}),pr=V.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),mr=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),hr=R.extend({method:w(`roots/list`),params:L.optional()}),gr=V.extend({roots:O(mr)}),_r=B.extend({method:w(`notifications/roots/list_changed`),params:z.optional()}),vr=k({ttl:E().optional(),pollInterval:E().optional()}),yr=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),br=T({taskId:x(),status:yr,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),xr=V.extend({task:br}),Sr=z.merge(br),Cr=B.extend({method:w(`notifications/tasks/status`),params:Sr}),wr=R.extend({method:w(`tasks/get`),params:L.extend({taskId:x()})}),Tr=V.merge(br),Er=R.extend({method:w(`tasks/result`),params:L.extend({taskId:x()})}),Dr=V.loose(),Or=Et.extend({method:w(`tasks/list`)}),kr=Dt.extend({tasks:O(br)}),Ar=R.extend({method:w(`tasks/cancel`),params:L.extend({taskId:x()})}),jr=V.merge(br),Mr=j([xt,ht,yt,fr,An,sn,rn,It,U,Bt,Wt,Kt,Yt,Tn,bn]),Nr=j([at,wt,vt,_r]),Pr=j([rt,Hn,Un,cr,gr]),Fr=j([xt,Vn,ar,hr]),Ir=j([at,wt,Mn,tn,Ht,En,gn,Zt,sr]),Lr=j([rt,_t,bt,pr,hn,an,Lt,W,Vt,Sn,xn,$t]),q=d().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:de.custom,message:`URL must be parseable`,fatal:!0}),ne}).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`}),Rr=k({resource:x().url(),authorization_servers:O(q).optional(),jwks_uri:x().url().optional(),scopes_supported:O(x()).optional(),bearer_methods_supported:O(x()).optional(),resource_signing_alg_values_supported:O(x()).optional(),resource_name:x().optional(),resource_documentation:x().optional(),resource_policy_uri:x().url().optional(),resource_tos_uri:x().url().optional(),tls_client_certificate_bound_access_tokens:A().optional(),authorization_details_types_supported:O(x()).optional(),dpop_signing_alg_values_supported:O(x()).optional(),dpop_bound_access_tokens_required:A().optional()}),zr=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),service_documentation:q.optional(),revocation_endpoint:q.optional(),revocation_endpoint_auth_methods_supported:O(x()).optional(),revocation_endpoint_auth_signing_alg_values_supported:O(x()).optional(),introspection_endpoint:x().optional(),introspection_endpoint_auth_methods_supported:O(x()).optional(),introspection_endpoint_auth_signing_alg_values_supported:O(x()).optional(),code_challenge_methods_supported:O(x()).optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0),dpop_signing_alg_values_supported:O(x()).optional()}),Br=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,userinfo_endpoint:q.optional(),jwks_uri:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),acr_values_supported:O(x()).optional(),subject_types_supported:O(x()),id_token_signing_alg_values_supported:O(x()),id_token_encryption_alg_values_supported:O(x()).optional(),id_token_encryption_enc_values_supported:O(x()).optional(),userinfo_signing_alg_values_supported:O(x()).optional(),userinfo_encryption_alg_values_supported:O(x()).optional(),userinfo_encryption_enc_values_supported:O(x()).optional(),request_object_signing_alg_values_supported:O(x()).optional(),request_object_encryption_alg_values_supported:O(x()).optional(),request_object_encryption_enc_values_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),display_values_supported:O(x()).optional(),claim_types_supported:O(x()).optional(),claims_supported:O(x()).optional(),service_documentation:x().optional(),claims_locales_supported:O(x()).optional(),ui_locales_supported:O(x()).optional(),claims_parameter_supported:A().optional(),request_parameter_supported:A().optional(),request_uri_parameter_supported:A().optional(),require_request_uri_registration:A().optional(),op_policy_uri:q.optional(),op_tos_uri:q.optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0)}),Vr=T({...Br.shape,...zr.pick({code_challenge_methods_supported:!0}).shape}),Hr=T({access_token:x(),id_token:x().optional(),token_type:x(),expires_in:he().optional(),scope:x().optional(),refresh_token:x().optional(),issuer:x().optional().catch(void 0)}).strip(),Ur=T({issued_token_type:w(`urn:ietf:params:oauth:token-type:id-jag`),access_token:x(),token_type:x().optional(),expires_in:E().optional(),scope:x().optional()}).strip(),Wr=T({error:x(),error_description:x().optional(),error_uri:x().optional()}),Gr=q.optional().or(w(``).transform(()=>void 0)),Kr=T({redirect_uris:O(q),token_endpoint_auth_method:x().optional(),grant_types:O(x()).optional(),response_types:O(x()).optional(),application_type:x().optional(),client_name:x().optional(),client_uri:q.optional(),logo_uri:Gr,scope:x().optional(),contacts:O(x()).optional(),tos_uri:Gr,policy_uri:x().optional(),jwks_uri:q.optional(),jwks:b().optional(),software_id:x().optional(),software_version:x().optional(),software_statement:x().optional()}).strip(),qr=T({client_id:x(),client_secret:x().optional(),client_id_issued_at:E().optional(),client_secret_expires_at:E().optional(),issuer:x().optional().catch(void 0)}).strip(),Jr=Kr.merge(qr),Yr=T({error:x(),error_description:x().optional()}).strip(),Xr=T({token:x(),token_type_hint:x().optional()}).strip(),Zr=Symbol.for(`mcp.sdk.errorBrands`);function Qr(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Zr,{value:n,enumerable:!1,configurable:!0})}function $r(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Zr)){let n=t[Zr];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var ei=function(e){return e.InvalidRequest=`invalid_request`,e.InvalidClient=`invalid_client`,e.InvalidGrant=`invalid_grant`,e.UnauthorizedClient=`unauthorized_client`,e.UnsupportedGrantType=`unsupported_grant_type`,e.InvalidScope=`invalid_scope`,e.AccessDenied=`access_denied`,e.ServerError=`server_error`,e.TemporarilyUnavailable=`temporarily_unavailable`,e.UnsupportedResponseType=`unsupported_response_type`,e.UnsupportedTokenType=`unsupported_token_type`,e.InvalidToken=`invalid_token`,e.MethodNotAllowed=`method_not_allowed`,e.TooManyRequests=`too_many_requests`,e.InvalidClientMetadata=`invalid_client_metadata`,e.InvalidRedirectUri=`invalid_redirect_uri`,e.InsufficientScope=`insufficient_scope`,e.InvalidTarget=`invalid_target`,e.InvalidDpopProof=`invalid_dpop_proof`,e.UseDpopNonce=`use_dpop_nonce`,e}({}),ti=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Qr(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},J=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),Y=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Qr(this,new.target)}},ni=class extends Y{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}};function ri(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function ii(e){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function ai({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=oi}function li(e){return e.filter(e=>!ci(e))}function ui(e){return e.filter(e=>ci(e))}function di(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var fi=[`task`,`inputRequests`,`requestState`];function pi(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||fi.some(t=>t in e)?e:{...e,content:[]}}function mi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=T({ttl:E().optional()}),a=T({taskId:x()}),o=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=T({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=T({method:x(),params:s.loose().optional()}),u=T({_meta:o.optional()}),d=T({method:x(),params:u.loose().optional()}),f=k({_meta:o.optional()}),p=j([x(),E().int()]),m=f.strict(),g=u.extend({requestId:p.optional(),reason:x().optional()}),_=d.extend({method:w(`notifications/cancelled`),params:g}),v=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),b=T({icons:O(v).optional()}),C=T({name:x(),title:x().optional()}),te=C.extend({...C.shape,...b.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),ne=se(T({applyDefaults:A().optional()}),t),re=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:ne.optional(),url:t.optional()}),t.optional())),ie=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),oe=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),le=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:re.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:ie.optional(),extensions:M(x(),t).optional()}),ue=s.extend({protocolVersion:x(),capabilities:le,clientInfo:te}),de=l.extend({method:w(`initialize`),params:ue}),fe=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:oe.optional(),extensions:M(x(),t).optional()}),me=f.extend({protocolVersion:x(),capabilities:fe,serverInfo:te,instructions:x().optional()}),he=d.extend({method:w(`notifications/initialized`),params:u.optional()}),N=l.extend({method:w(`ping`),params:s.optional()}),P=T({progress:E(),total:y(E()),message:y(x())}),ge=T({...u.shape,...P.shape,progressToken:n}),_e=d.extend({method:w(`notifications/progress`),params:ge}),ve=s.extend({cursor:r.optional()}),ye=l.extend({params:ve.optional()}),be=f.extend({nextCursor:r.optional()}),F=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),xe=F.extend({text:x()}),Se=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Ce=F.extend({blob:Se}),we=D([`user`,`assistant`]),Te=T({audience:O(we).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Ee=T({...C.shape,...b.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Te.optional(),_meta:y(k({}))}),De=T({...C.shape,...b.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Te.optional(),_meta:y(k({}))}),Oe=ye.extend({method:w(`resources/list`)}),ke=be.extend({resources:O(Ee)}),Ae=ye.extend({method:w(`resources/templates/list`)}),je=be.extend({resourceTemplates:O(De)}),Me=s.extend({uri:x()}),Ne=Me,Pe=l.extend({method:w(`resources/read`),params:Ne}),Fe=f.extend({contents:O(j([xe,Ce]))}),Ie=d.extend({method:w(`notifications/resources/list_changed`),params:u.optional()}),Le=Me,Re=l.extend({method:w(`resources/subscribe`),params:Le}),ze=Me,Be=l.extend({method:w(`resources/unsubscribe`),params:ze}),Ve=u.extend({uri:x()}),I=d.extend({method:w(`notifications/resources/updated`),params:Ve}),He=T({name:x(),description:y(x()),required:y(A())}),Ue=T({...C.shape,...b.shape,description:y(x()),arguments:y(O(He)),_meta:y(k({}))}),We=ye.extend({method:w(`prompts/list`)}),Ge=be.extend({prompts:O(Ue)}),Ke=s.extend({name:x(),arguments:M(x(),x()).optional()}),qe=l.extend({method:w(`prompts/get`),params:Ke}),L=T({type:w(`text`),text:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Je=T({type:w(`image`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),R=T({type:w(`audio`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),z=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),B=T({type:w(`resource`),resource:j([xe,Ce]),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Ye=Ee.extend({type:w(`resource_link`)}),V=j([L,Je,R,Ye,B]),Xe=T({role:we,content:V}),Ze=f.extend({description:x().optional(),messages:O(Xe)}),Qe=d.extend({method:w(`notifications/prompts/list_changed`),params:u.optional()}),$e=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),et=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),tt=T({...C.shape,...b.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()).optional(),annotations:$e.optional(),execution:et.optional(),_meta:M(x(),h()).optional()}),nt=ye.extend({method:w(`tools/list`)}),rt=be.extend({tools:O(tt)}),it=f.extend({content:O(V),structuredContent:M(x(),h()).optional(),isError:A().optional()}),at=c.extend({name:x(),arguments:M(x(),h()).optional()}),ot=l.extend({method:w(`tools/call`),params:at}),st=d.extend({method:w(`notifications/tools/list_changed`),params:u.optional()}),ct=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),H=s.extend({level:ct}),lt=l.extend({method:w(`logging/setLevel`),params:H}),ut=u.extend({level:ct,logger:x().optional(),data:h()}),dt=d.extend({method:w(`notifications/message`),params:ut}),ft=T({name:x().optional()}),pt=T({hints:O(ft).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),mt=T({mode:D([`auto`,`required`,`none`]).optional()}),ht=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(V),structuredContent:T({}).loose().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),gt=S(`type`,[L,Je,R]),_t=S(`type`,[L,Je,R,z,ht]),vt=T({role:we,content:j([_t,O(_t)]),_meta:M(x(),h()).optional()}),yt=c.extend({messages:O(vt),modelPreferences:pt.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(tt).optional(),toolChoice:mt.optional()}),bt=l.extend({method:w(`sampling/createMessage`),params:yt}),xt=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:we,content:gt}),St=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:we,content:j([_t,O(_t)])}),Ct=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),wt=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Tt=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Et=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Dt=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ot=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),kt=j([Et,Dt]),At=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),jt=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Mt=j([At,jt]),Nt=j([Ot,kt,Mt]),Pt=j([Nt,Ct,wt,Tt]),Ft=c.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),Pt),required:O(x()).optional()}).catchall(h())}),It=c.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),Lt=j([Ft,It]),U=l.extend({method:w(`elicitation/create`),params:Lt}),W=u.extend({elicitationId:x()}),Rt=d.extend({method:w(`notifications/elicitation/complete`),params:W}),zt=f.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),Bt=T({type:w(`ref/resource`),uri:x()}),Vt=T({type:w(`ref/prompt`),name:x()}),Ht=s.extend({ref:j([Vt,Bt]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),Ut=l.extend({method:w(`completion/complete`),params:Ht}),Wt=f.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),Gt=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Kt=l.extend({method:w(`roots/list`),params:s.optional()}),qt=f.extend({roots:O(Gt)}),Jt=d.extend({method:w(`notifications/roots/list_changed`),params:u.optional()}),Yt=k({ttl:E().optional(),pollInterval:E().optional()}),Xt=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Zt=T({taskId:x(),status:Xt,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),Qt=f.extend({task:Zt}),$t=u.merge(Zt),en=d.extend({method:w(`notifications/tasks/status`),params:$t}),tn=l.extend({method:w(`tasks/get`),params:s.extend({taskId:x()})}),G=f.merge(Zt),nn=l.extend({method:w(`tasks/result`),params:s.extend({taskId:x()})}),rn=f.loose(),an=ye.extend({method:w(`tasks/list`)}),on=be.extend({tasks:O(Zt)}),sn=l.extend({method:w(`tasks/cancel`),params:s.extend({taskId:x()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:_,IconSchema:v,IconsSchema:b,BaseMetadataSchema:C,ImplementationSchema:te,ClientTasksCapabilitySchema:ie,ServerTasksCapabilitySchema:oe,ClientCapabilitiesSchema:le,InitializeRequestParamsSchema:ue,InitializeRequestSchema:de,ServerCapabilitiesSchema:fe,InitializeResultSchema:me,InitializedNotificationSchema:he,PingRequestSchema:N,ProgressSchema:P,ProgressNotificationParamsSchema:ge,ProgressNotificationSchema:_e,PaginatedRequestParamsSchema:ve,PaginatedRequestSchema:ye,PaginatedResultSchema:be,ResourceContentsSchema:F,TextResourceContentsSchema:xe,BlobResourceContentsSchema:Ce,RoleSchema:we,AnnotationsSchema:Te,ResourceSchema:Ee,ResourceTemplateSchema:De,ListResourcesRequestSchema:Oe,ListResourcesResultSchema:ke,ListResourceTemplatesRequestSchema:Ae,ListResourceTemplatesResultSchema:je,ResourceRequestParamsSchema:Me,ReadResourceRequestParamsSchema:Ne,ReadResourceRequestSchema:Pe,ReadResourceResultSchema:Fe,ResourceListChangedNotificationSchema:Ie,SubscribeRequestParamsSchema:Le,SubscribeRequestSchema:Re,UnsubscribeRequestParamsSchema:ze,UnsubscribeRequestSchema:Be,ResourceUpdatedNotificationParamsSchema:Ve,ResourceUpdatedNotificationSchema:I,PromptArgumentSchema:He,PromptSchema:Ue,ListPromptsRequestSchema:We,ListPromptsResultSchema:Ge,GetPromptRequestParamsSchema:Ke,GetPromptRequestSchema:qe,TextContentSchema:L,ImageContentSchema:Je,AudioContentSchema:R,ToolUseContentSchema:z,EmbeddedResourceSchema:B,ResourceLinkSchema:Ye,ContentBlockSchema:V,PromptMessageSchema:Xe,GetPromptResultSchema:Ze,PromptListChangedNotificationSchema:Qe,ToolAnnotationsSchema:$e,ToolExecutionSchema:et,ToolSchema:tt,ListToolsRequestSchema:nt,ListToolsResultSchema:rt,CallToolResultSchema:it,CallToolRequestParamsSchema:at,CallToolRequestSchema:ot,ToolListChangedNotificationSchema:st,LoggingLevelSchema:ct,SetLevelRequestParamsSchema:H,SetLevelRequestSchema:lt,LoggingMessageNotificationParamsSchema:ut,LoggingMessageNotificationSchema:dt,ModelHintSchema:ft,ModelPreferencesSchema:pt,ToolChoiceSchema:mt,ToolResultContentSchema:ht,SamplingContentSchema:gt,SamplingMessageContentBlockSchema:_t,SamplingMessageSchema:vt,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:bt,CreateMessageResultSchema:xt,CreateMessageResultWithToolsSchema:St,BooleanSchemaSchema:Ct,StringSchemaSchema:wt,NumberSchemaSchema:Tt,UntitledSingleSelectEnumSchemaSchema:Et,TitledSingleSelectEnumSchemaSchema:Dt,LegacyTitledEnumSchemaSchema:Ot,SingleSelectEnumSchemaSchema:kt,UntitledMultiSelectEnumSchemaSchema:At,TitledMultiSelectEnumSchemaSchema:jt,MultiSelectEnumSchemaSchema:Mt,EnumSchemaSchema:Nt,PrimitiveSchemaDefinitionSchema:Pt,ElicitRequestFormParamsSchema:Ft,ElicitRequestURLParamsSchema:It,ElicitRequestParamsSchema:Lt,ElicitRequestSchema:U,ElicitationCompleteNotificationParamsSchema:W,ElicitationCompleteNotificationSchema:Rt,ElicitResultSchema:zt,ResourceTemplateReferenceSchema:Bt,PromptReferenceSchema:Vt,CompleteRequestParamsSchema:Ht,CompleteRequestSchema:Ut,CompleteResultSchema:Wt,RootSchema:Gt,ListRootsRequestSchema:Kt,ListRootsResultSchema:qt,RootsListChangedNotificationSchema:Jt,TaskCreationParamsSchema:Yt,TaskStatusSchema:Xt,TaskSchema:Zt,CreateTaskResultSchema:Qt,TaskStatusNotificationParamsSchema:$t,TaskStatusNotificationSchema:en,GetTaskRequestSchema:tn,GetTaskResultSchema:G,GetTaskPayloadRequestSchema:nn,GetTaskPayloadResultSchema:rn,ListTasksRequestSchema:an,ListTasksResultSchema:on,CancelTaskRequestSchema:sn,CancelTaskResultSchema:f.merge(Zt),ClientRequestSchema:j([N,de,Ut,lt,qe,We,Oe,Ae,Pe,Re,Be,ot,nt,tn,nn,an,sn]),ClientNotificationSchema:j([_,_e,he,Jt,en]),ClientResultSchema:j([m,xt,St,zt,qt,G,on,Qt]),ServerRequestSchema:j([N,bt,U,Kt,tn,nn,an,sn]),ServerNotificationSchema:j([_,_e,dt,I,Ie,st,Qe,en,Rt]),ServerResultSchema:j([m,me,Wt,Ze,Ge,ke,je,Fe,it,rt,G,on,Qt]),CallToolResultWireSchema:h().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of fi)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(pi).pipe(it)}}var hi;function gi(){return hi??=mi()}function _i(e){return e.type!==`object`}var vi=new Set([`const`,`enum`,`default`,`examples`]),yi=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function bi(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function xi(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(bi(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=Ae(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&bi(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=vi.has(o)?s:yi.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Si={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ci={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},wi={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ti;function Ei(){if(Ti)return Ti;let e=gi();return Ti={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ti}function Di(e){return Object.prototype.hasOwnProperty.call(Si,e)}function Oi(e){return Object.prototype.hasOwnProperty.call(Ci,e)}function ki(e){return Object.prototype.hasOwnProperty.call(wi,e)}function Ai(e){return ki(e)?Ei().resultSchemas[e]:void 0}function ji(e){return Di(e)?Ei().requestSchemas[e]:void 0}function Mi(e){return Oi(e)?Ei().notificationSchemas[e]:void 0}Object.keys(Si),Object.keys(Ci);function Ni(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pi(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Fi={ok:!1,reason:`not-in-era`};function Ii(e){return Ni(e)&&Ni(e.outputSchema)&&_i(e.outputSchema)}function Li(e){return e}var Ri={era:`2025-11-25`,hasRequestMethod:Di,hasNotificationMethod:Oi,validateRequest:(e,t)=>Pi(ji(e),t),validateResult:(e,t)=>Pi(Ai(e),t),validateNotification:(e,t)=>Pi(Mi(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Fi,validateInputResponse:()=>Fi,samplingResultVariant:((e,t)=>{let n=gi();return Pi(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=di(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&_i(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Ni(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Li(e)}}return{kind:`complete`,result:Li(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Ii(e))?t:{...t,tools:n.map(e=>Ii(e)?{...e,outputSchema:xi(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function zi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=j([x(),E().int()]),a=D([`user`,`assistant`]),o=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=T({ttl:E().optional()}),l=T({taskId:x()}),u=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=T({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=T({_meta:u.optional()}),m=T({method:x(),params:p.loose().optional()}),g=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),_=T({icons:O(g).optional()}),v=T({name:x(),title:x().optional()}),b=v.extend({...v.shape,..._.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),S=se(T({applyDefaults:A().optional()}),t),C=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:S.optional(),url:t.optional()}),t.optional())),te=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),ne=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),re=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:C.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:te.optional(),extensions:M(x(),t).optional()}),ie=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ne.optional(),extensions:M(x(),t).optional()}),oe=T({progress:E(),total:y(E()),message:y(x())}),le=T({...p.shape,...oe.shape,progressToken:n}),ue=m.extend({method:w(`notifications/progress`),params:le}),de=p.extend({level:o,logger:x().optional(),data:h()}),fe=m.extend({method:w(`notifications/message`),params:de}),me=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),he=me.extend({text:x()}),N=me.extend({blob:s}),P=T({audience:O(a).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),ge=T({...v.shape,..._.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:P.optional(),_meta:y(k({}))}),_e=T({...v.shape,..._.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:P.optional(),_meta:y(k({}))}),ve=m.extend({method:w(`notifications/resources/list_changed`),params:p.optional()}),ye=p.extend({uri:x()}),be=m.extend({method:w(`notifications/resources/updated`),params:ye}),F=T({name:x(),description:y(x()),required:y(A())}),xe=T({...v.shape,..._.shape,description:y(x()),arguments:y(O(F)),_meta:y(k({}))}),Se=m.extend({method:w(`notifications/prompts/list_changed`),params:p.optional()}),Ce=T({type:w(`text`),text:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),we=T({type:w(`image`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Te=T({type:w(`audio`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Ee=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),De=T({type:w(`resource`),resource:j([he,N]),annotations:P.optional(),_meta:M(x(),h()).optional()}),Oe=ge.extend({type:w(`resource_link`)}),ke=j([Ce,we,Te,Oe,De]),Ae=T({role:a,content:ke}),je=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),Me=m.extend({method:w(`notifications/tools/list_changed`),params:p.optional()}),Ne=T({name:x().optional()}),Pe=T({hints:O(Ne).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),ze=T({mode:D([`auto`,`required`,`none`]).optional()}),Ve=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),I=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),He=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Ue=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),We=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ge=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Ke=j([Ue,We]),qe=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),L=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Je=j([qe,L]),R=j([Ge,Ke,Je]),z=j([R,Ve,I,He]),B=f.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),z),required:O(x()).optional()}).catchall(h())}),Ye=T({type:w(`ref/resource`),uri:x()}),V=T({type:w(`ref/prompt`),name:x()}),Xe=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Ze=re.shape,Qe=T({experimental:Ze.experimental,sampling:Ze.sampling,elicitation:Ze.elicitation,roots:Ze.roots,extensions:Ze.extensions}),$e=ie.shape,et=T({experimental:$e.experimental,logging:$e.logging,completions:$e.completions,prompts:$e.prompts,resources:$e.resources,tools:$e.tools,extensions:$e.extensions}),tt=k({progressToken:n.optional(),[Fe]:x(),[Ie]:b.optional(),[Re]:Qe,[Be]:o.optional()}),nt=T({...v.shape,..._.shape,description:x().optional(),inputSchema:k({$schema:x().optional(),type:w(`object`)}),outputSchema:k({$schema:x().optional()}).optional(),annotations:je.optional(),_meta:M(x(),h()).optional()}),rt=T({type:w(`tool_result`),toolUseId:x(),content:O(ke),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),it=j([Ce,we,Te,Ee,rt]),at=T({role:a,content:j([it,O(it)]),_meta:M(x(),h()).optional()}),ot=x(),st=k({[Le]:b.optional().catch(void 0)}),ct=st.optional();function H(e){return k({_meta:ct,resultType:ot.default(`complete`),...e})}let lt=H({}),ut=H({nextCursor:r.optional()}),dt=H({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),ft=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),pt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),mt=H({description:x().optional(),messages:O(Ae)}),ht=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),gt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),_t=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),vt=H({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),yt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`])}),bt=H({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),xt=T({messages:O(at),modelPreferences:Pe.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(nt).optional(),toolChoice:ze.optional()}),St=T({method:w(`sampling/createMessage`),params:xt}),Ct=T({method:w(`roots/list`),params:T({_meta:M(x(),h()).optional()}).optional()}),wt=T({...at.shape,model:x(),stopReason:x().optional()}),Tt=T({roots:O(Xe)}),Et=T({action:D([`accept`,`decline`,`cancel`]),content:M(x(),j([x(),E(),A(),O(x())])).optional()}),Dt=T({mode:w(`url`),message:x(),url:x().url()}),Ot=j([B,Dt]),kt=T({method:w(`elicitation/create`),params:Ot}),At=j([St,Ct,kt]),jt=j([wt,Tt,Et]),Mt=M(x(),At),Nt=M(x(),jt),Pt=H({inputRequests:Mt.optional(),requestState:x().optional()}),Ft={inputResponses:Nt.optional(),requestState:x().optional()},It=T({_meta:tt,...Ft}),Lt=k({progressToken:n.optional()});function U(e,t){return T({method:w(e),params:T({_meta:tt,...t})})}function W(e,t){return T({method:w(e),params:T({_meta:Lt.optional(),...t}).optional()})}let Rt={name:x(),arguments:M(x(),h()).optional(),...Ft},zt={cursor:r.optional()},Bt=U(`tools/call`,Rt),Vt=U(`tools/list`,zt),Ht=U(`prompts/list`,zt),Ut=U(`prompts/get`,{name:x(),arguments:M(x(),x()).optional(),...Ft}),Wt=U(`resources/list`,zt),Gt=U(`resources/templates/list`,zt),Kt=U(`resources/read`,{uri:x(),...Ft}),qt={ref:j([V,Ye]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()},Jt=U(`completion/complete`,qt),Yt=U(`server/discover`,{}),Xt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Zt={notifications:Xt},Qt=U(`subscriptions/listen`,Zt),$t=st.extend({"io.modelcontextprotocol/subscriptionId":i}),en=k({_meta:$t,resultType:ot.default(`complete`)}),tn={"tools/call":W(`tools/call`,Rt),"tools/list":W(`tools/list`,zt),"prompts/get":W(`prompts/get`,{name:x(),arguments:M(x(),x()).optional()}),"prompts/list":W(`prompts/list`,zt),"resources/list":W(`resources/list`,zt),"resources/templates/list":W(`resources/templates/list`,zt),"resources/read":W(`resources/read`,{uri:x()}),"completion/complete":W(`completion/complete`,qt),"server/discover":W(`server/discover`,{}),"subscriptions/listen":W(`subscriptions/listen`,Zt)};function G(e){return k({_meta:ct,...e})}let nn={"tools/call":G({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),"tools/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),"prompts/get":G({description:x().optional(),messages:O(Ae)}),"prompts/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),"resources/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),"resources/templates/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),"resources/read":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),"completion/complete":G({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),"server/discover":G({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),"subscriptions/listen":G({})},rn=k({"io.modelcontextprotocol/subscriptionId":i.optional()}),an=T({method:w(`notifications/subscriptions/acknowledged`),params:T({_meta:rn.optional(),notifications:Xt})}),on=T({_meta:rn.optional(),requestId:i,reason:x().optional()}),sn=T({method:w(`notifications/cancelled`),params:on}),cn={"notifications/cancelled":sn,"notifications/progress":ue,"notifications/message":fe,"notifications/resources/updated":be,"notifications/resources/list_changed":ve,"notifications/tools/list_changed":Me,"notifications/prompts/list_changed":Se,"notifications/subscriptions/acknowledged":an},K=e=>T({jsonrpc:w(`2.0`),id:j([x(),E().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:g,IconsSchema:_,BaseMetadataSchema:v,ImplementationSchema:b,ClientTasksCapabilitySchema:te,ServerTasksCapabilitySchema:ne,ClientCapabilitiesSchema:re,ServerCapabilitiesSchema:ie,ProgressSchema:oe,ProgressNotificationParamsSchema:le,ProgressNotificationSchema:ue,LoggingMessageNotificationParamsSchema:de,LoggingMessageNotificationSchema:fe,ResourceContentsSchema:me,TextResourceContentsSchema:he,BlobResourceContentsSchema:N,AnnotationsSchema:P,ResourceSchema:ge,ResourceTemplateSchema:_e,ResourceListChangedNotificationSchema:ve,ResourceUpdatedNotificationParamsSchema:ye,ResourceUpdatedNotificationSchema:be,PromptArgumentSchema:F,PromptSchema:xe,PromptListChangedNotificationSchema:Se,TextContentSchema:Ce,ImageContentSchema:we,AudioContentSchema:Te,ToolUseContentSchema:Ee,EmbeddedResourceSchema:De,ResourceLinkSchema:Oe,ContentBlockSchema:ke,PromptMessageSchema:Ae,ToolAnnotationsSchema:je,ToolListChangedNotificationSchema:Me,ModelHintSchema:Ne,ModelPreferencesSchema:Pe,ToolChoiceSchema:ze,BooleanSchemaSchema:Ve,StringSchemaSchema:I,NumberSchemaSchema:He,UntitledSingleSelectEnumSchemaSchema:Ue,TitledSingleSelectEnumSchemaSchema:We,LegacyTitledEnumSchemaSchema:Ge,SingleSelectEnumSchemaSchema:Ke,UntitledMultiSelectEnumSchemaSchema:qe,TitledMultiSelectEnumSchemaSchema:L,MultiSelectEnumSchemaSchema:Je,EnumSchemaSchema:R,PrimitiveSchemaDefinitionSchema:z,ElicitRequestFormParamsSchema:B,ResourceTemplateReferenceSchema:Ye,PromptReferenceSchema:V,RootSchema:Xe,ClientCapabilities2026Schema:Qe,ServerCapabilities2026Schema:et,RequestMetaEnvelopeSchema:tt,ToolSchema:nt,ToolResultContentSchema:rt,SamplingMessageContentBlockSchema:it,SamplingMessageSchema:at,ResultTypeSchema:ot,ResultMetaSchema:st,ResultSchema:lt,PaginatedResultSchema:ut,CallToolResultSchema:dt,ListToolsResultSchema:ft,ListPromptsResultSchema:pt,GetPromptResultSchema:mt,ListResourcesResultSchema:ht,ListResourceTemplatesResultSchema:gt,ReadResourceResultSchema:_t,CompleteResultSchema:vt,CacheableResultSchema:yt,DiscoverResultSchema:bt,CreateMessageRequestParamsSchema:xt,CreateMessageRequestSchema:St,ListRootsRequestSchema:Ct,CreateMessageResultSchema:wt,ListRootsResultSchema:Tt,ElicitResultSchema:Et,ElicitRequestURLParamsSchema:Dt,ElicitRequestParamsSchema:Ot,ElicitRequestSchema:kt,InputRequestSchema:At,InputResponseSchema:jt,InputRequestsSchema:Mt,InputResponsesSchema:Nt,InputRequiredResultSchema:Pt,InputResponseRequestParamsSchema:It,CallToolRequestSchema:Bt,ListToolsRequestSchema:Vt,ListPromptsRequestSchema:Ht,GetPromptRequestSchema:Ut,ListResourcesRequestSchema:Wt,ListResourceTemplatesRequestSchema:Gt,ReadResourceRequestSchema:Kt,CompleteRequestSchema:Jt,DiscoverRequestSchema:Yt,SubscriptionFilterSchema:Xt,SubscriptionsListenRequestSchema:Qt,SubscriptionsListenResultMetaSchema:$t,SubscriptionsListenResultSchema:en,dispatchRequestSchemas:tn,dispatchResultSchemas:nn,NotificationMetaSchema:rn,SubscriptionsAcknowledgedNotificationSchema:an,CancelledNotificationParamsSchema:on,CancelledNotificationSchema:sn,notificationSchemas2026:cn,JSONRPCResultResponseSchema:K(lt),CallToolResultResponseSchema:K(j([dt,Pt])),ListToolsResultResponseSchema:K(ft),ListPromptsResultResponseSchema:K(pt),GetPromptResultResponseSchema:K(j([mt,Pt])),ListResourcesResultResponseSchema:K(ht),ListResourceTemplatesResultResponseSchema:K(gt),ReadResourceResultResponseSchema:K(j([_t,Pt])),CompleteResultResponseSchema:K(vt),DiscoverResultResponseSchema:K(bt),SubscriptionsListenResultResponseSchema:K(en)}}var Bi;function Vi(){return Bi??=zi()}var Hi=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Ui(e){return Hi.includes(e)}var Wi=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Gi(e){return e[Wi]}function Ki(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function qi(e){return e===`public`||e===`private`}var X=function(e){return 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.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),Z=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Qr(this,new.target)}static fromError(t,n,r){if(t===X.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Yi(e.elicitations,n)}if(t===X.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Xi({supported:e.supported,requested:e.requested},n)}if(t===X.InvalidParams||t===X.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===X.ResourceNotFound||Object.keys(e).length===1))return new Ji(e.uri,n)}if(t===X.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Zi({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Ji=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(X.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Yi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(X.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Xi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(X.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Zi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(X.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Qi=0,$i=`private`,ea=[`tools/call`,`prompts/get`,`resources/read`];function ta(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||ea.includes(e))return t;throw new Z(X.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function na(e,t){let n=Gi(t);if(t.resultType!==`complete`||!Ui(e))return n===void 0?t:sa(t);let r=t,i=Ki(r.ttlMs)?r.ttlMs:aa(n),a=qi(r.cacheScope)?r.cacheScope:oa(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Wi],o}function ra(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ia(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Le]:t}}:!ra(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Le]:t}}}function aa(e){return e!==void 0&&Ki(e.ttlMs)?e.ttlMs:Qi}function oa(e){return e!==void 0&&qi(e.cacheScope)?e.cacheScope:$i}function sa(e){let t={...e};return delete t[Wi],t}var ca=[`elicitation/create`,`sampling/createMessage`,`roots/list`],la;function ua(){if(la)return la;let e=Vi();return la={request:{"elicitation/create":T({method:w(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":T({method:w(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":T({method:w(`roots/list`),params:k({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},la}function da(e){return ca.includes(e)}function fa(e){return da(e)?ua().request[e]:void 0}function pa(e){return da(e)?ua().response[e]:void 0}var ma={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},ha={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function ga(e){return Object.prototype.hasOwnProperty.call(ma,e)}function _a(e){return Object.prototype.hasOwnProperty.call(ha,e)}function va(e){return Object.prototype.hasOwnProperty.call(ma,e)}function ya(e){return ga(e)?Vi().dispatchRequestSchemas[e]:void 0}function ba(e){return va(e)?Vi().dispatchResultSchemas[e]:void 0}function xa(e){return _a(e)?Vi().notificationSchemas2026[e]:void 0}Object.keys(ma),Object.keys(ha);function Sa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ca(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var wa={ok:!1,reason:`not-in-era`},Ta=[Fe,Re];function Ea(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Sa(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Sa(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Sa(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Da={era:`2026-07-28`,hasRequestMethod:ga,hasNotificationMethod:_a,hasInputRequestMethod:e=>fa(e)!==void 0,validateRequest:(e,t)=>Ca(ya(e),t),validateResult:(e,t)=>Ca(ba(e),t),validateNotification:(e,t)=>Ca(xa(e),t),validateInputRequest:(e,t)=>Ca(fa(e),t),validateInputResponse:(e,t)=>Ca(pa(e),t),samplingResultVariant:()=>wa,outboundEnvelope(e){return{[Fe]:e.protocolVersion,[Ie]:e.clientInfo,[Re]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Ta)n in e||t.push({key:n,problem:`missing`});let n=Vi().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>di(e),inputRequestSchema:fa,decodeResult(e,t){if(!Sa(t))return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Sa(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:Vi().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new Y(J.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=ka(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return ia(na(e,ta(e,Ea(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=Vi().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},Oa;function ka(){if(Oa)return Oa;let e=Vi();return Oa={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Oa}var Aa=`2026-07-28`;function ja(e){return e!==void 0&&ci(e)?Da:Ri}function Ma(e){return e.revision===void 0?e.era===`modern`?Da.era:Ri.era:ja(e.revision).era}function Na(e){return Ia.some(t=>t.hasRequestMethod(e))}function Pa(e){return Ia.some(t=>t.hasNotificationMethod(e))}function Fa(e){return e===`tasks/get`||e===`tasks/cancel`}var Ia=[Ri,Da],La=Ce({AnnotationsSchema:()=>Nt,AudioContentSchema:()=>ln,BaseMetadataSchema:()=>ct,BaseRequestParamsSchema:()=>L,BlobResourceContentsSchema:()=>jt,BooleanSchemaSchema:()=>Wn,CallToolRequestParamsSchema:()=>wn,CallToolRequestSchema:()=>Tn,CallToolResultSchema:()=>Sn,CancelTaskRequestSchema:()=>Ar,CancelTaskResultSchema:()=>jr,CancelledNotificationParamsSchema:()=>it,CancelledNotificationSchema:()=>at,ClientCapabilitiesSchema:()=>pt,ClientNotificationSchema:()=>Nr,ClientRequestSchema:()=>Mr,ClientResultSchema:()=>Pr,ClientTasksCapabilitySchema:()=>dt,CompatibilityCallToolResultSchema:()=>Cn,CompleteRequestParamsSchema:()=>dr,CompleteRequestSchema:()=>fr,CompleteResultSchema:()=>pr,ContentBlockSchema:()=>pn,CreateMessageRequestParamsSchema:()=>Bn,CreateMessageRequestSchema:()=>Vn,CreateMessageResultSchema:()=>Hn,CreateMessageResultWithToolsSchema:()=>Un,CreateTaskResultSchema:()=>xr,CursorSchema:()=>We,DiscoverRequestSchema:()=>yt,DiscoverResultSchema:()=>bt,ElicitRequestFormParamsSchema:()=>nr,ElicitRequestParamsSchema:()=>ir,ElicitRequestSchema:()=>ar,ElicitRequestURLParamsSchema:()=>rr,ElicitResultSchema:()=>cr,ElicitationCompleteNotificationParamsSchema:()=>or,ElicitationCompleteNotificationSchema:()=>sr,EmbeddedResourceSchema:()=>dn,EmptyResultSchema:()=>rt,EnumSchemaSchema:()=>er,GetPromptRequestParamsSchema:()=>on,GetPromptRequestSchema:()=>sn,GetPromptResultSchema:()=>hn,GetTaskPayloadRequestSchema:()=>Er,GetTaskPayloadResultSchema:()=>Dr,GetTaskRequestSchema:()=>wr,GetTaskResultSchema:()=>Tr,IconSchema:()=>ot,IconsSchema:()=>st,ImageContentSchema:()=>K,ImplementationSchema:()=>H,InitializeRequestParamsSchema:()=>mt,InitializeRequestSchema:()=>ht,InitializeResultSchema:()=>_t,InitializedNotificationSchema:()=>vt,JSONArraySchema:()=>He,JSONObjectSchema:()=>I,JSONRPCErrorResponseSchema:()=>et,JSONRPCMessageSchema:()=>tt,JSONRPCNotificationSchema:()=>Qe,JSONRPCRequestSchema:()=>Ze,JSONRPCResponseSchema:()=>nt,JSONRPCResultResponseSchema:()=>$e,JSONValueSchema:()=>Ve,LegacyTitledEnumSchemaSchema:()=>Yn,ListChangedOptionsBaseSchema:()=>Dn,ListPromptsRequestSchema:()=>rn,ListPromptsResultSchema:()=>an,ListResourceTemplatesRequestSchema:()=>U,ListResourceTemplatesResultSchema:()=>W,ListResourcesRequestSchema:()=>It,ListResourcesResultSchema:()=>Lt,ListRootsRequestSchema:()=>hr,ListRootsResultSchema:()=>gr,ListTasksRequestSchema:()=>Or,ListTasksResultSchema:()=>kr,ListToolsRequestSchema:()=>bn,ListToolsResultSchema:()=>xn,LoggingLevelSchema:()=>On,LoggingMessageNotificationParamsSchema:()=>jn,LoggingMessageNotificationSchema:()=>Mn,ModelHintSchema:()=>Nn,ModelPreferencesSchema:()=>Pn,MultiSelectEnumSchemaSchema:()=>$n,NotificationSchema:()=>B,NotificationsParamsSchema:()=>z,NumberSchemaSchema:()=>Kn,PaginatedRequestParamsSchema:()=>Tt,PaginatedRequestSchema:()=>Et,PaginatedResultSchema:()=>Dt,PingRequestSchema:()=>xt,PrimitiveSchemaDefinitionSchema:()=>tr,ProgressNotificationParamsSchema:()=>Ct,ProgressNotificationSchema:()=>wt,ProgressSchema:()=>St,ProgressTokenSchema:()=>Ue,PromptArgumentSchema:()=>G,PromptListChangedNotificationSchema:()=>gn,PromptMessageSchema:()=>mn,PromptReferenceSchema:()=>ur,PromptSchema:()=>nn,ReadResourceRequestParamsSchema:()=>zt,ReadResourceRequestSchema:()=>Bt,ReadResourceResultSchema:()=>Vt,RelatedTaskMetadataSchema:()=>Ke,RequestIdSchema:()=>Xe,RequestMetaSchema:()=>qe,RequestSchema:()=>R,ResourceContentsSchema:()=>Ot,ResourceLinkSchema:()=>fn,ResourceListChangedNotificationSchema:()=>Ht,ResourceRequestParamsSchema:()=>Rt,ResourceSchema:()=>Pt,ResourceTemplateReferenceSchema:()=>lr,ResourceTemplateSchema:()=>Ft,ResourceUpdatedNotificationParamsSchema:()=>en,ResourceUpdatedNotificationSchema:()=>tn,ResultMetaObjectSchema:()=>Ye,ResultSchema:()=>V,RoleSchema:()=>Mt,RootSchema:()=>mr,RootsListChangedNotificationSchema:()=>_r,SamplingContentSchema:()=>Ln,SamplingMessageContentBlockSchema:()=>Rn,SamplingMessageSchema:()=>zn,ServerCapabilitiesSchema:()=>gt,ServerNotificationSchema:()=>Ir,ServerRequestSchema:()=>Fr,ServerResultSchema:()=>Lr,ServerTasksCapabilitySchema:()=>ft,SetLevelRequestParamsSchema:()=>kn,SetLevelRequestSchema:()=>An,SingleSelectEnumSchemaSchema:()=>Xn,StringSchemaSchema:()=>Gn,SubscribeRequestParamsSchema:()=>Ut,SubscribeRequestSchema:()=>Wt,SubscriptionFilterSchema:()=>qt,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Xt,SubscriptionsAcknowledgedNotificationSchema:()=>Zt,SubscriptionsListenRequestParamsSchema:()=>Jt,SubscriptionsListenRequestSchema:()=>Yt,SubscriptionsListenResultMetaSchema:()=>Qt,SubscriptionsListenResultSchema:()=>$t,TaskAugmentedRequestParamsSchema:()=>Je,TaskCreationParamsSchema:()=>vr,TaskMetadataSchema:()=>Ge,TaskSchema:()=>br,TaskStatusNotificationParamsSchema:()=>Sr,TaskStatusNotificationSchema:()=>Cr,TaskStatusSchema:()=>yr,TextContentSchema:()=>cn,TextResourceContentsSchema:()=>kt,TitledMultiSelectEnumSchemaSchema:()=>Qn,TitledSingleSelectEnumSchemaSchema:()=>Jn,ToolAnnotationsSchema:()=>_n,ToolChoiceSchema:()=>Fn,ToolExecutionSchema:()=>vn,ToolListChangedNotificationSchema:()=>En,ToolResultContentSchema:()=>In,ToolSchema:()=>yn,ToolUseContentSchema:()=>un,UnsubscribeRequestParamsSchema:()=>Gt,UnsubscribeRequestSchema:()=>Kt,UntitledMultiSelectEnumSchemaSchema:()=>Zn,UntitledSingleSelectEnumSchemaSchema:()=>qn}),Ra=e=>Ze.safeParse(e).success,za=e=>Qe.safeParse(e).success,Ba=e=>$e.safeParse(e).success,Va=e=>et.safeParse(e).success,Ha=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`,Ua=e=>ht.safeParse(e).success,Wa=e=>vt.safeParse(e).success,Ga=`Mcp-Param-`,Ka=`x-mcp-header`,qa=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Ja=new Set([`string`,`integer`,`boolean`,`number`]);function Ya(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(Ka in o){if(!a||i.length===0)return`${Qa(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let e=o[Ka];if(typeof e!=`string`||e.length===0)return`${Qa(i)}: x-mcp-header MUST be a non-empty string`;if(!qa.test(e))return`${Qa(i)}: x-mcp-header '${e}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let r=typeof o.type==`string`?o.type:void 0;if(r===void 0||!Ja.has(r))return`${Qa(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${r??``}`;let s=e.toLowerCase(),c=n.get(s);if(c!==void 0)return`x-mcp-header '${e}' is not case-insensitively unique (also declared as '${c}')`;n.set(s,e),t.push({path:i,headerName:e,type:r})}let s=o.properties;if(typeof s==`object`&&s)for(let[e,t]of Object.entries(s)){let n=r(t,[...i,e],a);if(n!==void 0)return n}for(let e of Xa){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&Za.has(e)?Object.values(t):[t];for(let t of n){let n=r(t,[...i,`<${e}>`],!1);if(n!==void 0)return n}}},i=r(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}var Xa=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],Za=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function Qa(e){return e.length===0?``:e.join(`.`)}var $a=`=?base64?`,eo=`?=`;function to(e){if(typeof e==`string`)return e;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function no(e){if(e.length===0||e.startsWith($a)&&e.endsWith(eo)||e!==e.trim())return!0;for(let t=0;t=32&&n<=126))return!0}return!1}function ro(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCodePoint(e);return btoa(n)}function io(e){return no(e)?`${$a}${ro(e)}${eo}`:e}function ao(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function oo(e,t){let n={};for(let r of e){let e=ao(t,r.path);if(e==null)continue;let i=to(e);i!==void 0&&(n[`${Ga}${r.headerName}`]=io(i))}return n}X.InvalidRequest,X.UnsupportedProtocolVersion,X.InvalidParams,X.MethodNotFound,X.InvalidParams,X.MissingRequiredClientCapability,X.ParseError,X.InvalidRequest,X.MethodNotFound,X.UnsupportedProtocolVersion,X.MissingRequiredClientCapability;var so={"tools/call":`name`,"prompts/get":`name`,"resources/read":`uri`,"tasks/get":`taskId`,"tasks/update":`taskId`,"tasks/cancel":`taskId`};function co(e,t){let n=Object.hasOwn(so,e)?so[e]:void 0;if(n===void 0)return;let r=lo(t)?t[n]:void 0;return{field:n,value:typeof r==`string`?r:void 0}}function lo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uo(e,t){return le(e,t)}function fo(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function po(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var mo=!1,ho=`draft-2020-12`;function go(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:ho});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);mo||(mo=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=g(e,{target:ho,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&_o(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function _o(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||_o(e)))}return!1}function vo(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function yo(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>vo(e)).join(`, `)}:{success:!0,data:n.value}}function bo(e){let t=g(e,{target:ho,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var xo=/\\\.\\d\{(\d+)\}/;function So(e){let t=xo.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>pe({local:e,offset:t,precision:n}))))}function Co(e,t){let n;switch(e){case`email`:n=[re()];break;case`uri`:n=[d()];break;case`date`:n=[me()];break;case`date-time`:n=So(t)}return new Set(n.map(e=>bo(e)).filter(e=>e!==void 0))}function wo(e,t,n){return n!==`zod`||Co(e,t).has(t)}function To(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Eo(e){try{return go(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Z(X.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Do=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Oo(e){return Do.has(e)||e.startsWith(`x-`)}var ko=new Set([`$schema`,...Object.keys(nr.shape.requestedSchema.shape)]),Ao={string:fo([Gn,qn,Jn,Yn]),number:fo([Kn]),integer:fo([Kn]),boolean:fo([Wn]),array:fo([Zn,Qn])},jo=new Set(Gn.shape.format.unwrap().options);function Mo(e,t,n,r){if(!To(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Ao,e.type)?Ao[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Oo(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?jo.has(e.format)?(typeof s!=`string`||!wo(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function No(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&To(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Mo(n,`properties.${e}`,t,r)])):ko.has(i)?n[i]=a:Oo(i)||r.push(i);if(r.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Po(e,t){if(!To(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!uo(tr,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Fo(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Fo(e,t[r],`${n}[${r}]`)):!To(e)||!To(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Fo(r,t[e],i):Oo(e)?[]:[i]})}function Io(e){if(!po(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=No(Eo(e.requestedSchema),t),r=uo(nr.shape.requestedSchema,n);if(!r.success)throw new Z(X.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Po(n,r.error.message)}`);let i=Fo(n,r.data);if(i.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Lo(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(Lo,{elicit(e){try{return{method:`elicitation/create`,params:Io(e)}}catch(e){throw e instanceof Z?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var Ro=!0,zo=10,Bo=250;function Vo(e){return{autoFulfill:e?.autoFulfill??Ro,maxRounds:e?.maxRounds??zo}}function Ho(e,t,n){let r=t!==void 0&&Object.keys(t).length>0;return!r&&n===void 0?e:{...e,...r&&{inputResponses:t},...n!==void 0&&{requestState:n}}}function Uo(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Wo(e,t){return new Promise((n,r)=>{if(t?.aborted){r(t.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t.reason)));return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(t?.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t?.reason)))};t?.addEventListener(`abort`,a,{once:!0})})}function Go(e){let t=new AbortController,n=()=>t.abort(e?.reason);return e?.addEventListener(`abort`,n,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener(`abort`,n)}}async function Ko(e){let{config:t,method:n,originalParams:r,requestOptions:i,hooks:a,signal:o}=e,s=e.flowStartedAt??Date.now(),c=e.firstPayload,l=0;for(;;){if(l+=1,l>t.maxRounds)throw new Y(J.InputRequiredRoundsExceeded,Uo(n,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:c.inputRequests,...c.requestState!==void 0&&{requestState:c.requestState}}});i.onprogress?.({progress:l,message:`Fulfilling input required by '${n}' (round ${l})`});let e=Object.entries(c.inputRequests??{}),u;if(e.length>0){let t=Go(o);try{let n=await Promise.all(e.map(async([e,n])=>{try{return[e,await a.dispatchInputRequest(e,n,t.signal)]}catch(e){throw t.abort(e),e}}));u=Object.fromEntries(n)}finally{t.dispose()}}else await Wo(Bo,o);let d={...i.timeout!==void 0&&{timeout:i.timeout}};if(i.maxTotalTimeout!==void 0){let e=Date.now()-s,t=i.maxTotalTimeout-e;if(t<=0)throw new Y(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:e});d.maxTotalTimeout=t}let f=await a.retry(Ho(r,u,c.requestState),d);if(Ha(f)){c={inputRequests:f.inputRequests??{},...f.requestState!==void 0&&{requestState:f.requestState}};continue}return f}}var qo=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Jo={IdJagTokenExchangeResponseSchema:Ur,OAuthClientInformationFullSchema:Jr,OAuthClientInformationSchema:qr,OAuthClientMetadataSchema:Kr,OAuthClientRegistrationErrorSchema:Yr,OAuthErrorResponseSchema:Wr,OAuthMetadataSchema:zr,OAuthProtectedResourceMetadataSchema:Rr,OAuthTokenRevocationRequestSchema:Xr,OAuthTokensSchema:Hr,OpenIdProviderDiscoveryMetadataSchema:Vr,OpenIdProviderMetadataSchema:Br},Yo={},Xo={};function Zo(e,t){let n=e.slice(0,-6);Yo[n]=t,Xo[n]=e=>t.safeParse(e).success}for(let e of qo)Zo(e,La[e]);for(let[e,t]of Object.entries(Jo))Zo(e,t);Object.freeze(Yo);var Qo=Object.freeze(Xo);function $o(e){switch(e){case`initialize`:case`notifications/initialized`:return ja(void 0);case`server/discover`:return ja(Aa);default:return}}var es=[Fe,Ie,Re,Be],ts=[`inputResponses`,`requestState`];function ns(e,t){let n=e.params;if(!ss(n))return{message:e,lifted:{}};let r=n._meta,i=ss(r)?es.filter(e=>e in r):[],a=t===`request`?ts.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&ss(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function rs(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function is(e){return()=>e}var as=is(void 0),os=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Ne,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Y(J.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&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),new Y(J.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){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{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),Ba(e)||Va(e)?this._onresponse(e):Ra(e)?this._onrequest(e,t):za(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new Y(J.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=ns(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(Pa(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=ns(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(X.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(Na(n.method)&&!i.hasRequestMethod(n.method)&&!(Fa(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(X.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(X.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(X.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:us(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?as:is(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),po(t))return u(e,t,n);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(X.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:X.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.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._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Ba(e)?n(e):n(Z.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(po(t))return Fa(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return ja(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=$o(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Na(t)&&!e.hasRequestMethod(t))throw new Y(J.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof Y?e:new Y(J.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof Y?e:new Y(J.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(gs(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;yo(n,o).then(e=>{e.success?d(e.data):f(new Y(J.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new Y(J.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new Y(J.NotConnected,`Not connected`);if(Pa(t.method)&&!e.hasNotificationMethod(t.method))throw new Y(J.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!Na(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await yo(t.params,{...r.params});if(!a.success)throw new Z(X.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.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,n){if(typeof t==`function`){if(!Pa(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await yo(t.params,{...r.params});if(!i.success)throw new Z(X.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ss(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cs(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];n[r]=ss(a)&&ss(i)?{...a,...i}:i}return n}function ls(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function us(e){let t={},n=[];if(!ls(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!ls(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function ds(e){throw new Y(J.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function fs(e,t,n,r,i){return{sessionId:i,mcpReq:{id:e,method:t,_meta:n?._meta,requestState:is(void 0),signal:r,send:(()=>ds(`send`)),notify:()=>ds(`notify`)}}}async function ps(e,t,n,r,i){if(!ls(r)||typeof r.method!=`string`)throw new Y(J.InvalidResult,`Invalid input request '${n}': each inputRequests entry must be an embedded request object with a method`,{key:n});let a=r.method;if(!t.hasInputRequestMethod(a))throw new Y(J.InvalidResult,`Invalid input request '${n}': '${a}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:n,method:a});let o=e.getRequestHandler(a);if(o===void 0)throw new Y(J.CapabilityNotSupported,`Cannot fulfil input request '${n}': no handler is registered for '${a}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:n,method:a});let s=ls(r.params)?r.params:void 0;return await o({jsonrpc:`2.0`,id:n,method:a,...s!==void 0&&{params:s}},e.buildContext(fs(n,a,s,i,e.sessionId)))}function ms(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function hs(e,t,n,r){let{codec:i,request:a,options:o,flowStartedAt:s}=r,c={inputRequests:n.inputRequests,...n.requestState!==void 0&&{requestState:n.requestState}},l={dispatchInputRequest:(t,n,r)=>ps(e,i,t,n,r),retry:(e,t)=>r.retry(e,ms(o,t))};return Ko({config:t,method:a.method,originalParams:a.params,firstPayload:c,flowStartedAt:s,signal:o?.signal,requestOptions:{...o?.timeout!==void 0&&{timeout:o.timeout},...o?.maxTotalTimeout!==void 0&&{maxTotalTimeout:o.maxTotalTimeout},...o?.onprogress!==void 0&&{onprogress:o.onprogress}},hooks:l})}function gs(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var _s=Te(Se((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),1);function vs(e){if(e)try{return _s.parse(e).type}catch{let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return t===``||e.slice(t.length).includes(`,`)?void 0:t}}function ys(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function bs(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...ys(t.headers),...ys(r.headers)}:t.headers}):e}var xs=new Set([301,302,303,307,308]),Ss=5;function Cs(e,t){return e.protocol===t.protocol&&e.host===t.host||e.protocol===`http:`&&t.protocol===`https:`&&e.hostname===t.hostname&&!e.port&&!t.port}function ws(e,t){let n=xs.has(t.status)?t.headers?.get(`location`):void 0;if(n)try{return new URL(n,e)}catch{return}}var Ts=new WeakSet;function Es(e){let t=(t,n)=>e(t,n);return Ts.add(t),t}function Ds(e){return Ts.has(e)?e:async(t,n)=>{if(n?.redirect===`error`||n?.redirect===`manual`)return e(t,n);let r=(n?.method??`GET`).toUpperCase(),i=t;for(let t=0;;t++){let a=await e(i,{...n,redirect:`manual`}),o=ws(i,a);if(!o||t===Ss)return a;let s=new URL(i),c=r===`GET`||a.status===307||a.status===308,l=!(o.username||o.password)||o.username===s.username&&o.password===s.password;if(!c||!l||!Cs(s,o))return a;await a.text?.().catch(()=>{}),i=o}}}function Os(e,t){if(t.type===`opaqueredirect`)return`Redirect not followed: this runtime does not expose where it points`;let n=ws(t.url||e,t);if(n)return n.username=n.password=n.search=n.hash=``,n.protocol===`http:`&&new URL(t.url||e).protocol===`https:`?(n.protocol=`https:`,`Redirect from https to plain http not followed; try ${n.href} as the endpoint`):`Redirect to ${n.href} not followed; use that URL as the endpoint if it is the intended server`}function ks(e,t){let n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r1?t[a.href]=e:(a.hash=``,r===``?n=a:Is(e,t,n))}}else if(e!==!0&&e!==!1)return t;let i=n.href+(r?`#`+r:``);if(t[i]!==void 0)throw Error(`Duplicate schema URI "${i}".`);if(t[i]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:i}),e.$ref&&e.__absolute_ref__===void 0){let t=new URL(e.$ref,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:t.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let t=new URL(e.$recursiveRef,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:t.href})}if(e.$anchor){let r=new URL(`#`+e.$anchor,n.href);t[r.href]=e}for(let i in e){if(Ps[i])continue;let a=`${r}/${As(i)}`,o=e[i];if(Array.isArray(o)){if(Ms[i]){let e=o.length;for(let r=0;r%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Us=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,Ws=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Gs=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ks=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,qs=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Js=e=>{if(e[0]===`"`)return!1;let[t,n,...r]=e.split(`@`);return!t||!n||r.length!==0||t.length>64||n.length>253||t[0]===`.`||t.endsWith(`.`)||t.includes(`..`)||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(`.`).every(e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e))},Ys=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Xs=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Zs=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Qs(e){return e.test.bind(e)}var $s={date:tc,time:nc.bind(void 0,!1),"date-time":ic,duration:Zs,uri:sc,"uri-reference":Qs(Vs),"uri-template":Qs(Hs),url:Qs(Us),email:Js,hostname:Qs(Bs),ipv4:Qs(Ys),ipv6:Qs(Xs),regex:lc,uuid:Qs(Ws),"json-pointer":Qs(Gs),"json-pointer-uri-fragment":Qs(Ks),"relative-json-pointer":Qs(qs)};function ec(e){return e%4==0&&(e%100!=0||e%400==0)}function tc(e){let t=e.match(Ls);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&ec(n)?29:Rs[r])}function nc(e,t){let n=t.match(zs);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}var rc=/t|\s/i;function ic(e){let t=e.split(rc);return t.length==2&&tc(t[0])&&nc(!0,t[1])}var ac=/\/|:/,oc=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function sc(e){return ac.test(e)&&oc.test(e)}var cc=/[^\\]\\Z/;function lc(e){if(cc.test(e))return!1;try{return new RegExp(e,`u`),!0}catch{return!1}}function uc(e){let t=0,n=e.length,r=0,i;for(;r=55296&&i<=56319&&r{if(typeof e!=`string`||/[\s;'\"]/.test(e))return!1;let t=e.match(/^([a-z]+):\/\/([^/]+)$/i);return!!(t&&n.has(t[1].toLowerCase()))})}function ge(e){let t=N(N(N(e)?.ui)?.csp),n=P(t?.connectDomains,[`http`,`https`,`ws`,`wss`]),r=P(t?.resourceDomains,[`http`,`https`]),i=P(t?.frameDomains,[`http`,`https`]),a=P(t?.baseUriDomains,[`http`,`https`]),o=r.length?` ${r.join(` `)}`:``,s=[`default-src 'none'`,`worker-src blob:`,`script-src 'self' 'unsafe-inline'${o}`,`style-src 'self' 'unsafe-inline'${o}`,`img-src 'self' data:${o}`,`media-src 'self' data:${o}`,`font-src 'self' data:${o}`,`connect-src ${n.length?n.join(` `):`'none'`}`];return i.length&&s.push(`frame-src ${i.join(` `)}`),a.length&&s.push(`base-uri ${a.join(` `)}`),`${s.join(`; `)};`}var _e=Object.create,ve=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyNames,F=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty,Se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ce=(e,t)=>{let n={};for(var r in e)ve(n,r,{get:e[r],enumerable:!0});return t&&ve(n,Symbol.toStringTag,{value:`Module`}),n},we=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=be(t),a=0,o=i.length,s;at[e]).bind(null,s),enumerable:!(r=ye(t,s))||r.enumerable});return e},Te=(e,t,n)=>(n=e==null?{}:_e(F(e)),we(t||!e||!e.__esModule?ve(n,`default`,{value:e,enumerable:!0}):n,e)),Ee=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),De=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),Oe=new Set([`https://json-schema.org/draft-07/schema`,`http://json-schema.org/draft-07/schema`]),ke=new Set([`https://json-schema.org/draft-06/schema`,`http://json-schema.org/draft-06/schema`]);function Ae(e){return typeof e==`string`&&De.has(e.replace(/#$/,``))}function je(e,t){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let n=e.$schema.replace(/#$/,``);if(Ee.has(n))return`2020-12`;if(De.has(n))return`2019-09`;if(Oe.has(n)||ke.has(n))return`draft-7`;throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var Me=`2025-11-25`,Ne=[Me,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],Pe=`io.modelcontextprotocol/related-task`,Fe=`io.modelcontextprotocol/protocolVersion`,Ie=`io.modelcontextprotocol/clientInfo`,Le=`io.modelcontextprotocol/serverInfo`,Re=`io.modelcontextprotocol/clientCapabilities`,ze=`io.modelcontextprotocol/subscriptionId`,Be=`io.modelcontextprotocol/logLevel`,Ve=ee(()=>j([x(),E(),A(),ae(),M(x(),Ve),O(Ve)])),I=M(x(),Ve),He=O(Ve),Ue=j([x(),E().int()]),We=x(),Ge=T({ttl:E().optional()}),Ke=T({taskId:x()}),qe=k({progressToken:Ue.optional(),[Pe]:Ke.optional()}),L=T({_meta:qe.optional()}),Je=L.extend({task:Ge.optional()}),R=T({method:x(),params:L.loose().optional()}),z=T({_meta:qe.optional()}),B=T({method:x(),params:z.loose().optional()}),Ye=k({get[Le](){return H.optional().catch(void 0)}}),V=k({_meta:Ye.optional()}),Xe=j([x(),E().int()]),Ze=T({jsonrpc:w(`2.0`),id:Xe,...R.shape}).strict(),Qe=T({jsonrpc:w(`2.0`),...B.shape}).strict(),$e=T({jsonrpc:w(`2.0`),id:Xe,result:V}).strict(),et=T({jsonrpc:w(`2.0`),id:Xe.optional(),error:T({code:E().int(),message:x(),data:h().optional()})}).strict(),tt=j([Ze,Qe,$e,et]),nt=j([$e,et]),rt=V.strict(),it=z.extend({requestId:Xe.optional(),reason:x().optional()}),at=B.extend({method:w(`notifications/cancelled`),params:it}),ot=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),st=T({icons:O(ot).optional()}),ct=T({name:x(),title:x().optional()}),H=ct.extend({...ct.shape,...st.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),lt=se(T({applyDefaults:A().optional()}),I),ut=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:lt.optional(),url:I.optional()}),I.optional())),dt=k({list:I.optional(),cancel:I.optional(),requests:k({sampling:k({createMessage:I.optional()}).optional(),elicitation:k({create:I.optional()}).optional()}).optional()}),ft=k({list:I.optional(),cancel:I.optional(),requests:k({tools:k({call:I.optional()}).optional()}).optional()}),pt=T({experimental:M(x(),I).optional(),sampling:T({context:I.optional(),tools:I.optional()}).optional(),elicitation:ut.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:dt.optional(),extensions:M(x(),I).optional()}),mt=L.extend({protocolVersion:x(),capabilities:pt,clientInfo:H}),ht=R.extend({method:w(`initialize`),params:mt}),gt=T({experimental:M(x(),I).optional(),logging:I.optional(),completions:I.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ft.optional(),extensions:M(x(),I).optional()}),_t=V.extend({protocolVersion:x(),capabilities:gt,serverInfo:H,instructions:x().optional()}),vt=B.extend({method:w(`notifications/initialized`),params:z.optional()}),yt=R.extend({method:w(`server/discover`),params:L.optional()}),bt=V.extend({supportedVersions:O(x()),capabilities:gt,instructions:x().optional()}),xt=R.extend({method:w(`ping`),params:L.optional()}),St=T({progress:E(),total:y(E()),message:y(x())}),Ct=T({...z.shape,...St.shape,progressToken:Ue}),wt=B.extend({method:w(`notifications/progress`),params:Ct}),Tt=L.extend({cursor:We.optional()}),Et=R.extend({params:Tt.optional()}),Dt=V.extend({nextCursor:We.optional()}),Ot=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),kt=Ot.extend({text:x()}),At=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),jt=Ot.extend({blob:At}),Mt=D([`user`,`assistant`]),Nt=T({audience:O(Mt).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Pt=T({...ct.shape,...st.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Nt.optional(),_meta:y(k({}))}),Ft=T({...ct.shape,...st.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Nt.optional(),_meta:y(k({}))}),It=Et.extend({method:w(`resources/list`)}),Lt=Dt.extend({resources:O(Pt)}),U=Et.extend({method:w(`resources/templates/list`)}),W=Dt.extend({resourceTemplates:O(Ft)}),Rt=L.extend({uri:x()}),zt=Rt,Bt=R.extend({method:w(`resources/read`),params:zt}),Vt=V.extend({contents:O(j([kt,jt]))}),Ht=B.extend({method:w(`notifications/resources/list_changed`),params:z.optional()}),Ut=Rt,Wt=R.extend({method:w(`resources/subscribe`),params:Ut}),Gt=Rt,Kt=R.extend({method:w(`resources/unsubscribe`),params:Gt}),qt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Jt=L.extend({notifications:qt}),Yt=R.extend({method:w(`subscriptions/listen`),params:Jt}),Xt=z.extend({notifications:qt}),Zt=B.extend({method:w(`notifications/subscriptions/acknowledged`),params:Xt}),Qt=Ye.extend({[ze]:Xe}),$t=V.extend({_meta:Qt}),en=z.extend({uri:x()}),tn=B.extend({method:w(`notifications/resources/updated`),params:en}),G=T({name:x(),description:y(x()),required:y(A())}),nn=T({...ct.shape,...st.shape,description:y(x()),arguments:y(O(G)),_meta:y(k({}))}),rn=Et.extend({method:w(`prompts/list`)}),an=Dt.extend({prompts:O(nn)}),on=L.extend({name:x(),arguments:M(x(),x()).optional()}),sn=R.extend({method:w(`prompts/get`),params:on}),cn=T({type:w(`text`),text:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),K=T({type:w(`image`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),ln=T({type:w(`audio`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),un=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),dn=T({type:w(`resource`),resource:j([kt,jt]),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),fn=Pt.extend({type:w(`resource_link`)}),pn=j([cn,K,ln,fn,dn]),mn=T({role:Mt,content:pn}),hn=V.extend({description:x().optional(),messages:O(mn)}),gn=B.extend({method:w(`notifications/prompts/list_changed`),params:z.optional()}),_n=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),vn=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),yn=T({...ct.shape,...st.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),Ve).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:k({$schema:x().optional()}).optional(),annotations:_n.optional(),execution:vn.optional(),_meta:M(x(),h()).optional()}),bn=Et.extend({method:w(`tools/list`)}),xn=Dt.extend({tools:O(yn)}),Sn=V.extend({content:O(pn).default([]),structuredContent:h().optional(),isError:A().optional()}),Cn=Sn.or(V.extend({toolResult:h()})),wn=Je.extend({name:x(),arguments:M(x(),h()).optional()}),Tn=R.extend({method:w(`tools/call`),params:wn}),En=B.extend({method:w(`notifications/tools/list_changed`),params:z.optional()}),Dn=T({autoRefresh:A().default(!0),debounceMs:E().int().nonnegative().default(300)}),On=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),kn=L.extend({level:On}),An=R.extend({method:w(`logging/setLevel`),params:kn}),jn=z.extend({level:On,logger:x().optional(),data:h()}),Mn=B.extend({method:w(`notifications/message`),params:jn}),Nn=T({name:x().optional()}),Pn=T({hints:O(Nn).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),Fn=T({mode:D([`auto`,`required`,`none`]).optional()}),In=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(pn),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),Ln=S(`type`,[cn,K,ln]),Rn=S(`type`,[cn,K,ln,un,In]),zn=T({role:Mt,content:j([Rn,O(Rn)]),_meta:M(x(),h()).optional()}),Bn=Je.extend({messages:O(zn),modelPreferences:Pn.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:I.optional(),tools:O(yn).optional(),toolChoice:Fn.optional()}),Vn=R.extend({method:w(`sampling/createMessage`),params:Bn}),Hn=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:Mt,content:Ln}),Un=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:Mt,content:j([Rn,O(Rn)])}),Wn=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),Gn=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Kn=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),qn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Jn=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Yn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Xn=j([qn,Jn]),Zn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),Qn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),$n=j([Zn,Qn]),er=j([Yn,Xn,$n]),tr=j([er,Wn,Gn,Kn]),nr=Je.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),tr),required:O(x()).optional()}).catchall(h())}),rr=Je.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),ir=j([nr,rr]),ar=R.extend({method:w(`elicitation/create`),params:ir}),or=z.extend({elicitationId:x()}),sr=B.extend({method:w(`notifications/elicitation/complete`),params:or}),cr=V.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),lr=T({type:w(`ref/resource`),uri:x()}),ur=T({type:w(`ref/prompt`),name:x()}),dr=L.extend({ref:j([ur,lr]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),fr=R.extend({method:w(`completion/complete`),params:dr}),pr=V.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),mr=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),hr=R.extend({method:w(`roots/list`),params:L.optional()}),gr=V.extend({roots:O(mr)}),_r=B.extend({method:w(`notifications/roots/list_changed`),params:z.optional()}),vr=k({ttl:E().optional(),pollInterval:E().optional()}),yr=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),br=T({taskId:x(),status:yr,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),xr=V.extend({task:br}),Sr=z.merge(br),Cr=B.extend({method:w(`notifications/tasks/status`),params:Sr}),wr=R.extend({method:w(`tasks/get`),params:L.extend({taskId:x()})}),Tr=V.merge(br),Er=R.extend({method:w(`tasks/result`),params:L.extend({taskId:x()})}),Dr=V.loose(),Or=Et.extend({method:w(`tasks/list`)}),kr=Dt.extend({tasks:O(br)}),Ar=R.extend({method:w(`tasks/cancel`),params:L.extend({taskId:x()})}),jr=V.merge(br),Mr=j([xt,ht,yt,fr,An,sn,rn,It,U,Bt,Wt,Kt,Yt,Tn,bn]),Nr=j([at,wt,vt,_r]),Pr=j([rt,Hn,Un,cr,gr]),Fr=j([xt,Vn,ar,hr]),Ir=j([at,wt,Mn,tn,Ht,En,gn,Zt,sr]),Lr=j([rt,_t,bt,pr,hn,an,Lt,W,Vt,Sn,xn,$t]),q=d().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:de.custom,message:`URL must be parseable`,fatal:!0}),ne}).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`}),Rr=k({resource:x().url(),authorization_servers:O(q).optional(),jwks_uri:x().url().optional(),scopes_supported:O(x()).optional(),bearer_methods_supported:O(x()).optional(),resource_signing_alg_values_supported:O(x()).optional(),resource_name:x().optional(),resource_documentation:x().optional(),resource_policy_uri:x().url().optional(),resource_tos_uri:x().url().optional(),tls_client_certificate_bound_access_tokens:A().optional(),authorization_details_types_supported:O(x()).optional(),dpop_signing_alg_values_supported:O(x()).optional(),dpop_bound_access_tokens_required:A().optional()}),zr=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),service_documentation:q.optional(),revocation_endpoint:q.optional(),revocation_endpoint_auth_methods_supported:O(x()).optional(),revocation_endpoint_auth_signing_alg_values_supported:O(x()).optional(),introspection_endpoint:x().optional(),introspection_endpoint_auth_methods_supported:O(x()).optional(),introspection_endpoint_auth_signing_alg_values_supported:O(x()).optional(),code_challenge_methods_supported:O(x()).optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0),dpop_signing_alg_values_supported:O(x()).optional()}),Br=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,userinfo_endpoint:q.optional(),jwks_uri:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),acr_values_supported:O(x()).optional(),subject_types_supported:O(x()),id_token_signing_alg_values_supported:O(x()),id_token_encryption_alg_values_supported:O(x()).optional(),id_token_encryption_enc_values_supported:O(x()).optional(),userinfo_signing_alg_values_supported:O(x()).optional(),userinfo_encryption_alg_values_supported:O(x()).optional(),userinfo_encryption_enc_values_supported:O(x()).optional(),request_object_signing_alg_values_supported:O(x()).optional(),request_object_encryption_alg_values_supported:O(x()).optional(),request_object_encryption_enc_values_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),display_values_supported:O(x()).optional(),claim_types_supported:O(x()).optional(),claims_supported:O(x()).optional(),service_documentation:x().optional(),claims_locales_supported:O(x()).optional(),ui_locales_supported:O(x()).optional(),claims_parameter_supported:A().optional(),request_parameter_supported:A().optional(),request_uri_parameter_supported:A().optional(),require_request_uri_registration:A().optional(),op_policy_uri:q.optional(),op_tos_uri:q.optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0)}),Vr=T({...Br.shape,...zr.pick({code_challenge_methods_supported:!0}).shape}),Hr=T({access_token:x(),id_token:x().optional(),token_type:x(),expires_in:he().optional(),scope:x().optional(),refresh_token:x().optional(),issuer:x().optional().catch(void 0)}).strip(),Ur=T({issued_token_type:w(`urn:ietf:params:oauth:token-type:id-jag`),access_token:x(),token_type:x().optional(),expires_in:E().optional(),scope:x().optional()}).strip(),Wr=T({error:x(),error_description:x().optional(),error_uri:x().optional()}),Gr=q.optional().or(w(``).transform(()=>void 0)),Kr=T({redirect_uris:O(q),token_endpoint_auth_method:x().optional(),grant_types:O(x()).optional(),response_types:O(x()).optional(),application_type:x().optional(),client_name:x().optional(),client_uri:q.optional(),logo_uri:Gr,scope:x().optional(),contacts:O(x()).optional(),tos_uri:Gr,policy_uri:x().optional(),jwks_uri:q.optional(),jwks:b().optional(),software_id:x().optional(),software_version:x().optional(),software_statement:x().optional()}).strip(),qr=T({client_id:x(),client_secret:x().optional(),client_id_issued_at:E().optional(),client_secret_expires_at:E().optional(),issuer:x().optional().catch(void 0)}).strip(),Jr=Kr.merge(qr),Yr=T({error:x(),error_description:x().optional()}).strip(),Xr=T({token:x(),token_type_hint:x().optional()}).strip(),Zr=Symbol.for(`mcp.sdk.errorBrands`);function Qr(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Zr,{value:n,enumerable:!1,configurable:!0})}function $r(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Zr)){let n=t[Zr];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var ei=function(e){return e.InvalidRequest=`invalid_request`,e.InvalidClient=`invalid_client`,e.InvalidGrant=`invalid_grant`,e.UnauthorizedClient=`unauthorized_client`,e.UnsupportedGrantType=`unsupported_grant_type`,e.InvalidScope=`invalid_scope`,e.AccessDenied=`access_denied`,e.ServerError=`server_error`,e.TemporarilyUnavailable=`temporarily_unavailable`,e.UnsupportedResponseType=`unsupported_response_type`,e.UnsupportedTokenType=`unsupported_token_type`,e.InvalidToken=`invalid_token`,e.MethodNotAllowed=`method_not_allowed`,e.TooManyRequests=`too_many_requests`,e.InvalidClientMetadata=`invalid_client_metadata`,e.InvalidRedirectUri=`invalid_redirect_uri`,e.InsufficientScope=`insufficient_scope`,e.InvalidTarget=`invalid_target`,e.InvalidDpopProof=`invalid_dpop_proof`,e.UseDpopNonce=`use_dpop_nonce`,e}({}),ti=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Qr(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},J=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),Y=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Qr(this,new.target)}},ni=class extends Y{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}};function ri(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function ii(e){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function ai({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=oi}function li(e){return e.filter(e=>!ci(e))}function ui(e){return e.filter(e=>ci(e))}function di(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var fi=[`task`,`inputRequests`,`requestState`];function pi(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||fi.some(t=>t in e)?e:{...e,content:[]}}function mi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=T({ttl:E().optional()}),a=T({taskId:x()}),o=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=T({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=T({method:x(),params:s.loose().optional()}),u=T({_meta:o.optional()}),d=T({method:x(),params:u.loose().optional()}),f=k({_meta:o.optional()}),p=j([x(),E().int()]),m=f.strict(),g=u.extend({requestId:p.optional(),reason:x().optional()}),_=d.extend({method:w(`notifications/cancelled`),params:g}),v=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),b=T({icons:O(v).optional()}),C=T({name:x(),title:x().optional()}),te=C.extend({...C.shape,...b.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),ne=se(T({applyDefaults:A().optional()}),t),re=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:ne.optional(),url:t.optional()}),t.optional())),ie=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),oe=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),le=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:re.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:ie.optional(),extensions:M(x(),t).optional()}),ue=s.extend({protocolVersion:x(),capabilities:le,clientInfo:te}),de=l.extend({method:w(`initialize`),params:ue}),fe=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:oe.optional(),extensions:M(x(),t).optional()}),me=f.extend({protocolVersion:x(),capabilities:fe,serverInfo:te,instructions:x().optional()}),he=d.extend({method:w(`notifications/initialized`),params:u.optional()}),N=l.extend({method:w(`ping`),params:s.optional()}),P=T({progress:E(),total:y(E()),message:y(x())}),ge=T({...u.shape,...P.shape,progressToken:n}),_e=d.extend({method:w(`notifications/progress`),params:ge}),ve=s.extend({cursor:r.optional()}),ye=l.extend({params:ve.optional()}),be=f.extend({nextCursor:r.optional()}),F=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),xe=F.extend({text:x()}),Se=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Ce=F.extend({blob:Se}),we=D([`user`,`assistant`]),Te=T({audience:O(we).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Ee=T({...C.shape,...b.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Te.optional(),_meta:y(k({}))}),De=T({...C.shape,...b.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Te.optional(),_meta:y(k({}))}),Oe=ye.extend({method:w(`resources/list`)}),ke=be.extend({resources:O(Ee)}),Ae=ye.extend({method:w(`resources/templates/list`)}),je=be.extend({resourceTemplates:O(De)}),Me=s.extend({uri:x()}),Ne=Me,Pe=l.extend({method:w(`resources/read`),params:Ne}),Fe=f.extend({contents:O(j([xe,Ce]))}),Ie=d.extend({method:w(`notifications/resources/list_changed`),params:u.optional()}),Le=Me,Re=l.extend({method:w(`resources/subscribe`),params:Le}),ze=Me,Be=l.extend({method:w(`resources/unsubscribe`),params:ze}),Ve=u.extend({uri:x()}),I=d.extend({method:w(`notifications/resources/updated`),params:Ve}),He=T({name:x(),description:y(x()),required:y(A())}),Ue=T({...C.shape,...b.shape,description:y(x()),arguments:y(O(He)),_meta:y(k({}))}),We=ye.extend({method:w(`prompts/list`)}),Ge=be.extend({prompts:O(Ue)}),Ke=s.extend({name:x(),arguments:M(x(),x()).optional()}),qe=l.extend({method:w(`prompts/get`),params:Ke}),L=T({type:w(`text`),text:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Je=T({type:w(`image`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),R=T({type:w(`audio`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),z=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),B=T({type:w(`resource`),resource:j([xe,Ce]),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Ye=Ee.extend({type:w(`resource_link`)}),V=j([L,Je,R,Ye,B]),Xe=T({role:we,content:V}),Ze=f.extend({description:x().optional(),messages:O(Xe)}),Qe=d.extend({method:w(`notifications/prompts/list_changed`),params:u.optional()}),$e=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),et=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),tt=T({...C.shape,...b.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()).optional(),annotations:$e.optional(),execution:et.optional(),_meta:M(x(),h()).optional()}),nt=ye.extend({method:w(`tools/list`)}),rt=be.extend({tools:O(tt)}),it=f.extend({content:O(V),structuredContent:M(x(),h()).optional(),isError:A().optional()}),at=c.extend({name:x(),arguments:M(x(),h()).optional()}),ot=l.extend({method:w(`tools/call`),params:at}),st=d.extend({method:w(`notifications/tools/list_changed`),params:u.optional()}),ct=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),H=s.extend({level:ct}),lt=l.extend({method:w(`logging/setLevel`),params:H}),ut=u.extend({level:ct,logger:x().optional(),data:h()}),dt=d.extend({method:w(`notifications/message`),params:ut}),ft=T({name:x().optional()}),pt=T({hints:O(ft).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),mt=T({mode:D([`auto`,`required`,`none`]).optional()}),ht=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(V),structuredContent:T({}).loose().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),gt=S(`type`,[L,Je,R]),_t=S(`type`,[L,Je,R,z,ht]),vt=T({role:we,content:j([_t,O(_t)]),_meta:M(x(),h()).optional()}),yt=c.extend({messages:O(vt),modelPreferences:pt.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(tt).optional(),toolChoice:mt.optional()}),bt=l.extend({method:w(`sampling/createMessage`),params:yt}),xt=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:we,content:gt}),St=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:we,content:j([_t,O(_t)])}),Ct=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),wt=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Tt=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Et=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Dt=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ot=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),kt=j([Et,Dt]),At=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),jt=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Mt=j([At,jt]),Nt=j([Ot,kt,Mt]),Pt=j([Nt,Ct,wt,Tt]),Ft=c.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),Pt),required:O(x()).optional()}).catchall(h())}),It=c.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),Lt=j([Ft,It]),U=l.extend({method:w(`elicitation/create`),params:Lt}),W=u.extend({elicitationId:x()}),Rt=d.extend({method:w(`notifications/elicitation/complete`),params:W}),zt=f.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),Bt=T({type:w(`ref/resource`),uri:x()}),Vt=T({type:w(`ref/prompt`),name:x()}),Ht=s.extend({ref:j([Vt,Bt]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),Ut=l.extend({method:w(`completion/complete`),params:Ht}),Wt=f.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),Gt=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Kt=l.extend({method:w(`roots/list`),params:s.optional()}),qt=f.extend({roots:O(Gt)}),Jt=d.extend({method:w(`notifications/roots/list_changed`),params:u.optional()}),Yt=k({ttl:E().optional(),pollInterval:E().optional()}),Xt=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Zt=T({taskId:x(),status:Xt,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),Qt=f.extend({task:Zt}),$t=u.merge(Zt),en=d.extend({method:w(`notifications/tasks/status`),params:$t}),tn=l.extend({method:w(`tasks/get`),params:s.extend({taskId:x()})}),G=f.merge(Zt),nn=l.extend({method:w(`tasks/result`),params:s.extend({taskId:x()})}),rn=f.loose(),an=ye.extend({method:w(`tasks/list`)}),on=be.extend({tasks:O(Zt)}),sn=l.extend({method:w(`tasks/cancel`),params:s.extend({taskId:x()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:_,IconSchema:v,IconsSchema:b,BaseMetadataSchema:C,ImplementationSchema:te,ClientTasksCapabilitySchema:ie,ServerTasksCapabilitySchema:oe,ClientCapabilitiesSchema:le,InitializeRequestParamsSchema:ue,InitializeRequestSchema:de,ServerCapabilitiesSchema:fe,InitializeResultSchema:me,InitializedNotificationSchema:he,PingRequestSchema:N,ProgressSchema:P,ProgressNotificationParamsSchema:ge,ProgressNotificationSchema:_e,PaginatedRequestParamsSchema:ve,PaginatedRequestSchema:ye,PaginatedResultSchema:be,ResourceContentsSchema:F,TextResourceContentsSchema:xe,BlobResourceContentsSchema:Ce,RoleSchema:we,AnnotationsSchema:Te,ResourceSchema:Ee,ResourceTemplateSchema:De,ListResourcesRequestSchema:Oe,ListResourcesResultSchema:ke,ListResourceTemplatesRequestSchema:Ae,ListResourceTemplatesResultSchema:je,ResourceRequestParamsSchema:Me,ReadResourceRequestParamsSchema:Ne,ReadResourceRequestSchema:Pe,ReadResourceResultSchema:Fe,ResourceListChangedNotificationSchema:Ie,SubscribeRequestParamsSchema:Le,SubscribeRequestSchema:Re,UnsubscribeRequestParamsSchema:ze,UnsubscribeRequestSchema:Be,ResourceUpdatedNotificationParamsSchema:Ve,ResourceUpdatedNotificationSchema:I,PromptArgumentSchema:He,PromptSchema:Ue,ListPromptsRequestSchema:We,ListPromptsResultSchema:Ge,GetPromptRequestParamsSchema:Ke,GetPromptRequestSchema:qe,TextContentSchema:L,ImageContentSchema:Je,AudioContentSchema:R,ToolUseContentSchema:z,EmbeddedResourceSchema:B,ResourceLinkSchema:Ye,ContentBlockSchema:V,PromptMessageSchema:Xe,GetPromptResultSchema:Ze,PromptListChangedNotificationSchema:Qe,ToolAnnotationsSchema:$e,ToolExecutionSchema:et,ToolSchema:tt,ListToolsRequestSchema:nt,ListToolsResultSchema:rt,CallToolResultSchema:it,CallToolRequestParamsSchema:at,CallToolRequestSchema:ot,ToolListChangedNotificationSchema:st,LoggingLevelSchema:ct,SetLevelRequestParamsSchema:H,SetLevelRequestSchema:lt,LoggingMessageNotificationParamsSchema:ut,LoggingMessageNotificationSchema:dt,ModelHintSchema:ft,ModelPreferencesSchema:pt,ToolChoiceSchema:mt,ToolResultContentSchema:ht,SamplingContentSchema:gt,SamplingMessageContentBlockSchema:_t,SamplingMessageSchema:vt,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:bt,CreateMessageResultSchema:xt,CreateMessageResultWithToolsSchema:St,BooleanSchemaSchema:Ct,StringSchemaSchema:wt,NumberSchemaSchema:Tt,UntitledSingleSelectEnumSchemaSchema:Et,TitledSingleSelectEnumSchemaSchema:Dt,LegacyTitledEnumSchemaSchema:Ot,SingleSelectEnumSchemaSchema:kt,UntitledMultiSelectEnumSchemaSchema:At,TitledMultiSelectEnumSchemaSchema:jt,MultiSelectEnumSchemaSchema:Mt,EnumSchemaSchema:Nt,PrimitiveSchemaDefinitionSchema:Pt,ElicitRequestFormParamsSchema:Ft,ElicitRequestURLParamsSchema:It,ElicitRequestParamsSchema:Lt,ElicitRequestSchema:U,ElicitationCompleteNotificationParamsSchema:W,ElicitationCompleteNotificationSchema:Rt,ElicitResultSchema:zt,ResourceTemplateReferenceSchema:Bt,PromptReferenceSchema:Vt,CompleteRequestParamsSchema:Ht,CompleteRequestSchema:Ut,CompleteResultSchema:Wt,RootSchema:Gt,ListRootsRequestSchema:Kt,ListRootsResultSchema:qt,RootsListChangedNotificationSchema:Jt,TaskCreationParamsSchema:Yt,TaskStatusSchema:Xt,TaskSchema:Zt,CreateTaskResultSchema:Qt,TaskStatusNotificationParamsSchema:$t,TaskStatusNotificationSchema:en,GetTaskRequestSchema:tn,GetTaskResultSchema:G,GetTaskPayloadRequestSchema:nn,GetTaskPayloadResultSchema:rn,ListTasksRequestSchema:an,ListTasksResultSchema:on,CancelTaskRequestSchema:sn,CancelTaskResultSchema:f.merge(Zt),ClientRequestSchema:j([N,de,Ut,lt,qe,We,Oe,Ae,Pe,Re,Be,ot,nt,tn,nn,an,sn]),ClientNotificationSchema:j([_,_e,he,Jt,en]),ClientResultSchema:j([m,xt,St,zt,qt,G,on,Qt]),ServerRequestSchema:j([N,bt,U,Kt,tn,nn,an,sn]),ServerNotificationSchema:j([_,_e,dt,I,Ie,st,Qe,en,Rt]),ServerResultSchema:j([m,me,Wt,Ze,Ge,ke,je,Fe,it,rt,G,on,Qt]),CallToolResultWireSchema:h().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of fi)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(pi).pipe(it)}}var hi;function gi(){return hi??=mi()}function _i(e){return e.type!==`object`}var vi=new Set([`const`,`enum`,`default`,`examples`]),yi=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function bi(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function xi(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(bi(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=Ae(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&bi(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=vi.has(o)?s:yi.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Si={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ci={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},wi={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ti;function Ei(){if(Ti)return Ti;let e=gi();return Ti={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ti}function Di(e){return Object.prototype.hasOwnProperty.call(Si,e)}function Oi(e){return Object.prototype.hasOwnProperty.call(Ci,e)}function ki(e){return Object.prototype.hasOwnProperty.call(wi,e)}function Ai(e){return ki(e)?Ei().resultSchemas[e]:void 0}function ji(e){return Di(e)?Ei().requestSchemas[e]:void 0}function Mi(e){return Oi(e)?Ei().notificationSchemas[e]:void 0}Object.keys(Si),Object.keys(Ci);function Ni(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pi(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Fi={ok:!1,reason:`not-in-era`};function Ii(e){return Ni(e)&&Ni(e.outputSchema)&&_i(e.outputSchema)}function Li(e){return e}var Ri={era:`2025-11-25`,hasRequestMethod:Di,hasNotificationMethod:Oi,validateRequest:(e,t)=>Pi(ji(e),t),validateResult:(e,t)=>Pi(Ai(e),t),validateNotification:(e,t)=>Pi(Mi(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Fi,validateInputResponse:()=>Fi,samplingResultVariant:((e,t)=>{let n=gi();return Pi(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=di(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&_i(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Ni(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Li(e)}}return{kind:`complete`,result:Li(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Ii(e))?t:{...t,tools:n.map(e=>Ii(e)?{...e,outputSchema:xi(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function zi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=j([x(),E().int()]),a=D([`user`,`assistant`]),o=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=T({ttl:E().optional()}),l=T({taskId:x()}),u=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=T({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=T({_meta:u.optional()}),m=T({method:x(),params:p.loose().optional()}),g=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),_=T({icons:O(g).optional()}),v=T({name:x(),title:x().optional()}),b=v.extend({...v.shape,..._.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),S=se(T({applyDefaults:A().optional()}),t),C=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:S.optional(),url:t.optional()}),t.optional())),te=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),ne=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),re=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:C.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:te.optional(),extensions:M(x(),t).optional()}),ie=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ne.optional(),extensions:M(x(),t).optional()}),oe=T({progress:E(),total:y(E()),message:y(x())}),le=T({...p.shape,...oe.shape,progressToken:n}),ue=m.extend({method:w(`notifications/progress`),params:le}),de=p.extend({level:o,logger:x().optional(),data:h()}),fe=m.extend({method:w(`notifications/message`),params:de}),me=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),he=me.extend({text:x()}),N=me.extend({blob:s}),P=T({audience:O(a).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),ge=T({...v.shape,..._.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:P.optional(),_meta:y(k({}))}),_e=T({...v.shape,..._.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:P.optional(),_meta:y(k({}))}),ve=m.extend({method:w(`notifications/resources/list_changed`),params:p.optional()}),ye=p.extend({uri:x()}),be=m.extend({method:w(`notifications/resources/updated`),params:ye}),F=T({name:x(),description:y(x()),required:y(A())}),xe=T({...v.shape,..._.shape,description:y(x()),arguments:y(O(F)),_meta:y(k({}))}),Se=m.extend({method:w(`notifications/prompts/list_changed`),params:p.optional()}),Ce=T({type:w(`text`),text:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),we=T({type:w(`image`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Te=T({type:w(`audio`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Ee=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),De=T({type:w(`resource`),resource:j([he,N]),annotations:P.optional(),_meta:M(x(),h()).optional()}),Oe=ge.extend({type:w(`resource_link`)}),ke=j([Ce,we,Te,Oe,De]),Ae=T({role:a,content:ke}),je=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),Me=m.extend({method:w(`notifications/tools/list_changed`),params:p.optional()}),Ne=T({name:x().optional()}),Pe=T({hints:O(Ne).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),ze=T({mode:D([`auto`,`required`,`none`]).optional()}),Ve=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),I=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),He=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Ue=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),We=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ge=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Ke=j([Ue,We]),qe=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),L=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Je=j([qe,L]),R=j([Ge,Ke,Je]),z=j([R,Ve,I,He]),B=f.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),z),required:O(x()).optional()}).catchall(h())}),Ye=T({type:w(`ref/resource`),uri:x()}),V=T({type:w(`ref/prompt`),name:x()}),Xe=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Ze=re.shape,Qe=T({experimental:Ze.experimental,sampling:Ze.sampling,elicitation:Ze.elicitation,roots:Ze.roots,extensions:Ze.extensions}),$e=ie.shape,et=T({experimental:$e.experimental,logging:$e.logging,completions:$e.completions,prompts:$e.prompts,resources:$e.resources,tools:$e.tools,extensions:$e.extensions}),tt=k({progressToken:n.optional(),[Fe]:x(),[Ie]:b.optional(),[Re]:Qe,[Be]:o.optional()}),nt=T({...v.shape,..._.shape,description:x().optional(),inputSchema:k({$schema:x().optional(),type:w(`object`)}),outputSchema:k({$schema:x().optional()}).optional(),annotations:je.optional(),_meta:M(x(),h()).optional()}),rt=T({type:w(`tool_result`),toolUseId:x(),content:O(ke),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),it=j([Ce,we,Te,Ee,rt]),at=T({role:a,content:j([it,O(it)]),_meta:M(x(),h()).optional()}),ot=x(),st=k({[Le]:b.optional().catch(void 0)}),ct=st.optional();function H(e){return k({_meta:ct,resultType:ot.default(`complete`),...e})}let lt=H({}),ut=H({nextCursor:r.optional()}),dt=H({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),ft=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),pt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),mt=H({description:x().optional(),messages:O(Ae)}),ht=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),gt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),_t=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),vt=H({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),yt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`])}),bt=H({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),xt=T({messages:O(at),modelPreferences:Pe.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(nt).optional(),toolChoice:ze.optional()}),St=T({method:w(`sampling/createMessage`),params:xt}),Ct=T({method:w(`roots/list`),params:T({_meta:M(x(),h()).optional()}).optional()}),wt=T({...at.shape,model:x(),stopReason:x().optional()}),Tt=T({roots:O(Xe)}),Et=T({action:D([`accept`,`decline`,`cancel`]),content:M(x(),j([x(),E(),A(),O(x())])).optional()}),Dt=T({mode:w(`url`),message:x(),url:x().url()}),Ot=j([B,Dt]),kt=T({method:w(`elicitation/create`),params:Ot}),At=j([St,Ct,kt]),jt=j([wt,Tt,Et]),Mt=M(x(),At),Nt=M(x(),jt),Pt=H({inputRequests:Mt.optional(),requestState:x().optional()}),Ft={inputResponses:Nt.optional(),requestState:x().optional()},It=T({_meta:tt,...Ft}),Lt=k({progressToken:n.optional()});function U(e,t){return T({method:w(e),params:T({_meta:tt,...t})})}function W(e,t){return T({method:w(e),params:T({_meta:Lt.optional(),...t}).optional()})}let Rt={name:x(),arguments:M(x(),h()).optional(),...Ft},zt={cursor:r.optional()},Bt=U(`tools/call`,Rt),Vt=U(`tools/list`,zt),Ht=U(`prompts/list`,zt),Ut=U(`prompts/get`,{name:x(),arguments:M(x(),x()).optional(),...Ft}),Wt=U(`resources/list`,zt),Gt=U(`resources/templates/list`,zt),Kt=U(`resources/read`,{uri:x(),...Ft}),qt={ref:j([V,Ye]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()},Jt=U(`completion/complete`,qt),Yt=U(`server/discover`,{}),Xt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Zt={notifications:Xt},Qt=U(`subscriptions/listen`,Zt),$t=st.extend({"io.modelcontextprotocol/subscriptionId":i}),en=k({_meta:$t,resultType:ot.default(`complete`)}),tn={"tools/call":W(`tools/call`,Rt),"tools/list":W(`tools/list`,zt),"prompts/get":W(`prompts/get`,{name:x(),arguments:M(x(),x()).optional()}),"prompts/list":W(`prompts/list`,zt),"resources/list":W(`resources/list`,zt),"resources/templates/list":W(`resources/templates/list`,zt),"resources/read":W(`resources/read`,{uri:x()}),"completion/complete":W(`completion/complete`,qt),"server/discover":W(`server/discover`,{}),"subscriptions/listen":W(`subscriptions/listen`,Zt)};function G(e){return k({_meta:ct,...e})}let nn={"tools/call":G({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),"tools/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),"prompts/get":G({description:x().optional(),messages:O(Ae)}),"prompts/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),"resources/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),"resources/templates/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),"resources/read":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),"completion/complete":G({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),"server/discover":G({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),"subscriptions/listen":G({})},rn=k({"io.modelcontextprotocol/subscriptionId":i.optional()}),an=T({method:w(`notifications/subscriptions/acknowledged`),params:T({_meta:rn.optional(),notifications:Xt})}),on=T({_meta:rn.optional(),requestId:i,reason:x().optional()}),sn=T({method:w(`notifications/cancelled`),params:on}),cn={"notifications/cancelled":sn,"notifications/progress":ue,"notifications/message":fe,"notifications/resources/updated":be,"notifications/resources/list_changed":ve,"notifications/tools/list_changed":Me,"notifications/prompts/list_changed":Se,"notifications/subscriptions/acknowledged":an},K=e=>T({jsonrpc:w(`2.0`),id:j([x(),E().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:g,IconsSchema:_,BaseMetadataSchema:v,ImplementationSchema:b,ClientTasksCapabilitySchema:te,ServerTasksCapabilitySchema:ne,ClientCapabilitiesSchema:re,ServerCapabilitiesSchema:ie,ProgressSchema:oe,ProgressNotificationParamsSchema:le,ProgressNotificationSchema:ue,LoggingMessageNotificationParamsSchema:de,LoggingMessageNotificationSchema:fe,ResourceContentsSchema:me,TextResourceContentsSchema:he,BlobResourceContentsSchema:N,AnnotationsSchema:P,ResourceSchema:ge,ResourceTemplateSchema:_e,ResourceListChangedNotificationSchema:ve,ResourceUpdatedNotificationParamsSchema:ye,ResourceUpdatedNotificationSchema:be,PromptArgumentSchema:F,PromptSchema:xe,PromptListChangedNotificationSchema:Se,TextContentSchema:Ce,ImageContentSchema:we,AudioContentSchema:Te,ToolUseContentSchema:Ee,EmbeddedResourceSchema:De,ResourceLinkSchema:Oe,ContentBlockSchema:ke,PromptMessageSchema:Ae,ToolAnnotationsSchema:je,ToolListChangedNotificationSchema:Me,ModelHintSchema:Ne,ModelPreferencesSchema:Pe,ToolChoiceSchema:ze,BooleanSchemaSchema:Ve,StringSchemaSchema:I,NumberSchemaSchema:He,UntitledSingleSelectEnumSchemaSchema:Ue,TitledSingleSelectEnumSchemaSchema:We,LegacyTitledEnumSchemaSchema:Ge,SingleSelectEnumSchemaSchema:Ke,UntitledMultiSelectEnumSchemaSchema:qe,TitledMultiSelectEnumSchemaSchema:L,MultiSelectEnumSchemaSchema:Je,EnumSchemaSchema:R,PrimitiveSchemaDefinitionSchema:z,ElicitRequestFormParamsSchema:B,ResourceTemplateReferenceSchema:Ye,PromptReferenceSchema:V,RootSchema:Xe,ClientCapabilities2026Schema:Qe,ServerCapabilities2026Schema:et,RequestMetaEnvelopeSchema:tt,ToolSchema:nt,ToolResultContentSchema:rt,SamplingMessageContentBlockSchema:it,SamplingMessageSchema:at,ResultTypeSchema:ot,ResultMetaSchema:st,ResultSchema:lt,PaginatedResultSchema:ut,CallToolResultSchema:dt,ListToolsResultSchema:ft,ListPromptsResultSchema:pt,GetPromptResultSchema:mt,ListResourcesResultSchema:ht,ListResourceTemplatesResultSchema:gt,ReadResourceResultSchema:_t,CompleteResultSchema:vt,CacheableResultSchema:yt,DiscoverResultSchema:bt,CreateMessageRequestParamsSchema:xt,CreateMessageRequestSchema:St,ListRootsRequestSchema:Ct,CreateMessageResultSchema:wt,ListRootsResultSchema:Tt,ElicitResultSchema:Et,ElicitRequestURLParamsSchema:Dt,ElicitRequestParamsSchema:Ot,ElicitRequestSchema:kt,InputRequestSchema:At,InputResponseSchema:jt,InputRequestsSchema:Mt,InputResponsesSchema:Nt,InputRequiredResultSchema:Pt,InputResponseRequestParamsSchema:It,CallToolRequestSchema:Bt,ListToolsRequestSchema:Vt,ListPromptsRequestSchema:Ht,GetPromptRequestSchema:Ut,ListResourcesRequestSchema:Wt,ListResourceTemplatesRequestSchema:Gt,ReadResourceRequestSchema:Kt,CompleteRequestSchema:Jt,DiscoverRequestSchema:Yt,SubscriptionFilterSchema:Xt,SubscriptionsListenRequestSchema:Qt,SubscriptionsListenResultMetaSchema:$t,SubscriptionsListenResultSchema:en,dispatchRequestSchemas:tn,dispatchResultSchemas:nn,NotificationMetaSchema:rn,SubscriptionsAcknowledgedNotificationSchema:an,CancelledNotificationParamsSchema:on,CancelledNotificationSchema:sn,notificationSchemas2026:cn,JSONRPCResultResponseSchema:K(lt),CallToolResultResponseSchema:K(j([dt,Pt])),ListToolsResultResponseSchema:K(ft),ListPromptsResultResponseSchema:K(pt),GetPromptResultResponseSchema:K(j([mt,Pt])),ListResourcesResultResponseSchema:K(ht),ListResourceTemplatesResultResponseSchema:K(gt),ReadResourceResultResponseSchema:K(j([_t,Pt])),CompleteResultResponseSchema:K(vt),DiscoverResultResponseSchema:K(bt),SubscriptionsListenResultResponseSchema:K(en)}}var Bi;function Vi(){return Bi??=zi()}var Hi=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Ui(e){return Hi.includes(e)}var Wi=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Gi(e){return e[Wi]}function Ki(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function qi(e){return e===`public`||e===`private`}var X=function(e){return 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.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),Z=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Qr(this,new.target)}static fromError(t,n,r){if(t===X.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Yi(e.elicitations,n)}if(t===X.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Xi({supported:e.supported,requested:e.requested},n)}if(t===X.InvalidParams||t===X.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===X.ResourceNotFound||Object.keys(e).length===1))return new Ji(e.uri,n)}if(t===X.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Zi({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Ji=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(X.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Yi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(X.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Xi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(X.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Zi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(X.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Qi=0,$i=`private`,ea=[`tools/call`,`prompts/get`,`resources/read`];function ta(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||ea.includes(e))return t;throw new Z(X.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function na(e,t){let n=Gi(t);if(t.resultType!==`complete`||!Ui(e))return n===void 0?t:sa(t);let r=t,i=Ki(r.ttlMs)?r.ttlMs:aa(n),a=qi(r.cacheScope)?r.cacheScope:oa(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Wi],o}function ra(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ia(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Le]:t}}:!ra(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Le]:t}}}function aa(e){return e!==void 0&&Ki(e.ttlMs)?e.ttlMs:Qi}function oa(e){return e!==void 0&&qi(e.cacheScope)?e.cacheScope:$i}function sa(e){let t={...e};return delete t[Wi],t}var ca=[`elicitation/create`,`sampling/createMessage`,`roots/list`],la;function ua(){if(la)return la;let e=Vi();return la={request:{"elicitation/create":T({method:w(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":T({method:w(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":T({method:w(`roots/list`),params:k({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},la}function da(e){return ca.includes(e)}function fa(e){return da(e)?ua().request[e]:void 0}function pa(e){return da(e)?ua().response[e]:void 0}var ma={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},ha={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function ga(e){return Object.prototype.hasOwnProperty.call(ma,e)}function _a(e){return Object.prototype.hasOwnProperty.call(ha,e)}function va(e){return Object.prototype.hasOwnProperty.call(ma,e)}function ya(e){return ga(e)?Vi().dispatchRequestSchemas[e]:void 0}function ba(e){return va(e)?Vi().dispatchResultSchemas[e]:void 0}function xa(e){return _a(e)?Vi().notificationSchemas2026[e]:void 0}Object.keys(ma),Object.keys(ha);function Sa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ca(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var wa={ok:!1,reason:`not-in-era`},Ta=[Fe,Re];function Ea(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Sa(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Sa(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Sa(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Da={era:`2026-07-28`,hasRequestMethod:ga,hasNotificationMethod:_a,hasInputRequestMethod:e=>fa(e)!==void 0,validateRequest:(e,t)=>Ca(ya(e),t),validateResult:(e,t)=>Ca(ba(e),t),validateNotification:(e,t)=>Ca(xa(e),t),validateInputRequest:(e,t)=>Ca(fa(e),t),validateInputResponse:(e,t)=>Ca(pa(e),t),samplingResultVariant:()=>wa,outboundEnvelope(e){return{[Fe]:e.protocolVersion,[Ie]:e.clientInfo,[Re]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Ta)n in e||t.push({key:n,problem:`missing`});let n=Vi().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>di(e),inputRequestSchema:fa,decodeResult(e,t){if(!Sa(t))return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Sa(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:Vi().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new Y(J.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=ka(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return ia(na(e,ta(e,Ea(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=Vi().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},Oa;function ka(){if(Oa)return Oa;let e=Vi();return Oa={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Oa}var Aa=`2026-07-28`;function ja(e){return e!==void 0&&ci(e)?Da:Ri}function Ma(e){return e.revision===void 0?e.era===`modern`?Da.era:Ri.era:ja(e.revision).era}function Na(e){return Ia.some(t=>t.hasRequestMethod(e))}function Pa(e){return Ia.some(t=>t.hasNotificationMethod(e))}function Fa(e){return e===`tasks/get`||e===`tasks/cancel`}var Ia=[Ri,Da],La=Ce({AnnotationsSchema:()=>Nt,AudioContentSchema:()=>ln,BaseMetadataSchema:()=>ct,BaseRequestParamsSchema:()=>L,BlobResourceContentsSchema:()=>jt,BooleanSchemaSchema:()=>Wn,CallToolRequestParamsSchema:()=>wn,CallToolRequestSchema:()=>Tn,CallToolResultSchema:()=>Sn,CancelTaskRequestSchema:()=>Ar,CancelTaskResultSchema:()=>jr,CancelledNotificationParamsSchema:()=>it,CancelledNotificationSchema:()=>at,ClientCapabilitiesSchema:()=>pt,ClientNotificationSchema:()=>Nr,ClientRequestSchema:()=>Mr,ClientResultSchema:()=>Pr,ClientTasksCapabilitySchema:()=>dt,CompatibilityCallToolResultSchema:()=>Cn,CompleteRequestParamsSchema:()=>dr,CompleteRequestSchema:()=>fr,CompleteResultSchema:()=>pr,ContentBlockSchema:()=>pn,CreateMessageRequestParamsSchema:()=>Bn,CreateMessageRequestSchema:()=>Vn,CreateMessageResultSchema:()=>Hn,CreateMessageResultWithToolsSchema:()=>Un,CreateTaskResultSchema:()=>xr,CursorSchema:()=>We,DiscoverRequestSchema:()=>yt,DiscoverResultSchema:()=>bt,ElicitRequestFormParamsSchema:()=>nr,ElicitRequestParamsSchema:()=>ir,ElicitRequestSchema:()=>ar,ElicitRequestURLParamsSchema:()=>rr,ElicitResultSchema:()=>cr,ElicitationCompleteNotificationParamsSchema:()=>or,ElicitationCompleteNotificationSchema:()=>sr,EmbeddedResourceSchema:()=>dn,EmptyResultSchema:()=>rt,EnumSchemaSchema:()=>er,GetPromptRequestParamsSchema:()=>on,GetPromptRequestSchema:()=>sn,GetPromptResultSchema:()=>hn,GetTaskPayloadRequestSchema:()=>Er,GetTaskPayloadResultSchema:()=>Dr,GetTaskRequestSchema:()=>wr,GetTaskResultSchema:()=>Tr,IconSchema:()=>ot,IconsSchema:()=>st,ImageContentSchema:()=>K,ImplementationSchema:()=>H,InitializeRequestParamsSchema:()=>mt,InitializeRequestSchema:()=>ht,InitializeResultSchema:()=>_t,InitializedNotificationSchema:()=>vt,JSONArraySchema:()=>He,JSONObjectSchema:()=>I,JSONRPCErrorResponseSchema:()=>et,JSONRPCMessageSchema:()=>tt,JSONRPCNotificationSchema:()=>Qe,JSONRPCRequestSchema:()=>Ze,JSONRPCResponseSchema:()=>nt,JSONRPCResultResponseSchema:()=>$e,JSONValueSchema:()=>Ve,LegacyTitledEnumSchemaSchema:()=>Yn,ListChangedOptionsBaseSchema:()=>Dn,ListPromptsRequestSchema:()=>rn,ListPromptsResultSchema:()=>an,ListResourceTemplatesRequestSchema:()=>U,ListResourceTemplatesResultSchema:()=>W,ListResourcesRequestSchema:()=>It,ListResourcesResultSchema:()=>Lt,ListRootsRequestSchema:()=>hr,ListRootsResultSchema:()=>gr,ListTasksRequestSchema:()=>Or,ListTasksResultSchema:()=>kr,ListToolsRequestSchema:()=>bn,ListToolsResultSchema:()=>xn,LoggingLevelSchema:()=>On,LoggingMessageNotificationParamsSchema:()=>jn,LoggingMessageNotificationSchema:()=>Mn,ModelHintSchema:()=>Nn,ModelPreferencesSchema:()=>Pn,MultiSelectEnumSchemaSchema:()=>$n,NotificationSchema:()=>B,NotificationsParamsSchema:()=>z,NumberSchemaSchema:()=>Kn,PaginatedRequestParamsSchema:()=>Tt,PaginatedRequestSchema:()=>Et,PaginatedResultSchema:()=>Dt,PingRequestSchema:()=>xt,PrimitiveSchemaDefinitionSchema:()=>tr,ProgressNotificationParamsSchema:()=>Ct,ProgressNotificationSchema:()=>wt,ProgressSchema:()=>St,ProgressTokenSchema:()=>Ue,PromptArgumentSchema:()=>G,PromptListChangedNotificationSchema:()=>gn,PromptMessageSchema:()=>mn,PromptReferenceSchema:()=>ur,PromptSchema:()=>nn,ReadResourceRequestParamsSchema:()=>zt,ReadResourceRequestSchema:()=>Bt,ReadResourceResultSchema:()=>Vt,RelatedTaskMetadataSchema:()=>Ke,RequestIdSchema:()=>Xe,RequestMetaSchema:()=>qe,RequestSchema:()=>R,ResourceContentsSchema:()=>Ot,ResourceLinkSchema:()=>fn,ResourceListChangedNotificationSchema:()=>Ht,ResourceRequestParamsSchema:()=>Rt,ResourceSchema:()=>Pt,ResourceTemplateReferenceSchema:()=>lr,ResourceTemplateSchema:()=>Ft,ResourceUpdatedNotificationParamsSchema:()=>en,ResourceUpdatedNotificationSchema:()=>tn,ResultMetaObjectSchema:()=>Ye,ResultSchema:()=>V,RoleSchema:()=>Mt,RootSchema:()=>mr,RootsListChangedNotificationSchema:()=>_r,SamplingContentSchema:()=>Ln,SamplingMessageContentBlockSchema:()=>Rn,SamplingMessageSchema:()=>zn,ServerCapabilitiesSchema:()=>gt,ServerNotificationSchema:()=>Ir,ServerRequestSchema:()=>Fr,ServerResultSchema:()=>Lr,ServerTasksCapabilitySchema:()=>ft,SetLevelRequestParamsSchema:()=>kn,SetLevelRequestSchema:()=>An,SingleSelectEnumSchemaSchema:()=>Xn,StringSchemaSchema:()=>Gn,SubscribeRequestParamsSchema:()=>Ut,SubscribeRequestSchema:()=>Wt,SubscriptionFilterSchema:()=>qt,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Xt,SubscriptionsAcknowledgedNotificationSchema:()=>Zt,SubscriptionsListenRequestParamsSchema:()=>Jt,SubscriptionsListenRequestSchema:()=>Yt,SubscriptionsListenResultMetaSchema:()=>Qt,SubscriptionsListenResultSchema:()=>$t,TaskAugmentedRequestParamsSchema:()=>Je,TaskCreationParamsSchema:()=>vr,TaskMetadataSchema:()=>Ge,TaskSchema:()=>br,TaskStatusNotificationParamsSchema:()=>Sr,TaskStatusNotificationSchema:()=>Cr,TaskStatusSchema:()=>yr,TextContentSchema:()=>cn,TextResourceContentsSchema:()=>kt,TitledMultiSelectEnumSchemaSchema:()=>Qn,TitledSingleSelectEnumSchemaSchema:()=>Jn,ToolAnnotationsSchema:()=>_n,ToolChoiceSchema:()=>Fn,ToolExecutionSchema:()=>vn,ToolListChangedNotificationSchema:()=>En,ToolResultContentSchema:()=>In,ToolSchema:()=>yn,ToolUseContentSchema:()=>un,UnsubscribeRequestParamsSchema:()=>Gt,UnsubscribeRequestSchema:()=>Kt,UntitledMultiSelectEnumSchemaSchema:()=>Zn,UntitledSingleSelectEnumSchemaSchema:()=>qn}),Ra=e=>Ze.safeParse(e).success,za=e=>Qe.safeParse(e).success,Ba=e=>$e.safeParse(e).success,Va=e=>et.safeParse(e).success,Ha=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`,Ua=e=>ht.safeParse(e).success,Wa=e=>vt.safeParse(e).success,Ga=`Mcp-Param-`,Ka=`x-mcp-header`,qa=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Ja=new Set([`string`,`integer`,`boolean`,`number`]);function Ya(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(Ka in o){if(!a||i.length===0)return`${Qa(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let e=o[Ka];if(typeof e!=`string`||e.length===0)return`${Qa(i)}: x-mcp-header MUST be a non-empty string`;if(!qa.test(e))return`${Qa(i)}: x-mcp-header '${e}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let r=typeof o.type==`string`?o.type:void 0;if(r===void 0||!Ja.has(r))return`${Qa(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${r??``}`;let s=e.toLowerCase(),c=n.get(s);if(c!==void 0)return`x-mcp-header '${e}' is not case-insensitively unique (also declared as '${c}')`;n.set(s,e),t.push({path:i,headerName:e,type:r})}let s=o.properties;if(typeof s==`object`&&s)for(let[e,t]of Object.entries(s)){let n=r(t,[...i,e],a);if(n!==void 0)return n}for(let e of Xa){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&Za.has(e)?Object.values(t):[t];for(let t of n){let n=r(t,[...i,`<${e}>`],!1);if(n!==void 0)return n}}},i=r(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}var Xa=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],Za=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function Qa(e){return e.length===0?``:e.join(`.`)}var $a=`=?base64?`,eo=`?=`;function to(e){if(typeof e==`string`)return e;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function no(e){if(e.length===0||e.startsWith($a)&&e.endsWith(eo)||e!==e.trim())return!0;for(let t=0;t=32&&n<=126))return!0}return!1}function ro(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCodePoint(e);return btoa(n)}function io(e){return no(e)?`${$a}${ro(e)}${eo}`:e}function ao(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function oo(e,t){let n={};for(let r of e){let e=ao(t,r.path);if(e==null)continue;let i=to(e);i!==void 0&&(n[`${Ga}${r.headerName}`]=io(i))}return n}X.InvalidRequest,X.UnsupportedProtocolVersion,X.InvalidParams,X.MethodNotFound,X.InvalidParams,X.MissingRequiredClientCapability,X.ParseError,X.InvalidRequest,X.MethodNotFound,X.UnsupportedProtocolVersion,X.MissingRequiredClientCapability;var so={"tools/call":`name`,"prompts/get":`name`,"resources/read":`uri`,"tasks/get":`taskId`,"tasks/update":`taskId`,"tasks/cancel":`taskId`};function co(e,t){let n=Object.hasOwn(so,e)?so[e]:void 0;if(n===void 0)return;let r=lo(t)?t[n]:void 0;return{field:n,value:typeof r==`string`?r:void 0}}function lo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uo(e,t){return le(e,t)}function fo(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function po(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var mo=!1,ho=`draft-2020-12`;function go(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:ho});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);mo||(mo=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=g(e,{target:ho,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&_o(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function _o(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||_o(e)))}return!1}function vo(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function yo(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>vo(e)).join(`, `)}:{success:!0,data:n.value}}function bo(e){let t=g(e,{target:ho,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var xo=/\\\.\\d\{(\d+)\}/;function So(e){let t=xo.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>pe({local:e,offset:t,precision:n}))))}function Co(e,t){let n;switch(e){case`email`:n=[re()];break;case`uri`:n=[d()];break;case`date`:n=[me()];break;case`date-time`:n=So(t)}return new Set(n.map(e=>bo(e)).filter(e=>e!==void 0))}function wo(e,t,n){return n!==`zod`||Co(e,t).has(t)}function To(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Eo(e){try{return go(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Z(X.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Do=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Oo(e){return Do.has(e)||e.startsWith(`x-`)}var ko=new Set([`$schema`,...Object.keys(nr.shape.requestedSchema.shape)]),Ao={string:fo([Gn,qn,Jn,Yn]),number:fo([Kn]),integer:fo([Kn]),boolean:fo([Wn]),array:fo([Zn,Qn])},jo=new Set(Gn.shape.format.unwrap().options);function Mo(e,t,n,r){if(!To(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Ao,e.type)?Ao[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Oo(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?jo.has(e.format)?(typeof s!=`string`||!wo(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function No(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&To(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Mo(n,`properties.${e}`,t,r)])):ko.has(i)?n[i]=a:Oo(i)||r.push(i);if(r.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Po(e,t){if(!To(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!uo(tr,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Fo(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Fo(e,t[r],`${n}[${r}]`)):!To(e)||!To(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Fo(r,t[e],i):Oo(e)?[]:[i]})}function Io(e){if(!po(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=No(Eo(e.requestedSchema),t),r=uo(nr.shape.requestedSchema,n);if(!r.success)throw new Z(X.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Po(n,r.error.message)}`);let i=Fo(n,r.data);if(i.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Lo(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(Lo,{elicit(e){try{return{method:`elicitation/create`,params:Io(e)}}catch(e){throw e instanceof Z?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var Ro=!0,zo=10,Bo=250;function Vo(e){return{autoFulfill:e?.autoFulfill??Ro,maxRounds:e?.maxRounds??zo}}function Ho(e,t,n){let r=t!==void 0&&Object.keys(t).length>0;return!r&&n===void 0?e:{...e,...r&&{inputResponses:t},...n!==void 0&&{requestState:n}}}function Uo(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Wo(e,t){return new Promise((n,r)=>{if(t?.aborted){r(t.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t.reason)));return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(t?.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t?.reason)))};t?.addEventListener(`abort`,a,{once:!0})})}function Go(e){let t=new AbortController,n=()=>t.abort(e?.reason);return e?.addEventListener(`abort`,n,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener(`abort`,n)}}async function Ko(e){let{config:t,method:n,originalParams:r,requestOptions:i,hooks:a,signal:o}=e,s=e.flowStartedAt??Date.now(),c=e.firstPayload,l=0;for(;;){if(l+=1,l>t.maxRounds)throw new Y(J.InputRequiredRoundsExceeded,Uo(n,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:c.inputRequests,...c.requestState!==void 0&&{requestState:c.requestState}}});i.onprogress?.({progress:l,message:`Fulfilling input required by '${n}' (round ${l})`});let e=Object.entries(c.inputRequests??{}),u;if(e.length>0){let t=Go(o);try{let n=await Promise.all(e.map(async([e,n])=>{try{return[e,await a.dispatchInputRequest(e,n,t.signal)]}catch(e){throw t.abort(e),e}}));u=Object.fromEntries(n)}finally{t.dispose()}}else await Wo(Bo,o);let d={...i.timeout!==void 0&&{timeout:i.timeout}};if(i.maxTotalTimeout!==void 0){let e=Date.now()-s,t=i.maxTotalTimeout-e;if(t<=0)throw new Y(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:e});d.maxTotalTimeout=t}let f=await a.retry(Ho(r,u,c.requestState),d);if(Ha(f)){c={inputRequests:f.inputRequests??{},...f.requestState!==void 0&&{requestState:f.requestState}};continue}return f}}var qo=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Jo={IdJagTokenExchangeResponseSchema:Ur,OAuthClientInformationFullSchema:Jr,OAuthClientInformationSchema:qr,OAuthClientMetadataSchema:Kr,OAuthClientRegistrationErrorSchema:Yr,OAuthErrorResponseSchema:Wr,OAuthMetadataSchema:zr,OAuthProtectedResourceMetadataSchema:Rr,OAuthTokenRevocationRequestSchema:Xr,OAuthTokensSchema:Hr,OpenIdProviderDiscoveryMetadataSchema:Vr,OpenIdProviderMetadataSchema:Br},Yo={},Xo={};function Zo(e,t){let n=e.slice(0,-6);Yo[n]=t,Xo[n]=e=>t.safeParse(e).success}for(let e of qo)Zo(e,La[e]);for(let[e,t]of Object.entries(Jo))Zo(e,t);Object.freeze(Yo);var Qo=Object.freeze(Xo);function $o(e){switch(e){case`initialize`:case`notifications/initialized`:return ja(void 0);case`server/discover`:return ja(Aa);default:return}}var es=[Fe,Ie,Re,Be],ts=[`inputResponses`,`requestState`];function ns(e,t){let n=e.params;if(!ss(n))return{message:e,lifted:{}};let r=n._meta,i=ss(r)?es.filter(e=>e in r):[],a=t===`request`?ts.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&ss(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function rs(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function is(e){return()=>e}var as=is(void 0),os=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Ne,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Y(J.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&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),new Y(J.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){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{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),Ba(e)||Va(e)?this._onresponse(e):Ra(e)?this._onrequest(e,t):za(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new Y(J.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=ns(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(Pa(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=ns(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(X.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(Na(n.method)&&!i.hasRequestMethod(n.method)&&!(Fa(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(X.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(X.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(X.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:us(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?as:is(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),po(t))return u(e,t,n);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(X.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:X.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.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._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Ba(e)?n(e):n(Z.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(po(t))return Fa(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return ja(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=$o(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Na(t)&&!e.hasRequestMethod(t))throw new Y(J.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof Y?e:new Y(J.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof Y?e:new Y(J.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(gs(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;yo(n,o).then(e=>{e.success?d(e.data):f(new Y(J.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new Y(J.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new Y(J.NotConnected,`Not connected`);if(Pa(t.method)&&!e.hasNotificationMethod(t.method))throw new Y(J.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!Na(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await yo(t.params,{...r.params});if(!a.success)throw new Z(X.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.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,n){if(typeof t==`function`){if(!Pa(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await yo(t.params,{...r.params});if(!i.success)throw new Z(X.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ss(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cs(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];n[r]=ss(a)&&ss(i)?{...a,...i}:i}return n}function ls(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function us(e){let t={},n=[];if(!ls(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!ls(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function ds(e){throw new Y(J.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function fs(e,t,n,r,i){return{sessionId:i,mcpReq:{id:e,method:t,_meta:n?._meta,requestState:is(void 0),signal:r,send:(()=>ds(`send`)),notify:()=>ds(`notify`)}}}async function ps(e,t,n,r,i){if(!ls(r)||typeof r.method!=`string`)throw new Y(J.InvalidResult,`Invalid input request '${n}': each inputRequests entry must be an embedded request object with a method`,{key:n});let a=r.method;if(!t.hasInputRequestMethod(a))throw new Y(J.InvalidResult,`Invalid input request '${n}': '${a}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:n,method:a});let o=e.getRequestHandler(a);if(o===void 0)throw new Y(J.CapabilityNotSupported,`Cannot fulfil input request '${n}': no handler is registered for '${a}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:n,method:a});let s=ls(r.params)?r.params:void 0;return await o({jsonrpc:`2.0`,id:n,method:a,...s!==void 0&&{params:s}},e.buildContext(fs(n,a,s,i,e.sessionId)))}function ms(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function hs(e,t,n,r){let{codec:i,request:a,options:o,flowStartedAt:s}=r,c={inputRequests:n.inputRequests,...n.requestState!==void 0&&{requestState:n.requestState}},l={dispatchInputRequest:(t,n,r)=>ps(e,i,t,n,r),retry:(e,t)=>r.retry(e,ms(o,t))};return Ko({config:t,method:a.method,originalParams:a.params,firstPayload:c,flowStartedAt:s,signal:o?.signal,requestOptions:{...o?.timeout!==void 0&&{timeout:o.timeout},...o?.maxTotalTimeout!==void 0&&{maxTotalTimeout:o.maxTotalTimeout},...o?.onprogress!==void 0&&{onprogress:o.onprogress}},hooks:l})}function gs(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var _s=Te(Se((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),1);function vs(e){if(e)try{return _s.parse(e).type}catch{let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return t===``||e.slice(t.length).includes(`,`)?void 0:t}}function ys(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function bs(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...ys(t.headers),...ys(r.headers)}:t.headers}):e}var xs=new Set([301,302,303,307,308]),Ss=5;function Cs(e,t){return e.protocol===t.protocol&&e.host===t.host||e.protocol===`http:`&&t.protocol===`https:`&&e.hostname===t.hostname&&!e.port&&!t.port}function ws(e,t){let n=xs.has(t.status)?t.headers?.get(`location`):void 0;if(n)try{return new URL(n,e)}catch{return}}var Ts=new WeakSet;function Es(e){let t=(t,n)=>e(t,n);return Ts.add(t),t}function Ds(e){return Ts.has(e)?e:async(t,n)=>{if(n?.redirect===`error`||n?.redirect===`manual`)return e(t,n);let r=(n?.method??`GET`).toUpperCase(),i=t;for(let t=0;;t++){let a=await e(i,{...n,redirect:`manual`}),o=ws(i,a);if(!o||t===Ss)return a;let s=new URL(i),c=r===`GET`||a.status===307||a.status===308,l=!(o.username||o.password)||o.username===s.username&&o.password===s.password;if(!c||!l||!Cs(s,o))return a;await a.text?.().catch(()=>{}),i=o}}}function Os(e,t){if(t.type===`opaqueredirect`)return`Redirect not followed: this runtime does not expose where it points`;let n=ws(t.url||e,t);if(n)return n.username=n.password=n.search=n.hash=``,n.protocol===`http:`&&new URL(t.url||e).protocol===`https:`?(n.protocol=`https:`,`Redirect from https to plain http not followed; try ${n.href} as the endpoint`):`Redirect to ${n.href} not followed; use that URL as the endpoint if it is the intended server`}function ks(e,t){let n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r1?t[a.href]=e:(a.hash=``,r===``?n=a:Is(e,t,n))}}else if(e!==!0&&e!==!1)return t;let i=n.href+(r?`#`+r:``);if(t[i]!==void 0)throw Error(`Duplicate schema URI "${i}".`);if(t[i]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:i}),e.$ref&&e.__absolute_ref__===void 0){let t=new URL(e.$ref,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:t.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let t=new URL(e.$recursiveRef,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:t.href})}if(e.$anchor){let r=new URL(`#`+e.$anchor,n.href);t[r.href]=e}for(let i in e){if(Ps[i])continue;let a=`${r}/${As(i)}`,o=e[i];if(Array.isArray(o)){if(Ms[i]){let e=o.length;for(let r=0;r%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Us=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,Ws=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Gs=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ks=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,qs=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Js=e=>{if(e[0]===`"`)return!1;let[t,n,...r]=e.split(`@`);return!t||!n||r.length!==0||t.length>64||n.length>253||t[0]===`.`||t.endsWith(`.`)||t.includes(`..`)||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(`.`).every(e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e))},Ys=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Xs=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Zs=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Qs(e){return e.test.bind(e)}var $s={date:tc,time:nc.bind(void 0,!1),"date-time":ic,duration:Zs,uri:sc,"uri-reference":Qs(Vs),"uri-template":Qs(Hs),url:Qs(Us),email:Js,hostname:Qs(Bs),ipv4:Qs(Ys),ipv6:Qs(Xs),regex:lc,uuid:Qs(Ws),"json-pointer":Qs(Gs),"json-pointer-uri-fragment":Qs(Ks),"relative-json-pointer":Qs(qs)};function ec(e){return e%4==0&&(e%100!=0||e%400==0)}function tc(e){let t=e.match(Ls);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&ec(n)?29:Rs[r])}function nc(e,t){let n=t.match(zs);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}var rc=/t|\s/i;function ic(e){let t=e.split(rc);return t.length==2&&tc(t[0])&&nc(!0,t[1])}var ac=/\/|:/,oc=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function sc(e){return ac.test(e)&&oc.test(e)}var cc=/[^\\]\\Z/;function lc(e){if(cc.test(e))return!1;try{return new RegExp(e,`u`),!0}catch{return!1}}function uc(e){let t=0,n=e.length,r=0,i;for(;r=55296&&i<=56319&&rks(e,t))||F.push({instanceLocation:o,keyword:`enum`,keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(t=>e===t)||F.push({instanceLocation:o,keyword:`enum`,keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`})),v!==void 0){let t=`${s}/not`;Q(e,v,n,r,i,a,o,t).valid&&F.push({instanceLocation:o,keyword:`not`,keywordLocation:t,error:`Instance matched "not" schema.`})}let xe=[];if(y!==void 0){let t=`${s}/anyOf`,l=F.length,u=!1;for(let s=0;s{let u=Object.create(c),d=Q(e,s,n,r,i,p===!0?a:null,o,`${t}/${l}`,u);return F.push(...d.errors),d.valid&&xe.push(u),d.valid}).length;u===1?F.length=l:F.splice(l,0,{instanceLocation:o,keyword:`oneOf`,keywordLocation:t,error:`Instance does not match exactly one subschema (${u} matches).`})}if((u===`object`||u===`array`)&&Object.assign(c,...xe),S!==void 0){let t=`${s}/if`;if(Q(e,S,n,r,i,a,o,t,c).valid){if(ee!==void 0){let l=Q(e,ee,n,r,i,a,o,`${s}/then`,c);l.valid||F.push({instanceLocation:o,keyword:`if`,keywordLocation:t,error:`Instance does not match "then" schema.`},...l.errors)}}else if(C!==void 0){let l=Q(e,C,n,r,i,a,o,`${s}/else`,c);l.valid||F.push({instanceLocation:o,keyword:`if`,keywordLocation:t,error:`Instance does not match "else" schema.`},...l.errors)}}if(u===`object`){if(_!==void 0)for(let t of _)t in e||F.push({instanceLocation:o,keyword:`required`,keywordLocation:`${s}/required`,error:`Instance does not have required property "${t}".`});let t=Object.keys(e);if(re!==void 0&&t.lengthie&&F.push({instanceLocation:o,keyword:`maxProperties`,keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${ie} properties.`}),D!==void 0){let t=`${s}/propertyNames`;for(let s in e){let e=`${o}/${As(s)}`,c=Q(s,D,n,r,i,a,e,t);c.valid||F.push({instanceLocation:o,keyword:`propertyNames`,keywordLocation:t,error:`Property name "${s}" does not match schema.`},...c.errors)}}if(O!==void 0){let t=`${s}/dependantRequired`;for(let n in O)if(n in e){let r=O[n];for(let i of r)i in e||F.push({instanceLocation:o,keyword:`dependentRequired`,keywordLocation:t,error:`Instance has "${n}" but does not have "${i}".`})}}if(k!==void 0)for(let t in k){let l=`${s}/dependentSchemas`;if(t in e){let s=Q(e,k[t],n,r,i,a,o,`${l}/${As(t)}`,c);s.valid||F.push({instanceLocation:o,keyword:`dependentSchemas`,keywordLocation:l,error:`Instance has "${t}" but does not match dependant schema.`},...s.errors)}}if(ae!==void 0){let t=`${s}/dependencies`;for(let s in ae)if(s in e){let c=ae[s];if(Array.isArray(c))for(let n of c)n in e||F.push({instanceLocation:o,keyword:`dependencies`,keywordLocation:t,error:`Instance has "${s}" but does not have "${n}".`});else{let l=Q(e,c,n,r,i,a,o,`${t}/${As(s)}`);l.valid||F.push({instanceLocation:o,keyword:`dependencies`,keywordLocation:t,error:`Instance has "${s}" but does not match dependant schema.`},...l.errors)}}}let l=Object.create(null),u=!1;if(T!==void 0){let t=`${s}/properties`;for(let s in T){if(!(s in e))continue;let d=`${o}/${As(s)}`,f=Q(e[s],T[s],n,r,i,a,d,`${t}/${As(s)}`);if(f.valid)c[s]=l[s]=!0;else if(u=i,F.push({instanceLocation:o,keyword:`properties`,keywordLocation:t,error:`Property "${s}" does not match schema.`},...f.errors),u)break}}if(!u&&E!==void 0){let t=`${s}/patternProperties`;for(let s in E){let d=new RegExp(s,`u`),f=E[s];for(let p in e){if(!d.test(p))continue;let m=`${o}/${As(p)}`,h=Q(e[p],f,n,r,i,a,m,`${t}/${As(s)}`);h.valid?c[p]=l[p]=!0:(u=i,F.push({instanceLocation:o,keyword:`patternProperties`,keywordLocation:t,error:`Property "${p}" matches pattern "${s}" but does not match associated schema.`},...h.errors))}}}if(!u&&te!==void 0){let t=`${s}/additionalProperties`;for(let s in e){if(l[s])continue;let d=`${o}/${As(s)}`,f=Q(e[s],te,n,r,i,a,d,t);f.valid?c[s]=!0:(u=i,F.push({instanceLocation:o,keyword:`additionalProperties`,keywordLocation:t,error:`Property "${s}" does not match additional properties schema.`},...f.errors))}}else if(!u&&ne!==void 0){let t=`${s}/unevaluatedProperties`;for(let s in e)if(!c[s]){let l=`${o}/${As(s)}`,u=Q(e[s],ne,n,r,i,a,l,t);u.valid?c[s]=!0:F.push({instanceLocation:o,keyword:`unevaluatedProperties`,keywordLocation:t,error:`Property "${s}" does not match unevaluated properties schema.`},...u.errors)}}}else if(u===`array`){de!==void 0&&e.length>de&&F.push({instanceLocation:o,keyword:`maxItems`,keywordLocation:`${s}/maxItems`,error:`Array has too many items (${e.length} > ${de}).`}),ue!==void 0&&e.length=(j||0)&&(F.length=u),j===void 0&&M===void 0&&d===0?F.splice(u,0,{instanceLocation:o,keyword:`contains`,keywordLocation:l,error:`Array does not contain item matching schema.`}):j!==void 0&&dM&&F.push({instanceLocation:o,keyword:`maxContains`,keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${M} items matching schema. ${d} items were found.`})}}if(!u&&ce!==void 0){let u=`${s}/unevaluatedItems`;for(;l=me||e>me)&&F.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${N?`or equal to `:``} ${me}.`})):(pe!==void 0&&eme&&F.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${me}.`}),he!==void 0&&e<=he&&F.push({instanceLocation:o,keyword:`exclusiveMinimum`,keywordLocation:`${s}/exclusiveMinimum`,error:`${e} is less than ${he}.`}),N!==void 0&&e>=N&&F.push({instanceLocation:o,keyword:`exclusiveMaximum`,keywordLocation:`${s}/exclusiveMaximum`,error:`${e} is greater than or equal to ${N}.`})),P!==void 0){let t=e%P;Math.abs(0-t)>=1.1920929e-7&&Math.abs(P-t)>=1.1920929e-7&&F.push({instanceLocation:o,keyword:`multipleOf`,keywordLocation:`${s}/multipleOf`,error:`${e} is not a multiple of ${P}.`})}}else if(u===`string`){let t=ge===void 0&&_e===void 0?0:uc(e);ge!==void 0&&t_e&&F.push({instanceLocation:o,keyword:`maxLength`,keywordLocation:`${s}/maxLength`,error:`String is too long (${t} > ${_e}).`}),ve!==void 0&&!new RegExp(ve,`u`).test(e)&&F.push({instanceLocation:o,keyword:`pattern`,keywordLocation:`${s}/pattern`,error:`String does not match pattern.`}),w!==void 0&&$s[w]&&!$s[w](e)&&F.push({instanceLocation:o,keyword:`format`,keywordLocation:`${s}/format`,error:`String does not match format "${w}".`})}return{valid:F.length===0,errors:F}}var dc=class{schema;draft;shortCircuit;lookup;constructor(e,t=`2019-09`,n=!0){this.schema=e,this.draft=t,this.shortCircuit=n,this.lookup=Is(e)}validate(e){return Q(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){t&&(e={...e,$id:t}),Is(e,this.lookup)}},fc=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=je(e,`pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.`);return t===`draft-7`?`7`:t}getValidator(e){let t=new dc(e,this.draft??this._draftFor(e),this.shortcircuit);return e=>{let n=t.validate(e);return n.valid?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:n.errors.map(e=>`${e.instanceLocation}: ${e.error}`).join(`; `)}}}},pc=globalThis.crypto;async function mc(e){return(await pc).getRandomValues(new Uint8Array(e))}async function hc(e){let t=``;for(;t.length128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await gc(e);return{code_verifier:t,code_challenge:await _c(t)}}var yc=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},bc=10,xc=13,Sc=32;function Cc(e){}function wc(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=Cc,onError:n=Cc,onRetry:r=Cc,onComment:i,maxBufferSize:a}=e,o=[],s=0,c=!0,l,u=``,d=0,f,p=!1;function m(e){if(p)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),o.length===0){let t=g(e);t!==``&&(o.push(t),s=t.length),h();return}if(e.indexOf(` `)===-1&&e.indexOf(`\r`)===-1){o.push(e),s+=e.length,h();return}o.push(e);let t=o.join(``);o.length=0,s=0;let n=g(t);n!==``&&(o.push(n),s=n.length),h()}function h(){a!==void 0&&(s+u.length<=a||(p=!0,o.length=0,s=0,l=void 0,u=``,d=0,f=void 0,n(new yc(`Buffered data exceeded max buffer size of ${a} characters`,{type:`max-buffer-size-exceeded`}))))}function g(e){let n=0;if(e.indexOf(`\r`)===-1){let r=e.indexOf(` `,n);for(;r!==-1;){if(n===r){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0,n=r+1,r=e.indexOf(` diff --git a/internal/ui/dist/assets/page-CFdV4uPH.js b/internal/ui/dist/assets/page-Bq8j74s4.js similarity index 99% rename from internal/ui/dist/assets/page-CFdV4uPH.js rename to internal/ui/dist/assets/page-Bq8j74s4.js index 864d22d48..03afec928 100644 --- a/internal/ui/dist/assets/page-CFdV4uPH.js +++ b/internal/ui/dist/assets/page-Bq8j74s4.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/panel-sql-editor-BFXSBGw8.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-CEp3GmPL.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-EHBQhIeL.js","assets/Tooltip-B3r3s_B9.js","assets/index-ADB9ThEc.css"])))=>i.map(i=>d[i]); -import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,D as s,E as c,K as l,M as u,O as d,P as f,Q as p,S as m,T as h,X as g,Y as _,Z as v,_ as y,_t as b,a as x,c as S,d as C,dt as w,f as T,ft as E,g as D,gt as O,h as k,j as A,k as j,lt as M,m as N,mt as P,nt as F,o as I,ot as L,p as ee,r as R,s as te,st as ne,tt as re,u as ie,ut as z,v as ae,x as B,y as oe}from"./brand-DUaZkIz1.js";import{c as se,l as ce,t as le}from"./preload-helper-EHBQhIeL.js";import{C as ue,E as de,b as fe,o as pe,t as me,w as he}from"./Tooltip-B3r3s_B9.js";import{a as ge,c as _e,d as ve,i as ye,l as be,n as xe,o as Se,r as Ce,s as we,t as Te,u as Ee}from"./dashboard-change-chips-DHVvGnTI.js";import{n as De,r as Oe,t as ke}from"./WarningCircle.es-DWFLwubM.js";import{A as Ae,At as je,B as Me,Bt as Ne,C as Pe,D as Fe,E as Ie,F as Le,Ft as Re,Gt as ze,H as Be,Ht as Ve,I as He,It as Ue,Jt as We,Kt as Ge,Lt as Ke,M as qe,Mt as Je,N as Ye,Nt as Xe,O as Ze,P as Qe,Pt as $e,Q as et,R as tt,Rt as nt,U as rt,Ut as it,V as at,W as ot,Wt as st,Xt as ct,Yt as lt,Zt as ut,_ as dt,a as ft,b as pt,c as mt,d as ht,h as gt,i as _t,j as vt,jt as yt,k as bt,l as xt,m as St,n as Ct,o as wt,qt as Tt,r as Et,s as Dt,t as Ot,u as kt,v as At,w as jt,x as Mt,zt as Nt}from"./index-CEp3GmPL.js";function Pt(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=Ft(e);if(n.length!==Ft(t).length)return!1;for(let r=0;r{if(typeof n!=`string`||n.trim().length===0)throw Error(t);return`${e}-${n}`}}var H=r();function Lt(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function Rt(e,t){if(e===t||Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;let n=Object.keys(e),{length:r}=n;if(r!==Object.keys(t).length)return!1;for(let i=0;i{r.current||=window.setTimeout(()=>{i(...e),r.current=null},t)},[t]),o=(0,V.useCallback)(()=>{r.current&&=(window.clearTimeout(r.current),null)},[]);return(0,V.useEffect)(()=>(n.autoInvoke&&a(),o),[o,a]),{start:a,clear:o}}function Ut(e){let t=(0,V.useRef)(void 0);return(0,V.useEffect)(()=>{t.current=e},[e]),t.current}function Wt(e,t,n){let r=(0,V.useRef)(null);(0,V.useEffect)(()=>{r.current&&=(r.current.disconnect(),null);let i=typeof n==`function`?n():n;return i&&(r.current=new MutationObserver(e),r.current.observe(i,t)),()=>{r.current&&=(r.current.disconnect(),null)}},[e,t,n])}function Gt(){let[e,t]=(0,V.useState)(!1);return(0,V.useEffect)(()=>t(!0),[]),e}function Kt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`}function qt(e,t=document){let n=t.querySelector(e);if(n)return n;let r=t.querySelectorAll(`*`);for(let t=0;t{if(!e||!t||!n.current)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=t.offsetWidth===0?1:i.width/t.offsetWidth,o=t.offsetHeight===0?1:i.height/t.offsetHeight,s=window.getComputedStyle(e),c=window.getComputedStyle(t),l=fe(s.borderTopWidth)+fe(c.borderTopWidth),u=fe(s.borderLeftWidth)+fe(c.borderLeftWidth),d={top:(r.top-i.top)/o-l,left:(r.left-i.left)/a-u,width:r.width/a,height:r.height/o};n.current.style.transform=`translateY(${d.top}px) translateX(${d.left}px)`,n.current.style.width=`${d.width}px`,n.current.style.height=`${d.height}px`},p=()=>{window.clearTimeout(o.current),n.current&&(n.current.style.transitionDuration=`0ms`),f(),o.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration=``)},30)},m=(0,V.useRef)(null),h=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(c&&s.current!==e&&i&&i(),s.current=e,f(),e)return m.current=new ResizeObserver(p),m.current.observe(e),t&&(h.current=new ResizeObserver(p),h.current.observe(t)),()=>{m.current?.disconnect(),h.current?.disconnect()}},[t,e]),(0,V.useEffect)(()=>{if(t){let e=e=>{Zt(e.target,t)&&(p(),d(!1))};return t.addEventListener(`transitionend`,e),()=>{t.removeEventListener(`transitionend`,e)}}},[t]),(0,V.useEffect)(()=>{if(n.current&&a){let e=e=>{e.propertyName===`transform`&&a()};return n.current.addEventListener(`transitionend`,e),()=>{n.current?.removeEventListener(`transitionend`,e)}}},[a]),Ht(()=>{ve()!==`test`&&l(!0)},20,{autoInvoke:!0}),Wt(e=>{e.forEach(e=>{e.type===`attributes`&&e.attributeName===`dir`&&p()})},{attributes:!0,attributeFilter:[`dir`]},()=>document.documentElement),{initialized:c,hidden:u}}var $t={root:`m_96b553a6`},en=g((e,{transitionDuration:t},{shouldReduceMotion:n})=>({root:{"--transition-duration":e.respectReducedMotion&&n?`0ms`:typeof t==`number`?`${t}ms`:t||`150ms`}})),tn=h(e=>{let t=u(`FloatingIndicator`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,target:d,parent:f,transitionDuration:m,mod:h,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v,attributes:y,ref:b,...x}=t,S=p(),C=a({name:`FloatingIndicator`,classes:$t,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:y,vars:l,varsResolver:en,stylesCtx:{shouldReduceMotion:S}}),w=(0,V.useRef)(null),{initialized:T,hidden:E}=Qt({target:d,parent:f,ref:w,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v}),D=re(b,w);return!d||!f?null:(0,H.jsx)(o,{ref:D,mod:[{initialized:T,hidden:E},h],...C(`root`),...x})});tn.displayName=`@mantine/core/FloatingIndicator`,tn.classes=$t,tn.varsResolver=en;var[nn,rn]=de(`Accordion component was not found in the tree`),[an,on]=de(`Accordion.Item component was not found in the tree`),sn={root:`m_9bdbb667`,panel:`m_df78851f`,content:`m_4ba554d4`,itemTitle:`m_8fa820a0`,control:`m_4ba585b8`,"control--default":`m_6939a5e9`,"control--contained":`m_4271d21b`,label:`m_df3ffa0f`,chevron:`m_3f35ae96`,icon:`m_9bd771fe`,item:`m_9bd7b098`,"item--default":`m_fe19b709`,"item--contained":`m_1f921b3b`,"item--filled":`m_2cdf939a`,"item--separated":`m_9f59b069`},cn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,chevron:s,icon:c,onClick:l,onKeyDown:d,children:f,disabled:p,mod:h,...g}=u(`AccordionControl`,null,e),{value:_}=on(),v=rn(),y=v.isItemActive(_),b=typeof v.order==`number`,x=`h${v.order}`,S=(0,H.jsxs)(m,{...v.getStyles(`control`,{className:n,classNames:t,style:r,styles:i,variant:v.variant}),unstyled:v.unstyled,mod:[`accordion-control`,{active:y,"chevron-position":v.chevronPosition,disabled:p},h],onClick:e=>{l?.(e),v.onChange(_)},type:`button`,disabled:p,"aria-expanded":y,"aria-controls":v.getRegionId(_),id:v.getControlId(_),onKeyDown:Tt({siblingSelector:`[data-accordion-control]`,parentSelector:`[data-accordion]`,activateOnFocus:!1,loop:v.loop,orientation:`vertical`,onKeyDown:d}),...g,children:[(0,H.jsx)(o,{component:`span`,mod:{rotate:!v.disableChevronRotation&&y,position:v.chevronPosition},...v.getStyles(`chevron`,{classNames:t,styles:i}),children:s||v.chevron}),(0,H.jsx)(`span`,{...v.getStyles(`label`,{classNames:t,styles:i}),children:f}),c&&(0,H.jsx)(o,{component:`span`,mod:{"chevron-position":v.chevronPosition},...v.getStyles(`icon`,{classNames:t,styles:i}),children:c})]});return b?(0,H.jsx)(x,{...v.getStyles(`itemTitle`,{classNames:t,styles:i}),children:S}):S});cn.displayName=`@mantine/core/AccordionControl`,cn.classes=sn;var ln=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,mod:c,...l}=u(`AccordionItem`,null,e),d=rn();return(0,H.jsx)(an,{value:{value:s},children:(0,H.jsx)(o,{mod:[{active:d.isItemActive(s)},c],...d.getStyles(`item`,{className:n,classNames:t,styles:i,style:r,variant:d.variant}),...l})})});ln.displayName=`@mantine/core/AccordionItem`,ln.classes=sn;var un=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,keepMounted:s,keepMountedMode:c,...l}=u(`AccordionPanel`,null,e),{value:d}=on(),f=rn();return(0,H.jsx)(Ee,{...f.getStyles(`panel`,{className:n,classNames:t,style:r,styles:i}),expanded:f.isItemActive(d),transitionDuration:f.transitionDuration??200,role:`region`,id:f.getRegionId(d),"aria-labelledby":f.getControlId(d),keepMounted:s??f.keepMounted,keepMountedMode:c??f.keepMountedMode,...l,children:(0,H.jsx)(`div`,{...f.getStyles(`content`,{classNames:t,styles:i}),children:o})})});un.displayName=`@mantine/core/AccordionPanel`,un.classes=sn;var dn={multiple:!1,loop:!0,disableChevronRotation:!1,disableCollapse:!1,chevronPosition:`right`,variant:`default`,chevronSize:`auto`,chevronIconSize:16,keepMountedMode:`activity`},fn=g((e,{transitionDuration:t,chevronSize:n,radius:r})=>({root:{"--accordion-transition-duration":t===void 0?void 0:`${t}ms`,"--accordion-chevron-size":n===void 0?void 0:P(n),"--accordion-radius":r===void 0?void 0:ne(r)}})),pn=c(e=>{let t=u(`Accordion`,dn,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,children:d,multiple:f,value:p,defaultValue:m,onChange:h,id:g,loop:_,transitionDuration:v,disableChevronRotation:y,disableCollapse:b,chevronPosition:x,chevronSize:S,order:C,chevron:w,variant:T,radius:E,chevronIconSize:D,attributes:O,keepMounted:k,keepMountedMode:A,...j}=t,M=F(g),[N,P]=ze({value:p,defaultValue:m,finalValue:f?[]:null,onChange:h}),I=e=>Array.isArray(N)?N.includes(e):e===N,L=e=>{if(!Array.isArray(N)&&b&&e===N)return;let t=Array.isArray(N)?N.includes(e)?N.filter(t=>t!==e):[...N,e]:e===N?null:e;P(t)},ee=a({name:`Accordion`,classes:sn,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:O,vars:l,varsResolver:fn});return(0,H.jsx)(nn,{value:{isItemActive:I,onChange:L,getControlId:It(`${M}-control`,`Accordion.Item component was rendered with invalid value or without value`),getRegionId:It(`${M}-panel`,`Accordion.Item component was rendered with invalid value or without value`),chevron:w===null?null:w||(0,H.jsx)(nt,{size:D}),transitionDuration:v,disableChevronRotation:y,chevronPosition:x,order:C,loop:_,getStyles:ee,variant:T,unstyled:c,keepMounted:k,keepMountedMode:A},children:(0,H.jsx)(o,{...ee(`root`),id:M,...j,variant:T,"data-accordion":!0,children:d})})});pn.classes=sn,pn.varsResolver=fn,pn.displayName=`@mantine/core/Accordion`,pn.Item=ln,pn.Panel=un,pn.Control=cn,pn.Chevron=nt;function mn(e){return typeof e==`string`?{value:e,label:e}:typeof e==`object`&&`value`in e&&!(`label`in e)?{value:e.value,label:`${e.value}`,disabled:e.disabled}:typeof e==`object`&&`group`in e?{group:e.group,items:e.items.map(e=>mn(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function hn(e){return e?e.map(e=>mn(e)):[]}function gn(e){return e.reduce((e,t)=>`group`in t?{...e,...gn(t.items)}:(e[`${t.value}`]=t,e),{})}var _n={dropdown:`m_88b62a41`,search:`m_985517d8`,options:`m_b2821a6e`,option:`m_92253aa5`,empty:`m_2530cd1d`,header:`m_858f94bd`,footer:`m_82b967cb`,group:`m_254f3e4f`,groupLabel:`m_2bb2e9e5`,chevron:`m_2943220b`,optionsDropdownOption:`m_390b5f4`,optionsDropdownCheckIcon:`m_8ee53fc2`,optionsDropdownCheckPlaceholder:`m_a530ee0a`},vn={error:null},yn=g((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":M(t,`combobox-chevron-size`),"--combobox-chevron-color":n?l(n,e):void 0}})),bn=h(e=>{let t=u(`ComboboxChevron`,vn,e),{size:n,error:r,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,attributes:p,mod:m,...h}=t,g=a({name:`ComboboxChevron`,classes:_n,props:t,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,varsResolver:yn,attributes:p,rootSelector:`chevron`});return(0,H.jsx)(o,{component:`svg`,...h,...g(`chevron`),size:n,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,mod:[`combobox-chevron`,{error:r},m],children:(0,H.jsx)(`path`,{d:`M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})});bn.classes=_n,bn.varsResolver=yn,bn.displayName=`@mantine/core/ComboboxChevron`;var[xn,Sn]=de(`Combobox component was not found in tree`);function Cn({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,H.jsx)(k.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}Cn.displayName=`@mantine/core/ComboboxClearButton`;var wn=h(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:a,...o}=u(`ComboboxDropdown`,null,e),s=Sn();return(0,H.jsx)(Ne.Dropdown,{...o,role:`presentation`,"data-hidden":a||void 0,"data-floating-height":s.floatingHeight||void 0,...s.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});wn.classes=_n,wn.displayName=`@mantine/core/ComboboxDropdown`;var Tn={refProp:`ref`},En=h(e=>{let{children:t,refProp:n,ref:r}=u(`ComboboxDropdownTarget`,Tn,e);if(Sn(),!w(t))throw Error(`Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return(0,H.jsx)(Ne.Target,{ref:r,refProp:n,children:t})});En.displayName=`@mantine/core/ComboboxDropdownTarget`;var Dn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxEmpty`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...s})});Dn.classes=_n,Dn.displayName=`@mantine/core/ComboboxEmpty`;function On({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=Sn(),[c,l]=(0,V.useState)(null),u=t=>{if(e?.(t),!s.readOnly&&n){if(t.nativeEvent.isComposing)return;if(t.nativeEvent.code===`ArrowDown`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectNextOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`ArrowUp`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectPreviousOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`Enter`||t.nativeEvent.code===`NumpadEnter`){if(t.nativeEvent.keyCode===229)return;let e=s.store.getSelectedOptionIndex();s.store.dropdownOpened&&e!==-1?(t.preventDefault(),s.store.clickSelectedOption()):a===`button`&&(t.preventDefault(),s.store.openDropdown(`keyboard`))}t.key===`Escape`&&s.store.closeDropdown(`keyboard`),t.nativeEvent.code===`Space`&&a===`button`&&(t.preventDefault(),s.store.toggleDropdown(`keyboard`))}},d=r?{...i?{role:`combobox`}:{},"aria-haspopup":`listbox`,"aria-expanded":i?!!(s.store.listId&&s.store.dropdownOpened):void 0,"aria-controls":s.store.dropdownOpened&&s.store.listId?s.store.listId:void 0,"aria-activedescendant":s.store.dropdownOpened&&c||void 0,autoComplete:o,"data-expanded":s.store.dropdownOpened||void 0,"data-mantine-stop-propagation":s.store.dropdownOpened||void 0}:{},f=e=>{a===`button`&&e.currentTarget.focus(),t?.(e)};return{...d,onKeyDown:u,onClick:f}}var kn={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},An=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxEventsTarget`,kn,e),d=v(t);if(!d)throw Error(`Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Sn(),p=On({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s});return(0,V.cloneElement)(d,{...p,...l,[n]:re(c,f.store.targetRef,ue(d))})});An.displayName=`@mantine/core/ComboboxEventsTarget`;var jn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxFooter`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});jn.classes=_n,jn.displayName=`@mantine/core/ComboboxFooter`;var Mn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:s,label:c,id:l,...d}=u(`ComboboxGroup`,null,e),f=Sn(),p=F(l),m=c!=null&&c!==!1&&c!==``;return(0,H.jsxs)(o,{role:`group`,"aria-labelledby":m?p:void 0,...f.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...d,children:[m&&(0,H.jsx)(`div`,{id:p,...f.getStyles(`groupLabel`,{classNames:t,styles:i}),children:c}),s]})});Mn.classes=_n,Mn.displayName=`@mantine/core/ComboboxGroup`;var Nn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxHeader`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});Nn.classes=_n,Nn.displayName=`@mantine/core/ComboboxHeader`;function Pn({value:e,valuesDivider:t=`,`,...n}){return(0,H.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}Pn.displayName=`@mantine/core/ComboboxHiddenInput`;var Fn=h(e=>{let t=u(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:a,vars:s,onClick:c,id:l,active:d,onMouseDown:f,onMouseOver:p,disabled:m,selected:h,mod:g,..._}=t,v=Sn(),y=(0,V.useId)(),b=l||y;return(0,H.jsx)(o,{...v.getStyles(`option`,{className:r,classNames:n,styles:a,style:i}),"aria-disabled":m||void 0,..._,id:b,mod:[`combobox-option`,{"combobox-active":d,"combobox-disabled":m,"combobox-selected":h},g],role:`option`,onClick:e=>{m?e.preventDefault():(v.onOptionSubmit?.(t.value,t),c?.(e))},onMouseDown:e=>{e.preventDefault(),f?.(e)},onMouseOver:e=>{v.resetSelectionOnOptionHover&&v.store.resetSelectedOption(),p?.(e)}})});Fn.classes=_n,Fn.displayName=`@mantine/core/ComboboxOption`;var In=h(e=>{let{classNames:t,className:n,style:r,styles:i,id:a,onMouseDown:s,labelledBy:c,...l}=u(`ComboboxOptions`,null,e),d=Sn(),f=F(a);return(0,V.useEffect)(()=>{d.store.setListId(f)},[f]),(0,H.jsx)(o,{...d.getStyles(`options`,{className:n,style:r,classNames:t,styles:i}),...l,id:f,role:`listbox`,"aria-labelledby":c,onMouseDown:e=>{e.preventDefault(),s?.(e)}})});In.classes=_n,In.displayName=`@mantine/core/ComboboxOptions`;var Ln={withAriaAttributes:!0,withKeyboardNavigation:!0},Rn=h(e=>{let{classNames:t,styles:n,unstyled:r,vars:i,withAriaAttributes:a,onKeyDown:o,onClick:s,withKeyboardNavigation:c,size:l,ref:d,...f}=u(`ComboboxSearch`,Ln,e),p=Sn(),m=p.getStyles(`search`),h=On({targetType:`input`,withAriaAttributes:a,withKeyboardNavigation:c,withExpandedAttribute:!1,onKeyDown:o,onClick:s,autoComplete:`off`});return(0,H.jsx)(k,{ref:re(d,p.store.searchRef),classNames:[{input:m.className},t],styles:[{input:m.style},n],size:l||p.size,...h,...f,__staticSelector:`Combobox`})});Rn.classes=_n,Rn.displayName=`@mantine/core/ComboboxSearch`;var zn={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Bn=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxTarget`,zn,e),d=v(t);if(!d)throw Error(`Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Sn(),p=On({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s}),m=(0,V.cloneElement)(d,{...p,...l});return(0,H.jsx)(Ne.Target,{refProp:n,ref:re(c,f.store.targetRef),children:m})});Bn.displayName=`@mantine/core/ComboboxTarget`;function Vn(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].hasAttribute(`data-combobox-disabled`))return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].hasAttribute(`data-combobox-disabled`))return e}return e}function Hn(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),_=(0,V.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),v=(0,V.useCallback)((e=`unknown`)=>{s?_(e):g(e)},[_,g,s]),y=(0,V.useCallback)(()=>{let e=Yt(f.current);qt(`#${l.current} [data-combobox-selected]`,e)?.removeAttribute(`data-combobox-selected`)},[]),b=(0,V.useCallback)(e=>{let t=Yt(f.current),n=qt(`#${l.current}`,t),r=n?Jt(`[data-combobox-option]`,n):null;if(!r)return null;let i=e>=r.length?0:e<0?r.length-1:e;return u.current=i,r?.[i]&&!r[i].hasAttribute(`data-combobox-disabled`)?(y(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,y]),x=(0,V.useCallback)(()=>{let e=Yt(f.current),t=qt(`#${l.current} [data-combobox-active]`,e);if(t){let n=Jt(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return b(n)}return b(0)},[b]),S=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Hn(u.current,t,a))},[b,a]),C=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Vn(u.current,t,a))},[b,a]),w=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Un(t))},[b]),T=(0,V.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=Yt(f.current),r=Jt(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=Yt(f.current),r=Jt(`#${l.current} [data-combobox-option]`,n),i=r.findIndex(t=>t.hasAttribute(`data-combobox-${e}`));u.current=i,t?.scrollIntoView&&r[i]?.scrollIntoView({block:`nearest`,behavior:o})},0)},[]),E=(0,V.useCallback)(()=>{u.current=-1,y()},[y]),D=(0,V.useCallback)(()=>{let e=Yt(f.current);(Jt(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),O=(0,V.useCallback)(e=>{l.current=e},[]),k=(0,V.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),A=(0,V.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),j=(0,V.useCallback)(()=>u.current,[]);return(0,V.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:g,closeDropdown:_,toggleDropdown:v,selectedOptionIndex:u.current,getSelectedOptionIndex:j,selectOption:b,selectFirstOption:w,selectActiveOption:x,selectNextOption:S,selectPreviousOption:C,resetSelectedOption:E,updateSelectedOptionIndex:T,listId:l.current,setListId:O,clickSelectedOption:D,searchRef:d,focusSearchInput:k,targetRef:f,focusTarget:A}}var Gn={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},Kn=g((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:P(n),"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)}})),qn=e=>{let t=u(`Combobox`,Gn,e),{classNames:n,styles:r,unstyled:i,children:o,store:s,vars:c,onOptionSubmit:l,onClose:d,size:f,dropdownPadding:p,resetSelectionOnOptionHover:m,__staticSelector:h,readOnly:g,attributes:_,floatingHeight:v,middlewares:y,...b}=t,x=v===`viewport`?{...y,flip:!1,size:{...typeof y?.size==`object`?y.size:{},padding:typeof y?.size==`object`&&y.size.padding!==void 0?y.size.padding:10,apply:({availableHeight:e,availableWidth:t,elements:n,...r})=>{n.floating.style.setProperty(`--combobox-floating-max-height`,`${e}px`);let i=y?.size;typeof i==`object`&&i.apply?i.apply({availableHeight:e,availableWidth:t,elements:n,...r}):i&&Object.assign(n.floating.style,{maxWidth:`${t}px`,maxHeight:`${e}px`})}}}:y,S=Wn(),C=s||S,w=a({name:h||`Combobox`,classes:_n,props:t,classNames:n,styles:r,unstyled:i,attributes:_,vars:c,varsResolver:Kn}),T=()=>{d?.(),C.closeDropdown()};return(0,H.jsx)(xn,{value:{getStyles:w,store:C,onOptionSubmit:l,size:f,resetSelectionOnOptionHover:m,readOnly:g,floatingHeight:v},children:(0,H.jsx)(Ne,{opened:C.dropdownOpened,...b,middlewares:x,onChange:e=>!e&&T(),withRoles:!1,unstyled:i,children:o})})};qn.extend=e=>e,qn.classes=_n,qn.varsResolver=Kn,qn.displayName=`@mantine/core/Combobox`,qn.Target=Bn,qn.Dropdown=wn,qn.Options=In,qn.Option=Fn,qn.Search=Rn,qn.Empty=Dn,qn.Chevron=bn,qn.Footer=jn,qn.Header=Nn,qn.EventsTarget=An,qn.DropdownTarget=En,qn.Group=Mn,qn.ClearButton=Cn,qn.HiddenInput=Pn;function Jn({children:e,role:t}){let n=(0,V.use)(D);return n?(0,H.jsx)(`div`,{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):(0,H.jsx)(H.Fragment,{children:e})}var Yn={root:`m_5f75b09e`,body:`m_5f6e695e`,labelWrapper:`m_d3ea56bb`,label:`m_8ee546b8`,description:`m_328f68c0`,error:`m_8e8a99cc`},Xn=Yn;function Zn({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:i,unstyled:s,children:c,label:l,description:u,id:d,disabled:f,error:p,size:m,labelPosition:h=`left`,bodyElement:g=`div`,labelElement:_=`label`,variant:v,style:y,vars:b,mod:x,attributes:S,...C}){let w=a({name:e,props:t,className:n,style:y,classes:Yn,classNames:r,styles:i,unstyled:s,attributes:S}),T=u?`${d}-description`:void 0,E=p&&typeof p!=`boolean`?`${d}-error`:void 0;return(0,H.jsx)(o,{...w(`root`),__vars:{"--label-fz":L(m),"--label-lh":M(m,`label-lh`)},mod:[{"label-position":h},x],variant:v,size:m,...C,children:(0,H.jsxs)(o,{component:g,htmlFor:g===`label`?d:void 0,...w(`body`),children:[c,(0,H.jsxs)(`div`,{...w(`labelWrapper`),"data-disabled":f||void 0,children:[l&&(0,H.jsx)(o,{component:_,htmlFor:_===`label`?d:void 0,...w(`label`),"data-disabled":f||void 0,children:l}),u&&(0,H.jsx)(k.Description,{id:T,size:m,__inheritStyles:!1,...w(`description`),children:u}),p&&typeof p!=`boolean`&&(0,H.jsx)(k.Error,{id:E,size:m,__inheritStyles:!1,...w(`error`),children:p})]})]})})}Zn.displayName=`@mantine/core/InlineInput`;function Qn(e){return`group`in e}function $n({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function tr(e,t=new Set){if(Array.isArray(e))for(let n of e)if(Qn(n))tr(n.items,t);else{if(n.value===void 0)throw Error(`[@mantine/core] Each option must have value property`);if(t.has(n.value))throw Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function nr(e,t){return Array.isArray(e)?e.includes(t):e===t}function rr({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!Qn(e)){let s=nr(r,e.value),c=t&&(s?(0,H.jsx)(Ke,{className:_n.optionsDropdownCheckIcon}):n?(0,H.jsx)(`div`,{className:_n.optionsDropdownCheckPlaceholder}):null),l=(0,H.jsxs)(H.Fragment,{children:[i===`left`&&c,(0,H.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,H.jsx)(qn.Option,{value:e.value,disabled:e.disabled,className:_({[_n.optionsDropdownOption]:!a}),"data-reverse":i===`right`||void 0,"data-checked":s||void 0,"aria-selected":s,active:s,children:typeof o==`function`?o({option:e,checked:s}):l})}let s=e.items.map(e=>(0,H.jsx)(rr,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,H.jsx)(qn.Group,{label:e.group,children:s})}function ir({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:i,limit:a,maxDropdownHeight:o,floatingHeight:s,withScrollArea:c=!0,filterOptions:l=!0,withCheckIcon:u=!1,withAlignedLabels:d=!1,value:f,checkIconPosition:p,nothingFoundMessage:m,unstyled:h,labelId:g,renderOption:_,scrollAreaProps:v,"aria-label":y}){let b=Sn();tr(e);let x=typeof i==`string`?(r||$n)({options:e,search:l?i:``,limit:a??1/0}):e,S=er(x),C=x.map((e,t)=>(0,H.jsx)(rr,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},Qn(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,H.jsx)(qn.Dropdown,{hidden:t||n&&S,"data-composed":!0,children:(0,H.jsxs)(qn.Options,{labelledBy:g,"aria-label":y,children:[c?(0,H.jsx)(pe.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:C}):C,S&&m&&(0,H.jsx)(qn.Empty,{children:m})]})})}function ar(e,t,n,r){if(t===n||r===`before`&&n===t+1||r===`after`&&n===t-1)return e;let i=e.slice(),[a]=i.splice(t,1),o=t{let t=e.lastElementChild;return t?t instanceof HTMLInputElement?t:t.querySelector(`input`):null},sr=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let e=i.current;e&&(i.current=null,sr(o.current,e.expectedValue)&&e.container?.querySelector(`[data-mantine-pill-index="${e.index}"]`)?.focus())});let s=(0,V.useCallback)(e=>{a.current=e},[]);return{getPillProps:e=>{if(n)return{draggable:!0,tabIndex:-1,"data-mantine-pill-index":e,"aria-keyshortcuts":`Alt+ArrowLeft Alt+ArrowRight`,onMouseDown:e=>{e.button===0&&e.stopPropagation()},onDragStart:t=>{t.stopPropagation(),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,String(e)),r.current.draggedIndex=e;let n=t.currentTarget,i=n.getBoundingClientRect(),a=n.cloneNode(!0);a.removeAttribute(`data-dragging`),a.removeAttribute(`data-drag-over`),a.style.position=`fixed`,a.style.top=`-9999px`,a.style.left=`-9999px`,a.style.width=`${i.width}px`,a.style.height=`${i.height}px`,a.style.pointerEvents=`none`,document.body.appendChild(a),t.dataTransfer.setDragImage(a,t.clientX-i.left,t.clientY-i.top),setTimeout(()=>a.parentNode?.removeChild(a),0),requestAnimationFrame(()=>{n.setAttribute(`data-dragging`,`true`)})},onDragOver:t=>{let{draggedIndex:n}=r.current;if(n===null||n===e)return;let i=t.currentTarget,a=i.getBoundingClientRect(),o=t.clientX-a.left,s=(getComputedStyle(i).direction===`rtl`?o>a.width/2:o{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||(t.removeAttribute(`data-drag-over`),r.current.currentDropTarget===t&&(r.current.currentDropTarget=null))},onDrop:n=>{n.preventDefault(),n.stopPropagation();let i=n.currentTarget,a=i.getAttribute(`data-drag-over`);i.removeAttribute(`data-drag-over`);let{draggedIndex:s}=r.current;if(s!==null&&a&&s!==e){let n=ar(o.current,s,e,a);n!==o.current&&t(n)}r.current.draggedIndex=null,r.current.currentDropTarget=null},onDragEnd:e=>{e.currentTarget.removeAttribute(`data-dragging`);let t=r.current.currentDropTarget;t&&t.removeAttribute(`data-drag-over`),r.current.draggedIndex=null,r.current.currentDropTarget=null},onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`)return;let r=n.currentTarget,a=getComputedStyle(r).direction===`rtl`?n.key===`ArrowLeft`:n.key===`ArrowRight`,s=a?e+1:e-1;if(n.altKey){if(s<0||s>=o.current.length)return;n.preventDefault(),n.stopPropagation();let c=a?`after`:`before`,l=ar(o.current,e,s,c);if(l===o.current)return;i.current={container:r.parentElement,index:s,expectedValue:l},t(l);return}if(s<0)return;let c=r.parentElement;if(c){if(n.preventDefault(),n.stopPropagation(),s>=o.current.length){or(c)?.focus();return}c.querySelector(`[data-mantine-pill-index="${s}"]`)?.focus()}}}},getListProps:()=>n?{ref:s}:{},handleInputKeyDown:e=>{if(!n||e.key!==`ArrowLeft`)return;let t=e.currentTarget;if(!(t.value.length===0||t.selectionStart===0&&t.selectionEnd===0))return;let r=a.current;if(!r)return;let i=r.querySelectorAll(`[data-mantine-pill-index]`);i.length!==0&&(e.preventDefault(),i[i.length-1].focus())}}}function lr({id:e,label:t,labelProps:n,inputWrapperOrder:r}){if(t&&(!r||r.includes(`label`)))return n?.id||`${e}-label`}function ur(e){let t=e.currentTarget;return Yt(t).activeElement!==t}var dr=(0,V.createContext)(null),fr={root:`m_7cda1cd6`,"root--default":`m_44da308b`,"root--contrast":`m_e3a01f8`,label:`m_1e0e6180`,remove:`m_ae386778`,group:`m_1dcfd90b`},pr=(0,V.createContext)(null),mr=g((e,{gap:t},{size:n})=>({group:{"--pg-gap":t===void 0?M(n,`pg-gap`):M(t)}})),hr=h(e=>{let t=u(`PillGroup`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,size:d,disabled:f,attributes:p,...m}=t,h=(0,V.use)(dr)?.size||d||void 0,g=a({name:`PillGroup`,classes:fr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:p,vars:l,varsResolver:mr,stylesCtx:{size:h},rootSelector:`group`});return(0,H.jsx)(pr,{value:{size:h,disabled:f},children:(0,H.jsx)(o,{size:h,...g(`group`),...m})})});hr.classes=fr,hr.varsResolver=mr,hr.displayName=`@mantine/core/PillGroup`;var gr={variant:`default`},_r=g((e,{radius:t},{size:n})=>({root:{"--pill-fz":M(n,`pill-fz`),"--pill-height":M(n,`pill-height`),"--pill-radius":t===void 0?void 0:ne(t)}})),vr=h(e=>{let t=u(`Pill`,gr,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,variant:d,children:f,withRemoveButton:p,onRemove:m,removeButtonProps:h,radius:g,size:_,disabled:v,mod:y,attributes:b,...x}=t,S=(0,V.use)(pr),C=(0,V.use)(dr),w=_||S?.size||void 0,T=C?.variant===`filled`?`contrast`:d||`default`,E=a({name:`Pill`,classes:fr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:b,vars:l,varsResolver:_r,stylesCtx:{size:w}});return(0,H.jsxs)(o,{component:`span`,variant:T,size:w,...E(`root`,{variant:T}),mod:[{"with-remove":p&&!v,disabled:v||S?.disabled},y],...x,children:[(0,H.jsx)(`span`,{...E(`label`),children:f}),p&&(0,H.jsx)(ae,{variant:`transparent`,radius:g,tabIndex:-1,"aria-hidden":!0,unstyled:c,...h,...E(`remove`,{className:h?.className,style:h?.style}),onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),h?.onMouseDown?.(e)},onClick:e=>{e.stopPropagation(),m?.(),h?.onClick?.(e)}})]})});vr.classes=fr,vr.varsResolver=_r,vr.displayName=`@mantine/core/Pill`,vr.Group=hr;var yr={field:`m_45c4369d`},br={type:`visible`},xr=h(e=>{let t=u(`PillsInputField`,br,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,type:d,disabled:f,id:p,pointer:m,mod:h,attributes:g,ref:_,...v}=t,y=(0,V.use)(dr),b=(0,V.use)(D),x=a({name:`PillsInputField`,classes:yr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:g,rootSelector:`field`}),S=f||y?.disabled;return(0,H.jsx)(o,{component:`input`,ref:re(_,y?.fieldRef),"data-type":d,disabled:S,mod:[{disabled:S,pointer:m},h],...x(`field`),...v,id:b?.inputId||p,"aria-invalid":y?.hasError,"aria-describedby":b?.describedBy,type:`text`,onMouseDown:e=>!m&&e.stopPropagation()})});xr.classes=yr,xr.displayName=`@mantine/core/PillsInputField`;var Sr={size:`sm`},Cr=h(e=>{let{children:t,onMouseDown:n,onClick:r,size:i,disabled:a,__staticSelector:o,error:s,variant:c,...l}=u([`Input`,`InputWrapper`,`PillsInput`],Sr,e),d=(0,V.useRef)(null);return(0,H.jsx)(dr,{value:{fieldRef:d,size:i,disabled:a,hasError:!!s,variant:c},children:(0,H.jsx)(N,{size:i,error:s,variant:c,component:`div`,"data-no-overflow":!0,onMouseDown:e=>{e.preventDefault(),n?.(e),d.current?.focus()},onClick:e=>{e.preventDefault(),e.currentTarget.closest(`fieldset`)?.disabled||(d.current?.focus(),r?.(e))},...l,multiline:!0,disabled:a,__staticSelector:o||`PillsInput`,withAria:!1,children:t})})});Cr.displayName=`@mantine/core/PillsInput`,Cr.classes=N.classes,Cr.Field=xr;function wr(e,t){let n=t.trim().toLowerCase();if(n===``)return;let r=Object.values(e).filter(e=>!e.disabled&&e.label.trim().toLowerCase()===n);return r.length===1?r[0]:void 0}function Tr(e){return typeof e==`string`?e.trim().toLowerCase():e}function Er({data:e,value:t}){let n=t.map(Tr);return e.reduce((e,t)=>(Qn(t)?e.push({group:t.group,items:t.items.filter(e=>n.indexOf(Tr(e.value))===-1)}):n.indexOf(Tr(t.value))===-1&&e.push(t),e),[])}var Dr={xs:41,sm:50,md:60,lg:72,xl:89},Or={maxValues:1/0,withCheckIcon:!0,checkIconPosition:`left`,hiddenInputValuesDivider:`,`,clearSearchOnChange:!0,openOnFocus:!0,size:`sm`},kr=c(e=>{let t=u([`Input`,`InputWrapper`,`MultiSelect`],Or,e),{classNames:n,className:r,style:i,styles:o,unstyled:s,vars:c,size:l,value:f,defaultValue:p,onChange:m,onKeyDown:h,variant:g,data:_,dropdownOpened:v,defaultDropdownOpened:y,onDropdownOpen:b,onDropdownClose:x,selectFirstOptionOnChange:S,selectFirstOptionOnDropdownOpen:C,onOptionSubmit:w,comboboxProps:T,filter:E,limit:D,withScrollArea:O,maxDropdownHeight:k,floatingHeight:j,searchValue:M,defaultSearchValue:N,onSearchChange:P,readOnly:I,disabled:L,onFocus:ee,onBlur:R,radius:te,rightSection:ne,rightSectionWidth:re,rightSectionPointerEvents:ie,rightSectionProps:z,leftSection:ae,leftSectionWidth:B,leftSectionPointerEvents:oe,leftSectionProps:se,inputContainer:ce,inputWrapperOrder:le,withAsterisk:ue,labelProps:de,descriptionProps:fe,errorProps:pe,successProps:me,wrapperProps:he,description:ge,label:_e,error:ve,success:ye,maxValues:be,searchable:xe,nothingFoundMessage:Se,withCheckIcon:Ce,withAlignedLabels:we,checkIconPosition:Te,hidePickedOptions:Ee,withErrorStyles:De,withSuccessStyles:Oe,name:ke,form:Ae,id:je,clearable:Me,clearSectionMode:Ne,clearButtonProps:Pe,hiddenInputProps:Fe,placeholder:Ie,hiddenInputValuesDivider:Le,required:Re,mod:Be,renderOption:Ve,renderPill:He,onRemove:Ue,onClear:We,onMaxValues:Ge,scrollAreaProps:Ke,chevronColor:qe,attributes:Je,clearSearchOnChange:Ye,openOnFocus:Xe,loading:Ze,loadingPosition:Qe,withPillsReorder:$e,...et}=t,tt=F(je),nt=lr({id:tt,label:_e,labelProps:de,inputWrapperOrder:le}),rt=hn(_),it=gn(rt),at=(0,V.useRef)({}),ot=Wn({opened:v,defaultOpened:y,onDropdownOpen:()=>{b?.(),C&&ot.selectFirstOption()},onDropdownClose:()=>{x?.(),ot.resetSelectedOption()}}),{styleProps:st,rest:{type:ct,autoComplete:lt,...ut}}=d(et),[dt,ft]=ze({value:f,defaultValue:p,finalValue:[],onChange:m}),{getPillProps:pt,getListProps:mt,handleInputKeyDown:ht}=cr({value:dt,onChange:ft,enabled:$e&&!L&&!I}),[gt,_t]=ze({value:M,defaultValue:N,finalValue:``,onChange:P}),vt=e=>{_t(e),ot.resetSelectedOption()},yt=a({name:`MultiSelect`,classes:{},props:t,classNames:n,styles:o,unstyled:s,attributes:Je}),{resolvedClassNames:bt,resolvedStyles:xt}=A({props:t,styles:o,classNames:n}),St=e=>{h?.(e),!e.defaultPrevented&&(e.key===` `&&!xe&&(e.preventDefault(),ot.toggleDropdown()),e.key===`Backspace`&>.length===0&&dt.length>0&&!I&&(Ue?.(dt[dt.length-1]),ft(dt.slice(0,dt.length-1))),ht(e))},Ct=dt.map((e,t)=>{let n=it[`${e}`]||at.current[`${e}`],r=pt(t);return He?(0,H.jsx)(V.Fragment,{children:He({option:n,value:e,onRemove:()=>{ft(dt.filter(t=>e!==t)),Ue?.(e)},disabled:L,reorderProps:r})},`${e}-${t}`):(0,H.jsx)(vr,{withRemoveButton:!I&&!it[`${e}`]?.disabled,onRemove:()=>{ft(dt.filter(t=>e!==t)),Ue?.(e)},unstyled:s,disabled:L,...yt(`pill`),...r,children:n?.label||e},`${e}-${t}`)});(0,V.useEffect)(()=>{S&&ot.selectFirstOption()},[S,gt]),(0,V.useEffect)(()=>{dt.forEach(e=>{`${e}`in it&&(at.current[`${e}`]=it[`${e}`])})},[it,dt]);let wt=(0,H.jsx)(qn.ClearButton,{...Pe,onClear:()=>{We?.(),ft([]),vt(``)}}),Tt=Er({data:rt,value:dt}),Et=Me&&dt.length>0&&!L&&!I,Dt=Et?{paddingInlineEnd:Dr[l]??Dr.sm}:void 0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(qn,{store:ot,classNames:bt,styles:xt,unstyled:s,size:l,readOnly:I,__staticSelector:`MultiSelect`,attributes:Je,floatingHeight:j,onOptionSubmit:e=>{w?.(e),Ye&&vt(``),ot.updateSelectedOptionIndex(`selected`),dt.includes(it[`${e}`].value)?(ft(dt.filter(t=>t!==it[`${e}`].value)),Ue?.(it[`${e}`].value)):dt.lengthxe?ot.openDropdown():ot.toggleDropdown(),"data-expanded":ot.dropdownOpened||void 0,id:tt,required:Re,mod:Be,attributes:Je,children:(0,H.jsxs)(vr.Group,{attributes:Je,disabled:L,unstyled:s,...yt(`pillsList`,{style:Dt}),...mt(),children:[Ct,(0,H.jsx)(qn.EventsTarget,{autoComplete:lt,withExpandedAttribute:!0,children:(0,H.jsx)(Cr.Field,{...ut,id:tt,placeholder:Ie,type:!xe&&!Ie?`hidden`:`visible`,...yt(`inputField`),unstyled:s,onFocus:e=>{ee?.(e),Xe&&xe&&ot.openDropdown()},onBlur:e=>{R?.(e),ot.closeDropdown(),vt(``)},onKeyDown:St,value:gt,onChange:e=>{if(ur(e)){if(!I){let t=wr(it,e.currentTarget.value);t&&!dt.includes(t.value)&&dt.length{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ProgressLabel`,null,e),c=jr();return(0,H.jsx)(o,{...c.getStyles(`label`,{className:n,style:r,classNames:t,styles:i}),...s})});Nr.classes=Mr,Nr.displayName=`@mantine/core/ProgressLabel`;var Pr=g((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":M(t,`progress-size`),"--progress-radius":n===void 0?void 0:ne(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),Fr=h(e=>{let t=u(`ProgressRoot`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,autoContrast:d,transitionDuration:f,orientation:p,attributes:m,mod:h,...g}=t,_=a({name:`Progress`,classes:Mr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:m,vars:l,varsResolver:Pr});return(0,H.jsx)(Ar,{value:{getStyles:_,autoContrast:d},children:(0,H.jsx)(o,{mod:[{orientation:p},h],..._(`root`),...g})})});Fr.classes=Mr,Fr.varsResolver=Pr,Fr.displayName=`@mantine/core/ProgressRoot`;var Ir={withAria:!0},Lr=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,withAria:c,color:d,striped:p,animated:m,mod:h,...g}=u(`ProgressSection`,Ir,e),_=jr(),v=f(),y=c?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":s,"aria-valuetext":`${s}%`}:{};return(0,H.jsx)(o,{..._.getStyles(`section`,{className:n,classNames:t,styles:i,style:r}),...g,...y,mod:[{striped:p||m,animated:m},h],__vars:{"--progress-section-size":`${s}%`,"--progress-section-color":l(d,v),"--progress-label-color":Xt(_.autoContrast,v)?st({color:d,theme:v,autoContrast:_.autoContrast}):void 0}})});Lr.classes=Mr,Lr.displayName=`@mantine/core/ProgressSection`;var Rr=h(e=>{let t=u(`Progress`,null,e),{value:n,classNames:r,styles:i,vars:a,color:o,striped:s,animated:c,"aria-label":l,...d}=t,{resolvedClassNames:f,resolvedStyles:p}=A({classNames:r,styles:i,props:t});return(0,H.jsx)(Fr,{classNames:f,styles:p,vars:a,...d,children:(0,H.jsx)(Lr,{value:n,color:o,striped:s,animated:c,"aria-label":l})})});Rr.classes=Mr,Rr.displayName=`@mantine/core/Progress`,Rr.Section=Lr,Rr.Root=Fr,Rr.Label=Nr;var zr={root:`m_cf365364`,indicator:`m_9e182ccd`,label:`m_1738fcb2`,input:`m_1714d588`,control:`m_69686b9b`,innerLabel:`m_78882f40`},Br={withItemsBorders:!0},Vr=g((e,{radius:t,color:n,transitionDuration:r,size:i,transitionTimingFunction:a})=>({root:{"--sc-radius":t===void 0?void 0:ne(t),"--sc-color":n?l(n,e):void 0,"--sc-shadow":n?void 0:`var(--mantine-shadow-xs)`,"--sc-transition-duration":r===void 0?void 0:`${r}ms`,"--sc-transition-timing-function":a,"--sc-padding":M(i,`sc-padding`),"--sc-font-size":L(i)}})),Hr=c(e=>{let t=u(`SegmentedControl`,Br,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,data:d,value:p,defaultValue:m,onChange:h,size:g,name:_,disabled:v,readOnly:y,fullWidth:b,orientation:x,radius:S,color:C,transitionDuration:w,transitionTimingFunction:T,variant:E,autoContrast:D,withItemsBorders:O,mod:k,attributes:A,ref:j,...M}=t,N=a({name:`SegmentedControl`,props:t,classes:zr,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:A,vars:l,varsResolver:Vr}),P=f(),I=d.map(e=>Kt(e)?{label:`${e}`,value:e}:e),L=Gt(),[ee,R]=(0,V.useState)(0),[te,ne]=(0,V.useState)(null),[ie,z]=(0,V.useState)({}),ae=(e,t)=>{e!==null&&ie[t]!==e&&(ie[t]=e,z({...ie}))},[B,oe]=ze({value:p,defaultValue:m,finalValue:Array.isArray(d)?I.find(e=>!e.disabled)?.value??d[0]?.value??null:null,onChange:h}),se=F(_),ce=I.map(e=>`${e.value}`),le=I.map(e=>(0,V.createElement)(o,{...N(`control`),mod:{active:B===e.value,orientation:x},key:`${e.value}`},(0,V.createElement)(`input`,{...N(`input`),disabled:v||e.disabled,type:`radio`,name:se,value:`${e.value}`,id:`${se}-${e.value}`,checked:B===e.value,onChange:()=>!y&&oe(e.value),"data-focus-ring":P.focusRing,key:`${e.value}-input`}),(0,V.createElement)(o,{component:`label`,...N(`label`),mod:{active:B===e.value&&!(v||e.disabled),disabled:v||e.disabled,"read-only":y},htmlFor:`${se}-${e.value}`,ref:t=>ae(t,`${e.value}`),__vars:{"--sc-label-color":C===void 0?void 0:st({color:C,theme:P,autoContrast:D})},key:`${e.value}-label`},(0,H.jsx)(`span`,{...N(`innerLabel`),children:e.label})))),ue=re(j,ne);return Vt(()=>{R(e=>e+1)},[d.length]),Vt(()=>{z(e=>{let t={};return ce.forEach(n=>{n in e&&(t[n]=e[n])}),Object.keys(t).length===Object.keys(e).length?e:t})},[ce]),d.length===0?null:(0,H.jsxs)(o,{...N(`root`),variant:E,size:g,ref:ue,mod:[{"full-width":b,orientation:x,initialized:L,"with-items-borders":O},k],...M,role:`radiogroup`,"data-disabled":v,children:[B!==void 0&&(0,H.jsx)(tn,{target:ie[`${B}`],parent:te,component:`span`,transitionDuration:`var(--sc-transition-duration)`,...N(`indicator`)},ee),le]})});Hr.classes=zr,Hr.varsResolver=Vr,Hr.displayName=`@mantine/core/SegmentedControl`;var Ur={size:`sm`,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},Wr=c(e=>{let t=u([`Input`,`InputWrapper`,`Select`],Ur,e),{classNames:n,styles:r,unstyled:i,vars:a,dropdownOpened:o,defaultDropdownOpened:s,onDropdownClose:c,onDropdownOpen:l,onFocus:d,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:v,selectFirstOptionOnDropdownOpen:y,onOptionSubmit:b,comboboxProps:x,readOnly:S,disabled:C,filter:w,limit:T,withScrollArea:E,maxDropdownHeight:D,floatingHeight:O,size:k,searchable:j,rightSection:M,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,name:R,form:te,searchValue:ne,defaultSearchValue:re,onSearchChange:ie,allowDeselect:z,error:ae,rightSectionPointerEvents:B,id:oe,clearable:se,clearSectionMode:ce,clearButtonProps:le,hiddenInputProps:ue,renderOption:de,onClear:fe,autoComplete:pe,scrollAreaProps:me,__defaultRightSection:he,__clearSection:ge,__clearable:_e,chevronColor:ve,autoSelectOnBlur:ye,openOnFocus:be,attributes:xe,...Se}=t,Ce=(0,V.useMemo)(()=>hn(h),[h]),we=(0,V.useRef)({}),Te=(0,V.useMemo)(()=>gn(Ce),[Ce]),Ee=F(oe),De=lr({id:Ee,label:Se.label,labelProps:Se.labelProps,inputWrapperOrder:Se.inputWrapperOrder}),[Oe,ke,Ae]=ze({value:g,defaultValue:_,finalValue:null,onChange:m}),je=Oe==null?void 0:`${Oe}`in Te?Te[`${Oe}`]:we.current[`${Oe}`],Me=Ut(je),[Ne,Pe,Fe]=ze({value:ne,defaultValue:re,finalValue:je?je.label:``,onChange:ie}),Ie=Wn({opened:o,defaultOpened:s,onDropdownOpen:()=>{l?.(),y?Ie.selectFirstOption():Ie.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{c?.(),setTimeout(Ie.resetSelectedOption,0)}}),Le=e=>{Pe(e),Ie.resetSelectedOption()},{resolvedClassNames:Re,resolvedStyles:Be}=A({props:t,styles:r,classNames:n});(0,V.useEffect)(()=>{v&&Ie.selectFirstOption()},[v,Ne]),(0,V.useEffect)(()=>{g===null&&Le(``),g!=null&&je&&(Me?.value!==je.value||Me?.label!==je.label)&&Le(je.label)},[g,je]),(0,V.useEffect)(()=>{!Ae&&!Fe&&Le(Oe==null?``:`${Oe}`in Te?Te[`${Oe}`]?.label:we.current[`${Oe}`]?.label||``)},[Te,Oe]),(0,V.useEffect)(()=>{Oe&&`${Oe}`in Te&&(we.current[`${Oe}`]=Te[`${Oe}`])},[Te,Oe]);let Ve=(0,H.jsx)(qn.ClearButton,{...le,onClear:()=>{ke(null,null),Le(``),fe?.()}}),He=se&&Oe!=null&&!C&&!S;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(qn,{store:Ie,__staticSelector:`Select`,classNames:Re,styles:Be,unstyled:i,readOnly:S,size:k,attributes:xe,floatingHeight:O,keepMounted:ye,onOptionSubmit:e=>{b?.(e);let t=z&&`${Te[e].value}`==`${Oe}`?null:Te[e],n=t?t.value:null;n!==Oe&&ke(n,t),!Ae&&Le(n==null?``:t?.label||``),Ie.closeDropdown()},...x,children:[(0,H.jsx)(qn.Target,{targetType:j?`input`:`button`,autoComplete:pe,withExpandedAttribute:!0,children:(0,H.jsx)(N,{id:Ee,__defaultRightSection:(0,H.jsx)(qn.Chevron,{size:k,error:ae,unstyled:i,color:ve}),__clearSection:Ve,__clearable:He,__clearSectionMode:ce,rightSection:M,rightSectionPointerEvents:B||`none`,...Se,size:k,__staticSelector:`Select`,disabled:C,readOnly:S||!j,value:Ne,onChange:e=>{if(ur(e)){if(!S){let t=wr(Te,e.currentTarget.value);t&&`${t.value}`!=`${Oe}`&&(ke(t.value,t),!Ae&&Le(t.label))}return}Le(e.currentTarget.value),Ie.openDropdown(),v&&Ie.selectFirstOption()},onFocus:e=>{be&&j&&Ie.openDropdown(),d?.(e)},onBlur:e=>{ye&&Ie.clickSelectedOption(),Ie.closeDropdown();let t=Oe!=null&&(`${Oe}`in Te?Te[`${Oe}`]:we.current[`${Oe}`]);Le(t&&t.label||``),f?.(e)},onClick:e=>{j?Ie.openDropdown():Ie.toggleDropdown(),p?.(e)},classNames:Re,styles:Be,unstyled:i,pointer:!j,error:ae,attributes:xe})}),(0,H.jsx)(ir,{data:Ce,hidden:S||C,filter:w,search:Ne,limit:T,hiddenWhenEmpty:!ee,withScrollArea:E,maxDropdownHeight:D,filterOptions:!!j&&je?.label!==Ne,value:Oe,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,unstyled:i,labelId:De,"aria-label":De?void 0:Se[`aria-label`],renderOption:de,scrollAreaProps:me})]}),(0,H.jsx)(qn.HiddenInput,{value:Oe,name:R,form:te,disabled:C,...ue})]})});Wr.classes={...N.classes,...qn.classes},Wr.displayName=`@mantine/core/Select`;function Gr(e){if(e!==void 0)return typeof e==`number`?P(e):e}function Kr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=f(),s=t===void 0?e:t,c=r!==void 0,l=E({"--sg-spacing-x":z(Lt(e)),"--sg-spacing-y":z(Lt(s)),"--sg-auto-rows":i,...c?{"--sg-min-col-width":Gr(r)}:{"--sg-cols":Lt(n)?.toString()}}),u=O(o.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=z(e[r])),typeof s==`object`&&s[r]!==void 0&&(t[r][`--sg-spacing-y`]=z(s[r])),!c&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=Ge(O(u),o.breakpoints).filter(e=>O(u[e.value]).length>0).map(e=>({query:`(min-width: ${o.breakpoints[e.value]})`,styles:u[e.value]}));return(0,H.jsx)(j,{styles:l,media:d,selector:a})}function qr(e){return typeof e==`object`&&e?O(e):[]}function Jr(e){return e.sort((e,t)=>We(e)-We(t))}function Yr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}){return Jr(Array.from(new Set([...qr(e),...qr(t),...r===void 0?qr(n):[]])))}function Xr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=t===void 0?e:t,s=r!==void 0,c=E({"--sg-spacing-x":z(Lt(e)),"--sg-spacing-y":z(Lt(o)),"--sg-auto-rows":i,...s?{"--sg-min-col-width":Gr(r)}:{"--sg-cols":Lt(n)?.toString()}}),l=Yr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}),u=l.reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=z(e[r])),typeof o==`object`&&o[r]!==void 0&&(t[r][`--sg-spacing-y`]=z(o[r])),!s&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=l.map(e=>({query:`simple-grid (min-width: ${e})`,styles:u[e]}));return(0,H.jsx)(j,{styles:c,container:d,selector:a})}var Zr={container:`m_925c2d2c`,root:`m_2415a157`},Qr={cols:1,spacing:`md`,type:`media`},$r=h(e=>{let t=u(`SimpleGrid`,Qr,e),{classNames:n,className:r,style:i,styles:c,unstyled:l,vars:d,cols:f,verticalSpacing:p,spacing:m,type:h,minColWidth:g,autoFlow:_,autoRows:v,attributes:y,...b}=t,x=a({name:`SimpleGrid`,classes:Zr,props:t,className:r,style:i,classNames:n,styles:c,unstyled:l,attributes:y,vars:d}),S=s(),C=g===void 0?void 0:_||`auto-fill`;return h===`container`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Xr,{...t,selector:`.${S}`}),(0,H.jsx)(`div`,{...x(`container`),children:(0,H.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Kr,{...t,selector:`.${S}`}),(0,H.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})]})});$r.classes=Zr,$r.displayName=`@mantine/core/SimpleGrid`;var ei=(0,V.createContext)(null),ti={hiddenInputValuesSeparator:`,`},ni=c((e=>{let{value:t,defaultValue:n,onChange:r,size:i,wrapperProps:a,children:o,readOnly:s,name:c,hiddenInputValuesSeparator:l,hiddenInputProps:d,maxSelectedValues:f,disabled:p,...m}=u(`SwitchGroup`,ti,e),[h,g]=ze({value:t,defaultValue:n,finalValue:[],onChange:r}),_=e=>{let t=e.currentTarget.value;if(s)return;let n=h.includes(t);!n&&f&&h.length>=f||g(n?h.filter(e=>e!==t):[...h,t])},v=e=>{if(p)return!0;if(!f)return!1;let t=h.includes(e),n=h.length>=f;return!t&&n},y=h.join(l);return(0,H.jsx)(ei,{value:{value:h,onChange:_,size:i,isDisabled:v},children:(0,H.jsxs)(k.Wrapper,{size:i,...a,...m,labelElement:`div`,__staticSelector:`SwitchGroup`,children:[(0,H.jsx)(Jn,{role:`group`,children:o}),(0,H.jsx)(`input`,{type:`hidden`,name:c,value:y,...d})]})})}));ni.classes=k.Wrapper.classes,ni.displayName=`@mantine/core/SwitchGroup`;var ri={root:`m_5f93f3bb`,input:`m_926b4011`,track:`m_9307d992`,thumb:`m_93039a1d`,trackLabel:`m_8277e082`},ii={labelPosition:`right`,withThumbIndicator:!0},ai=g((e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:ne(t),"--switch-height":M(r,`switch-height`),"--switch-width":M(r,`switch-width`),"--switch-thumb-size":M(r,`switch-thumb-size`),"--switch-label-font-size":M(r,`switch-label-font-size`),"--switch-track-label-padding":M(r,`switch-track-label-padding`),"--switch-color":n?l(n,e):void 0}})),oi=h(e=>{let t=u(`Switch`,ii,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,color:f,label:p,offLabel:m,onLabel:h,id:g,size:_,radius:v,wrapperProps:y,thumbIcon:b,checked:x,defaultChecked:S,onChange:C,labelPosition:w,description:T,error:E,disabled:D,variant:O,rootRef:k,mod:A,withThumbIndicator:j,attributes:M,...N}=t,P=(0,V.use)(ei),I=_||P?.size,L=a({name:`Switch`,props:t,classes:ri,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:M,vars:l,varsResolver:ai}),{styleProps:ee,rest:R}=d(N),te=F(g),ne=[T?`${te}-description`:void 0,E&&typeof E!=`boolean`?`${te}-error`:void 0,R[`aria-describedby`]].filter(Boolean).join(` `)||void 0,re={checked:P?.value.includes(R.value)??x,onChange:e=>{P?.onChange(e),C?.(e)}},ie=D||P?.isDisabled?.(R.value),[z,ae]=ze({value:re.checked??x,defaultValue:S,finalValue:!1});return(0,H.jsxs)(Zn,{...L(`root`),__staticSelector:`Switch`,__stylesApiProps:t,id:te,size:I,labelPosition:w,label:p,description:T,error:E,disabled:ie,bodyElement:`label`,labelElement:`span`,classNames:n,styles:s,unstyled:c,"data-checked":re.checked,variant:O,ref:k,mod:A,attributes:M,inert:R.inert,...ee,...y,children:[(0,H.jsx)(`input`,{...R,...re,disabled:ie,checked:z,"data-checked":re.checked,onChange:e=>{re.onChange?.(e),ae(e.currentTarget.checked)},id:te,type:`checkbox`,role:`switch`,inert:R.inert,"aria-describedby":ne,...L(`input`)}),(0,H.jsxs)(o,{"aria-hidden":`true`,component:`span`,mod:{error:E,"label-position":w,"without-labels":!h&&!m},...L(`track`),children:[(0,H.jsx)(o,{component:`span`,mod:{"reduce-motion":!0,"with-thumb-indicator":j&&!b},...L(`thumb`),children:b}),(0,H.jsx)(`span`,{...L(`trackLabel`),children:z?h:m})]})]})});oi.classes={...ri,...Xn},oi.varsResolver=ai,oi.displayName=`@mantine/core/Switch`,oi.Group=ni;var si=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z`}))]]),ci=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z`}))]]),li=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M220,48V96a12,12,0,0,1-24,0V77l-35.51,35.52a12,12,0,0,1-17-17L179,60H160a12,12,0,0,1,0-24h48A12,12,0,0,1,220,48ZM95.51,143.51,60,179V160a12,12,0,0,0-24,0v48a12,12,0,0,0,12,12H96a12,12,0,0,0,0-24H77l35.52-35.51a12,12,0,0,0-17-17ZM208,148a12,12,0,0,0-12,12v19l-35.51-35.52a12,12,0,0,0-17,17L179,196H160a12,12,0,0,0,0,24h48a12,12,0,0,0,12-12V160A12,12,0,0,0,208,148ZM77,60H96a12,12,0,0,0,0-24H48A12,12,0,0,0,36,48V96a12,12,0,0,0,24,0V77l35.51,35.52a12,12,0,0,0,17-17Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,48V208H48V48Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M109.66,146.34a8,8,0,0,1,0,11.32L83.31,184l18.35,18.34A8,8,0,0,1,96,216H48a8,8,0,0,1-8-8V160a8,8,0,0,1,13.66-5.66L72,172.69l26.34-26.35A8,8,0,0,1,109.66,146.34ZM83.31,72l18.35-18.34A8,8,0,0,0,96,40H48a8,8,0,0,0-8,8V96a8,8,0,0,0,13.66,5.66L72,83.31l26.34,26.35a8,8,0,0,0,11.32-11.32ZM208,40H160a8,8,0,0,0-5.66,13.66L172.69,72,146.34,98.34a8,8,0,0,0,11.32,11.32L184,83.31l18.34,18.35A8,8,0,0,0,216,96V48A8,8,0,0,0,208,40Zm3.06,112.61a8,8,0,0,0-8.72,1.73L184,172.69l-26.34-26.35a8,8,0,0,0-11.32,11.32L172.69,184l-18.35,18.34A8,8,0,0,0,160,216h48a8,8,0,0,0,8-8V160A8,8,0,0,0,211.06,152.61Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M214,48V96a6,6,0,0,1-12,0V62.48l-45.76,45.76a6,6,0,0,1-8.48-8.48L193.52,54H160a6,6,0,0,1,0-12h48A6,6,0,0,1,214,48ZM99.76,147.76,54,193.52V160a6,6,0,0,0-12,0v48a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12H62.48l45.76-45.76a6,6,0,0,0-8.48-8.48ZM208,154a6,6,0,0,0-6,6v33.52l-45.76-45.76a6,6,0,0,0-8.48,8.48L193.52,202H160a6,6,0,0,0,0,12h48a6,6,0,0,0,6-6V160A6,6,0,0,0,208,154ZM62.48,54H96a6,6,0,0,0,0-12H48a6,6,0,0,0-6,6V96a6,6,0,0,0,12,0V62.48l45.76,45.76a6,6,0,0,0,8.48-8.48Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M212,48V96a4,4,0,0,1-8,0V57.66l-49.17,49.17a4,4,0,0,1-5.66-5.66L198.34,52H160a4,4,0,0,1,0-8h48A4,4,0,0,1,212,48ZM101.17,149.17,52,198.34V160a4,4,0,0,0-8,0v48a4,4,0,0,0,4,4H96a4,4,0,0,0,0-8H57.66l49.17-49.17a4,4,0,0,0-5.66-5.66ZM208,156a4,4,0,0,0-4,4v38.34l-49.17-49.17a4,4,0,0,0-5.66,5.66L198.34,204H160a4,4,0,0,0,0,8h48a4,4,0,0,0,4-4V160A4,4,0,0,0,208,156ZM57.66,52H96a4,4,0,0,0,0-8H48a4,4,0,0,0-4,4V96a4,4,0,0,0,8,0V57.66l49.17,49.17a4,4,0,0,0,5.66-5.66Z`}))]]),ui=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,160H48l80-80Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z`}))]]),di=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M172,108a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,108Zm-12,28H96a12,12,0,0,0,0,24h64a12,12,0,0,0,0-24Zm76-8A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-4-1.08,7.85,7.85,0,0,0-2.53.42L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Zm40-104a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,144Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm32,128H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M166,112a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm-6,26H96a6,6,0,0,0,0,12h64a6,6,0,0,0,0-12Zm70-10A102,102,0,0,1,79.31,217.65L44.44,229.27a14,14,0,0,1-17.71-17.71l11.62-34.87A102,102,0,1,1,230,128Zm-12,0A90,90,0,1,0,50.08,173.06a6,6,0,0,1,.5,4.91L38.12,215.35a2,2,0,0,0,2.53,2.53L78,205.42a6.2,6.2,0,0,1,1.9-.31,6.09,6.09,0,0,1,3,.81A90,90,0,0,0,218,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M168,112a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm-8,24H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16Zm72-8A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-16,0A88,88,0,1,0,51.81,172.06a8,8,0,0,1,.66,6.54L40,216,77.4,203.53a7.85,7.85,0,0,1,2.53-.42,8,8,0,0,1,4,1.08A88,88,0,0,0,216,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M164,112a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm-4,28H96a4,4,0,0,0,0,8h64a4,4,0,0,0,0-8Zm68-12A100,100,0,0,1,79.5,215.47l-35.69,11.9a12,12,0,0,1-15.18-15.18l11.9-35.69A100,100,0,1,1,228,128Zm-8,0A92,92,0,1,0,48.35,174.07a4,4,0,0,1,.33,3.27L36.22,214.72a4,4,0,0,0,5.06,5.06l37.38-12.46a3.93,3.93,0,0,1,1.27-.21,4.05,4.05,0,0,1,2,.54A92,92,0,0,0,220,128Z`}))]]),fi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z`}))]]),pi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M140,80v41.21l34.17,20.5a12,12,0,1,1-12.34,20.58l-40-24A12,12,0,0,1,116,128V80a12,12,0,0,1,24,0ZM128,28A99.38,99.38,0,0,0,57.24,57.34c-4.69,4.74-9,9.37-13.24,14V64a12,12,0,0,0-24,0v40a12,12,0,0,0,12,12H72a12,12,0,0,0,0-24H57.77C63,86,68.37,80.22,74.26,74.26a76,76,0,1,1,1.58,109,12,12,0,0,0-16.48,17.46A100,100,0,1,0,128,28Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128A96,96,0,0,1,62.11,197.82a8,8,0,1,1,11-11.64A80,80,0,1,0,71.43,71.43C67.9,75,64.58,78.51,61.35,82L77.66,98.34A8,8,0,0,1,72,112H32a8,8,0,0,1-8-8V64a8,8,0,0,1,13.66-5.66L50,70.7c3.22-3.49,6.54-7,10.06-10.55A96,96,0,0,1,224,128ZM128,72a8,8,0,0,0-8,8v48a8,8,0,0,0,3.88,6.86l40,24a8,8,0,1,0,8.24-13.72L136,123.47V80A8,8,0,0,0,128,72Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M134,80v44.6l37.09,22.25a6,6,0,0,1-6.18,10.3l-40-24A6,6,0,0,1,122,128V80a6,6,0,0,1,12,0Zm-6-46A93.4,93.4,0,0,0,61.51,61.56c-8.58,8.68-16,17-23.51,25.8V64a6,6,0,0,0-12,0v40a6,6,0,0,0,6,6H72a6,6,0,0,0,0-12H44.73C52.86,88.29,60.79,79.35,70,70a82,82,0,1,1,1.7,117.62,6,6,0,1,0-8.24,8.72A94,94,0,1,0,128,34Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M132,80v45.74l38.06,22.83a4,4,0,0,1-4.12,6.86l-40-24A4,4,0,0,1,124,128V80a4,4,0,0,1,8,0Zm-4-44A91.42,91.42,0,0,0,62.93,63C53.05,73,44.66,82.47,36,92.86V64a4,4,0,0,0-8,0v40a4,4,0,0,0,4,4H72a4,4,0,0,0,0-8H40.47C49.61,89,58.3,79,68.6,68.6a84,84,0,1,1,1.75,120.49,4,4,0,1,0-5.5,5.82A92,92,0,1,0,128,36Z`}))]]),mi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),hi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,44H32A20,20,0,0,0,12,64V192a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V64A20,20,0,0,0,224,44Zm-4,144H36V68H220ZM52,128a12,12,0,0,1,12-12H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,128Zm0-36A12,12,0,0,1,64,80H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,92Zm0,72a12,12,0,0,1,12-12h8a12,12,0,0,1,0,24H64A12,12,0,0,1,52,164Zm108,0a12,12,0,0,1-12,12H108a12,12,0,0,1,0-24h40A12,12,0,0,1,160,164Zm44,0a12,12,0,0,1-12,12h-8a12,12,0,0,1,0-24h8A12,12,0,0,1,204,164Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M232,64V192a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H224A8,8,0,0,1,232,64Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48ZM64,168H48a8,8,0,0,1,0-16H64a8,8,0,0,1,0,16Zm96,0H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm48,0H192a8,8,0,0,1,0-16h16a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,50H32A14,14,0,0,0,18,64V192a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V64A14,14,0,0,0,224,50Zm2,142a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H224a2,2,0,0,1,2,2Zm-20-64a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,128Zm0-32a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,96ZM70,160a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12h8A6,6,0,0,1,70,160Zm96,0a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,160Zm40,0a6,6,0,0,1-6,6h-8a6,6,0,0,1,0-12h8A6,6,0,0,1,206,160Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,52H32A12,12,0,0,0,20,64V192a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V64A12,12,0,0,0,224,52Zm4,140a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H224a4,4,0,0,1,4,4Zm-24-64a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,128Zm0-32a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,96ZM68,160a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8h8A4,4,0,0,1,68,160Zm96,0a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,160Zm40,0a4,4,0,0,1-4,4h-8a4,4,0,0,1,0-8h8A4,4,0,0,1,204,160Z`}))]]),gi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,64V192H88V64Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM68,188a12,12,0,1,1,12-12A12,12,0,0,1,68,188Zm0-48a12,12,0,1,1,12-12A12,12,0,0,1,68,140Zm0-48A12,12,0,1,1,80,80,12,12,0,0,1,68,92Zm124,92H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M82,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H88A6,6,0,0,1,82,64Zm134,58H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Zm0,64H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12ZM44,54A10,10,0,1,0,54,64,10,10,0,0,0,44,54Zm0,128a10,10,0,1,0,10,10A10,10,0,0,0,44,182Zm0-64a10,10,0,1,0,10,10A10,10,0,0,0,44,118Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M84,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H88A4,4,0,0,1,84,64Zm132,60H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Zm0,64H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8ZM44,120a8,8,0,1,0,8,8A8,8,0,0,0,44,120Zm0-64a8,8,0,1,0,8,8A8,8,0,0,0,44,56Zm0,128a8,8,0,1,0,8,8A8,8,0,0,0,44,184Z`}))]]),_i=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M28,64A12,12,0,0,1,40,52H216a12,12,0,0,1,0,24H40A12,12,0,0,1,28,64Zm12,76h64a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24Zm80,40H40a12,12,0,0,0,0,24h80a12,12,0,0,0,0-24Zm120.49,20.49a12,12,0,0,1-17,0l-18.08-18.08a44,44,0,1,1,17-17l18.08,18.07A12,12,0,0,1,240.49,200.49ZM184,164a20,20,0,1,0-20-20A20,20,0,0,0,184,164Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,2.34L217.36,166A40,40,0,1,0,206,177.36l20.3,20.3a8,8,0,0,0,11.32-11.32Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M34,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H40A6,6,0,0,1,34,64Zm6,70h72a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12Zm88,52H40a6,6,0,0,0,0,12h88a6,6,0,0,0,0-12Zm108.24,10.24a6,6,0,0,1-8.48,0l-21.49-21.48a38.06,38.06,0,1,1,8.49-8.49l21.48,21.49A6,6,0,0,1,236.24,196.24ZM184,170a26,26,0,1,0-26-26A26,26,0,0,0,184,170Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M36,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H40A4,4,0,0,1,36,64Zm4,68h72a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8Zm88,56H40a4,4,0,0,0,0,8h88a4,4,0,0,0,0-8Zm106.83,6.83a4,4,0,0,1-5.66,0l-22.72-22.72a36.06,36.06,0,1,1,5.66-5.66l22.72,22.72A4,4,0,0,1,234.83,194.83ZM184,172a28,28,0,1,0-28-28A28,28,0,0,0,184,172Z`}))]]),vi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M156,112a12,12,0,0,1-12,12H80a12,12,0,0,1,0-24h64A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H80a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M150,112a6,6,0,0,1-6,6H80a6,6,0,0,1,0-12h64A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M148,112a4,4,0,0,1-4,4H80a4,4,0,0,1,0-8h64A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z`}))]]),yi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M230.47,67.5a12,12,0,0,0-19.26-4.32L172.43,99l-12.68-2.72L157,83.57l35.79-38.78a12,12,0,0,0-4.32-19.26A76.07,76.07,0,0,0,88.41,121.64L30.92,174.18a4.68,4.68,0,0,0-.39.38,36,36,0,0,0,50.91,50.91l.38-.39,52.54-57.49A76.05,76.05,0,0,0,230.47,67.5ZM160,148a51.5,51.5,0,0,1-23.35-5.52,12,12,0,0,0-14.26,2.62L64.31,208.66a12,12,0,0,1-17-17l63.55-58.07a12,12,0,0,0,2.62-14.26A51.5,51.5,0,0,1,108,96a52.06,52.06,0,0,1,52-52h.89L135.17,71.87a12,12,0,0,0-2.91,10.65l5.66,26.35a12,12,0,0,0,9.21,9.21l26.35,5.66a12,12,0,0,0,10.65-2.91L212,95.12c0,.3,0,.59,0,.89A52.06,52.06,0,0,1,160,148Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,96a64,64,0,0,1-94.94,56L73,217A24,24,0,0,1,39,183L104,126.94a64,64,0,0,1,80-90.29L144,80l5.66,26.34L176,112l43.35-40A63.8,63.8,0,0,1,224,96Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M232,96a72,72,0,0,1-100.94,66L79,222.22c-.12.14-.26.29-.39.42a32,32,0,0,1-45.26-45.26c.14-.13.28-.27.43-.39L94,124.94a72.07,72.07,0,0,1,83.54-98.78,8,8,0,0,1,3.93,13.19L144,80l5.66,26.35L176,112l40.65-37.52a8,8,0,0,1,13.19,3.93A72.6,72.6,0,0,1,232,96Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224.91,69.75a6,6,0,0,0-9.63-2.16l-41.07,37.9L154.7,101.3l-4.19-19.51,37.9-41.07a6,6,0,0,0-2.16-9.63,70,70,0,0,0-89.77,94.39l-61.39,53c-.11.09-.21.19-.32.3A30,30,0,0,0,77.2,221.23c.11-.11.21-.21.3-.32l53-61.39a70,70,0,0,0,94.39-89.77ZM160,154a58,58,0,0,1-28-7.22,6,6,0,0,0-7.45,1.33L68.57,212.88a18,18,0,0,1-25.45-25.45l64.76-55.94A6,6,0,0,0,109.2,124a58,58,0,0,1,64-84.53L139.58,75.93a6,6,0,0,0-1.45,5.33l5.65,26.35a6,6,0,0,0,4.61,4.61l26.35,5.65a6,6,0,0,0,5.33-1.45L216.49,82.8A58.06,58.06,0,0,1,160,154Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M223.05,70.5a4,4,0,0,0-6.42-1.44l-41.82,38.6L153,103l-4.68-21.79,38.6-41.82a4,4,0,0,0-1.44-6.43A68,68,0,0,0,98.94,126L36.4,180l-.21.2a28,28,0,0,0,39.6,39.6l.2-.21,54-62.54A68,68,0,0,0,228,96,67.51,67.51,0,0,0,223.05,70.5ZM160,156a60,60,0,0,1-29-7.47,4,4,0,0,0-5,.89L70,214.25A20,20,0,0,1,41.75,186l64.82-56a4,4,0,0,0,.89-5,60,60,0,0,1,69.46-86.59L141.05,77.29a4,4,0,0,0-1,3.55l5.66,26.35a4,4,0,0,0,3.07,3.07l26.35,5.66a4,4,0,0,0,3.55-1l38.87-35.87A60.05,60.05,0,0,1,160,156Z`}))]]),bi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:si}));bi.displayName=`ArrowClockwiseIcon`;var xi=bi,Si=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:ci}));Si.displayName=`ArrowCounterClockwiseIcon`;var Ci=Si,wi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:li}));wi.displayName=`ArrowsOutIcon`;var Ti=wi,Ei=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:ui}));Ei.displayName=`CaretUpIcon`;var Di=Ei,Oi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:di}));Oi.displayName=`ChatCircleTextIcon`;var ki=Oi,Ai=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:fi}));Ai.displayName=`ClockIcon`;var ji=Ai,Mi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:pi}));Mi.displayName=`ClockCounterClockwiseIcon`;var Ni=Mi,Pi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:mi}));Pi.displayName=`InfoIcon`;var Fi=Pi,Ii=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:hi}));Ii.displayName=`KeyboardIcon`;var Li=Ii,Ri=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:gi}));Ri.displayName=`ListBulletsIcon`;var zi=Ri,Bi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:_i}));Bi.displayName=`ListMagnifyingGlassIcon`;var Vi=Bi,Hi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:vi}));Hi.displayName=`MagnifyingGlassMinusIcon`;var Ui=Hi,Wi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:yi}));Wi.displayName=`WrenchIcon`;var Gi=Wi,Ki=i(b(),1),qi=`$__all`;function Ji(e,t,n){if(e.kind===`constant`)return e.value??``;let r=e.kind===`custom`?e.options?.map(e=>({value:e}))??[]:n===null?[]:n,i=t[e.name],a=!e.multi&&Array.isArray(i)&&i.length===0?void 0:i;if(a===`$__all`){if(e.include_all)return qi}else if(a!==void 0){if(e.kind===`text`||r===void 0)return a;let t=new Set(r.map(e=>e.value));if(Array.isArray(a)){if(a.length===0&&e.multi)return[];let n=a.filter(e=>t.has(e));if(n.length>0)return n}else if(t.has(a))return a}return e.default?e.default:e.include_all?qi:r?.[0]?.value??``}var Yi=(e,t)=>e.replace(/\$([a-z][a-z0-9_]*)/g,(e,n)=>{let r=t[n];return r===void 0?e:r===`$__all`?`all`:Array.isArray(r)?r.join(`, `):r});function Xi(e,t,n){let r={};for(let i of e??[]){let e=Ji(i,t,n?.[i.name]);(i.kind!==`query`||e!==``)&&(r[i.name]=e)}return r}function Zi(e){return Array.from({length:e.rows},(t,n)=>Object.fromEntries(e.columns.map((t,r)=>{let i=e.values[r]?.[n]??null;return[t.name,typeof i==`number`&&!Number.isFinite(i)?null:i]})))}function Qi(e,t){return e.viz!==`logs`||!t||t.rows<2?[]:t.columns.flatMap((e,n)=>{if(e.role!==`dimension`||e.type!==`string`||[`body`,`body_template`,`severity`,`status`].includes(e.name)||/(^id$|_id$)/.test(e.name))return[];let r=t.values[n][0];return typeof r==`string`&&r!==``&&t.values[n].slice(0,t.rows).every(e=>e===r)?[{name:e.name,value:r}]:[]})}function $i(e,t){let n=t.frame??{columns:[],values:[],rows:0};return{columns:n.columns.map(e=>e.name),rows:Zi(n),selection:t=>{let n={};for(let r of e.query?.by??[]){let e=r.startsWith(`attributes[`)||r.startsWith(`resource[`)?r.slice(r.indexOf(`'`)+1,r.lastIndexOf(`'`)):r;t[e]!==void 0&&t[e]!==null&&(n[r]=String(t[e]))}return{time:typeof t.time==`number`?t.time:typeof t.start==`number`?t.start:void 0,dimensions:n,trace_id:typeof t.trace_id==`string`?t.trace_id:void 0,namespace:typeof t.namespace==`string`?t.namespace:void 0}}}}function ea(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}var ta=e=>e.map(ea).join(`
`);function na(e,t=!1){return n=>{let r=Array.isArray(n)?n:[n];return ta([...r[0]?.axisValueLabel?[r[0].axisValueLabel]:[],...r.map(n=>{let r=n.value,i=Array.isArray(r)?t?r.slice(1):r:[r];return`${n.seriesName??``}${n.name?` · ${n.name}`:``}: ${i.map(t=>typeof t==`number`?e(t,n.seriesName):String(t??`—`)).join(` · `)}`})])}}var ra=e=>/^Other(?: \(\d+\))?$/.test(e??``);function ia(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ra(e.name)),i=r.slice(0,n).map(e=>({name:e.name,items:[e]})),a=[...e.filter(e=>ra(e.name)),...r.slice(n)];return a.length&&i.push({name:a.length===1&&ra(a[0].name)?a[0].name:`Other (${a.reduce((e,t)=>e+(ra(t.name)?Number(t.name.match(/\d+/)?.[0]??1):1),0)})`,items:a}),i}function aa(e){let t=e.filter(e=>e!==null);return t.length?t.reduce((e,t)=>e+t,0):null}function oa(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ra(e.name));return{shown:[...r.slice(0,n),...e.filter(e=>ra(e.name))],hidden:Math.max(0,r.length-n)}}function sa(e,t){return e>0?[{type:`text`,right:8,bottom:2,silent:!0,style:{text:`${e} more series not shown`,fill:t,fontSize:11}}]:[]}function ca(e,t,n,r,i=`sans-serif`,a){let o=e=>Array.from(e).length>24?`${Array.from(e).slice(0,23).join(``)}…`:e,s=Math.max(1,t-16),c=1,l=0;for(let t of e){let e=15+(a?.(o(t),`12px ${i}`)??Array.from(o(t)).length*7.2);l&&l+10+e>s&&(c++,l=0),l+=(l?10:0)+e}let u=c>2;return{top:n?u?30:c*20+2:12,option:{type:u?`scroll`:`plain`,show:n,top:0,left:0,right:0,padding:0,itemGap:6,icon:`roundRect`,itemWidth:10,itemHeight:10,itemStyle:{borderColor:r,borderWidth:1},textStyle:{color:r,fontSize:12,lineHeight:14},data:e,formatter:o,tooltip:{show:!0,renderMode:`html`,formatter:e=>ea(e.name)}}}}function la(e,t){if(!(!Number.isFinite(e)||!Number.isFinite(t)||e>=t||Math.abs(e)>864e13||Math.abs(t)>864e13))return{from:new Date(Math.floor(e)).toISOString(),to:new Date(Math.ceil(t)).toISOString()}}function ua(e){let t=[e.time?.range?`Range ${e.time.range}`:void 0,e.time?.shift?`Shifted ${e.time.shift}`:void 0].filter(Boolean);return t.length?t.join(` · `):void 0}function da(e,t,n){if(n.interactive===!1||n.data?.value===null)return;let r=n.data?.selection;if(r)return Object.values(r.dimensions).some(ra)?void 0:r;if(ra(n.seriesName)||ra(n.name)||n.value===null||Array.isArray(n.value)&&n.value.at(-1)==null)return;let i=e.query?.by?.[0]??t.frame?.columns.find(e=>e.role===`dimension`)?.name,a=e.viz===`timeseries`?n.seriesName:n.name,o=Array.isArray(n.value)?n.value:[];return{time:e.viz===`timeseries`&&typeof o[0]==`number`?o[0]:void 0,dimensions:i&&a?{[i]:a}:{}}}var fa=new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}),pa=new Intl.NumberFormat(`en`,{maximumFractionDigits:2});function ma(e){return Math.abs(e)<1e-4?e.toExponential(2).replace(/\.?(0+)(?=e)/,``):String(Number(e.toPrecision(3)))}function ha(e,t=pa){return e!==0&&Math.abs(e)<1?ma(e):t.format(e)}function ga(e,t){let n=t===`s`?e*1e3:t===`ns`?e/1e6:e;return e!==0&&n===0?`${ma(e)}${t}`:n!==0&&Math.abs(n)<1?`${ma(n)}ms`:ye(n)}function _a(e){let t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],n=e,r=0;for(;Math.abs(n)>=1024&&r=1e4?fa:pa);default:return ha(t,Math.abs(t)>=1e4?fa:pa)}}function ya(e){return t=>e===`ms`||e===`s`||e===`ns`?va(e,t).replace(/(\.\d*?)0+([a-z]*)$/,`$1$2`).replace(/\.([a-z]*)$/,`$1`):va(e,t)}function ba(e,t){return ya(e)(t??NaN).replace(/(?<=\d)(ms|ns|s|m|h)\b/g,` $1`)}function xa(e){return Math.max(3,Math.min(10,Math.round(e/70)))-1}function Sa(e,t){let n=t===`ms`?1:t===`s`?1e3:t===`ns`?1e-6:void 0,r=e=>{let t=10**Math.floor(Math.log10(e));return[1,2,5,10].map(e=>e*t).find(t=>t>=e)};if(n===void 0)return r(e);let i=e*n,a=[1,10,100,1e3,1e4,6e4,6e5,36e5,36e6].flatMap(e=>[1,2,5].map(t=>e*t)).sort((e,t)=>e-t);return(i<1?r(i):a.find(e=>e>=i)??r(i/36e5)*36e5)/n}function Ca(e,t,n,r){e=Number.isFinite(e)?Math.min(0,e):0,t=Number.isFinite(t)?Math.max(0,t):1,t===e&&(t=e+1);let i=xa(r),a=Sa(Math.max(t-e,2**-52)/i,n);for(;Math.ceil(t/a)-Math.floor(e/a)>i;)a=Sa(a*1.01,n);return{min:Math.floor(e/a)*a,max:Math.ceil(t/a)*a,interval:a,splitNumber:i,fanout_unit:n}}function wa(e,t){return e.type!==`value`&&e.type!==`log`?e:{...e,...e.type===`value`&&typeof e.min==`number`&&typeof e.max==`number`?Ca(e.min,e.max,typeof e.fanout_unit==`string`?e.fanout_unit:void 0,t):{splitNumber:xa(t)}}}function Ta(e,t,n){let r=e=>va(n,e),i=``;if(n===`ms`||n===`s`||n===`ns`){let a=n===`s`?1e3:n===`ns`?1e-6:1,o=Math.abs((e??t??0)*a),s=o>=6e4?6e4:o>=1e3?1e3:1;i=s===6e4?` min`:s===1e3?` s`:` ms`;let c=s===6e4?1:s===1e3?+(o<1e4):2,l=new Intl.NumberFormat(void 0,{maximumFractionDigits:c});r=e=>l.format(e*a/s)}return t===null&&e!==null?`≥${r(e)}${i}`:(e===null||e===0)&&t!==null?`<${r(t)}${i}`:`${e===null?`−∞`:r(e)}–${t===null?`∞`:r(t)}${i}`}function Ea(e){let t=new Date(e);return t.getHours()===0&&t.getMinutes()===0&&t.getSeconds()===0?t.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}function Da(e,t=new Date,n){let r=new Date(e);if(!Number.isFinite(r.getTime()))return`—`;let i=new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,...r.getFullYear()===t.getFullYear()?{}:{year:`numeric`},hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).formatToParts(r),a=i.filter(e=>[`month`,`day`,`year`].includes(e.type)).map(e=>e.value),o=i.filter(e=>[`hour`,`minute`,`second`].includes(e.type)).map(e=>e.value);return`${a.join(` `)} ${o.join(`:`)}`}function Oa({panel:e,result:t}){let n=t?.frame;return(0,H.jsxs)(`div`,{"data-panel-data":!0,children:[t?.error&&(0,H.jsx)(T,{"data-panel-error-detail":!0,size:`sm`,role:`status`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,userSelect:`text`},children:t.error}),n?(0,H.jsxs)(be,{fz:12,striped:!0,children:[(0,H.jsx)(be.Thead,{children:(0,H.jsx)(be.Tr,{children:n.columns.map(e=>(0,H.jsx)(be.Th,{ff:wt.display,children:e.name},e.name))})}),(0,H.jsx)(be.Tbody,{children:Array.from({length:Math.min(n.rows,500)},(t,r)=>(0,H.jsx)(be.Tr,{children:n.columns.map((t,i)=>{let a=n.values[i][r];return(0,H.jsx)(be.Td,{ff:wt.display,children:a===null?`—`:t.type===`time`?new Date(Number(a)).toISOString():t.role===`measure`?va(t.unit??e.unit,Number(a)):String(a)},t.name)})},r))})]}):(0,H.jsx)(T,{c:`dimmed`,size:`sm`,children:`No data.`}),(0,H.jsxs)(T,{c:`dimmed`,fz:12,mt:8,children:[`Ran in `,t?.elapsed_ms??0,` ms`,t?.interval?`, one point per ${t.interval}`:``,n?`, ${n.rows} rows${n.truncated?` (truncated)`:``}`:``,`.`]}),(t?.sql??e.sql)&&(0,H.jsx)(Re,{block:!0,tabIndex:0,mt:8,children:t?.sql??e.sql})]})}function ka({panel:e,dark:t}){let n=JSON.stringify(e,null,2).split(/("(?:[^"\\]|\\.)*"(?=\s*:)|"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?)/g);return(0,H.jsx)(`pre`,{"data-panel-spec":!0,style:{margin:0,fontFamily:wt.display,fontSize:12,color:ft[t?`dark`:`light`].text},children:n.map((e,r)=>{let i=e.startsWith(`"`)&&/^\s*:/.test(n[r+1]??``)?`key`:e.startsWith(`"`)?`string`:/^(true|false|null)$/.test(e)?`literal`:/^-?\d/.test(e)?`number`:`punctuation`,a=i===`key`?_t[t?4:7]:i===`string`?mt[t?4:8]:i===`number`||i===`literal`?Dt[t?4:8]:void 0;return i===`punctuation`?e:(0,H.jsx)(`span`,{"data-json-token":i,style:{color:a},children:e},r)})})}function Aa(e){let t=e.event.data?.selection,n=e.event.value;return JSON.stringify([e.event.seriesName,e.event.name,t?.from??t?.time??(Array.isArray(n)?n[0]:void 0),t?.dimensions,t?.bucket])}function ja(e){let t=new Date().toISOString().slice(0,10),n=e.from.slice(0,10),r=e.to.slice(0,10),i=e=>e.slice(11,-1).replace(/\.000$/,``);return`${(n===t?``:n+` `)+i(e.from)} – ${(r!==n&&r!==t?r+` `:``)+i(e.to)} UTC · ${ye(Date.parse(e.to)-Date.parse(e.from))}`}var Ma={background:`color-mix(in srgb, var(--mantine-color-body) 92%, transparent)`,border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`,padding:`2px 6px`};function Na(e){return e.replace(`Enter drill`,`↵ drill`).replace(`Shift+←→`,`⇧←→`)}var Pa=(0,V.createContext)(void 0);function Fa({points:e,label:t,summary:n,children:r,onClick:i,canSelect:a,onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d,rangeReset:f,height:p=`100%`,onZoom:m,bounds:h,pointWindow:g}){let[_,v]=(0,V.useState)(!1),[b,x]=(0,V.useState)(``),[S,w]=(0,V.useState)(),[E,D]=(0,V.useState)(null),O=(0,V.useRef)(null),k=(0,V.useRef)(!1);(0,V.useEffect)(()=>{let e=e=>{e.key===`Tab`&&(k.current=!1)};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[]);let A=(0,V.useId)(),j=(0,V.useContext)(Pa),M=(0,V.useRef)(null),N=(0,V.useRef)({onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d});N.current={onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d};let P=(0,V.useMemo)(()=>new Map(e.map(e=>[Aa(e),e])),[e]),F=(0,V.useRef)(void 0),I=e=>g?.(e)?.from??e.event.name??(Array.isArray(e.event.value)?e.event.value[0]:void 0),L=F.current,ee=L?e.filter(e=>e.event.seriesName===L.event.seriesName):e,R=ee.length?ee:e,te=L&&I(L),ne=typeof te==`number`?R.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-te)I(e)===te),re=S?P.get(S)??ne??R[0]??e[0]:e[0],ie=!!(m&&h&&Number.isFinite(h.from)&&Number.isFinite(h.to)&&h.from[...new Set(e.map(e=>e.event.seriesName))],[e]),ae=(0,V.useMemo)(()=>e.filter(e=>e.event.seriesName===re?.event.seriesName),[e,re?.event.seriesName]),B=re?ae.indexOf(re):-1;(0,V.useEffect)(()=>{re&&(!S||P.has(S)||!ee.length)&&(F.current=re,(!S||!ee.length)&&w(Aa(re))),_&&N.current.onHighlight(re)},[re,S,_]),(0,V.useEffect)(()=>{if(!E)return;let e=Date.parse(E.from),t=Date.parse(E.to);h&&(Number.isFinite(e)&&eh.to)&&D(null)},[h?.from,h?.to,E]),(0,V.useEffect)(()=>{N.current.onRangePending?.(!!E)},[!!E]),(0,V.useEffect)(()=>{N.current.onRangeChange?.(E?{from:Date.parse(E.from),to:Date.parse(E.to)}:void 0)},[E]),(0,V.useEffect)(()=>{D(null)},[f]),(0,V.useEffect)(()=>()=>{N.current.onHighlight(void 0),N.current.onRangePending?.(!1),N.current.onRangeChange?.(void 0)},[]);let oe=(e,t=!1)=>{if(e){if(x(n(e)),t&&ie&&re){let t=E?.anchor??Aa(re),n=P.get(t),r=E?.window??(n&&g?.(n)),i=g?.(e);if(r&&i){let e=Math.max(h.from,Math.min(r.from,i.from)),n=Math.min(h.to,Math.max(r.to,i.to));Number.isFinite(e)&&Number.isFinite(n)&&e{if(!re)return;let n=z[Math.max(0,Math.min(z.length-1,z.indexOf(re.event.seriesName)+t))],r=e.filter(e=>e.event.seriesName===n),i=I(re),a=r.find(e=>I(e)===i),o=typeof i==`number`?r.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-i){e===`ArrowLeft`||e===`ArrowRight`?oe(ae[Math.max(0,Math.min(ae.length-1,B+(e===`ArrowLeft`?-1:1)))],t):!t&&(e===`ArrowUp`||e===`ArrowDown`)?se(e===`ArrowUp`?-1:1):!t&&(e===`Home`||e===`End`)&&oe(e===`Home`?ae[0]:ae.at(-1))},le=()=>{D(null),O.current?.focus()},ue=ie?`←→ points · ↑↓ series · Enter drill · Shift+←→ range`:`←→ points · ↑↓ series · Enter drill`;return(0,V.useLayoutEffect)(()=>(j?.setHint(_?ue:void 0),()=>j?.setHint(void 0)),[j,_,ue]),(0,V.useLayoutEffect)(()=>{let e=M.current;if(!e)return;N.current.onRangeBarHeight?.(e.getBoundingClientRect().height);let t=new ResizeObserver(([t])=>{if(!t)return;let n=getComputedStyle(e),r=[n.paddingTop,n.paddingBottom,n.borderTopWidth,n.borderBottomWidth].reduce((e,t)=>e+(parseFloat(t)||0),0);N.current.onRangeBarHeight?.(t.borderBoxSize?.[0]?.blockSize??t.contentRect.height+r)});return t.observe(e),()=>{t.disconnect(),N.current.onRangeBarHeight?.(0)}},[!!(E&&ie)]),(0,H.jsxs)(o,{ref:O,"data-chart-plot":!0,tabIndex:0,role:`application`,"aria-roledescription":`chart`,"aria-label":t,"aria-describedby":A,"data-mantine-stop-propagation":E?`true`:void 0,className:`chart-keyboard-point`,style:{position:`relative`,height:p,width:`100%`,flex:`1 1 auto`,minHeight:0,minWidth:0},onPointerDownCapture:e=>{M.current?.contains(e.target)||(k.current=!0,v(!1),_&&N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onFocus:e=>{e.target!==e.currentTarget||k.current||(N.current.onActiveChange?.(!0),v(!0))},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(v(!1),D(null),x(``),N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onKeyDown:e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey||e.nativeEvent.isComposing)return;if(e.key===`Escape`&&!e.repeat){E?(e.preventDefault(),e.stopPropagation(),le()):e.target===e.currentTarget&&!e.currentTarget.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`)&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.blur());return}if(e.target!==e.currentTarget||e.repeat&&![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key))return;let t=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key);if(t&&!_&&(k.current=!1,v(!0),N.current.onActiveChange?.(!0),!re)){e.preventDefault();return}e.key===`Enter`&&_&&!e.shiftKey&&re&&i&&(!a||a(re.event))?(e.preventDefault(),i(re.event)):t&&(!e.shiftKey||e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),ce(e.key,e.shiftKey))},children:[r,(0,H.jsx)(o,{"data-chart-overlay":!0,style:{position:`absolute`,inset:0,zIndex:1,pointerEvents:`none`,overflow:`hidden`},children:E&&ie&&(0,H.jsxs)(y,{ref:M,"data-chart-range-bar":!0,gap:6,style:{...Ma,position:`absolute`,bottom:4,left:4,right:4,maxHeight:`100%`,overflow:`auto`,pointerEvents:`auto`},children:[(0,H.jsx)(T,{"data-chart-range-label":!0,size:`xs`,title:E.from+` – `+E.to,truncate:!0,style:{flex:`1 1 140px`,minWidth:0},children:ja(E)}),(0,H.jsx)(C,{size:`compact-xs`,"data-mantine-stop-propagation":`true`,onClick:()=>{m(Date.parse(E.from),Date.parse(E.to)),le()},children:`Zoom to range`}),(0,H.jsx)(C,{size:`compact-xs`,variant:`subtle`,"data-mantine-stop-propagation":`true`,onClick:le,children:`Cancel`})]})}),(0,H.jsx)(Ve,{id:A,children:ue}),(0,H.jsx)(Ve,{"aria-live":`polite`,"aria-atomic":`true`,children:b})]})}var Ia=new Set([`id`,`http`,`https`,`rpc`,`grpc`,`cpu`,`sql`,`url`,`uri`,`ip`,`io`,`db`,`gc`,`tls`,`api`]),La={ms:`ms`,ns:`ns`,s:`s`,us:`µs`,bytes:`bytes`,percent:`%`,ratio:`ratio`,per_second:`/s`,per_minute:`/min`},Ra={body_template:`message template`,parquet_index:`traces`};function za(e,t){let n=typeof e==`string`?e:e.name,r=t?.options?.columns?.find(e=>e.field===n)?.unit??(typeof e==`string`?void 0:e.unit)??(typeof e!=`string`&&e.role===`measure`?t?.unit:void 0),i=Ra[n]??n;/\b(?:duckdb|parquet|sqlite|variant|timestamptz_ns|timestamp_ns)\b|\btelemetry\./i.test(i)&&(i=`value`),i=i.replace(/^(\w+)\(([^()]*)\)$/,(e,t,n)=>[t,n].filter(Boolean).join(`_`));let a=i.match(/_(ms|ns|us|s|bytes|percent)$/i);a&&(i=i.slice(0,-a[0].length));let o=r??a?.[1]?.toLowerCase();return i=i.split(`_`).map((e,t)=>/^p\d+$/i.test(e)||Ia.has(e.toLowerCase())?e.toUpperCase():t===0?e.charAt(0).toUpperCase()+e.slice(1):e).join(` `),i+(o&&o!==`none`&&o!==`count`?` (${La[o]??o})`:``)}function Ba(e){return e===`healthy`?`ok`:e===`degraded`?`warn`:e===`unknown`?`gray`:`bad`}function Va(e){return ft[e?`dark`:`light`]}function Ha(e){let t=e?5:7;return{ok:mt[t],warn:ht[t],bad:Et[t],info:Dt[t]}}function Ua(e,t){return xt[t?`dark`:`light`][e]??Va(t).muted}function Wa(e){return e===`unhealthy`?`diamond`:e===`degraded`?`roundRect`:`circle`}function Ga(e){return e===`unknown`?`dashed`:`solid`}var Ka=e=>typeof e==`number`&&Number.isFinite(e)?e:null;function qa(e){return e.columns.flatMap((e,t)=>e.role===`measure`?[t]:[])}function Ja(e){let t=e.columns.findIndex(e=>e.role===`time`);if(t<0)return[];let n=e.columns.findIndex(e=>e.role===`dimension`),r=qa(e);if(n>=0&&r.length>0){let i=r[0],a=new Map;for(let r=0;r({name:e.columns[n].name,unit:e.columns[n].unit,points:e.values[t].map((t,r)=>[Number(t),Ka(e.values[n][r])])}))}function Ya(e){let t=e.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),n=qa(e);if(t.length===0||n.length===0)return{categories:[],series:[]};let r=t[0],i=[];for(let t=0;t1){let a=t[1],o=n[0],s=new Map;for(let t=0;tnull)),s.get(n)[i.indexOf(String(e.values[r][t]??``))]=Ka(e.values[o][t])}return{categories:i,series:[...s.entries()].map(([t,n])=>({name:t,unit:e.columns[o].unit,values:n}))}}return{categories:i,series:n.map(t=>({name:e.columns[t].name,unit:e.columns[t].unit,values:e.values[t].map(Ka)}))}}function Xa(e,t){let n=e.filter(e=>e!==null);if(n.length===0)return null;switch(t){case`last`:return n[n.length-1];case`min`:return Math.min(...n);case`max`:return Math.max(...n);case`sum`:return n.reduce((e,t)=>e+t,0);default:return n.reduce((e,t)=>e+t,0)/n.length}}function Za(e,t){let n=qa(t)[0];return n===void 0?null:(e.reduce??`window`)===`window`?t.totals?Ka(t.totals[n]):Xa(t.values[n].map(Ka),`mean`):Xa(t.values[n].map(Ka),e.reduce??`mean`)}function Qa(e){let t=qa(e)[0];return t===void 0?[]:e.values[t].map(Ka)}var $a={ok:0,warn:1,bad:2};function eo(e){if(!e?.length)return;let t=[...e].sort((e,t)=>$a[e.status]-$a[t.status]),n=t[0],r=t[t.length-1];return $a[r.status]>$a[n.status]&&r.value!==n.value?r.value>n.value?`lower`:`higher`:`lower`}function to(e,t,n){if(e===null||!t||t.length===0)return null;n??=eo(t);let r=`ok`;for(let i of t)(n===`lower`?e>=i.value:e<=i.value)&&$a[i.status]>$a[r]&&(r=i.status);return r}function no(e,t){let n=Ct(e),r=Ct(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function ro(e,t){return`rgba(${[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)).join(`, `)}, ${t})`}function io(e,t){return{color:e,...no(e,t.surface)<3?{borderColor:t.text,borderWidth:1}:{}}}function ao(e,t){return{color:e,...no(e,t.surface)<3?{shadowColor:t.text,shadowBlur:2}:{}}}function oo(e,t){return{ok:mt,warn:ht,bad:Et}[e][t?5:8]}function so(e){let t=Va(e),n=Ha(e);return{dark:e,text:t.text,muted:t.muted,grid:t.grid,surface:t.surface,border:t.border,status:{ok:n.ok,warn:n.warn,bad:n.bad},font:wt.display}}function co(e,t,n){if(!Array.isArray(e.series))return e;let r=e.series,i=Array.isArray(e.yAxis)?e.yAxis:[e.yAxis],a=[],o=r.map((e,o)=>{let s=e.endLabel;if(!s?.show||!Array.isArray(e.data))return e;let c;for(let t=e.data.length-1;t>=0;t--){let n=e.data[t];if(Array.isArray(n)&&typeof n[1]==`number`&&Number.isFinite(n[1])){c=n;break}}let l=i[Number(e.yAxisIndex??0)];if(!c||!l)return{...e,endLabel:{...s,show:!1}};let u=l.type===`log`?Math.log:e=>e,d=l.min??1/0,f=l.max??0;if(l.type===`log`&&(l.min===void 0||l.max===void 0)){for(let t of r)if(Number(t.yAxisIndex??0)===Number(e.yAxisIndex??0)&&Array.isArray(t.data))for(let e of t.data)Array.isArray(e)&&typeof e[1]==`number`&&Number.isFinite(e[1])&&e[1]>0&&(l.min===void 0&&(d=Math.min(d,e[1])),l.max===void 0&&(f=Math.max(f,e[1])))}Number.isFinite(d)||(d=1);let p=u(l.type===`log`?d:l.min??0),m=u(l.type===`log`?Math.max(f,d*1.01):l.max??1),h=n?.(o,c),g=Number.isFinite(h)?h:t.y+t.height*(1-(u(c[1])-p)/(m-p)),_=((s.lineHeight??14)+2)/2,v=[Math.max(t.y+_,Math.min(t.y+t.height-_,g)),...a.flatMap(e=>[e.y-e.half-_,e.y+e.half+_])].filter(e=>Number.isFinite(e)&&e-_>=t.y&&e+_<=t.y+t.height&&a.every(t=>Math.abs(t.y-e)>=t.half+_)).sort((e,t)=>Math.abs(e-g)-Math.abs(t-g))[0];return v===void 0?{...e,endLabel:{...s,show:!1}}:(a.push({y:v,half:_}),{...e,labelLayout:{dy:v-g,hideOverlap:!0}})});return{...e,series:o}}var lo=(e,t,n)=>ra(e)?n.muted:Ua(t,n.dark);function uo(e,t){let n=Ja(e);if(!e.columns.some(e=>e.role===`dimension`))for(let r of n)r.name=za(e.columns.find(e=>e.name===r.name)??r.name,t);return oa(n,t)}function fo(e,t){return{animationDuration:200,textStyle:{fontFamily:e.font,color:e.muted,fontSize:11},grid:{left:8,right:16,top:28,bottom:8,containLabel:!0},tooltip:{trigger:`axis`,formatter:na(e=>va(t,e)),confine:!0,backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:12},valueFormatter:e=>va(t,e),axisPointer:{type:`line`,lineStyle:{color:e.border}}},aria:{enabled:!0}}}function po(e,t,n,r){return(e.thresholds??[]).map(i=>({yAxis:i.value,label:{formatter:`${i.label??i.status} ${ya(r??e.unit)(i.value).replace(/(?<=\d)(ms|s|m|h)$/,` $1`)}`,position:i.value<=(n.min+n.max)/2?`insideEndTop`:`insideEndBottom`,distance:8,color:t.muted,textBorderColor:t.surface,textBorderWidth:3,fontSize:12},lineStyle:{color:t.status[i.status],type:[4,3],width:1}}))}function mo(e,t,n,r={width:500,height:248}){let i=t.frame?uo(t.frame,e):{shown:[],hidden:0},a=i.shown,o=a[0]?.unit??e.unit,s=new Set(a.map(e=>e.name)),c=a.find(e=>ra(e.name)),l=t.previous&&t.shift_ms!==void 0?uo(t.previous,e).shown.flatMap(e=>ra(e.name)?c?[e]:[]:s.has(e.name)?[e]:[]):[],u=[...new Set([...a,...l].map(t=>t.unit??e.unit))];u.length===0&&u.push(e.unit);let d=e.options?.style??`line`,f=a.length>=2&&a.length<=6&&i.hidden===0&&d!==`bars`&&d!==`stacked`,p=f?Math.max(40,...a.map(e=>{let t=Array.from(e.name).slice(0,24).join(``);return r.measureText?.(t,`12px ${n.font}`)??Array.from(t).length*7.2}))+12:0,m=f?p+8:0,h=(e.options?.legend??`auto`)!==`hidden`&&a.length>1,g=ca(a.map(e=>e.name),r.width,h,n.text,n.font,r.measureText),_=r.height-g.top-(i.hidden?24:8)-22,v=Math.max(0,Math.floor(_/16)),y=t.shift_ms,b=u.map(t=>{let n=[...a,...l].filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.points.flatMap(([,e])=>e===null?[]:[e]));if(d===`stacked`){let r=new Map;for(let n of a.filter(n=>(n.unit??e.unit)===t))for(let[e,t]of n.points){let n=r.get(e)??{positive:0,negative:0};t!==null&&(t>0?n.positive+=t:n.negative+=t),r.set(e,n)}n.push(...[...r.values()].flatMap(e=>[e.positive,e.negative]))}return Ca(Math.min(0,...n),Math.max(0,...n),t,_)}),x=a.map((t,r)=>{let i=lo(t.name,r,n);return{name:t.name,interactive:!0,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:d===`bars`||d===`stacked`?`bar`:`line`,data:t.points,endLabel:f?{show:r0?{symbol:[`none`,`none`],silent:!0,data:po(e,n,b[0],o)}:void 0}}),S=y===void 0?[]:l.map(t=>({name:`${t.name} · previous`,interactive:!1,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:`line`,data:t.points.map(([e,t])=>[e+y,t]),showSymbol:!1,silent:!0,z:1,lineStyle:{width:1,type:`dashed`,color:n.muted},itemStyle:{color:n.muted}})),C=u.map((t,r)=>({...e.options?.scale===`log`?{splitNumber:xa(_)}:b[r],type:e.options?.scale===`log`?`log`:`value`,position:r===0?`left`:`right`,offset:Math.max(0,r-1)*56,axisLine:{show:!1},splitLine:{show:r===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:ya(t)}}));return co({...fo(n,o),tooltip:{...fo(n,o).tooltip,formatter:na((t,n)=>va([...a,...l].find(e=>e.name===n||`${e.name} · previous`===n)?.unit??e.unit,t),!0)},legend:g.option,grid:{left:8,right:16+(f?m:0)+Math.max(0,u.length-2)*56,top:g.top,bottom:i.hidden?24:8,containLabel:!0},xAxis:{type:`time`,min:t.from_ms,max:t.to_ms,axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:Ea}},yAxis:C.length===1?C[0]:C,series:[...x,...S],graphic:sa(i.hidden,n.muted)},{y:g.top,height:_})}function ho(e,t,n){if(n(e)<=t)return e;let r=Array.from(e);for(let e=r.length-1;e>0;e--){let i=Math.floor(e*.45),a=e-i,o=r.slice(0,i).join(``)+`…`+r.slice(-a).join(``);if(n(o)<=t)return o}return`…`}function go(e,t,n,r={width:500,height:248}){let i=Ya(t);if(t.columns.filter(e=>e.role===`dimension`).length<2)for(let n of i.series)n.name=za(t.columns.find(e=>e.name===n.name)??n.name,e);let a=i.categories,{shown:o,hidden:s}=oa(i.series,e),c=t.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),l=new Map;for(let n=0;nString(t.values[e][n]??``))),{dimensions:r,...i})}let u=o[0]?.unit??e.unit,d=[...new Set(o.map(t=>t.unit??e.unit))];d.length===0&&d.push(e.unit);let f=o.length>1,p=!!(t.periods?.[`Before deploy`]||t.periods?.[`Since deploy`]),m=e=>r.measureText?.(e,`11px ${n.font}`)??Array.from(e).length*6.6,h=Math.min(r.width*.4,Math.max(40,...a.map(m))),g=ca(o.map(e=>e.name),r.width,f&&e.options?.legend!==`hidden`,n.text,n.font,r.measureText),_=d.map((t,i)=>({...Ca(Math.min(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),Math.max(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),t,r.width-h-80),type:`value`,position:i===0?`bottom`:`top`,offset:Math.max(0,i-1)*36,splitLine:{show:i===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,formatter:e=>ba(t,e),hideOverlap:!0}}));return{...fo(n,u),tooltip:{...fo(n,u).tooltip,formatter:na((t,n)=>va(o.find(e=>e.name===n)?.unit??e.unit,t)),axisPointer:{type:`shadow`}},legend:g.option,grid:{left:8,right:56,top:(f?g.top:8)+Math.max(0,d.length-1)*36,bottom:s?24:8,containLabel:!0},yAxis:{type:`category`,inverse:!0,data:a,splitLine:{show:!1},axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,width:h,overflow:`truncate`,formatter:e=>ho(e,h,m)}},xAxis:_.length===1?_[0]:_,series:o.map((t,r)=>({name:t.name,interactive:!0,xAxisIndex:d.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:`bar`,data:t.values.map((e,n)=>({value:e,selection:l.get(JSON.stringify(c.length>1?[a[n],t.name]:[a[n]]))})),barMaxWidth:p&&t.name===`Before deploy`?7:14,barGap:`20%`,itemStyle:{...io(p?t.name===`Before deploy`?n.muted:Ua(0,n.dark):lo(t.name,r,n),n),borderRadius:[0,4,4,0]},label:{show:p?t.name===`Since deploy`:!f||r===0,position:`right`,color:n.text,fontFamily:n.font,fontSize:11,formatter:({value:n})=>ba(t.unit??e.unit,n)}})),graphic:sa(s,n.muted)}}function _o(e,t,n,r=e.unit,i={width:270,height:140}){let a=e.min??0,o=e.max??100,s=vo(e,a,o,n),c=va(r,t),l=to(t,e.thresholds,e.better),u=l===`bad`?`◆ Bad`:l===`warn`?`■ Warn`:l===`ok`?`● OK`:t===null?`○ Unknown`:void 0,d=e=>`${e}40`,f=i.measureText?.(c,`600 28px ${n.font}`)??c.length*28*.6,p=i.measureText?.(u??``,`11px ${n.font}`)??(u?.length??0)*11*.6,m=i.width{let r=y;return y=e,{type:`rect`,shape:{x:4+r*_,y:g,width:(e-r)*_,height:10,r:[n===0?5:0,n===s.length-1?5:0,n===s.length-1?5:0,n===0?5:0]},style:{fill:d(t)}}}),{id:`gauge-fill`,type:`rect`,shape:{x:4,y:g,width:v*_,height:10,r:5},style:{fill:l?n.status[l]:Ua(0,n.dark)}},{id:`gauge-marker`,type:`rect`,shape:{x:3+v*_,y:g-2,width:2,height:14,r:1},style:{fill:n.text}},{type:`text`,left:4,top:g+12,style:{text:va(r,a),fill:n.muted,fontSize:11,fontFamily:n.font}},{type:`text`,right:4,top:g+12,style:{text:va(r,o),fill:n.muted,fontSize:11,fontFamily:n.font}}]}}function vo(e,t,n,r){let i=n-t||1,a=[t,...(e.thresholds??[]).map(e=>Math.min(n,Math.max(t,e.value))),n].sort((e,t)=>e-t),o=[];for(let t=0;t[(e.end-t)/i,r.status[e.status]])}var yo=function(e,t){return yo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},yo(e,t)};function U(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);yo(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var bo=`12px sans-serif`,xo=20,So=100,Co=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function wo(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n=0)s=o*n.length;else for(var c=0;c=zo&&(Ro=0),Ro++}function Vo(){var e=[...arguments];typeof console<`u`&&console.error.apply(console,e)}function Ho(e){if(typeof e!=`object`||!e)return e;var t=e,n=ko.call(e);if(n===`[object Array]`){if(!xs(e)){t=[];for(var r=0,i=e.length;r`u`&&typeof self<`u`?Ns.worker=!0:!Ns.hasGlobalWindow||`Deno`in window||typeof navigator<`u`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Node.js`)>-1?(Ns.node=!0,Ns.svgSupported=!0):Ps(navigator.userAgent,Ns);function Ps(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);if(r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`){var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}}var Fs=1e-4,Is=20;function Ls(e){return e.replace(/^\s+|\s+$/g,``)}var Rs=Math.min,zs=Math.max,Bs=Math.abs,Vs=Math.round,Hs=Math.floor,Us=Math.ceil,Ws=Math.pow,Gs=Math.log,Ks=Math.LN10,qs=Math.PI,Js=Math.random;function Ys(e,t,n,r){var i=t[0],a=t[1],o=n[0],s=n[1],c=a-i,l=s-o;if(c===0)return l===0?o:(o+s)/2;if(r){if(c>0){if(e<=i)return o;if(e>=a)return s}else if(e>=i)return o;else if(e<=a)return s}else{if(e===i)return o;if(e===a)return s}return(e-i)/c*l+o}var Xs=Zs;function Zs(e,t,n){switch(e){case`center`:case`middle`:e=`50%`;break;case`left`:case`top`:e=`0%`;break;case`right`:case`bottom`:e=`100%`}return Qs(e,t,n)}function Qs(e,t,n){return Y(e)?$s(e)?parseFloat(e)/100*t+(n||0):parseFloat(e):e==null?NaN:+e}function $s(e){return!!Ls(e).match(/%$/)}function ec(e,t,n){return isNaN(t)?n?``+e:+e:(t=Rs(zs(0,t),Is),e=(+e).toFixed(t),n?e:+e)}function tc(e){return e.sort(function(e,t){return e-t}),e}function nc(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,n=0;n<15;n++,t*=10)if(Vs(e*t)/t===e)return n}return rc(e)}function rc(e){var t=e.toString().toLowerCase(),n=t.indexOf(`e`),r=n>0?+t.slice(n+1):0,i=n>0?n:t.length,a=t.indexOf(`.`);return zs(0,(a<0?0:i-1-a)-r)}function ic(e,t,n){var r=Bs(e[1]-e[0]);if(!isFinite(r)||r===0)return NaN;var i=Gs(2*Bs(n||1)*Bs(r))/Ks,a=Gs(Bs(t))/Ks,o=zs(0,Us(-i+a));return isFinite(o)||(o=NaN),o}function ac(e,t){var n=zs(nc(e),nc(t)),r=e+t;return n>Is?r:ec(r,n)}var oc=Ws(2,53)-1;function sc(e){var t=qs*2;return(e%t+t)%t}function cc(e){return e>-Fs&&e=10&&t++,t}function pc(e,t){var n=fc(e),r=Ws(10,n),i=e/r;return e=(t===2?1:t?i<1.5?1:i<2.5?2:i<4?3:i<7?5:10:i<1?1:i<2?2:i<3?3:i<5?5:10)*r,ec(e,-n)}function mc(e){e.sort(function(e,t){return s(e,t,0)?-1:1});for(var t=-1/0,n=1,r=0;r0?e.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)&&(this.item=this._list[this._idx],this.key=this._idx+=this._step,!0)},e})();function ul(){return[1/0,-1/0]}function dl(e,t){hl(t)&&(te[1]&&(e[1]=t))}function fl(e,t){hl(t)&&te[1]&&(e[1]=t)}function ml(e,t){gl(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function hl(e){return e!=null&&isFinite(e)}function gl(e,t){return hl(e)&&hl(t)&&e<=t}function _l(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function vl(e){gl(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function yl(){var e=`__ec_once_`+bl++;return function(t,n){Z(t,e)||(t[e]=1,n())}}var bl=_c();function xl(e,t,n){var r=Es(),i=0;G(e,function(a){var o=t(a),s=r.get(o)||0;n&&n(a,s),!s&&!n&&(e[i++]=a),r.set(o,s+1)}),n||(e.length=i)}function Sl(e){return e.value+``}function Cl(e){return e+``}function wl(e,t){return X(t,!0)?e.seriesIndex+2:0}function Tl(e,t,n){var r=e.getData().count();return{progressiveRender:n.progressiveEnabled&&t.incrementalPrepareRender&&r>=n.threshold,large:e.get(`large`)&&r>=e.get(`largeThreshold`),modDataCount:e.get(`progressiveChunkMode`)===`mod`?e.getData().count():null}}function El(e){return{overallReset:e}}var Dl=`.`,Ol=`___EC__COMPONENT__CONTAINER___`,kl=`___EC__EXTENDED_CLASS___`;function Al(e){var t={main:``,sub:``};if(e){var n=e.split(Dl);t.main=n[0]||``,t.sub=n[1]||``}return t}function jl(e){_s(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),`componentType "`+e+`" illegal`)}function Ml(e){return!!(e&&e[kl])}function Nl(e,t){e.$constructor=e,e.extend=function(e){var t=this,n;return Pl(t)?n=function(e){U(t,e);function t(){return e.apply(this,arguments)||this}return t}(t):(n=function(){(e.$constructor||t).apply(this,arguments)},Jo(n,this)),W(n.prototype,e),n[kl]=!0,n.extend=this.extend,n.superCall=Rl,n.superApply=zl,n.superClass=t,n}}function Pl(e){return rs(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function Fl(e,t){e.extend=t.extend}var Il=Math.round(Math.random()*10);function Ll(e){var t=[`__\0is_clz`,Il++].join(`_`);e.prototype[t]=!0,e.isInstance=function(e){return!!(e&&e[t])}}function Rl(e,t){var n=[...arguments].slice(2);return this.superClass.prototype[t].apply(e,n)}function zl(e,t,n){return this.superClass.prototype[t].apply(e,n)}function Bl(e){var t={};e.registerClass=function(e){var r=e.type||e.prototype.type;if(r){jl(r),e.prototype.type=r;var i=Al(r);if(!i.sub)t[i.main]=e;else if(i.sub!==Ol){var a=n(i);a[i.sub]=e}}return e},e.getClass=function(e,n,r){var i=t[e];if(i&&i[Ol]&&(i=n?i[n]:null),r&&!i)throw Error(n?`Component `+e+`.`+(n||``)+` is used but not imported.`:e+`.type should be specified.`);return i},e.getClassesByMainType=function(e){var n=Al(e),r=[],i=t[n.main];return i&&i[Ol]?G(i,function(e,t){t!==Ol&&r.push(e)}):r.push(i),r},e.hasClass=function(e){return!!t[Al(e).main]},e.getAllClassMainTypes=function(){var e=[];return G(t,function(t,n){e.push(n)}),e},e.hasSubTypes=function(e){var n=t[Al(e).main];return n&&n[Ol]};function n(e){var n=t[e.main];return(!n||!n[Ol])&&(n=t[e.main]={},n[Ol]=!0),n}}function Vl(e,t){for(var n=0;n=0||i&&qo(i,s)<0)){var c=n.getShallow(s,t);c!=null&&(a[e[o][0]]=c)}}return a}}var Hl=Vl([[`fill`,`color`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`opacity`],[`shadowColor`]]),Ul=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return Hl(this,e,t)},e}(),Wl=function(){function e(e){this.value=e}return e}(),Gl=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new Wl(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),Kl=function(){function e(e){this._list=new Gl,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new Wl(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),ql=new Kl(50);function Jl(e){if(typeof e==`string`){var t=ql.get(e);return t&&t.image}return e}function Yl(e,t,n,r,i){if(!e)return t;if(typeof e==`string`){if(t&&t.__zrImageSrc===e||!n)return t;var a=ql.get(e),o={hostEl:n,cb:r,cbPayload:i};return a?(t=a.image,!Zl(t)&&a.pending.push(o)):(t=Eo.loadImage(e,Xl,Xl),t.__zrImageSrc=e,ql.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}function Xl(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;tu||d>f||p>m||h>g)return!1;var _=!(u=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height},e.prototype.contain=function(t,n){return e.contain(this,t,n)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(e){Vu(this,e)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(e,t){return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e},e.applyTransform=function(e,t,n){if(!n){e!==t&&Vu(e,t);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],i=n[3],a=n[4],o=n[5];e.x=t.x*r+a,e.y=t.y*i+o,e.width=t.width*r,e.height=t.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}Au.x=Mu.x=t.x,Au.y=Nu.y=t.y,ju.x=Nu.x=t.x+t.width,ju.y=Mu.y=t.y+t.height,Au.transform(n),Nu.transform(n),ju.transform(n),Mu.transform(n),e.x=Tu(Au.x,ju.x,Mu.x,Nu.x),e.y=Tu(Au.y,ju.y,Mu.y,Nu.y);var s=Eu(Au.x,ju.x,Mu.x,Nu.x),c=Eu(Au.y,ju.y,Mu.y,Nu.y);e.width=s-e.x,e.height=c-e.y},e.calculateTransform=function(e,t,n){var r=n.width/t.width,i=n.height/t.height;return e=$l(e||[]),nu(e,e,lu(qu,-t.x,-t.y)),iu(e,e,lu(qu,r,i)),nu(e,e,lu(qu,n.x,n.y)),e},e}(),zu=Ru.create,Bu=Ru.set,Vu=Ru.copy,Hu=Ru.calculateTransform,Uu=Ru.applyTransform,Wu=Ru.contain,Gu=new Ru(0,0,0,0),Ku=new Ru(0,0,0,0),qu=[];function Ju(e,t,n,r,i,a,o,s){var c=Du(t-n),l=Du(r-e),u=Tu(c,l),d=Ou[i],f=Ou[1-i],p=ku[i];t=l||!Pu.bidirectional)&&(Fu[d]=-l,Fu[f]=0,Pu.useDir&&Pu.calcDirMTV())))}function Yu(){var e=0,t=new wu,n=new wu,r={minTv:new wu,maxTv:new wu,useDir:!1,dirMinTv:new wu,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,a){r.touchThreshold=0,i&&i.touchThreshold!=null&&(r.touchThreshold=Eu(0,i.touchThreshold)),r.negativeSize=!1,a&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,i&&i.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),e=i.direction,r.bidirectional=i.bidirectional==null||!!i.bidirectional,r.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var a=r.minTv,o=r.dirMinTv,s=a.y*a.y+a.x*a.x,c=Math.sin(e),l=Math.cos(e),u=c*a.y+l*a.x;if(i(u)){i(a.x)&&i(a.y)&&o.set(0,0);return}if(n.x=s*l/u,n.y=s*c/u,i(n.x)&&i(n.y)){o.set(0,0);return}(r.bidirectional||t.dot(n)>0)&&n.len()=ed)){e||=`12px sans-serif`;for(var t=[],n=+new Date,r=0;r<=127;r++)t[r]=Eo.measureText(String.fromCharCode(r),e).width;var i=+new Date-n;return i>16?$u=ed:i>2&&$u++,t}}var $u=0,ed=5;function td(e,t){return e.asciiWidthMapTried||=(e.asciiWidthMap=Qu(e.font),!0),0<=t&&t<=127?e.asciiWidthMap==null?e.asciiCharWidth:e.asciiWidthMap[t]:e.stWideCharWidth}function nd(e,t){var n=e.strWidthCache,r=n.get(t);return r??(r=Eo.measureText(t,e.font).width,n.put(t,r)),r}function rd(e,t,n,r){var i=nd(Xu(t),e),a=sd(t);return new Ru(ad(0,i,n),od(0,a,r),i,a)}function id(e,t,n,r){var i=((e||``)+``).split(` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/panel-sql-editor-Behd0nuD.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-DxHBLqHS.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-EHBQhIeL.js","assets/Tooltip-B3r3s_B9.js","assets/index-ADB9ThEc.css"])))=>i.map(i=>d[i]); +import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,D as s,E as c,K as l,M as u,O as d,P as f,Q as p,S as m,T as h,X as g,Y as _,Z as v,_ as y,_t as b,a as x,c as S,d as C,dt as w,f as T,ft as E,g as D,gt as O,h as k,j as A,k as j,lt as M,m as N,mt as P,nt as F,o as I,ot as L,p as ee,r as R,s as te,st as ne,tt as re,u as ie,ut as z,v as ae,x as B,y as oe}from"./brand-DUaZkIz1.js";import{c as se,l as ce,t as le}from"./preload-helper-EHBQhIeL.js";import{C as ue,E as de,b as fe,o as pe,t as me,w as he}from"./Tooltip-B3r3s_B9.js";import{a as ge,c as _e,d as ve,i as ye,l as be,n as xe,o as Se,r as Ce,s as we,t as Te,u as Ee}from"./dashboard-change-chips-Cbk2Ba8I.js";import{n as De,r as Oe,t as ke}from"./WarningCircle.es-BIbVHGEb.js";import{A as Ae,At as je,B as Me,Bt as Ne,C as Pe,D as Fe,E as Ie,F as Le,Ft as Re,Gt as ze,H as Be,Ht as Ve,I as He,It as Ue,Jt as We,Kt as Ge,Lt as Ke,M as qe,Mt as Je,N as Ye,Nt as Xe,O as Ze,P as Qe,Pt as $e,Q as et,R as tt,Rt as nt,U as rt,Ut as it,V as at,W as ot,Wt as st,Xt as ct,Yt as lt,Zt as ut,_ as dt,a as ft,b as pt,c as mt,d as ht,h as gt,i as _t,j as vt,jt as yt,k as bt,l as xt,m as St,n as Ct,o as wt,qt as Tt,r as Et,s as Dt,t as Ot,u as kt,v as At,w as jt,x as Mt,zt as Nt}from"./index-DxHBLqHS.js";function Pt(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=Ft(e);if(n.length!==Ft(t).length)return!1;for(let r=0;r{if(typeof n!=`string`||n.trim().length===0)throw Error(t);return`${e}-${n}`}}var H=r();function Lt(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function Rt(e,t){if(e===t||Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;let n=Object.keys(e),{length:r}=n;if(r!==Object.keys(t).length)return!1;for(let i=0;i{r.current||=window.setTimeout(()=>{i(...e),r.current=null},t)},[t]),o=(0,V.useCallback)(()=>{r.current&&=(window.clearTimeout(r.current),null)},[]);return(0,V.useEffect)(()=>(n.autoInvoke&&a(),o),[o,a]),{start:a,clear:o}}function Ut(e){let t=(0,V.useRef)(void 0);return(0,V.useEffect)(()=>{t.current=e},[e]),t.current}function Wt(e,t,n){let r=(0,V.useRef)(null);(0,V.useEffect)(()=>{r.current&&=(r.current.disconnect(),null);let i=typeof n==`function`?n():n;return i&&(r.current=new MutationObserver(e),r.current.observe(i,t)),()=>{r.current&&=(r.current.disconnect(),null)}},[e,t,n])}function Gt(){let[e,t]=(0,V.useState)(!1);return(0,V.useEffect)(()=>t(!0),[]),e}function Kt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`}function qt(e,t=document){let n=t.querySelector(e);if(n)return n;let r=t.querySelectorAll(`*`);for(let t=0;t{if(!e||!t||!n.current)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=t.offsetWidth===0?1:i.width/t.offsetWidth,o=t.offsetHeight===0?1:i.height/t.offsetHeight,s=window.getComputedStyle(e),c=window.getComputedStyle(t),l=fe(s.borderTopWidth)+fe(c.borderTopWidth),u=fe(s.borderLeftWidth)+fe(c.borderLeftWidth),d={top:(r.top-i.top)/o-l,left:(r.left-i.left)/a-u,width:r.width/a,height:r.height/o};n.current.style.transform=`translateY(${d.top}px) translateX(${d.left}px)`,n.current.style.width=`${d.width}px`,n.current.style.height=`${d.height}px`},p=()=>{window.clearTimeout(o.current),n.current&&(n.current.style.transitionDuration=`0ms`),f(),o.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration=``)},30)},m=(0,V.useRef)(null),h=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(c&&s.current!==e&&i&&i(),s.current=e,f(),e)return m.current=new ResizeObserver(p),m.current.observe(e),t&&(h.current=new ResizeObserver(p),h.current.observe(t)),()=>{m.current?.disconnect(),h.current?.disconnect()}},[t,e]),(0,V.useEffect)(()=>{if(t){let e=e=>{Zt(e.target,t)&&(p(),d(!1))};return t.addEventListener(`transitionend`,e),()=>{t.removeEventListener(`transitionend`,e)}}},[t]),(0,V.useEffect)(()=>{if(n.current&&a){let e=e=>{e.propertyName===`transform`&&a()};return n.current.addEventListener(`transitionend`,e),()=>{n.current?.removeEventListener(`transitionend`,e)}}},[a]),Ht(()=>{ve()!==`test`&&l(!0)},20,{autoInvoke:!0}),Wt(e=>{e.forEach(e=>{e.type===`attributes`&&e.attributeName===`dir`&&p()})},{attributes:!0,attributeFilter:[`dir`]},()=>document.documentElement),{initialized:c,hidden:u}}var $t={root:`m_96b553a6`},en=g((e,{transitionDuration:t},{shouldReduceMotion:n})=>({root:{"--transition-duration":e.respectReducedMotion&&n?`0ms`:typeof t==`number`?`${t}ms`:t||`150ms`}})),tn=h(e=>{let t=u(`FloatingIndicator`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,target:d,parent:f,transitionDuration:m,mod:h,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v,attributes:y,ref:b,...x}=t,S=p(),C=a({name:`FloatingIndicator`,classes:$t,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:y,vars:l,varsResolver:en,stylesCtx:{shouldReduceMotion:S}}),w=(0,V.useRef)(null),{initialized:T,hidden:E}=Qt({target:d,parent:f,ref:w,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v}),D=re(b,w);return!d||!f?null:(0,H.jsx)(o,{ref:D,mod:[{initialized:T,hidden:E},h],...C(`root`),...x})});tn.displayName=`@mantine/core/FloatingIndicator`,tn.classes=$t,tn.varsResolver=en;var[nn,rn]=de(`Accordion component was not found in the tree`),[an,on]=de(`Accordion.Item component was not found in the tree`),sn={root:`m_9bdbb667`,panel:`m_df78851f`,content:`m_4ba554d4`,itemTitle:`m_8fa820a0`,control:`m_4ba585b8`,"control--default":`m_6939a5e9`,"control--contained":`m_4271d21b`,label:`m_df3ffa0f`,chevron:`m_3f35ae96`,icon:`m_9bd771fe`,item:`m_9bd7b098`,"item--default":`m_fe19b709`,"item--contained":`m_1f921b3b`,"item--filled":`m_2cdf939a`,"item--separated":`m_9f59b069`},cn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,chevron:s,icon:c,onClick:l,onKeyDown:d,children:f,disabled:p,mod:h,...g}=u(`AccordionControl`,null,e),{value:_}=on(),v=rn(),y=v.isItemActive(_),b=typeof v.order==`number`,x=`h${v.order}`,S=(0,H.jsxs)(m,{...v.getStyles(`control`,{className:n,classNames:t,style:r,styles:i,variant:v.variant}),unstyled:v.unstyled,mod:[`accordion-control`,{active:y,"chevron-position":v.chevronPosition,disabled:p},h],onClick:e=>{l?.(e),v.onChange(_)},type:`button`,disabled:p,"aria-expanded":y,"aria-controls":v.getRegionId(_),id:v.getControlId(_),onKeyDown:Tt({siblingSelector:`[data-accordion-control]`,parentSelector:`[data-accordion]`,activateOnFocus:!1,loop:v.loop,orientation:`vertical`,onKeyDown:d}),...g,children:[(0,H.jsx)(o,{component:`span`,mod:{rotate:!v.disableChevronRotation&&y,position:v.chevronPosition},...v.getStyles(`chevron`,{classNames:t,styles:i}),children:s||v.chevron}),(0,H.jsx)(`span`,{...v.getStyles(`label`,{classNames:t,styles:i}),children:f}),c&&(0,H.jsx)(o,{component:`span`,mod:{"chevron-position":v.chevronPosition},...v.getStyles(`icon`,{classNames:t,styles:i}),children:c})]});return b?(0,H.jsx)(x,{...v.getStyles(`itemTitle`,{classNames:t,styles:i}),children:S}):S});cn.displayName=`@mantine/core/AccordionControl`,cn.classes=sn;var ln=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,mod:c,...l}=u(`AccordionItem`,null,e),d=rn();return(0,H.jsx)(an,{value:{value:s},children:(0,H.jsx)(o,{mod:[{active:d.isItemActive(s)},c],...d.getStyles(`item`,{className:n,classNames:t,styles:i,style:r,variant:d.variant}),...l})})});ln.displayName=`@mantine/core/AccordionItem`,ln.classes=sn;var un=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,keepMounted:s,keepMountedMode:c,...l}=u(`AccordionPanel`,null,e),{value:d}=on(),f=rn();return(0,H.jsx)(Ee,{...f.getStyles(`panel`,{className:n,classNames:t,style:r,styles:i}),expanded:f.isItemActive(d),transitionDuration:f.transitionDuration??200,role:`region`,id:f.getRegionId(d),"aria-labelledby":f.getControlId(d),keepMounted:s??f.keepMounted,keepMountedMode:c??f.keepMountedMode,...l,children:(0,H.jsx)(`div`,{...f.getStyles(`content`,{classNames:t,styles:i}),children:o})})});un.displayName=`@mantine/core/AccordionPanel`,un.classes=sn;var dn={multiple:!1,loop:!0,disableChevronRotation:!1,disableCollapse:!1,chevronPosition:`right`,variant:`default`,chevronSize:`auto`,chevronIconSize:16,keepMountedMode:`activity`},fn=g((e,{transitionDuration:t,chevronSize:n,radius:r})=>({root:{"--accordion-transition-duration":t===void 0?void 0:`${t}ms`,"--accordion-chevron-size":n===void 0?void 0:P(n),"--accordion-radius":r===void 0?void 0:ne(r)}})),pn=c(e=>{let t=u(`Accordion`,dn,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,children:d,multiple:f,value:p,defaultValue:m,onChange:h,id:g,loop:_,transitionDuration:v,disableChevronRotation:y,disableCollapse:b,chevronPosition:x,chevronSize:S,order:C,chevron:w,variant:T,radius:E,chevronIconSize:D,attributes:O,keepMounted:k,keepMountedMode:A,...j}=t,M=F(g),[N,P]=ze({value:p,defaultValue:m,finalValue:f?[]:null,onChange:h}),I=e=>Array.isArray(N)?N.includes(e):e===N,L=e=>{if(!Array.isArray(N)&&b&&e===N)return;let t=Array.isArray(N)?N.includes(e)?N.filter(t=>t!==e):[...N,e]:e===N?null:e;P(t)},ee=a({name:`Accordion`,classes:sn,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:O,vars:l,varsResolver:fn});return(0,H.jsx)(nn,{value:{isItemActive:I,onChange:L,getControlId:It(`${M}-control`,`Accordion.Item component was rendered with invalid value or without value`),getRegionId:It(`${M}-panel`,`Accordion.Item component was rendered with invalid value or without value`),chevron:w===null?null:w||(0,H.jsx)(nt,{size:D}),transitionDuration:v,disableChevronRotation:y,chevronPosition:x,order:C,loop:_,getStyles:ee,variant:T,unstyled:c,keepMounted:k,keepMountedMode:A},children:(0,H.jsx)(o,{...ee(`root`),id:M,...j,variant:T,"data-accordion":!0,children:d})})});pn.classes=sn,pn.varsResolver=fn,pn.displayName=`@mantine/core/Accordion`,pn.Item=ln,pn.Panel=un,pn.Control=cn,pn.Chevron=nt;function mn(e){return typeof e==`string`?{value:e,label:e}:typeof e==`object`&&`value`in e&&!(`label`in e)?{value:e.value,label:`${e.value}`,disabled:e.disabled}:typeof e==`object`&&`group`in e?{group:e.group,items:e.items.map(e=>mn(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function hn(e){return e?e.map(e=>mn(e)):[]}function gn(e){return e.reduce((e,t)=>`group`in t?{...e,...gn(t.items)}:(e[`${t.value}`]=t,e),{})}var _n={dropdown:`m_88b62a41`,search:`m_985517d8`,options:`m_b2821a6e`,option:`m_92253aa5`,empty:`m_2530cd1d`,header:`m_858f94bd`,footer:`m_82b967cb`,group:`m_254f3e4f`,groupLabel:`m_2bb2e9e5`,chevron:`m_2943220b`,optionsDropdownOption:`m_390b5f4`,optionsDropdownCheckIcon:`m_8ee53fc2`,optionsDropdownCheckPlaceholder:`m_a530ee0a`},vn={error:null},yn=g((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":M(t,`combobox-chevron-size`),"--combobox-chevron-color":n?l(n,e):void 0}})),bn=h(e=>{let t=u(`ComboboxChevron`,vn,e),{size:n,error:r,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,attributes:p,mod:m,...h}=t,g=a({name:`ComboboxChevron`,classes:_n,props:t,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,varsResolver:yn,attributes:p,rootSelector:`chevron`});return(0,H.jsx)(o,{component:`svg`,...h,...g(`chevron`),size:n,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,mod:[`combobox-chevron`,{error:r},m],children:(0,H.jsx)(`path`,{d:`M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})});bn.classes=_n,bn.varsResolver=yn,bn.displayName=`@mantine/core/ComboboxChevron`;var[xn,Sn]=de(`Combobox component was not found in tree`);function Cn({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,H.jsx)(k.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}Cn.displayName=`@mantine/core/ComboboxClearButton`;var wn=h(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:a,...o}=u(`ComboboxDropdown`,null,e),s=Sn();return(0,H.jsx)(Ne.Dropdown,{...o,role:`presentation`,"data-hidden":a||void 0,"data-floating-height":s.floatingHeight||void 0,...s.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});wn.classes=_n,wn.displayName=`@mantine/core/ComboboxDropdown`;var Tn={refProp:`ref`},En=h(e=>{let{children:t,refProp:n,ref:r}=u(`ComboboxDropdownTarget`,Tn,e);if(Sn(),!w(t))throw Error(`Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return(0,H.jsx)(Ne.Target,{ref:r,refProp:n,children:t})});En.displayName=`@mantine/core/ComboboxDropdownTarget`;var Dn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxEmpty`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...s})});Dn.classes=_n,Dn.displayName=`@mantine/core/ComboboxEmpty`;function On({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=Sn(),[c,l]=(0,V.useState)(null),u=t=>{if(e?.(t),!s.readOnly&&n){if(t.nativeEvent.isComposing)return;if(t.nativeEvent.code===`ArrowDown`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectNextOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`ArrowUp`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectPreviousOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`Enter`||t.nativeEvent.code===`NumpadEnter`){if(t.nativeEvent.keyCode===229)return;let e=s.store.getSelectedOptionIndex();s.store.dropdownOpened&&e!==-1?(t.preventDefault(),s.store.clickSelectedOption()):a===`button`&&(t.preventDefault(),s.store.openDropdown(`keyboard`))}t.key===`Escape`&&s.store.closeDropdown(`keyboard`),t.nativeEvent.code===`Space`&&a===`button`&&(t.preventDefault(),s.store.toggleDropdown(`keyboard`))}},d=r?{...i?{role:`combobox`}:{},"aria-haspopup":`listbox`,"aria-expanded":i?!!(s.store.listId&&s.store.dropdownOpened):void 0,"aria-controls":s.store.dropdownOpened&&s.store.listId?s.store.listId:void 0,"aria-activedescendant":s.store.dropdownOpened&&c||void 0,autoComplete:o,"data-expanded":s.store.dropdownOpened||void 0,"data-mantine-stop-propagation":s.store.dropdownOpened||void 0}:{},f=e=>{a===`button`&&e.currentTarget.focus(),t?.(e)};return{...d,onKeyDown:u,onClick:f}}var kn={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},An=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxEventsTarget`,kn,e),d=v(t);if(!d)throw Error(`Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Sn(),p=On({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s});return(0,V.cloneElement)(d,{...p,...l,[n]:re(c,f.store.targetRef,ue(d))})});An.displayName=`@mantine/core/ComboboxEventsTarget`;var jn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxFooter`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});jn.classes=_n,jn.displayName=`@mantine/core/ComboboxFooter`;var Mn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:s,label:c,id:l,...d}=u(`ComboboxGroup`,null,e),f=Sn(),p=F(l),m=c!=null&&c!==!1&&c!==``;return(0,H.jsxs)(o,{role:`group`,"aria-labelledby":m?p:void 0,...f.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...d,children:[m&&(0,H.jsx)(`div`,{id:p,...f.getStyles(`groupLabel`,{classNames:t,styles:i}),children:c}),s]})});Mn.classes=_n,Mn.displayName=`@mantine/core/ComboboxGroup`;var Nn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxHeader`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});Nn.classes=_n,Nn.displayName=`@mantine/core/ComboboxHeader`;function Pn({value:e,valuesDivider:t=`,`,...n}){return(0,H.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}Pn.displayName=`@mantine/core/ComboboxHiddenInput`;var Fn=h(e=>{let t=u(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:a,vars:s,onClick:c,id:l,active:d,onMouseDown:f,onMouseOver:p,disabled:m,selected:h,mod:g,..._}=t,v=Sn(),y=(0,V.useId)(),b=l||y;return(0,H.jsx)(o,{...v.getStyles(`option`,{className:r,classNames:n,styles:a,style:i}),"aria-disabled":m||void 0,..._,id:b,mod:[`combobox-option`,{"combobox-active":d,"combobox-disabled":m,"combobox-selected":h},g],role:`option`,onClick:e=>{m?e.preventDefault():(v.onOptionSubmit?.(t.value,t),c?.(e))},onMouseDown:e=>{e.preventDefault(),f?.(e)},onMouseOver:e=>{v.resetSelectionOnOptionHover&&v.store.resetSelectedOption(),p?.(e)}})});Fn.classes=_n,Fn.displayName=`@mantine/core/ComboboxOption`;var In=h(e=>{let{classNames:t,className:n,style:r,styles:i,id:a,onMouseDown:s,labelledBy:c,...l}=u(`ComboboxOptions`,null,e),d=Sn(),f=F(a);return(0,V.useEffect)(()=>{d.store.setListId(f)},[f]),(0,H.jsx)(o,{...d.getStyles(`options`,{className:n,style:r,classNames:t,styles:i}),...l,id:f,role:`listbox`,"aria-labelledby":c,onMouseDown:e=>{e.preventDefault(),s?.(e)}})});In.classes=_n,In.displayName=`@mantine/core/ComboboxOptions`;var Ln={withAriaAttributes:!0,withKeyboardNavigation:!0},Rn=h(e=>{let{classNames:t,styles:n,unstyled:r,vars:i,withAriaAttributes:a,onKeyDown:o,onClick:s,withKeyboardNavigation:c,size:l,ref:d,...f}=u(`ComboboxSearch`,Ln,e),p=Sn(),m=p.getStyles(`search`),h=On({targetType:`input`,withAriaAttributes:a,withKeyboardNavigation:c,withExpandedAttribute:!1,onKeyDown:o,onClick:s,autoComplete:`off`});return(0,H.jsx)(k,{ref:re(d,p.store.searchRef),classNames:[{input:m.className},t],styles:[{input:m.style},n],size:l||p.size,...h,...f,__staticSelector:`Combobox`})});Rn.classes=_n,Rn.displayName=`@mantine/core/ComboboxSearch`;var zn={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Bn=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxTarget`,zn,e),d=v(t);if(!d)throw Error(`Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Sn(),p=On({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s}),m=(0,V.cloneElement)(d,{...p,...l});return(0,H.jsx)(Ne.Target,{refProp:n,ref:re(c,f.store.targetRef),children:m})});Bn.displayName=`@mantine/core/ComboboxTarget`;function Vn(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].hasAttribute(`data-combobox-disabled`))return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].hasAttribute(`data-combobox-disabled`))return e}return e}function Hn(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),_=(0,V.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),v=(0,V.useCallback)((e=`unknown`)=>{s?_(e):g(e)},[_,g,s]),y=(0,V.useCallback)(()=>{let e=Yt(f.current);qt(`#${l.current} [data-combobox-selected]`,e)?.removeAttribute(`data-combobox-selected`)},[]),b=(0,V.useCallback)(e=>{let t=Yt(f.current),n=qt(`#${l.current}`,t),r=n?Jt(`[data-combobox-option]`,n):null;if(!r)return null;let i=e>=r.length?0:e<0?r.length-1:e;return u.current=i,r?.[i]&&!r[i].hasAttribute(`data-combobox-disabled`)?(y(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,y]),x=(0,V.useCallback)(()=>{let e=Yt(f.current),t=qt(`#${l.current} [data-combobox-active]`,e);if(t){let n=Jt(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return b(n)}return b(0)},[b]),S=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Hn(u.current,t,a))},[b,a]),C=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Vn(u.current,t,a))},[b,a]),w=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Un(t))},[b]),T=(0,V.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=Yt(f.current),r=Jt(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=Yt(f.current),r=Jt(`#${l.current} [data-combobox-option]`,n),i=r.findIndex(t=>t.hasAttribute(`data-combobox-${e}`));u.current=i,t?.scrollIntoView&&r[i]?.scrollIntoView({block:`nearest`,behavior:o})},0)},[]),E=(0,V.useCallback)(()=>{u.current=-1,y()},[y]),D=(0,V.useCallback)(()=>{let e=Yt(f.current);(Jt(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),O=(0,V.useCallback)(e=>{l.current=e},[]),k=(0,V.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),A=(0,V.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),j=(0,V.useCallback)(()=>u.current,[]);return(0,V.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:g,closeDropdown:_,toggleDropdown:v,selectedOptionIndex:u.current,getSelectedOptionIndex:j,selectOption:b,selectFirstOption:w,selectActiveOption:x,selectNextOption:S,selectPreviousOption:C,resetSelectedOption:E,updateSelectedOptionIndex:T,listId:l.current,setListId:O,clickSelectedOption:D,searchRef:d,focusSearchInput:k,targetRef:f,focusTarget:A}}var Gn={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},Kn=g((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:P(n),"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)}})),qn=e=>{let t=u(`Combobox`,Gn,e),{classNames:n,styles:r,unstyled:i,children:o,store:s,vars:c,onOptionSubmit:l,onClose:d,size:f,dropdownPadding:p,resetSelectionOnOptionHover:m,__staticSelector:h,readOnly:g,attributes:_,floatingHeight:v,middlewares:y,...b}=t,x=v===`viewport`?{...y,flip:!1,size:{...typeof y?.size==`object`?y.size:{},padding:typeof y?.size==`object`&&y.size.padding!==void 0?y.size.padding:10,apply:({availableHeight:e,availableWidth:t,elements:n,...r})=>{n.floating.style.setProperty(`--combobox-floating-max-height`,`${e}px`);let i=y?.size;typeof i==`object`&&i.apply?i.apply({availableHeight:e,availableWidth:t,elements:n,...r}):i&&Object.assign(n.floating.style,{maxWidth:`${t}px`,maxHeight:`${e}px`})}}}:y,S=Wn(),C=s||S,w=a({name:h||`Combobox`,classes:_n,props:t,classNames:n,styles:r,unstyled:i,attributes:_,vars:c,varsResolver:Kn}),T=()=>{d?.(),C.closeDropdown()};return(0,H.jsx)(xn,{value:{getStyles:w,store:C,onOptionSubmit:l,size:f,resetSelectionOnOptionHover:m,readOnly:g,floatingHeight:v},children:(0,H.jsx)(Ne,{opened:C.dropdownOpened,...b,middlewares:x,onChange:e=>!e&&T(),withRoles:!1,unstyled:i,children:o})})};qn.extend=e=>e,qn.classes=_n,qn.varsResolver=Kn,qn.displayName=`@mantine/core/Combobox`,qn.Target=Bn,qn.Dropdown=wn,qn.Options=In,qn.Option=Fn,qn.Search=Rn,qn.Empty=Dn,qn.Chevron=bn,qn.Footer=jn,qn.Header=Nn,qn.EventsTarget=An,qn.DropdownTarget=En,qn.Group=Mn,qn.ClearButton=Cn,qn.HiddenInput=Pn;function Jn({children:e,role:t}){let n=(0,V.use)(D);return n?(0,H.jsx)(`div`,{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):(0,H.jsx)(H.Fragment,{children:e})}var Yn={root:`m_5f75b09e`,body:`m_5f6e695e`,labelWrapper:`m_d3ea56bb`,label:`m_8ee546b8`,description:`m_328f68c0`,error:`m_8e8a99cc`},Xn=Yn;function Zn({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:i,unstyled:s,children:c,label:l,description:u,id:d,disabled:f,error:p,size:m,labelPosition:h=`left`,bodyElement:g=`div`,labelElement:_=`label`,variant:v,style:y,vars:b,mod:x,attributes:S,...C}){let w=a({name:e,props:t,className:n,style:y,classes:Yn,classNames:r,styles:i,unstyled:s,attributes:S}),T=u?`${d}-description`:void 0,E=p&&typeof p!=`boolean`?`${d}-error`:void 0;return(0,H.jsx)(o,{...w(`root`),__vars:{"--label-fz":L(m),"--label-lh":M(m,`label-lh`)},mod:[{"label-position":h},x],variant:v,size:m,...C,children:(0,H.jsxs)(o,{component:g,htmlFor:g===`label`?d:void 0,...w(`body`),children:[c,(0,H.jsxs)(`div`,{...w(`labelWrapper`),"data-disabled":f||void 0,children:[l&&(0,H.jsx)(o,{component:_,htmlFor:_===`label`?d:void 0,...w(`label`),"data-disabled":f||void 0,children:l}),u&&(0,H.jsx)(k.Description,{id:T,size:m,__inheritStyles:!1,...w(`description`),children:u}),p&&typeof p!=`boolean`&&(0,H.jsx)(k.Error,{id:E,size:m,__inheritStyles:!1,...w(`error`),children:p})]})]})})}Zn.displayName=`@mantine/core/InlineInput`;function Qn(e){return`group`in e}function $n({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function tr(e,t=new Set){if(Array.isArray(e))for(let n of e)if(Qn(n))tr(n.items,t);else{if(n.value===void 0)throw Error(`[@mantine/core] Each option must have value property`);if(t.has(n.value))throw Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function nr(e,t){return Array.isArray(e)?e.includes(t):e===t}function rr({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!Qn(e)){let s=nr(r,e.value),c=t&&(s?(0,H.jsx)(Ke,{className:_n.optionsDropdownCheckIcon}):n?(0,H.jsx)(`div`,{className:_n.optionsDropdownCheckPlaceholder}):null),l=(0,H.jsxs)(H.Fragment,{children:[i===`left`&&c,(0,H.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,H.jsx)(qn.Option,{value:e.value,disabled:e.disabled,className:_({[_n.optionsDropdownOption]:!a}),"data-reverse":i===`right`||void 0,"data-checked":s||void 0,"aria-selected":s,active:s,children:typeof o==`function`?o({option:e,checked:s}):l})}let s=e.items.map(e=>(0,H.jsx)(rr,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,H.jsx)(qn.Group,{label:e.group,children:s})}function ir({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:i,limit:a,maxDropdownHeight:o,floatingHeight:s,withScrollArea:c=!0,filterOptions:l=!0,withCheckIcon:u=!1,withAlignedLabels:d=!1,value:f,checkIconPosition:p,nothingFoundMessage:m,unstyled:h,labelId:g,renderOption:_,scrollAreaProps:v,"aria-label":y}){let b=Sn();tr(e);let x=typeof i==`string`?(r||$n)({options:e,search:l?i:``,limit:a??1/0}):e,S=er(x),C=x.map((e,t)=>(0,H.jsx)(rr,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},Qn(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,H.jsx)(qn.Dropdown,{hidden:t||n&&S,"data-composed":!0,children:(0,H.jsxs)(qn.Options,{labelledBy:g,"aria-label":y,children:[c?(0,H.jsx)(pe.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:C}):C,S&&m&&(0,H.jsx)(qn.Empty,{children:m})]})})}function ar(e,t,n,r){if(t===n||r===`before`&&n===t+1||r===`after`&&n===t-1)return e;let i=e.slice(),[a]=i.splice(t,1),o=t{let t=e.lastElementChild;return t?t instanceof HTMLInputElement?t:t.querySelector(`input`):null},sr=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let e=i.current;e&&(i.current=null,sr(o.current,e.expectedValue)&&e.container?.querySelector(`[data-mantine-pill-index="${e.index}"]`)?.focus())});let s=(0,V.useCallback)(e=>{a.current=e},[]);return{getPillProps:e=>{if(n)return{draggable:!0,tabIndex:-1,"data-mantine-pill-index":e,"aria-keyshortcuts":`Alt+ArrowLeft Alt+ArrowRight`,onMouseDown:e=>{e.button===0&&e.stopPropagation()},onDragStart:t=>{t.stopPropagation(),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,String(e)),r.current.draggedIndex=e;let n=t.currentTarget,i=n.getBoundingClientRect(),a=n.cloneNode(!0);a.removeAttribute(`data-dragging`),a.removeAttribute(`data-drag-over`),a.style.position=`fixed`,a.style.top=`-9999px`,a.style.left=`-9999px`,a.style.width=`${i.width}px`,a.style.height=`${i.height}px`,a.style.pointerEvents=`none`,document.body.appendChild(a),t.dataTransfer.setDragImage(a,t.clientX-i.left,t.clientY-i.top),setTimeout(()=>a.parentNode?.removeChild(a),0),requestAnimationFrame(()=>{n.setAttribute(`data-dragging`,`true`)})},onDragOver:t=>{let{draggedIndex:n}=r.current;if(n===null||n===e)return;let i=t.currentTarget,a=i.getBoundingClientRect(),o=t.clientX-a.left,s=(getComputedStyle(i).direction===`rtl`?o>a.width/2:o{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||(t.removeAttribute(`data-drag-over`),r.current.currentDropTarget===t&&(r.current.currentDropTarget=null))},onDrop:n=>{n.preventDefault(),n.stopPropagation();let i=n.currentTarget,a=i.getAttribute(`data-drag-over`);i.removeAttribute(`data-drag-over`);let{draggedIndex:s}=r.current;if(s!==null&&a&&s!==e){let n=ar(o.current,s,e,a);n!==o.current&&t(n)}r.current.draggedIndex=null,r.current.currentDropTarget=null},onDragEnd:e=>{e.currentTarget.removeAttribute(`data-dragging`);let t=r.current.currentDropTarget;t&&t.removeAttribute(`data-drag-over`),r.current.draggedIndex=null,r.current.currentDropTarget=null},onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`)return;let r=n.currentTarget,a=getComputedStyle(r).direction===`rtl`?n.key===`ArrowLeft`:n.key===`ArrowRight`,s=a?e+1:e-1;if(n.altKey){if(s<0||s>=o.current.length)return;n.preventDefault(),n.stopPropagation();let c=a?`after`:`before`,l=ar(o.current,e,s,c);if(l===o.current)return;i.current={container:r.parentElement,index:s,expectedValue:l},t(l);return}if(s<0)return;let c=r.parentElement;if(c){if(n.preventDefault(),n.stopPropagation(),s>=o.current.length){or(c)?.focus();return}c.querySelector(`[data-mantine-pill-index="${s}"]`)?.focus()}}}},getListProps:()=>n?{ref:s}:{},handleInputKeyDown:e=>{if(!n||e.key!==`ArrowLeft`)return;let t=e.currentTarget;if(!(t.value.length===0||t.selectionStart===0&&t.selectionEnd===0))return;let r=a.current;if(!r)return;let i=r.querySelectorAll(`[data-mantine-pill-index]`);i.length!==0&&(e.preventDefault(),i[i.length-1].focus())}}}function lr({id:e,label:t,labelProps:n,inputWrapperOrder:r}){if(t&&(!r||r.includes(`label`)))return n?.id||`${e}-label`}function ur(e){let t=e.currentTarget;return Yt(t).activeElement!==t}var dr=(0,V.createContext)(null),fr={root:`m_7cda1cd6`,"root--default":`m_44da308b`,"root--contrast":`m_e3a01f8`,label:`m_1e0e6180`,remove:`m_ae386778`,group:`m_1dcfd90b`},pr=(0,V.createContext)(null),mr=g((e,{gap:t},{size:n})=>({group:{"--pg-gap":t===void 0?M(n,`pg-gap`):M(t)}})),hr=h(e=>{let t=u(`PillGroup`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,size:d,disabled:f,attributes:p,...m}=t,h=(0,V.use)(dr)?.size||d||void 0,g=a({name:`PillGroup`,classes:fr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:p,vars:l,varsResolver:mr,stylesCtx:{size:h},rootSelector:`group`});return(0,H.jsx)(pr,{value:{size:h,disabled:f},children:(0,H.jsx)(o,{size:h,...g(`group`),...m})})});hr.classes=fr,hr.varsResolver=mr,hr.displayName=`@mantine/core/PillGroup`;var gr={variant:`default`},_r=g((e,{radius:t},{size:n})=>({root:{"--pill-fz":M(n,`pill-fz`),"--pill-height":M(n,`pill-height`),"--pill-radius":t===void 0?void 0:ne(t)}})),vr=h(e=>{let t=u(`Pill`,gr,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,variant:d,children:f,withRemoveButton:p,onRemove:m,removeButtonProps:h,radius:g,size:_,disabled:v,mod:y,attributes:b,...x}=t,S=(0,V.use)(pr),C=(0,V.use)(dr),w=_||S?.size||void 0,T=C?.variant===`filled`?`contrast`:d||`default`,E=a({name:`Pill`,classes:fr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:b,vars:l,varsResolver:_r,stylesCtx:{size:w}});return(0,H.jsxs)(o,{component:`span`,variant:T,size:w,...E(`root`,{variant:T}),mod:[{"with-remove":p&&!v,disabled:v||S?.disabled},y],...x,children:[(0,H.jsx)(`span`,{...E(`label`),children:f}),p&&(0,H.jsx)(ae,{variant:`transparent`,radius:g,tabIndex:-1,"aria-hidden":!0,unstyled:c,...h,...E(`remove`,{className:h?.className,style:h?.style}),onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),h?.onMouseDown?.(e)},onClick:e=>{e.stopPropagation(),m?.(),h?.onClick?.(e)}})]})});vr.classes=fr,vr.varsResolver=_r,vr.displayName=`@mantine/core/Pill`,vr.Group=hr;var yr={field:`m_45c4369d`},br={type:`visible`},xr=h(e=>{let t=u(`PillsInputField`,br,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,type:d,disabled:f,id:p,pointer:m,mod:h,attributes:g,ref:_,...v}=t,y=(0,V.use)(dr),b=(0,V.use)(D),x=a({name:`PillsInputField`,classes:yr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:g,rootSelector:`field`}),S=f||y?.disabled;return(0,H.jsx)(o,{component:`input`,ref:re(_,y?.fieldRef),"data-type":d,disabled:S,mod:[{disabled:S,pointer:m},h],...x(`field`),...v,id:b?.inputId||p,"aria-invalid":y?.hasError,"aria-describedby":b?.describedBy,type:`text`,onMouseDown:e=>!m&&e.stopPropagation()})});xr.classes=yr,xr.displayName=`@mantine/core/PillsInputField`;var Sr={size:`sm`},Cr=h(e=>{let{children:t,onMouseDown:n,onClick:r,size:i,disabled:a,__staticSelector:o,error:s,variant:c,...l}=u([`Input`,`InputWrapper`,`PillsInput`],Sr,e),d=(0,V.useRef)(null);return(0,H.jsx)(dr,{value:{fieldRef:d,size:i,disabled:a,hasError:!!s,variant:c},children:(0,H.jsx)(N,{size:i,error:s,variant:c,component:`div`,"data-no-overflow":!0,onMouseDown:e=>{e.preventDefault(),n?.(e),d.current?.focus()},onClick:e=>{e.preventDefault(),e.currentTarget.closest(`fieldset`)?.disabled||(d.current?.focus(),r?.(e))},...l,multiline:!0,disabled:a,__staticSelector:o||`PillsInput`,withAria:!1,children:t})})});Cr.displayName=`@mantine/core/PillsInput`,Cr.classes=N.classes,Cr.Field=xr;function wr(e,t){let n=t.trim().toLowerCase();if(n===``)return;let r=Object.values(e).filter(e=>!e.disabled&&e.label.trim().toLowerCase()===n);return r.length===1?r[0]:void 0}function Tr(e){return typeof e==`string`?e.trim().toLowerCase():e}function Er({data:e,value:t}){let n=t.map(Tr);return e.reduce((e,t)=>(Qn(t)?e.push({group:t.group,items:t.items.filter(e=>n.indexOf(Tr(e.value))===-1)}):n.indexOf(Tr(t.value))===-1&&e.push(t),e),[])}var Dr={xs:41,sm:50,md:60,lg:72,xl:89},Or={maxValues:1/0,withCheckIcon:!0,checkIconPosition:`left`,hiddenInputValuesDivider:`,`,clearSearchOnChange:!0,openOnFocus:!0,size:`sm`},kr=c(e=>{let t=u([`Input`,`InputWrapper`,`MultiSelect`],Or,e),{classNames:n,className:r,style:i,styles:o,unstyled:s,vars:c,size:l,value:f,defaultValue:p,onChange:m,onKeyDown:h,variant:g,data:_,dropdownOpened:v,defaultDropdownOpened:y,onDropdownOpen:b,onDropdownClose:x,selectFirstOptionOnChange:S,selectFirstOptionOnDropdownOpen:C,onOptionSubmit:w,comboboxProps:T,filter:E,limit:D,withScrollArea:O,maxDropdownHeight:k,floatingHeight:j,searchValue:M,defaultSearchValue:N,onSearchChange:P,readOnly:I,disabled:L,onFocus:ee,onBlur:R,radius:te,rightSection:ne,rightSectionWidth:re,rightSectionPointerEvents:ie,rightSectionProps:z,leftSection:ae,leftSectionWidth:B,leftSectionPointerEvents:oe,leftSectionProps:se,inputContainer:ce,inputWrapperOrder:le,withAsterisk:ue,labelProps:de,descriptionProps:fe,errorProps:pe,successProps:me,wrapperProps:he,description:ge,label:_e,error:ve,success:ye,maxValues:be,searchable:xe,nothingFoundMessage:Se,withCheckIcon:Ce,withAlignedLabels:we,checkIconPosition:Te,hidePickedOptions:Ee,withErrorStyles:De,withSuccessStyles:Oe,name:ke,form:Ae,id:je,clearable:Me,clearSectionMode:Ne,clearButtonProps:Pe,hiddenInputProps:Fe,placeholder:Ie,hiddenInputValuesDivider:Le,required:Re,mod:Be,renderOption:Ve,renderPill:He,onRemove:Ue,onClear:We,onMaxValues:Ge,scrollAreaProps:Ke,chevronColor:qe,attributes:Je,clearSearchOnChange:Ye,openOnFocus:Xe,loading:Ze,loadingPosition:Qe,withPillsReorder:$e,...et}=t,tt=F(je),nt=lr({id:tt,label:_e,labelProps:de,inputWrapperOrder:le}),rt=hn(_),it=gn(rt),at=(0,V.useRef)({}),ot=Wn({opened:v,defaultOpened:y,onDropdownOpen:()=>{b?.(),C&&ot.selectFirstOption()},onDropdownClose:()=>{x?.(),ot.resetSelectedOption()}}),{styleProps:st,rest:{type:ct,autoComplete:lt,...ut}}=d(et),[dt,ft]=ze({value:f,defaultValue:p,finalValue:[],onChange:m}),{getPillProps:pt,getListProps:mt,handleInputKeyDown:ht}=cr({value:dt,onChange:ft,enabled:$e&&!L&&!I}),[gt,_t]=ze({value:M,defaultValue:N,finalValue:``,onChange:P}),vt=e=>{_t(e),ot.resetSelectedOption()},yt=a({name:`MultiSelect`,classes:{},props:t,classNames:n,styles:o,unstyled:s,attributes:Je}),{resolvedClassNames:bt,resolvedStyles:xt}=A({props:t,styles:o,classNames:n}),St=e=>{h?.(e),!e.defaultPrevented&&(e.key===` `&&!xe&&(e.preventDefault(),ot.toggleDropdown()),e.key===`Backspace`&>.length===0&&dt.length>0&&!I&&(Ue?.(dt[dt.length-1]),ft(dt.slice(0,dt.length-1))),ht(e))},Ct=dt.map((e,t)=>{let n=it[`${e}`]||at.current[`${e}`],r=pt(t);return He?(0,H.jsx)(V.Fragment,{children:He({option:n,value:e,onRemove:()=>{ft(dt.filter(t=>e!==t)),Ue?.(e)},disabled:L,reorderProps:r})},`${e}-${t}`):(0,H.jsx)(vr,{withRemoveButton:!I&&!it[`${e}`]?.disabled,onRemove:()=>{ft(dt.filter(t=>e!==t)),Ue?.(e)},unstyled:s,disabled:L,...yt(`pill`),...r,children:n?.label||e},`${e}-${t}`)});(0,V.useEffect)(()=>{S&&ot.selectFirstOption()},[S,gt]),(0,V.useEffect)(()=>{dt.forEach(e=>{`${e}`in it&&(at.current[`${e}`]=it[`${e}`])})},[it,dt]);let wt=(0,H.jsx)(qn.ClearButton,{...Pe,onClear:()=>{We?.(),ft([]),vt(``)}}),Tt=Er({data:rt,value:dt}),Et=Me&&dt.length>0&&!L&&!I,Dt=Et?{paddingInlineEnd:Dr[l]??Dr.sm}:void 0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(qn,{store:ot,classNames:bt,styles:xt,unstyled:s,size:l,readOnly:I,__staticSelector:`MultiSelect`,attributes:Je,floatingHeight:j,onOptionSubmit:e=>{w?.(e),Ye&&vt(``),ot.updateSelectedOptionIndex(`selected`),dt.includes(it[`${e}`].value)?(ft(dt.filter(t=>t!==it[`${e}`].value)),Ue?.(it[`${e}`].value)):dt.lengthxe?ot.openDropdown():ot.toggleDropdown(),"data-expanded":ot.dropdownOpened||void 0,id:tt,required:Re,mod:Be,attributes:Je,children:(0,H.jsxs)(vr.Group,{attributes:Je,disabled:L,unstyled:s,...yt(`pillsList`,{style:Dt}),...mt(),children:[Ct,(0,H.jsx)(qn.EventsTarget,{autoComplete:lt,withExpandedAttribute:!0,children:(0,H.jsx)(Cr.Field,{...ut,id:tt,placeholder:Ie,type:!xe&&!Ie?`hidden`:`visible`,...yt(`inputField`),unstyled:s,onFocus:e=>{ee?.(e),Xe&&xe&&ot.openDropdown()},onBlur:e=>{R?.(e),ot.closeDropdown(),vt(``)},onKeyDown:St,value:gt,onChange:e=>{if(ur(e)){if(!I){let t=wr(it,e.currentTarget.value);t&&!dt.includes(t.value)&&dt.length{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ProgressLabel`,null,e),c=jr();return(0,H.jsx)(o,{...c.getStyles(`label`,{className:n,style:r,classNames:t,styles:i}),...s})});Nr.classes=Mr,Nr.displayName=`@mantine/core/ProgressLabel`;var Pr=g((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":M(t,`progress-size`),"--progress-radius":n===void 0?void 0:ne(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),Fr=h(e=>{let t=u(`ProgressRoot`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,autoContrast:d,transitionDuration:f,orientation:p,attributes:m,mod:h,...g}=t,_=a({name:`Progress`,classes:Mr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:m,vars:l,varsResolver:Pr});return(0,H.jsx)(Ar,{value:{getStyles:_,autoContrast:d},children:(0,H.jsx)(o,{mod:[{orientation:p},h],..._(`root`),...g})})});Fr.classes=Mr,Fr.varsResolver=Pr,Fr.displayName=`@mantine/core/ProgressRoot`;var Ir={withAria:!0},Lr=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,withAria:c,color:d,striped:p,animated:m,mod:h,...g}=u(`ProgressSection`,Ir,e),_=jr(),v=f(),y=c?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":s,"aria-valuetext":`${s}%`}:{};return(0,H.jsx)(o,{..._.getStyles(`section`,{className:n,classNames:t,styles:i,style:r}),...g,...y,mod:[{striped:p||m,animated:m},h],__vars:{"--progress-section-size":`${s}%`,"--progress-section-color":l(d,v),"--progress-label-color":Xt(_.autoContrast,v)?st({color:d,theme:v,autoContrast:_.autoContrast}):void 0}})});Lr.classes=Mr,Lr.displayName=`@mantine/core/ProgressSection`;var Rr=h(e=>{let t=u(`Progress`,null,e),{value:n,classNames:r,styles:i,vars:a,color:o,striped:s,animated:c,"aria-label":l,...d}=t,{resolvedClassNames:f,resolvedStyles:p}=A({classNames:r,styles:i,props:t});return(0,H.jsx)(Fr,{classNames:f,styles:p,vars:a,...d,children:(0,H.jsx)(Lr,{value:n,color:o,striped:s,animated:c,"aria-label":l})})});Rr.classes=Mr,Rr.displayName=`@mantine/core/Progress`,Rr.Section=Lr,Rr.Root=Fr,Rr.Label=Nr;var zr={root:`m_cf365364`,indicator:`m_9e182ccd`,label:`m_1738fcb2`,input:`m_1714d588`,control:`m_69686b9b`,innerLabel:`m_78882f40`},Br={withItemsBorders:!0},Vr=g((e,{radius:t,color:n,transitionDuration:r,size:i,transitionTimingFunction:a})=>({root:{"--sc-radius":t===void 0?void 0:ne(t),"--sc-color":n?l(n,e):void 0,"--sc-shadow":n?void 0:`var(--mantine-shadow-xs)`,"--sc-transition-duration":r===void 0?void 0:`${r}ms`,"--sc-transition-timing-function":a,"--sc-padding":M(i,`sc-padding`),"--sc-font-size":L(i)}})),Hr=c(e=>{let t=u(`SegmentedControl`,Br,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,data:d,value:p,defaultValue:m,onChange:h,size:g,name:_,disabled:v,readOnly:y,fullWidth:b,orientation:x,radius:S,color:C,transitionDuration:w,transitionTimingFunction:T,variant:E,autoContrast:D,withItemsBorders:O,mod:k,attributes:A,ref:j,...M}=t,N=a({name:`SegmentedControl`,props:t,classes:zr,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:A,vars:l,varsResolver:Vr}),P=f(),I=d.map(e=>Kt(e)?{label:`${e}`,value:e}:e),L=Gt(),[ee,R]=(0,V.useState)(0),[te,ne]=(0,V.useState)(null),[ie,z]=(0,V.useState)({}),ae=(e,t)=>{e!==null&&ie[t]!==e&&(ie[t]=e,z({...ie}))},[B,oe]=ze({value:p,defaultValue:m,finalValue:Array.isArray(d)?I.find(e=>!e.disabled)?.value??d[0]?.value??null:null,onChange:h}),se=F(_),ce=I.map(e=>`${e.value}`),le=I.map(e=>(0,V.createElement)(o,{...N(`control`),mod:{active:B===e.value,orientation:x},key:`${e.value}`},(0,V.createElement)(`input`,{...N(`input`),disabled:v||e.disabled,type:`radio`,name:se,value:`${e.value}`,id:`${se}-${e.value}`,checked:B===e.value,onChange:()=>!y&&oe(e.value),"data-focus-ring":P.focusRing,key:`${e.value}-input`}),(0,V.createElement)(o,{component:`label`,...N(`label`),mod:{active:B===e.value&&!(v||e.disabled),disabled:v||e.disabled,"read-only":y},htmlFor:`${se}-${e.value}`,ref:t=>ae(t,`${e.value}`),__vars:{"--sc-label-color":C===void 0?void 0:st({color:C,theme:P,autoContrast:D})},key:`${e.value}-label`},(0,H.jsx)(`span`,{...N(`innerLabel`),children:e.label})))),ue=re(j,ne);return Vt(()=>{R(e=>e+1)},[d.length]),Vt(()=>{z(e=>{let t={};return ce.forEach(n=>{n in e&&(t[n]=e[n])}),Object.keys(t).length===Object.keys(e).length?e:t})},[ce]),d.length===0?null:(0,H.jsxs)(o,{...N(`root`),variant:E,size:g,ref:ue,mod:[{"full-width":b,orientation:x,initialized:L,"with-items-borders":O},k],...M,role:`radiogroup`,"data-disabled":v,children:[B!==void 0&&(0,H.jsx)(tn,{target:ie[`${B}`],parent:te,component:`span`,transitionDuration:`var(--sc-transition-duration)`,...N(`indicator`)},ee),le]})});Hr.classes=zr,Hr.varsResolver=Vr,Hr.displayName=`@mantine/core/SegmentedControl`;var Ur={size:`sm`,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},Wr=c(e=>{let t=u([`Input`,`InputWrapper`,`Select`],Ur,e),{classNames:n,styles:r,unstyled:i,vars:a,dropdownOpened:o,defaultDropdownOpened:s,onDropdownClose:c,onDropdownOpen:l,onFocus:d,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:v,selectFirstOptionOnDropdownOpen:y,onOptionSubmit:b,comboboxProps:x,readOnly:S,disabled:C,filter:w,limit:T,withScrollArea:E,maxDropdownHeight:D,floatingHeight:O,size:k,searchable:j,rightSection:M,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,name:R,form:te,searchValue:ne,defaultSearchValue:re,onSearchChange:ie,allowDeselect:z,error:ae,rightSectionPointerEvents:B,id:oe,clearable:se,clearSectionMode:ce,clearButtonProps:le,hiddenInputProps:ue,renderOption:de,onClear:fe,autoComplete:pe,scrollAreaProps:me,__defaultRightSection:he,__clearSection:ge,__clearable:_e,chevronColor:ve,autoSelectOnBlur:ye,openOnFocus:be,attributes:xe,...Se}=t,Ce=(0,V.useMemo)(()=>hn(h),[h]),we=(0,V.useRef)({}),Te=(0,V.useMemo)(()=>gn(Ce),[Ce]),Ee=F(oe),De=lr({id:Ee,label:Se.label,labelProps:Se.labelProps,inputWrapperOrder:Se.inputWrapperOrder}),[Oe,ke,Ae]=ze({value:g,defaultValue:_,finalValue:null,onChange:m}),je=Oe==null?void 0:`${Oe}`in Te?Te[`${Oe}`]:we.current[`${Oe}`],Me=Ut(je),[Ne,Pe,Fe]=ze({value:ne,defaultValue:re,finalValue:je?je.label:``,onChange:ie}),Ie=Wn({opened:o,defaultOpened:s,onDropdownOpen:()=>{l?.(),y?Ie.selectFirstOption():Ie.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{c?.(),setTimeout(Ie.resetSelectedOption,0)}}),Le=e=>{Pe(e),Ie.resetSelectedOption()},{resolvedClassNames:Re,resolvedStyles:Be}=A({props:t,styles:r,classNames:n});(0,V.useEffect)(()=>{v&&Ie.selectFirstOption()},[v,Ne]),(0,V.useEffect)(()=>{g===null&&Le(``),g!=null&&je&&(Me?.value!==je.value||Me?.label!==je.label)&&Le(je.label)},[g,je]),(0,V.useEffect)(()=>{!Ae&&!Fe&&Le(Oe==null?``:`${Oe}`in Te?Te[`${Oe}`]?.label:we.current[`${Oe}`]?.label||``)},[Te,Oe]),(0,V.useEffect)(()=>{Oe&&`${Oe}`in Te&&(we.current[`${Oe}`]=Te[`${Oe}`])},[Te,Oe]);let Ve=(0,H.jsx)(qn.ClearButton,{...le,onClear:()=>{ke(null,null),Le(``),fe?.()}}),He=se&&Oe!=null&&!C&&!S;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(qn,{store:Ie,__staticSelector:`Select`,classNames:Re,styles:Be,unstyled:i,readOnly:S,size:k,attributes:xe,floatingHeight:O,keepMounted:ye,onOptionSubmit:e=>{b?.(e);let t=z&&`${Te[e].value}`==`${Oe}`?null:Te[e],n=t?t.value:null;n!==Oe&&ke(n,t),!Ae&&Le(n==null?``:t?.label||``),Ie.closeDropdown()},...x,children:[(0,H.jsx)(qn.Target,{targetType:j?`input`:`button`,autoComplete:pe,withExpandedAttribute:!0,children:(0,H.jsx)(N,{id:Ee,__defaultRightSection:(0,H.jsx)(qn.Chevron,{size:k,error:ae,unstyled:i,color:ve}),__clearSection:Ve,__clearable:He,__clearSectionMode:ce,rightSection:M,rightSectionPointerEvents:B||`none`,...Se,size:k,__staticSelector:`Select`,disabled:C,readOnly:S||!j,value:Ne,onChange:e=>{if(ur(e)){if(!S){let t=wr(Te,e.currentTarget.value);t&&`${t.value}`!=`${Oe}`&&(ke(t.value,t),!Ae&&Le(t.label))}return}Le(e.currentTarget.value),Ie.openDropdown(),v&&Ie.selectFirstOption()},onFocus:e=>{be&&j&&Ie.openDropdown(),d?.(e)},onBlur:e=>{ye&&Ie.clickSelectedOption(),Ie.closeDropdown();let t=Oe!=null&&(`${Oe}`in Te?Te[`${Oe}`]:we.current[`${Oe}`]);Le(t&&t.label||``),f?.(e)},onClick:e=>{j?Ie.openDropdown():Ie.toggleDropdown(),p?.(e)},classNames:Re,styles:Be,unstyled:i,pointer:!j,error:ae,attributes:xe})}),(0,H.jsx)(ir,{data:Ce,hidden:S||C,filter:w,search:Ne,limit:T,hiddenWhenEmpty:!ee,withScrollArea:E,maxDropdownHeight:D,filterOptions:!!j&&je?.label!==Ne,value:Oe,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,unstyled:i,labelId:De,"aria-label":De?void 0:Se[`aria-label`],renderOption:de,scrollAreaProps:me})]}),(0,H.jsx)(qn.HiddenInput,{value:Oe,name:R,form:te,disabled:C,...ue})]})});Wr.classes={...N.classes,...qn.classes},Wr.displayName=`@mantine/core/Select`;function Gr(e){if(e!==void 0)return typeof e==`number`?P(e):e}function Kr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=f(),s=t===void 0?e:t,c=r!==void 0,l=E({"--sg-spacing-x":z(Lt(e)),"--sg-spacing-y":z(Lt(s)),"--sg-auto-rows":i,...c?{"--sg-min-col-width":Gr(r)}:{"--sg-cols":Lt(n)?.toString()}}),u=O(o.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=z(e[r])),typeof s==`object`&&s[r]!==void 0&&(t[r][`--sg-spacing-y`]=z(s[r])),!c&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=Ge(O(u),o.breakpoints).filter(e=>O(u[e.value]).length>0).map(e=>({query:`(min-width: ${o.breakpoints[e.value]})`,styles:u[e.value]}));return(0,H.jsx)(j,{styles:l,media:d,selector:a})}function qr(e){return typeof e==`object`&&e?O(e):[]}function Jr(e){return e.sort((e,t)=>We(e)-We(t))}function Yr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}){return Jr(Array.from(new Set([...qr(e),...qr(t),...r===void 0?qr(n):[]])))}function Xr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=t===void 0?e:t,s=r!==void 0,c=E({"--sg-spacing-x":z(Lt(e)),"--sg-spacing-y":z(Lt(o)),"--sg-auto-rows":i,...s?{"--sg-min-col-width":Gr(r)}:{"--sg-cols":Lt(n)?.toString()}}),l=Yr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}),u=l.reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=z(e[r])),typeof o==`object`&&o[r]!==void 0&&(t[r][`--sg-spacing-y`]=z(o[r])),!s&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=l.map(e=>({query:`simple-grid (min-width: ${e})`,styles:u[e]}));return(0,H.jsx)(j,{styles:c,container:d,selector:a})}var Zr={container:`m_925c2d2c`,root:`m_2415a157`},Qr={cols:1,spacing:`md`,type:`media`},$r=h(e=>{let t=u(`SimpleGrid`,Qr,e),{classNames:n,className:r,style:i,styles:c,unstyled:l,vars:d,cols:f,verticalSpacing:p,spacing:m,type:h,minColWidth:g,autoFlow:_,autoRows:v,attributes:y,...b}=t,x=a({name:`SimpleGrid`,classes:Zr,props:t,className:r,style:i,classNames:n,styles:c,unstyled:l,attributes:y,vars:d}),S=s(),C=g===void 0?void 0:_||`auto-fill`;return h===`container`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Xr,{...t,selector:`.${S}`}),(0,H.jsx)(`div`,{...x(`container`),children:(0,H.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Kr,{...t,selector:`.${S}`}),(0,H.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})]})});$r.classes=Zr,$r.displayName=`@mantine/core/SimpleGrid`;var ei=(0,V.createContext)(null),ti={hiddenInputValuesSeparator:`,`},ni=c((e=>{let{value:t,defaultValue:n,onChange:r,size:i,wrapperProps:a,children:o,readOnly:s,name:c,hiddenInputValuesSeparator:l,hiddenInputProps:d,maxSelectedValues:f,disabled:p,...m}=u(`SwitchGroup`,ti,e),[h,g]=ze({value:t,defaultValue:n,finalValue:[],onChange:r}),_=e=>{let t=e.currentTarget.value;if(s)return;let n=h.includes(t);!n&&f&&h.length>=f||g(n?h.filter(e=>e!==t):[...h,t])},v=e=>{if(p)return!0;if(!f)return!1;let t=h.includes(e),n=h.length>=f;return!t&&n},y=h.join(l);return(0,H.jsx)(ei,{value:{value:h,onChange:_,size:i,isDisabled:v},children:(0,H.jsxs)(k.Wrapper,{size:i,...a,...m,labelElement:`div`,__staticSelector:`SwitchGroup`,children:[(0,H.jsx)(Jn,{role:`group`,children:o}),(0,H.jsx)(`input`,{type:`hidden`,name:c,value:y,...d})]})})}));ni.classes=k.Wrapper.classes,ni.displayName=`@mantine/core/SwitchGroup`;var ri={root:`m_5f93f3bb`,input:`m_926b4011`,track:`m_9307d992`,thumb:`m_93039a1d`,trackLabel:`m_8277e082`},ii={labelPosition:`right`,withThumbIndicator:!0},ai=g((e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:ne(t),"--switch-height":M(r,`switch-height`),"--switch-width":M(r,`switch-width`),"--switch-thumb-size":M(r,`switch-thumb-size`),"--switch-label-font-size":M(r,`switch-label-font-size`),"--switch-track-label-padding":M(r,`switch-track-label-padding`),"--switch-color":n?l(n,e):void 0}})),oi=h(e=>{let t=u(`Switch`,ii,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,color:f,label:p,offLabel:m,onLabel:h,id:g,size:_,radius:v,wrapperProps:y,thumbIcon:b,checked:x,defaultChecked:S,onChange:C,labelPosition:w,description:T,error:E,disabled:D,variant:O,rootRef:k,mod:A,withThumbIndicator:j,attributes:M,...N}=t,P=(0,V.use)(ei),I=_||P?.size,L=a({name:`Switch`,props:t,classes:ri,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:M,vars:l,varsResolver:ai}),{styleProps:ee,rest:R}=d(N),te=F(g),ne=[T?`${te}-description`:void 0,E&&typeof E!=`boolean`?`${te}-error`:void 0,R[`aria-describedby`]].filter(Boolean).join(` `)||void 0,re={checked:P?.value.includes(R.value)??x,onChange:e=>{P?.onChange(e),C?.(e)}},ie=D||P?.isDisabled?.(R.value),[z,ae]=ze({value:re.checked??x,defaultValue:S,finalValue:!1});return(0,H.jsxs)(Zn,{...L(`root`),__staticSelector:`Switch`,__stylesApiProps:t,id:te,size:I,labelPosition:w,label:p,description:T,error:E,disabled:ie,bodyElement:`label`,labelElement:`span`,classNames:n,styles:s,unstyled:c,"data-checked":re.checked,variant:O,ref:k,mod:A,attributes:M,inert:R.inert,...ee,...y,children:[(0,H.jsx)(`input`,{...R,...re,disabled:ie,checked:z,"data-checked":re.checked,onChange:e=>{re.onChange?.(e),ae(e.currentTarget.checked)},id:te,type:`checkbox`,role:`switch`,inert:R.inert,"aria-describedby":ne,...L(`input`)}),(0,H.jsxs)(o,{"aria-hidden":`true`,component:`span`,mod:{error:E,"label-position":w,"without-labels":!h&&!m},...L(`track`),children:[(0,H.jsx)(o,{component:`span`,mod:{"reduce-motion":!0,"with-thumb-indicator":j&&!b},...L(`thumb`),children:b}),(0,H.jsx)(`span`,{...L(`trackLabel`),children:z?h:m})]})]})});oi.classes={...ri,...Xn},oi.varsResolver=ai,oi.displayName=`@mantine/core/Switch`,oi.Group=ni;var si=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z`}))]]),ci=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z`}))]]),li=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M220,48V96a12,12,0,0,1-24,0V77l-35.51,35.52a12,12,0,0,1-17-17L179,60H160a12,12,0,0,1,0-24h48A12,12,0,0,1,220,48ZM95.51,143.51,60,179V160a12,12,0,0,0-24,0v48a12,12,0,0,0,12,12H96a12,12,0,0,0,0-24H77l35.52-35.51a12,12,0,0,0-17-17ZM208,148a12,12,0,0,0-12,12v19l-35.51-35.52a12,12,0,0,0-17,17L179,196H160a12,12,0,0,0,0,24h48a12,12,0,0,0,12-12V160A12,12,0,0,0,208,148ZM77,60H96a12,12,0,0,0,0-24H48A12,12,0,0,0,36,48V96a12,12,0,0,0,24,0V77l35.51,35.52a12,12,0,0,0,17-17Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,48V208H48V48Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M109.66,146.34a8,8,0,0,1,0,11.32L83.31,184l18.35,18.34A8,8,0,0,1,96,216H48a8,8,0,0,1-8-8V160a8,8,0,0,1,13.66-5.66L72,172.69l26.34-26.35A8,8,0,0,1,109.66,146.34ZM83.31,72l18.35-18.34A8,8,0,0,0,96,40H48a8,8,0,0,0-8,8V96a8,8,0,0,0,13.66,5.66L72,83.31l26.34,26.35a8,8,0,0,0,11.32-11.32ZM208,40H160a8,8,0,0,0-5.66,13.66L172.69,72,146.34,98.34a8,8,0,0,0,11.32,11.32L184,83.31l18.34,18.35A8,8,0,0,0,216,96V48A8,8,0,0,0,208,40Zm3.06,112.61a8,8,0,0,0-8.72,1.73L184,172.69l-26.34-26.35a8,8,0,0,0-11.32,11.32L172.69,184l-18.35,18.34A8,8,0,0,0,160,216h48a8,8,0,0,0,8-8V160A8,8,0,0,0,211.06,152.61Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M214,48V96a6,6,0,0,1-12,0V62.48l-45.76,45.76a6,6,0,0,1-8.48-8.48L193.52,54H160a6,6,0,0,1,0-12h48A6,6,0,0,1,214,48ZM99.76,147.76,54,193.52V160a6,6,0,0,0-12,0v48a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12H62.48l45.76-45.76a6,6,0,0,0-8.48-8.48ZM208,154a6,6,0,0,0-6,6v33.52l-45.76-45.76a6,6,0,0,0-8.48,8.48L193.52,202H160a6,6,0,0,0,0,12h48a6,6,0,0,0,6-6V160A6,6,0,0,0,208,154ZM62.48,54H96a6,6,0,0,0,0-12H48a6,6,0,0,0-6,6V96a6,6,0,0,0,12,0V62.48l45.76,45.76a6,6,0,0,0,8.48-8.48Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M212,48V96a4,4,0,0,1-8,0V57.66l-49.17,49.17a4,4,0,0,1-5.66-5.66L198.34,52H160a4,4,0,0,1,0-8h48A4,4,0,0,1,212,48ZM101.17,149.17,52,198.34V160a4,4,0,0,0-8,0v48a4,4,0,0,0,4,4H96a4,4,0,0,0,0-8H57.66l49.17-49.17a4,4,0,0,0-5.66-5.66ZM208,156a4,4,0,0,0-4,4v38.34l-49.17-49.17a4,4,0,0,0-5.66,5.66L198.34,204H160a4,4,0,0,0,0,8h48a4,4,0,0,0,4-4V160A4,4,0,0,0,208,156ZM57.66,52H96a4,4,0,0,0,0-8H48a4,4,0,0,0-4,4V96a4,4,0,0,0,8,0V57.66l49.17,49.17a4,4,0,0,0,5.66-5.66Z`}))]]),ui=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,160H48l80-80Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z`}))]]),di=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M172,108a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,108Zm-12,28H96a12,12,0,0,0,0,24h64a12,12,0,0,0,0-24Zm76-8A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-4-1.08,7.85,7.85,0,0,0-2.53.42L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Zm40-104a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,144Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm32,128H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M166,112a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm-6,26H96a6,6,0,0,0,0,12h64a6,6,0,0,0,0-12Zm70-10A102,102,0,0,1,79.31,217.65L44.44,229.27a14,14,0,0,1-17.71-17.71l11.62-34.87A102,102,0,1,1,230,128Zm-12,0A90,90,0,1,0,50.08,173.06a6,6,0,0,1,.5,4.91L38.12,215.35a2,2,0,0,0,2.53,2.53L78,205.42a6.2,6.2,0,0,1,1.9-.31,6.09,6.09,0,0,1,3,.81A90,90,0,0,0,218,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M168,112a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm-8,24H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16Zm72-8A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-16,0A88,88,0,1,0,51.81,172.06a8,8,0,0,1,.66,6.54L40,216,77.4,203.53a7.85,7.85,0,0,1,2.53-.42,8,8,0,0,1,4,1.08A88,88,0,0,0,216,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M164,112a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm-4,28H96a4,4,0,0,0,0,8h64a4,4,0,0,0,0-8Zm68-12A100,100,0,0,1,79.5,215.47l-35.69,11.9a12,12,0,0,1-15.18-15.18l11.9-35.69A100,100,0,1,1,228,128Zm-8,0A92,92,0,1,0,48.35,174.07a4,4,0,0,1,.33,3.27L36.22,214.72a4,4,0,0,0,5.06,5.06l37.38-12.46a3.93,3.93,0,0,1,1.27-.21,4.05,4.05,0,0,1,2,.54A92,92,0,0,0,220,128Z`}))]]),fi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z`}))]]),pi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M140,80v41.21l34.17,20.5a12,12,0,1,1-12.34,20.58l-40-24A12,12,0,0,1,116,128V80a12,12,0,0,1,24,0ZM128,28A99.38,99.38,0,0,0,57.24,57.34c-4.69,4.74-9,9.37-13.24,14V64a12,12,0,0,0-24,0v40a12,12,0,0,0,12,12H72a12,12,0,0,0,0-24H57.77C63,86,68.37,80.22,74.26,74.26a76,76,0,1,1,1.58,109,12,12,0,0,0-16.48,17.46A100,100,0,1,0,128,28Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128A96,96,0,0,1,62.11,197.82a8,8,0,1,1,11-11.64A80,80,0,1,0,71.43,71.43C67.9,75,64.58,78.51,61.35,82L77.66,98.34A8,8,0,0,1,72,112H32a8,8,0,0,1-8-8V64a8,8,0,0,1,13.66-5.66L50,70.7c3.22-3.49,6.54-7,10.06-10.55A96,96,0,0,1,224,128ZM128,72a8,8,0,0,0-8,8v48a8,8,0,0,0,3.88,6.86l40,24a8,8,0,1,0,8.24-13.72L136,123.47V80A8,8,0,0,0,128,72Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M134,80v44.6l37.09,22.25a6,6,0,0,1-6.18,10.3l-40-24A6,6,0,0,1,122,128V80a6,6,0,0,1,12,0Zm-6-46A93.4,93.4,0,0,0,61.51,61.56c-8.58,8.68-16,17-23.51,25.8V64a6,6,0,0,0-12,0v40a6,6,0,0,0,6,6H72a6,6,0,0,0,0-12H44.73C52.86,88.29,60.79,79.35,70,70a82,82,0,1,1,1.7,117.62,6,6,0,1,0-8.24,8.72A94,94,0,1,0,128,34Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M132,80v45.74l38.06,22.83a4,4,0,0,1-4.12,6.86l-40-24A4,4,0,0,1,124,128V80a4,4,0,0,1,8,0Zm-4-44A91.42,91.42,0,0,0,62.93,63C53.05,73,44.66,82.47,36,92.86V64a4,4,0,0,0-8,0v40a4,4,0,0,0,4,4H72a4,4,0,0,0,0-8H40.47C49.61,89,58.3,79,68.6,68.6a84,84,0,1,1,1.75,120.49,4,4,0,1,0-5.5,5.82A92,92,0,1,0,128,36Z`}))]]),mi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),hi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,44H32A20,20,0,0,0,12,64V192a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V64A20,20,0,0,0,224,44Zm-4,144H36V68H220ZM52,128a12,12,0,0,1,12-12H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,128Zm0-36A12,12,0,0,1,64,80H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,92Zm0,72a12,12,0,0,1,12-12h8a12,12,0,0,1,0,24H64A12,12,0,0,1,52,164Zm108,0a12,12,0,0,1-12,12H108a12,12,0,0,1,0-24h40A12,12,0,0,1,160,164Zm44,0a12,12,0,0,1-12,12h-8a12,12,0,0,1,0-24h8A12,12,0,0,1,204,164Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M232,64V192a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H224A8,8,0,0,1,232,64Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48ZM64,168H48a8,8,0,0,1,0-16H64a8,8,0,0,1,0,16Zm96,0H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm48,0H192a8,8,0,0,1,0-16h16a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,50H32A14,14,0,0,0,18,64V192a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V64A14,14,0,0,0,224,50Zm2,142a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H224a2,2,0,0,1,2,2Zm-20-64a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,128Zm0-32a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,96ZM70,160a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12h8A6,6,0,0,1,70,160Zm96,0a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,160Zm40,0a6,6,0,0,1-6,6h-8a6,6,0,0,1,0-12h8A6,6,0,0,1,206,160Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,52H32A12,12,0,0,0,20,64V192a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V64A12,12,0,0,0,224,52Zm4,140a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H224a4,4,0,0,1,4,4Zm-24-64a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,128Zm0-32a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,96ZM68,160a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8h8A4,4,0,0,1,68,160Zm96,0a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,160Zm40,0a4,4,0,0,1-4,4h-8a4,4,0,0,1,0-8h8A4,4,0,0,1,204,160Z`}))]]),gi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,64V192H88V64Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM68,188a12,12,0,1,1,12-12A12,12,0,0,1,68,188Zm0-48a12,12,0,1,1,12-12A12,12,0,0,1,68,140Zm0-48A12,12,0,1,1,80,80,12,12,0,0,1,68,92Zm124,92H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M82,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H88A6,6,0,0,1,82,64Zm134,58H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Zm0,64H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12ZM44,54A10,10,0,1,0,54,64,10,10,0,0,0,44,54Zm0,128a10,10,0,1,0,10,10A10,10,0,0,0,44,182Zm0-64a10,10,0,1,0,10,10A10,10,0,0,0,44,118Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M84,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H88A4,4,0,0,1,84,64Zm132,60H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Zm0,64H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8ZM44,120a8,8,0,1,0,8,8A8,8,0,0,0,44,120Zm0-64a8,8,0,1,0,8,8A8,8,0,0,0,44,56Zm0,128a8,8,0,1,0,8,8A8,8,0,0,0,44,184Z`}))]]),_i=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M28,64A12,12,0,0,1,40,52H216a12,12,0,0,1,0,24H40A12,12,0,0,1,28,64Zm12,76h64a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24Zm80,40H40a12,12,0,0,0,0,24h80a12,12,0,0,0,0-24Zm120.49,20.49a12,12,0,0,1-17,0l-18.08-18.08a44,44,0,1,1,17-17l18.08,18.07A12,12,0,0,1,240.49,200.49ZM184,164a20,20,0,1,0-20-20A20,20,0,0,0,184,164Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,2.34L217.36,166A40,40,0,1,0,206,177.36l20.3,20.3a8,8,0,0,0,11.32-11.32Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M34,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H40A6,6,0,0,1,34,64Zm6,70h72a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12Zm88,52H40a6,6,0,0,0,0,12h88a6,6,0,0,0,0-12Zm108.24,10.24a6,6,0,0,1-8.48,0l-21.49-21.48a38.06,38.06,0,1,1,8.49-8.49l21.48,21.49A6,6,0,0,1,236.24,196.24ZM184,170a26,26,0,1,0-26-26A26,26,0,0,0,184,170Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M36,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H40A4,4,0,0,1,36,64Zm4,68h72a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8Zm88,56H40a4,4,0,0,0,0,8h88a4,4,0,0,0,0-8Zm106.83,6.83a4,4,0,0,1-5.66,0l-22.72-22.72a36.06,36.06,0,1,1,5.66-5.66l22.72,22.72A4,4,0,0,1,234.83,194.83ZM184,172a28,28,0,1,0-28-28A28,28,0,0,0,184,172Z`}))]]),vi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M156,112a12,12,0,0,1-12,12H80a12,12,0,0,1,0-24h64A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H80a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M150,112a6,6,0,0,1-6,6H80a6,6,0,0,1,0-12h64A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M148,112a4,4,0,0,1-4,4H80a4,4,0,0,1,0-8h64A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z`}))]]),yi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M230.47,67.5a12,12,0,0,0-19.26-4.32L172.43,99l-12.68-2.72L157,83.57l35.79-38.78a12,12,0,0,0-4.32-19.26A76.07,76.07,0,0,0,88.41,121.64L30.92,174.18a4.68,4.68,0,0,0-.39.38,36,36,0,0,0,50.91,50.91l.38-.39,52.54-57.49A76.05,76.05,0,0,0,230.47,67.5ZM160,148a51.5,51.5,0,0,1-23.35-5.52,12,12,0,0,0-14.26,2.62L64.31,208.66a12,12,0,0,1-17-17l63.55-58.07a12,12,0,0,0,2.62-14.26A51.5,51.5,0,0,1,108,96a52.06,52.06,0,0,1,52-52h.89L135.17,71.87a12,12,0,0,0-2.91,10.65l5.66,26.35a12,12,0,0,0,9.21,9.21l26.35,5.66a12,12,0,0,0,10.65-2.91L212,95.12c0,.3,0,.59,0,.89A52.06,52.06,0,0,1,160,148Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,96a64,64,0,0,1-94.94,56L73,217A24,24,0,0,1,39,183L104,126.94a64,64,0,0,1,80-90.29L144,80l5.66,26.34L176,112l43.35-40A63.8,63.8,0,0,1,224,96Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M232,96a72,72,0,0,1-100.94,66L79,222.22c-.12.14-.26.29-.39.42a32,32,0,0,1-45.26-45.26c.14-.13.28-.27.43-.39L94,124.94a72.07,72.07,0,0,1,83.54-98.78,8,8,0,0,1,3.93,13.19L144,80l5.66,26.35L176,112l40.65-37.52a8,8,0,0,1,13.19,3.93A72.6,72.6,0,0,1,232,96Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224.91,69.75a6,6,0,0,0-9.63-2.16l-41.07,37.9L154.7,101.3l-4.19-19.51,37.9-41.07a6,6,0,0,0-2.16-9.63,70,70,0,0,0-89.77,94.39l-61.39,53c-.11.09-.21.19-.32.3A30,30,0,0,0,77.2,221.23c.11-.11.21-.21.3-.32l53-61.39a70,70,0,0,0,94.39-89.77ZM160,154a58,58,0,0,1-28-7.22,6,6,0,0,0-7.45,1.33L68.57,212.88a18,18,0,0,1-25.45-25.45l64.76-55.94A6,6,0,0,0,109.2,124a58,58,0,0,1,64-84.53L139.58,75.93a6,6,0,0,0-1.45,5.33l5.65,26.35a6,6,0,0,0,4.61,4.61l26.35,5.65a6,6,0,0,0,5.33-1.45L216.49,82.8A58.06,58.06,0,0,1,160,154Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M223.05,70.5a4,4,0,0,0-6.42-1.44l-41.82,38.6L153,103l-4.68-21.79,38.6-41.82a4,4,0,0,0-1.44-6.43A68,68,0,0,0,98.94,126L36.4,180l-.21.2a28,28,0,0,0,39.6,39.6l.2-.21,54-62.54A68,68,0,0,0,228,96,67.51,67.51,0,0,0,223.05,70.5ZM160,156a60,60,0,0,1-29-7.47,4,4,0,0,0-5,.89L70,214.25A20,20,0,0,1,41.75,186l64.82-56a4,4,0,0,0,.89-5,60,60,0,0,1,69.46-86.59L141.05,77.29a4,4,0,0,0-1,3.55l5.66,26.35a4,4,0,0,0,3.07,3.07l26.35,5.66a4,4,0,0,0,3.55-1l38.87-35.87A60.05,60.05,0,0,1,160,156Z`}))]]),bi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:si}));bi.displayName=`ArrowClockwiseIcon`;var xi=bi,Si=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:ci}));Si.displayName=`ArrowCounterClockwiseIcon`;var Ci=Si,wi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:li}));wi.displayName=`ArrowsOutIcon`;var Ti=wi,Ei=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:ui}));Ei.displayName=`CaretUpIcon`;var Di=Ei,Oi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:di}));Oi.displayName=`ChatCircleTextIcon`;var ki=Oi,Ai=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:fi}));Ai.displayName=`ClockIcon`;var ji=Ai,Mi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:pi}));Mi.displayName=`ClockCounterClockwiseIcon`;var Ni=Mi,Pi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:mi}));Pi.displayName=`InfoIcon`;var Fi=Pi,Ii=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:hi}));Ii.displayName=`KeyboardIcon`;var Li=Ii,Ri=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:gi}));Ri.displayName=`ListBulletsIcon`;var zi=Ri,Bi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:_i}));Bi.displayName=`ListMagnifyingGlassIcon`;var Vi=Bi,Hi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:vi}));Hi.displayName=`MagnifyingGlassMinusIcon`;var Ui=Hi,Wi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:yi}));Wi.displayName=`WrenchIcon`;var Gi=Wi,Ki=i(b(),1),qi=`$__all`;function Ji(e,t,n){if(e.kind===`constant`)return e.value??``;let r=e.kind===`custom`?e.options?.map(e=>({value:e}))??[]:n===null?[]:n,i=t[e.name],a=!e.multi&&Array.isArray(i)&&i.length===0?void 0:i;if(a===`$__all`){if(e.include_all)return qi}else if(a!==void 0){if(e.kind===`text`||r===void 0)return a;let t=new Set(r.map(e=>e.value));if(Array.isArray(a)){if(a.length===0&&e.multi)return[];let n=a.filter(e=>t.has(e));if(n.length>0)return n}else if(t.has(a))return a}return e.default?e.default:e.include_all?qi:r?.[0]?.value??``}var Yi=(e,t)=>e.replace(/\$([a-z][a-z0-9_]*)/g,(e,n)=>{let r=t[n];return r===void 0?e:r===`$__all`?`all`:Array.isArray(r)?r.join(`, `):r});function Xi(e,t,n){let r={};for(let i of e??[]){let e=Ji(i,t,n?.[i.name]);(i.kind!==`query`||e!==``)&&(r[i.name]=e)}return r}function Zi(e){return Array.from({length:e.rows},(t,n)=>Object.fromEntries(e.columns.map((t,r)=>{let i=e.values[r]?.[n]??null;return[t.name,typeof i==`number`&&!Number.isFinite(i)?null:i]})))}function Qi(e,t){return e.viz!==`logs`||!t||t.rows<2?[]:t.columns.flatMap((e,n)=>{if(e.role!==`dimension`||e.type!==`string`||[`body`,`body_template`,`severity`,`status`].includes(e.name)||/(^id$|_id$)/.test(e.name))return[];let r=t.values[n][0];return typeof r==`string`&&r!==``&&t.values[n].slice(0,t.rows).every(e=>e===r)?[{name:e.name,value:r}]:[]})}function $i(e,t){let n=t.frame??{columns:[],values:[],rows:0};return{columns:n.columns.map(e=>e.name),rows:Zi(n),selection:t=>{let n={};for(let r of e.query?.by??[]){let e=r.startsWith(`attributes[`)||r.startsWith(`resource[`)?r.slice(r.indexOf(`'`)+1,r.lastIndexOf(`'`)):r;t[e]!==void 0&&t[e]!==null&&(n[r]=String(t[e]))}return{time:typeof t.time==`number`?t.time:typeof t.start==`number`?t.start:void 0,dimensions:n,trace_id:typeof t.trace_id==`string`?t.trace_id:void 0,namespace:typeof t.namespace==`string`?t.namespace:void 0}}}}function ea(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}var ta=e=>e.map(ea).join(`
`);function na(e,t=!1){return n=>{let r=Array.isArray(n)?n:[n];return ta([...r[0]?.axisValueLabel?[r[0].axisValueLabel]:[],...r.map(n=>{let r=n.value,i=Array.isArray(r)?t?r.slice(1):r:[r];return`${n.seriesName??``}${n.name?` · ${n.name}`:``}: ${i.map(t=>typeof t==`number`?e(t,n.seriesName):String(t??`—`)).join(` · `)}`})])}}var ra=e=>/^Other(?: \(\d+\))?$/.test(e??``);function ia(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ra(e.name)),i=r.slice(0,n).map(e=>({name:e.name,items:[e]})),a=[...e.filter(e=>ra(e.name)),...r.slice(n)];return a.length&&i.push({name:a.length===1&&ra(a[0].name)?a[0].name:`Other (${a.reduce((e,t)=>e+(ra(t.name)?Number(t.name.match(/\d+/)?.[0]??1):1),0)})`,items:a}),i}function aa(e){let t=e.filter(e=>e!==null);return t.length?t.reduce((e,t)=>e+t,0):null}function oa(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ra(e.name));return{shown:[...r.slice(0,n),...e.filter(e=>ra(e.name))],hidden:Math.max(0,r.length-n)}}function sa(e,t){return e>0?[{type:`text`,right:8,bottom:2,silent:!0,style:{text:`${e} more series not shown`,fill:t,fontSize:11}}]:[]}function ca(e,t,n,r,i=`sans-serif`,a){let o=e=>Array.from(e).length>24?`${Array.from(e).slice(0,23).join(``)}…`:e,s=Math.max(1,t-16),c=1,l=0;for(let t of e){let e=15+(a?.(o(t),`12px ${i}`)??Array.from(o(t)).length*7.2);l&&l+10+e>s&&(c++,l=0),l+=(l?10:0)+e}let u=c>2;return{top:n?u?30:c*20+2:12,option:{type:u?`scroll`:`plain`,show:n,top:0,left:0,right:0,padding:0,itemGap:6,icon:`roundRect`,itemWidth:10,itemHeight:10,itemStyle:{borderColor:r,borderWidth:1},textStyle:{color:r,fontSize:12,lineHeight:14},data:e,formatter:o,tooltip:{show:!0,renderMode:`html`,formatter:e=>ea(e.name)}}}}function la(e,t){if(!(!Number.isFinite(e)||!Number.isFinite(t)||e>=t||Math.abs(e)>864e13||Math.abs(t)>864e13))return{from:new Date(Math.floor(e)).toISOString(),to:new Date(Math.ceil(t)).toISOString()}}function ua(e){let t=[e.time?.range?`Range ${e.time.range}`:void 0,e.time?.shift?`Shifted ${e.time.shift}`:void 0].filter(Boolean);return t.length?t.join(` · `):void 0}function da(e,t,n){if(n.interactive===!1||n.data?.value===null)return;let r=n.data?.selection;if(r)return Object.values(r.dimensions).some(ra)?void 0:r;if(ra(n.seriesName)||ra(n.name)||n.value===null||Array.isArray(n.value)&&n.value.at(-1)==null)return;let i=e.query?.by?.[0]??t.frame?.columns.find(e=>e.role===`dimension`)?.name,a=e.viz===`timeseries`?n.seriesName:n.name,o=Array.isArray(n.value)?n.value:[];return{time:e.viz===`timeseries`&&typeof o[0]==`number`?o[0]:void 0,dimensions:i&&a?{[i]:a}:{}}}var fa=new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}),pa=new Intl.NumberFormat(`en`,{maximumFractionDigits:2});function ma(e){return Math.abs(e)<1e-4?e.toExponential(2).replace(/\.?(0+)(?=e)/,``):String(Number(e.toPrecision(3)))}function ha(e,t=pa){return e!==0&&Math.abs(e)<1?ma(e):t.format(e)}function ga(e,t){let n=t===`s`?e*1e3:t===`ns`?e/1e6:e;return e!==0&&n===0?`${ma(e)}${t}`:n!==0&&Math.abs(n)<1?`${ma(n)}ms`:ye(n)}function _a(e){let t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],n=e,r=0;for(;Math.abs(n)>=1024&&r=1e4?fa:pa);default:return ha(t,Math.abs(t)>=1e4?fa:pa)}}function ya(e){return t=>e===`ms`||e===`s`||e===`ns`?va(e,t).replace(/(\.\d*?)0+([a-z]*)$/,`$1$2`).replace(/\.([a-z]*)$/,`$1`):va(e,t)}function ba(e,t){return ya(e)(t??NaN).replace(/(?<=\d)(ms|ns|s|m|h)\b/g,` $1`)}function xa(e){return Math.max(3,Math.min(10,Math.round(e/70)))-1}function Sa(e,t){let n=t===`ms`?1:t===`s`?1e3:t===`ns`?1e-6:void 0,r=e=>{let t=10**Math.floor(Math.log10(e));return[1,2,5,10].map(e=>e*t).find(t=>t>=e)};if(n===void 0)return r(e);let i=e*n,a=[1,10,100,1e3,1e4,6e4,6e5,36e5,36e6].flatMap(e=>[1,2,5].map(t=>e*t)).sort((e,t)=>e-t);return(i<1?r(i):a.find(e=>e>=i)??r(i/36e5)*36e5)/n}function Ca(e,t,n,r){e=Number.isFinite(e)?Math.min(0,e):0,t=Number.isFinite(t)?Math.max(0,t):1,t===e&&(t=e+1);let i=xa(r),a=Sa(Math.max(t-e,2**-52)/i,n);for(;Math.ceil(t/a)-Math.floor(e/a)>i;)a=Sa(a*1.01,n);return{min:Math.floor(e/a)*a,max:Math.ceil(t/a)*a,interval:a,splitNumber:i,fanout_unit:n}}function wa(e,t){return e.type!==`value`&&e.type!==`log`?e:{...e,...e.type===`value`&&typeof e.min==`number`&&typeof e.max==`number`?Ca(e.min,e.max,typeof e.fanout_unit==`string`?e.fanout_unit:void 0,t):{splitNumber:xa(t)}}}function Ta(e,t,n){let r=e=>va(n,e),i=``;if(n===`ms`||n===`s`||n===`ns`){let a=n===`s`?1e3:n===`ns`?1e-6:1,o=Math.abs((e??t??0)*a),s=o>=6e4?6e4:o>=1e3?1e3:1;i=s===6e4?` min`:s===1e3?` s`:` ms`;let c=s===6e4?1:s===1e3?+(o<1e4):2,l=new Intl.NumberFormat(void 0,{maximumFractionDigits:c});r=e=>l.format(e*a/s)}return t===null&&e!==null?`≥${r(e)}${i}`:(e===null||e===0)&&t!==null?`<${r(t)}${i}`:`${e===null?`−∞`:r(e)}–${t===null?`∞`:r(t)}${i}`}function Ea(e){let t=new Date(e);return t.getHours()===0&&t.getMinutes()===0&&t.getSeconds()===0?t.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}function Da(e,t=new Date,n){let r=new Date(e);if(!Number.isFinite(r.getTime()))return`—`;let i=new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,...r.getFullYear()===t.getFullYear()?{}:{year:`numeric`},hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).formatToParts(r),a=i.filter(e=>[`month`,`day`,`year`].includes(e.type)).map(e=>e.value),o=i.filter(e=>[`hour`,`minute`,`second`].includes(e.type)).map(e=>e.value);return`${a.join(` `)} ${o.join(`:`)}`}function Oa({panel:e,result:t}){let n=t?.frame;return(0,H.jsxs)(`div`,{"data-panel-data":!0,children:[t?.error&&(0,H.jsx)(T,{"data-panel-error-detail":!0,size:`sm`,role:`status`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,userSelect:`text`},children:t.error}),n?(0,H.jsxs)(be,{fz:12,striped:!0,children:[(0,H.jsx)(be.Thead,{children:(0,H.jsx)(be.Tr,{children:n.columns.map(e=>(0,H.jsx)(be.Th,{ff:wt.display,children:e.name},e.name))})}),(0,H.jsx)(be.Tbody,{children:Array.from({length:Math.min(n.rows,500)},(t,r)=>(0,H.jsx)(be.Tr,{children:n.columns.map((t,i)=>{let a=n.values[i][r];return(0,H.jsx)(be.Td,{ff:wt.display,children:a===null?`—`:t.type===`time`?new Date(Number(a)).toISOString():t.role===`measure`?va(t.unit??e.unit,Number(a)):String(a)},t.name)})},r))})]}):(0,H.jsx)(T,{c:`dimmed`,size:`sm`,children:`No data.`}),(0,H.jsxs)(T,{c:`dimmed`,fz:12,mt:8,children:[`Ran in `,t?.elapsed_ms??0,` ms`,t?.interval?`, one point per ${t.interval}`:``,n?`, ${n.rows} rows${n.truncated?` (truncated)`:``}`:``,`.`]}),(t?.sql??e.sql)&&(0,H.jsx)(Re,{block:!0,tabIndex:0,mt:8,children:t?.sql??e.sql})]})}function ka({panel:e,dark:t}){let n=JSON.stringify(e,null,2).split(/("(?:[^"\\]|\\.)*"(?=\s*:)|"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?)/g);return(0,H.jsx)(`pre`,{"data-panel-spec":!0,style:{margin:0,fontFamily:wt.display,fontSize:12,color:ft[t?`dark`:`light`].text},children:n.map((e,r)=>{let i=e.startsWith(`"`)&&/^\s*:/.test(n[r+1]??``)?`key`:e.startsWith(`"`)?`string`:/^(true|false|null)$/.test(e)?`literal`:/^-?\d/.test(e)?`number`:`punctuation`,a=i===`key`?_t[t?4:7]:i===`string`?mt[t?4:8]:i===`number`||i===`literal`?Dt[t?4:8]:void 0;return i===`punctuation`?e:(0,H.jsx)(`span`,{"data-json-token":i,style:{color:a},children:e},r)})})}function Aa(e){let t=e.event.data?.selection,n=e.event.value;return JSON.stringify([e.event.seriesName,e.event.name,t?.from??t?.time??(Array.isArray(n)?n[0]:void 0),t?.dimensions,t?.bucket])}function ja(e){let t=new Date().toISOString().slice(0,10),n=e.from.slice(0,10),r=e.to.slice(0,10),i=e=>e.slice(11,-1).replace(/\.000$/,``);return`${(n===t?``:n+` `)+i(e.from)} – ${(r!==n&&r!==t?r+` `:``)+i(e.to)} UTC · ${ye(Date.parse(e.to)-Date.parse(e.from))}`}var Ma={background:`color-mix(in srgb, var(--mantine-color-body) 92%, transparent)`,border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`,padding:`2px 6px`};function Na(e){return e.replace(`Enter drill`,`↵ drill`).replace(`Shift+←→`,`⇧←→`)}var Pa=(0,V.createContext)(void 0);function Fa({points:e,label:t,summary:n,children:r,onClick:i,canSelect:a,onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d,rangeReset:f,height:p=`100%`,onZoom:m,bounds:h,pointWindow:g}){let[_,v]=(0,V.useState)(!1),[b,x]=(0,V.useState)(``),[S,w]=(0,V.useState)(),[E,D]=(0,V.useState)(null),O=(0,V.useRef)(null),k=(0,V.useRef)(!1);(0,V.useEffect)(()=>{let e=e=>{e.key===`Tab`&&(k.current=!1)};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[]);let A=(0,V.useId)(),j=(0,V.useContext)(Pa),M=(0,V.useRef)(null),N=(0,V.useRef)({onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d});N.current={onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d};let P=(0,V.useMemo)(()=>new Map(e.map(e=>[Aa(e),e])),[e]),F=(0,V.useRef)(void 0),I=e=>g?.(e)?.from??e.event.name??(Array.isArray(e.event.value)?e.event.value[0]:void 0),L=F.current,ee=L?e.filter(e=>e.event.seriesName===L.event.seriesName):e,R=ee.length?ee:e,te=L&&I(L),ne=typeof te==`number`?R.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-te)I(e)===te),re=S?P.get(S)??ne??R[0]??e[0]:e[0],ie=!!(m&&h&&Number.isFinite(h.from)&&Number.isFinite(h.to)&&h.from[...new Set(e.map(e=>e.event.seriesName))],[e]),ae=(0,V.useMemo)(()=>e.filter(e=>e.event.seriesName===re?.event.seriesName),[e,re?.event.seriesName]),B=re?ae.indexOf(re):-1;(0,V.useEffect)(()=>{re&&(!S||P.has(S)||!ee.length)&&(F.current=re,(!S||!ee.length)&&w(Aa(re))),_&&N.current.onHighlight(re)},[re,S,_]),(0,V.useEffect)(()=>{if(!E)return;let e=Date.parse(E.from),t=Date.parse(E.to);h&&(Number.isFinite(e)&&eh.to)&&D(null)},[h?.from,h?.to,E]),(0,V.useEffect)(()=>{N.current.onRangePending?.(!!E)},[!!E]),(0,V.useEffect)(()=>{N.current.onRangeChange?.(E?{from:Date.parse(E.from),to:Date.parse(E.to)}:void 0)},[E]),(0,V.useEffect)(()=>{D(null)},[f]),(0,V.useEffect)(()=>()=>{N.current.onHighlight(void 0),N.current.onRangePending?.(!1),N.current.onRangeChange?.(void 0)},[]);let oe=(e,t=!1)=>{if(e){if(x(n(e)),t&&ie&&re){let t=E?.anchor??Aa(re),n=P.get(t),r=E?.window??(n&&g?.(n)),i=g?.(e);if(r&&i){let e=Math.max(h.from,Math.min(r.from,i.from)),n=Math.min(h.to,Math.max(r.to,i.to));Number.isFinite(e)&&Number.isFinite(n)&&e{if(!re)return;let n=z[Math.max(0,Math.min(z.length-1,z.indexOf(re.event.seriesName)+t))],r=e.filter(e=>e.event.seriesName===n),i=I(re),a=r.find(e=>I(e)===i),o=typeof i==`number`?r.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-i){e===`ArrowLeft`||e===`ArrowRight`?oe(ae[Math.max(0,Math.min(ae.length-1,B+(e===`ArrowLeft`?-1:1)))],t):!t&&(e===`ArrowUp`||e===`ArrowDown`)?se(e===`ArrowUp`?-1:1):!t&&(e===`Home`||e===`End`)&&oe(e===`Home`?ae[0]:ae.at(-1))},le=()=>{D(null),O.current?.focus()},ue=ie?`←→ points · ↑↓ series · Enter drill · Shift+←→ range`:`←→ points · ↑↓ series · Enter drill`;return(0,V.useLayoutEffect)(()=>(j?.setHint(_?ue:void 0),()=>j?.setHint(void 0)),[j,_,ue]),(0,V.useLayoutEffect)(()=>{let e=M.current;if(!e)return;N.current.onRangeBarHeight?.(e.getBoundingClientRect().height);let t=new ResizeObserver(([t])=>{if(!t)return;let n=getComputedStyle(e),r=[n.paddingTop,n.paddingBottom,n.borderTopWidth,n.borderBottomWidth].reduce((e,t)=>e+(parseFloat(t)||0),0);N.current.onRangeBarHeight?.(t.borderBoxSize?.[0]?.blockSize??t.contentRect.height+r)});return t.observe(e),()=>{t.disconnect(),N.current.onRangeBarHeight?.(0)}},[!!(E&&ie)]),(0,H.jsxs)(o,{ref:O,"data-chart-plot":!0,tabIndex:0,role:`application`,"aria-roledescription":`chart`,"aria-label":t,"aria-describedby":A,"data-mantine-stop-propagation":E?`true`:void 0,className:`chart-keyboard-point`,style:{position:`relative`,height:p,width:`100%`,flex:`1 1 auto`,minHeight:0,minWidth:0},onPointerDownCapture:e=>{M.current?.contains(e.target)||(k.current=!0,v(!1),_&&N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onFocus:e=>{e.target!==e.currentTarget||k.current||(N.current.onActiveChange?.(!0),v(!0))},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(v(!1),D(null),x(``),N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onKeyDown:e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey||e.nativeEvent.isComposing)return;if(e.key===`Escape`&&!e.repeat){E?(e.preventDefault(),e.stopPropagation(),le()):e.target===e.currentTarget&&!e.currentTarget.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`)&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.blur());return}if(e.target!==e.currentTarget||e.repeat&&![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key))return;let t=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key);if(t&&!_&&(k.current=!1,v(!0),N.current.onActiveChange?.(!0),!re)){e.preventDefault();return}e.key===`Enter`&&_&&!e.shiftKey&&re&&i&&(!a||a(re.event))?(e.preventDefault(),i(re.event)):t&&(!e.shiftKey||e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),ce(e.key,e.shiftKey))},children:[r,(0,H.jsx)(o,{"data-chart-overlay":!0,style:{position:`absolute`,inset:0,zIndex:1,pointerEvents:`none`,overflow:`hidden`},children:E&&ie&&(0,H.jsxs)(y,{ref:M,"data-chart-range-bar":!0,gap:6,style:{...Ma,position:`absolute`,bottom:4,left:4,right:4,maxHeight:`100%`,overflow:`auto`,pointerEvents:`auto`},children:[(0,H.jsx)(T,{"data-chart-range-label":!0,size:`xs`,title:E.from+` – `+E.to,truncate:!0,style:{flex:`1 1 140px`,minWidth:0},children:ja(E)}),(0,H.jsx)(C,{size:`compact-xs`,"data-mantine-stop-propagation":`true`,onClick:()=>{m(Date.parse(E.from),Date.parse(E.to)),le()},children:`Zoom to range`}),(0,H.jsx)(C,{size:`compact-xs`,variant:`subtle`,"data-mantine-stop-propagation":`true`,onClick:le,children:`Cancel`})]})}),(0,H.jsx)(Ve,{id:A,children:ue}),(0,H.jsx)(Ve,{"aria-live":`polite`,"aria-atomic":`true`,children:b})]})}var Ia=new Set([`id`,`http`,`https`,`rpc`,`grpc`,`cpu`,`sql`,`url`,`uri`,`ip`,`io`,`db`,`gc`,`tls`,`api`]),La={ms:`ms`,ns:`ns`,s:`s`,us:`µs`,bytes:`bytes`,percent:`%`,ratio:`ratio`,per_second:`/s`,per_minute:`/min`},Ra={body_template:`message template`,parquet_index:`traces`};function za(e,t){let n=typeof e==`string`?e:e.name,r=t?.options?.columns?.find(e=>e.field===n)?.unit??(typeof e==`string`?void 0:e.unit)??(typeof e!=`string`&&e.role===`measure`?t?.unit:void 0),i=Ra[n]??n;/\b(?:duckdb|parquet|sqlite|variant|timestamptz_ns|timestamp_ns)\b|\btelemetry\./i.test(i)&&(i=`value`),i=i.replace(/^(\w+)\(([^()]*)\)$/,(e,t,n)=>[t,n].filter(Boolean).join(`_`));let a=i.match(/_(ms|ns|us|s|bytes|percent)$/i);a&&(i=i.slice(0,-a[0].length));let o=r??a?.[1]?.toLowerCase();return i=i.split(`_`).map((e,t)=>/^p\d+$/i.test(e)||Ia.has(e.toLowerCase())?e.toUpperCase():t===0?e.charAt(0).toUpperCase()+e.slice(1):e).join(` `),i+(o&&o!==`none`&&o!==`count`?` (${La[o]??o})`:``)}function Ba(e){return e===`healthy`?`ok`:e===`degraded`?`warn`:e===`unknown`?`gray`:`bad`}function Va(e){return ft[e?`dark`:`light`]}function Ha(e){let t=e?5:7;return{ok:mt[t],warn:ht[t],bad:Et[t],info:Dt[t]}}function Ua(e,t){return xt[t?`dark`:`light`][e]??Va(t).muted}function Wa(e){return e===`unhealthy`?`diamond`:e===`degraded`?`roundRect`:`circle`}function Ga(e){return e===`unknown`?`dashed`:`solid`}var Ka=e=>typeof e==`number`&&Number.isFinite(e)?e:null;function qa(e){return e.columns.flatMap((e,t)=>e.role===`measure`?[t]:[])}function Ja(e){let t=e.columns.findIndex(e=>e.role===`time`);if(t<0)return[];let n=e.columns.findIndex(e=>e.role===`dimension`),r=qa(e);if(n>=0&&r.length>0){let i=r[0],a=new Map;for(let r=0;r({name:e.columns[n].name,unit:e.columns[n].unit,points:e.values[t].map((t,r)=>[Number(t),Ka(e.values[n][r])])}))}function Ya(e){let t=e.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),n=qa(e);if(t.length===0||n.length===0)return{categories:[],series:[]};let r=t[0],i=[];for(let t=0;t1){let a=t[1],o=n[0],s=new Map;for(let t=0;tnull)),s.get(n)[i.indexOf(String(e.values[r][t]??``))]=Ka(e.values[o][t])}return{categories:i,series:[...s.entries()].map(([t,n])=>({name:t,unit:e.columns[o].unit,values:n}))}}return{categories:i,series:n.map(t=>({name:e.columns[t].name,unit:e.columns[t].unit,values:e.values[t].map(Ka)}))}}function Xa(e,t){let n=e.filter(e=>e!==null);if(n.length===0)return null;switch(t){case`last`:return n[n.length-1];case`min`:return Math.min(...n);case`max`:return Math.max(...n);case`sum`:return n.reduce((e,t)=>e+t,0);default:return n.reduce((e,t)=>e+t,0)/n.length}}function Za(e,t){let n=qa(t)[0];return n===void 0?null:(e.reduce??`window`)===`window`?t.totals?Ka(t.totals[n]):Xa(t.values[n].map(Ka),`mean`):Xa(t.values[n].map(Ka),e.reduce??`mean`)}function Qa(e){let t=qa(e)[0];return t===void 0?[]:e.values[t].map(Ka)}var $a={ok:0,warn:1,bad:2};function eo(e){if(!e?.length)return;let t=[...e].sort((e,t)=>$a[e.status]-$a[t.status]),n=t[0],r=t[t.length-1];return $a[r.status]>$a[n.status]&&r.value!==n.value?r.value>n.value?`lower`:`higher`:`lower`}function to(e,t,n){if(e===null||!t||t.length===0)return null;n??=eo(t);let r=`ok`;for(let i of t)(n===`lower`?e>=i.value:e<=i.value)&&$a[i.status]>$a[r]&&(r=i.status);return r}function no(e,t){let n=Ct(e),r=Ct(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function ro(e,t){return`rgba(${[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)).join(`, `)}, ${t})`}function io(e,t){return{color:e,...no(e,t.surface)<3?{borderColor:t.text,borderWidth:1}:{}}}function ao(e,t){return{color:e,...no(e,t.surface)<3?{shadowColor:t.text,shadowBlur:2}:{}}}function oo(e,t){return{ok:mt,warn:ht,bad:Et}[e][t?5:8]}function so(e){let t=Va(e),n=Ha(e);return{dark:e,text:t.text,muted:t.muted,grid:t.grid,surface:t.surface,border:t.border,status:{ok:n.ok,warn:n.warn,bad:n.bad},font:wt.display}}function co(e,t,n){if(!Array.isArray(e.series))return e;let r=e.series,i=Array.isArray(e.yAxis)?e.yAxis:[e.yAxis],a=[],o=r.map((e,o)=>{let s=e.endLabel;if(!s?.show||!Array.isArray(e.data))return e;let c;for(let t=e.data.length-1;t>=0;t--){let n=e.data[t];if(Array.isArray(n)&&typeof n[1]==`number`&&Number.isFinite(n[1])){c=n;break}}let l=i[Number(e.yAxisIndex??0)];if(!c||!l)return{...e,endLabel:{...s,show:!1}};let u=l.type===`log`?Math.log:e=>e,d=l.min??1/0,f=l.max??0;if(l.type===`log`&&(l.min===void 0||l.max===void 0)){for(let t of r)if(Number(t.yAxisIndex??0)===Number(e.yAxisIndex??0)&&Array.isArray(t.data))for(let e of t.data)Array.isArray(e)&&typeof e[1]==`number`&&Number.isFinite(e[1])&&e[1]>0&&(l.min===void 0&&(d=Math.min(d,e[1])),l.max===void 0&&(f=Math.max(f,e[1])))}Number.isFinite(d)||(d=1);let p=u(l.type===`log`?d:l.min??0),m=u(l.type===`log`?Math.max(f,d*1.01):l.max??1),h=n?.(o,c),g=Number.isFinite(h)?h:t.y+t.height*(1-(u(c[1])-p)/(m-p)),_=((s.lineHeight??14)+2)/2,v=[Math.max(t.y+_,Math.min(t.y+t.height-_,g)),...a.flatMap(e=>[e.y-e.half-_,e.y+e.half+_])].filter(e=>Number.isFinite(e)&&e-_>=t.y&&e+_<=t.y+t.height&&a.every(t=>Math.abs(t.y-e)>=t.half+_)).sort((e,t)=>Math.abs(e-g)-Math.abs(t-g))[0];return v===void 0?{...e,endLabel:{...s,show:!1}}:(a.push({y:v,half:_}),{...e,labelLayout:{dy:v-g,hideOverlap:!0}})});return{...e,series:o}}var lo=(e,t,n)=>ra(e)?n.muted:Ua(t,n.dark);function uo(e,t){let n=Ja(e);if(!e.columns.some(e=>e.role===`dimension`))for(let r of n)r.name=za(e.columns.find(e=>e.name===r.name)??r.name,t);return oa(n,t)}function fo(e,t){return{animationDuration:200,textStyle:{fontFamily:e.font,color:e.muted,fontSize:11},grid:{left:8,right:16,top:28,bottom:8,containLabel:!0},tooltip:{trigger:`axis`,formatter:na(e=>va(t,e)),confine:!0,backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:12},valueFormatter:e=>va(t,e),axisPointer:{type:`line`,lineStyle:{color:e.border}}},aria:{enabled:!0}}}function po(e,t,n,r){return(e.thresholds??[]).map(i=>({yAxis:i.value,label:{formatter:`${i.label??i.status} ${ya(r??e.unit)(i.value).replace(/(?<=\d)(ms|s|m|h)$/,` $1`)}`,position:i.value<=(n.min+n.max)/2?`insideEndTop`:`insideEndBottom`,distance:8,color:t.muted,textBorderColor:t.surface,textBorderWidth:3,fontSize:12},lineStyle:{color:t.status[i.status],type:[4,3],width:1}}))}function mo(e,t,n,r={width:500,height:248}){let i=t.frame?uo(t.frame,e):{shown:[],hidden:0},a=i.shown,o=a[0]?.unit??e.unit,s=new Set(a.map(e=>e.name)),c=a.find(e=>ra(e.name)),l=t.previous&&t.shift_ms!==void 0?uo(t.previous,e).shown.flatMap(e=>ra(e.name)?c?[e]:[]:s.has(e.name)?[e]:[]):[],u=[...new Set([...a,...l].map(t=>t.unit??e.unit))];u.length===0&&u.push(e.unit);let d=e.options?.style??`line`,f=a.length>=2&&a.length<=6&&i.hidden===0&&d!==`bars`&&d!==`stacked`,p=f?Math.max(40,...a.map(e=>{let t=Array.from(e.name).slice(0,24).join(``);return r.measureText?.(t,`12px ${n.font}`)??Array.from(t).length*7.2}))+12:0,m=f?p+8:0,h=(e.options?.legend??`auto`)!==`hidden`&&a.length>1,g=ca(a.map(e=>e.name),r.width,h,n.text,n.font,r.measureText),_=r.height-g.top-(i.hidden?24:8)-22,v=Math.max(0,Math.floor(_/16)),y=t.shift_ms,b=u.map(t=>{let n=[...a,...l].filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.points.flatMap(([,e])=>e===null?[]:[e]));if(d===`stacked`){let r=new Map;for(let n of a.filter(n=>(n.unit??e.unit)===t))for(let[e,t]of n.points){let n=r.get(e)??{positive:0,negative:0};t!==null&&(t>0?n.positive+=t:n.negative+=t),r.set(e,n)}n.push(...[...r.values()].flatMap(e=>[e.positive,e.negative]))}return Ca(Math.min(0,...n),Math.max(0,...n),t,_)}),x=a.map((t,r)=>{let i=lo(t.name,r,n);return{name:t.name,interactive:!0,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:d===`bars`||d===`stacked`?`bar`:`line`,data:t.points,endLabel:f?{show:r0?{symbol:[`none`,`none`],silent:!0,data:po(e,n,b[0],o)}:void 0}}),S=y===void 0?[]:l.map(t=>({name:`${t.name} · previous`,interactive:!1,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:`line`,data:t.points.map(([e,t])=>[e+y,t]),showSymbol:!1,silent:!0,z:1,lineStyle:{width:1,type:`dashed`,color:n.muted},itemStyle:{color:n.muted}})),C=u.map((t,r)=>({...e.options?.scale===`log`?{splitNumber:xa(_)}:b[r],type:e.options?.scale===`log`?`log`:`value`,position:r===0?`left`:`right`,offset:Math.max(0,r-1)*56,axisLine:{show:!1},splitLine:{show:r===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:ya(t)}}));return co({...fo(n,o),tooltip:{...fo(n,o).tooltip,formatter:na((t,n)=>va([...a,...l].find(e=>e.name===n||`${e.name} · previous`===n)?.unit??e.unit,t),!0)},legend:g.option,grid:{left:8,right:16+(f?m:0)+Math.max(0,u.length-2)*56,top:g.top,bottom:i.hidden?24:8,containLabel:!0},xAxis:{type:`time`,min:t.from_ms,max:t.to_ms,axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:Ea}},yAxis:C.length===1?C[0]:C,series:[...x,...S],graphic:sa(i.hidden,n.muted)},{y:g.top,height:_})}function ho(e,t,n){if(n(e)<=t)return e;let r=Array.from(e);for(let e=r.length-1;e>0;e--){let i=Math.floor(e*.45),a=e-i,o=r.slice(0,i).join(``)+`…`+r.slice(-a).join(``);if(n(o)<=t)return o}return`…`}function go(e,t,n,r={width:500,height:248}){let i=Ya(t);if(t.columns.filter(e=>e.role===`dimension`).length<2)for(let n of i.series)n.name=za(t.columns.find(e=>e.name===n.name)??n.name,e);let a=i.categories,{shown:o,hidden:s}=oa(i.series,e),c=t.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),l=new Map;for(let n=0;nString(t.values[e][n]??``))),{dimensions:r,...i})}let u=o[0]?.unit??e.unit,d=[...new Set(o.map(t=>t.unit??e.unit))];d.length===0&&d.push(e.unit);let f=o.length>1,p=!!(t.periods?.[`Before deploy`]||t.periods?.[`Since deploy`]),m=e=>r.measureText?.(e,`11px ${n.font}`)??Array.from(e).length*6.6,h=Math.min(r.width*.4,Math.max(40,...a.map(m))),g=ca(o.map(e=>e.name),r.width,f&&e.options?.legend!==`hidden`,n.text,n.font,r.measureText),_=d.map((t,i)=>({...Ca(Math.min(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),Math.max(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),t,r.width-h-80),type:`value`,position:i===0?`bottom`:`top`,offset:Math.max(0,i-1)*36,splitLine:{show:i===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,formatter:e=>ba(t,e),hideOverlap:!0}}));return{...fo(n,u),tooltip:{...fo(n,u).tooltip,formatter:na((t,n)=>va(o.find(e=>e.name===n)?.unit??e.unit,t)),axisPointer:{type:`shadow`}},legend:g.option,grid:{left:8,right:56,top:(f?g.top:8)+Math.max(0,d.length-1)*36,bottom:s?24:8,containLabel:!0},yAxis:{type:`category`,inverse:!0,data:a,splitLine:{show:!1},axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,width:h,overflow:`truncate`,formatter:e=>ho(e,h,m)}},xAxis:_.length===1?_[0]:_,series:o.map((t,r)=>({name:t.name,interactive:!0,xAxisIndex:d.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:`bar`,data:t.values.map((e,n)=>({value:e,selection:l.get(JSON.stringify(c.length>1?[a[n],t.name]:[a[n]]))})),barMaxWidth:p&&t.name===`Before deploy`?7:14,barGap:`20%`,itemStyle:{...io(p?t.name===`Before deploy`?n.muted:Ua(0,n.dark):lo(t.name,r,n),n),borderRadius:[0,4,4,0]},label:{show:p?t.name===`Since deploy`:!f||r===0,position:`right`,color:n.text,fontFamily:n.font,fontSize:11,formatter:({value:n})=>ba(t.unit??e.unit,n)}})),graphic:sa(s,n.muted)}}function _o(e,t,n,r=e.unit,i={width:270,height:140}){let a=e.min??0,o=e.max??100,s=vo(e,a,o,n),c=va(r,t),l=to(t,e.thresholds,e.better),u=l===`bad`?`◆ Bad`:l===`warn`?`■ Warn`:l===`ok`?`● OK`:t===null?`○ Unknown`:void 0,d=e=>`${e}40`,f=i.measureText?.(c,`600 28px ${n.font}`)??c.length*28*.6,p=i.measureText?.(u??``,`11px ${n.font}`)??(u?.length??0)*11*.6,m=i.width{let r=y;return y=e,{type:`rect`,shape:{x:4+r*_,y:g,width:(e-r)*_,height:10,r:[n===0?5:0,n===s.length-1?5:0,n===s.length-1?5:0,n===0?5:0]},style:{fill:d(t)}}}),{id:`gauge-fill`,type:`rect`,shape:{x:4,y:g,width:v*_,height:10,r:5},style:{fill:l?n.status[l]:Ua(0,n.dark)}},{id:`gauge-marker`,type:`rect`,shape:{x:3+v*_,y:g-2,width:2,height:14,r:1},style:{fill:n.text}},{type:`text`,left:4,top:g+12,style:{text:va(r,a),fill:n.muted,fontSize:11,fontFamily:n.font}},{type:`text`,right:4,top:g+12,style:{text:va(r,o),fill:n.muted,fontSize:11,fontFamily:n.font}}]}}function vo(e,t,n,r){let i=n-t||1,a=[t,...(e.thresholds??[]).map(e=>Math.min(n,Math.max(t,e.value))),n].sort((e,t)=>e-t),o=[];for(let t=0;t[(e.end-t)/i,r.status[e.status]])}var yo=function(e,t){return yo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},yo(e,t)};function U(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);yo(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var bo=`12px sans-serif`,xo=20,So=100,Co=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function wo(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n=0)s=o*n.length;else for(var c=0;c=zo&&(Ro=0),Ro++}function Vo(){var e=[...arguments];typeof console<`u`&&console.error.apply(console,e)}function Ho(e){if(typeof e!=`object`||!e)return e;var t=e,n=ko.call(e);if(n===`[object Array]`){if(!xs(e)){t=[];for(var r=0,i=e.length;r`u`&&typeof self<`u`?Ns.worker=!0:!Ns.hasGlobalWindow||`Deno`in window||typeof navigator<`u`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Node.js`)>-1?(Ns.node=!0,Ns.svgSupported=!0):Ps(navigator.userAgent,Ns);function Ps(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);if(r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`){var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}}var Fs=1e-4,Is=20;function Ls(e){return e.replace(/^\s+|\s+$/g,``)}var Rs=Math.min,zs=Math.max,Bs=Math.abs,Vs=Math.round,Hs=Math.floor,Us=Math.ceil,Ws=Math.pow,Gs=Math.log,Ks=Math.LN10,qs=Math.PI,Js=Math.random;function Ys(e,t,n,r){var i=t[0],a=t[1],o=n[0],s=n[1],c=a-i,l=s-o;if(c===0)return l===0?o:(o+s)/2;if(r){if(c>0){if(e<=i)return o;if(e>=a)return s}else if(e>=i)return o;else if(e<=a)return s}else{if(e===i)return o;if(e===a)return s}return(e-i)/c*l+o}var Xs=Zs;function Zs(e,t,n){switch(e){case`center`:case`middle`:e=`50%`;break;case`left`:case`top`:e=`0%`;break;case`right`:case`bottom`:e=`100%`}return Qs(e,t,n)}function Qs(e,t,n){return Y(e)?$s(e)?parseFloat(e)/100*t+(n||0):parseFloat(e):e==null?NaN:+e}function $s(e){return!!Ls(e).match(/%$/)}function ec(e,t,n){return isNaN(t)?n?``+e:+e:(t=Rs(zs(0,t),Is),e=(+e).toFixed(t),n?e:+e)}function tc(e){return e.sort(function(e,t){return e-t}),e}function nc(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,n=0;n<15;n++,t*=10)if(Vs(e*t)/t===e)return n}return rc(e)}function rc(e){var t=e.toString().toLowerCase(),n=t.indexOf(`e`),r=n>0?+t.slice(n+1):0,i=n>0?n:t.length,a=t.indexOf(`.`);return zs(0,(a<0?0:i-1-a)-r)}function ic(e,t,n){var r=Bs(e[1]-e[0]);if(!isFinite(r)||r===0)return NaN;var i=Gs(2*Bs(n||1)*Bs(r))/Ks,a=Gs(Bs(t))/Ks,o=zs(0,Us(-i+a));return isFinite(o)||(o=NaN),o}function ac(e,t){var n=zs(nc(e),nc(t)),r=e+t;return n>Is?r:ec(r,n)}var oc=Ws(2,53)-1;function sc(e){var t=qs*2;return(e%t+t)%t}function cc(e){return e>-Fs&&e=10&&t++,t}function pc(e,t){var n=fc(e),r=Ws(10,n),i=e/r;return e=(t===2?1:t?i<1.5?1:i<2.5?2:i<4?3:i<7?5:10:i<1?1:i<2?2:i<3?3:i<5?5:10)*r,ec(e,-n)}function mc(e){e.sort(function(e,t){return s(e,t,0)?-1:1});for(var t=-1/0,n=1,r=0;r0?e.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)&&(this.item=this._list[this._idx],this.key=this._idx+=this._step,!0)},e})();function ul(){return[1/0,-1/0]}function dl(e,t){hl(t)&&(te[1]&&(e[1]=t))}function fl(e,t){hl(t)&&te[1]&&(e[1]=t)}function ml(e,t){gl(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function hl(e){return e!=null&&isFinite(e)}function gl(e,t){return hl(e)&&hl(t)&&e<=t}function _l(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function vl(e){gl(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function yl(){var e=`__ec_once_`+bl++;return function(t,n){Z(t,e)||(t[e]=1,n())}}var bl=_c();function xl(e,t,n){var r=Es(),i=0;G(e,function(a){var o=t(a),s=r.get(o)||0;n&&n(a,s),!s&&!n&&(e[i++]=a),r.set(o,s+1)}),n||(e.length=i)}function Sl(e){return e.value+``}function Cl(e){return e+``}function wl(e,t){return X(t,!0)?e.seriesIndex+2:0}function Tl(e,t,n){var r=e.getData().count();return{progressiveRender:n.progressiveEnabled&&t.incrementalPrepareRender&&r>=n.threshold,large:e.get(`large`)&&r>=e.get(`largeThreshold`),modDataCount:e.get(`progressiveChunkMode`)===`mod`?e.getData().count():null}}function El(e){return{overallReset:e}}var Dl=`.`,Ol=`___EC__COMPONENT__CONTAINER___`,kl=`___EC__EXTENDED_CLASS___`;function Al(e){var t={main:``,sub:``};if(e){var n=e.split(Dl);t.main=n[0]||``,t.sub=n[1]||``}return t}function jl(e){_s(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),`componentType "`+e+`" illegal`)}function Ml(e){return!!(e&&e[kl])}function Nl(e,t){e.$constructor=e,e.extend=function(e){var t=this,n;return Pl(t)?n=function(e){U(t,e);function t(){return e.apply(this,arguments)||this}return t}(t):(n=function(){(e.$constructor||t).apply(this,arguments)},Jo(n,this)),W(n.prototype,e),n[kl]=!0,n.extend=this.extend,n.superCall=Rl,n.superApply=zl,n.superClass=t,n}}function Pl(e){return rs(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function Fl(e,t){e.extend=t.extend}var Il=Math.round(Math.random()*10);function Ll(e){var t=[`__\0is_clz`,Il++].join(`_`);e.prototype[t]=!0,e.isInstance=function(e){return!!(e&&e[t])}}function Rl(e,t){var n=[...arguments].slice(2);return this.superClass.prototype[t].apply(e,n)}function zl(e,t,n){return this.superClass.prototype[t].apply(e,n)}function Bl(e){var t={};e.registerClass=function(e){var r=e.type||e.prototype.type;if(r){jl(r),e.prototype.type=r;var i=Al(r);if(!i.sub)t[i.main]=e;else if(i.sub!==Ol){var a=n(i);a[i.sub]=e}}return e},e.getClass=function(e,n,r){var i=t[e];if(i&&i[Ol]&&(i=n?i[n]:null),r&&!i)throw Error(n?`Component `+e+`.`+(n||``)+` is used but not imported.`:e+`.type should be specified.`);return i},e.getClassesByMainType=function(e){var n=Al(e),r=[],i=t[n.main];return i&&i[Ol]?G(i,function(e,t){t!==Ol&&r.push(e)}):r.push(i),r},e.hasClass=function(e){return!!t[Al(e).main]},e.getAllClassMainTypes=function(){var e=[];return G(t,function(t,n){e.push(n)}),e},e.hasSubTypes=function(e){var n=t[Al(e).main];return n&&n[Ol]};function n(e){var n=t[e.main];return(!n||!n[Ol])&&(n=t[e.main]={},n[Ol]=!0),n}}function Vl(e,t){for(var n=0;n=0||i&&qo(i,s)<0)){var c=n.getShallow(s,t);c!=null&&(a[e[o][0]]=c)}}return a}}var Hl=Vl([[`fill`,`color`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`opacity`],[`shadowColor`]]),Ul=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return Hl(this,e,t)},e}(),Wl=function(){function e(e){this.value=e}return e}(),Gl=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new Wl(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),Kl=function(){function e(e){this._list=new Gl,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new Wl(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),ql=new Kl(50);function Jl(e){if(typeof e==`string`){var t=ql.get(e);return t&&t.image}return e}function Yl(e,t,n,r,i){if(!e)return t;if(typeof e==`string`){if(t&&t.__zrImageSrc===e||!n)return t;var a=ql.get(e),o={hostEl:n,cb:r,cbPayload:i};return a?(t=a.image,!Zl(t)&&a.pending.push(o)):(t=Eo.loadImage(e,Xl,Xl),t.__zrImageSrc=e,ql.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}function Xl(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;tu||d>f||p>m||h>g)return!1;var _=!(u=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height},e.prototype.contain=function(t,n){return e.contain(this,t,n)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(e){Vu(this,e)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(e,t){return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e},e.applyTransform=function(e,t,n){if(!n){e!==t&&Vu(e,t);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],i=n[3],a=n[4],o=n[5];e.x=t.x*r+a,e.y=t.y*i+o,e.width=t.width*r,e.height=t.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}Au.x=Mu.x=t.x,Au.y=Nu.y=t.y,ju.x=Nu.x=t.x+t.width,ju.y=Mu.y=t.y+t.height,Au.transform(n),Nu.transform(n),ju.transform(n),Mu.transform(n),e.x=Tu(Au.x,ju.x,Mu.x,Nu.x),e.y=Tu(Au.y,ju.y,Mu.y,Nu.y);var s=Eu(Au.x,ju.x,Mu.x,Nu.x),c=Eu(Au.y,ju.y,Mu.y,Nu.y);e.width=s-e.x,e.height=c-e.y},e.calculateTransform=function(e,t,n){var r=n.width/t.width,i=n.height/t.height;return e=$l(e||[]),nu(e,e,lu(qu,-t.x,-t.y)),iu(e,e,lu(qu,r,i)),nu(e,e,lu(qu,n.x,n.y)),e},e}(),zu=Ru.create,Bu=Ru.set,Vu=Ru.copy,Hu=Ru.calculateTransform,Uu=Ru.applyTransform,Wu=Ru.contain,Gu=new Ru(0,0,0,0),Ku=new Ru(0,0,0,0),qu=[];function Ju(e,t,n,r,i,a,o,s){var c=Du(t-n),l=Du(r-e),u=Tu(c,l),d=Ou[i],f=Ou[1-i],p=ku[i];t=l||!Pu.bidirectional)&&(Fu[d]=-l,Fu[f]=0,Pu.useDir&&Pu.calcDirMTV())))}function Yu(){var e=0,t=new wu,n=new wu,r={minTv:new wu,maxTv:new wu,useDir:!1,dirMinTv:new wu,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,a){r.touchThreshold=0,i&&i.touchThreshold!=null&&(r.touchThreshold=Eu(0,i.touchThreshold)),r.negativeSize=!1,a&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,i&&i.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),e=i.direction,r.bidirectional=i.bidirectional==null||!!i.bidirectional,r.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var a=r.minTv,o=r.dirMinTv,s=a.y*a.y+a.x*a.x,c=Math.sin(e),l=Math.cos(e),u=c*a.y+l*a.x;if(i(u)){i(a.x)&&i(a.y)&&o.set(0,0);return}if(n.x=s*l/u,n.y=s*c/u,i(n.x)&&i(n.y)){o.set(0,0);return}(r.bidirectional||t.dot(n)>0)&&n.len()=ed)){e||=`12px sans-serif`;for(var t=[],n=+new Date,r=0;r<=127;r++)t[r]=Eo.measureText(String.fromCharCode(r),e).width;var i=+new Date-n;return i>16?$u=ed:i>2&&$u++,t}}var $u=0,ed=5;function td(e,t){return e.asciiWidthMapTried||=(e.asciiWidthMap=Qu(e.font),!0),0<=t&&t<=127?e.asciiWidthMap==null?e.asciiCharWidth:e.asciiWidthMap[t]:e.stWideCharWidth}function nd(e,t){var n=e.strWidthCache,r=n.get(t);return r??(r=Eo.measureText(t,e.font).width,n.put(t,r)),r}function rd(e,t,n,r){var i=nd(Xu(t),e),a=sd(t);return new Ru(ad(0,i,n),od(0,a,r),i,a)}function id(e,t,n,r){var i=((e||``)+``).split(` `);if(i.length===1)return rd(i[0],t,n,r);for(var a=new Ru(0,0,0,0),o=0;o=0?parseFloat(e)/100*t:parseFloat(e):e}function ld(e,t,n){var r=t.position||`inside`,i=t.distance==null?5:t.distance,a=n.height,o=n.width,s=a/2,c=n.x,l=n.y,u=`left`,d=`top`;if(r instanceof Array)c+=cd(r[0],n.width),l+=cd(r[1],n.height),u=null,d=null;else switch(r){case`left`:c-=i,l+=s,u=`right`,d=`middle`;break;case`right`:c+=i+o,l+=s,d=`middle`;break;case`top`:c+=o/2,l-=i,u=`center`,d=`bottom`;break;case`bottom`:c+=o/2,l+=a+i,u=`center`;break;case`inside`:c+=o/2,l+=s,u=`center`,d=`middle`;break;case`insideLeft`:c+=i,l+=s,d=`middle`;break;case`insideRight`:c+=o-i,l+=s,u=`right`,d=`middle`;break;case`insideTop`:c+=o/2,l+=i,u=`center`;break;case`insideBottom`:c+=o/2,l+=a-i,u=`center`,d=`bottom`;break;case`insideTopLeft`:c+=i,l+=i;break;case`insideTopRight`:c+=o-i,l+=i,u=`right`;break;case`insideBottomLeft`:c+=i,l+=a-i,d=`bottom`;break;case`insideBottomRight`:c+=o-i,l+=a-i,u=`right`,d=`bottom`}return e||={},e.x=c,e.y=l,e.align=u,e.verticalAlign=d,e}var ud=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function dd(e,t,n,r,i,a){if(!n){e.text=``,e.isTruncated=!1;return}var o=(t+``).split(` `);a=fd(n,r,i,a);for(var s=!1,c={},l=0,u=o.length;l=s;l++)c-=s;var u=nd(o,n);return u>c&&(n=``,u=0),c=e-u,i.ellipsis=n,i.ellipsisWidth=u,i.contentWidth=c,i.containerWidth=e,i}function pd(e,t,n){var r=n.containerWidth,i=n.contentWidth,a=n.fontMeasureInfo;if(!r){e.textLine=``,e.isTruncated=!1;return}var o=nd(a,t);if(o<=r){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=i||s>=n.maxIterations){t+=n.ellipsis;break}var c=s===0?md(t,i,a):o>0?Math.floor(t.length*i/o):0;t=t.substr(0,c),o=nd(a,t)}t===``&&(t=n.placeholder),e.textLine=t,e.isTruncated=!0}function md(e,t,n){for(var r=0,i=0,a=e.length;i{A6(e)}):A6(e)}function A6(e){if(e)try{e.body&&M6(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function j6(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function M6(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function N6(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:B6(r);let i=V6(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+a6(s.paddingLeft)+a6(o.marginLeft),top:-i.offsetTop+a6(s.paddingTop)+a6(o.marginTop),right:b6(a)-v6(i)-i.offsetLeft+a6(s.paddingRight)-a6(o.marginRight),bottom:y6(a)-_6(i)-i.offsetTop+a6(s.paddingBottom)-a6(o.marginBottom)}}return i6(r.right)&&(t=Math.min(t,r.right)),i6(r.bottom)&&(n=Math.min(n,r.bottom)),i6(r.left)&&(t=Math.max(t,r.left)),i6(r.top)&&(n=Math.max(n,r.top)),[t,n]}function P6(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function F6(e){return e.props.axis===`both`||e.props.axis===`x`}function I6(e){return e.props.axis===`both`||e.props.axis===`y`}function L6(e,t,n){let r=typeof t==`number`?T6(e,t):null;if(typeof t==`number`&&!r)return null;let i=V6(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return x6(r||e,a,n.props.scale)}function R6(e,t,n){let r=!i6(e.lastX),i=V6(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function z6(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function B6(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function V6(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var H6=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},U6={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},W6=U6.mouse,G6=class extends V.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!m6(e.target,this.props.handle,t)||this.props.cancel&&m6(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=E6(e);this.touchIdentifier=r;let i=L6(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=R6(this,a,o);H6(`DraggableCore: handleDragStart: %j`,s),H6(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&O6(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,h6(n,W6.move,this.handleDrag),h6(n,W6.stop,this.handleDragStop))},this.handleDrag=e=>{let t=L6(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=P6(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=R6(this,n,r);if(H6(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=L6(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=P6(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=R6(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&k6(a.ownerDocument),H6(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(H6(`DraggableCore: Removing handlers`),g6(a.ownerDocument,W6.move,this.handleDrag),g6(a.ownerDocument,W6.stop,this.handleDragStop))},this.onMouseDown=e=>(W6=U6.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(W6=U6.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(W6=U6.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(W6=U6.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&h6(e,U6.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;g6(t,U6.mouse.move,this.handleDrag),g6(t,U6.touch.move,this.handleDrag),g6(t,U6.mouse.stop,this.handleDragStop),g6(t,U6.touch.stop,this.handleDragStop),g6(e,U6.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&k6(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ki.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(H6(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return V.cloneElement(V.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};G6.displayName=`DraggableCore`,G6.propTypes={allowAnyClick:t6.default.bool,allowMobileScroll:t6.default.bool,children:t6.default.node.isRequired,disabled:t6.default.bool,enableUserSelectHack:t6.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:t6.default.arrayOf(t6.default.number),handle:t6.default.string,cancel:t6.default.string,nodeRef:t6.default.object,nonce:t6.default.string,onStart:t6.default.func,onDrag:t6.default.func,onStop:t6.default.func,onMouseDown:t6.default.func,scale:t6.default.number,className:o6,style:o6,transform:o6},G6.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var K6=class extends V.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(H6(`Draggable: onDragStart: %j`,t),this.props.onStart(e,z6(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;H6(`Draggable: onDrag: %j`,t);let n=z6(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=N6(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,z6(this,t))===!1)return!1;H6(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(H6(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ki.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,h={x:F6(this)&&p?this.state.x:m.x,y:I6(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=C6(h,c):d=S6(h,c);let g=V.Children.only(n),v=_(g.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return V.createElement(G6,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},V.cloneElement(g,{className:v,style:{...g.props.style,...d},transform:f}))}};K6.displayName=`Draggable`,K6.propTypes={...G6.propTypes,axis:t6.default.oneOf([`both`,`x`,`y`,`none`]),bounds:t6.default.oneOfType([t6.default.shape({left:t6.default.number,right:t6.default.number,top:t6.default.number,bottom:t6.default.number}),t6.default.string,t6.default.oneOf([!1])]),defaultClassName:t6.default.string,defaultClassNameDragging:t6.default.string,defaultClassNameDragged:t6.default.string,defaultPosition:t6.default.shape({x:t6.default.number,y:t6.default.number}),positionOffset:t6.default.shape({x:t6.default.oneOfType([t6.default.number,t6.default.string]),y:t6.default.oneOfType([t6.default.number,t6.default.string])}),position:t6.default.shape({x:t6.default.number,y:t6.default.number}),className:o6,style:o6,transform:o6},K6.defaultProps={...G6.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var q6=e(((e,t)=>{function n(e){var t,r,i=``;if(typeof e==`string`||typeof e==`number`)i+=e;else if(typeof e==`object`){if(Array.isArray(e)){var a=e.length;for(t=0;t{var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),f=e=>u(i({},`__esModule`,{value:!0}),e),p={};l(p,{DraggableCore:()=>we,default:()=>Te}),n.exports=f(p);var m=d(t()),h=d(e6()),g=d(b()),_=q6();function v(e,t){for(let n=0,r=e.length;n`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;nt===e.identifier)||e.changedTouches&&v(e.changedTouches,e=>t===e.identifier)}function ie(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function z(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function ae(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??z();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} `,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;} -`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&se(e.body,`react-draggable-transparent-selection`)}function B(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{oe(e)}):oe(e)}function oe(e){if(e)try{e.body&&ce(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function se(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function ce(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function le(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:ge(r);let i=_e(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+S(s.paddingLeft)+S(o.marginLeft),top:-i.offsetTop+S(s.paddingTop)+S(o.marginTop),right:L(a)-F(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:I(a)-P(i)-i.offsetTop+S(s.paddingBottom)-S(o.marginBottom)}}return x(r.right)&&(t=Math.min(t,r.right)),x(r.bottom)&&(n=Math.min(n,r.bottom)),x(r.left)&&(t=Math.max(t,r.left)),x(r.top)&&(n=Math.max(n,r.top)),[t,n]}function ue(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function de(e){return e.props.axis===`both`||e.props.axis===`x`}function fe(e){return e.props.axis===`both`||e.props.axis===`y`}function pe(e,t,n){let r=typeof t==`number`?re(e,t):null;if(typeof t==`number`&&!r)return null;let i=_e(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return ee(r||e,a,n.props.scale)}function me(e,t,n){let r=!x(e.lastX),i=_e(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function he(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function ge(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function _e(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var ve=d(t()),ye=d(e6()),be=d(b()),xe=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Se={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Ce=Se.mouse,we=class extends ve.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!j(e.target,this.props.handle,t)||this.props.cancel&&j(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ie(e);this.touchIdentifier=r;let i=pe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=me(this,a,o);xe(`DraggableCore: handleDragStart: %j`,s),xe(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&ae(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,M(n,Ce.move,this.handleDrag),M(n,Ce.stop,this.handleDragStop))},this.handleDrag=e=>{let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=ue(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(xe(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=ue(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&B(a.ownerDocument),xe(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(xe(`DraggableCore: Removing handlers`),N(a.ownerDocument,Ce.move,this.handleDrag),N(a.ownerDocument,Ce.stop,this.handleDragStop))},this.onMouseDown=e=>(Ce=Se.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Ce=Se.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Ce=Se.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Ce=Se.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&M(e,Se.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;N(t,Se.mouse.move,this.handleDrag),N(t,Se.touch.move,this.handleDrag),N(t,Se.mouse.stop,this.handleDragStop),N(t,Se.touch.stop,this.handleDragStop),N(e,Se.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&B(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=be.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(xe(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return ve.cloneElement(ve.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};we.displayName=`DraggableCore`,we.propTypes={allowAnyClick:ye.default.bool,allowMobileScroll:ye.default.bool,children:ye.default.node.isRequired,disabled:ye.default.bool,enableUserSelectHack:ye.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:ye.default.arrayOf(ye.default.number),handle:ye.default.string,cancel:ye.default.string,nodeRef:ye.default.object,nonce:ye.default.string,onStart:ye.default.func,onDrag:ye.default.func,onStop:ye.default.func,onMouseDown:ye.default.func,scale:ye.default.number,className:C,style:C,transform:C},we.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Te=class extends m.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(xe(`Draggable: onDragStart: %j`,t),this.props.onStart(e,he(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;xe(`Draggable: onDrag: %j`,t);let n=he(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=le(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,he(this,t))===!1)return!1;xe(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(xe(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=g.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,h=s||r,g={x:de(this)&&p?this.state.x:h.x,y:fe(this)&&p?this.state.y:h.y};this.state.isElementSVG?f=te(g,c):d=R(g,c);let v=m.Children.only(n),y=(0,_.clsx)(v.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return m.createElement(we,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},m.cloneElement(v,{className:y,style:{...v.props.style,...d},transform:f}))}};Te.displayName=`Draggable`,Te.propTypes={...we.propTypes,axis:h.default.oneOf([`both`,`x`,`y`,`none`]),bounds:h.default.oneOfType([h.default.shape({left:h.default.number,right:h.default.number,top:h.default.number,bottom:h.default.number}),h.default.string,h.default.oneOf([!1])]),defaultClassName:h.default.string,defaultClassNameDragging:h.default.string,defaultClassNameDragged:h.default.string,defaultPosition:h.default.shape({x:h.default.number,y:h.default.number}),positionOffset:h.default.shape({x:h.default.oneOfType([h.default.number,h.default.string]),y:h.default.oneOfType([h.default.number,h.default.string])}),position:h.default.shape({x:h.default.number,y:h.default.number}),className:C,style:C,transform:C},Te.defaultProps={...we.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(n.exports={DraggableCore:we})})),Y6=e(((e,t)=>{var n=J6(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),X6=e((e=>{e.__esModule=!0,e.cloneElement=l;var n=r(t());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t{e.__esModule=!0,e.resizableProps=void 0;var t=n(e6());Y6();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),Q6=e((e=>{e.__esModule=!0,e.default=void 0;var n=s(t()),r=Y6(),i=X6(),a=Z6(),o=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;tMath.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&(e!==`onResize`||v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,t){let r=this.props.handle;if(!r)return n.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:t});if(typeof r==`function`)return r(e,t);let i=typeof r.type==`string`,a=d({ref:t},i?{}:{handleAxis:e});return n.cloneElement(r,a)}render(){let e=this.props,t=e.children,a=e.className,s=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let u=e.resizeHandles;e.transformScale;let f=l(e,o);return(0,i.cloneElement)(t,d(d({},f),{},{className:(a?a+` `:``)+`react-resizable`,children:[...n.Children.toArray(t.props.children),...u.map(e=>{let t=this.handleRefs[e]??(this.handleRefs[e]=n.createRef());return n.createElement(r.DraggableCore,c({},s,{nodeRef:t,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,t))})]}))}};e.default=h,h.propTypes=a.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),$6=e((e=>{e.__esModule=!0,e.default=void 0;var n=c(t()),r=s(e6()),i=s(Q6()),a=Z6(),o=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(c=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,t=e.handle,r=e.handleSize;e.onResize;let a=e.onResizeStart,s=e.onResizeStop,c=e.draggableOpts,u=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,m=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=h(e,o);return n.createElement(i.default,{axis:m,draggableOpts:c,handle:t,handleSize:r,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:u,onResizeStart:a,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},n.createElement(`div`,l({},y,{style:d(d({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=d(d({},a.resizableProps),{},{children:r.default.element})})),e8=e(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Q6().default,t.exports.ResizableBox=$6().default}))(),t8=Z3(),n8=50,r8=12;function i8(e){let t=e;for(;t;){let e=window.getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function a8(e){let t=i8(e),n=null,r=0,i=0,a=!1;function o(){let e=t;if(!e)return;let s=e.getBoundingClientRect(),{clientHeight:c,scrollTop:l,scrollHeight:u}=e,{scrollLeft:d,scrollWidth:f,clientWidth:p}=e,m=0,h=0;i0?m=-r8:i>s.bottom-n8&&l+c0?h=-r8:r>s.right-n8&&d+p({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),ye=(0,V.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),be=(0,V.useCallback)(e=>({...ye,containerHeight:e??ye.containerHeight,layout:de.current}),[ye]),xe=(0,V.useMemo)(()=>I??{i:M,x:w,y:T,w:E,h:D,minW:O,maxW:k,minH:A,maxH:j},[I,M,w,T,E,D,O,k,A,j]),Se=(0,V.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(p)return v3(e);let t=y3(e);return m?{...t,left:b3(e.left/r),width:b3(e.width/r)}:t},[g,p,m,r]),Ce=(0,V.useCallback)((e,{node:t})=>{if(!ee)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/h,o=r.left/h,s=i.top/h,c=r.top/h,l;if(g?.calcDragPosition){let t=e;l=g.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(ce.current=l,_e.current||=a8(t instanceof HTMLElement?t:null),v>0){let t=e;he.current={x:t.clientX,y:t.clientY},me.current=!0,ge.current=!1,ae(!0);return}ae(!0);let u=Y4(ve,l.top,l.left),{x:d,y:f}=g3(F,xe,u.x,u.y,be());ee(M,d,f,{e,node:t,newPosition:l})},[ee,h,ve,g,v,F,xe,be,M]),we=(0,V.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!R||!z)return;let s=e;if(me.current&&!ge.current){let n=s.clientX-he.current.x,r=s.clientY-he.current.y;if(Math.hypot(n,r){if(!te||!z)return;_e.current?.stop(),_e.current=null;let n=me.current;if(me.current=!1,ge.current=!1,he.current={x:0,y:0},n){ae(!1),ce.current={left:0,top:0};return}let{left:r,top:i}=ce.current,a={top:i,left:r};ae(!1),ce.current={left:0,top:0};let o=Y4(ve,i,r),{x:s,y:c}=g3(F,xe,o.x,o.y,be());te(M,s,c,{e,node:t,newPosition:a})},[te,z,ve,F,xe,be,M]);fe.current=Ce,pe.current=we;let Ee=(0,V.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?ne:o===`onResize`?re:ie;if(!s)return;let c;c=t?A3(i,a,n,r):{...n,top:a.top,left:a.left},le.current=c;let l=t?.offsetParent?.clientHeight??0,u=X4(ve,c.width,c.height),{w:d,h:f}=_3(F,xe,u.w,u.h,i,be(l));s(M,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[ne,re,ie,r,ve,M,F,xe,be]),De=(0,V.useCallback)((e,t)=>{oe(!0);let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStart`)},[Ee,ve,w,T,E,D]),Oe=(0,V.useCallback)((e,t)=>{let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResize`)},[Ee,ve,w,T,E,D]),ke=(0,V.useCallback)((e,t)=>{oe(!1),le.current={top:0,left:0,width:0,height:0};let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStop`)},[Ee,ve,w,T,E,D]);(0,V.useEffect)(()=>{if(!y)return;let e=se.current;if(!e)return;let t=ue.current||{left:0,top:0},n=z&&(y.left!==t.left||y.top!==t.top);if(!z){let t={node:e,deltaX:y.left,deltaY:y.top,lastX:0,lastY:0,x:y.left,y:y.top};fe.current?.(y.e,t)}else if(n){let t={node:e,deltaX:y.left-ce.current.left,deltaY:y.top-ce.current.top,lastX:ce.current.left,lastY:ce.current.top,x:y.left,y:y.top};pe.current?.(y.e,t)}ue.current=y},[y,z,M]);let Ae=q4(ve,w,T,E,D,z?ce.current:null,B?le.current:null),je=V.Children.only(t),Me=G4(ve),Ne=[K4(O,Me,i[0]),K4(A,o,i[1])],Pe=[K4(k,Me,i[0]),K4(j,o,i[1])],Fe=je.props,Ie=Fe.className,Le=Fe.style,Re=V.cloneElement(je,{ref:se,className:_(`react-grid-item`,Ie,b,{static:f,resizing:B,"react-draggable":c,"react-draggable-dragging":z,dropping:!!y,cssTransforms:p}),style:{...x,...Le,...Se(Ae)}}),ze=P;return Re=(0,H.jsx)(e8.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:Ae.width,height:Ae.height,minConstraints:Ne,maxConstraints:Pe,onResizeStart:De,onResize:Oe,onResizeStop:ke,transformScale:h,resizeHandles:N,handle:ze,children:Re}),Re=(0,H.jsx)(G6,{disabled:!c,onStart:Ce,onDrag:we,onStop:Te,handle:S,cancel:`.react-resizable-handle`+(C?`,`+C:``),scale:h,allowMobileScroll:d,nodeRef:se,children:Re}),Re}var s8=V.memo(o8,(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h&&e.minW===t.minW&&e.maxW===t.maxW&&e.minH===t.minH&&e.maxH===t.maxH&&e.cols===t.cols&&e.containerWidth===t.containerWidth&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.margin===t.margin&&e.containerPadding===t.containerPadding&&e.transformScale===t.transformScale&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.isBounded===t.isBounded&&e.allowMobileScroll===t.allowMobileScroll&&e.useCSSTransforms===t.useCSSTransforms&&e.usePercentages===t.usePercentages&&e.children===t.children&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.droppingPosition===t.droppingPosition);s8.displayName=`GridItem`;function c8(e){let{clientX:t,clientY:n,gridElement:r,droppingItem:i,event:a,dragOffsetX:o=0,dragOffsetY:s=0,transformScale:c,cols:l,margin:u,maxRows:d,rowHeight:f,width:p,containerPadding:m}=e,h=r.getBoundingClientRect(),g={cols:l,margin:u,maxRows:d,rowHeight:f,containerWidth:p,containerPadding:m},_=G4(g),v=K4(i.w,_,u[0]),y=K4(i.h,f,u[1]),b=v/2,x=y/2,S=r.scrollLeft??0,C=r.scrollTop??0,w=t-h.left+S+o-b,T=n-h.top+C+s-x,E=Math.max(0,w),D=Math.max(0,T);return{newDroppingPosition:{left:E/c,top:D/c,e:a},calculatedXY:J4(g,D,E,i.w,i.h)}}var l8=()=>{},u8=`react-grid-layout`,d8=!1;try{d8=/firefox/i.test(navigator.userAgent)}catch{}function f8(e,t){let n=V.Children.toArray(e),r=V.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!V.isValidElement(t)||t.key===null)return;let n=String(t.key);a.add(n);let r=e.find(e=>e.i===n);if(r)i.push(s3(r));else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:i3(i),w:1,h:1})}});let o=d3(i,{cols:n});return r.compact(o,n)}function m8(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=j3,compactor:c,constraints:l=h3,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:h,onLayoutChange:g=l8,onDragStart:v=l8,onDrag:y=l8,onDragStop:b=l8,onResizeStart:x=l8,onResize:S=l8,onResizeStop:C=l8,onDrop:w=l8,onDropDragOver:T=l8}=e,E=(0,V.useMemo)(()=>({...M3,...r}),[r]),D=(0,V.useMemo)(()=>({...N3,...i}),[i]),O=(0,V.useMemo)(()=>({...P3,...a}),[a]),k=(0,V.useMemo)(()=>({...F3,...o}),[o]),{cols:A,rowHeight:j,maxRows:M,margin:N,containerPadding:P}=E,{enabled:F,bounded:I,handle:L,cancel:ee,threshold:R,allowMobileScroll:te}=D,{enabled:ne,handles:re,handleComponent:ie}=O,{enabled:z,defaultItem:ae,onDragOver:B,touchEnabled:oe=!0,touchDragSource:se=`[data-rgl-draggable]`}=k,ce=c??G3(`vertical`),le=ce.type,ue=ce.allowOverlap,de=ce.preventCollision??!1,fe=(0,V.useMemo)(()=>d??{i:`__dropping-elem__`,...ae},[d,ae]),pe=s.type===`transform`,me=s.scale,he=P??N,[ge,_e]=(0,V.useState)(!1),[ve,ye]=(0,V.useState)(()=>p8(u,t,A,ce)),[be,xe]=(0,V.useState)(null),[Se,Ce]=(0,V.useState)(!1),[we,Te]=(0,V.useState)(null),[Ee,De]=(0,V.useState)(),Oe=(0,V.useRef)(void 0);Oe.current=Ee;let ke=(0,V.useRef)(null),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(0),Ne=(0,V.useRef)(ve),Pe=(0,V.useRef)(u),Fe=(0,V.useRef)(t),Ie=(0,V.useRef)(le),Le=(0,V.useRef)(null),Re=(0,V.useRef)(!1),ze=(0,V.useRef)(null),Be=(0,V.useRef)(null);Be.current=we;let Ve=(0,V.useRef)(w);(0,V.useLayoutEffect)(()=>{Ve.current=w});let He=(0,V.useRef)(ve);He.current=ve,(0,V.useEffect)(()=>{_e(!0),(0,t8.deepEqual)(ve,u)||g(ve)},[]),(0,V.useEffect)(()=>{if(be||we)return;let e=!(0,t8.deepEqual)(u,Pe.current),n=!f8(t,Fe.current),r=le!==Ie.current;if(e||n||r){let n=p8(e?u:ve,t,A,ce);(0,t8.deepEqual)(n,ve)||ye(n)}Pe.current=u,Fe.current=t,Ie.current=le},[u,t,A,le,ce,be,we,ve]),(0,V.useEffect)(()=>{if(!be&&!we&&!(0,t8.deepEqual)(ve,Ne.current)){Ne.current=ve;let e=ve.filter(e=>e.i!==fe.i);g(e)}},[ve,be,we,g,fe.i]);let Ue=(0,V.useMemo)(()=>{if(!f)return;let e=i3(ve),t=he[1];return e*j+(e-1)*N[1]+t*2+`px`},[f,ve,j,N,he]),We=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=a3(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};ke.current=s3(a),je.current=i,xe(o),v(i,a,a,null,r.e,r.node)},[v]),Ge=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=ke.current,o=a3(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=f3(i,o,t,n,!0,de,le,A,ue);y(c,a,o,s,r.e,r.node),ye(ce.compact(c,A)),xe(s)},[de,le,A,ue,ce,y]),Ke=(0,V.useCallback)((e,t,n,r)=>{if(!ke.current)return;let i=He.current,a=ke.current,o=a3(i,e);if(!o)return;let s=f3(i,o,t,n,!0,de,le,A,ue),c=ce.compact(s,A);b(c,a,o,null,r.e,r.node);let l=je.current;ke.current=null,je.current=null,xe(null),ye(c),l&&!(0,t8.deepEqual)(l,c)&&g(c)},[de,le,A,ue,ce,b,g]),qe=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=a3(i,e);a&&(Ae.current=s3(a),je.current=i,Ce(!0),x(i,a,a,null,r.e,r.node))},[x]),Je=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,{handle:o}=r,s=!1,c,l,[u,d]=u3(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),de&&!ue&&e3(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,(o===`n`||o===`nw`||o===`ne`)&&(e.y=l??e.y),e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=f3(u,d,c,l,!0,de,le,A,ue));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};S(f,a,d,p,r.e,r.node);let m=ce.compact(f,A);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}ye(m),xe(p)},[de,le,A,ue,ce,S]),Ye=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,o=a3(i,e),s=ce.compact(i,A);C(s,a,o??null,null,r.e,r.node);let c=je.current;Ae.current=null,je.current=null,xe(null),Ce(!1),ye(s),c&&!(0,t8.deepEqual)(c,s)&&g(s)},[A,ce,C,g]),Xe=(0,V.useCallback)((e,t,n,r)=>{if(r)Oe.current&&(Oe.current.left!==t.left||Oe.current.top!==t.top)&&(De(t),ye(t=>t.map(t=>t.i===e.i&&(t.x!==n.x||t.y!==n.y)?{...t,x:n.x,y:n.y}:t)));else{Te((0,H.jsx)(`div`,{},e.i)),De(t);let r=He.current.filter(t=>t.i!==e.i);ye([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),Ze=(0,V.useCallback)((e,t,r)=>{let i=Le.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=c8({clientX:e,clientY:t,gridElement:i,droppingItem:fe,event:r,transformScale:me,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:he});Xe(fe,a,o,!!Be.current)},[fe,me,A,N,M,j,n,he,Xe]),Qe=(0,V.useCallback)(()=>{let e=He.current;if(!e.some(e=>e.i===fe.i)){Te(null),xe(null),De(void 0);return}let t=ce.compact(e.filter(e=>e.i!==fe.i),A);ye(t),Te(null),xe(null),De(void 0)},[fe.i,A,ce]),$e=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),d8&&!e.nativeEvent.target?.classList.contains(u8))return!1;let t=B?B(e.nativeEvent):T(e);if(t===!1)return we&&Qe(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...fe,...a},{newDroppingPosition:s,calculatedXY:c}=c8({clientX:e.clientX,clientY:e.clientY,gridElement:e.currentTarget,droppingItem:o,event:e.nativeEvent,dragOffsetX:r,dragOffsetY:i,transformScale:me,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:he});Xe(o,s,c,!!we)},[we,fe,B,T,Qe,Xe,me,A,N,M,j,n,he]),et=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current--,Me.current<0&&(Me.current=0),Me.current===0&&Qe()},[Qe]),tt=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current++},[]),nt=(0,V.useCallback)(e=>{let t=He.current,n=t.find(e=>e.i===fe.i);Qe(),Ve.current(t,n,e)},[fe.i,Qe]),rt=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current=0,nt(e.nativeEvent)},[nt]);(0,V.useEffect)(()=>{if(!z||!oe)return;let e=Le.current;if(!e)return;let t=(t,n)=>{let r=document.elementFromPoint(t,n);return r?e.contains(r):!1},n=e=>e instanceof HTMLElement&&e.closest(se)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=ze.current;if(n===null)return t[0];for(let e=0;e{if(!n(e.target)||ze.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(ze.current=t.identifier,Re.current=!0)},a=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);if(n){if(!t(n.clientX,n.clientY)){Be.current&&Qe();return}Ze(n.clientX,n.clientY,e)}},o=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);if(Re.current=!1,ze.current=null,n){if(!t(n.clientX,n.clientY)){Qe();return}nt(e)}},s=()=>{Re.current&&(Re.current=!1,ze.current=null,Qe())},c={passive:!1};return document.addEventListener(`touchstart`,i,c),document.addEventListener(`touchmove`,a,c),document.addEventListener(`touchend`,o,c),document.addEventListener(`touchcancel`,s,c),()=>{document.removeEventListener(`touchstart`,i,c),document.removeEventListener(`touchmove`,a,c),document.removeEventListener(`touchend`,o,c),document.removeEventListener(`touchcancel`,s,c)}},[z,oe,se,Ze,Qe,nt,fe.i]);let it=(0,V.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=a3(ve,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&F,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ne,o=r.resizeHandles||[...re],c=i&&I&&r.isBounded!==!1,u=ie;return(0,H.jsx)(s8,{containerWidth:n,cols:A,margin:N,containerPadding:he,maxRows:M,rowHeight:j,cancel:ee,handle:L,onDragStart:We,onDrag:Ge,onDragStop:Ke,onResizeStart:qe,onResize:Je,onResizeStop:Ye,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:te,useCSSTransforms:pe&&ge,usePercentages:!ge,transformScale:me,positionStrategy:s,dragThreshold:R,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?Ee:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:ve,children:e},r.i)},[ve,n,A,N,he,M,j,ee,L,We,Ge,Ke,qe,Je,Ye,F,ne,I,pe,ge,me,s,R,Ee,re,ie,l]),at=()=>be?(0,H.jsx)(s8,{w:be.w,h:be.h,x:be.x,y:be.y,i:be.i,className:`react-grid-placeholder ${Se?`placeholder-resizing`:``}`,containerWidth:n,cols:A,margin:N,containerPadding:he,maxRows:M,rowHeight:j,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:pe,transformScale:me,constraints:l,layout:ve,children:(0,H.jsx)(`div`,{})}):null,ot=(0,V.useCallback)(e=>{Le.current=e,typeof h==`function`?h(e):h&&`current`in h&&(h.current=e)},[h]),st=_(u8,p),ct={height:Ue,...m};return(0,H.jsxs)(`div`,{ref:ot,className:st,style:ct,onDrop:z?rt:void 0,onDragLeave:z?et:void 0,onDragEnter:z?tt:void 0,onDragOver:z?$e:void 0,children:[V.Children.map(t,e=>V.isValidElement(e)?it(e):null),z&&we&&it(we,!0),at()]})}var h8={lg:1200,md:996,sm:768,xs:480,xxs:0},g8={lg:12,md:10,sm:6,xs:4,xxs:2},_8=()=>{};function v8(e,t,n,r,i=!1){let a=[];V.Children.forEach(t,t=>{if(!V.isValidElement(t)||t.key===null)return;let n=String(t.key),r=t.props[`data-grid`],o=e.find(e=>e.i===n);o?i&&r?a.push({...o,i:n,w:r.w??o.w,h:r.h??o.h,minW:r.minW??o.minW,maxW:r.maxW??o.maxW,minH:r.minH??o.minH,maxH:r.maxH??o.maxH}):a.push({...o,i:n}):r?a.push({i:n,x:r.x??0,y:r.y??0,w:r.w??1,h:r.h??1,minW:r.minW,maxW:r.maxW,minH:r.minH,maxH:r.maxH,static:r.static,isDraggable:r.isDraggable,isResizable:r.isResizable,resizeHandles:r.resizeHandles,isBounded:r.isBounded}):a.push({i:n,x:0,y:i3(a),w:1,h:1})});let o=d3(a,{cols:n});return r.compact(o,n)}function y8(e){let{children:t,width:n,breakpoint:r,breakpoints:i=h8,cols:a=g8,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=_8,onLayoutChange:p=_8,onWidthChange:m=_8,...h}=e,g=d??G3(`vertical`),_=g.type,v=g.allowOverlap,y=(0,V.useMemo)(()=>r??q3(i,n),[]),b=(0,V.useMemo)(()=>J3(y,a),[y,a]),x=(0,V.useMemo)(()=>Y3(o,i,y,y,b,_),[]),[S,C]=(0,V.useState)(y),[w,T]=(0,V.useState)(b),[E,D]=(0,V.useState)(x),[O,k]=(0,V.useState)(o),A=(0,V.useRef)(n),j=(0,V.useRef)(r),M=(0,V.useRef)(i),N=(0,V.useRef)(a),P=(0,V.useRef)(o),F=(0,V.useRef)(_),I=(0,V.useRef)(O);(0,V.useEffect)(()=>{I.current=O},[O]);let L=(0,V.useMemo)(()=>(0,t8.deepEqual)(o,P.current)?null:Y3(o,i,S,S,w,g),[o,i,S,w,g]),ee=L??E;(0,V.useEffect)(()=>{L!==null&&(D(L),k(o),I.current=o,P.current=o)},[L,o]),(0,V.useEffect)(()=>{if(_!==F.current){let e=g.compact(c3(ee),w),t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t),F.current=_}},[_,g,ee,w,v,S,p]),(0,V.useEffect)(()=>{let e=n!==A.current,o=r!==j.current,s=!(0,t8.deepEqual)(i,M.current),c=!(0,t8.deepEqual)(a,N.current);if(e||o||s||c){let e=r??q3(i,n),o=J3(e,a),d=S;if(d!==e||s||c){let n={...I.current};n[d]||(n[d]=c3(E));let r=Y3(n,i,e,d,o,g),a=!n[e];r=v8(r,t,o,g,a),n[e]=r,C(e),T(o),D(r),k(n),I.current=n,f(e,o),p(r,n)}let h=X3(l,e),_=u?X3(u,e):null;m(n,h,o,_),A.current=n,j.current=r,M.current=i,N.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let R=(0,V.useCallback)(e=>{let t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t)},[S,p]),te=(0,V.useMemo)(()=>X3(l,S),[l,S]),ne=(0,V.useMemo)(()=>u===null?null:X3(u,S),[u,S]),re=(0,V.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:te,containerPadding:ne}),[w,s,c,te,ne]);return(0,H.jsx)(m8,{...h,width:n,gridConfig:re,compactor:g,onLayoutChange:R,layout:ee,children:t})}var b8=V.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,H.jsx)(y8,{...r,innerRef:i})});b8.displayName=`ResponsiveGridLayout`;function x8(e,t,n,r){let i=e=>t?.frame?.columns.some((n,r)=>n.name===e&&t.frame.values[r]?.some(e=>typeof e==`string`&&e!==``));return{onSelect:e.click&&(e.viz===`service_map`||!(e.drill&&r))?t=>n(e.click.set_variable,t):void 0,onPoint:r&&(e.viz===`service_map`||e.click||e.drill||i(`trace_id`)||e.options?.columns?.some(e=>e.format===`trace_link`&&i(e.field)))?r:void 0}}function S8(e,t,n,r){if(!t)return;let i=pt(e,t,n);if(!i)return;let a=Object.values(n.dimensions)[0],o=e.click?.set_variable;return{target:i,vars:o&&a!==void 0?{...r,[o]:a}:r}}function C8(e){return`Explain the panel “${e.title}”`}function w8(e){return`Fix the panel “${e.title}”`}function T8(e){return[{description:`Observed panel diagnostics`,value:JSON.stringify(e)}]}var E8=e=>e*40+(e-1)*12,D8={s:3,m:6,l:10},O8={stat:4},k8=e=>Math.max(O8[e.viz]??0,D8[e.height??(e.viz===`service_map`?`l`:e.viz===`stat`?`s`:`m`)]),A8=(0,V.lazy)(()=>le(()=>import(`./panel-sql-editor-BFXSBGw8.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),j8=0;function M8(e){let t;do t=`p_${Date.now().toString(36)}_${(++j8).toString(36)}_${Math.random().toString(36).slice(2,10)}`;while(e.some(e=>e.id===t));return t}function N8({dashboardId:e,version:t,spec:n,vars:r,results:i,fetching:a,annotations:o,fetchingIds:s=[],staleAt:c=new Map,time:l=n.time,onEditExit:u,editing:d,view:f,agentAvailable:p,canManage:m=!1,onOpenChat:h,onVariable:g,onRetry:_,onPoint:v,onZoom:b,onZoomReset:x,zoomed:S,onView:w,onVisible:E,onRangePending:D,shortcutScope:O,onShortcuts:k,overlayOpen:A,returnViewFocus:j}){let M=et(),[N,P]=(0,V.useState)(),[F,I]=(0,V.useState)(()=>n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??k8(e)})));(0,V.useEffect)(()=>{I(n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??k8(e)})))},[n]);let[L,R]=(0,V.useState)(()=>window.innerHeight),[te,ne]=(0,V.useState)();(0,V.useEffect)(()=>{let e=()=>R(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let re=(0,V.useRef)(null),ie=(0,V.useRef)(new Map),z=(0,V.useRef)(null),ae=(0,V.useRef)(null),B=()=>{let e=N?.panel.id;P(void 0),requestAnimationFrame(()=>(ae.current?.isConnected?ae.current:ie.current.get(e??``))?.focus())},se=(0,V.useRef)(f);f&&(se.current=f);let[ce,le]=(0,V.useState)(0),ue=ce>0,de=d&&(ce>=1100?`lg`:ce>=800?`md`:`sm`)==`lg`;(0,V.useLayoutEffect)(()=>{if(!re.current)return;le(Math.max(0,Math.round(re.current.getBoundingClientRect().width)));let e=new ResizeObserver(([e])=>{e&&le(Math.max(0,Math.round(e.contentRect.width)))});return e.observe(re.current),()=>e.disconnect()},[]);let fe=(0,V.useRef)(E);fe.current=E,(0,V.useEffect)(()=>{if(!ue||!re.current||typeof IntersectionObserver>`u`)return;let e=new Set(n.panels.map(e=>e.id)),t=new IntersectionObserver(t=>{for(let n of t){let t=n.target.dataset.panel;t&&(n.isIntersecting?e.add(t):e.delete(t))}f&&n.panels.some(e=>e.id===f)&&e.add(f),fe.current([...e])},{rootMargin:`200px`});return re.current.querySelectorAll(`.react-grid-item[data-panel]`).forEach(e=>t.observe(e)),()=>t.disconnect()},[n,f,ue]);let pe=(0,V.useMemo)(()=>n.panels.some(e=>{let t=F.find(t=>t.i===e.id);return t&&(t.x!==e.grid?.x||t.y!==e.grid?.y||t.w!==e.grid?.w||t.h!==e.grid?.h)}),[F,n]),me=e=>({...n,panels:e.map(e=>{let t=F.find(t=>t.i===e.id);return t?{...e,grid:{x:t.x,y:t.y,w:t.w,h:t.h}}:e})}),he=De({mutationFn:()=>Qe(e,me(n.panels),t,`Edited layout`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),ge=De({mutationFn:r=>pe?Qe(e,me(n.panels.filter(e=>e.id!==r)),t,`Removed a panel and saved layout`):Ae(e,[{op:`remove_panel`,id:r}],t,`Removed a panel`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),_e=De({mutationFn:r=>{let i={...r,id:M8(n.panels),title:`${Array.from(r.title).slice(0,73).join(``)} (copy)`,grid:void 0};if(pe){let a=[...n.panels];return a.splice(a.findIndex(e=>e.id===r.id)+1,0,i),Qe(e,me(a),t,`Duplicated a panel and saved layout`)}return Ae(e,[{op:`add_panel`,after:r.id,panel:i}],t,`Duplicated a panel`)},onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}});(0,V.useEffect)(()=>{d||(he.reset(),ge.reset(),_e.reset())},[d]);let ve=()=>{he.reset(),ge.reset(),_e.reset(),u?.(),M.invalidateQueries({queryKey:[`dashboard`,e]})},ye=async e=>{let t=new URL(window.location.href);t.searchParams.set(`view`,e),t.searchParams.delete(`edit`);try{await navigator.clipboard.writeText(t.toString()),ne(`Link copied`)}catch{ne(`Copy this URL: ${t.toString()}`)}},be=`dashboard-${e}`,xe=n=>({dashboard_id:e,version:t,panel_id:n.id,title:Yi(n.title,r),from_ms:i.get(n.id)?.from_ms,to_ms:i.get(n.id)?.to_ms,vars:r,error:i.get(n.id)?.error,status:i.get(n.id)?.status,diagnosis:i.get(n.id)?.diagnosis,stale_since:c.get(n.id),truncated:i.has(n.id)?!!(i.get(n.id)?.frame?.truncated||i.get(n.id)?.previous?.truncated):void 0,note:i.get(n.id)?.frame?.note,spec:{...n,dashboard_time:l}}),Se=(u,d,y=!1)=>(0,H.jsx)(V4,{panel:u,title:Yi(u.title,r),result:i.get(u.id),loading:a&&s.includes(u.id),height:d,group:be,editing:de&&!y,agentAvailable:p,suspended:!y&&u.id===f,menuRef:y?z:e=>{e?ie.current.set(u.id,e):ie.current.delete(u.id)},compare:l.compare===`previous_period`,range:u.time?.range??l.range,annotations:o,vars:r,onVariable:g,...x8(u,i.get(u.id),g,v?e=>v(u,e):void 0),onRangePending:e=>D?.(u.id,e),onZoom:b,zoomed:S,onZoomReset:x,onRetry:_?()=>_(u.id):void 0,onView:()=>w(u.id),onCopyLink:()=>{ye(u.id)},onEditSQL:m&&typeof u.sql==`string`?()=>{ae.current=y?z.current:ie.current.get(u.id)??null,P({panel:u,spec:n,version:t})}:void 0,onExplain:e?()=>h(C8(xe(u)),{answer_only:!0,context:T8(xe(u))}):void 0,onFix:e&&m?()=>h(w8(xe(u)),{context:T8(xe(u))}):void 0,staleAt:c.get(u.id),onDuplicate:de&&!y?()=>_e.mutate(u):void 0,onRemove:de&&!y?()=>ge.mutate(u.id):void 0}),Ce=n.panels.find(e=>e.id===f),we=d?he.error??ge.error??_e.error:null,Te=we instanceof Me&&we.code===`dashboard_version_conflict`,Ee=e=>{de&&I(e.map(({i:e,x:t,y:n,w:r,h:i})=>({i:e,x:t,y:n,w:r,h:i})))};return(0,H.jsxs)(`div`,{ref:re,style:{minWidth:0},children:[d&&(0,H.jsxs)(y,{justify:`space-between`,mb:`sm`,p:`xs`,style:{border:`1px dashed var(--mantine-color-default-border)`,borderRadius:8},children:[(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:de?`Drag a panel by its title and resize it from the corner. Changes are saved as a new version.`:`The layout can be edited only on a wider screen.`}),(0,H.jsx)(C,{size:`compact-sm`,disabled:!pe||!de,loading:he.isPending,onClick:()=>he.mutate(),children:`Save layout`})]}),Te&&(0,H.jsxs)(ee,{color:`warn`,mb:`sm`,children:[`Someone saved this dashboard since you opened it. Load the latest version, then redo your change. `,(0,H.jsx)(C,{size:`compact-sm`,onClick:ve,children:`Load latest`})]}),we&&!Te&&(0,H.jsx)(ee,{color:`bad`,mb:`sm`,children:we.message}),te&&(0,H.jsx)(ee,{role:`status`,mb:`sm`,children:te}),!ue&&(0,H.jsx)(`div`,{"data-grid-placeholder":!0,style:{height:E8(Math.max(1,...F.map(e=>e.y+e.h)))}}),ue&&(0,H.jsx)(b8,{width:ce,className:`dashboard-grid${de?` dashboard-grid-editing`:``}`,layouts:{lg:F,md:F,sm:F.map(e=>({...e,x:0,w:12}))},breakpoints:{lg:1100,md:800,sm:0},cols:{lg:12,md:12,sm:12},rowHeight:40,margin:[12,12],containerPadding:[0,0],compactor:z3,dragConfig:{enabled:de,handle:`.panel-drag`,cancel:`button`},resizeConfig:{enabled:de},onDragStop:Ee,onResizeStop:Ee,children:n.panels.map(e=>{let t=F.find(t=>t.i===e.id);return(0,H.jsx)(`div`,{"data-panel":e.id,children:Se(e,E8(t?.h??6))},e.id)})}),(0,H.jsx)(B4,{shortcutScope:O,onShortcuts:k,escapeEnabled:!A&&!N,opened:!!f,onClose:()=>w(void 0),title:Ce?Yi(Ce.title,r):`Missing panel`,returnFocusTo:()=>j?.(se.current)??ie.current.get(se.current??``)??ie.current.values().next().value,children:Ce?(0,H.jsx)(`div`,{style:{height:`calc(100vh - 120px)`},children:Se(Ce,Math.max(40,L-140),!0)}):(0,H.jsx)(ee,{color:`warn`,children:`This panel is missing from the dashboard. The shared link may be out of date.`})}),N&&(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(yt,{opened:!0,onClose:B,title:`Loading SQL editor`,children:(0,H.jsx)(oe,{size:`sm`,"aria-label":`Loading SQL editor`})}),children:(0,H.jsx)(A8,{dashboardId:e,version:N.version,spec:N.spec,panel:N.panel,time:l,vars:r,onClose:B})})]})}function P8(e,t=1,n=8){let r=(t-1)*n;return e.slice(r,r+n)}function F8({icon:e,title:t,children:n,tall:r=!1}){return(0,H.jsx)(ie,{mih:r?220:130,p:`xl`,children:(0,H.jsxs)(y,{wrap:`nowrap`,children:[(0,H.jsx)(te,{variant:`light`,size:`xl`,radius:`md`,children:e}),(0,H.jsxs)(o,{children:[(0,H.jsx)(T,{fw:700,size:`sm`,children:t}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,mt:3,children:n})]})]})})}function I8(e,t=8){let[n,r]=(0,V.useState)(1),i=Math.max(1,Math.ceil(e.length/t));(0,V.useEffect)(()=>{n>i&&r(i)},[n,i]);let a=(n-1)*t;return{page:n,setPage:r,totalPages:i,pageItems:P8(e,n,t),from:e.length?a+1:0,to:Math.min(a+t,e.length),total:e.length}}function L8({page:e,totalPages:t,from:n,to:r,total:i,onChange:a}){return t<=1?null:(0,H.jsxs)(y,{justify:`space-between`,mt:`xs`,children:[(0,H.jsxs)(T,{c:`dimmed`,size:`xs`,children:[n,`–`,r,` of `,i]}),(0,H.jsx)(y,{gap:4,children:[{label:`First page`,page:1,disabled:e===1},{label:`Previous page`,page:e-1,disabled:e===1},{label:`Next page`,page:e+1,disabled:e===t},{label:`Last page`,page:t,disabled:e===t}].map(e=>(0,H.jsx)(C,{size:`compact-xs`,variant:`subtle`,"aria-label":e.label,disabled:e.disabled,onClick:()=>a(e.page),children:e.label},e.label))})]})}function R8({spans:e,dark:t,onSpan:n}){let r=Math.min(...e.map(e=>new Date(e.start).valueOf())),i=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),a=Math.max(i-r,1),s=[...new Set(e.map(e=>e.service))],c=I8(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(be.ScrollContainer,{minWidth:680,children:(0,H.jsxs)(be,{highlightOnHover:!!n,verticalSpacing:`sm`,children:[(0,H.jsx)(be.Thead,{children:(0,H.jsxs)(be.Tr,{children:[(0,H.jsx)(be.Th,{w:230,children:`Operation`}),(0,H.jsx)(be.Th,{children:`Timeline`}),(0,H.jsx)(be.Th,{w:90,ta:`right`,children:`Duration`})]})}),(0,H.jsx)(be.Tbody,{children:c.pageItems.map(e=>{let i=(new Date(e.start).valueOf()-r)/a*100,c=Math.max(e.duration_ms/a*100,.6),l=e.status===`STATUS_CODE_ERROR`;return(0,H.jsxs)(be.Tr,{tabIndex:n?0:void 0,onClick:n?()=>n(e):void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))}:void 0,style:{cursor:n?`pointer`:void 0},children:[(0,H.jsx)(be.Td,{children:(0,H.jsxs)(y,{gap:`xs`,wrap:`nowrap`,children:[(0,H.jsx)(o,{w:8,h:8,bg:Ua(s.indexOf(e.service),t),style:{borderRadius:`50%`,flex:`0 0 auto`}}),(0,H.jsxs)(o,{miw:0,children:[(0,H.jsx)(T,{fw:600,size:`sm`,truncate:!0,children:e.operation}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,truncate:!0,children:e.service})]})]})}),(0,H.jsx)(be.Td,{children:(0,H.jsx)(me,{label:`${e.service} · ${e.operation} · ${ye(e.duration_ms)}`,withArrow:!0,children:(0,H.jsx)(o,{pos:`relative`,h:14,bg:`var(--mantine-color-default-hover)`,role:`img`,"aria-label":`${e.operation} on ${e.service} took ${ye(e.duration_ms)}`,style:{borderRadius:`var(--mantine-radius-sm)`},children:(0,H.jsx)(o,{pos:`absolute`,left:`${i}%`,w:`${Math.min(c,100-i)}%`,h:`100%`,bg:l?`bad`:Ua(s.indexOf(e.service),t),style:{borderRadius:`var(--mantine-radius-sm)`,minWidth:3}})})})}),(0,H.jsx)(be.Td,{ta:`right`,children:(0,H.jsx)(T,{size:`sm`,ff:`monospace`,children:ye(e.duration_ms)})})]},e.span_id)})})]})}),(0,H.jsx)(L8,{...c,onChange:c.setPage})]})}function z8({result:e,dark:t,onSpan:n}){let[r,i]=(0,V.useState)(`waterfall`),a=e.data,s=(0,V.useMemo)(()=>({id:`correlated_logs`,status:a.logs.length?`ok`:`empty`,elapsed_ms:0,frame:{columns:[{name:`time`,type:`time`,role:`time`},...[`severity`,`service`,`body`].map(e=>({name:e,type:`string`,role:`dimension`}))],rows:a.logs.length,values:[a.logs.map(e=>Date.parse(e.time)),a.logs.map(e=>e.severity),a.logs.map(e=>e.service),a.logs.map(e=>e.body)]}}),[a.logs]);return(0,H.jsxs)(S,{gap:`sm`,children:[(0,H.jsxs)(y,{children:[(0,H.jsx)(T,{fw:600,children:a.trace_id}),(0,H.jsx)(T,{c:a.has_error?`bad`:`dimmed`,children:a.has_error?`■ Error`:`● OK`})]}),a.spans.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(y,{role:`group`,"aria-label":`Trace view`,children:[(0,H.jsx)(C,{"aria-pressed":r===`waterfall`,variant:r===`waterfall`?`light`:`subtle`,onClick:()=>i(`waterfall`),children:`Waterfall`}),(0,H.jsx)(C,{"aria-pressed":r===`flame`,variant:r===`flame`?`light`:`subtle`,onClick:()=>i(`flame`),children:`Flame graph`})]}),r===`waterfall`?(0,H.jsx)(R8,{spans:a.spans,dark:t,onSpan:n}):(0,H.jsx)(B8,{spans:a.spans,dark:t,onSpan:n})]}):(0,H.jsx)(T,{c:`dimmed`,children:`No spans were found for this trace.`}),(0,H.jsx)(T,{fw:600,children:`Correlated logs`}),a.logs.length?(0,H.jsx)(o,{style:{overflow:`auto`,minWidth:0},children:(0,H.jsx)(P4,{foldConstants:!1,panel:{id:`correlated_logs`,title:`Correlated logs`,viz:`logs`},result:s,dark:t,height:320})}):(0,H.jsx)(F8,{tall:!0,icon:(0,H.jsx)(zi,{size:20,weight:`duotone`}),title:`No correlated logs`,children:`No logs in this window carry the selected trace ID.`}),a.truncated&&(0,H.jsxs)(ee,{color:`warn`,children:[`This trace is truncated: `,a.spans.length,` of `,a.span_count,` spans, `,a.services.length,` of `,a.service_count,` services.`]})]})}function B8({spans:e,dark:t,onSpan:n}){let r=(0,V.useMemo)(()=>V8(e),[e]),i=[...new Set(e.map(e=>e.service))];return(0,H.jsxs)(S,{px:{base:`md`,sm:`lg`},pb:`md`,gap:`xs`,children:[(0,H.jsxs)(y,{justify:`space-between`,children:[(0,H.jsx)(y,{gap:`md`,children:i.map(e=>(0,H.jsxs)(y,{gap:5,children:[(0,H.jsx)(o,{w:8,h:8,bg:Ua(i.indexOf(e),t),style:{borderRadius:`50%`}}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,children:e})]},e))}),(0,H.jsx)(Ue,{variant:`light`,children:ye(r.total)})]}),(0,H.jsx)(B,{withBorder:!0,radius:`md`,p:`sm`,children:(0,H.jsx)(pe,{type:`auto`,offsetScrollbars:!0,children:(0,H.jsxs)(o,{miw:760,children:[(0,H.jsx)(o,{pos:`relative`,h:22,mb:4,children:[0,25,50,75,100].map(e=>(0,H.jsx)(T,{pos:`absolute`,left:`${e}%`,c:`dimmed`,size:`xs`,style:{transform:e===100?`translateX(-100%)`:e?`translateX(-50%)`:void 0},children:ye(r.total*e/100)},e))}),(0,H.jsxs)(o,{pos:`relative`,h:Math.max(150,r.laneCount*36+12),bg:`var(--mantine-color-default-hover)`,style:{overflow:`hidden`,borderRadius:`var(--mantine-radius-md)`},children:[[0,25,50,75,100].map(e=>(0,H.jsx)(o,{pos:`absolute`,left:`${e}%`,top:0,bottom:0,style:{borderLeft:`1px solid var(--mantine-color-default-border)`}},e)),r.frames.map(({span:e,lane:r,left:a,width:s})=>{let c=e.status===`STATUS_CODE_ERROR`,l=s<7,u=c?Ha(t).bad:Ua(i.indexOf(e.service),t),d=`${e.operation} · ${ye(e.duration_ms)} · ${e.service}`,f=(0,H.jsxs)(T,{component:`span`,size:`xs`,fw:700,truncate:!0,children:[l?``:e.operation,s>=12?` · ${ye(e.duration_ms)}`:``]}),p={position:`absolute`,left:`${a}%`,top:r*36+6,width:`${Math.max(s,.35)}%`,height:30,overflow:`hidden`,minWidth:3};return(0,H.jsx)(me,{label:`${e.service} · ${e.operation} · ${ye(e.duration_ms)}`,withArrow:!0,events:{hover:!0,focus:!0,touch:!1},children:n?(0,H.jsx)(C,{variant:`filled`,color:u,"aria-label":d,px:l?2:`xs`,size:`compact-xs`,onClick:()=>n(e),style:p,children:f}):(0,H.jsx)(o,{role:`img`,tabIndex:0,"aria-label":d,style:{...p,display:`flex`,alignItems:`center`,paddingInline:l?2:8,borderRadius:`var(--mantine-radius-sm)`,background:u,color:Ot(u)},children:f})},e.span_id)})]})]})})}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,children:`Width represents wall-clock duration; lanes preserve span hierarchy without overlap.`})]})}function V8(e){let t=Math.min(...e.map(e=>new Date(e.start).valueOf())),n=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),r=Math.max(n-t,1),i=new Map(e.map(e=>[e.span_id,e])),a=(e,t=new Set)=>{if(!e.parent_span_id||t.has(e.span_id))return 0;let n=i.get(e.parent_span_id);return n?(t.add(e.span_id),1+a(n,t)):0},o=e.map(e=>{let n=new Date(e.start).valueOf();return{span:e,depth:a(e),start:n,end:n+e.duration_ms,left:(n-t)/r*100,width:e.duration_ms/r*100}}).sort((e,t)=>e.depth-t.depth||e.start-t.start||t.span.duration_ms-e.span.duration_ms),s=[],c=0;for(let e of[...new Set(o.map(e=>e.depth))].sort((e,t)=>e-t)){let t=[];for(let n of o.filter(t=>t.depth===e)){let e=t.findIndex(e=>e<=n.start);e===-1&&(e=t.length),t[e]=n.end,s.push({...n,lane:c+e})}c+=Math.max(t.length,1)}return{frames:s,laneCount:c,total:r}}function H8({client:e,spec:t,time:n,vars:r,target:i,onChange:a}){let o=it(`light`)===`dark`,s=t.panels.find(e=>e.id===i?.panel_id),c=i?.kind===`logs`&&s?.query?.from===`logs`,l=ot({queryKey:[`exemplars`,t,i,r],queryFn:({signal:n})=>e.exemplars({dashboard:t,panel_id:i.panel_id,kind:c?`logs`:`traces`,time:{from:i.window_from,to:i.window_to,refresh:`off`},from:i.from,to:i.to,dimensions:i.dimensions,bucket:i.bucket,vars:r},n),enabled:!!(i&&s&&!i.trace_id),retry:!1}),u=ot({queryKey:[`drill-trace`,i],queryFn:({signal:t})=>e.trace(i,t),enabled:!!i?.trace_id,retry:!1});return(0,H.jsxs)($e,{opened:!!i,onClose:()=>a(void 0),title:s?`${s.title} · ${i?.kind}`:`Panel selection unavailable`,position:`right`,size:`xl`,children:[i?.trace_id&&(0,H.jsx)(C,{variant:`subtle`,mb:`sm`,onClick:()=>{let{trace_id:e,namespace:t,...n}=i;a(n)},children:`Back to traces`}),!s&&(0,H.jsx)(ee,{color:`bad`,children:`This panel is no longer in the dashboard.`}),(l.isFetching||u.isFetching)&&(0,H.jsx)(oe,{role:`status`,"aria-label":`Loading drill data`,size:`sm`}),(l.error||u.error)&&(0,H.jsx)(ee,{color:`bad`,children:(l.error??u.error)?.message}),c&&l.data?.logs&&s&&(0,H.jsx)(P4,{panel:{...s,viz:`logs`},result:{id:s.id,status:l.data.logs.rows?`ok`:`empty`,frame:l.data.logs,elapsed_ms:0,from_ms:Date.parse(i.from),to_ms:Date.parse(i.to)},dark:o,height:500}),c&&l.data?.logs?.rows===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No logs match this selection.`}),!c&&!i?.trace_id&&l.data&&(0,H.jsxs)(S,{gap:`xs`,children:[l.data.traces.length===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No exemplar traces match this selection.`}),l.data.traces.map(e=>(0,H.jsxs)(C,{variant:`default`,justify:`space-between`,onClick:()=>a({...i,trace_id:e.trace_id,namespace:e.namespace}),children:[e.service,` · `,e.operation,` · `,e.duration_ms.toFixed(1),` ms`]},`${e.namespace}/${e.trace_id}`)),l.data.truncated&&(0,H.jsx)(T,{size:`xs`,c:`dimmed`,children:`Showing at most 20 exemplar traces.`})]}),u.data&&(0,H.jsx)(z8,{result:u.data,dark:o})]})}var U8={"5m":`Last 5 minutes`,"15m":`Last 15 minutes`,"1h":`Last hour`,"3h":`Last 3 hours`,"6h":`Last 6 hours`,"12h":`Last 12 hours`,"24h":`Last 24 hours`,"2d":`Last 2 days`,"7d":`Last 7 days`,"30d":`Last 30 days`};function W8(e){return e.from&&e.to?`${ge(e.from)} – ${ge(e.to)}`:U8[e.range??`1h`]??e.range??`Last hour`}function G8({time:e,refresh:t,compare:n,editing:r,fetching:i,updatedAt:a,onRange:o,onAbsolute:s,onZoomOut:c,onRefresh:l,onRefreshNow:u,onCompare:d,onEdit:f,onHistory:p,onShortcuts:m,selecting:h=!1}){let[g,_]=(0,V.useState)(``),[v,b]=(0,V.useState)(``),[x,S]=(0,V.useState)(!1);return(0,H.jsxs)(y,{gap:`xs`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard controls`,children:[(0,H.jsxs)(Je,{position:`bottom-end`,withinPortal:!0,opened:x,onChange:S,children:[(0,H.jsx)(Je.Target,{children:(0,H.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,H.jsx)(ji,{size:15}),rightSection:(0,H.jsx)(_e,{size:12,weight:`bold`}),children:W8(e)})}),(0,H.jsxs)(Je.Dropdown,{miw:260,children:[(0,H.jsx)(Je.Label,{children:`Relative`}),dt.map(t=>(0,H.jsx)(Je.Item,{onClick:()=>o(t),fw:e.range===t?600:void 0,children:U8[t]},t)),(0,H.jsx)(Je.Divider,{}),(0,H.jsx)(Je.Label,{children:`Absolute (your time zone)`}),(0,H.jsxs)(y,{gap:6,px:`xs`,pb:`xs`,wrap:`nowrap`,children:[(0,H.jsx)(je,{type:`datetime-local`,size:`xs`,"aria-label":`From`,value:g,onChange:e=>_(e.currentTarget.value)}),(0,H.jsx)(je,{type:`datetime-local`,size:`xs`,"aria-label":`To`,value:v,onChange:e=>b(e.currentTarget.value)})]}),(0,H.jsx)(y,{px:`xs`,pb:`xs`,justify:`flex-end`,children:(0,H.jsx)(C,{size:`compact-sm`,disabled:!g||!v||g>=v,onClick:()=>{s(new Date(g).toISOString(),new Date(v).toISOString()),S(!1)},children:`Apply range`})})]})]}),(0,H.jsx)(me,{label:`Zoom out`,children:(0,H.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Zoom out`,onClick:c,children:(0,H.jsx)(Ui,{size:15})})}),(0,H.jsxs)(y,{"data-refresh-controls":!0,gap:4,wrap:`nowrap`,children:[(0,H.jsx)(me,{label:a?`Updated ${ge(a)}`:`Refresh now`,children:(0,H.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Refresh now`,loading:i,onClick:u,children:(0,H.jsx)(xi,{size:15})})}),(0,H.jsx)(Hr,{size:`xs`,"aria-label":`Auto refresh`,value:t,onChange:l,data:At.map(e=>({value:e,label:e===`off`?`Off`:e}))})]}),(0,H.jsx)(oi,{size:`sm`,label:`Compare with previous period`,checked:n,onChange:e=>d(e.currentTarget.checked)}),(0,H.jsx)(C,{variant:r?`filled`:`default`,size:`sm`,leftSection:(0,H.jsx)(Be,{size:15}),onClick:f,children:r?`Done`:`Edit layout`}),(0,H.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,H.jsx)(Ni,{size:15}),onClick:p,children:`History`}),m&&(0,H.jsx)(R4,{onClick:m}),a&&(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,visibleFrom:`md`,children:[`Updated `,new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}).format(a)]}),h&&(0,H.jsx)(T,{"data-range-paused":!0,size:`xs`,c:`dimmed`,role:`status`,children:`Paused while selecting`})]})}var K8=(e,t)=>!(t instanceof Me&&t.status<500)&&e<2,q8=(e,t)=>!(t instanceof Me&&t.code===`timeout`)&&K8(e,t),J8=e=>({panels:e.panels.map(({grid:e,...t})=>t),variables:e.variables,time:e.time,annotations:e.annotations});function Y8(e,t,n,r,i){return[`panels`,JSON.stringify([e,J8(t),n,r,i])]}function X8(e,t,n,r){return[`variables`,e,J8(t),n,r]}async function Z8(e,t){let n=await Ye(e,t),r=new Set(e.dashboard.panels.filter(e=>[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)).map(e=>e.id)),i=n.filter(e=>r.has(e.id)&&e.from_ms!==void 0&&e.to_ms!==void 0&&e.from_mse.from_ms)),o=Math.max(...i.map(e=>e.to_ms));try{return{results:n,annotations:await vt({from:new Date(a).toISOString(),to:new Date(o).toISOString()},t)}}catch(e){if(t?.aborted)throw e;return{results:n,annotation_error:e instanceof Error?e.message:`Annotations unavailable`}}}var Q8={off:!1,"10s":1e4,"30s":3e4,"1m":6e4,"5m":3e5},$8=0;function e5(e,t){let[n,r]=e.queryKey;if(n!==`panels`||typeof r!=`string`)return!1;try{return JSON.parse(r)[0]===t}catch{return!1}}function t5({dashboardId:e,spec:t,time:n,vars:r,compare:i,widths:a,visible:o,refresh:s,enabled:c=!0}){let l=(0,V.useMemo)(()=>Object.fromEntries(Object.entries(a).map(([e,t])=>[e,Math.max(100,Math.round(t/100)*100)])),[a]),u=Y8(e,t,n,r,i),d=u[1],f=o.filter(e=>t.panels.some(t=>t.id===e)),p=(0,V.useRef)([]),m=(0,V.useRef)(void 0),h=(0,V.useRef)(null),g=(0,V.useRef)(!1),_=(0,V.useRef)(null),v=(0,V.useRef)({key:d,ids:new Set}),[y,b]=(0,V.useState)({key:d}),[x,S]=(0,V.useState)({key:d,results:new Map,updated:new Map,stale:new Set,receivedAt:0}),C=f.length===0&&x.key===d&&x.receivedAt>0,w=c&&t.panels.some(e=>e.viz!==`text`),T=ot({queryKey:u,queryFn:({signal:e})=>{if(C&&h.current?.key!==d)return p.current=[],Promise.resolve({results:[],hasTimePanels:!1,batch:++$8});let a=h.current?.key===d?h.current.ids:f;p.current=(a.length?[...a]:t.panels.map(e=>e.id)).sort(),v.current.key!==d&&(v.current={key:d,ids:new Set});for(let e of p.current)v.current.ids.add(e);let o=[...p.current];return Z8({dashboard:t,panels:o,time:n,vars:r,widths:l,compare:i},e).then(e=>{let n=new Set(e.results.map(e=>e.id)),r=o.filter(e=>!n.has(e)&&t.panels.find(t=>t.id===e)?.viz!==`text`).map(e=>({id:e,status:`error`,elapsed_ms:0,error:`No result was returned for this panel; refresh to retry.`,request_error:o}));return{...e,batch:++$8,results:[...e.results.map(e=>W4(e,o)),...r],hasTimePanels:t.panels.some(e=>o.includes(e.id)&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz))}}).catch(n=>{throw e.aborted||(m.current={key:d,ids:o.filter(e=>t.panels.find(t=>t.id===e)?.viz!==`text`),error:n instanceof Error?n.message:String(n),retryable:!(n instanceof Me)||n.status===408||n.status===429||n.status>=500}),n})},retry:q8,enabled:w,refetchInterval:C?!1:Q8[s]??3e4,staleTime:5e3,placeholderData:e=>e}),E=T.error&&m.current?.key===d?m.current:void 0,D=(0,V.useMemo)(()=>n5(x,d,T.isPlaceholderData?void 0:T.data?.results,T.dataUpdatedAt,T.data?.batch,E),[x,d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]),O=D.results,k=T.isPlaceholderData?void 0:T.data?.hasTimePanels?T.data:y.key===d?y:void 0;(0,V.useEffect)(()=>{!T.isPlaceholderData&&T.data?.hasTimePanels&&b({key:d,annotations:T.data.annotations,annotation_error:T.data.annotation_error})},[d,T.data,T.isPlaceholderData]),(0,V.useEffect)(()=>{T.isPlaceholderData||S(e=>n5(e,d,T.data?.results,T.dataUpdatedAt,T.data?.batch,E))},[d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]);let A=new Map([...D.stale].flatMap(e=>{let t=D.updated.get(e);return t?[[e,t]]:[]})),j=(T.data?.results??[]).find(e=>e.status===`error`&&D.stale.has(e.id));(0,V.useEffect)(()=>{if(!w||T.isFetching||g.current||_.current?.key===d||h.current?.key===d)return;let e=v.current.key===d?v.current.ids:new Set,n=[...new Set(f.filter(n=>!O.has(n)&&!e.has(n)&&t.panels.find(e=>e.id===n)?.viz!==`text`))].sort();if(!n.length)return;let r={key:d,ids:n};h.current=r,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===r&&(h.current=null)})},[o,w,d,T.isFetching,T.error,T.refetch,O,t.panels]),(0,V.useEffect)(()=>{!T.isFetching&&_.current?.key!==d&&g.current&&(g.current=!1,h.current=null,w&&!C&&T.refetch({cancelRefetch:!1}))},[T.isFetching,d,w,C,T.refetch]);let M=e=>{let t={key:d,ids:e};h.current=t,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===t&&(h.current=null)})};return(0,V.useEffect)(()=>{if(T.isFetching||!_.current)return;let e=_.current;if(_.current=null,e.key!==d||!w)return;let n=[...e.ids].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();n.length&&M(n)},[T.isFetching,d,w,O,t.panels]),{retry:e=>{if(!w)return;let n=e?O.get(e)?.request_error??[]:[...O.values()].flatMap(e=>e.request_error??[]),r=[...new Set(n)].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();if(r.length){if(T.isFetching){_.current?.key!==d&&(_.current={key:d,ids:new Set});for(let e of r)_.current.ids.add(e);return}M(r)}},results:O,staleAt:A,annotations:k?.annotations,annotationError:k?.annotation_error,fetchingIds:T.isFetching?p.current:[],fetching:T.isFetching,error:T.error??(j?Error(j.error??`Panel refresh failed`):null),updatedAt:T.isPlaceholderData?null:T.dataUpdatedAt||null,refetch:()=>{if(w&&!C){if(T.isFetching){h.current?.key===d&&(g.current=!0);return}T.refetch({cancelRefetch:!1})}}}}function n5(e,t,n,r,i,a){let o=e.key===t?{key:t,results:new Map(e.results),updated:new Map(e.updated),stale:new Set(e.stale),receivedAt:e.receivedAt,receivedBatch:e.receivedBatch}:{key:t,results:new Map,updated:new Map,stale:new Set,receivedAt:0};for(let e of n&&i!==o.receivedBatch?n:[])e.status===`error`&&o.results.get(e.id)?.frame?(o.stale.add(e.id),o.results.set(e.id,{...o.results.get(e.id),error:e.error,request_error:e.request_error})):(o.results.set(e.id,e),o.updated.set(e.id,r),o.stale.delete(e.id));n&&(o.receivedAt=r,o.receivedBatch=i);for(let e of a?.ids??[]){let t=o.results.get(e);t?.frame?(o.stale.add(e),o.results.set(e,{...t,error:a.error,request_error:a.retryable?a.ids:void 0})):o.results.set(e,{id:e,status:`error`,elapsed_ms:0,error:a.error,request_error:a.retryable?a.ids:void 0})}return o}function r5(e,t){return e.queryKey[0]===`variables`&&e.queryKey[1]===t}function i5(e,t,n,r,i,a=!1){let o=!!t.variables?.some(e=>e.kind===`query`),s=ot({queryKey:X8(e,t,n,r),queryFn:async({signal:e})=>{let a=await i({dashboard:t,time:n,vars:r},e);return Object.fromEntries((t.variables??[]).map(e=>[e.name,a[e.name]??(e.kind===`custom`?e.options?.map(e=>({value:e})):void 0)??[]]))},enabled:o,retry:a,staleTime:6e4,placeholderData:e=>e}),c=s.isPlaceholderData?void 0:s.data,l=s.isError||(t.variables??[]).every(e=>e.kind!==`query`||r[e.name]!==void 0&&r[e.name]!==`$__all`&&(e.multi||!Array.isArray(r[e.name])||r[e.name].length>0)||!!e.default||e.include_all||c?.[e.name]!==void 0);return{...s,currentData:c,ready:l}}function a5(e){return t=>e5(t,e)||r5(t,`dashboard-${e}`)}function o5({id:e,currentVersion:t,opened:n,onClose:r,onRestored:i}){let a=et(),[o,s]=(0,V.useState)(),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(n),m=(0,V.useRef)(0),h=(0,V.useRef)(n);h.current=n;let g=(0,V.useRef)(!1),_=(0,V.useRef)(!1),v=(0,V.useRef)(i);v.current=i,(0,V.useEffect)(()=>(_.current=!0,()=>{_.current=!1}),[]);let y=De({mutationFn:({version:t})=>He(e,t),retry:!1,onSuccess:(t,{version:n,generation:r})=>{a.cancelQueries({queryKey:[`dashboard`,e],exact:!0}),a.cancelQueries({predicate:a5(e)}),a.cancelQueries({queryKey:[`exemplars`]}),a.cancelQueries({queryKey:[`drill-trace`]}),a.setQueryData([`dashboard`,e],t),a.invalidateQueries({predicate:a5(e),refetchType:`none`}),_.current&&(h.current&&r===m.current&&l(`Restored v${n} as v${t.version}`),v.current(t)),a.invalidateQueries({queryKey:Pe}),a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}),a.invalidateQueries({queryKey:[`exemplars`],refetchType:`none`}),a.invalidateQueries({queryKey:[`drill-trace`],refetchType:`none`})},onError:t=>{t instanceof Me&&t.code===`dashboard_version_not_found`&&a.invalidateQueries({queryKey:[`dashboard-versions`,e]})},onSettled:()=>{g.current=!1,_.current&&d(!1)}}),b=()=>{m.current++,y.reset(),l(``)};(0,V.useEffect)(()=>{if(n){p(!0);return}m.current++,y.reset(),l(``),a.cancelQueries({queryKey:[`dashboard-versions`,e]}),a.cancelQueries({queryKey:[`dashboard-version`,e]})},[n,e,a,y.reset]);let x=(0,V.useRef)(t);return(0,V.useEffect)(()=>{x.current!==t&&(x.current=t,a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}))},[t,e,a]),(0,H.jsx)($e,{opened:n,onClose:()=>{b(),r()},onExitTransitionEnd:()=>p(!1),title:`Version history`,position:`right`,size:`xl`,children:(n||f)&&(0,H.jsx)(s5,{id:e,opened:n,currentVersion:t,selected:o,onSelect:e=>{b(),s(e)},pending:u,error:y.error,failedVersion:y.variables?.version,success:c,onRestore:e=>{g.current||(g.current=!0,d(!0),l(``),y.mutate({version:e,generation:m.current}))}})})}function s5({id:e,opened:t,currentVersion:n,selected:r,onSelect:i,pending:a,error:s,failedVersion:c,success:l,onRestore:u}){let d=ot({queryKey:[`dashboard-versions`,e],queryFn:({signal:t})=>bt(e,t),enabled:t,retry:!1}),f=r??d.data?.[0]?.version,p=ot({queryKey:[`dashboard-version`,e,f],queryFn:({signal:t})=>Fe(e,f,t),enabled:t&&f!==void 0,retry:!1});return(0,H.jsxs)(S,{gap:`md`,"data-version-history":!0,children:[(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:`Inspect saved specs and changes. Restoring adds a new version.`}),l&&(0,H.jsx)(ee,{color:`ok`,role:`status`,children:l}),s&&c===f&&(0,H.jsx)(d5,{error:s,version:f}),(0,H.jsxs)(o,{mih:160,children:[d.isPending&&(0,H.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{size:`sm`,children:`Loading history…`})]}),d.error&&(0,H.jsxs)(ee,{color:`bad`,title:`History unavailable`,children:[d.error.message,(0,H.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void d.refetch(),children:`Retry history`})]}),d.data?.length===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No versions available.`}),!!d.data?.length&&(0,H.jsx)(pe,{h:200,type:`auto`,children:(0,H.jsx)(S,{gap:`xs`,pr:`sm`,role:`list`,"aria-label":`Saved versions`,children:d.data.map(e=>(0,H.jsxs)(B,{role:`listitem`,withBorder:!0,p:`xs`,radius:`sm`,style:{borderColor:f===e.version?`var(--mantine-color-brand-filled)`:void 0},children:[(0,H.jsxs)(y,{justify:`space-between`,gap:`xs`,children:[(0,H.jsxs)(C,{variant:f===e.version?`light`:`subtle`,size:`compact-sm`,"aria-pressed":f===e.version,onClick:()=>i(e.version),children:[`Version `,e.version]}),e.version===n&&(0,H.jsx)(Ue,{color:`gray`,variant:`light`,tt:`none`,children:`Current`}),(0,H.jsx)(l5,{at:e.created_at})]}),(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,mt:4,children:[c5(e),` · `,e.message||`No edit message`]})]},e.version))})})]}),(0,H.jsx)(Ve,{role:`status`,"aria-live":`polite`,children:f===void 0?`Select a version.`:p.isFetching?`Loading version ${f}…`:p.error?`Version ${f} unavailable.`:`Version ${f} ready.`}),(0,H.jsxs)(o,{mih:280,"aria-busy":p.isFetching,children:[f!==void 0&&p.isPending&&(0,H.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{size:`sm`,children:`Loading version…`})]}),p.error&&(0,H.jsxs)(ee,{color:`bad`,title:p.error instanceof Me&&p.error.code===`dashboard_version_not_found`?`This version is no longer available`:`Version unavailable`,children:[p.error.message,(0,H.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void p.refetch(),children:`Retry version`})]}),p.data&&!p.error&&(0,H.jsx)(u5,{record:p.data,currentVersion:n,pending:a,onRestore:()=>u(p.data.dashboard.version)})]})]})}function c5(e){return e.author_kind===`agent`?`Agent`:e.author_kind===`user`?`You`:`System`}function l5({at:e}){let t=(Date.parse(e)-Date.now())/1e3,[n,r]=Math.abs(t)<60?[1,`second`]:Math.abs(t)<3600?[60,`minute`]:Math.abs(t)<86400?[3600,`hour`]:[86400,`day`];return(0,H.jsx)(T,{component:`time`,dateTime:e,title:ge(e),size:`xs`,c:`dimmed`,children:new Intl.RelativeTimeFormat(void 0,{numeric:`auto`}).format(Math.round(t/n),r)})}function u5({record:e,currentVersion:t,pending:n,onRestore:r}){let{dashboard:i}=e,a=ce(e);return(0,H.jsxs)(S,{gap:`sm`,"data-history-version":i.version,children:[(0,H.jsxs)(y,{justify:`space-between`,align:`flex-start`,children:[(0,H.jsxs)(o,{miw:0,children:[(0,H.jsxs)(I,{order:2,fz:`lg`,children:[i.name,` · v`,i.version]}),(0,H.jsxs)(T,{size:`sm`,c:`dimmed`,children:[c5(e),` · `,e.message||`No edit message`]}),(0,H.jsx)(l5,{at:e.created_at})]}),i.version===t?(0,H.jsx)(C,{size:`sm`,variant:`default`,disabled:!0,children:`Current version`}):(0,H.jsxs)(C,{size:`sm`,disabled:n,loading:n,onClick:r,children:[`Restore version `,i.version]})]}),i.description&&(0,H.jsx)(T,{size:`sm`,children:i.description}),e.changes_available?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Te,{labels:a}),!a.length&&!e.layout_changed&&(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:`No authored changes.`})]}):(0,H.jsx)(ee,{color:`warn`,title:`Changes unavailable`,children:`The preceding version is no longer retained. This saved spec is still available.`}),(0,H.jsxs)(T,{size:`sm`,c:`dimmed`,children:[`Read-only · `,i.spec.panels.length,` panels. Historical data is not queried.`]}),(0,H.jsxs)(pn,{variant:`contained`,children:[(0,H.jsxs)(pn.Item,{value:`spec`,children:[(0,H.jsx)(pn.Control,{children:`Spec`}),(0,H.jsx)(pn.Panel,{children:(0,H.jsx)(Re,{block:!0,tabIndex:0,style:{maxHeight:320,overflow:`auto`},children:JSON.stringify(i.spec,null,2)})})]}),(0,H.jsxs)(pn.Item,{value:`data`,children:[(0,H.jsx)(pn.Control,{children:`Data`}),(0,H.jsx)(pn.Panel,{children:(0,H.jsx)(S,{gap:`xs`,children:i.spec.panels.map(e=>(0,H.jsxs)(o,{children:[(0,H.jsxs)(T,{size:`sm`,fw:500,children:[e.title,` · `,e.viz]}),(0,H.jsx)(Re,{block:!0,tabIndex:0,children:e.content??e.sql??JSON.stringify(e.query??{},null,2)})]},e.id))})})]})]})]})}function d5({error:e,version:t}){let n=e instanceof Me?e.code:void 0,r=!(e instanceof Me)||e.status>=500?`Try again with the restore button.`:n===`invalid_spec`?`This saved spec is invalid. Review the fields below and choose another version.`:n===`dashboard_version_not_found`?`Reload history and choose a retained version.`:[`already_current`,`dashboard_version_conflict`,`conflict`].includes(n??``)?`This dashboard changed or its name conflicts. Reload history and choose another version.`:`Check your access and reload history.`;return(0,H.jsxs)(ee,{color:`bad`,title:`Restore of version ${t} failed`,children:[(0,H.jsx)(T,{size:`sm`,children:e.message}),e instanceof Me&&e.problems.length>0&&(0,H.jsx)(`ul`,{children:e.problems.map((e,t)=>(0,H.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))}),(0,H.jsx)(T,{size:`sm`,mt:`xs`,children:r})]})}function f5(e,t){let n=JSON.stringify([e.range,e.from,e.to]),r=(0,V.useRef)({search:e,onSearch:t,scope:n}),i=(0,V.useRef)(``),a=(0,V.useRef)(void 0),[o,s]=(0,V.useState)(!1);r.current.scope!==n&&(i.current!==`${e.from}/${e.to}`&&(a.current=void 0,o&&s(!1)),i.current=``),r.current={search:e,onSearch:t,scope:n};let c=(0,V.useCallback)(()=>{i.current=``,a.current=void 0,s(!1)},[]),l=(0,V.useCallback)(()=>{if(!a.current)return;let e=a.current;c(),r.current.onSearch({...r.current.search,...e},!1)},[c]);return{zoom:(0,V.useCallback)((e,t)=>{let n=la(e,t);if(!n)return;let o=r.current,c=`${n.from}/${n.to}`;o.search.from===n.from&&o.search.to===n.to||i.current===c||(a.current??={range:o.search.range,from:o.search.from,to:o.search.to},s(!0),i.current=c,o.onSearch({...o.search,range:void 0,...n},!1))},[]),reset:c,resetZoom:l,zoomed:o}}function p5({variables:e,vars:t,options:n,onChange:r}){return e.length===0?null:(0,H.jsx)(y,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard variables`,children:e.map(e=>{let i=Ji(e,t,n[e.name]),a=[...e.include_all?[{value:qi,label:`All`}]:[],...(n[e.name]??e.options?.map(e=>({value:e}))??[]).map(e=>({value:e.value,label:e.value}))],o=(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,ff:`monospace`,children:[`$`,e.name]});return e.kind===`constant`?(0,H.jsx)(je,{label:o,size:`xs`,value:e.value,readOnly:!0,w:160},e.name):e.kind===`text`?(0,H.jsx)(je,{label:o,size:`xs`,w:200,defaultValue:typeof i==`string`?i:``,onBlur:t=>r(e.name,t.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}},`${e.name}:${JSON.stringify(i)}`):e.multi?(0,H.jsx)(kr,{label:o,size:`xs`,w:260,searchable:!0,clearable:!0,data:a.filter(e=>e.value!==qi),value:Array.isArray(i)?i:i&&i!==`$__all`?[i]:[],placeholder:e.include_all?`All`:`None`,onChange:t=>r(e.name,t.length?t:e.include_all?qi:[])},e.name):(0,H.jsx)(Wr,{label:o,size:`xs`,w:220,searchable:!0,allowDeselect:!1,data:a,value:Array.isArray(i)?i[0]??null:i||null,onChange:t=>t!==null&&r(e.name,t)},e.name)})})}function m5(e,t,n=!1){let r=e.target;return t||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey&&e.key!==`?`||r instanceof Element&&r.closest(`input,textarea,select,[contenteditable]:not([contenteditable="false"]),[role="textbox"],[role="menu"]`)||r instanceof Element&&r.closest(`[role="dialog"]`)&&!(n&&r.closest(`[data-panel-fullscreen]`))?null:[`r`,`e`,`h`,`f`,`?`].includes(e.key)?e.key:null}function h5(e,t,n={}){let r=(0,V.useRef)({actions:t,options:n});r.current={actions:t,options:n},(0,V.useEffect)(()=>{let t=t=>{let n=e.current,i=t.target,{actions:a,options:o}=r.current;if(!n||!(i instanceof Element)||o.enabled===!1)return;let s=o.fullscreenScope?[...document.querySelectorAll(`[data-shortcut-scope]`)].find(e=>e.dataset.shortcutScope===o.fullscreenScope&&e.hasAttribute(`data-panel-fullscreen`)):void 0,c=n.contains(i)&&n.contains(document.activeElement),l=i===document.body&&document.activeElement===document.body,u=s?.contains(i)&&s.contains(document.activeElement);if(!c&&!l&&!u)return;let d=m5(t,!!(o.modalOpen||[...document.querySelectorAll(`[role="dialog"]`)].some(e=>e!==s)),!!s);if(!d||s&&![`r`,`f`,`?`].includes(d))return;let f=a[d];f&&(t.preventDefault(),f(i))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e])}function g5({opened:e,onClose:t,fullscreen:n=!1,enabled:r,onEnabled:i}){let a=[[`r`,`Refresh now`],...n?[]:[[`e`,`Toggle layout mode`],[`h`,`Open history`]],[`f`,n?`Exit full-screen`:`Open the focused panel in full-screen`],[`?`,`Open keyboard shortcuts`],[`Escape`,`Cancel a range, then leave the chart or close full-screen`]];return(0,H.jsx)(yt,{opened:e,onClose:t,title:`Keyboard shortcuts`,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,children:(0,H.jsxs)(S,{gap:`xs`,children:[(0,H.jsx)(oi,{label:`Single-key shortcuts`,checked:r,onChange:e=>i(e.currentTarget.checked)}),a.map(([e,t])=>(0,H.jsxs)(y,{gap:`sm`,children:[(0,H.jsx)(Xe,{children:e}),(0,H.jsx)(T,{size:`sm`,children:t})]},e)),!n&&(0,H.jsx)(T,{size:`sm`,children:`Focus a chart or a panel control before pressing f. Without a focused panel, f does nothing.`}),(0,H.jsx)(T,{size:`sm`,children:`Tab directly to a chart. Left/Right moves between points; Up/Down changes series at the same time or category. Home/End jumps to the first/last point. Enter drills or applies the panel filter. Comparison and Other values can be read even when selection is unavailable.`}),(0,H.jsx)(T,{size:`sm`,children:`On time charts, Shift+Left/Right extends a range and pauses auto-refresh. Review the shaded range and compact UTC label, then choose Zoom to range. Use the time picker after zooming for precise edits. Escape or Cancel cancels it and resumes refresh. The next Escape leaves the chart or closes full-screen. Reset zoom, Zoom out and browser Back preserve comparison and filters.`}),(0,H.jsxs)(T,{size:`sm`,children:[n?`In full-screen, r refreshes, f exits and ? opens help; e and h are inactive.`:`Shortcuts work in the dashboard.`,` Typing, menus and other dialogs or drawers pause shortcuts. Modifier shortcuts keep their browser behavior. Turning off single-key shortcuts keeps chart navigation and visible controls available.`]}),(0,H.jsx)(T,{size:`sm`,children:`The global / shortcut focuses the chat composer.`})]})})}function _5(e){let t=`fanout:single-key-shortcuts:`+e,n=()=>{try{return localStorage.getItem(t)!==`off`}catch{return!0}},[r,i]=(0,V.useState)(n);return(0,V.useEffect)(()=>{i(n())},[t]),(0,V.useEffect)(()=>{let e=e=>{e.key===t&&i(n())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[t]),{enabled:r,change:e=>{i(e);try{localStorage.setItem(t,e?`on`:`off`)}catch{}}}}function v5(e){let t=(0,V.useRef)(void 0),n=t=>[...e.current?.querySelectorAll(`[data-panel]`)??[]].find(e=>e.dataset.panel===t&&!e.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`));return(0,V.useEffect)(()=>{t.current&&!n(t.current.panel)&&(t.current=void 0)}),{remember(n){t.current=void 0;let r=document.activeElement;if(!(r instanceof HTMLElement)||!e.current?.contains(r)||r.closest(`[data-panel]`)?.dataset.panel!==n)return;let i=r.getAttribute(`data-panel-view`),a=r.getAttribute(`aria-label`),o=r.hasAttribute(`data-chart-plot`)?`[data-chart-plot]`:i?`[data-panel-view=${JSON.stringify(i)}]`:a?`[aria-label=${JSON.stringify(a)}]`:void 0;t.current={element:r,panel:n,selector:o}},restore(e){let r=t.current;if(t.current=void 0,r&&(e===void 0||r.panel===e)&&n(r.panel))return r.element.isConnected&&!r.element.closest(`[hidden]`)?r.element:r.selector?n(r.panel)?.querySelector(r.selector)??void 0:void 0}}}var y5={exemplars:qe,trace:Ie},b5={"5m":`15m`,"15m":`1h`,"1h":`3h`,"3h":`6h`,"6h":`12h`,"12h":`24h`,"24h":`2d`,"2d":`7d`,"7d":`30d`,"30d":`30d`};function x5({dashboardId:e,search:t,onSearch:n,onOpen:r}){let{agentAvailable:i,openChat:a}=se(),o=ot({queryKey:Pe,queryFn:Ze,staleTime:15e3});(0,V.useEffect)(()=>{!e&&o.data?.length&&r((o.data.find(e=>e.is_default)??o.data[0]).id,!0)},[e,o.data]);let s=ot({queryKey:[`dashboard`,e],queryFn:({signal:t})=>jt(e,t),enabled:!!e,retry:(e,t)=>!(t instanceof Me&&t.code===`not_found`)&&e<2});return!e&&o.error?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsx)(ee,{color:`bad`,title:`Dashboards could not be loaded`,children:o.error.message})}):!e&&o.data?.length===0?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,H.jsx)(I,{order:1,fz:24,children:`No dashboards yet`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`Create a dashboard to explore your services.`}),i&&(0,H.jsx)(C,{mt:`sm`,size:`sm`,onClick:()=>a(`Build me a dashboard for my services, showing request volume, latency, and errors. Ask me which services to monitor first.`),children:`Create with AI`})]})}):!e||s.isLoading?(0,H.jsxs)(ie,{mih:`50vh`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading your dashboard…`})]}):s.error instanceof Me&&s.error.code===`not_found`?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,H.jsx)(I,{order:1,fz:24,children:`This dashboard isn't here`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`The link may be out of date, or the dashboard may have been deleted.`}),o.data?.length?(0,H.jsx)(C,{mt:`sm`,variant:`default`,size:`sm`,onClick:()=>r((o.data.find(e=>e.is_default)??o.data[0]).id,!0),children:`Open your default dashboard`}):null]})}):s.error||!s.data?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsx)(T,{c:`dimmed`,size:`sm`,children:`Your dashboard is unavailable. Try refreshing.`})}):(0,H.jsx)(S5,{id:s.data.id,version:s.data.version,spec:s.data.spec,search:t,onSearch:n,agentAvailable:i,openChat:a},s.data.id)}function S5({id:e,version:t,spec:n,search:r,onSearch:i,agentAvailable:a,openChat:s}){let[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(!1),f=(0,V.useRef)(null),p=(0,V.useId)(),m=_5(tt().id),h=v5(f),[g,_]=(0,V.useState)(()=>new Set),v=(0,V.useCallback)((e,t)=>_(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r}),[]),b=et(),[x,w]=(0,V.useState)(),{zoom:E,reset:D,resetZoom:O,zoomed:k}=f5(r,i),A=gt(n,r),[j,M]=(0,V.useState)(A.refresh??`30s`),N=r.compare?r.compare===`1`:n.time.compare===`previous_period`,P=r.vars??{},F=i5(`dashboard-${e}`,n,A,P,Le,K8),L=(0,V.useMemo)(()=>Xi(n.variables,P,F.currentData),[n.variables,P,F.currentData]),[R,te]=(0,V.useState)(()=>window.innerWidth);(0,V.useEffect)(()=>{let e=0,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>te(window.innerWidth),300)};return window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t),window.clearTimeout(e)}},[]);let ne=(0,V.useMemo)(()=>{let e=Math.max(320,Math.min(R-64,1600));return Object.fromEntries(n.panels.map(t=>[t.id,e/12*(t.grid?.w??t.width??6)]))},[R,n]),[re,ie]=(0,V.useState)(()=>n.panels.map(e=>e.id)),z=t5({dashboardId:e,version:t,spec:n,time:A,vars:L,compare:N,widths:ne,visible:(0,V.useMemo)(()=>re.filter(e=>n.panels.some(t=>t.id===e)),[re,n.panels]),refresh:g.size?`off`:j,enabled:F.ready});(0,V.useEffect)(()=>{x===t&&b.refetchQueries({predicate:a5(e),type:`active`,stale:!0},{cancelRefetch:!1})},[x,t,e,b]);let ae=(0,V.useMemo)(()=>z.annotations?{...z.annotations,deploys:n.annotations?.deploys===!1?[]:z.annotations.deploys,anomalies:n.annotations?.anomalies===!1?[]:z.annotations.anomalies}:void 0,[z.annotations,n.annotations?.deploys,n.annotations?.anomalies]),B=F.error??z.error,oe=(e,t)=>{let n={...P};t===void 0?delete n[e]:n[e]=t,i({...r,vars:n},!0)},se=()=>i({...r,edit:r.edit===`1`?void 0:`1`}),ce=e=>{e&&h.remember(e),i({...r,view:e},e===void 0)};return h5(f,{r:()=>z.refetch(),e:se,h:()=>l(!0),"?":()=>d(!0),f:e=>{if(r.view){ce();return}let t=e.closest(`[data-panel]`)?.dataset.panel;t&&n.panels.some(e=>e.id===t)&&ce(t)}},{modalOpen:c||u||!!r.drill,fullscreenScope:r.view?p:void 0,enabled:m.enabled}),(0,H.jsxs)(o,{component:`main`,ref:f,"aria-label":`Dashboard`,maw:1600,mx:`auto`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:[(0,H.jsxs)(S,{gap:`sm`,mb:`md`,children:[(0,H.jsxs)(y,{justify:`space-between`,align:`flex-start`,wrap:`wrap`,gap:`sm`,children:[(0,H.jsxs)(o,{miw:0,children:[(0,H.jsx)(I,{order:1,fz:28,lts:`-0.02em`,children:n.name}),n.description&&(0,H.jsx)(T,{c:`dimmed`,size:`sm`,mt:2,children:n.description})]}),(0,H.jsx)(G8,{selecting:g.size>0,time:A,refresh:j,compare:N,editing:r.edit===`1`,fetching:z.fetching,updatedAt:z.updatedAt,onRange:e=>{D(),i({...r,range:e,from:void 0,to:void 0})},onAbsolute:(e,t)=>{D(),i({...r,range:void 0,from:e,to:t})},onZoomOut:()=>{if(A.from&&A.to){let e=Date.parse(A.from),t=Date.parse(A.to),n=(t-e)/2;i({...r,range:void 0,from:new Date(e-n).toISOString(),to:new Date(t+n).toISOString()})}else i({...r,range:b5[A.range??`1h`]??`1h`,from:void 0,to:void 0})},onRefresh:M,onRefreshNow:z.refetch,onCompare:e=>i({...r,compare:e?`1`:`0`},!0),onEdit:se,onHistory:()=>l(!0),onShortcuts:()=>d(!0)})]}),(0,H.jsx)(p5,{variables:n.variables??[],vars:P,options:F.data??{},onChange:oe}),Object.entries(P).filter(([,e])=>e!==`$__all`).length>0&&(0,H.jsx)(y,{gap:6,children:Object.entries(P).filter(([,e])=>e!==`$__all`).map(([e,t])=>(0,H.jsxs)(C,{size:`compact-xs`,variant:`light`,"aria-label":`$${e} = ${Array.isArray(t)?t.join(`, `):t} ×: remove filter`,onClick:()=>oe(e,void 0),children:[`$`,e,` = `,Array.isArray(t)?t.join(`, `):t,` ×`]},e))}),z.annotationError&&(0,H.jsx)(ee,{color:`warn`,title:`Annotations unavailable`,children:z.annotationError}),z.annotations?.truncated&&(0,H.jsx)(T,{size:`xs`,c:`warn`,role:`status`,children:`Annotation history is limited.`})]}),B&&(0,H.jsxs)(ee,{color:`bad`,icon:(0,H.jsx)(ke,{size:18,weight:`fill`}),mb:`md`,title:F.error?`Variables could not be loaded`:`Panels could not be loaded`,children:[B.message,B instanceof Me&&(0,H.jsx)(`ul`,{children:B.problems.map((e,t)=>(0,H.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))})]}),(0,H.jsx)(N8,{dashboardId:e,version:t,spec:n,vars:L,results:z.results,annotations:ae,fetching:z.fetching,fetchingIds:z.fetchingIds,staleAt:z.staleAt,time:{...A,compare:N?`previous_period`:void 0},onEditExit:()=>i({...r,edit:void 0}),editing:r.edit===`1`,view:r.view,canManage:!0,agentAvailable:a,onOpenChat:s,onRetry:z.retry,onVariable:oe,onZoom:E,zoomed:k,onZoomReset:O,onView:ce,onRangePending:v,shortcutScope:p,onShortcuts:()=>d(!0),overlayOpen:c||u||!!r.drill,returnViewFocus:h.restore,onVisible:ie,onPoint:(e,t)=>{let n=S8(e,z.results.get(e.id),t,P);n&&i({...r,vars:n.vars,drill:JSON.stringify(n.target)},!1)}}),(0,H.jsx)(H8,{client:y5,spec:n,time:A,vars:L,target:Mt(r.drill),onChange:e=>i({...r,drill:e?JSON.stringify(e):void 0},!1)}),(0,H.jsx)(o5,{id:e,currentVersion:t,opened:c,onClose:()=>l(!1),onRestored:e=>{w(e.version);let t=new Set(e.spec.panels.map(e=>e.id)),n=Mt(r.drill),a=r.view&&!t.has(r.view)?void 0:r.view,o=n&&!t.has(n.panel_id)?void 0:r.drill;(a!==r.view||o!==r.drill)&&i({...r,view:a,drill:o},!0)}}),(0,H.jsx)(g5,{opened:u,onClose:()=>d(!1),fullscreen:!!r.view,enabled:m.enabled,onEnabled:m.change})]})}export{Yi as i,W4 as n,V4 as r,x5 as t}; \ No newline at end of file +`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&se(e.body,`react-draggable-transparent-selection`)}function B(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{oe(e)}):oe(e)}function oe(e){if(e)try{e.body&&ce(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function se(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function ce(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function le(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:ge(r);let i=_e(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+S(s.paddingLeft)+S(o.marginLeft),top:-i.offsetTop+S(s.paddingTop)+S(o.marginTop),right:L(a)-F(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:I(a)-P(i)-i.offsetTop+S(s.paddingBottom)-S(o.marginBottom)}}return x(r.right)&&(t=Math.min(t,r.right)),x(r.bottom)&&(n=Math.min(n,r.bottom)),x(r.left)&&(t=Math.max(t,r.left)),x(r.top)&&(n=Math.max(n,r.top)),[t,n]}function ue(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function de(e){return e.props.axis===`both`||e.props.axis===`x`}function fe(e){return e.props.axis===`both`||e.props.axis===`y`}function pe(e,t,n){let r=typeof t==`number`?re(e,t):null;if(typeof t==`number`&&!r)return null;let i=_e(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return ee(r||e,a,n.props.scale)}function me(e,t,n){let r=!x(e.lastX),i=_e(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function he(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function ge(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function _e(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var ve=d(t()),ye=d(e6()),be=d(b()),xe=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Se={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Ce=Se.mouse,we=class extends ve.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!j(e.target,this.props.handle,t)||this.props.cancel&&j(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ie(e);this.touchIdentifier=r;let i=pe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=me(this,a,o);xe(`DraggableCore: handleDragStart: %j`,s),xe(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&ae(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,M(n,Ce.move,this.handleDrag),M(n,Ce.stop,this.handleDragStop))},this.handleDrag=e=>{let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=ue(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(xe(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=ue(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&B(a.ownerDocument),xe(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(xe(`DraggableCore: Removing handlers`),N(a.ownerDocument,Ce.move,this.handleDrag),N(a.ownerDocument,Ce.stop,this.handleDragStop))},this.onMouseDown=e=>(Ce=Se.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Ce=Se.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Ce=Se.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Ce=Se.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&M(e,Se.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;N(t,Se.mouse.move,this.handleDrag),N(t,Se.touch.move,this.handleDrag),N(t,Se.mouse.stop,this.handleDragStop),N(t,Se.touch.stop,this.handleDragStop),N(e,Se.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&B(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=be.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(xe(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return ve.cloneElement(ve.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};we.displayName=`DraggableCore`,we.propTypes={allowAnyClick:ye.default.bool,allowMobileScroll:ye.default.bool,children:ye.default.node.isRequired,disabled:ye.default.bool,enableUserSelectHack:ye.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:ye.default.arrayOf(ye.default.number),handle:ye.default.string,cancel:ye.default.string,nodeRef:ye.default.object,nonce:ye.default.string,onStart:ye.default.func,onDrag:ye.default.func,onStop:ye.default.func,onMouseDown:ye.default.func,scale:ye.default.number,className:C,style:C,transform:C},we.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Te=class extends m.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(xe(`Draggable: onDragStart: %j`,t),this.props.onStart(e,he(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;xe(`Draggable: onDrag: %j`,t);let n=he(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=le(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,he(this,t))===!1)return!1;xe(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(xe(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=g.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,h=s||r,g={x:de(this)&&p?this.state.x:h.x,y:fe(this)&&p?this.state.y:h.y};this.state.isElementSVG?f=te(g,c):d=R(g,c);let v=m.Children.only(n),y=(0,_.clsx)(v.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return m.createElement(we,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},m.cloneElement(v,{className:y,style:{...v.props.style,...d},transform:f}))}};Te.displayName=`Draggable`,Te.propTypes={...we.propTypes,axis:h.default.oneOf([`both`,`x`,`y`,`none`]),bounds:h.default.oneOfType([h.default.shape({left:h.default.number,right:h.default.number,top:h.default.number,bottom:h.default.number}),h.default.string,h.default.oneOf([!1])]),defaultClassName:h.default.string,defaultClassNameDragging:h.default.string,defaultClassNameDragged:h.default.string,defaultPosition:h.default.shape({x:h.default.number,y:h.default.number}),positionOffset:h.default.shape({x:h.default.oneOfType([h.default.number,h.default.string]),y:h.default.oneOfType([h.default.number,h.default.string])}),position:h.default.shape({x:h.default.number,y:h.default.number}),className:C,style:C,transform:C},Te.defaultProps={...we.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(n.exports={DraggableCore:we})})),Y6=e(((e,t)=>{var n=J6(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),X6=e((e=>{e.__esModule=!0,e.cloneElement=l;var n=r(t());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t{e.__esModule=!0,e.resizableProps=void 0;var t=n(e6());Y6();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),Q6=e((e=>{e.__esModule=!0,e.default=void 0;var n=s(t()),r=Y6(),i=X6(),a=Z6(),o=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;tMath.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&(e!==`onResize`||v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,t){let r=this.props.handle;if(!r)return n.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:t});if(typeof r==`function`)return r(e,t);let i=typeof r.type==`string`,a=d({ref:t},i?{}:{handleAxis:e});return n.cloneElement(r,a)}render(){let e=this.props,t=e.children,a=e.className,s=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let u=e.resizeHandles;e.transformScale;let f=l(e,o);return(0,i.cloneElement)(t,d(d({},f),{},{className:(a?a+` `:``)+`react-resizable`,children:[...n.Children.toArray(t.props.children),...u.map(e=>{let t=this.handleRefs[e]??(this.handleRefs[e]=n.createRef());return n.createElement(r.DraggableCore,c({},s,{nodeRef:t,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,t))})]}))}};e.default=h,h.propTypes=a.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),$6=e((e=>{e.__esModule=!0,e.default=void 0;var n=c(t()),r=s(e6()),i=s(Q6()),a=Z6(),o=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(c=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,t=e.handle,r=e.handleSize;e.onResize;let a=e.onResizeStart,s=e.onResizeStop,c=e.draggableOpts,u=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,m=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=h(e,o);return n.createElement(i.default,{axis:m,draggableOpts:c,handle:t,handleSize:r,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:u,onResizeStart:a,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},n.createElement(`div`,l({},y,{style:d(d({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=d(d({},a.resizableProps),{},{children:r.default.element})})),e8=e(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Q6().default,t.exports.ResizableBox=$6().default}))(),t8=Z3(),n8=50,r8=12;function i8(e){let t=e;for(;t;){let e=window.getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function a8(e){let t=i8(e),n=null,r=0,i=0,a=!1;function o(){let e=t;if(!e)return;let s=e.getBoundingClientRect(),{clientHeight:c,scrollTop:l,scrollHeight:u}=e,{scrollLeft:d,scrollWidth:f,clientWidth:p}=e,m=0,h=0;i0?m=-r8:i>s.bottom-n8&&l+c0?h=-r8:r>s.right-n8&&d+p({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),ye=(0,V.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),be=(0,V.useCallback)(e=>({...ye,containerHeight:e??ye.containerHeight,layout:de.current}),[ye]),xe=(0,V.useMemo)(()=>I??{i:M,x:w,y:T,w:E,h:D,minW:O,maxW:k,minH:A,maxH:j},[I,M,w,T,E,D,O,k,A,j]),Se=(0,V.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(p)return v3(e);let t=y3(e);return m?{...t,left:b3(e.left/r),width:b3(e.width/r)}:t},[g,p,m,r]),Ce=(0,V.useCallback)((e,{node:t})=>{if(!ee)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/h,o=r.left/h,s=i.top/h,c=r.top/h,l;if(g?.calcDragPosition){let t=e;l=g.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(ce.current=l,_e.current||=a8(t instanceof HTMLElement?t:null),v>0){let t=e;he.current={x:t.clientX,y:t.clientY},me.current=!0,ge.current=!1,ae(!0);return}ae(!0);let u=Y4(ve,l.top,l.left),{x:d,y:f}=g3(F,xe,u.x,u.y,be());ee(M,d,f,{e,node:t,newPosition:l})},[ee,h,ve,g,v,F,xe,be,M]),we=(0,V.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!R||!z)return;let s=e;if(me.current&&!ge.current){let n=s.clientX-he.current.x,r=s.clientY-he.current.y;if(Math.hypot(n,r){if(!te||!z)return;_e.current?.stop(),_e.current=null;let n=me.current;if(me.current=!1,ge.current=!1,he.current={x:0,y:0},n){ae(!1),ce.current={left:0,top:0};return}let{left:r,top:i}=ce.current,a={top:i,left:r};ae(!1),ce.current={left:0,top:0};let o=Y4(ve,i,r),{x:s,y:c}=g3(F,xe,o.x,o.y,be());te(M,s,c,{e,node:t,newPosition:a})},[te,z,ve,F,xe,be,M]);fe.current=Ce,pe.current=we;let Ee=(0,V.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?ne:o===`onResize`?re:ie;if(!s)return;let c;c=t?A3(i,a,n,r):{...n,top:a.top,left:a.left},le.current=c;let l=t?.offsetParent?.clientHeight??0,u=X4(ve,c.width,c.height),{w:d,h:f}=_3(F,xe,u.w,u.h,i,be(l));s(M,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[ne,re,ie,r,ve,M,F,xe,be]),De=(0,V.useCallback)((e,t)=>{oe(!0);let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStart`)},[Ee,ve,w,T,E,D]),Oe=(0,V.useCallback)((e,t)=>{let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResize`)},[Ee,ve,w,T,E,D]),ke=(0,V.useCallback)((e,t)=>{oe(!1),le.current={top:0,left:0,width:0,height:0};let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStop`)},[Ee,ve,w,T,E,D]);(0,V.useEffect)(()=>{if(!y)return;let e=se.current;if(!e)return;let t=ue.current||{left:0,top:0},n=z&&(y.left!==t.left||y.top!==t.top);if(!z){let t={node:e,deltaX:y.left,deltaY:y.top,lastX:0,lastY:0,x:y.left,y:y.top};fe.current?.(y.e,t)}else if(n){let t={node:e,deltaX:y.left-ce.current.left,deltaY:y.top-ce.current.top,lastX:ce.current.left,lastY:ce.current.top,x:y.left,y:y.top};pe.current?.(y.e,t)}ue.current=y},[y,z,M]);let Ae=q4(ve,w,T,E,D,z?ce.current:null,B?le.current:null),je=V.Children.only(t),Me=G4(ve),Ne=[K4(O,Me,i[0]),K4(A,o,i[1])],Pe=[K4(k,Me,i[0]),K4(j,o,i[1])],Fe=je.props,Ie=Fe.className,Le=Fe.style,Re=V.cloneElement(je,{ref:se,className:_(`react-grid-item`,Ie,b,{static:f,resizing:B,"react-draggable":c,"react-draggable-dragging":z,dropping:!!y,cssTransforms:p}),style:{...x,...Le,...Se(Ae)}}),ze=P;return Re=(0,H.jsx)(e8.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:Ae.width,height:Ae.height,minConstraints:Ne,maxConstraints:Pe,onResizeStart:De,onResize:Oe,onResizeStop:ke,transformScale:h,resizeHandles:N,handle:ze,children:Re}),Re=(0,H.jsx)(G6,{disabled:!c,onStart:Ce,onDrag:we,onStop:Te,handle:S,cancel:`.react-resizable-handle`+(C?`,`+C:``),scale:h,allowMobileScroll:d,nodeRef:se,children:Re}),Re}var s8=V.memo(o8,(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h&&e.minW===t.minW&&e.maxW===t.maxW&&e.minH===t.minH&&e.maxH===t.maxH&&e.cols===t.cols&&e.containerWidth===t.containerWidth&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.margin===t.margin&&e.containerPadding===t.containerPadding&&e.transformScale===t.transformScale&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.isBounded===t.isBounded&&e.allowMobileScroll===t.allowMobileScroll&&e.useCSSTransforms===t.useCSSTransforms&&e.usePercentages===t.usePercentages&&e.children===t.children&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.droppingPosition===t.droppingPosition);s8.displayName=`GridItem`;function c8(e){let{clientX:t,clientY:n,gridElement:r,droppingItem:i,event:a,dragOffsetX:o=0,dragOffsetY:s=0,transformScale:c,cols:l,margin:u,maxRows:d,rowHeight:f,width:p,containerPadding:m}=e,h=r.getBoundingClientRect(),g={cols:l,margin:u,maxRows:d,rowHeight:f,containerWidth:p,containerPadding:m},_=G4(g),v=K4(i.w,_,u[0]),y=K4(i.h,f,u[1]),b=v/2,x=y/2,S=r.scrollLeft??0,C=r.scrollTop??0,w=t-h.left+S+o-b,T=n-h.top+C+s-x,E=Math.max(0,w),D=Math.max(0,T);return{newDroppingPosition:{left:E/c,top:D/c,e:a},calculatedXY:J4(g,D,E,i.w,i.h)}}var l8=()=>{},u8=`react-grid-layout`,d8=!1;try{d8=/firefox/i.test(navigator.userAgent)}catch{}function f8(e,t){let n=V.Children.toArray(e),r=V.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!V.isValidElement(t)||t.key===null)return;let n=String(t.key);a.add(n);let r=e.find(e=>e.i===n);if(r)i.push(s3(r));else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:i3(i),w:1,h:1})}});let o=d3(i,{cols:n});return r.compact(o,n)}function m8(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=j3,compactor:c,constraints:l=h3,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:h,onLayoutChange:g=l8,onDragStart:v=l8,onDrag:y=l8,onDragStop:b=l8,onResizeStart:x=l8,onResize:S=l8,onResizeStop:C=l8,onDrop:w=l8,onDropDragOver:T=l8}=e,E=(0,V.useMemo)(()=>({...M3,...r}),[r]),D=(0,V.useMemo)(()=>({...N3,...i}),[i]),O=(0,V.useMemo)(()=>({...P3,...a}),[a]),k=(0,V.useMemo)(()=>({...F3,...o}),[o]),{cols:A,rowHeight:j,maxRows:M,margin:N,containerPadding:P}=E,{enabled:F,bounded:I,handle:L,cancel:ee,threshold:R,allowMobileScroll:te}=D,{enabled:ne,handles:re,handleComponent:ie}=O,{enabled:z,defaultItem:ae,onDragOver:B,touchEnabled:oe=!0,touchDragSource:se=`[data-rgl-draggable]`}=k,ce=c??G3(`vertical`),le=ce.type,ue=ce.allowOverlap,de=ce.preventCollision??!1,fe=(0,V.useMemo)(()=>d??{i:`__dropping-elem__`,...ae},[d,ae]),pe=s.type===`transform`,me=s.scale,he=P??N,[ge,_e]=(0,V.useState)(!1),[ve,ye]=(0,V.useState)(()=>p8(u,t,A,ce)),[be,xe]=(0,V.useState)(null),[Se,Ce]=(0,V.useState)(!1),[we,Te]=(0,V.useState)(null),[Ee,De]=(0,V.useState)(),Oe=(0,V.useRef)(void 0);Oe.current=Ee;let ke=(0,V.useRef)(null),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(0),Ne=(0,V.useRef)(ve),Pe=(0,V.useRef)(u),Fe=(0,V.useRef)(t),Ie=(0,V.useRef)(le),Le=(0,V.useRef)(null),Re=(0,V.useRef)(!1),ze=(0,V.useRef)(null),Be=(0,V.useRef)(null);Be.current=we;let Ve=(0,V.useRef)(w);(0,V.useLayoutEffect)(()=>{Ve.current=w});let He=(0,V.useRef)(ve);He.current=ve,(0,V.useEffect)(()=>{_e(!0),(0,t8.deepEqual)(ve,u)||g(ve)},[]),(0,V.useEffect)(()=>{if(be||we)return;let e=!(0,t8.deepEqual)(u,Pe.current),n=!f8(t,Fe.current),r=le!==Ie.current;if(e||n||r){let n=p8(e?u:ve,t,A,ce);(0,t8.deepEqual)(n,ve)||ye(n)}Pe.current=u,Fe.current=t,Ie.current=le},[u,t,A,le,ce,be,we,ve]),(0,V.useEffect)(()=>{if(!be&&!we&&!(0,t8.deepEqual)(ve,Ne.current)){Ne.current=ve;let e=ve.filter(e=>e.i!==fe.i);g(e)}},[ve,be,we,g,fe.i]);let Ue=(0,V.useMemo)(()=>{if(!f)return;let e=i3(ve),t=he[1];return e*j+(e-1)*N[1]+t*2+`px`},[f,ve,j,N,he]),We=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=a3(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};ke.current=s3(a),je.current=i,xe(o),v(i,a,a,null,r.e,r.node)},[v]),Ge=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=ke.current,o=a3(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=f3(i,o,t,n,!0,de,le,A,ue);y(c,a,o,s,r.e,r.node),ye(ce.compact(c,A)),xe(s)},[de,le,A,ue,ce,y]),Ke=(0,V.useCallback)((e,t,n,r)=>{if(!ke.current)return;let i=He.current,a=ke.current,o=a3(i,e);if(!o)return;let s=f3(i,o,t,n,!0,de,le,A,ue),c=ce.compact(s,A);b(c,a,o,null,r.e,r.node);let l=je.current;ke.current=null,je.current=null,xe(null),ye(c),l&&!(0,t8.deepEqual)(l,c)&&g(c)},[de,le,A,ue,ce,b,g]),qe=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=a3(i,e);a&&(Ae.current=s3(a),je.current=i,Ce(!0),x(i,a,a,null,r.e,r.node))},[x]),Je=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,{handle:o}=r,s=!1,c,l,[u,d]=u3(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),de&&!ue&&e3(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,(o===`n`||o===`nw`||o===`ne`)&&(e.y=l??e.y),e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=f3(u,d,c,l,!0,de,le,A,ue));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};S(f,a,d,p,r.e,r.node);let m=ce.compact(f,A);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}ye(m),xe(p)},[de,le,A,ue,ce,S]),Ye=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,o=a3(i,e),s=ce.compact(i,A);C(s,a,o??null,null,r.e,r.node);let c=je.current;Ae.current=null,je.current=null,xe(null),Ce(!1),ye(s),c&&!(0,t8.deepEqual)(c,s)&&g(s)},[A,ce,C,g]),Xe=(0,V.useCallback)((e,t,n,r)=>{if(r)Oe.current&&(Oe.current.left!==t.left||Oe.current.top!==t.top)&&(De(t),ye(t=>t.map(t=>t.i===e.i&&(t.x!==n.x||t.y!==n.y)?{...t,x:n.x,y:n.y}:t)));else{Te((0,H.jsx)(`div`,{},e.i)),De(t);let r=He.current.filter(t=>t.i!==e.i);ye([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),Ze=(0,V.useCallback)((e,t,r)=>{let i=Le.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=c8({clientX:e,clientY:t,gridElement:i,droppingItem:fe,event:r,transformScale:me,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:he});Xe(fe,a,o,!!Be.current)},[fe,me,A,N,M,j,n,he,Xe]),Qe=(0,V.useCallback)(()=>{let e=He.current;if(!e.some(e=>e.i===fe.i)){Te(null),xe(null),De(void 0);return}let t=ce.compact(e.filter(e=>e.i!==fe.i),A);ye(t),Te(null),xe(null),De(void 0)},[fe.i,A,ce]),$e=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),d8&&!e.nativeEvent.target?.classList.contains(u8))return!1;let t=B?B(e.nativeEvent):T(e);if(t===!1)return we&&Qe(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...fe,...a},{newDroppingPosition:s,calculatedXY:c}=c8({clientX:e.clientX,clientY:e.clientY,gridElement:e.currentTarget,droppingItem:o,event:e.nativeEvent,dragOffsetX:r,dragOffsetY:i,transformScale:me,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:he});Xe(o,s,c,!!we)},[we,fe,B,T,Qe,Xe,me,A,N,M,j,n,he]),et=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current--,Me.current<0&&(Me.current=0),Me.current===0&&Qe()},[Qe]),tt=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current++},[]),nt=(0,V.useCallback)(e=>{let t=He.current,n=t.find(e=>e.i===fe.i);Qe(),Ve.current(t,n,e)},[fe.i,Qe]),rt=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current=0,nt(e.nativeEvent)},[nt]);(0,V.useEffect)(()=>{if(!z||!oe)return;let e=Le.current;if(!e)return;let t=(t,n)=>{let r=document.elementFromPoint(t,n);return r?e.contains(r):!1},n=e=>e instanceof HTMLElement&&e.closest(se)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=ze.current;if(n===null)return t[0];for(let e=0;e{if(!n(e.target)||ze.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(ze.current=t.identifier,Re.current=!0)},a=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);if(n){if(!t(n.clientX,n.clientY)){Be.current&&Qe();return}Ze(n.clientX,n.clientY,e)}},o=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);if(Re.current=!1,ze.current=null,n){if(!t(n.clientX,n.clientY)){Qe();return}nt(e)}},s=()=>{Re.current&&(Re.current=!1,ze.current=null,Qe())},c={passive:!1};return document.addEventListener(`touchstart`,i,c),document.addEventListener(`touchmove`,a,c),document.addEventListener(`touchend`,o,c),document.addEventListener(`touchcancel`,s,c),()=>{document.removeEventListener(`touchstart`,i,c),document.removeEventListener(`touchmove`,a,c),document.removeEventListener(`touchend`,o,c),document.removeEventListener(`touchcancel`,s,c)}},[z,oe,se,Ze,Qe,nt,fe.i]);let it=(0,V.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=a3(ve,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&F,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ne,o=r.resizeHandles||[...re],c=i&&I&&r.isBounded!==!1,u=ie;return(0,H.jsx)(s8,{containerWidth:n,cols:A,margin:N,containerPadding:he,maxRows:M,rowHeight:j,cancel:ee,handle:L,onDragStart:We,onDrag:Ge,onDragStop:Ke,onResizeStart:qe,onResize:Je,onResizeStop:Ye,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:te,useCSSTransforms:pe&&ge,usePercentages:!ge,transformScale:me,positionStrategy:s,dragThreshold:R,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?Ee:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:ve,children:e},r.i)},[ve,n,A,N,he,M,j,ee,L,We,Ge,Ke,qe,Je,Ye,F,ne,I,pe,ge,me,s,R,Ee,re,ie,l]),at=()=>be?(0,H.jsx)(s8,{w:be.w,h:be.h,x:be.x,y:be.y,i:be.i,className:`react-grid-placeholder ${Se?`placeholder-resizing`:``}`,containerWidth:n,cols:A,margin:N,containerPadding:he,maxRows:M,rowHeight:j,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:pe,transformScale:me,constraints:l,layout:ve,children:(0,H.jsx)(`div`,{})}):null,ot=(0,V.useCallback)(e=>{Le.current=e,typeof h==`function`?h(e):h&&`current`in h&&(h.current=e)},[h]),st=_(u8,p),ct={height:Ue,...m};return(0,H.jsxs)(`div`,{ref:ot,className:st,style:ct,onDrop:z?rt:void 0,onDragLeave:z?et:void 0,onDragEnter:z?tt:void 0,onDragOver:z?$e:void 0,children:[V.Children.map(t,e=>V.isValidElement(e)?it(e):null),z&&we&&it(we,!0),at()]})}var h8={lg:1200,md:996,sm:768,xs:480,xxs:0},g8={lg:12,md:10,sm:6,xs:4,xxs:2},_8=()=>{};function v8(e,t,n,r,i=!1){let a=[];V.Children.forEach(t,t=>{if(!V.isValidElement(t)||t.key===null)return;let n=String(t.key),r=t.props[`data-grid`],o=e.find(e=>e.i===n);o?i&&r?a.push({...o,i:n,w:r.w??o.w,h:r.h??o.h,minW:r.minW??o.minW,maxW:r.maxW??o.maxW,minH:r.minH??o.minH,maxH:r.maxH??o.maxH}):a.push({...o,i:n}):r?a.push({i:n,x:r.x??0,y:r.y??0,w:r.w??1,h:r.h??1,minW:r.minW,maxW:r.maxW,minH:r.minH,maxH:r.maxH,static:r.static,isDraggable:r.isDraggable,isResizable:r.isResizable,resizeHandles:r.resizeHandles,isBounded:r.isBounded}):a.push({i:n,x:0,y:i3(a),w:1,h:1})});let o=d3(a,{cols:n});return r.compact(o,n)}function y8(e){let{children:t,width:n,breakpoint:r,breakpoints:i=h8,cols:a=g8,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=_8,onLayoutChange:p=_8,onWidthChange:m=_8,...h}=e,g=d??G3(`vertical`),_=g.type,v=g.allowOverlap,y=(0,V.useMemo)(()=>r??q3(i,n),[]),b=(0,V.useMemo)(()=>J3(y,a),[y,a]),x=(0,V.useMemo)(()=>Y3(o,i,y,y,b,_),[]),[S,C]=(0,V.useState)(y),[w,T]=(0,V.useState)(b),[E,D]=(0,V.useState)(x),[O,k]=(0,V.useState)(o),A=(0,V.useRef)(n),j=(0,V.useRef)(r),M=(0,V.useRef)(i),N=(0,V.useRef)(a),P=(0,V.useRef)(o),F=(0,V.useRef)(_),I=(0,V.useRef)(O);(0,V.useEffect)(()=>{I.current=O},[O]);let L=(0,V.useMemo)(()=>(0,t8.deepEqual)(o,P.current)?null:Y3(o,i,S,S,w,g),[o,i,S,w,g]),ee=L??E;(0,V.useEffect)(()=>{L!==null&&(D(L),k(o),I.current=o,P.current=o)},[L,o]),(0,V.useEffect)(()=>{if(_!==F.current){let e=g.compact(c3(ee),w),t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t),F.current=_}},[_,g,ee,w,v,S,p]),(0,V.useEffect)(()=>{let e=n!==A.current,o=r!==j.current,s=!(0,t8.deepEqual)(i,M.current),c=!(0,t8.deepEqual)(a,N.current);if(e||o||s||c){let e=r??q3(i,n),o=J3(e,a),d=S;if(d!==e||s||c){let n={...I.current};n[d]||(n[d]=c3(E));let r=Y3(n,i,e,d,o,g),a=!n[e];r=v8(r,t,o,g,a),n[e]=r,C(e),T(o),D(r),k(n),I.current=n,f(e,o),p(r,n)}let h=X3(l,e),_=u?X3(u,e):null;m(n,h,o,_),A.current=n,j.current=r,M.current=i,N.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let R=(0,V.useCallback)(e=>{let t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t)},[S,p]),te=(0,V.useMemo)(()=>X3(l,S),[l,S]),ne=(0,V.useMemo)(()=>u===null?null:X3(u,S),[u,S]),re=(0,V.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:te,containerPadding:ne}),[w,s,c,te,ne]);return(0,H.jsx)(m8,{...h,width:n,gridConfig:re,compactor:g,onLayoutChange:R,layout:ee,children:t})}var b8=V.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,H.jsx)(y8,{...r,innerRef:i})});b8.displayName=`ResponsiveGridLayout`;function x8(e,t,n,r){let i=e=>t?.frame?.columns.some((n,r)=>n.name===e&&t.frame.values[r]?.some(e=>typeof e==`string`&&e!==``));return{onSelect:e.click&&(e.viz===`service_map`||!(e.drill&&r))?t=>n(e.click.set_variable,t):void 0,onPoint:r&&(e.viz===`service_map`||e.click||e.drill||i(`trace_id`)||e.options?.columns?.some(e=>e.format===`trace_link`&&i(e.field)))?r:void 0}}function S8(e,t,n,r){if(!t)return;let i=pt(e,t,n);if(!i)return;let a=Object.values(n.dimensions)[0],o=e.click?.set_variable;return{target:i,vars:o&&a!==void 0?{...r,[o]:a}:r}}function C8(e){return`Explain the panel “${e.title}”`}function w8(e){return`Fix the panel “${e.title}”`}function T8(e){return[{description:`Observed panel diagnostics`,value:JSON.stringify(e)}]}var E8=e=>e*40+(e-1)*12,D8={s:3,m:6,l:10},O8={stat:4},k8=e=>Math.max(O8[e.viz]??0,D8[e.height??(e.viz===`service_map`?`l`:e.viz===`stat`?`s`:`m`)]),A8=(0,V.lazy)(()=>le(()=>import(`./panel-sql-editor-Behd0nuD.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),j8=0;function M8(e){let t;do t=`p_${Date.now().toString(36)}_${(++j8).toString(36)}_${Math.random().toString(36).slice(2,10)}`;while(e.some(e=>e.id===t));return t}function N8({dashboardId:e,version:t,spec:n,vars:r,results:i,fetching:a,annotations:o,fetchingIds:s=[],staleAt:c=new Map,time:l=n.time,onEditExit:u,editing:d,view:f,agentAvailable:p,canManage:m=!1,onOpenChat:h,onVariable:g,onRetry:_,onPoint:v,onZoom:b,onZoomReset:x,zoomed:S,onView:w,onVisible:E,onRangePending:D,shortcutScope:O,onShortcuts:k,overlayOpen:A,returnViewFocus:j}){let M=et(),[N,P]=(0,V.useState)(),[F,I]=(0,V.useState)(()=>n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??k8(e)})));(0,V.useEffect)(()=>{I(n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??k8(e)})))},[n]);let[L,R]=(0,V.useState)(()=>window.innerHeight),[te,ne]=(0,V.useState)();(0,V.useEffect)(()=>{let e=()=>R(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let re=(0,V.useRef)(null),ie=(0,V.useRef)(new Map),z=(0,V.useRef)(null),ae=(0,V.useRef)(null),B=()=>{let e=N?.panel.id;P(void 0),requestAnimationFrame(()=>(ae.current?.isConnected?ae.current:ie.current.get(e??``))?.focus())},se=(0,V.useRef)(f);f&&(se.current=f);let[ce,le]=(0,V.useState)(0),ue=ce>0,de=d&&(ce>=1100?`lg`:ce>=800?`md`:`sm`)==`lg`;(0,V.useLayoutEffect)(()=>{if(!re.current)return;le(Math.max(0,Math.round(re.current.getBoundingClientRect().width)));let e=new ResizeObserver(([e])=>{e&&le(Math.max(0,Math.round(e.contentRect.width)))});return e.observe(re.current),()=>e.disconnect()},[]);let fe=(0,V.useRef)(E);fe.current=E,(0,V.useEffect)(()=>{if(!ue||!re.current||typeof IntersectionObserver>`u`)return;let e=new Set(n.panels.map(e=>e.id)),t=new IntersectionObserver(t=>{for(let n of t){let t=n.target.dataset.panel;t&&(n.isIntersecting?e.add(t):e.delete(t))}f&&n.panels.some(e=>e.id===f)&&e.add(f),fe.current([...e])},{rootMargin:`200px`});return re.current.querySelectorAll(`.react-grid-item[data-panel]`).forEach(e=>t.observe(e)),()=>t.disconnect()},[n,f,ue]);let pe=(0,V.useMemo)(()=>n.panels.some(e=>{let t=F.find(t=>t.i===e.id);return t&&(t.x!==e.grid?.x||t.y!==e.grid?.y||t.w!==e.grid?.w||t.h!==e.grid?.h)}),[F,n]),me=e=>({...n,panels:e.map(e=>{let t=F.find(t=>t.i===e.id);return t?{...e,grid:{x:t.x,y:t.y,w:t.w,h:t.h}}:e})}),he=De({mutationFn:()=>Qe(e,me(n.panels),t,`Edited layout`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),ge=De({mutationFn:r=>pe?Qe(e,me(n.panels.filter(e=>e.id!==r)),t,`Removed a panel and saved layout`):Ae(e,[{op:`remove_panel`,id:r}],t,`Removed a panel`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),_e=De({mutationFn:r=>{let i={...r,id:M8(n.panels),title:`${Array.from(r.title).slice(0,73).join(``)} (copy)`,grid:void 0};if(pe){let a=[...n.panels];return a.splice(a.findIndex(e=>e.id===r.id)+1,0,i),Qe(e,me(a),t,`Duplicated a panel and saved layout`)}return Ae(e,[{op:`add_panel`,after:r.id,panel:i}],t,`Duplicated a panel`)},onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}});(0,V.useEffect)(()=>{d||(he.reset(),ge.reset(),_e.reset())},[d]);let ve=()=>{he.reset(),ge.reset(),_e.reset(),u?.(),M.invalidateQueries({queryKey:[`dashboard`,e]})},ye=async e=>{let t=new URL(window.location.href);t.searchParams.set(`view`,e),t.searchParams.delete(`edit`);try{await navigator.clipboard.writeText(t.toString()),ne(`Link copied`)}catch{ne(`Copy this URL: ${t.toString()}`)}},be=`dashboard-${e}`,xe=n=>({dashboard_id:e,version:t,panel_id:n.id,title:Yi(n.title,r),from_ms:i.get(n.id)?.from_ms,to_ms:i.get(n.id)?.to_ms,vars:r,error:i.get(n.id)?.error,status:i.get(n.id)?.status,diagnosis:i.get(n.id)?.diagnosis,stale_since:c.get(n.id),truncated:i.has(n.id)?!!(i.get(n.id)?.frame?.truncated||i.get(n.id)?.previous?.truncated):void 0,note:i.get(n.id)?.frame?.note,spec:{...n,dashboard_time:l}}),Se=(u,d,y=!1)=>(0,H.jsx)(V4,{panel:u,title:Yi(u.title,r),result:i.get(u.id),loading:a&&s.includes(u.id),height:d,group:be,editing:de&&!y,agentAvailable:p,suspended:!y&&u.id===f,menuRef:y?z:e=>{e?ie.current.set(u.id,e):ie.current.delete(u.id)},compare:l.compare===`previous_period`,range:u.time?.range??l.range,annotations:o,vars:r,onVariable:g,...x8(u,i.get(u.id),g,v?e=>v(u,e):void 0),onRangePending:e=>D?.(u.id,e),onZoom:b,zoomed:S,onZoomReset:x,onRetry:_?()=>_(u.id):void 0,onView:()=>w(u.id),onCopyLink:()=>{ye(u.id)},onEditSQL:m&&typeof u.sql==`string`?()=>{ae.current=y?z.current:ie.current.get(u.id)??null,P({panel:u,spec:n,version:t})}:void 0,onExplain:e?()=>h(C8(xe(u)),{answer_only:!0,context:T8(xe(u))}):void 0,onFix:e&&m?()=>h(w8(xe(u)),{context:T8(xe(u))}):void 0,staleAt:c.get(u.id),onDuplicate:de&&!y?()=>_e.mutate(u):void 0,onRemove:de&&!y?()=>ge.mutate(u.id):void 0}),Ce=n.panels.find(e=>e.id===f),we=d?he.error??ge.error??_e.error:null,Te=we instanceof Me&&we.code===`dashboard_version_conflict`,Ee=e=>{de&&I(e.map(({i:e,x:t,y:n,w:r,h:i})=>({i:e,x:t,y:n,w:r,h:i})))};return(0,H.jsxs)(`div`,{ref:re,style:{minWidth:0},children:[d&&(0,H.jsxs)(y,{justify:`space-between`,mb:`sm`,p:`xs`,style:{border:`1px dashed var(--mantine-color-default-border)`,borderRadius:8},children:[(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:de?`Drag a panel by its title and resize it from the corner. Changes are saved as a new version.`:`The layout can be edited only on a wider screen.`}),(0,H.jsx)(C,{size:`compact-sm`,disabled:!pe||!de,loading:he.isPending,onClick:()=>he.mutate(),children:`Save layout`})]}),Te&&(0,H.jsxs)(ee,{color:`warn`,mb:`sm`,children:[`Someone saved this dashboard since you opened it. Load the latest version, then redo your change. `,(0,H.jsx)(C,{size:`compact-sm`,onClick:ve,children:`Load latest`})]}),we&&!Te&&(0,H.jsx)(ee,{color:`bad`,mb:`sm`,children:we.message}),te&&(0,H.jsx)(ee,{role:`status`,mb:`sm`,children:te}),!ue&&(0,H.jsx)(`div`,{"data-grid-placeholder":!0,style:{height:E8(Math.max(1,...F.map(e=>e.y+e.h)))}}),ue&&(0,H.jsx)(b8,{width:ce,className:`dashboard-grid${de?` dashboard-grid-editing`:``}`,layouts:{lg:F,md:F,sm:F.map(e=>({...e,x:0,w:12}))},breakpoints:{lg:1100,md:800,sm:0},cols:{lg:12,md:12,sm:12},rowHeight:40,margin:[12,12],containerPadding:[0,0],compactor:z3,dragConfig:{enabled:de,handle:`.panel-drag`,cancel:`button`},resizeConfig:{enabled:de},onDragStop:Ee,onResizeStop:Ee,children:n.panels.map(e=>{let t=F.find(t=>t.i===e.id);return(0,H.jsx)(`div`,{"data-panel":e.id,children:Se(e,E8(t?.h??6))},e.id)})}),(0,H.jsx)(B4,{shortcutScope:O,onShortcuts:k,escapeEnabled:!A&&!N,opened:!!f,onClose:()=>w(void 0),title:Ce?Yi(Ce.title,r):`Missing panel`,returnFocusTo:()=>j?.(se.current)??ie.current.get(se.current??``)??ie.current.values().next().value,children:Ce?(0,H.jsx)(`div`,{style:{height:`calc(100vh - 120px)`},children:Se(Ce,Math.max(40,L-140),!0)}):(0,H.jsx)(ee,{color:`warn`,children:`This panel is missing from the dashboard. The shared link may be out of date.`})}),N&&(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(yt,{opened:!0,onClose:B,title:`Loading SQL editor`,children:(0,H.jsx)(oe,{size:`sm`,"aria-label":`Loading SQL editor`})}),children:(0,H.jsx)(A8,{dashboardId:e,version:N.version,spec:N.spec,panel:N.panel,time:l,vars:r,onClose:B})})]})}function P8(e,t=1,n=8){let r=(t-1)*n;return e.slice(r,r+n)}function F8({icon:e,title:t,children:n,tall:r=!1}){return(0,H.jsx)(ie,{mih:r?220:130,p:`xl`,children:(0,H.jsxs)(y,{wrap:`nowrap`,children:[(0,H.jsx)(te,{variant:`light`,size:`xl`,radius:`md`,children:e}),(0,H.jsxs)(o,{children:[(0,H.jsx)(T,{fw:700,size:`sm`,children:t}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,mt:3,children:n})]})]})})}function I8(e,t=8){let[n,r]=(0,V.useState)(1),i=Math.max(1,Math.ceil(e.length/t));(0,V.useEffect)(()=>{n>i&&r(i)},[n,i]);let a=(n-1)*t;return{page:n,setPage:r,totalPages:i,pageItems:P8(e,n,t),from:e.length?a+1:0,to:Math.min(a+t,e.length),total:e.length}}function L8({page:e,totalPages:t,from:n,to:r,total:i,onChange:a}){return t<=1?null:(0,H.jsxs)(y,{justify:`space-between`,mt:`xs`,children:[(0,H.jsxs)(T,{c:`dimmed`,size:`xs`,children:[n,`–`,r,` of `,i]}),(0,H.jsx)(y,{gap:4,children:[{label:`First page`,page:1,disabled:e===1},{label:`Previous page`,page:e-1,disabled:e===1},{label:`Next page`,page:e+1,disabled:e===t},{label:`Last page`,page:t,disabled:e===t}].map(e=>(0,H.jsx)(C,{size:`compact-xs`,variant:`subtle`,"aria-label":e.label,disabled:e.disabled,onClick:()=>a(e.page),children:e.label},e.label))})]})}function R8({spans:e,dark:t,onSpan:n}){let r=Math.min(...e.map(e=>new Date(e.start).valueOf())),i=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),a=Math.max(i-r,1),s=[...new Set(e.map(e=>e.service))],c=I8(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(be.ScrollContainer,{minWidth:680,children:(0,H.jsxs)(be,{highlightOnHover:!!n,verticalSpacing:`sm`,children:[(0,H.jsx)(be.Thead,{children:(0,H.jsxs)(be.Tr,{children:[(0,H.jsx)(be.Th,{w:230,children:`Operation`}),(0,H.jsx)(be.Th,{children:`Timeline`}),(0,H.jsx)(be.Th,{w:90,ta:`right`,children:`Duration`})]})}),(0,H.jsx)(be.Tbody,{children:c.pageItems.map(e=>{let i=(new Date(e.start).valueOf()-r)/a*100,c=Math.max(e.duration_ms/a*100,.6),l=e.status===`STATUS_CODE_ERROR`;return(0,H.jsxs)(be.Tr,{tabIndex:n?0:void 0,onClick:n?()=>n(e):void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))}:void 0,style:{cursor:n?`pointer`:void 0},children:[(0,H.jsx)(be.Td,{children:(0,H.jsxs)(y,{gap:`xs`,wrap:`nowrap`,children:[(0,H.jsx)(o,{w:8,h:8,bg:Ua(s.indexOf(e.service),t),style:{borderRadius:`50%`,flex:`0 0 auto`}}),(0,H.jsxs)(o,{miw:0,children:[(0,H.jsx)(T,{fw:600,size:`sm`,truncate:!0,children:e.operation}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,truncate:!0,children:e.service})]})]})}),(0,H.jsx)(be.Td,{children:(0,H.jsx)(me,{label:`${e.service} · ${e.operation} · ${ye(e.duration_ms)}`,withArrow:!0,children:(0,H.jsx)(o,{pos:`relative`,h:14,bg:`var(--mantine-color-default-hover)`,role:`img`,"aria-label":`${e.operation} on ${e.service} took ${ye(e.duration_ms)}`,style:{borderRadius:`var(--mantine-radius-sm)`},children:(0,H.jsx)(o,{pos:`absolute`,left:`${i}%`,w:`${Math.min(c,100-i)}%`,h:`100%`,bg:l?`bad`:Ua(s.indexOf(e.service),t),style:{borderRadius:`var(--mantine-radius-sm)`,minWidth:3}})})})}),(0,H.jsx)(be.Td,{ta:`right`,children:(0,H.jsx)(T,{size:`sm`,ff:`monospace`,children:ye(e.duration_ms)})})]},e.span_id)})})]})}),(0,H.jsx)(L8,{...c,onChange:c.setPage})]})}function z8({result:e,dark:t,onSpan:n}){let[r,i]=(0,V.useState)(`waterfall`),a=e.data,s=(0,V.useMemo)(()=>({id:`correlated_logs`,status:a.logs.length?`ok`:`empty`,elapsed_ms:0,frame:{columns:[{name:`time`,type:`time`,role:`time`},...[`severity`,`service`,`body`].map(e=>({name:e,type:`string`,role:`dimension`}))],rows:a.logs.length,values:[a.logs.map(e=>Date.parse(e.time)),a.logs.map(e=>e.severity),a.logs.map(e=>e.service),a.logs.map(e=>e.body)]}}),[a.logs]);return(0,H.jsxs)(S,{gap:`sm`,children:[(0,H.jsxs)(y,{children:[(0,H.jsx)(T,{fw:600,children:a.trace_id}),(0,H.jsx)(T,{c:a.has_error?`bad`:`dimmed`,children:a.has_error?`■ Error`:`● OK`})]}),a.spans.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(y,{role:`group`,"aria-label":`Trace view`,children:[(0,H.jsx)(C,{"aria-pressed":r===`waterfall`,variant:r===`waterfall`?`light`:`subtle`,onClick:()=>i(`waterfall`),children:`Waterfall`}),(0,H.jsx)(C,{"aria-pressed":r===`flame`,variant:r===`flame`?`light`:`subtle`,onClick:()=>i(`flame`),children:`Flame graph`})]}),r===`waterfall`?(0,H.jsx)(R8,{spans:a.spans,dark:t,onSpan:n}):(0,H.jsx)(B8,{spans:a.spans,dark:t,onSpan:n})]}):(0,H.jsx)(T,{c:`dimmed`,children:`No spans were found for this trace.`}),(0,H.jsx)(T,{fw:600,children:`Correlated logs`}),a.logs.length?(0,H.jsx)(o,{style:{overflow:`auto`,minWidth:0},children:(0,H.jsx)(P4,{foldConstants:!1,panel:{id:`correlated_logs`,title:`Correlated logs`,viz:`logs`},result:s,dark:t,height:320})}):(0,H.jsx)(F8,{tall:!0,icon:(0,H.jsx)(zi,{size:20,weight:`duotone`}),title:`No correlated logs`,children:`No logs in this window carry the selected trace ID.`}),a.truncated&&(0,H.jsxs)(ee,{color:`warn`,children:[`This trace is truncated: `,a.spans.length,` of `,a.span_count,` spans, `,a.services.length,` of `,a.service_count,` services.`]})]})}function B8({spans:e,dark:t,onSpan:n}){let r=(0,V.useMemo)(()=>V8(e),[e]),i=[...new Set(e.map(e=>e.service))];return(0,H.jsxs)(S,{px:{base:`md`,sm:`lg`},pb:`md`,gap:`xs`,children:[(0,H.jsxs)(y,{justify:`space-between`,children:[(0,H.jsx)(y,{gap:`md`,children:i.map(e=>(0,H.jsxs)(y,{gap:5,children:[(0,H.jsx)(o,{w:8,h:8,bg:Ua(i.indexOf(e),t),style:{borderRadius:`50%`}}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,children:e})]},e))}),(0,H.jsx)(Ue,{variant:`light`,children:ye(r.total)})]}),(0,H.jsx)(B,{withBorder:!0,radius:`md`,p:`sm`,children:(0,H.jsx)(pe,{type:`auto`,offsetScrollbars:!0,children:(0,H.jsxs)(o,{miw:760,children:[(0,H.jsx)(o,{pos:`relative`,h:22,mb:4,children:[0,25,50,75,100].map(e=>(0,H.jsx)(T,{pos:`absolute`,left:`${e}%`,c:`dimmed`,size:`xs`,style:{transform:e===100?`translateX(-100%)`:e?`translateX(-50%)`:void 0},children:ye(r.total*e/100)},e))}),(0,H.jsxs)(o,{pos:`relative`,h:Math.max(150,r.laneCount*36+12),bg:`var(--mantine-color-default-hover)`,style:{overflow:`hidden`,borderRadius:`var(--mantine-radius-md)`},children:[[0,25,50,75,100].map(e=>(0,H.jsx)(o,{pos:`absolute`,left:`${e}%`,top:0,bottom:0,style:{borderLeft:`1px solid var(--mantine-color-default-border)`}},e)),r.frames.map(({span:e,lane:r,left:a,width:s})=>{let c=e.status===`STATUS_CODE_ERROR`,l=s<7,u=c?Ha(t).bad:Ua(i.indexOf(e.service),t),d=`${e.operation} · ${ye(e.duration_ms)} · ${e.service}`,f=(0,H.jsxs)(T,{component:`span`,size:`xs`,fw:700,truncate:!0,children:[l?``:e.operation,s>=12?` · ${ye(e.duration_ms)}`:``]}),p={position:`absolute`,left:`${a}%`,top:r*36+6,width:`${Math.max(s,.35)}%`,height:30,overflow:`hidden`,minWidth:3};return(0,H.jsx)(me,{label:`${e.service} · ${e.operation} · ${ye(e.duration_ms)}`,withArrow:!0,events:{hover:!0,focus:!0,touch:!1},children:n?(0,H.jsx)(C,{variant:`filled`,color:u,"aria-label":d,px:l?2:`xs`,size:`compact-xs`,onClick:()=>n(e),style:p,children:f}):(0,H.jsx)(o,{role:`img`,tabIndex:0,"aria-label":d,style:{...p,display:`flex`,alignItems:`center`,paddingInline:l?2:8,borderRadius:`var(--mantine-radius-sm)`,background:u,color:Ot(u)},children:f})},e.span_id)})]})]})})}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,children:`Width represents wall-clock duration; lanes preserve span hierarchy without overlap.`})]})}function V8(e){let t=Math.min(...e.map(e=>new Date(e.start).valueOf())),n=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),r=Math.max(n-t,1),i=new Map(e.map(e=>[e.span_id,e])),a=(e,t=new Set)=>{if(!e.parent_span_id||t.has(e.span_id))return 0;let n=i.get(e.parent_span_id);return n?(t.add(e.span_id),1+a(n,t)):0},o=e.map(e=>{let n=new Date(e.start).valueOf();return{span:e,depth:a(e),start:n,end:n+e.duration_ms,left:(n-t)/r*100,width:e.duration_ms/r*100}}).sort((e,t)=>e.depth-t.depth||e.start-t.start||t.span.duration_ms-e.span.duration_ms),s=[],c=0;for(let e of[...new Set(o.map(e=>e.depth))].sort((e,t)=>e-t)){let t=[];for(let n of o.filter(t=>t.depth===e)){let e=t.findIndex(e=>e<=n.start);e===-1&&(e=t.length),t[e]=n.end,s.push({...n,lane:c+e})}c+=Math.max(t.length,1)}return{frames:s,laneCount:c,total:r}}function H8({client:e,spec:t,time:n,vars:r,target:i,onChange:a}){let o=it(`light`)===`dark`,s=t.panels.find(e=>e.id===i?.panel_id),c=i?.kind===`logs`&&s?.query?.from===`logs`,l=ot({queryKey:[`exemplars`,t,i,r],queryFn:({signal:n})=>e.exemplars({dashboard:t,panel_id:i.panel_id,kind:c?`logs`:`traces`,time:{from:i.window_from,to:i.window_to,refresh:`off`},from:i.from,to:i.to,dimensions:i.dimensions,bucket:i.bucket,vars:r},n),enabled:!!(i&&s&&!i.trace_id),retry:!1}),u=ot({queryKey:[`drill-trace`,i],queryFn:({signal:t})=>e.trace(i,t),enabled:!!i?.trace_id,retry:!1});return(0,H.jsxs)($e,{opened:!!i,onClose:()=>a(void 0),title:s?`${s.title} · ${i?.kind}`:`Panel selection unavailable`,position:`right`,size:`xl`,children:[i?.trace_id&&(0,H.jsx)(C,{variant:`subtle`,mb:`sm`,onClick:()=>{let{trace_id:e,namespace:t,...n}=i;a(n)},children:`Back to traces`}),!s&&(0,H.jsx)(ee,{color:`bad`,children:`This panel is no longer in the dashboard.`}),(l.isFetching||u.isFetching)&&(0,H.jsx)(oe,{role:`status`,"aria-label":`Loading drill data`,size:`sm`}),(l.error||u.error)&&(0,H.jsx)(ee,{color:`bad`,children:(l.error??u.error)?.message}),c&&l.data?.logs&&s&&(0,H.jsx)(P4,{panel:{...s,viz:`logs`},result:{id:s.id,status:l.data.logs.rows?`ok`:`empty`,frame:l.data.logs,elapsed_ms:0,from_ms:Date.parse(i.from),to_ms:Date.parse(i.to)},dark:o,height:500}),c&&l.data?.logs?.rows===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No logs match this selection.`}),!c&&!i?.trace_id&&l.data&&(0,H.jsxs)(S,{gap:`xs`,children:[l.data.traces.length===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No exemplar traces match this selection.`}),l.data.traces.map(e=>(0,H.jsxs)(C,{variant:`default`,justify:`space-between`,onClick:()=>a({...i,trace_id:e.trace_id,namespace:e.namespace}),children:[e.service,` · `,e.operation,` · `,e.duration_ms.toFixed(1),` ms`]},`${e.namespace}/${e.trace_id}`)),l.data.truncated&&(0,H.jsx)(T,{size:`xs`,c:`dimmed`,children:`Showing at most 20 exemplar traces.`})]}),u.data&&(0,H.jsx)(z8,{result:u.data,dark:o})]})}var U8={"5m":`Last 5 minutes`,"15m":`Last 15 minutes`,"1h":`Last hour`,"3h":`Last 3 hours`,"6h":`Last 6 hours`,"12h":`Last 12 hours`,"24h":`Last 24 hours`,"2d":`Last 2 days`,"7d":`Last 7 days`,"30d":`Last 30 days`};function W8(e){return e.from&&e.to?`${ge(e.from)} – ${ge(e.to)}`:U8[e.range??`1h`]??e.range??`Last hour`}function G8({time:e,refresh:t,compare:n,editing:r,fetching:i,updatedAt:a,onRange:o,onAbsolute:s,onZoomOut:c,onRefresh:l,onRefreshNow:u,onCompare:d,onEdit:f,onHistory:p,onShortcuts:m,selecting:h=!1}){let[g,_]=(0,V.useState)(``),[v,b]=(0,V.useState)(``),[x,S]=(0,V.useState)(!1);return(0,H.jsxs)(y,{gap:`xs`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard controls`,children:[(0,H.jsxs)(Je,{position:`bottom-end`,withinPortal:!0,opened:x,onChange:S,children:[(0,H.jsx)(Je.Target,{children:(0,H.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,H.jsx)(ji,{size:15}),rightSection:(0,H.jsx)(_e,{size:12,weight:`bold`}),children:W8(e)})}),(0,H.jsxs)(Je.Dropdown,{miw:260,children:[(0,H.jsx)(Je.Label,{children:`Relative`}),dt.map(t=>(0,H.jsx)(Je.Item,{onClick:()=>o(t),fw:e.range===t?600:void 0,children:U8[t]},t)),(0,H.jsx)(Je.Divider,{}),(0,H.jsx)(Je.Label,{children:`Absolute (your time zone)`}),(0,H.jsxs)(y,{gap:6,px:`xs`,pb:`xs`,wrap:`nowrap`,children:[(0,H.jsx)(je,{type:`datetime-local`,size:`xs`,"aria-label":`From`,value:g,onChange:e=>_(e.currentTarget.value)}),(0,H.jsx)(je,{type:`datetime-local`,size:`xs`,"aria-label":`To`,value:v,onChange:e=>b(e.currentTarget.value)})]}),(0,H.jsx)(y,{px:`xs`,pb:`xs`,justify:`flex-end`,children:(0,H.jsx)(C,{size:`compact-sm`,disabled:!g||!v||g>=v,onClick:()=>{s(new Date(g).toISOString(),new Date(v).toISOString()),S(!1)},children:`Apply range`})})]})]}),(0,H.jsx)(me,{label:`Zoom out`,children:(0,H.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Zoom out`,onClick:c,children:(0,H.jsx)(Ui,{size:15})})}),(0,H.jsxs)(y,{"data-refresh-controls":!0,gap:4,wrap:`nowrap`,children:[(0,H.jsx)(me,{label:a?`Updated ${ge(a)}`:`Refresh now`,children:(0,H.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Refresh now`,loading:i,onClick:u,children:(0,H.jsx)(xi,{size:15})})}),(0,H.jsx)(Hr,{size:`xs`,"aria-label":`Auto refresh`,value:t,onChange:l,data:At.map(e=>({value:e,label:e===`off`?`Off`:e}))})]}),(0,H.jsx)(oi,{size:`sm`,label:`Compare with previous period`,checked:n,onChange:e=>d(e.currentTarget.checked)}),(0,H.jsx)(C,{variant:r?`filled`:`default`,size:`sm`,leftSection:(0,H.jsx)(Be,{size:15}),onClick:f,children:r?`Done`:`Edit layout`}),(0,H.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,H.jsx)(Ni,{size:15}),onClick:p,children:`History`}),m&&(0,H.jsx)(R4,{onClick:m}),a&&(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,visibleFrom:`md`,children:[`Updated `,new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}).format(a)]}),h&&(0,H.jsx)(T,{"data-range-paused":!0,size:`xs`,c:`dimmed`,role:`status`,children:`Paused while selecting`})]})}var K8=(e,t)=>!(t instanceof Me&&t.status<500)&&e<2,q8=(e,t)=>!(t instanceof Me&&t.code===`timeout`)&&K8(e,t),J8=e=>({panels:e.panels.map(({grid:e,...t})=>t),variables:e.variables,time:e.time,annotations:e.annotations});function Y8(e,t,n,r,i){return[`panels`,JSON.stringify([e,J8(t),n,r,i])]}function X8(e,t,n,r){return[`variables`,e,J8(t),n,r]}async function Z8(e,t){let n=await Ye(e,t),r=new Set(e.dashboard.panels.filter(e=>[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)).map(e=>e.id)),i=n.filter(e=>r.has(e.id)&&e.from_ms!==void 0&&e.to_ms!==void 0&&e.from_mse.from_ms)),o=Math.max(...i.map(e=>e.to_ms));try{return{results:n,annotations:await vt({from:new Date(a).toISOString(),to:new Date(o).toISOString()},t)}}catch(e){if(t?.aborted)throw e;return{results:n,annotation_error:e instanceof Error?e.message:`Annotations unavailable`}}}var Q8={off:!1,"10s":1e4,"30s":3e4,"1m":6e4,"5m":3e5},$8=0;function e5(e,t){let[n,r]=e.queryKey;if(n!==`panels`||typeof r!=`string`)return!1;try{return JSON.parse(r)[0]===t}catch{return!1}}function t5({dashboardId:e,spec:t,time:n,vars:r,compare:i,widths:a,visible:o,refresh:s,enabled:c=!0}){let l=(0,V.useMemo)(()=>Object.fromEntries(Object.entries(a).map(([e,t])=>[e,Math.max(100,Math.round(t/100)*100)])),[a]),u=Y8(e,t,n,r,i),d=u[1],f=o.filter(e=>t.panels.some(t=>t.id===e)),p=(0,V.useRef)([]),m=(0,V.useRef)(void 0),h=(0,V.useRef)(null),g=(0,V.useRef)(!1),_=(0,V.useRef)(null),v=(0,V.useRef)({key:d,ids:new Set}),[y,b]=(0,V.useState)({key:d}),[x,S]=(0,V.useState)({key:d,results:new Map,updated:new Map,stale:new Set,receivedAt:0}),C=f.length===0&&x.key===d&&x.receivedAt>0,w=c&&t.panels.some(e=>e.viz!==`text`),T=ot({queryKey:u,queryFn:({signal:e})=>{if(C&&h.current?.key!==d)return p.current=[],Promise.resolve({results:[],hasTimePanels:!1,batch:++$8});let a=h.current?.key===d?h.current.ids:f;p.current=(a.length?[...a]:t.panels.map(e=>e.id)).sort(),v.current.key!==d&&(v.current={key:d,ids:new Set});for(let e of p.current)v.current.ids.add(e);let o=[...p.current];return Z8({dashboard:t,panels:o,time:n,vars:r,widths:l,compare:i},e).then(e=>{let n=new Set(e.results.map(e=>e.id)),r=o.filter(e=>!n.has(e)&&t.panels.find(t=>t.id===e)?.viz!==`text`).map(e=>({id:e,status:`error`,elapsed_ms:0,error:`No result was returned for this panel; refresh to retry.`,request_error:o}));return{...e,batch:++$8,results:[...e.results.map(e=>W4(e,o)),...r],hasTimePanels:t.panels.some(e=>o.includes(e.id)&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz))}}).catch(n=>{throw e.aborted||(m.current={key:d,ids:o.filter(e=>t.panels.find(t=>t.id===e)?.viz!==`text`),error:n instanceof Error?n.message:String(n),retryable:!(n instanceof Me)||n.status===408||n.status===429||n.status>=500}),n})},retry:q8,enabled:w,refetchInterval:C?!1:Q8[s]??3e4,staleTime:5e3,placeholderData:e=>e}),E=T.error&&m.current?.key===d?m.current:void 0,D=(0,V.useMemo)(()=>n5(x,d,T.isPlaceholderData?void 0:T.data?.results,T.dataUpdatedAt,T.data?.batch,E),[x,d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]),O=D.results,k=T.isPlaceholderData?void 0:T.data?.hasTimePanels?T.data:y.key===d?y:void 0;(0,V.useEffect)(()=>{!T.isPlaceholderData&&T.data?.hasTimePanels&&b({key:d,annotations:T.data.annotations,annotation_error:T.data.annotation_error})},[d,T.data,T.isPlaceholderData]),(0,V.useEffect)(()=>{T.isPlaceholderData||S(e=>n5(e,d,T.data?.results,T.dataUpdatedAt,T.data?.batch,E))},[d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]);let A=new Map([...D.stale].flatMap(e=>{let t=D.updated.get(e);return t?[[e,t]]:[]})),j=(T.data?.results??[]).find(e=>e.status===`error`&&D.stale.has(e.id));(0,V.useEffect)(()=>{if(!w||T.isFetching||g.current||_.current?.key===d||h.current?.key===d)return;let e=v.current.key===d?v.current.ids:new Set,n=[...new Set(f.filter(n=>!O.has(n)&&!e.has(n)&&t.panels.find(e=>e.id===n)?.viz!==`text`))].sort();if(!n.length)return;let r={key:d,ids:n};h.current=r,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===r&&(h.current=null)})},[o,w,d,T.isFetching,T.error,T.refetch,O,t.panels]),(0,V.useEffect)(()=>{!T.isFetching&&_.current?.key!==d&&g.current&&(g.current=!1,h.current=null,w&&!C&&T.refetch({cancelRefetch:!1}))},[T.isFetching,d,w,C,T.refetch]);let M=e=>{let t={key:d,ids:e};h.current=t,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===t&&(h.current=null)})};return(0,V.useEffect)(()=>{if(T.isFetching||!_.current)return;let e=_.current;if(_.current=null,e.key!==d||!w)return;let n=[...e.ids].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();n.length&&M(n)},[T.isFetching,d,w,O,t.panels]),{retry:e=>{if(!w)return;let n=e?O.get(e)?.request_error??[]:[...O.values()].flatMap(e=>e.request_error??[]),r=[...new Set(n)].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();if(r.length){if(T.isFetching){_.current?.key!==d&&(_.current={key:d,ids:new Set});for(let e of r)_.current.ids.add(e);return}M(r)}},results:O,staleAt:A,annotations:k?.annotations,annotationError:k?.annotation_error,fetchingIds:T.isFetching?p.current:[],fetching:T.isFetching,error:T.error??(j?Error(j.error??`Panel refresh failed`):null),updatedAt:T.isPlaceholderData?null:T.dataUpdatedAt||null,refetch:()=>{if(w&&!C){if(T.isFetching){h.current?.key===d&&(g.current=!0);return}T.refetch({cancelRefetch:!1})}}}}function n5(e,t,n,r,i,a){let o=e.key===t?{key:t,results:new Map(e.results),updated:new Map(e.updated),stale:new Set(e.stale),receivedAt:e.receivedAt,receivedBatch:e.receivedBatch}:{key:t,results:new Map,updated:new Map,stale:new Set,receivedAt:0};for(let e of n&&i!==o.receivedBatch?n:[])e.status===`error`&&o.results.get(e.id)?.frame?(o.stale.add(e.id),o.results.set(e.id,{...o.results.get(e.id),error:e.error,request_error:e.request_error})):(o.results.set(e.id,e),o.updated.set(e.id,r),o.stale.delete(e.id));n&&(o.receivedAt=r,o.receivedBatch=i);for(let e of a?.ids??[]){let t=o.results.get(e);t?.frame?(o.stale.add(e),o.results.set(e,{...t,error:a.error,request_error:a.retryable?a.ids:void 0})):o.results.set(e,{id:e,status:`error`,elapsed_ms:0,error:a.error,request_error:a.retryable?a.ids:void 0})}return o}function r5(e,t){return e.queryKey[0]===`variables`&&e.queryKey[1]===t}function i5(e,t,n,r,i,a=!1){let o=!!t.variables?.some(e=>e.kind===`query`),s=ot({queryKey:X8(e,t,n,r),queryFn:async({signal:e})=>{let a=await i({dashboard:t,time:n,vars:r},e);return Object.fromEntries((t.variables??[]).map(e=>[e.name,a[e.name]??(e.kind===`custom`?e.options?.map(e=>({value:e})):void 0)??[]]))},enabled:o,retry:a,staleTime:6e4,placeholderData:e=>e}),c=s.isPlaceholderData?void 0:s.data,l=s.isError||(t.variables??[]).every(e=>e.kind!==`query`||r[e.name]!==void 0&&r[e.name]!==`$__all`&&(e.multi||!Array.isArray(r[e.name])||r[e.name].length>0)||!!e.default||e.include_all||c?.[e.name]!==void 0);return{...s,currentData:c,ready:l}}function a5(e){return t=>e5(t,e)||r5(t,`dashboard-${e}`)}function o5({id:e,currentVersion:t,opened:n,onClose:r,onRestored:i}){let a=et(),[o,s]=(0,V.useState)(),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(n),m=(0,V.useRef)(0),h=(0,V.useRef)(n);h.current=n;let g=(0,V.useRef)(!1),_=(0,V.useRef)(!1),v=(0,V.useRef)(i);v.current=i,(0,V.useEffect)(()=>(_.current=!0,()=>{_.current=!1}),[]);let y=De({mutationFn:({version:t})=>He(e,t),retry:!1,onSuccess:(t,{version:n,generation:r})=>{a.cancelQueries({queryKey:[`dashboard`,e],exact:!0}),a.cancelQueries({predicate:a5(e)}),a.cancelQueries({queryKey:[`exemplars`]}),a.cancelQueries({queryKey:[`drill-trace`]}),a.setQueryData([`dashboard`,e],t),a.invalidateQueries({predicate:a5(e),refetchType:`none`}),_.current&&(h.current&&r===m.current&&l(`Restored v${n} as v${t.version}`),v.current(t)),a.invalidateQueries({queryKey:Pe}),a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}),a.invalidateQueries({queryKey:[`exemplars`],refetchType:`none`}),a.invalidateQueries({queryKey:[`drill-trace`],refetchType:`none`})},onError:t=>{t instanceof Me&&t.code===`dashboard_version_not_found`&&a.invalidateQueries({queryKey:[`dashboard-versions`,e]})},onSettled:()=>{g.current=!1,_.current&&d(!1)}}),b=()=>{m.current++,y.reset(),l(``)};(0,V.useEffect)(()=>{if(n){p(!0);return}m.current++,y.reset(),l(``),a.cancelQueries({queryKey:[`dashboard-versions`,e]}),a.cancelQueries({queryKey:[`dashboard-version`,e]})},[n,e,a,y.reset]);let x=(0,V.useRef)(t);return(0,V.useEffect)(()=>{x.current!==t&&(x.current=t,a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}))},[t,e,a]),(0,H.jsx)($e,{opened:n,onClose:()=>{b(),r()},onExitTransitionEnd:()=>p(!1),title:`Version history`,position:`right`,size:`xl`,children:(n||f)&&(0,H.jsx)(s5,{id:e,opened:n,currentVersion:t,selected:o,onSelect:e=>{b(),s(e)},pending:u,error:y.error,failedVersion:y.variables?.version,success:c,onRestore:e=>{g.current||(g.current=!0,d(!0),l(``),y.mutate({version:e,generation:m.current}))}})})}function s5({id:e,opened:t,currentVersion:n,selected:r,onSelect:i,pending:a,error:s,failedVersion:c,success:l,onRestore:u}){let d=ot({queryKey:[`dashboard-versions`,e],queryFn:({signal:t})=>bt(e,t),enabled:t,retry:!1}),f=r??d.data?.[0]?.version,p=ot({queryKey:[`dashboard-version`,e,f],queryFn:({signal:t})=>Fe(e,f,t),enabled:t&&f!==void 0,retry:!1});return(0,H.jsxs)(S,{gap:`md`,"data-version-history":!0,children:[(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:`Inspect saved specs and changes. Restoring adds a new version.`}),l&&(0,H.jsx)(ee,{color:`ok`,role:`status`,children:l}),s&&c===f&&(0,H.jsx)(d5,{error:s,version:f}),(0,H.jsxs)(o,{mih:160,children:[d.isPending&&(0,H.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{size:`sm`,children:`Loading history…`})]}),d.error&&(0,H.jsxs)(ee,{color:`bad`,title:`History unavailable`,children:[d.error.message,(0,H.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void d.refetch(),children:`Retry history`})]}),d.data?.length===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No versions available.`}),!!d.data?.length&&(0,H.jsx)(pe,{h:200,type:`auto`,children:(0,H.jsx)(S,{gap:`xs`,pr:`sm`,role:`list`,"aria-label":`Saved versions`,children:d.data.map(e=>(0,H.jsxs)(B,{role:`listitem`,withBorder:!0,p:`xs`,radius:`sm`,style:{borderColor:f===e.version?`var(--mantine-color-brand-filled)`:void 0},children:[(0,H.jsxs)(y,{justify:`space-between`,gap:`xs`,children:[(0,H.jsxs)(C,{variant:f===e.version?`light`:`subtle`,size:`compact-sm`,"aria-pressed":f===e.version,onClick:()=>i(e.version),children:[`Version `,e.version]}),e.version===n&&(0,H.jsx)(Ue,{color:`gray`,variant:`light`,tt:`none`,children:`Current`}),(0,H.jsx)(l5,{at:e.created_at})]}),(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,mt:4,children:[c5(e),` · `,e.message||`No edit message`]})]},e.version))})})]}),(0,H.jsx)(Ve,{role:`status`,"aria-live":`polite`,children:f===void 0?`Select a version.`:p.isFetching?`Loading version ${f}…`:p.error?`Version ${f} unavailable.`:`Version ${f} ready.`}),(0,H.jsxs)(o,{mih:280,"aria-busy":p.isFetching,children:[f!==void 0&&p.isPending&&(0,H.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{size:`sm`,children:`Loading version…`})]}),p.error&&(0,H.jsxs)(ee,{color:`bad`,title:p.error instanceof Me&&p.error.code===`dashboard_version_not_found`?`This version is no longer available`:`Version unavailable`,children:[p.error.message,(0,H.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void p.refetch(),children:`Retry version`})]}),p.data&&!p.error&&(0,H.jsx)(u5,{record:p.data,currentVersion:n,pending:a,onRestore:()=>u(p.data.dashboard.version)})]})]})}function c5(e){return e.author_kind===`agent`?`Agent`:e.author_kind===`user`?`You`:`System`}function l5({at:e}){let t=(Date.parse(e)-Date.now())/1e3,[n,r]=Math.abs(t)<60?[1,`second`]:Math.abs(t)<3600?[60,`minute`]:Math.abs(t)<86400?[3600,`hour`]:[86400,`day`];return(0,H.jsx)(T,{component:`time`,dateTime:e,title:ge(e),size:`xs`,c:`dimmed`,children:new Intl.RelativeTimeFormat(void 0,{numeric:`auto`}).format(Math.round(t/n),r)})}function u5({record:e,currentVersion:t,pending:n,onRestore:r}){let{dashboard:i}=e,a=ce(e);return(0,H.jsxs)(S,{gap:`sm`,"data-history-version":i.version,children:[(0,H.jsxs)(y,{justify:`space-between`,align:`flex-start`,children:[(0,H.jsxs)(o,{miw:0,children:[(0,H.jsxs)(I,{order:2,fz:`lg`,children:[i.name,` · v`,i.version]}),(0,H.jsxs)(T,{size:`sm`,c:`dimmed`,children:[c5(e),` · `,e.message||`No edit message`]}),(0,H.jsx)(l5,{at:e.created_at})]}),i.version===t?(0,H.jsx)(C,{size:`sm`,variant:`default`,disabled:!0,children:`Current version`}):(0,H.jsxs)(C,{size:`sm`,disabled:n,loading:n,onClick:r,children:[`Restore version `,i.version]})]}),i.description&&(0,H.jsx)(T,{size:`sm`,children:i.description}),e.changes_available?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Te,{labels:a}),!a.length&&!e.layout_changed&&(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:`No authored changes.`})]}):(0,H.jsx)(ee,{color:`warn`,title:`Changes unavailable`,children:`The preceding version is no longer retained. This saved spec is still available.`}),(0,H.jsxs)(T,{size:`sm`,c:`dimmed`,children:[`Read-only · `,i.spec.panels.length,` panels. Historical data is not queried.`]}),(0,H.jsxs)(pn,{variant:`contained`,children:[(0,H.jsxs)(pn.Item,{value:`spec`,children:[(0,H.jsx)(pn.Control,{children:`Spec`}),(0,H.jsx)(pn.Panel,{children:(0,H.jsx)(Re,{block:!0,tabIndex:0,style:{maxHeight:320,overflow:`auto`},children:JSON.stringify(i.spec,null,2)})})]}),(0,H.jsxs)(pn.Item,{value:`data`,children:[(0,H.jsx)(pn.Control,{children:`Data`}),(0,H.jsx)(pn.Panel,{children:(0,H.jsx)(S,{gap:`xs`,children:i.spec.panels.map(e=>(0,H.jsxs)(o,{children:[(0,H.jsxs)(T,{size:`sm`,fw:500,children:[e.title,` · `,e.viz]}),(0,H.jsx)(Re,{block:!0,tabIndex:0,children:e.content??e.sql??JSON.stringify(e.query??{},null,2)})]},e.id))})})]})]})]})}function d5({error:e,version:t}){let n=e instanceof Me?e.code:void 0,r=!(e instanceof Me)||e.status>=500?`Try again with the restore button.`:n===`invalid_spec`?`This saved spec is invalid. Review the fields below and choose another version.`:n===`dashboard_version_not_found`?`Reload history and choose a retained version.`:[`already_current`,`dashboard_version_conflict`,`conflict`].includes(n??``)?`This dashboard changed or its name conflicts. Reload history and choose another version.`:`Check your access and reload history.`;return(0,H.jsxs)(ee,{color:`bad`,title:`Restore of version ${t} failed`,children:[(0,H.jsx)(T,{size:`sm`,children:e.message}),e instanceof Me&&e.problems.length>0&&(0,H.jsx)(`ul`,{children:e.problems.map((e,t)=>(0,H.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))}),(0,H.jsx)(T,{size:`sm`,mt:`xs`,children:r})]})}function f5(e,t){let n=JSON.stringify([e.range,e.from,e.to]),r=(0,V.useRef)({search:e,onSearch:t,scope:n}),i=(0,V.useRef)(``),a=(0,V.useRef)(void 0),[o,s]=(0,V.useState)(!1);r.current.scope!==n&&(i.current!==`${e.from}/${e.to}`&&(a.current=void 0,o&&s(!1)),i.current=``),r.current={search:e,onSearch:t,scope:n};let c=(0,V.useCallback)(()=>{i.current=``,a.current=void 0,s(!1)},[]),l=(0,V.useCallback)(()=>{if(!a.current)return;let e=a.current;c(),r.current.onSearch({...r.current.search,...e},!1)},[c]);return{zoom:(0,V.useCallback)((e,t)=>{let n=la(e,t);if(!n)return;let o=r.current,c=`${n.from}/${n.to}`;o.search.from===n.from&&o.search.to===n.to||i.current===c||(a.current??={range:o.search.range,from:o.search.from,to:o.search.to},s(!0),i.current=c,o.onSearch({...o.search,range:void 0,...n},!1))},[]),reset:c,resetZoom:l,zoomed:o}}function p5({variables:e,vars:t,options:n,onChange:r}){return e.length===0?null:(0,H.jsx)(y,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard variables`,children:e.map(e=>{let i=Ji(e,t,n[e.name]),a=[...e.include_all?[{value:qi,label:`All`}]:[],...(n[e.name]??e.options?.map(e=>({value:e}))??[]).map(e=>({value:e.value,label:e.value}))],o=(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,ff:`monospace`,children:[`$`,e.name]});return e.kind===`constant`?(0,H.jsx)(je,{label:o,size:`xs`,value:e.value,readOnly:!0,w:160},e.name):e.kind===`text`?(0,H.jsx)(je,{label:o,size:`xs`,w:200,defaultValue:typeof i==`string`?i:``,onBlur:t=>r(e.name,t.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}},`${e.name}:${JSON.stringify(i)}`):e.multi?(0,H.jsx)(kr,{label:o,size:`xs`,w:260,searchable:!0,clearable:!0,data:a.filter(e=>e.value!==qi),value:Array.isArray(i)?i:i&&i!==`$__all`?[i]:[],placeholder:e.include_all?`All`:`None`,onChange:t=>r(e.name,t.length?t:e.include_all?qi:[])},e.name):(0,H.jsx)(Wr,{label:o,size:`xs`,w:220,searchable:!0,allowDeselect:!1,data:a,value:Array.isArray(i)?i[0]??null:i||null,onChange:t=>t!==null&&r(e.name,t)},e.name)})})}function m5(e,t,n=!1){let r=e.target;return t||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey&&e.key!==`?`||r instanceof Element&&r.closest(`input,textarea,select,[contenteditable]:not([contenteditable="false"]),[role="textbox"],[role="menu"]`)||r instanceof Element&&r.closest(`[role="dialog"]`)&&!(n&&r.closest(`[data-panel-fullscreen]`))?null:[`r`,`e`,`h`,`f`,`?`].includes(e.key)?e.key:null}function h5(e,t,n={}){let r=(0,V.useRef)({actions:t,options:n});r.current={actions:t,options:n},(0,V.useEffect)(()=>{let t=t=>{let n=e.current,i=t.target,{actions:a,options:o}=r.current;if(!n||!(i instanceof Element)||o.enabled===!1)return;let s=o.fullscreenScope?[...document.querySelectorAll(`[data-shortcut-scope]`)].find(e=>e.dataset.shortcutScope===o.fullscreenScope&&e.hasAttribute(`data-panel-fullscreen`)):void 0,c=n.contains(i)&&n.contains(document.activeElement),l=i===document.body&&document.activeElement===document.body,u=s?.contains(i)&&s.contains(document.activeElement);if(!c&&!l&&!u)return;let d=m5(t,!!(o.modalOpen||[...document.querySelectorAll(`[role="dialog"]`)].some(e=>e!==s)),!!s);if(!d||s&&![`r`,`f`,`?`].includes(d))return;let f=a[d];f&&(t.preventDefault(),f(i))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e])}function g5({opened:e,onClose:t,fullscreen:n=!1,enabled:r,onEnabled:i}){let a=[[`r`,`Refresh now`],...n?[]:[[`e`,`Toggle layout mode`],[`h`,`Open history`]],[`f`,n?`Exit full-screen`:`Open the focused panel in full-screen`],[`?`,`Open keyboard shortcuts`],[`Escape`,`Cancel a range, then leave the chart or close full-screen`]];return(0,H.jsx)(yt,{opened:e,onClose:t,title:`Keyboard shortcuts`,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,children:(0,H.jsxs)(S,{gap:`xs`,children:[(0,H.jsx)(oi,{label:`Single-key shortcuts`,checked:r,onChange:e=>i(e.currentTarget.checked)}),a.map(([e,t])=>(0,H.jsxs)(y,{gap:`sm`,children:[(0,H.jsx)(Xe,{children:e}),(0,H.jsx)(T,{size:`sm`,children:t})]},e)),!n&&(0,H.jsx)(T,{size:`sm`,children:`Focus a chart or a panel control before pressing f. Without a focused panel, f does nothing.`}),(0,H.jsx)(T,{size:`sm`,children:`Tab directly to a chart. Left/Right moves between points; Up/Down changes series at the same time or category. Home/End jumps to the first/last point. Enter drills or applies the panel filter. Comparison and Other values can be read even when selection is unavailable.`}),(0,H.jsx)(T,{size:`sm`,children:`On time charts, Shift+Left/Right extends a range and pauses auto-refresh. Review the shaded range and compact UTC label, then choose Zoom to range. Use the time picker after zooming for precise edits. Escape or Cancel cancels it and resumes refresh. The next Escape leaves the chart or closes full-screen. Reset zoom, Zoom out and browser Back preserve comparison and filters.`}),(0,H.jsxs)(T,{size:`sm`,children:[n?`In full-screen, r refreshes, f exits and ? opens help; e and h are inactive.`:`Shortcuts work in the dashboard.`,` Typing, menus and other dialogs or drawers pause shortcuts. Modifier shortcuts keep their browser behavior. Turning off single-key shortcuts keeps chart navigation and visible controls available.`]}),(0,H.jsx)(T,{size:`sm`,children:`The global / shortcut focuses the chat composer.`})]})})}function _5(e){let t=`fanout:single-key-shortcuts:`+e,n=()=>{try{return localStorage.getItem(t)!==`off`}catch{return!0}},[r,i]=(0,V.useState)(n);return(0,V.useEffect)(()=>{i(n())},[t]),(0,V.useEffect)(()=>{let e=e=>{e.key===t&&i(n())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[t]),{enabled:r,change:e=>{i(e);try{localStorage.setItem(t,e?`on`:`off`)}catch{}}}}function v5(e){let t=(0,V.useRef)(void 0),n=t=>[...e.current?.querySelectorAll(`[data-panel]`)??[]].find(e=>e.dataset.panel===t&&!e.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`));return(0,V.useEffect)(()=>{t.current&&!n(t.current.panel)&&(t.current=void 0)}),{remember(n){t.current=void 0;let r=document.activeElement;if(!(r instanceof HTMLElement)||!e.current?.contains(r)||r.closest(`[data-panel]`)?.dataset.panel!==n)return;let i=r.getAttribute(`data-panel-view`),a=r.getAttribute(`aria-label`),o=r.hasAttribute(`data-chart-plot`)?`[data-chart-plot]`:i?`[data-panel-view=${JSON.stringify(i)}]`:a?`[aria-label=${JSON.stringify(a)}]`:void 0;t.current={element:r,panel:n,selector:o}},restore(e){let r=t.current;if(t.current=void 0,r&&(e===void 0||r.panel===e)&&n(r.panel))return r.element.isConnected&&!r.element.closest(`[hidden]`)?r.element:r.selector?n(r.panel)?.querySelector(r.selector)??void 0:void 0}}}var y5={exemplars:qe,trace:Ie},b5={"5m":`15m`,"15m":`1h`,"1h":`3h`,"3h":`6h`,"6h":`12h`,"12h":`24h`,"24h":`2d`,"2d":`7d`,"7d":`30d`,"30d":`30d`};function x5({dashboardId:e,search:t,onSearch:n,onOpen:r}){let{agentAvailable:i,openChat:a}=se(),o=ot({queryKey:Pe,queryFn:Ze,staleTime:15e3});(0,V.useEffect)(()=>{!e&&o.data?.length&&r((o.data.find(e=>e.is_default)??o.data[0]).id,!0)},[e,o.data]);let s=ot({queryKey:[`dashboard`,e],queryFn:({signal:t})=>jt(e,t),enabled:!!e,retry:(e,t)=>!(t instanceof Me&&t.code===`not_found`)&&e<2});return!e&&o.error?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsx)(ee,{color:`bad`,title:`Dashboards could not be loaded`,children:o.error.message})}):!e&&o.data?.length===0?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,H.jsx)(I,{order:1,fz:24,children:`No dashboards yet`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`Create a dashboard to explore your services.`}),i&&(0,H.jsx)(C,{mt:`sm`,size:`sm`,onClick:()=>a(`Build me a dashboard for my services, showing request volume, latency, and errors. Ask me which services to monitor first.`),children:`Create with AI`})]})}):!e||s.isLoading?(0,H.jsxs)(ie,{mih:`50vh`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading your dashboard…`})]}):s.error instanceof Me&&s.error.code===`not_found`?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,H.jsx)(I,{order:1,fz:24,children:`This dashboard isn't here`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`The link may be out of date, or the dashboard may have been deleted.`}),o.data?.length?(0,H.jsx)(C,{mt:`sm`,variant:`default`,size:`sm`,onClick:()=>r((o.data.find(e=>e.is_default)??o.data[0]).id,!0),children:`Open your default dashboard`}):null]})}):s.error||!s.data?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsx)(T,{c:`dimmed`,size:`sm`,children:`Your dashboard is unavailable. Try refreshing.`})}):(0,H.jsx)(S5,{id:s.data.id,version:s.data.version,spec:s.data.spec,search:t,onSearch:n,agentAvailable:i,openChat:a},s.data.id)}function S5({id:e,version:t,spec:n,search:r,onSearch:i,agentAvailable:a,openChat:s}){let[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(!1),f=(0,V.useRef)(null),p=(0,V.useId)(),m=_5(tt().id),h=v5(f),[g,_]=(0,V.useState)(()=>new Set),v=(0,V.useCallback)((e,t)=>_(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r}),[]),b=et(),[x,w]=(0,V.useState)(),{zoom:E,reset:D,resetZoom:O,zoomed:k}=f5(r,i),A=gt(n,r),[j,M]=(0,V.useState)(A.refresh??`30s`),N=r.compare?r.compare===`1`:n.time.compare===`previous_period`,P=r.vars??{},F=i5(`dashboard-${e}`,n,A,P,Le,K8),L=(0,V.useMemo)(()=>Xi(n.variables,P,F.currentData),[n.variables,P,F.currentData]),[R,te]=(0,V.useState)(()=>window.innerWidth);(0,V.useEffect)(()=>{let e=0,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>te(window.innerWidth),300)};return window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t),window.clearTimeout(e)}},[]);let ne=(0,V.useMemo)(()=>{let e=Math.max(320,Math.min(R-64,1600));return Object.fromEntries(n.panels.map(t=>[t.id,e/12*(t.grid?.w??t.width??6)]))},[R,n]),[re,ie]=(0,V.useState)(()=>n.panels.map(e=>e.id)),z=t5({dashboardId:e,version:t,spec:n,time:A,vars:L,compare:N,widths:ne,visible:(0,V.useMemo)(()=>re.filter(e=>n.panels.some(t=>t.id===e)),[re,n.panels]),refresh:g.size?`off`:j,enabled:F.ready});(0,V.useEffect)(()=>{x===t&&b.refetchQueries({predicate:a5(e),type:`active`,stale:!0},{cancelRefetch:!1})},[x,t,e,b]);let ae=(0,V.useMemo)(()=>z.annotations?{...z.annotations,deploys:n.annotations?.deploys===!1?[]:z.annotations.deploys,anomalies:n.annotations?.anomalies===!1?[]:z.annotations.anomalies}:void 0,[z.annotations,n.annotations?.deploys,n.annotations?.anomalies]),B=F.error??z.error,oe=(e,t)=>{let n={...P};t===void 0?delete n[e]:n[e]=t,i({...r,vars:n},!0)},se=()=>i({...r,edit:r.edit===`1`?void 0:`1`}),ce=e=>{e&&h.remember(e),i({...r,view:e},e===void 0)};return h5(f,{r:()=>z.refetch(),e:se,h:()=>l(!0),"?":()=>d(!0),f:e=>{if(r.view){ce();return}let t=e.closest(`[data-panel]`)?.dataset.panel;t&&n.panels.some(e=>e.id===t)&&ce(t)}},{modalOpen:c||u||!!r.drill,fullscreenScope:r.view?p:void 0,enabled:m.enabled}),(0,H.jsxs)(o,{component:`main`,ref:f,"aria-label":`Dashboard`,maw:1600,mx:`auto`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:[(0,H.jsxs)(S,{gap:`sm`,mb:`md`,children:[(0,H.jsxs)(y,{justify:`space-between`,align:`flex-start`,wrap:`wrap`,gap:`sm`,children:[(0,H.jsxs)(o,{miw:0,children:[(0,H.jsx)(I,{order:1,fz:28,lts:`-0.02em`,children:n.name}),n.description&&(0,H.jsx)(T,{c:`dimmed`,size:`sm`,mt:2,children:n.description})]}),(0,H.jsx)(G8,{selecting:g.size>0,time:A,refresh:j,compare:N,editing:r.edit===`1`,fetching:z.fetching,updatedAt:z.updatedAt,onRange:e=>{D(),i({...r,range:e,from:void 0,to:void 0})},onAbsolute:(e,t)=>{D(),i({...r,range:void 0,from:e,to:t})},onZoomOut:()=>{if(A.from&&A.to){let e=Date.parse(A.from),t=Date.parse(A.to),n=(t-e)/2;i({...r,range:void 0,from:new Date(e-n).toISOString(),to:new Date(t+n).toISOString()})}else i({...r,range:b5[A.range??`1h`]??`1h`,from:void 0,to:void 0})},onRefresh:M,onRefreshNow:z.refetch,onCompare:e=>i({...r,compare:e?`1`:`0`},!0),onEdit:se,onHistory:()=>l(!0),onShortcuts:()=>d(!0)})]}),(0,H.jsx)(p5,{variables:n.variables??[],vars:P,options:F.data??{},onChange:oe}),Object.entries(P).filter(([,e])=>e!==`$__all`).length>0&&(0,H.jsx)(y,{gap:6,children:Object.entries(P).filter(([,e])=>e!==`$__all`).map(([e,t])=>(0,H.jsxs)(C,{size:`compact-xs`,variant:`light`,"aria-label":`$${e} = ${Array.isArray(t)?t.join(`, `):t} ×: remove filter`,onClick:()=>oe(e,void 0),children:[`$`,e,` = `,Array.isArray(t)?t.join(`, `):t,` ×`]},e))}),z.annotationError&&(0,H.jsx)(ee,{color:`warn`,title:`Annotations unavailable`,children:z.annotationError}),z.annotations?.truncated&&(0,H.jsx)(T,{size:`xs`,c:`warn`,role:`status`,children:`Annotation history is limited.`})]}),B&&(0,H.jsxs)(ee,{color:`bad`,icon:(0,H.jsx)(ke,{size:18,weight:`fill`}),mb:`md`,title:F.error?`Variables could not be loaded`:`Panels could not be loaded`,children:[B.message,B instanceof Me&&(0,H.jsx)(`ul`,{children:B.problems.map((e,t)=>(0,H.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))})]}),(0,H.jsx)(N8,{dashboardId:e,version:t,spec:n,vars:L,results:z.results,annotations:ae,fetching:z.fetching,fetchingIds:z.fetchingIds,staleAt:z.staleAt,time:{...A,compare:N?`previous_period`:void 0},onEditExit:()=>i({...r,edit:void 0}),editing:r.edit===`1`,view:r.view,canManage:!0,agentAvailable:a,onOpenChat:s,onRetry:z.retry,onVariable:oe,onZoom:E,zoomed:k,onZoomReset:O,onView:ce,onRangePending:v,shortcutScope:p,onShortcuts:()=>d(!0),overlayOpen:c||u||!!r.drill,returnViewFocus:h.restore,onVisible:ie,onPoint:(e,t)=>{let n=S8(e,z.results.get(e.id),t,P);n&&i({...r,vars:n.vars,drill:JSON.stringify(n.target)},!1)}}),(0,H.jsx)(H8,{client:y5,spec:n,time:A,vars:L,target:Mt(r.drill),onChange:e=>i({...r,drill:e?JSON.stringify(e):void 0},!1)}),(0,H.jsx)(o5,{id:e,currentVersion:t,opened:c,onClose:()=>l(!1),onRestored:e=>{w(e.version);let t=new Set(e.spec.panels.map(e=>e.id)),n=Mt(r.drill),a=r.view&&!t.has(r.view)?void 0:r.view,o=n&&!t.has(n.panel_id)?void 0:r.drill;(a!==r.view||o!==r.drill)&&i({...r,view:a,drill:o},!0)}}),(0,H.jsx)(g5,{opened:u,onClose:()=>d(!1),fullscreen:!!r.view,enabled:m.enabled,onEnabled:m.change})]})}export{Yi as i,W4 as n,V4 as r,x5 as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/panel-sql-editor-BFXSBGw8.js b/internal/ui/dist/assets/panel-sql-editor-Behd0nuD.js similarity index 99% rename from internal/ui/dist/assets/panel-sql-editor-BFXSBGw8.js rename to internal/ui/dist/assets/panel-sql-editor-Behd0nuD.js index 4ef63a64e..84a91c885 100644 --- a/internal/ui/dist/assets/panel-sql-editor-BFXSBGw8.js +++ b/internal/ui/dist/assets/panel-sql-editor-Behd0nuD.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,_ as i,c as a,d as o,f as s,p as c}from"./brand-DUaZkIz1.js";import{i as l,n as u,r as d}from"./page-CFdV4uPH.js";import{A as f,B as p,C as m,N as h,Q as g,T as _,W as v,jt as y,o as b}from"./index-CEp3GmPL.js";var x=n(e(),1),S=[],ee=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t>1;if(e=ee[r])t=r+1;else return!0;if(t==n)return!1}}function ne(e){return e>=127462&&e<=127487}var re=8205;function ie(e,t,n=!0,r=!0){return(n?ae:oe)(e,t,r)}function ae(e,t,n){if(t==e.length)return t;t&&ce(e.charCodeAt(t))&&le(e.charCodeAt(t-1))&&t--;let r=se(e,t);for(t+=ue(r);t=0&&ne(se(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function oe(e,t,n){for(;t>1;){let r=ae(e,t-2,n);if(r=56320&&e<57344}function le(e){return e>=55296&&e<56320}function ue(e){return e<65536?1:2}var C=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=w(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),fe.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=w(this,e,t);let n=[];return this.decompose(e,t,n,0),fe.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new ge(this),i=new ge(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new ge(this,e)}iterRange(e,t=this.length){return new _e(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ve(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new de(t):fe.from(de.split(t,[]))}},de=class e extends C{constructor(e,t=pe(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new ye(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(he(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=me(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=w(this,t,n);let i=me(this.text,me(r.text,he(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):fe.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=` +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,_ as i,c as a,d as o,f as s,p as c}from"./brand-DUaZkIz1.js";import{i as l,n as u,r as d}from"./page-Bq8j74s4.js";import{A as f,B as p,C as m,N as h,Q as g,T as _,W as v,jt as y,o as b}from"./index-DxHBLqHS.js";var x=n(e(),1),S=[],ee=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t>1;if(e=ee[r])t=r+1;else return!0;if(t==n)return!1}}function ne(e){return e>=127462&&e<=127487}var re=8205;function ie(e,t,n=!0,r=!0){return(n?ae:oe)(e,t,r)}function ae(e,t,n){if(t==e.length)return t;t&&ce(e.charCodeAt(t))&&le(e.charCodeAt(t-1))&&t--;let r=se(e,t);for(t+=ue(r);t=0&&ne(se(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function oe(e,t,n){for(;t>1;){let r=ae(e,t-2,n);if(r=56320&&e<57344}function le(e){return e>=55296&&e<56320}function ue(e){return e<65536?1:2}var C=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=w(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),fe.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=w(this,e,t);let n=[];return this.decompose(e,t,n,0),fe.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new ge(this),i=new ge(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new ge(this,e)}iterRange(e,t=this.length){return new _e(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ve(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new de(t):fe.from(de.split(t,[]))}},de=class e extends C{constructor(e,t=pe(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new ye(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(he(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=me(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=w(this,t,n);let i=me(this.text,me(r.text,he(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):fe.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=` `){[e,t]=w(this,e,t);let r=``;for(let i=0,a=0;i<=t&&ae&&a&&(r+=n),ei&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},fe=class e extends C{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=w(this,t,n),r.lines=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=` `){[e,t]=w(this,e,t);let r=``;for(let i=0,a=0;ie&&i&&(r+=n),ea&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new de(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof de&&c&&(n=u[u.length-1])instanceof de&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new de(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};C.empty=new de([``],0);function pe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function me(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a=n&&(c>r&&(s=s.slice(0,r-i)),i0?1:(e instanceof de?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof de?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(r instanceof de){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof de?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},_e=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new ge(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},ve=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(C.prototype[Symbol.iterator]=function(){return this.iter()},ge.prototype[Symbol.iterator]=_e.prototype[Symbol.iterator]=ve.prototype[Symbol.iterator]=function(){return this});var ye=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function w(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function T(e,t,n=!0,r=!0){return ie(e,t,n,r)}function be(e){return e>=56320&&e<57344}function xe(e){return e>=55296&&e<56320}function Se(e,t){let n=e.charCodeAt(t);if(!xe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return be(r)?(n-55296<<10)+(r-56320)+65536:n}function Ce(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function we(e){return e<65536?1:2}var Te=/\r\n?|\n/,E=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(E||={}),Ee=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return i+(e-r);i+=o}else{if(n!=E.Simple&&c>=e&&(n==E.TrackDel&&re||n==E.TrackBefore&&re))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n=0&&r<=t&&o>=e)return rt?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},De=class e extends Ee{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return ke(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return Ae(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length0&&Oe(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;os||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?C.of(l.split(r||Te)):l:C.empty,d=u.length;if(e==s&&d==0)return;eo&&D(i,e-o,-1),D(i,s-e,d),Oe(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;et&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function Oe(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function Ae(e,t,n,r=!1){let i=[],a=r?[]:null,o=new Me(e),s=new Me(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);D(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len=0&&e=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.lent||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var Me=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?C.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?C.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Ne=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return O.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return O.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!=`number`||typeof e.head!=`number`)throw RangeError(`Invalid JSON representation for SelectionRange`);return O.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},O=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>Ne.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;ie.from-t.from),n=t.indexOf(r);for(let r=1;ri.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function Pe(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var Fe=0,k=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=Fe++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:Ie),!!t.static,t.enables)}of(e){return new Le([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Le(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Le(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function Ie(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var Le=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=Fe++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||ze(e,c)){let r=t(e);if(a?!Re(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=Qe(o,c);if(this.dependencies.every(t=>t instanceof k?o.facet(t)===e.facet(t):t instanceof He?o.field(t,!1)==e.field(t,!1):!0)||(a?Re(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function Re(e,t,n){if(e.length!=t.length)return!1;for(let r=0;re[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;te===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(Ve).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(Ve),i=n.facet(Ve),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,Ve.of({field:this,create:e})]}get extension(){return this}},Ue={lowest:4,low:3,default:2,high:1,highest:0};function We(e){return t=>new Ke(t,e)}var Ge={highest:We(Ue.highest),high:We(Ue.high),default:We(Ue.default),low:We(Ue.low),lowest:We(Ue.lowest)},Ke=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},qe=class e{of(e){return new Je(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Je=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Ye=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of Xe(t,n,o))e instanceof He?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,Ie(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>Be(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function Xe(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof Je&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Je){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof Ke)a(e.inner,e.prec);else if(e instanceof He)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof Le)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,Ue.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,Ue.default),r.reduce((e,t)=>e.concat(t))}function Ze(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Qe(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var $e=k.define(),et=k.define({combine:e=>e.some(e=>e),static:!0}),tt=k.define({combine:e=>e.length?e[0]:void 0,static:!0}),nt=k.define(),rt=k.define(),it=k.define(),at=k.define({combine:e=>e.length?e[0]:!1}),ot=class{constructor(e,t){this.type=e,this.value=t}static define(){return new st}},st=class{of(e){return new ot(this,e)}},ct=class{constructor(e){this.map=e}of(e){return new A(this,e)}},A=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new ct(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};A.reconfigure=A.define(),A.appendConfig=A.define();var lt=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Pe(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};lt.time=ot.define(),lt.userEvent=ot.define(),lt.addToHistory=ot.define(),lt.remote=ot.define();function ut(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r=e[r]))a=e[r++],o=e[r++];else if(i=0;n--){let i=r[n](e);e=i instanceof lt?i:Array.isArray(i)&&i.length==1&&i[0]instanceof lt?i[0]:pt(t,_t(i),!1)}return e}function ht(e){let t=e.startState,n=t.facet(it),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=dt(r,ft(t,a,e.changes.newLength),!0))}return r==e?e:lt.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var gt=[];function _t(e){return e==null?gt:Array.isArray(e)?e:[e]}var vt=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(vt||={}),yt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,bt;try{bt=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function xt(e){if(bt)return bt.test(e);for(let t=0;t`€`&&(n.toUpperCase()!=n.toLowerCase()||yt.test(n)))return!0}return!1}function St(e){return t=>{if(!/\S/.test(t))return vt.Space;if(xt(t))return vt.Word;for(let n=0;n-1)return vt.Word;return vt.Other}}var j=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;ei.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(A.reconfigure)?(n=null,r=e.value):e.is(A.appendConfig)&&(n=null,r=_t(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Ye.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(et)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:O.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=_t(n.effects);for(let n=1;nn.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:O.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Ye.resolve(t.extensions||[],new Map),r=t.doc instanceof C?t.doc:C.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||Te)),i=t.selection?t.selection instanceof O?t.selection:O.single(t.selection.anchor,t.selection.head):O.single(0);return Pe(i,r.length),n.staticFacet(et)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||` diff --git a/internal/ui/dist/assets/settings-NQwuPzSG.js b/internal/ui/dist/assets/settings-BSIny0s-.js similarity index 99% rename from internal/ui/dist/assets/settings-NQwuPzSG.js rename to internal/ui/dist/assets/settings-BSIny0s-.js index 4fdfefc14..7f8e1cba0 100644 --- a/internal/ui/dist/assets/settings-NQwuPzSG.js +++ b/internal/ui/dist/assets/settings-BSIny0s-.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,M as i,_ as a,a as o,c as s,d as c,f as l,i as u,o as d,p as f,r as p,x as m,y as h}from"./brand-DUaZkIz1.js";import{t as g}from"./Tooltip-B3r3s_B9.js";import{n as _,r as v,t as y}from"./WarningCircle.es-DWFLwubM.js";import{At as b,Ft as x,L as S,Q as C,R as w,S as T,W as E,jt as D,z as O}from"./index-CEp3GmPL.js";var k=n(e(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j=t(),M={timeout:1e3};function N(e){let{children:t,timeout:n,value:r,...a}=i(`CopyButton`,M,e),o=A({timeout:n});return(0,j.jsx)(j.Fragment,{children:t({copy:()=>o.copy(r),copied:o.copied,...a})})}N.displayName=`@mantine/core/CopyButton`;var P=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),F=k.forwardRef((e,t)=>k.createElement(o,{ref:t,...e,weights:P}));F.displayName=`ArrowsClockwiseIcon`;var I=F,L=[`settings`,`ingest`],R=[`settings`,`oauth`,`connections`];function z(){let e=C(),t=E({queryKey:R,queryFn:()=>S(`/api/auth/oauth/connections`)}),[n,i]=(0,k.useState)(null),[o,u]=(0,k.useState)(``),p=_({onMutate:async()=>{u(``),await e.cancelQueries({queryKey:R})},mutationFn:async e=>{if(!(await O(`/api/auth/oauth/connections/${encodeURIComponent(e.client_id)}/revoke`,{method:`POST`})).ok)throw Error(`Fanout could not disconnect this agent. Try again.`)},onSuccess:(t,n)=>{e.setQueryData(R,e=>e&&{connections:e.connections.filter(e=>e.client_id!==n.client_id)}),i(null),u(`${n.client_name} disconnected.`)}});return(0,j.jsxs)(s,{gap:`sm`,children:[(0,j.jsxs)(r,{children:[(0,j.jsx)(d,{order:2,fz:22,lts:`-0.02em`,children:`Connected agents`}),(0,j.jsx)(l,{c:`dimmed`,size:`sm`,mt:2,children:`Agents you have authorized to access Fanout through MCP.`})]}),(0,j.jsx)(m,{withBorder:!0,radius:`lg`,p:`lg`,children:t.data?t.data.connections.length===0?(0,j.jsxs)(l,{c:`dimmed`,size:`sm`,children:[`No agents connected. `,(0,j.jsx)(v,{href:T.connect,target:`_blank`,rel:`noopener noreferrer`,inherit:!0,children:`Connect an agent over MCP`}),` to get started.`]}):(0,j.jsx)(s,{gap:`md`,children:t.data.connections.map(e=>(0,j.jsxs)(a,{justify:`space-between`,align:`center`,children:[(0,j.jsxs)(r,{style:{minWidth:0,overflowWrap:`anywhere`},children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:e.client_name}),(0,j.jsxs)(l,{size:`xs`,c:`dimmed`,children:[`Connected `,(0,j.jsx)(`time`,{dateTime:e.connected_at,children:new Date(e.connected_at).toLocaleDateString()})]})]}),(0,j.jsx)(c,{variant:`default`,size:`sm`,onClick:()=>{p.reset(),i(e)},disabled:p.isPending,children:`Disconnect`})]},e.client_id))}):t.isLoading?(0,j.jsx)(l,{c:`dimmed`,size:`sm`,role:`status`,children:`Loading connected agents…`}):(0,j.jsxs)(s,{gap:`sm`,align:`flex-start`,children:[(0,j.jsx)(f,{color:`bad`,radius:`md`,icon:(0,j.jsx)(y,{size:18,weight:`fill`}),children:`Fanout could not load your connected agents.`}),(0,j.jsx)(c,{size:`compact-sm`,variant:`light`,onClick:()=>void t.refetch(),children:`Try again`})]})}),(0,j.jsx)(l,{size:`sm`,c:`dimmed`,role:`status`,"aria-live":`polite`,children:o}),(0,j.jsx)(D,{opened:n!==null,onClose:()=>!p.isPending&&i(null),title:`Disconnect ${n?.client_name??`agent`}?`,centered:!0,radius:`md`,children:(0,j.jsxs)(s,{gap:`md`,children:[(0,j.jsx)(l,{size:`sm`,c:`dimmed`,children:`This agent loses access immediately. Your other agents and browser session stay connected. You can authorize the agent again to reconnect.`}),p.isError&&(0,j.jsx)(f,{color:`bad`,radius:`md`,icon:(0,j.jsx)(y,{size:18,weight:`fill`}),children:`Fanout could not disconnect this agent. Try again.`}),(0,j.jsxs)(a,{justify:`flex-end`,gap:`sm`,children:[(0,j.jsx)(c,{variant:`default`,size:`sm`,onClick:()=>{p.reset(),i(null)},disabled:p.isPending,children:`Cancel`}),(0,j.jsx)(c,{color:`bad`,size:`sm`,loading:p.isPending,onClick:()=>n&&p.mutate(n),children:`Disconnect`})]})]})})]})}function B(e,t){let n=e.trim();return t||/^https:\/\//i.test(n)||/:443$/.test(n)}function V(e,t,n){if(/^https?:\/\//i.test(e.trim()))try{let t=new URL(e);e=`${t.protocol}//${t.hostname}:${t.port||(t.protocol===`https:`?`443`:`80`)}`}catch{}let r=B(e,n)?``:` +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,M as i,_ as a,a as o,c as s,d as c,f as l,i as u,o as d,p as f,r as p,x as m,y as h}from"./brand-DUaZkIz1.js";import{t as g}from"./Tooltip-B3r3s_B9.js";import{n as _,r as v,t as y}from"./WarningCircle.es-BIbVHGEb.js";import{At as b,Ft as x,L as S,Q as C,R as w,S as T,W as E,jt as D,z as O}from"./index-DxHBLqHS.js";var k=n(e(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j=t(),M={timeout:1e3};function N(e){let{children:t,timeout:n,value:r,...a}=i(`CopyButton`,M,e),o=A({timeout:n});return(0,j.jsx)(j.Fragment,{children:t({copy:()=>o.copy(r),copied:o.copied,...a})})}N.displayName=`@mantine/core/CopyButton`;var P=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),F=k.forwardRef((e,t)=>k.createElement(o,{ref:t,...e,weights:P}));F.displayName=`ArrowsClockwiseIcon`;var I=F,L=[`settings`,`ingest`],R=[`settings`,`oauth`,`connections`];function z(){let e=C(),t=E({queryKey:R,queryFn:()=>S(`/api/auth/oauth/connections`)}),[n,i]=(0,k.useState)(null),[o,u]=(0,k.useState)(``),p=_({onMutate:async()=>{u(``),await e.cancelQueries({queryKey:R})},mutationFn:async e=>{if(!(await O(`/api/auth/oauth/connections/${encodeURIComponent(e.client_id)}/revoke`,{method:`POST`})).ok)throw Error(`Fanout could not disconnect this agent. Try again.`)},onSuccess:(t,n)=>{e.setQueryData(R,e=>e&&{connections:e.connections.filter(e=>e.client_id!==n.client_id)}),i(null),u(`${n.client_name} disconnected.`)}});return(0,j.jsxs)(s,{gap:`sm`,children:[(0,j.jsxs)(r,{children:[(0,j.jsx)(d,{order:2,fz:22,lts:`-0.02em`,children:`Connected agents`}),(0,j.jsx)(l,{c:`dimmed`,size:`sm`,mt:2,children:`Agents you have authorized to access Fanout through MCP.`})]}),(0,j.jsx)(m,{withBorder:!0,radius:`lg`,p:`lg`,children:t.data?t.data.connections.length===0?(0,j.jsxs)(l,{c:`dimmed`,size:`sm`,children:[`No agents connected. `,(0,j.jsx)(v,{href:T.connect,target:`_blank`,rel:`noopener noreferrer`,inherit:!0,children:`Connect an agent over MCP`}),` to get started.`]}):(0,j.jsx)(s,{gap:`md`,children:t.data.connections.map(e=>(0,j.jsxs)(a,{justify:`space-between`,align:`center`,children:[(0,j.jsxs)(r,{style:{minWidth:0,overflowWrap:`anywhere`},children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:e.client_name}),(0,j.jsxs)(l,{size:`xs`,c:`dimmed`,children:[`Connected `,(0,j.jsx)(`time`,{dateTime:e.connected_at,children:new Date(e.connected_at).toLocaleDateString()})]})]}),(0,j.jsx)(c,{variant:`default`,size:`sm`,onClick:()=>{p.reset(),i(e)},disabled:p.isPending,children:`Disconnect`})]},e.client_id))}):t.isLoading?(0,j.jsx)(l,{c:`dimmed`,size:`sm`,role:`status`,children:`Loading connected agents…`}):(0,j.jsxs)(s,{gap:`sm`,align:`flex-start`,children:[(0,j.jsx)(f,{color:`bad`,radius:`md`,icon:(0,j.jsx)(y,{size:18,weight:`fill`}),children:`Fanout could not load your connected agents.`}),(0,j.jsx)(c,{size:`compact-sm`,variant:`light`,onClick:()=>void t.refetch(),children:`Try again`})]})}),(0,j.jsx)(l,{size:`sm`,c:`dimmed`,role:`status`,"aria-live":`polite`,children:o}),(0,j.jsx)(D,{opened:n!==null,onClose:()=>!p.isPending&&i(null),title:`Disconnect ${n?.client_name??`agent`}?`,centered:!0,radius:`md`,children:(0,j.jsxs)(s,{gap:`md`,children:[(0,j.jsx)(l,{size:`sm`,c:`dimmed`,children:`This agent loses access immediately. Your other agents and browser session stay connected. You can authorize the agent again to reconnect.`}),p.isError&&(0,j.jsx)(f,{color:`bad`,radius:`md`,icon:(0,j.jsx)(y,{size:18,weight:`fill`}),children:`Fanout could not disconnect this agent. Try again.`}),(0,j.jsxs)(a,{justify:`flex-end`,gap:`sm`,children:[(0,j.jsx)(c,{variant:`default`,size:`sm`,onClick:()=>{p.reset(),i(null)},disabled:p.isPending,children:`Cancel`}),(0,j.jsx)(c,{color:`bad`,size:`sm`,loading:p.isPending,onClick:()=>n&&p.mutate(n),children:`Disconnect`})]})]})})]})}function B(e,t){let n=e.trim();return t||/^https:\/\//i.test(n)||/:443$/.test(n)}function V(e,t,n){if(/^https?:\/\//i.test(e.trim()))try{let t=new URL(e);e=`${t.protocol}//${t.hostname}:${t.port||(t.protocol===`https:`?`443`:`80`)}`}catch{}let r=B(e,n)?``:` tls: insecure: true`;return`exporters: otlp/fanout: diff --git a/internal/ui/dist/index.html b/internal/ui/dist/index.html index 1d36f71d5..2c56cd39b 100644 --- a/internal/ui/dist/index.html +++ b/internal/ui/dist/index.html @@ -21,7 +21,7 @@ document.documentElement.setAttribute("data-mantine-color-scheme", computed); } catch (e) {} - + diff --git a/justfile b/justfile index c3f70c0df..804c8a9a1 100644 --- a/justfile +++ b/justfile @@ -198,8 +198,13 @@ ui-boundaries-check: # Audit the one locked browser graph. GHSA-vfj7-8cjw-p6xm reaches host # through vite-plugin-singlefile > micromatch at build time, on our own globs. # Drop this exception when a patched braces release is available. +# GHSA-mrhx-c7xc-m3w5 remains only in the zod 3 copy that @ag-ui/client and +# @ag-ui/proto require; zod 3 has no patched release. In the browser it parses +# events from Fanout's own authenticated /api/agent/runs, so the worst case is +# the user's own tab running out of memory. Drop this exception when AG-UI +# moves to zod 4.6.6 or later. ui-audit: - cd ui/host && bun audit --ignore=GHSA-vfj7-8cjw-p6xm + cd ui/host && bun audit --ignore=GHSA-vfj7-8cjw-p6xm --ignore=GHSA-mrhx-c7xc-m3w5 # Compare temporary builds without requiring clean or committed embeds. ui-check: diff --git a/ui/host/bun.lock b/ui/host/bun.lock index d7720f336..b70c4a67c 100644 --- a/ui/host/bun.lock +++ b/ui/host/bun.lock @@ -42,7 +42,7 @@ "@types/react-dom": "19.3.0", "@vitejs/plugin-react": "6.1.2", "axe-core": "4.14.0", - "happy-dom": "20.14.5", + "happy-dom": "21.0.4", "knip": "6.41.0", "typescript": "7.0.2", "vite": "8.3.4", @@ -517,7 +517,7 @@ "get-tsconfig": ["get-tsconfig@4.14.3", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-++QEw4DIY7WGoukz+/+A/8dGYPT9l9yIadnmSgZ8Rjr3YVSVDipQSO9CdnJo9ePqFqUUqh+wk9uIaoiAwsiPkA=="], - "happy-dom": ["happy-dom@20.14.5", "", { "dependencies": { "@types/node": ">=20.0.0", "@types/whatwg-mimetype": "^3.0.2", "@types/ws": "^8.18.1", "buffer-image-size": "^0.6.4", "entities": "^7.0.1", "whatwg-mimetype": "^3.0.0", "ws": "^8.21.0" } }, "sha512-x/RzkpWO40bTjIoT30iQtt64FLLmH/iRcUCN2X//bLx7H3ifkdfPXyqsro/OYtqzIAhiLMMA7mmiOR9C3NOKjQ=="], + "happy-dom": ["happy-dom@21.0.4", "", { "dependencies": { "@types/node": ">=20.0.0", "@types/whatwg-mimetype": "^3.0.2", "@types/ws": "^8.18.1", "buffer-image-size": "^0.6.4", "entities": "^7.0.1", "whatwg-mimetype": "^3.0.0", "ws": "^8.21.0" } }, "sha512-tFm+GaLBgo6o0awHnvHaNoraVo27qJ+2tZEtZ+cIa08hXbeitrxAJajLI05hsUy/2/YTKcUjQYzHe5mCcraLBw=="], "hast-util-to-jsx-runtime": ["hast-util-to-jsx-runtime@2.3.6", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "hast-util-whitespace": "^3.0.0", "mdast-util-mdx-expression": "^2.0.0", "mdast-util-mdx-jsx": "^3.0.0", "mdast-util-mdxjs-esm": "^2.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "style-to-js": "^1.0.0", "unist-util-position": "^5.0.0", "vfile-message": "^4.0.0" } }, "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg=="], @@ -873,7 +873,7 @@ "yaml": ["yaml@2.9.1", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw=="], - "zod": ["zod@4.6.5", "", {}, "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q=="], + "zod": ["zod@4.6.6", "", {}, "sha512-4UmzQUF5fxvfcYHlbjBmejU+w+hbDnWFx4aS8kBx7nPBHcO2SqPbpAG8snbdg+Xse4pRefR98hgjFgIMCI/UhA=="], "zrender": ["zrender@6.1.0", "", { "dependencies": { "tslib": "2.3.0" } }, "sha512-oEGMDB6pOP2S6OwRR4PdVv610zrjnA3Bh+JnSG12fYJlBKjtNAoEb5fSUoCOOINlH96I2fU38/A2UpRKs67xYQ=="], diff --git a/ui/host/package.json b/ui/host/package.json index 8fc38e11b..0824861ab 100644 --- a/ui/host/package.json +++ b/ui/host/package.json @@ -53,7 +53,7 @@ "@types/react-dom": "19.3.0", "@vitejs/plugin-react": "6.1.2", "axe-core": "4.14.0", - "happy-dom": "20.14.5", + "happy-dom": "21.0.4", "knip": "6.41.0", "typescript": "7.0.2", "vite": "8.3.4",