@inspectr/app 1.8.0 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/_astro/abap-Bs8kvjsq.CRCWOmpq.js +1 -0
  2. package/dist/_astro/apex-Dspwrl5m.DnsZk_dE.js +1 -0
  3. package/dist/_astro/azcli-k1BiOau1.1IWB1ccx.js +1 -0
  4. package/dist/_astro/bat-BIP72KWc.DPkNLes8.js +1 -0
  5. package/dist/_astro/bicep-VhQeYhS3.BgaUVETf.js +2 -0
  6. package/dist/_astro/cameligo-DnuAXtHg.CGrWLZr3.js +1 -0
  7. package/dist/_astro/{client.DGHkvVry.js → client.DyG9qce3.js} +1 -1
  8. package/dist/_astro/clojure-BAuDPsal.D9WOWImG.js +1 -0
  9. package/dist/_astro/coffee-BV06qSnj.B7EJu28W.js +1 -0
  10. package/dist/_astro/cpp-Cz8Jeyrf.SEyurbux.js +1 -0
  11. package/dist/_astro/csharp-F6hhlXFb.BoL64M5l.js +1 -0
  12. package/dist/_astro/csp-KzlEHCyI.C46ZqvIl.js +1 -0
  13. package/dist/_astro/css-e4FKntZ3.DQU6DXDx.js +3 -0
  14. package/dist/_astro/cssMode-CCxwJWiv.DYoQASZ6.js +4 -0
  15. package/dist/_astro/cypher-CpvDGKRr.D84EuPTj.js +1 -0
  16. package/dist/_astro/dart-DdHeFWR0.D8lhlL1r.js +1 -0
  17. package/dist/_astro/dockerfile-aoNXDcio.DLk6rpji.js +1 -0
  18. package/dist/_astro/ecl-C4Q0DYuA.BO6FnfXk.js +1 -0
  19. package/dist/_astro/editor.main-CP-oXbVe.BaJawuSL.js +725 -0
  20. package/dist/_astro/elixir-C9X42b0T.BRjLKONM.js +1 -0
  21. package/dist/_astro/flow9-Bff42pfB.Cac8vKd7.js +1 -0
  22. package/dist/_astro/freemarker2-BZveqxNO.Dy7ZsiSn.js +3 -0
  23. package/dist/_astro/fsharp-C6vPAsHG.fd1GTHhf.js +1 -0
  24. package/dist/_astro/go-DEr8zx9f.O9LJTZXk.js +1 -0
  25. package/dist/_astro/graphql-BiNBBRFh.LQdxqEYJ.js +1 -0
  26. package/dist/_astro/handlebars-DFLvXTZ8.DDIKN5Gi.js +1 -0
  27. package/dist/_astro/hcl-2T9lKuFg.DxDQ3s82.js +1 -0
  28. package/dist/_astro/html-DxXqfwFE.BXqtZ7lN.js +1 -0
  29. package/dist/_astro/htmlMode-C9gIo-LK.CmrXlwLH.js +4 -0
  30. package/dist/_astro/{index.CDCJvWuM.js → index.46Y7ScJG.js} +6 -6
  31. package/dist/_astro/index.DWiP4IWs.css +1 -0
  32. package/dist/_astro/ini-CZGtssYM.BvajGCUy.js +1 -0
  33. package/dist/_astro/java-B260NeH3.SYsfObOQ.js +1 -0
  34. package/dist/_astro/javascript-CYYD6pGr.D7jAauD3.js +1 -0
  35. package/dist/_astro/jsonMode-jVbIoPc6.BLXUoYNj.js +10 -0
  36. package/dist/_astro/julia-kuNLM9c5.DQXNmw_w.js +1 -0
  37. package/dist/_astro/kotlin-Bz6kAefA.qQ0MG-9I.js +1 -0
  38. package/dist/_astro/less-AZUtS89I.GGFNNJHn.js +2 -0
  39. package/dist/_astro/lexon-BcmgnyRb.Canl7DCW.js +1 -0
  40. package/dist/_astro/liquid-PYsubg5u.C6CW5d1t.js +1 -0
  41. package/dist/_astro/lua-Dz1RbATg.D28Ae8-K.js +1 -0
  42. package/dist/_astro/m3-CIMooLFn.DPitgjJI.js +1 -0
  43. package/dist/_astro/markdown-C1BsCK9P.B811l8j2.js +1 -0
  44. package/dist/_astro/mdx-DRJsmowz.Cwrug6Dd.js +1 -0
  45. package/dist/_astro/mips-BovsnfLQ.CdjsipkG.js +1 -0
  46. package/dist/_astro/msdax-CiRB2ZB-.CYqgjx_P.js +1 -0
  47. package/dist/_astro/mysql-BwdpPE19.BHd6q0vd.js +1 -0
  48. package/dist/_astro/objective-c-D4nfHfso.B1aVtJYH.js +1 -0
  49. package/dist/_astro/pascal--j5-PYtz.BhNW15KB.js +1 -0
  50. package/dist/_astro/pascaligo-C7TcJxNL.5jv8CcQD.js +1 -0
  51. package/dist/_astro/perl-BzEWqUb5.DlYyT36c.js +1 -0
  52. package/dist/_astro/pgsql-B_KZ0mGX.Dy0bjov7.js +1 -0
  53. package/dist/_astro/php-A19QHzQV.120yhfDK.js +1 -0
  54. package/dist/_astro/pla-COeKY1hA.CjnFlu4u.js +1 -0
  55. package/dist/_astro/postiats-BfMp7zJL.CQpG440k.js +1 -0
  56. package/dist/_astro/powerquery-B0TS_5Gb.DdJtto1Z.js +1 -0
  57. package/dist/_astro/powershell-5jSbKdYB.Bu_VLpJB.js +1 -0
  58. package/dist/_astro/protobuf-YgnOutn3.IBS6jZEB.js +2 -0
  59. package/dist/_astro/pug-DLej6kn5.kFxLfcjb.js +1 -0
  60. package/dist/_astro/python-M8MItOfu.Bc7fY0-x.js +1 -0
  61. package/dist/_astro/qsharp-AhjqtSHB.q7JyzKFN.js +1 -0
  62. package/dist/_astro/r-D-F4P80w.BIFz-_sK.js +1 -0
  63. package/dist/_astro/razor-CkROrZip.nLGEwVIE.js +1 -0
  64. package/dist/_astro/redis-hwwIlMnV.CHOsPHWR.js +1 -0
  65. package/dist/_astro/redshift-Bcm_kjEG.CBifECDb.js +1 -0
  66. package/dist/_astro/restructuredtext-CrdzfPP-.CghPJEOS.js +1 -0
  67. package/dist/_astro/ruby-QC2UNm1s.CYWGW-b1.js +1 -0
  68. package/dist/_astro/rust-5aqiQ3L5.DMDD0SHb.js +1 -0
  69. package/dist/_astro/sb-B1g1ZfLJ.BYAiYHFx.js +1 -0
  70. package/dist/_astro/scala-C2U4R5Gb.Bqvq8jcR.js +1 -0
  71. package/dist/_astro/scheme-DeFRbslr.Dhb-2j9p.js +1 -0
  72. package/dist/_astro/scss-RSTCiCmI.CTwUZ5N7.js +3 -0
  73. package/dist/_astro/shell-BpF-iNu8.CsDZo4DB.js +1 -0
  74. package/dist/_astro/solidity-C00r2mbQ.CME5AdoB.js +1 -0
  75. package/dist/_astro/sophia-DVW5ZKDB.RYC1BQQz.js +1 -0
  76. package/dist/_astro/sparql-B0nmpxeX.KEyrF7De.js +1 -0
  77. package/dist/_astro/sql-CJwKPERn.BdTr02Mf.js +1 -0
  78. package/dist/_astro/st-DPlKG5DT.C7iG7M4S.js +1 -0
  79. package/dist/_astro/swift-YZBAbVHV.D7IUmUK8.js +1 -0
  80. package/dist/_astro/systemverilog-CDQSaH63.DgMryOEJ.js +1 -0
  81. package/dist/_astro/tcl-Dlu8sp6Q.PloMZuKG.js +1 -0
  82. package/dist/_astro/tsMode-D1me_v4f.DS1Lo27t.js +11 -0
  83. package/dist/_astro/twig-C5TO7-kw.BfRIq3la.js +1 -0
  84. package/dist/_astro/typescript-D8U3Pc3R.CaTpGQaM.js +1 -0
  85. package/dist/_astro/typespec-BsmjDEu7.ckCBmM_m.js +1 -0
  86. package/dist/_astro/ui.DLFhzLPw.js +188 -0
  87. package/dist/_astro/ui.DTVtizjN.js +1 -0
  88. package/dist/_astro/vb-ChHvIDrk.BwAE3J76.js +1 -0
  89. package/dist/_astro/wgsl-XEp1ju8c.B_1kOXbF.js +298 -0
  90. package/dist/_astro/xml-CTIvZv70.6rRcWBeI.js +1 -0
  91. package/dist/_astro/yaml-BgbINe9U.CzB3LZHn.js +1 -0
  92. package/dist/index.html +1 -1
  93. package/package.json +2 -2
  94. package/dist/_astro/index.BI4u68pT.css +0 -1
  95. package/dist/_astro/ui.wB53HS6E.js +0 -187
@@ -1,187 +0,0 @@
1
- import{r as bF,g as yF,v as x,a as m,Z as Xs}from"./index.CDCJvWuM.js";var Qt=bF();const xF=yF(Qt);var O9={},ld=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var aS={exports:{}},Ru={},oS;function vF(){if(oS)return Ru;oS=1;var e=x,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(l,c,u){var d,f={},p=null,h=null;u!==void 0&&(p=""+u),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(h=c.ref);for(d in c)n.call(c,d)&&!o.hasOwnProperty(d)&&(f[d]=c[d]);if(l&&l.defaultProps)for(d in c=l.defaultProps,c)f[d]===void 0&&(f[d]=c[d]);return{$$typeof:t,type:l,key:p,ref:h,props:f,_owner:a.current}}return Ru.Fragment=r,Ru.jsx=s,Ru.jsxs=s,Ru}var sS;function kF(){return sS||(sS=1,aS.exports=vF()),aS.exports}var i=kF(),pw={exports:{}},wF=pw.exports,iS;function jF(){return iS||(iS=1,function(e,t){((r,n)=>{e.exports=n()})(wF,function(){var r=function(j,S){return(r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(P,_){P.__proto__=_}:function(P,_){for(var B in _)Object.prototype.hasOwnProperty.call(_,B)&&(P[B]=_[B])}))(j,S)},n=function(){return(n=Object.assign||function(j){for(var S,P=1,_=arguments.length;P<_;P++)for(var B in S=arguments[P])Object.prototype.hasOwnProperty.call(S,B)&&(j[B]=S[B]);return j}).apply(this,arguments)};function a(j,S,P){for(var _,B=0,q=S.length;B<q;B++)!_&&B in S||((_=_||Array.prototype.slice.call(S,0,B))[B]=S[B]);return j.concat(_||Array.prototype.slice.call(S))}var o=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:ld,s=Object.keys,l=Array.isArray;function c(j,S){return typeof S=="object"&&s(S).forEach(function(P){j[P]=S[P]}),j}typeof Promise>"u"||o.Promise||(o.Promise=Promise);var u=Object.getPrototypeOf,d={}.hasOwnProperty;function f(j,S){return d.call(j,S)}function p(j,S){typeof S=="function"&&(S=S(u(j))),(typeof Reflect>"u"?s:Reflect.ownKeys)(S).forEach(function(P){g(j,P,S[P])})}var h=Object.defineProperty;function g(j,S,P,_){h(j,S,c(P&&f(P,"get")&&typeof P.get=="function"?{get:P.get,set:P.set,configurable:!0}:{value:P,configurable:!0,writable:!0},_))}function b(j){return{from:function(S){return j.prototype=Object.create(S.prototype),g(j.prototype,"constructor",j),{extend:p.bind(null,j.prototype)}}}}var y=Object.getOwnPropertyDescriptor,v=[].slice;function k(j,S,P){return v.call(j,S,P)}function N(j,S){return S(j)}function w(j){if(!j)throw new Error("Assertion Failed")}function E(j){o.setImmediate?setImmediate(j):setTimeout(j,0)}function C(j,S){if(typeof S=="string"&&f(j,S))return j[S];if(!S)return j;if(typeof S!="string"){for(var P=[],_=0,B=S.length;_<B;++_){var q=C(j,S[_]);P.push(q)}return P}var Z,Q=S.indexOf(".");return Q===-1||(Z=j[S.substr(0,Q)])==null?void 0:C(Z,S.substr(Q+1))}function O(j,S,P){if(j&&S!==void 0&&!("isFrozen"in Object&&Object.isFrozen(j)))if(typeof S!="string"&&"length"in S){w(typeof P!="string"&&"length"in P);for(var _=0,B=S.length;_<B;++_)O(j,S[_],P[_])}else{var q,Z,Q=S.indexOf(".");Q!==-1?(q=S.substr(0,Q),(Q=S.substr(Q+1))===""?P===void 0?l(j)&&!isNaN(parseInt(q))?j.splice(q,1):delete j[q]:j[q]=P:O(Z=(Z=j[q])&&f(j,q)?Z:j[q]={},Q,P)):P===void 0?l(j)&&!isNaN(parseInt(S))?j.splice(S,1):delete j[S]:j[S]=P}}function D(j){var S,P={};for(S in j)f(j,S)&&(P[S]=j[S]);return P}var A=[].concat;function M(j){return A.apply([],j)}var X="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(M([8,16,32,64].map(function(j){return["Int","Uint","Float"].map(function(S){return S+j+"Array"})}))).filter(function(j){return o[j]}),I=new Set(X.map(function(j){return o[j]})),T=null;function R(j){return T=new WeakMap,j=function S(P){if(!P||typeof P!="object")return P;var _=T.get(P);if(_)return _;if(l(P)){_=[],T.set(P,_);for(var B=0,q=P.length;B<q;++B)_.push(S(P[B]))}else if(I.has(P.constructor))_=P;else{var Z,Q=u(P);for(Z in _=Q===Object.prototype?{}:Object.create(Q),T.set(P,_),P)f(P,Z)&&(_[Z]=S(P[Z]))}return _}(j),T=null,j}var L={}.toString;function F(j){return L.call(j).slice(8,-1)}var V=typeof Symbol<"u"?Symbol.iterator:"@@iterator",H=typeof V=="symbol"?function(j){var S;return j!=null&&(S=j[V])&&S.apply(j)}:function(){return null};function $(j,S){S=j.indexOf(S),0<=S&&j.splice(S,1)}var z={};function W(j){var S,P,_,B;if(arguments.length===1){if(l(j))return j.slice();if(this===z&&typeof j=="string")return[j];if(B=H(j))for(P=[];!(_=B.next()).done;)P.push(_.value);else{if(j==null)return[j];if(typeof(S=j.length)!="number")return[j];for(P=new Array(S);S--;)P[S]=j[S]}}else for(S=arguments.length,P=new Array(S);S--;)P[S]=arguments[S];return P}var U=typeof Symbol<"u"?function(j){return j[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},X=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],ft=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(X),Y={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function ae(j,S){this.name=j,this.message=S}function G(j,S){return j+". Errors: "+Object.keys(S).map(function(P){return S[P].toString()}).filter(function(P,_,B){return B.indexOf(P)===_}).join(`
2
- `)}function ee(j,S,P,_){this.failures=S,this.failedKeys=_,this.successCount=P,this.message=G(j,S)}function re(j,S){this.name="BulkError",this.failures=Object.keys(S).map(function(P){return S[P]}),this.failuresByPos=S,this.message=G(j,this.failures)}b(ae).from(Error).extend({toString:function(){return this.name+": "+this.message}}),b(ee).from(ae),b(re).from(ae);var pe=ft.reduce(function(j,S){return j[S]=S+"Error",j},{}),te=ae,se=ft.reduce(function(j,S){var P=S+"Error";function _(B,q){this.name=P,B?typeof B=="string"?(this.message="".concat(B).concat(q?`
3
- `+q:""),this.inner=q||null):typeof B=="object"&&(this.message="".concat(B.name," ").concat(B.message),this.inner=B):(this.message=Y[S]||P,this.inner=null)}return b(_).from(te),j[S]=_,j},{}),ne=(se.Syntax=SyntaxError,se.Type=TypeError,se.Range=RangeError,X.reduce(function(j,S){return j[S+"Error"]=se[S],j},{}));X=ft.reduce(function(j,S){return["Syntax","Type","Range"].indexOf(S)===-1&&(j[S+"Error"]=se[S]),j},{});function K(){}function ge(j){return j}function ye(j,S){return j==null||j===ge?S:function(P){return S(j(P))}}function me(j,S){return function(){j.apply(this,arguments),S.apply(this,arguments)}}function Se(j,S){return j===K?S:function(){var P=j.apply(this,arguments),_=(P!==void 0&&(arguments[0]=P),this.onsuccess),B=this.onerror,q=(this.onsuccess=null,this.onerror=null,S.apply(this,arguments));return _&&(this.onsuccess=this.onsuccess?me(_,this.onsuccess):_),B&&(this.onerror=this.onerror?me(B,this.onerror):B),q!==void 0?q:P}}function Re(j,S){return j===K?S:function(){j.apply(this,arguments);var P=this.onsuccess,_=this.onerror;this.onsuccess=this.onerror=null,S.apply(this,arguments),P&&(this.onsuccess=this.onsuccess?me(P,this.onsuccess):P),_&&(this.onerror=this.onerror?me(_,this.onerror):_)}}function Te(j,S){return j===K?S:function(B){var _=j.apply(this,arguments),B=(c(B,_),this.onsuccess),q=this.onerror,Z=(this.onsuccess=null,this.onerror=null,S.apply(this,arguments));return B&&(this.onsuccess=this.onsuccess?me(B,this.onsuccess):B),q&&(this.onerror=this.onerror?me(q,this.onerror):q),_===void 0?Z===void 0?void 0:Z:c(_,Z)}}function Je(j,S){return j===K?S:function(){return S.apply(this,arguments)!==!1&&j.apply(this,arguments)}}function rt(j,S){return j===K?S:function(){var P=j.apply(this,arguments);if(P&&typeof P.then=="function"){for(var _=this,B=arguments.length,q=new Array(B);B--;)q[B]=arguments[B];return P.then(function(){return S.apply(_,q)})}return S.apply(this,arguments)}}X.ModifyError=ee,X.DexieError=ae,X.BulkError=re;var De=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function ut(j){De=j}var ct={},Nt=100,yt=typeof Promise>"u"?[]:(ft=Promise.resolve(),typeof crypto<"u"&&crypto.subtle?[yt=crypto.subtle.digest("SHA-512",new Uint8Array([0])),u(yt),ft]:[ft,u(ft),ft]),ft=yt[0],Ol=yt[1],Ol=Ol&&Ol.then,Ct=ft&&ft.constructor,Ae=!!yt[2],ke=function(j,S){Tt.push([j,S]),qe&&(queueMicrotask(ta),qe=!1)},Ie=!0,qe=!0,nt=[],dt=[],wt=ge,pt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:K,pgp:!1,env:{},finalize:K},Le=pt,Tt=[],er=0,qr=[];function Ve(j){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var S=this._PSD=Le;if(typeof j!="function"){if(j!==ct)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&ea(this,this._value)}else this._state=null,this._value=null,++S.ref,function P(_,B){try{B(function(q){if(_._state===null){if(q===_)throw new TypeError("A promise cannot be resolved with itself.");var Z=_._lib&&Un();q&&typeof q.then=="function"?P(_,function(Q,ue){q instanceof Ve?q._then(Q,ue):q.then(Q,ue)}):(_._state=!0,_._value=q,cn(_)),Z&&st()}},ea.bind(null,_))}catch(q){ea(_,q)}}(this,j)}var hr={get:function(){var j=Le,S=je;function P(_,B){var q=this,Z=!j.global&&(j!==Le||S!==je),Q=Z&&!Kt(),ue=new Ve(function(be,ce){ka(q,new ir(vn(_,j,Z,Q),vn(B,j,Z,Q),be,ce,j))});return this._consoleTask&&(ue._consoleTask=this._consoleTask),ue}return P.prototype=ct,P},set:function(j){g(this,"then",j&&j.prototype===ct?hr:{get:function(){return j},set:hr.set})}};function ir(j,S,P,_,B){this.onFulfilled=typeof j=="function"?j:null,this.onRejected=typeof S=="function"?S:null,this.resolve=P,this.reject=_,this.psd=B}function ea(j,S){var P,_;dt.push(S),j._state===null&&(P=j._lib&&Un(),S=wt(S),j._state=!1,j._value=S,_=j,nt.some(function(B){return B._value===_._value})||nt.push(_),cn(j),P)&&st()}function cn(j){var S=j._listeners;j._listeners=[];for(var P=0,_=S.length;P<_;++P)ka(j,S[P]);var B=j._PSD;--B.ref||B.finalize(),er===0&&(++er,ke(function(){--er==0&&Ft()},[]))}function ka(j,S){if(j._state===null)j._listeners.push(S);else{var P=j._state?S.onFulfilled:S.onRejected;if(P===null)return(j._state?S.resolve:S.reject)(j._value);++S.psd.ref,++er,ke(yi,[P,j,S])}}function yi(j,S,P){try{var _,B=S._value;!S._state&&dt.length&&(dt=[]),_=De&&S._consoleTask?S._consoleTask.run(function(){return j(B)}):j(B),S._state||dt.indexOf(B)!==-1||(q=>{for(var Z=nt.length;Z;)if(nt[--Z]._value===q._value)return nt.splice(Z,1)})(S),P.resolve(_)}catch(q){P.reject(q)}finally{--er==0&&Ft(),--P.psd.ref||P.psd.finalize()}}function ta(){tr(pt,function(){Un()&&st()})}function Un(){var j=Ie;return qe=Ie=!1,j}function st(){var j,S,P;do for(;0<Tt.length;)for(j=Tt,Tt=[],P=j.length,S=0;S<P;++S){var _=j[S];_[0].apply(null,_[1])}while(0<Tt.length);qe=Ie=!0}function Ft(){for(var j=nt,S=(nt=[],j.forEach(function(_){_._PSD.onunhandled.call(null,_._value,_)}),qr.slice(0)),P=S.length;P;)S[--P]()}function Er(j){return new Ve(ct,!1,j)}function _t(j,S){var P=Le;return function(){var _=Un(),B=Le;try{return Kr(P,!0),j.apply(this,arguments)}catch(q){S&&S(q)}finally{Kr(B,!1),_&&st()}}}p(Ve.prototype,{then:hr,_then:function(j,S){ka(this,new ir(null,null,j,S,Le))},catch:function(j){var S,P;return arguments.length===1?this.then(null,j):(S=j,P=arguments[1],typeof S=="function"?this.then(null,function(_){return(_ instanceof S?P:Er)(_)}):this.then(null,function(_){return(_&&_.name===S?P:Er)(_)}))},finally:function(j){return this.then(function(S){return Ve.resolve(j()).then(function(){return S})},function(S){return Ve.resolve(j()).then(function(){return Er(S)})})},timeout:function(j,S){var P=this;return j<1/0?new Ve(function(_,B){var q=setTimeout(function(){return B(new se.Timeout(S))},j);P.then(_,B).finally(clearTimeout.bind(null,q))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&g(Ve.prototype,Symbol.toStringTag,"Dexie.Promise"),pt.env=It(),p(Ve,{all:function(){var j=W.apply(null,arguments).map(vr);return new Ve(function(S,P){j.length===0&&S([]);var _=j.length;j.forEach(function(B,q){return Ve.resolve(B).then(function(Z){j[q]=Z,--_||S(j)},P)})})},resolve:function(j){return j instanceof Ve?j:j&&typeof j.then=="function"?new Ve(function(S,P){j.then(S,P)}):new Ve(ct,!0,j)},reject:Er,race:function(){var j=W.apply(null,arguments).map(vr);return new Ve(function(S,P){j.map(function(_){return Ve.resolve(_).then(S,P)})})},PSD:{get:function(){return Le},set:function(j){return Le=j}},totalEchoes:{get:function(){return je}},newPSD:Ye,usePSD:tr,scheduler:{get:function(){return ke},set:function(j){ke=j}},rejectionMapper:{get:function(){return wt},set:function(j){wt=j}},follow:function(j,S){return new Ve(function(P,_){return Ye(function(B,q){var Z=Le;Z.unhandleds=[],Z.onunhandled=q,Z.finalize=me(function(){var Q,ue=this;Q=function(){ue.unhandleds.length===0?B():q(ue.unhandleds[0])},qr.push(function be(){Q(),qr.splice(qr.indexOf(be),1)}),++er,ke(function(){--er==0&&Ft()},[])},Z.finalize),j()},S,P,_)})}}),Ct&&(Ct.allSettled&&g(Ve,"allSettled",function(){var j=W.apply(null,arguments).map(vr);return new Ve(function(S){j.length===0&&S([]);var P=j.length,_=new Array(P);j.forEach(function(B,q){return Ve.resolve(B).then(function(Z){return _[q]={status:"fulfilled",value:Z}},function(Z){return _[q]={status:"rejected",reason:Z}}).then(function(){return--P||S(_)})})})}),Ct.any&&typeof AggregateError<"u"&&g(Ve,"any",function(){var j=W.apply(null,arguments).map(vr);return new Ve(function(S,P){j.length===0&&P(new AggregateError([]));var _=j.length,B=new Array(_);j.forEach(function(q,Z){return Ve.resolve(q).then(function(Q){return S(Q)},function(Q){B[Z]=Q,--_||P(new AggregateError(B))})})})}),Ct.withResolvers)&&(Ve.withResolvers=Ct.withResolvers);var Yt={awaits:0,echoes:0,id:0},Wr=0,Jr=[],Qr=0,je=0,Pe=0;function Ye(j,Z,P,_){var B=Le,q=Object.create(B),Z=(q.parent=B,q.ref=0,q.global=!1,q.id=++Pe,pt.env,q.env=Ae?{Promise:Ve,PromiseProp:{value:Ve,configurable:!0,writable:!0},all:Ve.all,race:Ve.race,allSettled:Ve.allSettled,any:Ve.any,resolve:Ve.resolve,reject:Ve.reject}:{},Z&&c(q,Z),++B.ref,q.finalize=function(){--this.parent.ref||this.parent.finalize()},tr(q,j,P,_));return q.ref===0&&q.finalize(),Z}function Pt(){return Yt.id||(Yt.id=++Wr),++Yt.awaits,Yt.echoes+=Nt,Yt.id}function Kt(){return!!Yt.awaits&&(--Yt.awaits==0&&(Yt.id=0),Yt.echoes=Yt.awaits*Nt,!0)}function vr(j){return Yt.echoes&&j&&j.constructor===Ct?(Pt(),j.then(function(S){return Kt(),S},function(S){return Kt(),Sr(S)})):j}function Lr(){var j=Jr[Jr.length-1];Jr.pop(),Kr(j,!1)}function Kr(j,S){var P,_,B=Le;(S?!Yt.echoes||Qr++&&j===Le:!Qr||--Qr&&j===Le)||queueMicrotask(S?function(q){++je,Yt.echoes&&--Yt.echoes!=0||(Yt.echoes=Yt.awaits=Yt.id=0),Jr.push(Le),Kr(q,!0)}.bind(null,j):Lr),j!==Le&&(Le=j,B===pt&&(pt.env=It()),Ae)&&(P=pt.env.Promise,_=j.env,B.global||j.global)&&(Object.defineProperty(o,"Promise",_.PromiseProp),P.all=_.all,P.race=_.race,P.resolve=_.resolve,P.reject=_.reject,_.allSettled&&(P.allSettled=_.allSettled),_.any)&&(P.any=_.any)}function It(){var j=o.Promise;return Ae?{Promise:j,PromiseProp:Object.getOwnPropertyDescriptor(o,"Promise"),all:j.all,race:j.race,allSettled:j.allSettled,any:j.any,resolve:j.resolve,reject:j.reject}:{}}function tr(j,S,P,_,B){var q=Le;try{return Kr(j,!0),S(P,_,B)}finally{Kr(q,!1)}}function vn(j,S,P,_){return typeof j!="function"?j:function(){var B=Le;P&&Pt(),Kr(S,!0);try{return j.apply(this,arguments)}finally{Kr(B,!1),_&&queueMicrotask(Kt)}}}function En(j){Promise===Ct&&Yt.echoes===0?Qr===0?j():enqueueNativeMicroTask(j):setTimeout(j,0)}(""+Ol).indexOf("[native code]")===-1&&(Pt=Kt=K);var Sr=Ve.reject,ra="￿",na="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",wl="String expected.",to=[],jl="__dbnames",Nl="readonly",Cu="readwrite";function Lo(j,S){return j?S?function(){return j.apply(this,arguments)&&S.apply(this,arguments)}:j:S}var am={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function El(j){return typeof j!="string"||/\./.test(j)?function(S){return S}:function(S){return S[j]===void 0&&j in S&&delete(S=R(S))[j],S}}function om(){throw se.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.")}function Wt(j,S){try{var P=sm(j),_=sm(S);if(P!==_)return P==="Array"?1:_==="Array"?-1:P==="binary"?1:_==="binary"?-1:P==="string"?1:_==="string"?-1:P==="Date"?1:_!=="Date"?NaN:-1;switch(P){case"number":case"Date":case"string":return S<j?1:j<S?-1:0;case"binary":for(var B=im(j),q=im(S),Z=B.length,Q=q.length,ue=Z<Q?Z:Q,be=0;be<ue;++be)if(B[be]!==q[be])return B[be]<q[be]?-1:1;return Z===Q?0:Z<Q?-1:1;case"Array":for(var ce=j,oe=S,de=ce.length,fe=oe.length,le=de<fe?de:fe,ie=0;ie<le;++ie){var ve=Wt(ce[ie],oe[ie]);if(ve!==0)return ve}return de===fe?0:de<fe?-1:1}}catch{}return NaN}function sm(j){var S=typeof j;return S=="object"&&(ArrayBuffer.isView(j)||(S=F(j))==="ArrayBuffer")?"binary":S}function im(j){return j instanceof Uint8Array?j:ArrayBuffer.isView(j)?new Uint8Array(j.buffer,j.byteOffset,j.byteLength):new Uint8Array(j)}function Sl(j,S,P){var _=j.schema.yProps;return _?(S&&0<P.numFailures&&(S=S.filter(function(B,q){return!P.failures[q]})),Promise.all(_.map(function(B){return B=B.updatesTable,S?j.db.table(B).where("k").anyOf(S).delete():j.db.table(B).clear()})).then(function(){return P})):P}lm.prototype.execute=function(j){var S=this["@@propmod"];if(S.add!==void 0){var P=S.add;if(l(P))return a(a([],l(j)?j:[],!0),P).sort();if(typeof P=="number")return(Number(j)||0)+P;if(typeof P=="bigint")try{return BigInt(j)+P}catch{return BigInt(0)+P}throw new TypeError("Invalid term ".concat(P))}if(S.remove!==void 0){var _=S.remove;if(l(_))return l(j)?j.filter(function(B){return!_.includes(B)}).sort():[];if(typeof _=="number")return Number(j)-_;if(typeof _=="bigint")try{return BigInt(j)-_}catch{return BigInt(0)-_}throw new TypeError("Invalid subtrahend ".concat(_))}return P=(P=S.replacePrefix)==null?void 0:P[0],P&&typeof j=="string"&&j.startsWith(P)?S.replacePrefix[1]+j.substring(P.length):j};var xi=lm;function lm(j){this["@@propmod"]=j}function cm(j,S){for(var P=s(S),_=P.length,B=!1,q=0;q<_;++q){var Z=P[q],Q=S[Z],ue=C(j,Z);Q instanceof xi?(O(j,Z,Q.execute(ue)),B=!0):ue!==Q&&(O(j,Z,Q),B=!0)}return B}kr.prototype._trans=function(j,S,P){var _=this._tx||Le.trans,B=this.name,q=De&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(j==="readonly"?"read":"write"," ").concat(this.name));function Z(be,ce,oe){if(oe.schema[B])return S(oe.idbtrans,oe);throw new se.NotFound("Table "+B+" not part of transaction")}var Q=Un();try{var ue=_&&_.db._novip===this.db._novip?_===Le.trans?_._promise(j,Z,P):Ye(function(){return _._promise(j,Z,P)},{trans:_,transless:Le.transless||Le}):function be(ce,oe,de,fe){if(ce.idbdb&&(ce._state.openComplete||Le.letThrough||ce._vip)){var le=ce._createTransaction(oe,de,ce._dbSchema);try{le.create(),ce._state.PR1398_maxLoop=3}catch(ie){return ie.name===pe.InvalidState&&ce.isOpen()&&0<--ce._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),ce.close({disableAutoOpen:!1}),ce.open().then(function(){return be(ce,oe,de,fe)})):Sr(ie)}return le._promise(oe,function(ie,ve){return Ye(function(){return Le.trans=le,fe(ie,ve,le)})}).then(function(ie){if(oe==="readwrite")try{le.idbtrans.commit()}catch{}return oe==="readonly"?ie:le._completion.then(function(){return ie})})}if(ce._state.openComplete)return Sr(new se.DatabaseClosed(ce._state.dbOpenError));if(!ce._state.isBeingOpened){if(!ce._state.autoOpen)return Sr(new se.DatabaseClosed);ce.open().catch(K)}return ce._state.dbReadyPromise.then(function(){return be(ce,oe,de,fe)})}(this.db,j,[this.name],Z);return q&&(ue._consoleTask=q,ue=ue.catch(function(be){return console.trace(be),Sr(be)})),ue}finally{Q&&st()}},kr.prototype.get=function(j,S){var P=this;return j&&j.constructor===Object?this.where(j).first(S):j==null?Sr(new se.Type("Invalid argument to Table.get()")):this._trans("readonly",function(_){return P.core.get({trans:_,key:j}).then(function(B){return P.hook.reading.fire(B)})}).then(S)},kr.prototype.where=function(j){if(typeof j=="string")return new this.db.WhereClause(this,j);if(l(j))return new this.db.WhereClause(this,"[".concat(j.join("+"),"]"));var S=s(j);if(S.length===1)return this.where(S[0]).equals(j[S[0]]);var P=this.schema.indexes.concat(this.schema.primKey).filter(function(Q){if(Q.compound&&S.every(function(be){return 0<=Q.keyPath.indexOf(be)})){for(var ue=0;ue<S.length;++ue)if(S.indexOf(Q.keyPath[ue])===-1)return!1;return!0}return!1}).sort(function(Q,ue){return Q.keyPath.length-ue.keyPath.length})[0];if(P&&this.db._maxKey!==ra)return Z=P.keyPath.slice(0,S.length),this.where(Z).equals(Z.map(function(Q){return j[Q]}));!P&&De&&console.warn("The query ".concat(JSON.stringify(j)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(S.join("+"),"]"));var _=this.schema.idxByName;function B(Q,ue){return Wt(Q,ue)===0}var Z=S.reduce(function(ce,ue){var be=ce[0],ce=ce[1],oe=_[ue],de=j[ue];return[be||oe,be||!oe?Lo(ce,oe&&oe.multi?function(fe){return fe=C(fe,ue),l(fe)&&fe.some(function(le){return B(de,le)})}:function(fe){return B(de,C(fe,ue))}):ce]},[null,null]),q=Z[0],Z=Z[1];return q?this.where(q.name).equals(j[q.keyPath]).filter(Z):P?this.filter(Z):this.where(S).equals("")},kr.prototype.filter=function(j){return this.toCollection().and(j)},kr.prototype.count=function(j){return this.toCollection().count(j)},kr.prototype.offset=function(j){return this.toCollection().offset(j)},kr.prototype.limit=function(j){return this.toCollection().limit(j)},kr.prototype.each=function(j){return this.toCollection().each(j)},kr.prototype.toArray=function(j){return this.toCollection().toArray(j)},kr.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},kr.prototype.orderBy=function(j){return new this.db.Collection(new this.db.WhereClause(this,l(j)?"[".concat(j.join("+"),"]"):j))},kr.prototype.reverse=function(){return this.toCollection().reverse()},kr.prototype.mapToClass=function(j){for(var S=this.db,P=this.name,_=((this.schema.mappedClass=j).prototype instanceof om&&(j=(Z=>{var Q=ce,ue=Z;if(typeof ue!="function"&&ue!==null)throw new TypeError("Class extends value "+String(ue)+" is not a constructor or null");function be(){this.constructor=Q}function ce(){return Z!==null&&Z.apply(this,arguments)||this}return r(Q,ue),Q.prototype=ue===null?Object.create(ue):(be.prototype=ue.prototype,new be),Object.defineProperty(ce.prototype,"db",{get:function(){return S},enumerable:!1,configurable:!0}),ce.prototype.table=function(){return P},ce})(j)),new Set),B=j.prototype;B;B=u(B))Object.getOwnPropertyNames(B).forEach(function(Z){return _.add(Z)});function q(Z){if(!Z)return Z;var Q,ue=Object.create(j.prototype);for(Q in Z)if(!_.has(Q))try{ue[Q]=Z[Q]}catch{}return ue}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=q,this.hook("reading",q),j},kr.prototype.defineClass=function(){return this.mapToClass(function(j){c(this,j)})},kr.prototype.add=function(j,S){var P=this,_=this.schema.primKey,B=_.auto,q=_.keyPath,Z=j;return q&&B&&(Z=El(q)(j)),this._trans("readwrite",function(Q){return P.core.mutate({trans:Q,type:"add",keys:S!=null?[S]:null,values:[Z]})}).then(function(Q){return Q.numFailures?Ve.reject(Q.failures[0]):Q.lastResult}).then(function(Q){if(q)try{O(j,q,Q)}catch{}return Q})},kr.prototype.upsert=function(j,S){var P=this,_=this.schema.primKey.keyPath;return this._trans("readwrite",function(B){return P.core.get({trans:B,key:j}).then(function(q){var Z=q??{};return cm(Z,S),_&&O(Z,_,j),P.core.mutate({trans:B,type:"put",values:[Z],keys:[j],upsert:!0,updates:{keys:[j],changeSpecs:[S]}}).then(function(Q){return Q.numFailures?Ve.reject(Q.failures[0]):!!q})})})},kr.prototype.update=function(j,S){return typeof j!="object"||l(j)?this.where(":id").equals(j).modify(S):(j=C(j,this.schema.primKey.keyPath))===void 0?Sr(new se.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(j).modify(S)},kr.prototype.put=function(j,S){var P=this,_=this.schema.primKey,B=_.auto,q=_.keyPath,Z=j;return q&&B&&(Z=El(q)(j)),this._trans("readwrite",function(Q){return P.core.mutate({trans:Q,type:"put",values:[Z],keys:S!=null?[S]:null})}).then(function(Q){return Q.numFailures?Ve.reject(Q.failures[0]):Q.lastResult}).then(function(Q){if(q)try{O(j,q,Q)}catch{}return Q})},kr.prototype.delete=function(j){var S=this;return this._trans("readwrite",function(P){return S.core.mutate({trans:P,type:"delete",keys:[j]}).then(function(_){return Sl(S,[j],_)}).then(function(_){return _.numFailures?Ve.reject(_.failures[0]):void 0})})},kr.prototype.clear=function(){var j=this;return this._trans("readwrite",function(S){return j.core.mutate({trans:S,type:"deleteRange",range:am}).then(function(P){return Sl(j,null,P)})}).then(function(S){return S.numFailures?Ve.reject(S.failures[0]):void 0})},kr.prototype.bulkGet=function(j){var S=this;return this._trans("readonly",function(P){return S.core.getMany({keys:j,trans:P}).then(function(_){return _.map(function(B){return S.hook.reading.fire(B)})})})},kr.prototype.bulkAdd=function(j,S,P){var _=this,B=Array.isArray(S)?S:void 0,q=(P=P||(B?void 0:S))?P.allKeys:void 0;return this._trans("readwrite",function(Z){var Q=_.schema.primKey,be=Q.auto,Q=Q.keyPath;if(Q&&B)throw new se.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(B&&B.length!==j.length)throw new se.InvalidArgument("Arguments objects and keys must have the same length");var ue=j.length,be=Q&&be?j.map(El(Q)):j;return _.core.mutate({trans:Z,type:"add",keys:B,values:be,wantResults:q}).then(function(ce){var oe=ce.numFailures,de=ce.failures;if(oe===0)return q?ce.results:ce.lastResult;throw new re("".concat(_.name,".bulkAdd(): ").concat(oe," of ").concat(ue," operations failed"),de)})})},kr.prototype.bulkPut=function(j,S,P){var _=this,B=Array.isArray(S)?S:void 0,q=(P=P||(B?void 0:S))?P.allKeys:void 0;return this._trans("readwrite",function(Z){var Q=_.schema.primKey,be=Q.auto,Q=Q.keyPath;if(Q&&B)throw new se.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(B&&B.length!==j.length)throw new se.InvalidArgument("Arguments objects and keys must have the same length");var ue=j.length,be=Q&&be?j.map(El(Q)):j;return _.core.mutate({trans:Z,type:"put",keys:B,values:be,wantResults:q}).then(function(ce){var oe=ce.numFailures,de=ce.failures;if(oe===0)return q?ce.results:ce.lastResult;throw new re("".concat(_.name,".bulkPut(): ").concat(oe," of ").concat(ue," operations failed"),de)})})},kr.prototype.bulkUpdate=function(j){var S=this,P=this.core,_=j.map(function(Z){return Z.key}),B=j.map(function(Z){return Z.changes}),q=[];return this._trans("readwrite",function(Z){return P.getMany({trans:Z,keys:_,cache:"clone"}).then(function(Q){var ue=[],be=[],ce=(j.forEach(function(oe,de){var fe=oe.key,le=oe.changes,ie=Q[de];if(ie){for(var ve=0,we=Object.keys(le);ve<we.length;ve++){var he=we[ve],Oe=le[he];if(he===S.schema.primKey.keyPath){if(Wt(Oe,fe)!==0)throw new se.Constraint("Cannot update primary key in bulkUpdate()")}else O(ie,he,Oe)}q.push(de),ue.push(fe),be.push(ie)}}),ue.length);return P.mutate({trans:Z,type:"put",keys:ue,values:be,updates:{keys:_,changeSpecs:B}}).then(function(oe){var de=oe.numFailures,fe=oe.failures;if(de===0)return ce;for(var le=0,ie=Object.keys(fe);le<ie.length;le++){var ve,we=ie[le],he=q[Number(we)];he!=null&&(ve=fe[we],delete fe[we],fe[he]=ve)}throw new re("".concat(S.name,".bulkUpdate(): ").concat(de," of ").concat(ce," operations failed"),fe)})})})},kr.prototype.bulkDelete=function(j){var S=this,P=j.length;return this._trans("readwrite",function(_){return S.core.mutate({trans:_,type:"delete",keys:j}).then(function(B){return Sl(S,j,B)})}).then(function(_){var B=_.numFailures,q=_.failures;if(B===0)return _.lastResult;throw new re("".concat(S.name,".bulkDelete(): ").concat(B," of ").concat(P," operations failed"),q)})};var Ou=kr;function kr(){}function vi(j){function S(Z,Q){if(Q){for(var ue=arguments.length,be=new Array(ue-1);--ue;)be[ue-1]=arguments[ue];return P[Z].subscribe.apply(null,be),j}if(typeof Z=="string")return P[Z]}var P={};S.addEventType=q;for(var _=1,B=arguments.length;_<B;++_)q(arguments[_]);return S;function q(Z,Q,ue){var be,ce;if(typeof Z!="object")return Q=Q||Je,ce={subscribers:[],fire:ue=ue||K,subscribe:function(oe){ce.subscribers.indexOf(oe)===-1&&(ce.subscribers.push(oe),ce.fire=Q(ce.fire,oe))},unsubscribe:function(oe){ce.subscribers=ce.subscribers.filter(function(de){return de!==oe}),ce.fire=ce.subscribers.reduce(Q,ue)}},P[Z]=S[Z]=ce;s(be=Z).forEach(function(oe){var de=be[oe];if(l(de))q(oe,be[oe][0],be[oe][1]);else{if(de!=="asap")throw new se.InvalidArgument("Invalid event config");var fe=q(oe,ge,function(){for(var le=arguments.length,ie=new Array(le);le--;)ie[le]=arguments[le];fe.subscribers.forEach(function(ve){E(function(){ve.apply(null,ie)})})})}})}}function ki(j,S){return b(S).from({prototype:j}),S}function ws(j,S){return!(j.filter||j.algorithm||j.or)&&(S?j.justLimit:!j.replayFilter)}function Pu(j,S){j.filter=Lo(j.filter,S)}function xe(j,S,P){var _=j.replayFilter;j.replayFilter=_?function(){return Lo(_(),S())}:S,j.justLimit=P&&!_}function Ne(j,S){if(j.isPrimKey)return S.primaryKey;var P=S.getIndexByKeyPath(j.index);if(P)return P;throw new se.Schema("KeyPath "+j.index+" on object store "+S.name+" is not indexed")}function Ue(j,S,P){var _=Ne(j,S.schema);return S.openCursor({trans:P,values:!j.keysOnly,reverse:j.dir==="prev",unique:!!j.unique,query:{index:_,range:j.range}})}function _e(j,S,P,_){var B,q,Z=j.replayFilter?Lo(j.filter,j.replayFilter()):j.filter;return j.or?(B={},q=function(Q,ue,be){var ce,oe;Z&&!Z(ue,be,function(de){return ue.stop(de)},function(de){return ue.fail(de)})||((oe=""+(ce=ue.primaryKey))=="[object ArrayBuffer]"&&(oe=""+new Uint8Array(ce)),f(B,oe))||(B[oe]=!0,S(Q,ue,be))},Promise.all([j.or._iterate(q,P),Ze(Ue(j,_,P),j.algorithm,q,!j.keysOnly&&j.valueMapper)])):Ze(Ue(j,_,P),Lo(j.algorithm,Z),S,!j.keysOnly&&j.valueMapper)}function Ze(j,S,P,_){var B=_t(_?function(q,Z,Q){return P(_(q),Z,Q)}:P);return j.then(function(q){if(q)return q.start(function(){var Z=function(){return q.continue()};S&&!S(q,function(Q){return Z=Q},function(Q){q.stop(Q),Z=K},function(Q){q.fail(Q),Z=K})||B(q.value,q,function(Q){return Z=Q}),Z()})})}ht.prototype._read=function(j,S){var P=this._ctx;return P.error?P.table._trans(null,Sr.bind(null,P.error)):P.table._trans("readonly",j).then(S)},ht.prototype._write=function(j){var S=this._ctx;return S.error?S.table._trans(null,Sr.bind(null,S.error)):S.table._trans("readwrite",j,"locked")},ht.prototype._addAlgorithm=function(j){var S=this._ctx;S.algorithm=Lo(S.algorithm,j)},ht.prototype._iterate=function(j,S){return _e(this._ctx,j,S,this._ctx.table.core)},ht.prototype.clone=function(j){var S=Object.create(this.constructor.prototype),P=Object.create(this._ctx);return j&&c(P,j),S._ctx=P,S},ht.prototype.raw=function(){return this._ctx.valueMapper=null,this},ht.prototype.each=function(j){var S=this._ctx;return this._read(function(P){return _e(S,j,P,S.table.core)})},ht.prototype.count=function(j){var S=this;return this._read(function(P){var _,B=S._ctx,q=B.table.core;return ws(B,!0)?q.count({trans:P,query:{index:Ne(B,q.schema),range:B.range}}).then(function(Z){return Math.min(Z,B.limit)}):(_=0,_e(B,function(){return++_,!1},P,q).then(function(){return _}))}).then(j)},ht.prototype.sortBy=function(j,S){var P=j.split(".").reverse(),_=P[0],B=P.length-1;function q(ue,be){return be?q(ue[P[be]],be-1):ue[_]}var Z=this._ctx.dir==="next"?1:-1;function Q(ue,be){return Wt(q(ue,B),q(be,B))*Z}return this.toArray(function(ue){return ue.sort(Q)}).then(S)},ht.prototype.toArray=function(j){var S=this;return this._read(function(P){var _,B,q,Z=S._ctx;return Z.dir==="next"&&ws(Z,!0)&&0<Z.limit?(_=Z.valueMapper,B=Ne(Z,Z.table.core.schema),Z.table.core.query({trans:P,limit:Z.limit,values:!0,query:{index:B,range:Z.range}}).then(function(Q){return Q=Q.result,_?Q.map(_):Q})):(q=[],_e(Z,function(Q){return q.push(Q)},P,Z.table.core).then(function(){return q}))},j)},ht.prototype.offset=function(j){var S=this._ctx;return j<=0||(S.offset+=j,ws(S)?xe(S,function(){var P=j;return function(_,B){return P===0||(P===1?--P:B(function(){_.advance(P),P=0}),!1)}}):xe(S,function(){var P=j;return function(){return--P<0}})),this},ht.prototype.limit=function(j){return this._ctx.limit=Math.min(this._ctx.limit,j),xe(this._ctx,function(){var S=j;return function(P,_,B){return--S<=0&&_(B),0<=S}},!0),this},ht.prototype.until=function(j,S){return Pu(this._ctx,function(P,_,B){return!j(P.value)||(_(B),S)}),this},ht.prototype.first=function(j){return this.limit(1).toArray(function(S){return S[0]}).then(j)},ht.prototype.last=function(j){return this.reverse().first(j)},ht.prototype.filter=function(j){var S;return Pu(this._ctx,function(P){return j(P.value)}),(S=this._ctx).isMatch=Lo(S.isMatch,j),this},ht.prototype.and=function(j){return this.filter(j)},ht.prototype.or=function(j){return new this.db.WhereClause(this._ctx.table,j,this)},ht.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},ht.prototype.desc=function(){return this.reverse()},ht.prototype.eachKey=function(j){var S=this._ctx;return S.keysOnly=!S.isMatch,this.each(function(P,_){j(_.key,_)})},ht.prototype.eachUniqueKey=function(j){return this._ctx.unique="unique",this.eachKey(j)},ht.prototype.eachPrimaryKey=function(j){var S=this._ctx;return S.keysOnly=!S.isMatch,this.each(function(P,_){j(_.primaryKey,_)})},ht.prototype.keys=function(j){var S=this._ctx,P=(S.keysOnly=!S.isMatch,[]);return this.each(function(_,B){P.push(B.key)}).then(function(){return P}).then(j)},ht.prototype.primaryKeys=function(j){var S=this._ctx;if(S.dir==="next"&&ws(S,!0)&&0<S.limit)return this._read(function(_){var B=Ne(S,S.table.core.schema);return S.table.core.query({trans:_,values:!1,limit:S.limit,query:{index:B,range:S.range}})}).then(function(_){return _.result}).then(j);S.keysOnly=!S.isMatch;var P=[];return this.each(function(_,B){P.push(B.primaryKey)}).then(function(){return P}).then(j)},ht.prototype.uniqueKeys=function(j){return this._ctx.unique="unique",this.keys(j)},ht.prototype.firstKey=function(j){return this.limit(1).keys(function(S){return S[0]}).then(j)},ht.prototype.lastKey=function(j){return this.reverse().firstKey(j)},ht.prototype.distinct=function(){var j,S=this._ctx,S=S.index&&S.table.schema.idxByName[S.index];return S&&S.multi&&(j={},Pu(this._ctx,function(_){var _=_.primaryKey.toString(),B=f(j,_);return j[_]=!0,!B})),this},ht.prototype.modify=function(j){var S=this,P=this._ctx;return this._write(function(_){function B(ie,ve){var we=ve.failures;de+=ie-ve.numFailures;for(var he=0,Oe=s(we);he<Oe.length;he++){var Fe=Oe[he];oe.push(we[Fe])}}var q=typeof j=="function"?j:function(ie){return cm(ie,j)},Z=P.table.core,ce=Z.schema.primaryKey,Q=ce.outbound,ue=ce.extractKey,be=200,ce=S.db._options.modifyChunkSize,oe=(ce&&(be=typeof ce=="object"?ce[Z.name]||ce["*"]||200:ce),[]),de=0,fe=[],le=j===lr;return S.clone().primaryKeys().then(function(ie){function ve(he){var Oe=Math.min(be,ie.length-he),Fe=ie.slice(he,he+Oe);return(le?Promise.resolve([]):Z.getMany({trans:_,keys:Fe,cache:"immutable"})).then(function(Xe){var Ge=[],$e=[],at=Q?[]:null,tt=le?Fe:[];if(!le)for(var Ke=0;Ke<Oe;++Ke){var it=Xe[Ke],Jt={value:R(it),primKey:ie[he+Ke]};q.call(Jt,Jt.value,Jt)!==!1&&(Jt.value==null?tt.push(ie[he+Ke]):Q||Wt(ue(it),ue(Jt.value))===0?($e.push(Jt.value),Q&&at.push(ie[he+Ke])):(tt.push(ie[he+Ke]),Ge.push(Jt.value)))}return Promise.resolve(0<Ge.length&&Z.mutate({trans:_,type:"add",values:Ge}).then(function(rr){for(var xt in rr.failures)tt.splice(parseInt(xt),1);B(Ge.length,rr)})).then(function(){return(0<$e.length||we&&typeof j=="object")&&Z.mutate({trans:_,type:"put",keys:at,values:$e,criteria:we,changeSpec:typeof j!="function"&&j,isAdditionalChunk:0<he}).then(function(rr){return B($e.length,rr)})}).then(function(){return(0<tt.length||we&&le)&&Z.mutate({trans:_,type:"delete",keys:tt,criteria:we,isAdditionalChunk:0<he}).then(function(rr){return Sl(P.table,tt,rr)}).then(function(rr){return B(tt.length,rr)})}).then(function(){return ie.length>he+Oe&&ve(he+be)})})}var we=ws(P)&&P.limit===1/0&&(typeof j!="function"||le)&&{index:P.index,range:P.range};return ve(0).then(function(){if(0<oe.length)throw new ee("Error modifying one or more objects",oe,de,fe);return ie.length})})})},ht.prototype.delete=function(){var j=this._ctx,S=j.range;return!ws(j)||j.table.schema.yProps||!j.isPrimKey&&S.type!==3?this.modify(lr):this._write(function(P){var _=j.table.core.schema.primaryKey,B=S;return j.table.core.count({trans:P,query:{index:_,range:B}}).then(function(q){return j.table.core.mutate({trans:P,type:"deleteRange",range:B}).then(function(ue){var Q=ue.failures,ue=ue.numFailures;if(ue)throw new ee("Could not delete some values",Object.keys(Q).map(function(be){return Q[be]}),q-ue);return q-ue})})})};var ot=ht;function ht(){}var lr=function(j,S){return S.value=null};function Et(j,S){return j<S?-1:j===S?0:1}function Ot(j,S){return S<j?-1:j===S?0:1}function At(j,S,P){return j=j instanceof HE?new j.Collection(j):j,j._ctx.error=new(P||TypeError)(S),j}function Cr(j){return new j.Collection(j,function(){return BE("")}).limit(0)}function gr(fe,S,P,_){var B,q,Z,Q,ue,be,ce,oe=P.length;if(!P.every(function(ie){return typeof ie=="string"}))return At(fe,wl);function de(ie){B=ie==="next"?function(we){return we.toUpperCase()}:function(we){return we.toLowerCase()},q=ie==="next"?function(we){return we.toLowerCase()}:function(we){return we.toUpperCase()},Z=ie==="next"?Et:Ot;var ve=P.map(function(we){return{lower:q(we),upper:B(we)}}).sort(function(we,he){return Z(we.lower,he.lower)});Q=ve.map(function(we){return we.upper}),ue=ve.map(function(we){return we.lower}),ce=(be=ie)==="next"?"":_}de("next");var fe=new fe.Collection(fe,function(){return un(Q[0],ue[oe-1]+_)}),le=(fe._ondirectionchange=function(ie){de(ie)},0);return fe._addAlgorithm(function(ie,ve,we){var he=ie.key;if(typeof he=="string"){var Oe=q(he);if(S(Oe,ue,le))return!0;for(var Fe=null,Xe=le;Xe<oe;++Xe){var Ge=(($e,at,tt,Ke,it,Jt)=>{for(var rr=Math.min($e.length,Ke.length),xt=-1,zt=0;zt<rr;++zt){var Yr=at[zt];if(Yr!==Ke[zt])return it($e[zt],tt[zt])<0?$e.substr(0,zt)+tt[zt]+tt.substr(zt+1):it($e[zt],Ke[zt])<0?$e.substr(0,zt)+Ke[zt]+tt.substr(zt+1):0<=xt?$e.substr(0,xt)+at[xt]+tt.substr(xt+1):null;it($e[zt],Yr)<0&&(xt=zt)}return rr<Ke.length&&Jt==="next"?$e+tt.substr($e.length):rr<$e.length&&Jt==="prev"?$e.substr(0,tt.length):xt<0?null:$e.substr(0,xt)+Ke[xt]+tt.substr(xt+1)})(he,Oe,Q[Xe],ue[Xe],Z,be);Ge===null&&Fe===null?le=Xe+1:(Fe===null||0<Z(Fe,Ge))&&(Fe=Ge)}ve(Fe!==null?function(){ie.continue(Fe+ce)}:we)}return!1}),fe}function un(j,S,P,_){return{type:2,lower:j,upper:S,lowerOpen:P,upperOpen:_}}function BE(j){return{type:1,lower:j,upper:j}}Object.defineProperty(kn.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),kn.prototype.between=function(j,S,P,_){P=P!==!1,_=_===!0;try{return 0<this._cmp(j,S)||this._cmp(j,S)===0&&(P||_)&&(!P||!_)?Cr(this):new this.Collection(this,function(){return un(j,S,!P,!_)})}catch{return At(this,na)}},kn.prototype.equals=function(j){return j==null?At(this,na):new this.Collection(this,function(){return BE(j)})},kn.prototype.above=function(j){return j==null?At(this,na):new this.Collection(this,function(){return un(j,void 0,!0)})},kn.prototype.aboveOrEqual=function(j){return j==null?At(this,na):new this.Collection(this,function(){return un(j,void 0,!1)})},kn.prototype.below=function(j){return j==null?At(this,na):new this.Collection(this,function(){return un(void 0,j,!1,!0)})},kn.prototype.belowOrEqual=function(j){return j==null?At(this,na):new this.Collection(this,function(){return un(void 0,j)})},kn.prototype.startsWith=function(j){return typeof j!="string"?At(this,wl):this.between(j,j+ra,!0,!0)},kn.prototype.startsWithIgnoreCase=function(j){return j===""?this.startsWith(j):gr(this,function(S,P){return S.indexOf(P[0])===0},[j],ra)},kn.prototype.equalsIgnoreCase=function(j){return gr(this,function(S,P){return S===P[0]},[j],"")},kn.prototype.anyOfIgnoreCase=function(){var j=W.apply(z,arguments);return j.length===0?Cr(this):gr(this,function(S,P){return P.indexOf(S)!==-1},j,"")},kn.prototype.startsWithAnyOfIgnoreCase=function(){var j=W.apply(z,arguments);return j.length===0?Cr(this):gr(this,function(S,P){return P.some(function(_){return S.indexOf(_)===0})},j,ra)},kn.prototype.anyOf=function(){var j,S,P=this,_=W.apply(z,arguments),B=this._cmp;try{_.sort(B)}catch{return At(this,na)}return _.length===0?Cr(this):((j=new this.Collection(this,function(){return un(_[0],_[_.length-1])}))._ondirectionchange=function(q){B=q==="next"?P._ascending:P._descending,_.sort(B)},S=0,j._addAlgorithm(function(q,Z,Q){for(var ue=q.key;0<B(ue,_[S]);)if(++S===_.length)return Z(Q),!1;return B(ue,_[S])===0||(Z(function(){q.continue(_[S])}),!1)}),j)},kn.prototype.notEqual=function(j){return this.inAnyRange([[-1/0,j],[j,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},kn.prototype.noneOf=function(){var j=W.apply(z,arguments);if(j.length===0)return new this.Collection(this);try{j.sort(this._ascending)}catch{return At(this,na)}var S=j.reduce(function(P,_){return P?P.concat([[P[P.length-1][1],_]]):[[-1/0,_]]},null);return S.push([j[j.length-1],this.db._maxKey]),this.inAnyRange(S,{includeLowers:!1,includeUppers:!1})},kn.prototype.inAnyRange=function(j,we){var P=this,_=this._cmp,B=this._ascending,q=this._descending,Z=this._min,Q=this._max;if(j.length===0)return Cr(this);if(!j.every(function(he){return he[0]!==void 0&&he[1]!==void 0&&B(he[0],he[1])<=0}))return At(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",se.InvalidArgument);var ue=!we||we.includeLowers!==!1,be=we&&we.includeUppers===!0,ce,oe=B;function de(he,Oe){return oe(he[0],Oe[0])}try{(ce=j.reduce(function(he,Oe){for(var Fe=0,Xe=he.length;Fe<Xe;++Fe){var Ge=he[Fe];if(_(Oe[0],Ge[1])<0&&0<_(Oe[1],Ge[0])){Ge[0]=Z(Ge[0],Oe[0]),Ge[1]=Q(Ge[1],Oe[1]);break}}return Fe===Xe&&he.push(Oe),he},[])).sort(de)}catch{return At(this,na)}var fe=0,le=be?function(he){return 0<B(he,ce[fe][1])}:function(he){return 0<=B(he,ce[fe][1])},ie=ue?function(he){return 0<q(he,ce[fe][0])}:function(he){return 0<=q(he,ce[fe][0])},ve=le,we=new this.Collection(this,function(){return un(ce[0][0],ce[ce.length-1][1],!ue,!be)});return we._ondirectionchange=function(he){oe=he==="next"?(ve=le,B):(ve=ie,q),ce.sort(de)},we._addAlgorithm(function(he,Oe,Fe){for(var Xe,Ge=he.key;ve(Ge);)if(++fe===ce.length)return Oe(Fe),!1;return!le(Xe=Ge)&&!ie(Xe)||(P._cmp(Ge,ce[fe][1])===0||P._cmp(Ge,ce[fe][0])===0||Oe(function(){oe===B?he.continue(ce[fe][0]):he.continue(ce[fe][1])}),!1)}),we},kn.prototype.startsWithAnyOf=function(){var j=W.apply(z,arguments);return j.every(function(S){return typeof S=="string"})?j.length===0?Cr(this):this.inAnyRange(j.map(function(S){return[S,S+ra]})):At(this,"startsWithAnyOf() only works with strings")};var HE=kn;function kn(){}function ro(j){return _t(function(S){return Au(S),j(S.target.error),!1})}function Au(j){j.stopPropagation&&j.stopPropagation(),j.preventDefault&&j.preventDefault()}var Mu="storagemutated",zb="x-storagemutated-1",js=vi(null,Mu),eF=(no.prototype._lock=function(){return w(!Le.global),++this._reculock,this._reculock!==1||Le.global||(Le.lockOwnerFor=this),this},no.prototype._unlock=function(){if(w(!Le.global),--this._reculock==0)for(Le.global||(Le.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var j=this._blockedFuncs.shift();try{tr(j[1],j[0])}catch{}}return this},no.prototype._locked=function(){return this._reculock&&Le.lockOwnerFor!==this},no.prototype.create=function(j){var S=this;if(this.mode){var P=this.db.idbdb,_=this.db._state.dbOpenError;if(w(!this.idbtrans),!j&&!P)switch(_&&_.name){case"DatabaseClosedError":throw new se.DatabaseClosed(_);case"MissingAPIError":throw new se.MissingAPI(_.message,_);default:throw new se.OpenFailed(_)}if(!this.active)throw new se.TransactionInactive;w(this._completion._state===null),(j=this.idbtrans=j||(this.db.core||P).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=_t(function(B){Au(B),S._reject(j.error)}),j.onabort=_t(function(B){Au(B),S.active&&S._reject(new se.Abort(j.error)),S.active=!1,S.on("abort").fire(B)}),j.oncomplete=_t(function(){S.active=!1,S._resolve(),"mutatedParts"in j&&js.storagemutated.fire(j.mutatedParts)})}return this},no.prototype._promise=function(j,S,P){var _,B=this;return j==="readwrite"&&this.mode!=="readwrite"?Sr(new se.ReadOnly("Transaction is readonly")):this.active?this._locked()?new Ve(function(q,Z){B._blockedFuncs.push([function(){B._promise(j,S,P).then(q,Z)},Le])}):P?Ye(function(){var q=new Ve(function(Z,Q){B._lock();var ue=S(Z,Q,B);ue&&ue.then&&ue.then(Z,Q)});return q.finally(function(){return B._unlock()}),q._lib=!0,q}):((_=new Ve(function(q,Z){var Q=S(q,Z,B);Q&&Q.then&&Q.then(q,Z)}))._lib=!0,_):Sr(new se.TransactionInactive)},no.prototype._root=function(){return this.parent?this.parent._root():this},no.prototype.waitFor=function(j){var S,P=this._root(),_=Ve.resolve(j),B=(P._waitingFor?P._waitingFor=P._waitingFor.then(function(){return _}):(P._waitingFor=_,P._waitingQueue=[],S=P.idbtrans.objectStore(P.storeNames[0]),function q(){for(++P._spinCount;P._waitingQueue.length;)P._waitingQueue.shift()();P._waitingFor&&(S.get(-1/0).onsuccess=q)}()),P._waitingFor);return new Ve(function(q,Z){_.then(function(Q){return P._waitingQueue.push(_t(q.bind(null,Q)))},function(Q){return P._waitingQueue.push(_t(Z.bind(null,Q)))}).finally(function(){P._waitingFor===B&&(P._waitingFor=null)})})},no.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new se.Abort))},no.prototype.table=function(j){var S=this._memoizedTables||(this._memoizedTables={});if(f(S,j))return S[j];var P=this.schema[j];if(P)return(P=new this.db.Table(j,P,this)).core=this.db.core.table(j),S[j]=P;throw new se.NotFound("Table "+j+" not part of transaction")},no);function no(){}function Ub(j,S,P,_,B,q,Z,Q){return{name:j,keyPath:S,unique:P,multi:_,auto:B,compound:q,src:(P&&!Z?"&":"")+(_?"*":"")+(B?"++":"")+zE(S),type:Q}}function zE(j){return typeof j=="string"?j:j?"["+[].join.call(j,"+")+"]":""}function qb(j,S,P){return{name:j,primKey:S,indexes:P,mappedClass:null,idxByName:(_=function(B){return[B.name,B]},P.reduce(function(B,q,Z){return q=_(q,Z),q&&(B[q[0]]=q[1]),B},{}))};var _}var Tu=function(j){try{return j.only([[]]),Tu=function(){return[[]]},[[]]}catch{return Tu=function(){return ra},ra}};function Vb(j){return j==null?function(){}:typeof j=="string"?(S=j).split(".").length===1?function(P){return P[S]}:function(P){return C(P,S)}:function(P){return C(P,j)};var S}function UE(j){return[].slice.call(j)}var tF=0;function _u(j){return j==null?":id":typeof j=="string"?j:"[".concat(j.join("+"),"]")}function rF(j,S,ue){function _(le){if(le.type===3)return null;if(le.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var oe=le.lower,de=le.upper,fe=le.lowerOpen,le=le.upperOpen;return oe===void 0?de===void 0?null:S.upperBound(de,!!le):de===void 0?S.lowerBound(oe,!!fe):S.bound(oe,de,!!fe,!!le)}function B(ce){var oe,de=ce.name;return{name:de,schema:ce,mutate:function(fe){var le=fe.trans,ie=fe.type,ve=fe.keys,we=fe.values,he=fe.range;return new Promise(function(Oe,Fe){Oe=_t(Oe);var Xe=le.objectStore(de),Ge=Xe.keyPath==null,$e=ie==="put"||ie==="add";if(!$e&&ie!=="delete"&&ie!=="deleteRange")throw new Error("Invalid operation type: "+ie);var at,tt=(ve||we||{length:1}).length;if(ve&&we&&ve.length!==we.length)throw new Error("Given keys array must have same length as given values array.");if(tt===0)return Oe({numFailures:0,failures:{},results:[],lastResult:void 0});function Ke(Gr){++rr,Au(Gr)}var it=[],Jt=[],rr=0;if(ie==="deleteRange"){if(he.type===4)return Oe({numFailures:rr,failures:Jt,results:[],lastResult:void 0});he.type===3?it.push(at=Xe.clear()):it.push(at=Xe.delete(_(he)))}else{var Ge=$e?Ge?[we,ve]:[we,null]:[ve,null],xt=Ge[0],zt=Ge[1];if($e)for(var Yr=0;Yr<tt;++Yr)it.push(at=zt&&zt[Yr]!==void 0?Xe[ie](xt[Yr],zt[Yr]):Xe[ie](xt[Yr])),at.onerror=Ke;else for(Yr=0;Yr<tt;++Yr)it.push(at=Xe[ie](xt[Yr])),at.onerror=Ke}function wa(Gr){Gr=Gr.target.result,it.forEach(function(Ni,cy){return Ni.error!=null&&(Jt[cy]=Ni.error)}),Oe({numFailures:rr,failures:Jt,results:ie==="delete"?ve:it.map(function(Ni){return Ni.result}),lastResult:Gr})}at.onerror=function(Gr){Ke(Gr),wa(Gr)},at.onsuccess=wa})},getMany:function(fe){var le=fe.trans,ie=fe.keys;return new Promise(function(ve,we){ve=_t(ve);for(var he,Oe=le.objectStore(de),Fe=ie.length,Xe=new Array(Fe),Ge=0,$e=0,at=function(it){it=it.target,Xe[it._pos]=it.result,++$e===Ge&&ve(Xe)},tt=ro(we),Ke=0;Ke<Fe;++Ke)ie[Ke]!=null&&((he=Oe.get(ie[Ke]))._pos=Ke,he.onsuccess=at,he.onerror=tt,++Ge);Ge===0&&ve(Xe)})},get:function(fe){var le=fe.trans,ie=fe.key;return new Promise(function(ve,we){ve=_t(ve);var he=le.objectStore(de).get(ie);he.onsuccess=function(Oe){return ve(Oe.target.result)},he.onerror=ro(we)})},query:(oe=Q,function(fe){return new Promise(function(le,ie){le=_t(le);var ve,we,he,$e=fe.trans,Oe=fe.values,Fe=fe.limit,Ge=fe.query,Xe=Fe===1/0?void 0:Fe,at=Ge.index,Ge=Ge.range,$e=$e.objectStore(de),$e=at.isPrimaryKey?$e:$e.index(at.name),at=_(Ge);if(Fe===0)return le({result:[]});oe?((Ge=Oe?$e.getAll(at,Xe):$e.getAllKeys(at,Xe)).onsuccess=function(tt){return le({result:tt.target.result})},Ge.onerror=ro(ie)):(ve=0,we=!Oe&&"openKeyCursor"in $e?$e.openKeyCursor(at):$e.openCursor(at),he=[],we.onsuccess=function(tt){var Ke=we.result;return!Ke||(he.push(Oe?Ke.value:Ke.primaryKey),++ve===Fe)?le({result:he}):void Ke.continue()},we.onerror=ro(ie))})}),openCursor:function(fe){var le=fe.trans,ie=fe.values,ve=fe.query,we=fe.reverse,he=fe.unique;return new Promise(function(Oe,Fe){Oe=_t(Oe);var $e=ve.index,Xe=ve.range,Ge=le.objectStore(de),Ge=$e.isPrimaryKey?Ge:Ge.index($e.name),$e=we?he?"prevunique":"prev":he?"nextunique":"next",at=!ie&&"openKeyCursor"in Ge?Ge.openKeyCursor(_(Xe),$e):Ge.openCursor(_(Xe),$e);at.onerror=ro(Fe),at.onsuccess=_t(function(tt){var Ke,it,Jt,rr,xt=at.result;xt?(xt.___id=++tF,xt.done=!1,Ke=xt.continue.bind(xt),it=(it=xt.continuePrimaryKey)&&it.bind(xt),Jt=xt.advance.bind(xt),rr=function(){throw new Error("Cursor not stopped")},xt.trans=le,xt.stop=xt.continue=xt.continuePrimaryKey=xt.advance=function(){throw new Error("Cursor not started")},xt.fail=_t(Fe),xt.next=function(){var zt=this,Yr=1;return this.start(function(){return Yr--?zt.continue():zt.stop()}).then(function(){return zt})},xt.start=function(zt){function Yr(){if(at.result)try{zt()}catch(Gr){xt.fail(Gr)}else xt.done=!0,xt.start=function(){throw new Error("Cursor behind last entry")},xt.stop()}var wa=new Promise(function(Gr,Ni){Gr=_t(Gr),at.onerror=ro(Ni),xt.fail=Ni,xt.stop=function(cy){xt.stop=xt.continue=xt.continuePrimaryKey=xt.advance=rr,Gr(cy)}});return at.onsuccess=_t(function(Gr){at.onsuccess=Yr,Yr()}),xt.continue=Ke,xt.continuePrimaryKey=it,xt.advance=Jt,Yr(),wa},Oe(xt)):Oe(null)},Fe)})},count:function(fe){var le=fe.query,ie=fe.trans,ve=le.index,we=le.range;return new Promise(function(he,Oe){var Fe=ie.objectStore(de),Fe=ve.isPrimaryKey?Fe:Fe.index(ve.name),Xe=_(we),Xe=Xe?Fe.count(Xe):Fe.count();Xe.onsuccess=_t(function(Ge){return he(Ge.target.result)}),Xe.onerror=ro(Oe)})}}}q=ue,Z=UE((ue=j).objectStoreNames);var q,ue={schema:{name:ue.name,tables:Z.map(function(ce){return q.objectStore(ce)}).map(function(ce){var oe=ce.keyPath,de=ce.autoIncrement,le=l(oe),fe={},le={name:ce.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:oe==null,compound:le,keyPath:oe,autoIncrement:de,unique:!0,extractKey:Vb(oe)},indexes:UE(ce.indexNames).map(function(ie){return ce.index(ie)}).map(function(he){var Oe=he.name,ve=he.unique,we=he.multiEntry,he=he.keyPath,Oe={name:Oe,compound:l(he),keyPath:he,unique:ve,multiEntry:we,extractKey:Vb(he)};return fe[_u(he)]=Oe}),getIndexByKeyPath:function(ie){return fe[_u(ie)]}};return fe[":id"]=le.primaryKey,oe!=null&&(fe[_u(oe)]=le.primaryKey),le})},hasGetAll:0<Z.length&&"getAll"in q.objectStore(Z[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)},Z=ue.schema,Q=ue.hasGetAll,ue=Z.tables.map(B),be={};return ue.forEach(function(ce){return be[ce.name]=ce}),{stack:"dbcore",transaction:j.transaction.bind(j),table:function(ce){if(be[ce])return be[ce];throw new Error("Table '".concat(ce,"' not found"))},MIN_KEY:-1/0,MAX_KEY:Tu(S),schema:Z}}function nF(j,S,P,_){return P=P.IDBKeyRange,S=rF(S,P,_),{dbcore:j.dbcore.reduce(function(B,q){return q=q.create,n(n({},B),q(B))},S)}}function um(j,S){var P=S.db,P=nF(j._middlewares,P,j._deps,S);j.core=P.dbcore,j.tables.forEach(function(_){var B=_.name;j.core.schema.tables.some(function(q){return q.name===B})&&(_.core=j.core.table(B),j[B]instanceof j.Table)&&(j[B].core=_.core)})}function dm(j,S,P,_){P.forEach(function(B){var q=_[B];S.forEach(function(Z){var Q=function ue(be,ce){return y(be,ce)||(be=u(be))&&ue(be,ce)}(Z,B);(!Q||"value"in Q&&Q.value===void 0)&&(Z===j.Transaction.prototype||Z instanceof j.Transaction?g(Z,B,{get:function(){return this.table(B)},set:function(ue){h(this,B,{value:ue,writable:!0,configurable:!0,enumerable:!0})}}):Z[B]=new j.Table(B,q))})})}function Wb(j,S){S.forEach(function(P){for(var _ in P)P[_]instanceof j.Table&&delete P[_]})}function aF(j,S){return j._cfg.version-S._cfg.version}function oF(j,S,P,_){var B=j._dbSchema,q=(P.objectStoreNames.contains("$meta")&&!B.$meta&&(B.$meta=qb("$meta",VE("")[0],[]),j._storeNames.push("$meta")),j._createTransaction("readwrite",j._storeNames,B)),Z=(q.create(P),q._completion.catch(_),q._reject.bind(q)),Q=Le.transless||Le;Ye(function(){if(Le.trans=q,Le.transless=Q,S!==0)return um(j,P),be=S,((ue=q).storeNames.includes("$meta")?ue.table("$meta").get("version").then(function(ce){return ce??be}):Ve.resolve(be)).then(function(ve){var oe=j,de=ve,fe=q,le=P,ie=[],ve=oe._versions,we=oe._dbSchema=mm(0,oe.idbdb,le);return(ve=ve.filter(function(he){return he._cfg.version>=de})).length===0?Ve.resolve():(ve.forEach(function(he){ie.push(function(){var Oe,Fe,Xe,Ge=we,$e=he._cfg.dbschema,at=(pm(oe,Ge,le),pm(oe,$e,le),we=oe._dbSchema=$e,Kb(Ge,$e)),tt=(at.add.forEach(function(Ke){Yb(le,Ke[0],Ke[1].primKey,Ke[1].indexes)}),at.change.forEach(function(Ke){if(Ke.recreate)throw new se.Upgrade("Not yet support for changing primary key");var it=le.objectStore(Ke.name);Ke.add.forEach(function(Jt){return fm(it,Jt)}),Ke.change.forEach(function(Jt){it.deleteIndex(Jt.name),fm(it,Jt)}),Ke.del.forEach(function(Jt){return it.deleteIndex(Jt)})}),he._cfg.contentUpgrade);if(tt&&he._cfg.version>de)return um(oe,le),fe._memoizedTables={},Oe=D($e),at.del.forEach(function(Ke){Oe[Ke]=Ge[Ke]}),Wb(oe,[oe.Transaction.prototype]),dm(oe,[oe.Transaction.prototype],s(Oe),Oe),fe.schema=Oe,(Fe=U(tt))&&Pt(),$e=Ve.follow(function(){var Ke;(Xe=tt(fe))&&Fe&&(Ke=Kt.bind(null,null),Xe.then(Ke,Ke))}),Xe&&typeof Xe.then=="function"?Ve.resolve(Xe):$e.then(function(){return Xe})}),ie.push(function(Oe){var Fe,Xe,Ge=he._cfg.dbschema;Fe=Ge,Xe=Oe,[].slice.call(Xe.db.objectStoreNames).forEach(function($e){return Fe[$e]==null&&Xe.db.deleteObjectStore($e)}),Wb(oe,[oe.Transaction.prototype]),dm(oe,[oe.Transaction.prototype],oe._storeNames,oe._dbSchema),fe.schema=oe._dbSchema}),ie.push(function(Oe){oe.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(oe.idbdb.version/10)===he._cfg.version?(oe.idbdb.deleteObjectStore("$meta"),delete oe._dbSchema.$meta,oe._storeNames=oe._storeNames.filter(function(Fe){return Fe!=="$meta"})):Oe.objectStore("$meta").put(he._cfg.version,"version"))})}),function he(){return ie.length?Ve.resolve(ie.shift()(fe.idbtrans)).then(he):Ve.resolve()}().then(function(){qE(we,le)}))}).catch(Z);var ue,be;s(B).forEach(function(ce){Yb(P,ce,B[ce].primKey,B[ce].indexes)}),um(j,P),Ve.follow(function(){return j.on.populate.fire(q)}).catch(Z)})}function sF(j,S){qE(j._dbSchema,S),S.db.version%10!=0||S.objectStoreNames.contains("$meta")||S.db.createObjectStore("$meta").add(Math.ceil(S.db.version/10-1),"version");var P=mm(0,j.idbdb,S);pm(j,j._dbSchema,S);for(var _=0,B=Kb(P,j._dbSchema).change;_<B.length;_++){var q=(Z=>{if(Z.change.length||Z.recreate)return console.warn("Unable to patch indexes of table ".concat(Z.name," because it has changes on the type of index or primary key.")),{value:void 0};var Q=S.objectStore(Z.name);Z.add.forEach(function(ue){De&&console.debug("Dexie upgrade patch: Creating missing index ".concat(Z.name,".").concat(ue.src)),fm(Q,ue)})})(B[_]);if(typeof q=="object")return q.value}}function Kb(j,S){var P,_={del:[],add:[],change:[]};for(P in j)S[P]||_.del.push(P);for(P in S){var B=j[P],q=S[P];if(B){var Z={name:P,def:q,recreate:!1,del:[],add:[],change:[]};if(""+(B.primKey.keyPath||"")!=""+(q.primKey.keyPath||"")||B.primKey.auto!==q.primKey.auto)Z.recreate=!0,_.change.push(Z);else{var Q=B.idxByName,ue=q.idxByName,be=void 0;for(be in Q)ue[be]||Z.del.push(be);for(be in ue){var ce=Q[be],oe=ue[be];ce?ce.src!==oe.src&&Z.change.push(oe):Z.add.push(oe)}(0<Z.del.length||0<Z.add.length||0<Z.change.length)&&_.change.push(Z)}}else _.add.push([P,q])}return _}function Yb(j,S,P,_){var B=j.db.createObjectStore(S,P.keyPath?{keyPath:P.keyPath,autoIncrement:P.auto}:{autoIncrement:P.auto});_.forEach(function(q){return fm(B,q)})}function qE(j,S){s(j).forEach(function(P){S.db.objectStoreNames.contains(P)||(De&&console.debug("Dexie: Creating missing table",P),Yb(S,P,j[P].primKey,j[P].indexes))})}function fm(j,S){j.createIndex(S.name,S.keyPath,{unique:S.unique,multiEntry:S.multi})}function mm(j,S,P){var _={};return k(S.objectStoreNames,0).forEach(function(B){for(var q=P.objectStore(B),Z=Ub(zE(be=q.keyPath),be||"",!0,!1,!!q.autoIncrement,be&&typeof be!="string",!0),Q=[],ue=0;ue<q.indexNames.length;++ue){var ce=q.index(q.indexNames[ue]),be=ce.keyPath,ce=Ub(ce.name,be,!!ce.unique,!!ce.multiEntry,!1,be&&typeof be!="string",!1);Q.push(ce)}_[B]=qb(B,Z,Q)}),_}function pm(j,S,P){for(var _=P.db.objectStoreNames,B=0;B<_.length;++B){var q=_[B],Z=P.objectStore(q);j._hasGetAll="getAll"in Z;for(var Q=0;Q<Z.indexNames.length;++Q){var ue,be=Z.indexNames[Q],ce=Z.index(be).keyPath,ce=typeof ce=="string"?ce:"["+k(ce).join("+")+"]";S[q]&&(ue=S[q].idxByName[ce])&&(ue.name=be,delete S[q].idxByName[ce],S[q].idxByName[be]=ue)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&o.WorkerGlobalScope&&o instanceof o.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(j._hasGetAll=!1)}function VE(j){return j.split(",").map(function(S,P){var B=S.split(":"),_=(_=B[1])==null?void 0:_.trim(),B=(S=B[0].trim()).replace(/([&*]|\+\+)/g,""),q=/^\[/.test(B)?B.match(/^\[(.*)\]$/)[1].split("+"):B;return Ub(B,q||null,/\&/.test(S),/\*/.test(S),/\+\+/.test(S),l(q),P===0,_)})}Cl.prototype._createTableSchema=qb,Cl.prototype._parseIndexSyntax=VE,Cl.prototype._parseStoresSpec=function(j,S){var P=this;s(j).forEach(function(_){if(j[_]!==null){var B=P._parseIndexSyntax(j[_]),q=B.shift();if(!q)throw new se.Schema("Invalid schema for table "+_+": "+j[_]);if(q.unique=!0,q.multi)throw new se.Schema("Primary key cannot be multiEntry*");B.forEach(function(Z){if(Z.auto)throw new se.Schema("Only primary key can be marked as autoIncrement (++)");if(!Z.keyPath)throw new se.Schema("Index must have a name and cannot be an empty string")}),q=P._createTableSchema(_,q,B),S[_]=q}})},Cl.prototype.stores=function(P){var S=this.db,P=(this._cfg.storesSource=this._cfg.storesSource?c(this._cfg.storesSource,P):P,S._versions),_={},B={};return P.forEach(function(q){c(_,q._cfg.storesSource),B=q._cfg.dbschema={},q._parseStoresSpec(_,B)}),S._dbSchema=B,Wb(S,[S._allTables,S,S.Transaction.prototype]),dm(S,[S._allTables,S,S.Transaction.prototype,this._cfg.tables],s(B),B),S._storeNames=s(B),this},Cl.prototype.upgrade=function(j){return this._cfg.contentUpgrade=rt(this._cfg.contentUpgrade||K,j),this};var iF=Cl;function Cl(){}function Xb(j,S){var P=j._dbNamesDB;return P||(P=j._dbNamesDB=new Ro(jl,{addons:[],indexedDB:j,IDBKeyRange:S})).version(1).stores({dbnames:"name"}),P.table("dbnames")}function Gb(j){return j&&typeof j.databases=="function"}function Zb(j){return Ye(function(){return Le.letThrough=!0,j()})}function Jb(j){return!("from"in j)}var On=function(j,S){var P;if(!this)return P=new On,j&&"d"in j&&c(P,j),P;c(this,arguments.length?{d:1,from:j,to:1<arguments.length?S:j}:{d:0})};function Iu(j,S,P){var _=Wt(S,P);if(!isNaN(_)){if(0<_)throw RangeError();if(Jb(j))return c(j,{from:S,to:P,d:1});var _=j.l,B=j.r;if(Wt(P,j.from)<0)return _?Iu(_,S,P):j.l={from:S,to:P,d:1,l:null,r:null},KE(j);if(0<Wt(S,j.to))return B?Iu(B,S,P):j.r={from:S,to:P,d:1,l:null,r:null},KE(j);Wt(S,j.from)<0&&(j.from=S,j.l=null,j.d=B?B.d+1:1),0<Wt(P,j.to)&&(j.to=P,j.r=null,j.d=j.l?j.l.d+1:1),S=!j.r,_&&!j.l&&Du(j,_),B&&S&&Du(j,B)}}function Du(j,S){Jb(S)||function P(_,B){var q=B.from,Z=B.l,Q=B.r;Iu(_,q,B.to),Z&&P(_,Z),Q&&P(_,Q)}(j,S)}function WE(j,S){var P=hm(S),_=P.next();if(!_.done)for(var B=_.value,q=hm(j),Z=q.next(B.from),Q=Z.value;!_.done&&!Z.done;){if(Wt(Q.from,B.to)<=0&&0<=Wt(Q.to,B.from))return!0;Wt(B.from,Q.from)<0?B=(_=P.next(Q.from)).value:Q=(Z=q.next(B.from)).value}return!1}function hm(j){var S=Jb(j)?null:{s:0,n:j};return{next:function(P){for(var _=0<arguments.length;S;)switch(S.s){case 0:if(S.s=1,_)for(;S.n.l&&Wt(P,S.n.from)<0;)S={up:S,n:S.n.l,s:1};else for(;S.n.l;)S={up:S,n:S.n.l,s:1};case 1:if(S.s=2,!_||Wt(P,S.n.to)<=0)return{value:S.n,done:!1};case 2:if(S.n.r){S.s=3,S={up:S,n:S.n.r,s:0};continue}case 3:S=S.up}return{done:!0}}}}function KE(j){var S,P,_,B=(((B=j.r)==null?void 0:B.d)||0)-(((B=j.l)==null?void 0:B.d)||0),B=1<B?"r":B<-1?"l":"";B&&(S=B=="r"?"l":"r",P=n({},j),_=j[B],j.from=_.from,j.to=_.to,j[B]=_[B],P[B]=_[S],(j[S]=P).d=YE(P)),j.d=YE(j)}function YE(P){var S=P.r,P=P.l;return(S?P?Math.max(S.d,P.d):S.d:P?P.d:0)+1}function gm(j,S){return s(S).forEach(function(P){j[P]?Du(j[P],S[P]):j[P]=function _(B){var q,Z,Q={};for(q in B)f(B,q)&&(Z=B[q],Q[q]=!Z||typeof Z!="object"||I.has(Z.constructor)?Z:_(Z));return Q}(S[P])}),j}function Qb(j,S){return j.all||S.all||Object.keys(j).some(function(P){return S[P]&&WE(S[P],j[P])})}p(On.prototype,((ft={add:function(j){return Du(this,j),this},addKey:function(j){return Iu(this,j,j),this},addKeys:function(j){var S=this;return j.forEach(function(P){return Iu(S,P,P)}),this},hasKey:function(j){var S=hm(this).next(j).value;return S&&Wt(S.from,j)<=0&&0<=Wt(S.to,j)}})[V]=function(){return hm(this)},ft));var wi={},ey={},ty=!1;function bm(j){gm(ey,j),ty||(ty=!0,setTimeout(function(){ty=!1,ry(ey,!(ey={}))},0))}function ry(j,S){S===void 0&&(S=!1);var P=new Set;if(j.all)for(var _=0,B=Object.values(wi);_<B.length;_++)XE(Q=B[_],j,P,S);else for(var q in j){var Z,Q,q=/^idb\:\/\/(.*)\/(.*)\//.exec(q);q&&(Z=q[1],q=q[2],Q=wi["idb://".concat(Z,"/").concat(q)])&&XE(Q,j,P,S)}P.forEach(function(ue){return ue()})}function XE(j,S,P,_){for(var B=[],q=0,Z=Object.entries(j.queries.query);q<Z.length;q++){for(var Q=Z[q],ue=Q[0],be=[],ce=0,oe=Q[1];ce<oe.length;ce++){var de=oe[ce];Qb(S,de.obsSet)?de.subscribers.forEach(function(ve){return P.add(ve)}):_&&be.push(de)}_&&B.push([ue,be])}if(_)for(var fe=0,le=B;fe<le.length;fe++){var ie=le[fe],ue=ie[0],be=ie[1];j.queries.query[ue]=be}}function lF(j){var S=j._state,P=j._deps.indexedDB;if(S.isBeingOpened||j.idbdb)return S.dbReadyPromise.then(function(){return S.dbOpenError?Sr(S.dbOpenError):j});S.isBeingOpened=!0,S.dbOpenError=null,S.openComplete=!1;var _=S.openCanceller,B=Math.round(10*j.verno),q=!1;function Z(){if(S.openCanceller!==_)throw new se.DatabaseClosed("db.open() was cancelled")}function Q(){return new Ve(function(de,fe){if(Z(),!P)throw new se.MissingAPI;var le=j.name,ie=S.autoSchema||!B?P.open(le):P.open(le,B);if(!ie)throw new se.MissingAPI;ie.onerror=ro(fe),ie.onblocked=_t(j._fireOnBlocked),ie.onupgradeneeded=_t(function(ve){var we;ce=ie.transaction,S.autoSchema&&!j._options.allowEmptyDB?(ie.onerror=Au,ce.abort(),ie.result.close(),(we=P.deleteDatabase(le)).onsuccess=we.onerror=_t(function(){fe(new se.NoSuchDatabase("Database ".concat(le," doesnt exist")))})):(ce.onerror=ro(fe),we=ve.oldVersion>Math.pow(2,62)?0:ve.oldVersion,oe=we<1,j.idbdb=ie.result,q&&sF(j,ce),oF(j,we/10,ce,fe))},fe),ie.onsuccess=_t(function(){ce=null;var ve,we,he,Oe,Fe,Xe,Ge=j.idbdb=ie.result,$e=k(Ge.objectStoreNames);if(0<$e.length)try{var at=Ge.transaction((Fe=$e).length===1?Fe[0]:Fe,"readonly");if(S.autoSchema)Xe=Ge,Oe=at,(he=j).verno=Xe.version/10,Oe=he._dbSchema=mm(0,Xe,Oe),he._storeNames=k(Xe.objectStoreNames,0),dm(he,[he._allTables],s(Oe),Oe);else if(pm(j,j._dbSchema,at),we=at,((we=Kb(mm(0,(ve=j).idbdb,we),ve._dbSchema)).add.length||we.change.some(function(tt){return tt.add.length||tt.change.length}))&&!q)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),Ge.close(),B=Ge.version+1,q=!0,de(Q());um(j,at)}catch{}to.push(j),Ge.onversionchange=_t(function(tt){S.vcFired=!0,j.on("versionchange").fire(tt)}),Ge.onclose=_t(function(){j.close({disableAutoOpen:!1})}),oe&&($e=j._deps,Fe=le,Gb(Xe=$e.indexedDB)||Fe===jl||Xb(Xe,$e.IDBKeyRange).put({name:Fe}).catch(K)),de()},fe)}).catch(function(de){switch(de?.name){case"UnknownError":if(0<S.PR1398_maxLoop)return S.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),Q();break;case"VersionError":if(0<B)return B=0,Q()}return Ve.reject(de)})}var ue,be=S.dbReadyResolve,ce=null,oe=!1;return Ve.race([_,(typeof navigator>"u"?Ve.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(de){function fe(){return indexedDB.databases().finally(de)}ue=setInterval(fe,100),fe()}).finally(function(){return clearInterval(ue)}):Promise.resolve()).then(Q)]).then(function(){return Z(),S.onReadyBeingFired=[],Ve.resolve(Zb(function(){return j.on.ready.fire(j.vip)})).then(function de(){var fe;if(0<S.onReadyBeingFired.length)return fe=S.onReadyBeingFired.reduce(rt,K),S.onReadyBeingFired=[],Ve.resolve(Zb(function(){return fe(j.vip)})).then(de)})}).finally(function(){S.openCanceller===_&&(S.onReadyBeingFired=null,S.isBeingOpened=!1)}).catch(function(de){S.dbOpenError=de;try{ce&&ce.abort()}catch{}return _===S.openCanceller&&j._close(),Sr(de)}).finally(function(){S.openComplete=!0,be()}).then(function(){var de;return oe&&(de={},j.tables.forEach(function(fe){fe.schema.indexes.forEach(function(le){le.name&&(de["idb://".concat(j.name,"/").concat(fe.name,"/").concat(le.name)]=new On(-1/0,[[[]]]))}),de["idb://".concat(j.name,"/").concat(fe.name,"/")]=de["idb://".concat(j.name,"/").concat(fe.name,"/:dels")]=new On(-1/0,[[[]]])}),js(Mu).fire(de),ry(de,!0)),j})}function ny(j){function S(q){return j.next(q)}var P=B(S),_=B(function(q){return j.throw(q)});function B(q){return function(Q){var Q=q(Q),ue=Q.value;return Q.done?ue:ue&&typeof ue.then=="function"?ue.then(P,_):l(ue)?Promise.all(ue).then(P,_):P(ue)}}return B(S)()}function ym(j,S,P){for(var _=l(j)?j.slice():[j],B=0;B<P;++B)_.push(S);return _}var cF={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(j){return n(n({},j),{table:function(_){var P=j.table(_),_=P.schema,B={},q=[];function Z(de,fe,le){var he=_u(de),ie=B[he]=B[he]||[],ve=de==null?0:typeof de=="string"?1:de.length,we=0<fe,he=n(n({},le),{name:we?"".concat(he,"(virtual-from:").concat(le.name,")"):le.name,lowLevelIndex:le,isVirtual:we,keyTail:fe,keyLength:ve,extractKey:Vb(de),unique:!we&&le.unique});return ie.push(he),he.isPrimaryKey||q.push(he),1<ve&&Z(ve===2?de[0]:de.slice(0,ve-1),fe+1,le),ie.sort(function(Oe,Fe){return Oe.keyTail-Fe.keyTail}),he}var Q=Z(_.primaryKey.keyPath,0,_.primaryKey);B[":id"]=[Q];for(var ue=0,be=_.indexes;ue<be.length;ue++){var ce=be[ue];Z(ce.keyPath,0,ce)}function oe(de){var fe,le=de.query.index;return le.isVirtual?n(n({},de),{query:{index:le.lowLevelIndex,range:(fe=de.query.range,le=le.keyTail,{type:fe.type===1?2:fe.type,lower:ym(fe.lower,fe.lowerOpen?j.MAX_KEY:j.MIN_KEY,le),lowerOpen:!0,upper:ym(fe.upper,fe.upperOpen?j.MIN_KEY:j.MAX_KEY,le),upperOpen:!0})}}):de}return n(n({},P),{schema:n(n({},_),{primaryKey:Q,indexes:q,getIndexByKeyPath:function(de){return(de=B[_u(de)])&&de[0]}}),count:function(de){return P.count(oe(de))},query:function(de){return P.query(oe(de))},openCursor:function(de){var fe=de.query.index,le=fe.keyTail,ie=fe.keyLength;return fe.isVirtual?P.openCursor(oe(de)).then(function(we){return we&&ve(we)}):P.openCursor(de);function ve(we){return Object.create(we,{continue:{value:function(he){he!=null?we.continue(ym(he,de.reverse?j.MAX_KEY:j.MIN_KEY,le)):de.unique?we.continue(we.key.slice(0,ie).concat(de.reverse?j.MIN_KEY:j.MAX_KEY,le)):we.continue()}},continuePrimaryKey:{value:function(he,Oe){we.continuePrimaryKey(ym(he,j.MAX_KEY,le),Oe)}},primaryKey:{get:function(){return we.primaryKey}},key:{get:function(){var he=we.key;return ie===1?he[0]:he.slice(0,ie)}},value:{get:function(){return we.value}}})}}})}})}};function ay(j,S,P,_){return P=P||{},_=_||"",s(j).forEach(function(B){var q,Z,Q;f(S,B)?(q=j[B],Z=S[B],typeof q=="object"&&typeof Z=="object"&&q&&Z?(Q=F(q))!==F(Z)?P[_+B]=S[B]:Q==="Object"?ay(q,Z,P,_+B+"."):q!==Z&&(P[_+B]=S[B]):q!==Z&&(P[_+B]=S[B])):P[_+B]=void 0}),s(S).forEach(function(B){f(j,B)||(P[_+B]=S[B])}),P}function oy(j,S){return S.type==="delete"?S.keys:S.keys||S.values.map(j.extractKey)}var uF={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(j){return n(n({},j),{table:function(S){var P=j.table(S),_=P.schema.primaryKey;return n(n({},P),{mutate:function(B){var q=Le.trans,Z=q.table(S).hook,Q=Z.deleting,ue=Z.creating,be=Z.updating;switch(B.type){case"add":if(ue.fire===K)break;return q._promise("readwrite",function(){return ce(B)},!0);case"put":if(ue.fire===K&&be.fire===K)break;return q._promise("readwrite",function(){return ce(B)},!0);case"delete":if(Q.fire===K)break;return q._promise("readwrite",function(){return ce(B)},!0);case"deleteRange":if(Q.fire===K)break;return q._promise("readwrite",function(){return function oe(de,fe,le){return P.query({trans:de,values:!1,query:{index:_,range:fe},limit:le}).then(function(ie){var ve=ie.result;return ce({type:"delete",keys:ve,trans:de}).then(function(we){return 0<we.numFailures?Promise.reject(we.failures[0]):ve.length<le?{failures:[],numFailures:0,lastResult:void 0}:oe(de,n(n({},fe),{lower:ve[ve.length-1],lowerOpen:!0}),le)})})}(B.trans,B.range,1e4)},!0)}return P.mutate(B);function ce(oe){var de,fe,le,ie=Le.trans,ve=oe.keys||oy(_,oe);if(ve)return(oe=oe.type==="add"||oe.type==="put"?n(n({},oe),{keys:ve}):n({},oe)).type!=="delete"&&(oe.values=a([],oe.values)),oe.keys&&(oe.keys=a([],oe.keys)),de=P,le=ve,((fe=oe).type==="add"?Promise.resolve([]):de.getMany({trans:fe.trans,keys:le,cache:"immutable"})).then(function(we){var he=ve.map(function(Oe,Fe){var Xe,Ge,$e,at=we[Fe],tt={onerror:null,onsuccess:null};return oe.type==="delete"?Q.fire.call(tt,Oe,at,ie):oe.type==="add"||at===void 0?(Xe=ue.fire.call(tt,Oe,oe.values[Fe],ie),Oe==null&&Xe!=null&&(oe.keys[Fe]=Oe=Xe,_.outbound||O(oe.values[Fe],_.keyPath,Oe))):(Xe=ay(at,oe.values[Fe]),(Ge=be.fire.call(tt,Xe,Oe,at,ie))&&($e=oe.values[Fe],Object.keys(Ge).forEach(function(Ke){f($e,Ke)?$e[Ke]=Ge[Ke]:O($e,Ke,Ge[Ke])}))),tt});return P.mutate(oe).then(function(Oe){for(var Fe=Oe.failures,Xe=Oe.results,Ge=Oe.numFailures,Oe=Oe.lastResult,$e=0;$e<ve.length;++$e){var at=(Xe||ve)[$e],tt=he[$e];at==null?tt.onerror&&tt.onerror(Fe[$e]):tt.onsuccess&&tt.onsuccess(oe.type==="put"&&we[$e]?oe.values[$e]:at)}return{failures:Fe,results:Xe,numFailures:Ge,lastResult:Oe}}).catch(function(Oe){return he.forEach(function(Fe){return Fe.onerror&&Fe.onerror(Oe)}),Promise.reject(Oe)})});throw new Error("Keys missing")}}})}})}};function GE(j,S,P){try{if(!S||S.keys.length<j.length)return null;for(var _=[],B=0,q=0;B<S.keys.length&&q<j.length;++B)Wt(S.keys[B],j[q])===0&&(_.push(P?R(S.values[B]):S.values[B]),++q);return _.length===j.length?_:null}catch{return null}}var dF={stack:"dbcore",level:-1,create:function(j){return{table:function(S){var P=j.table(S);return n(n({},P),{getMany:function(_){var B;return _.cache?(B=GE(_.keys,_.trans._cache,_.cache==="clone"))?Ve.resolve(B):P.getMany(_).then(function(q){return _.trans._cache={keys:_.keys,values:_.cache==="clone"?R(q):q},q}):P.getMany(_)},mutate:function(_){return _.type!=="add"&&(_.trans._cache=null),P.mutate(_)}})}}}};function ZE(j,S){return j.trans.mode==="readonly"&&!!j.subscr&&!j.trans.explicit&&j.trans.db._options.cache!=="disabled"&&!S.schema.primaryKey.outbound}function JE(j,S){switch(j){case"query":return S.values&&!S.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var fF={stack:"dbcore",level:0,name:"Observability",create:function(j){var S=j.schema.name,P=new On(j.MIN_KEY,j.MAX_KEY);return n(n({},j),{transaction:function(_,B,q){if(Le.subscr&&B!=="readonly")throw new se.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(Le.querier));return j.transaction(_,B,q)},table:function(_){function B(ve){var ie,ve=ve.query;return[ie=ve.index,new On((ie=(ve=ve.range).lower)!=null?ie:j.MIN_KEY,(ie=ve.upper)!=null?ie:j.MAX_KEY)]}var q=j.table(_),Z=q.schema,Q=Z.primaryKey,ue=Z.indexes,be=Q.extractKey,ce=Q.outbound,oe=Q.autoIncrement&&ue.filter(function(le){return le.compound&&le.keyPath.includes(Q.keyPath)}),de=n(n({},q),{mutate:function(le){function ie(it){return it="idb://".concat(S,"/").concat(_,"/").concat(it),Fe[it]||(Fe[it]=new On)}var ve,we,he,Oe=le.trans,Fe=le.mutatedParts||(le.mutatedParts={}),Xe=ie(""),Ge=ie(":dels"),$e=le.type,tt=le.type==="deleteRange"?[le.range]:le.type==="delete"?[le.keys]:le.values.length<50?[oy(Q,le).filter(function(it){return it}),le.values]:[],at=tt[0],tt=tt[1],Ke=le.trans._cache;return l(at)?(Xe.addKeys(at),($e=$e==="delete"||at.length===tt.length?GE(at,Ke):null)||Ge.addKeys(at),($e||tt)&&(ve=ie,we=$e,he=tt,Z.indexes.forEach(function(it){var Jt=ve(it.name||"");function rr(zt){return zt!=null?it.extractKey(zt):null}function xt(zt){it.multiEntry&&l(zt)?zt.forEach(function(Yr){return Jt.addKey(Yr)}):Jt.addKey(zt)}(we||he).forEach(function(zt,Gr){var wa=we&&rr(we[Gr]),Gr=he&&rr(he[Gr]);Wt(wa,Gr)!==0&&(wa!=null&&xt(wa),Gr!=null)&&xt(Gr)})}))):at?(tt={from:(Ke=at.lower)!=null?Ke:j.MIN_KEY,to:($e=at.upper)!=null?$e:j.MAX_KEY},Ge.add(tt),Xe.add(tt)):(Xe.add(P),Ge.add(P),Z.indexes.forEach(function(it){return ie(it.name).add(P)})),q.mutate(le).then(function(it){return!at||le.type!=="add"&&le.type!=="put"||(Xe.addKeys(it.results),oe&&oe.forEach(function(Jt){for(var rr=le.values.map(function(wa){return Jt.extractKey(wa)}),xt=Jt.keyPath.findIndex(function(wa){return wa===Q.keyPath}),zt=0,Yr=it.results.length;zt<Yr;++zt)rr[zt][xt]=it.results[zt];ie(Jt.name).addKeys(rr)})),Oe.mutatedParts=gm(Oe.mutatedParts||{},Fe),it})}}),fe={get:function(le){return[Q,new On(le.key)]},getMany:function(le){return[Q,new On().addKeys(le.keys)]},count:B,query:B,openCursor:B};return s(fe).forEach(function(le){de[le]=function(ie){var ve=Le.subscr,we=!!ve,he=ZE(Le,q)&&JE(le,ie)?ie.obsSet={}:ve;if(we){var Oe,ve=function(tt){return tt="idb://".concat(S,"/").concat(_,"/").concat(tt),he[tt]||(he[tt]=new On)},Fe=ve(""),Xe=ve(":dels"),we=fe[le](ie),Ge=we[0],we=we[1];if((le==="query"&&Ge.isPrimaryKey&&!ie.values?Xe:ve(Ge.name||"")).add(we),!Ge.isPrimaryKey){if(le!=="count")return Oe=le==="query"&&ce&&ie.values&&q.query(n(n({},ie),{values:!1})),q[le].apply(this,arguments).then(function(tt){if(le==="query"){if(ce&&ie.values)return Oe.then(function(rr){return rr=rr.result,Fe.addKeys(rr),tt});var Ke=ie.values?tt.result.map(be):tt.result;(ie.values?Fe:Xe).addKeys(Ke)}else{var it,Jt;if(le==="openCursor")return Jt=ie.values,(it=tt)&&Object.create(it,{key:{get:function(){return Xe.addKey(it.primaryKey),it.key}},primaryKey:{get:function(){var rr=it.primaryKey;return Xe.addKey(rr),rr}},value:{get:function(){return Jt&&Fe.addKey(it.primaryKey),it.value}}})}return tt});Xe.add(P)}}return q[le].apply(this,arguments)}}),de}})}};function QE(j,S,P){var _;return P.numFailures===0?S:S.type==="deleteRange"||(_=S.keys?S.keys.length:"values"in S&&S.values?S.values.length:1,P.numFailures===_)?null:(_=n({},S),l(_.keys)&&(_.keys=_.keys.filter(function(B,q){return!(q in P.failures)})),"values"in _&&l(_.values)&&(_.values=_.values.filter(function(B,q){return!(q in P.failures)})),_)}function sy(j,S){return P=j,((_=S).lower===void 0||(_.lowerOpen?0<Wt(P,_.lower):0<=Wt(P,_.lower)))&&(P=j,(_=S).upper===void 0||(_.upperOpen?Wt(P,_.upper)<0:Wt(P,_.upper)<=0));var P,_}function eS(j,S,P,_,B,q){var Z,Q,ue,be,ce,oe;return!P||P.length===0||(Z=S.query.index,Q=Z.multiEntry,ue=S.query.range,be=_.schema.primaryKey.extractKey,ce=Z.extractKey,oe=(Z.lowLevelIndex||Z).extractKey,(_=P.reduce(function(de,fe){var le=de,ie=[];if(fe.type==="add"||fe.type==="put")for(var ve=new On,we=fe.values.length-1;0<=we;--we){var he,Oe=fe.values[we],Fe=be(Oe);!ve.hasKey(Fe)&&(he=ce(Oe),Q&&l(he)?he.some(function(tt){return sy(tt,ue)}):sy(he,ue))&&(ve.addKey(Fe),ie.push(Oe))}switch(fe.type){case"add":var Xe=new On().addKeys(S.values?de.map(function(Ke){return be(Ke)}):de),le=de.concat(S.values?ie.filter(function(Ke){return Ke=be(Ke),!Xe.hasKey(Ke)&&(Xe.addKey(Ke),!0)}):ie.map(function(Ke){return be(Ke)}).filter(function(Ke){return!Xe.hasKey(Ke)&&(Xe.addKey(Ke),!0)}));break;case"put":var Ge=new On().addKeys(fe.values.map(function(Ke){return be(Ke)}));le=de.filter(function(Ke){return!Ge.hasKey(S.values?be(Ke):Ke)}).concat(S.values?ie:ie.map(function(Ke){return be(Ke)}));break;case"delete":var $e=new On().addKeys(fe.keys);le=de.filter(function(Ke){return!$e.hasKey(S.values?be(Ke):Ke)});break;case"deleteRange":var at=fe.range;le=de.filter(function(Ke){return!sy(be(Ke),at)})}return le},j))===j)?j:(_.sort(function(de,fe){return Wt(oe(de),oe(fe))||Wt(be(de),be(fe))}),S.limit&&S.limit<1/0&&(_.length>S.limit?_.length=S.limit:j.length===S.limit&&_.length<S.limit&&(B.dirty=!0)),q?Object.freeze(_):_)}function tS(j,S){return Wt(j.lower,S.lower)===0&&Wt(j.upper,S.upper)===0&&!!j.lowerOpen==!!S.lowerOpen&&!!j.upperOpen==!!S.upperOpen}function mF(j,S){return((P,_,B,q)=>{if(P===void 0)return _!==void 0?-1:0;if(_===void 0)return 1;if((P=Wt(P,_))===0){if(B&&q)return 0;if(B)return 1;if(q)return-1}return P})(j.lower,S.lower,j.lowerOpen,S.lowerOpen)<=0&&0<=((P,_,B,q)=>{if(P===void 0)return _!==void 0?1:0;if(_===void 0)return-1;if((P=Wt(P,_))===0){if(B&&q)return 0;if(B)return-1;if(q)return 1}return P})(j.upper,S.upper,j.upperOpen,S.upperOpen)}function pF(j,S,P,_){j.subscribers.add(P),_.addEventListener("abort",function(){var B,q;j.subscribers.delete(P),j.subscribers.size===0&&(B=j,q=S,setTimeout(function(){B.subscribers.size===0&&$(q,B)},3e3))})}var hF={stack:"dbcore",level:0,name:"Cache",create:function(j){var S=j.schema.name;return n(n({},j),{transaction:function(P,_,B){var q,Z,Q=j.transaction(P,_,B);return _==="readwrite"&&(B=(q=new AbortController).signal,Q.addEventListener("abort",(Z=function(ue){return function(){if(q.abort(),_==="readwrite"){for(var be=new Set,ce=0,oe=P;ce<oe.length;ce++){var de=oe[ce],fe=wi["idb://".concat(S,"/").concat(de)];if(fe){var le=j.table(de),ie=fe.optimisticOps.filter(function(it){return it.trans===Q});if(Q._explicit&&ue&&Q.mutatedParts)for(var ve=0,we=Object.values(fe.queries.query);ve<we.length;ve++)for(var he=0,Oe=(Ge=we[ve]).slice();he<Oe.length;he++)Qb(($e=Oe[he]).obsSet,Q.mutatedParts)&&($(Ge,$e),$e.subscribers.forEach(function(it){return be.add(it)}));else if(0<ie.length){fe.optimisticOps=fe.optimisticOps.filter(function(it){return it.trans!==Q});for(var Fe=0,Xe=Object.values(fe.queries.query);Fe<Xe.length;Fe++)for(var Ge,$e,at,tt=0,Ke=(Ge=Xe[Fe]).slice();tt<Ke.length;tt++)($e=Ke[tt]).res!=null&&Q.mutatedParts&&(ue&&!$e.dirty?(at=Object.isFrozen($e.res),at=eS($e.res,$e.req,ie,le,$e,at),$e.dirty?($(Ge,$e),$e.subscribers.forEach(function(it){return be.add(it)})):at!==$e.res&&($e.res=at,$e.promise=Ve.resolve({result:at}))):($e.dirty&&$(Ge,$e),$e.subscribers.forEach(function(it){return be.add(it)})))}}}be.forEach(function(it){return it()})}}})(!1),{signal:B}),Q.addEventListener("error",Z(!1),{signal:B}),Q.addEventListener("complete",Z(!0),{signal:B})),Q},table:function(P){var _=j.table(P),B=_.schema.primaryKey;return n(n({},_),{mutate:function(q){var Z,Q=Le.trans;return!B.outbound&&Q.db._options.cache!=="disabled"&&!Q.explicit&&Q.idbtrans.mode==="readwrite"&&(Z=wi["idb://".concat(S,"/").concat(P)])?(Q=_.mutate(q),q.type!=="add"&&q.type!=="put"||!(50<=q.values.length||oy(B,q).some(function(ue){return ue==null}))?(Z.optimisticOps.push(q),q.mutatedParts&&bm(q.mutatedParts),Q.then(function(ue){0<ue.numFailures&&($(Z.optimisticOps,q),(ue=QE(0,q,ue))&&Z.optimisticOps.push(ue),q.mutatedParts)&&bm(q.mutatedParts)}),Q.catch(function(){$(Z.optimisticOps,q),q.mutatedParts&&bm(q.mutatedParts)})):Q.then(function(ue){var be=QE(0,n(n({},q),{values:q.values.map(function(ce,oe){var de;return ue.failures[oe]?ce:(O(de=(de=B.keyPath)!=null&&de.includes(".")?R(ce):n({},ce),B.keyPath,ue.results[oe]),de)})}),ue);Z.optimisticOps.push(be),queueMicrotask(function(){return q.mutatedParts&&bm(q.mutatedParts)})}),Q):_.mutate(q)},query:function(q){var Z,Q,ue,be,ce,oe,de;return ZE(Le,_)&&JE("query",q)?(Z=((ue=Le.trans)==null?void 0:ue.db._options.cache)==="immutable",Q=(ue=Le).requery,ue=ue.signal,oe=((fe,le,ie,ve)=>{var we=wi["idb://".concat(fe,"/").concat(le)];if(!we)return[];if(!(fe=we.queries[ie]))return[null,!1,we,null];var he=fe[(ve.query?ve.query.index.name:null)||""];if(!he)return[null,!1,we,null];switch(ie){case"query":var Oe=he.find(function(Fe){return Fe.req.limit===ve.limit&&Fe.req.values===ve.values&&tS(Fe.req.query.range,ve.query.range)});return Oe?[Oe,!0,we,he]:[he.find(function(Fe){return("limit"in Fe.req?Fe.req.limit:1/0)>=ve.limit&&(!ve.values||Fe.req.values)&&mF(Fe.req.query.range,ve.query.range)}),!1,we,he];case"count":return Oe=he.find(function(Fe){return tS(Fe.req.query.range,ve.query.range)}),[Oe,!!Oe,we,he]}})(S,P,"query",q),de=oe[0],be=oe[2],ce=oe[3],de&&oe[1]?de.obsSet=q.obsSet:(oe=_.query(q).then(function(fe){var le=fe.result;if(de&&(de.res=le),Z){for(var ie=0,ve=le.length;ie<ve;++ie)Object.freeze(le[ie]);Object.freeze(le)}else fe.result=R(le);return fe}).catch(function(fe){return ce&&de&&$(ce,de),Promise.reject(fe)}),de={obsSet:q.obsSet,promise:oe,subscribers:new Set,type:"query",req:q,dirty:!1},ce?ce.push(de):(ce=[de],(be=be||(wi["idb://".concat(S,"/").concat(P)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[q.query.index.name||""]=ce)),pF(de,ce,Q,ue),de.promise.then(function(fe){return{result:eS(fe.result,q,be?.optimisticOps,_,de,Z)}})):_.query(q)}})}})}};function xm(j,S){return new Proxy(j,{get:function(P,_,B){return _==="db"?S:Reflect.get(P,_,B)}})}en.prototype.version=function(j){if(isNaN(j)||j<.1)throw new se.Type("Given version is not a positive number");if(j=Math.round(10*j)/10,this.idbdb||this._state.isBeingOpened)throw new se.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,j);var S=this._versions,P=S.filter(function(_){return _._cfg.version===j})[0];return P||(P=new this.Version(j),S.push(P),S.sort(aF),P.stores({}),this._state.autoSchema=!1),P},en.prototype._whenReady=function(j){var S=this;return this.idbdb&&(this._state.openComplete||Le.letThrough||this._vip)?j():new Ve(function(P,_){if(S._state.openComplete)return _(new se.DatabaseClosed(S._state.dbOpenError));if(!S._state.isBeingOpened){if(!S._state.autoOpen)return void _(new se.DatabaseClosed);S.open().catch(K)}S._state.dbReadyPromise.then(P,_)}).then(j)},en.prototype.use=function(B){var S=B.stack,P=B.create,_=B.level,B=B.name,q=(B&&this.unuse({stack:S,name:B}),this._middlewares[S]||(this._middlewares[S]=[]));return q.push({stack:S,create:P,level:_??10,name:B}),q.sort(function(Z,Q){return Z.level-Q.level}),this},en.prototype.unuse=function(j){var S=j.stack,P=j.name,_=j.create;return S&&this._middlewares[S]&&(this._middlewares[S]=this._middlewares[S].filter(function(B){return _?B.create!==_:!!P&&B.name!==P})),this},en.prototype.open=function(){var j=this;return tr(pt,function(){return lF(j)})},en.prototype._close=function(){this.on.close.fire(new CustomEvent("close"));var j=this._state,S=to.indexOf(this);if(0<=S&&to.splice(S,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}j.isBeingOpened||(j.dbReadyPromise=new Ve(function(P){j.dbReadyResolve=P}),j.openCanceller=new Ve(function(P,_){j.cancelOpen=_}))},en.prototype.close=function(S){var S=(S===void 0?{disableAutoOpen:!0}:S).disableAutoOpen,P=this._state;S?(P.isBeingOpened&&P.cancelOpen(new se.DatabaseClosed),this._close(),P.autoOpen=!1,P.dbOpenError=new se.DatabaseClosed):(this._close(),P.autoOpen=this._options.autoOpen||P.isBeingOpened,P.openComplete=!1,P.dbOpenError=null)},en.prototype.delete=function(j){var S=this,P=(j===void 0&&(j={disableAutoOpen:!0}),0<arguments.length&&typeof arguments[0]!="object"),_=this._state;return new Ve(function(B,q){function Z(){S.close(j);var Q=S._deps.indexedDB.deleteDatabase(S.name);Q.onsuccess=_t(function(){var ue,be,ce;ue=S._deps,be=S.name,Gb(ce=ue.indexedDB)||be===jl||Xb(ce,ue.IDBKeyRange).delete(be).catch(K),B()}),Q.onerror=ro(q),Q.onblocked=S._fireOnBlocked}if(P)throw new se.InvalidArgument("Invalid closeOptions argument to db.delete()");_.isBeingOpened?_.dbReadyPromise.then(Z):Z()})},en.prototype.backendDB=function(){return this.idbdb},en.prototype.isOpen=function(){return this.idbdb!==null},en.prototype.hasBeenClosed=function(){var j=this._state.dbOpenError;return j&&j.name==="DatabaseClosed"},en.prototype.hasFailed=function(){return this._state.dbOpenError!==null},en.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(en.prototype,"tables",{get:function(){var j=this;return s(this._allTables).map(function(S){return j._allTables[S]})},enumerable:!1,configurable:!0}),en.prototype.transaction=function(){var j=function(S,P,_){var B=arguments.length;if(B<2)throw new se.InvalidArgument("Too few arguments");for(var q=new Array(B-1);--B;)q[B-1]=arguments[B];return _=q.pop(),[S,M(q),_]}.apply(this,arguments);return this._transaction.apply(this,j)},en.prototype._transaction=function(j,S,P){var _,B,q=this,Z=Le.trans,Q=(Z&&Z.db===this&&j.indexOf("!")===-1||(Z=null),j.indexOf("?")!==-1);j=j.replace("!","").replace("?","");try{if(B=S.map(function(be){if(be=be instanceof q.Table?be.name:be,typeof be!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return be}),j=="r"||j===Nl)_=Nl;else{if(j!="rw"&&j!=Cu)throw new se.InvalidArgument("Invalid transaction mode: "+j);_=Cu}if(Z){if(Z.mode===Nl&&_===Cu){if(!Q)throw new se.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");Z=null}Z&&B.forEach(function(be){if(Z&&Z.storeNames.indexOf(be)===-1){if(!Q)throw new se.SubTransaction("Table "+be+" not included in parent transaction.");Z=null}}),Q&&Z&&!Z.active&&(Z=null)}}catch(be){return Z?Z._promise(null,function(ce,oe){oe(be)}):Sr(be)}var ue=function be(ce,oe,de,fe,le){return Ve.resolve().then(function(){var he=Le.transless||Le,ie=ce._createTransaction(oe,de,ce._dbSchema,fe),he=(ie.explicit=!0,{trans:ie,transless:he});if(fe)ie.idbtrans=fe.idbtrans;else try{ie.create(),ie.idbtrans._explicit=!0,ce._state.PR1398_maxLoop=3}catch(Oe){return Oe.name===pe.InvalidState&&ce.isOpen()&&0<--ce._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),ce.close({disableAutoOpen:!1}),ce.open().then(function(){return be(ce,oe,de,null,le)})):Sr(Oe)}var ve,we=U(le),he=(we&&Pt(),Ve.follow(function(){var Oe;(ve=le.call(ie,ie))&&(we?(Oe=Kt.bind(null,null),ve.then(Oe,Oe)):typeof ve.next=="function"&&typeof ve.throw=="function"&&(ve=ny(ve)))},he));return(ve&&typeof ve.then=="function"?Ve.resolve(ve).then(function(Oe){return ie.active?Oe:Sr(new se.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):he.then(function(){return ve})).then(function(Oe){return fe&&ie._resolve(),ie._completion.then(function(){return Oe})}).catch(function(Oe){return ie._reject(Oe),Sr(Oe)})})}.bind(null,this,_,B,Z,P);return Z?Z._promise(_,ue,"lock"):Le.trans?tr(Le.transless,function(){return q._whenReady(ue)}):this._whenReady(ue)},en.prototype.table=function(j){if(f(this._allTables,j))return this._allTables[j];throw new se.InvalidTable("Table ".concat(j," does not exist"))};var Ro=en;function en(j,S){var P,_,B,q,Z,Q=this,ue=(this._middlewares={},this.verno=0,en.dependencies),ue=(this._options=S=n({addons:en.addons,autoOpen:!0,indexedDB:ue.indexedDB,IDBKeyRange:ue.IDBKeyRange,cache:"cloned"},S),this._deps={indexedDB:S.indexedDB,IDBKeyRange:S.IDBKeyRange},S.addons),be=(this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this,{dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:K,dbReadyPromise:null,cancelOpen:K,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:S.autoOpen}),ce=(be.dbReadyPromise=new Ve(function(oe){be.dbReadyResolve=oe}),be.openCanceller=new Ve(function(oe,de){be.cancelOpen=de}),this._state=be,this.name=j,this.on=vi(this,"populate","blocked","versionchange","close",{ready:[rt,K]}),this.once=function(oe,de){var fe=function(){for(var le=[],ie=0;ie<arguments.length;ie++)le[ie]=arguments[ie];Q.on(oe).unsubscribe(fe),de.apply(Q,le)};return Q.on(oe,fe)},this.on.ready.subscribe=N(this.on.ready.subscribe,function(oe){return function(de,fe){en.vip(function(){var le,ie=Q._state;ie.openComplete?(ie.dbOpenError||Ve.resolve().then(de),fe&&oe(de)):ie.onReadyBeingFired?(ie.onReadyBeingFired.push(de),fe&&oe(de)):(oe(de),le=Q,fe||oe(function ve(){le.on.ready.unsubscribe(de),le.on.ready.unsubscribe(ve)}))})}}),this.Collection=(P=this,ki(ot.prototype,function(ve,ie){this.db=P;var fe=am,le=null;if(ie)try{fe=ie()}catch(he){le=he}var ie=ve._ctx,ve=ie.table,we=ve.hook.reading.fire;this._ctx={table:ve,index:ie.index,isPrimKey:!ie.index||ve.schema.primKey.keyPath&&ie.index===ve.schema.primKey.name,range:fe,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:le,or:ie.or,valueMapper:we!==ge?we:null}})),this.Table=(_=this,ki(Ou.prototype,function(oe,de,fe){this.db=_,this._tx=fe,this.name=oe,this.schema=de,this.hook=_._allTables[oe]?_._allTables[oe].hook:vi(null,{creating:[Se,K],reading:[ye,ge],updating:[Te,K],deleting:[Re,K]})})),this.Transaction=(B=this,ki(eF.prototype,function(oe,de,fe,le,ie){var ve=this;oe!=="readonly"&&de.forEach(function(we){we=(we=fe[we])==null?void 0:we.yProps,we&&(de=de.concat(we.map(function(he){return he.updatesTable})))}),this.db=B,this.mode=oe,this.storeNames=de,this.schema=fe,this.chromeTransactionDurability=le,this.idbtrans=null,this.on=vi(this,"complete","error","abort"),this.parent=ie||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new Ve(function(we,he){ve._resolve=we,ve._reject=he}),this._completion.then(function(){ve.active=!1,ve.on.complete.fire()},function(we){var he=ve.active;return ve.active=!1,ve.on.error.fire(we),ve.parent?ve.parent._reject(we):he&&ve.idbtrans&&ve.idbtrans.abort(),Sr(we)})})),this.Version=(q=this,ki(iF.prototype,function(oe){this.db=q,this._cfg={version:oe,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(Z=this,ki(HE.prototype,function(oe,de,fe){if(this.db=Z,this._ctx={table:oe,index:de===":id"?null:de,or:fe},this._cmp=this._ascending=Wt,this._descending=function(le,ie){return Wt(ie,le)},this._max=function(le,ie){return 0<Wt(le,ie)?le:ie},this._min=function(le,ie){return Wt(le,ie)<0?le:ie},this._IDBKeyRange=Z._deps.IDBKeyRange,!this._IDBKeyRange)throw new se.MissingAPI})),this.on("versionchange",function(oe){0<oe.newVersion?console.warn("Another connection wants to upgrade database '".concat(Q.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(Q.name,"'. Closing db now to resume the delete request.")),Q.close({disableAutoOpen:!1})}),this.on("blocked",function(oe){!oe.newVersion||oe.newVersion<oe.oldVersion?console.warn("Dexie.delete('".concat(Q.name,"') was blocked")):console.warn("Upgrade '".concat(Q.name,"' blocked by other connection holding version ").concat(oe.oldVersion/10))}),this._maxKey=Tu(S.IDBKeyRange),this._createTransaction=function(oe,de,fe,le){return new Q.Transaction(oe,de,fe,Q._options.chromeTransactionDurability,le)},this._fireOnBlocked=function(oe){Q.on("blocked").fire(oe),to.filter(function(de){return de.name===Q.name&&de!==Q&&!de._state.vcFired}).map(function(de){return de.on("versionchange").fire(oe)})},this.use(dF),this.use(hF),this.use(fF),this.use(cF),this.use(uF),new Proxy(this,{get:function(oe,de,fe){var le;return de==="_vip"||(de==="table"?function(ie){return xm(Q.table(ie),ce)}:(le=Reflect.get(oe,de,fe))instanceof Ou?xm(le,ce):de==="tables"?le.map(function(ie){return xm(ie,ce)}):de==="_createTransaction"?function(){return xm(le.apply(this,arguments),ce)}:le)}}));this.vip=ce,ue.forEach(function(oe){return oe(Q)})}var vm,Ol=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",gF=(iy.prototype.subscribe=function(j,S,P){return this._subscribe(j&&typeof j!="function"?j:{next:j,error:S,complete:P})},iy.prototype[Ol]=function(){return this},iy);function iy(j){this._subscribe=j}try{vm={indexedDB:o.indexedDB||o.mozIndexedDB||o.webkitIndexedDB||o.msIndexedDB,IDBKeyRange:o.IDBKeyRange||o.webkitIDBKeyRange}}catch{vm={indexedDB:null,IDBKeyRange:null}}function rS(j){var S,P=!1,_=new gF(function(B){var q=U(j),Z,Q=!1,ue={},be={},ce={get closed(){return Q},unsubscribe:function(){Q||(Q=!0,Z&&Z.abort(),oe&&js.storagemutated.unsubscribe(fe))}},oe=(B.start&&B.start(ce),!1),de=function(){return En(le)},fe=function(ie){gm(ue,ie),Qb(be,ue)&&de()},le=function(){var ie,ve,we;!Q&&vm.indexedDB&&(ue={},ie={},Z&&Z.abort(),Z=new AbortController,we=(he=>{var Oe=Un();try{q&&Pt();var Fe=Ye(j,he);return Fe=q?Fe.finally(Kt):Fe}finally{Oe&&st()}})(ve={subscr:ie,signal:Z.signal,requery:de,querier:j,trans:null}),Promise.resolve(we).then(function(he){P=!0,S=he,Q||ve.signal.aborted||(ue={},(Oe=>{for(var Fe in Oe)if(f(Oe,Fe))return;return 1})(be=ie)||oe||(js(Mu,fe),oe=!0),En(function(){return!Q&&B.next&&B.next(he)}))},function(he){P=!1,["DatabaseClosedError","AbortError"].includes(he?.name)||Q||En(function(){Q||B.error&&B.error(he)})}))};return setTimeout(de,0),ce});return _.hasValue=function(){return P},_.getValue=function(){return S},_}var ji=Ro;function ly(j){var S=Ns;try{Ns=!0,js.storagemutated.fire(j),ry(j,!0)}finally{Ns=S}}p(ji,n(n({},X),{delete:function(j){return new ji(j,{addons:[]}).delete()},exists:function(j){return new ji(j,{addons:[]}).open().then(function(S){return S.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(j){try{return S=ji.dependencies,P=S.indexedDB,S=S.IDBKeyRange,(Gb(P)?Promise.resolve(P.databases()).then(function(_){return _.map(function(B){return B.name}).filter(function(B){return B!==jl})}):Xb(P,S).toCollection().primaryKeys()).then(j)}catch{return Sr(new se.MissingAPI)}var S,P},defineClass:function(){return function(j){c(this,j)}},ignoreTransaction:function(j){return Le.trans?tr(Le.transless,j):j()},vip:Zb,async:function(j){return function(){try{var S=ny(j.apply(this,arguments));return S&&typeof S.then=="function"?S:Ve.resolve(S)}catch(P){return Sr(P)}}},spawn:function(j,S,P){try{var _=ny(j.apply(P,S||[]));return _&&typeof _.then=="function"?_:Ve.resolve(_)}catch(B){return Sr(B)}},currentTransaction:{get:function(){return Le.trans||null}},waitFor:function(j,S){return j=Ve.resolve(typeof j=="function"?ji.ignoreTransaction(j):j).timeout(S||6e4),Le.trans?Le.trans.waitFor(j):j},Promise:Ve,debug:{get:function(){return De},set:function(j){ut(j)}},derive:b,extend:c,props:p,override:N,Events:vi,on:js,liveQuery:rS,extendObservabilitySet:gm,getByKeyPath:C,setByKeyPath:O,delByKeyPath:function(j,S){typeof S=="string"?O(j,S,void 0):"length"in S&&[].map.call(S,function(P){O(j,P,void 0)})},shallowClone:D,deepClone:R,getObjectDiff:ay,cmp:Wt,asap:E,minKey:-1/0,addons:[],connections:to,errnames:pe,dependencies:vm,cache:wi,semVer:"4.3.0",version:"4.3.0".split(".").map(function(j){return parseInt(j)}).reduce(function(j,S,P){return j+S/Math.pow(10,2*P)})})),ji.maxKey=Tu(ji.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(js(Mu,function(j){Ns||(j=new CustomEvent(zb,{detail:j}),Ns=!0,dispatchEvent(j),Ns=!1)}),addEventListener(zb,function(j){j=j.detail,Ns||ly(j)}));var Lu,Ns=!1,nS=function(){};return typeof BroadcastChannel<"u"&&((nS=function(){(Lu=new BroadcastChannel(zb)).onmessage=function(j){return j.data&&ly(j.data)}})(),typeof Lu.unref=="function"&&Lu.unref(),js(Mu,function(j){Ns||Lu.postMessage(j)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(j){if(!Ro.disableBfCache&&j.persisted){De&&console.debug("Dexie: handling persisted pagehide"),Lu?.close();for(var S=0,P=to;S<P.length;S++)P[S].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(j){!Ro.disableBfCache&&j.persisted&&(De&&console.debug("Dexie: handling persisted pageshow"),nS(),ly({all:new On(-1/0,[[]])}))})),Ve.rejectionMapper=function(j,S){return!j||j instanceof ae||j instanceof TypeError||j instanceof SyntaxError||!j.name||!ne[j.name]?j:(S=new ne[j.name](S||j.message,j),"stack"in j&&g(S,"stack",{get:function(){return this.inner.stack}}),S)},ut(De),n(Ro,Object.freeze({__proto__:null,Dexie:Ro,Entity:om,PropModification:xi,RangeSet:On,add:function(j){return new xi({add:j})},cmp:Wt,default:Ro,liveQuery:rS,mergeRanges:Du,rangesOverlap:WE,remove:function(j){return new xi({remove:j})},replacePrefix:function(j,S){return new xi({replacePrefix:[j,S]})}}),{default:Ro}),Ro})}(pw)),pw.exports}var NF=jF();const hw=mr(NF),lS=Symbol.for("Dexie"),mc=globalThis[lS]||(globalThis[lS]=hw);if(hw.semVer!==mc.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${hw.semVer} and ${mc.semVer}`);const{liveQuery:Rje,mergeRanges:Fje,rangesOverlap:$je,RangeSet:Bje,cmp:Hje,Entity:zje,PropModification:Uje,replacePrefix:qje,add:Vje,remove:Wje,DexieYProvider:Kje}=mc;function EF(e,t,r){var n,a;typeof e=="function"?(n=t||[],a=r):(n=[],a=t);var o=x.useRef({hasResult:!1,result:a,error:null}),s=x.useReducer(function(u){return u+1},0);s[0];var l=s[1],c=x.useMemo(function(){var u=typeof e=="function"?e():e;if(!u||typeof u.subscribe!="function")throw e===u?new TypeError("Given argument to useObservable() was neither a valid observable nor a function."):new TypeError("Observable factory given to useObservable() did not return a valid observable.");if(!o.current.hasResult&&typeof window<"u"&&(typeof u.hasValue!="function"||u.hasValue()))if(typeof u.getValue=="function")o.current.result=u.getValue(),o.current.hasResult=!0;else{var d=u.subscribe(function(f){o.current.result=f,o.current.hasResult=!0});typeof d=="function"?d():d.unsubscribe()}return u},n);if(x.useDebugValue(o.current.result),x.useEffect(function(){var u=c.subscribe(function(d){var f=o.current;(f.error!==null||f.result!==d)&&(f.error=null,f.result=d,f.hasResult=!0,l())},function(d){var f=o.current;f.error!==d&&(f.error=d,l())});return typeof u=="function"?u:u.unsubscribe.bind(u)},n),o.current.error)throw o.current.error;return o.current.result}function Dn(e,t,r){return EF(function(){return mc.liveQuery(e)},t||[],r)}typeof FinalizationRegistry<"u"&&new FinalizationRegistry(function(e){var t=mc.DexieYProvider;t&&t.release(e)});function dr(e,t){const[r,n]=m.useState(()=>{if(typeof window>"u")return t;const a=localStorage.getItem(e);return a!==null?a:t});return m.useEffect(()=>{if(typeof window>"u")return;const a=o=>{if(o.key&&o.key!==e)return;const s=localStorage.getItem(e);n(s!==null?s:t)};return window.addEventListener("storage",a),window.addEventListener("local-storage",a),()=>{window.removeEventListener("storage",a),window.removeEventListener("local-storage",a)}},[e,t]),m.useEffect(()=>{typeof window>"u"||(r==null?localStorage.removeItem(e):localStorage.setItem(e,r),window.dispatchEvent(new CustomEvent("local-storage",{detail:{key:e,value:r}})))},[e,r]),[r,n]}const Qc=e=>e>=200&&e<300?"bg-green-200 text-green-800":e>=300&&e<400?"bg-blue-200 text-blue-800":e>=400&&e<500?"bg-orange-600 text-orange-200":e>=500?"bg-red-800 text-red-100":"bg-gray-200 text-gray-800",Nf=e=>{if(!e)return"";switch(e.toUpperCase()){case"GET":return"text-[rgb(0,107,230)]";case"POST":return"text-[rgb(23,131,135)]";case"PATCH":return"text-[rgb(204,75,0)]";case"DELETE":return"text-red-700";default:return""}},Kh=e=>{if(!e)return"text-gray-700 dark:text-gray-200 border border-gray-700 dark:border-gray-200";switch(e.toUpperCase()){case"GET":return"text-green-700 dark:text-green-300 border border-green-700 dark:border-green-300";case"POST":return"text-sky-700 dark:text-white border border-sky-700 dark:border-sky-300";case"PUT":return"text-fuchsia-700 dark:text-fuchsia-300 border border-fuchsia-700 dark:border-fuchsia-300";case"PATCH":return"text-purple-700 dark:text-purple-300 border border-purple-700 dark:border-purple-300";case"DELETE":return"text-red-700 dark:text-red-300 border border-red-700 dark:border-red-300";case"OPTIONS":return"text-rose-700 dark:text-rose-300 border border-rose-700 dark:border-rose-300";case"HEAD":return"text-pink-700 dark:text-pink-300 border border-pink-700 dark:border-pink-300";default:return"text-gray-700 dark:text-gray-200 border border-gray-700 dark:border-gray-200"}},Tn=(e,t)=>{if(!e)return"N/A";const r=new Date(e),n=r.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),a=r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),o=t?.includeMilliseconds===!0?`.${String(r.getMilliseconds()).padStart(3,"0")}`:"";return`${n} at ${a}${o}`},Yn=e=>{if(e==null)return"N/A";const t=Number(e);return t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(2)}s`:`${(t/6e4).toFixed(2)}m`},Ei=e=>{if(e==null)return"N/A";const t=Number(e);if(t===0)return"0 B";const r=["B","KB","MB","GB","TB"],n=Math.floor(Math.log10(t)/Math.log10(1024));return n===0?`${t} ${r[n]}`:`${(t/Math.pow(1024,n)).toFixed(2)} ${r[n]}`},SF=["bg-blue-100 dark:bg-blue-900/30","border-blue-700 dark:border-blue-500"].join(" "),CF="border-l-4",OF=({operation:e,opId:t,onSelect:r,onRemove:n,selected:a,showQueryParams:o=!1,selectedOperationRef:s})=>{const l=g=>{r(g)},c=g=>{const b=new Date(g),y=String(b.getHours()).padStart(2,"0"),v=String(b.getMinutes()).padStart(2,"0"),k=String(b.getSeconds()).padStart(2,"0");return`${y}:${v}:${k}`},u=e?.path||e?.request?.path,d=e?.query_params||e?.request?.query_params;let f=u||e?.url||e?.request?.url;const p=o&&u&&Array.isArray(d)&&d.length>0,h=p?`?${d.map(g=>`${g.name}=${g.value}`).join("&")}`:"";return p&&(f=`${u}${h}`),i.jsx("li",{ref:a?s:null,className:`flex items-center cursor-pointer hover:bg-gray-200 dark:hover:bg-dark-tremor-background-subtle ${CF} ${a?SF:"border-transparent"}`,onClick:()=>{l(e)},children:i.jsxs("div",{className:"flex items-center py-1 px-2 w-full [container-type:inline-size] [container-name:requestlist]",children:[i.jsx("div",{className:"w-16 flex justify-center",children:i.jsx("span",{className:`inline-flex px-3 py-1 text-xs font-semibold rounded-full ${Qc(e?.status_code??e?.response?.status)}`,children:(e?.status_code??e?.response?.status)||"N/A"})}),i.jsx("div",{className:`w-20 text-center font-medium ${Nf(e?.method||e?.request?.method)}`,children:e?.method||e?.request?.method||"GET"}),i.jsx("div",{className:"flex-grow truncate text-left text-tremor-content-strong dark:text-dark-tremor-content-strong",title:f,children:u?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:u}),p&&i.jsx("span",{className:"text-gray-400 dark:text-gray-400",children:h})]}):f}),i.jsx("div",{className:"w-20 text-gray-900 dark:text-dark-tremor-content text-center text-xs hidden [@container(min-width:440px)]:inline",children:e?.time?c(e.time):e?.request?.timestamp?c(e.request.timestamp):"N/A"}),i.jsx("div",{className:"w-16 text-gray-500 dark:text-dark-tremor-content text-center text-xs hidden [@container(min-width:520px)]:inline",children:Yn(e?.duration??e?.timing?.duration)}),i.jsx("button",{className:"w-8 h-8 flex items-center justify-center cursor-pointer text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",onClick:g=>{g.stopPropagation(),n(t)},children:"✕"})]})})},tn=({options:e=[],selected:t,onChange:r,placeholder:n="Add option...",colorFn:a})=>{const[o,s]=m.useState(""),[l,c]=m.useState(!1),[u,d]=m.useState(0),f=m.useRef(null),p=e.filter(y=>y.toLowerCase().includes(o.toLowerCase())&&!t.includes(y));m.useEffect(()=>{d(0)},[o,t]);const h=y=>{t.includes(y)||r([...t,y]),s("")},g=y=>{r(t.filter(v=>v!==y))},b=y=>{y.key==="ArrowDown"?(y.preventDefault(),d(v=>v+1<p.length?v+1:v)):y.key==="ArrowUp"?(y.preventDefault(),d(v=>v-1>=0?v-1:0)):y.key==="Enter"?(console.log("enter",u),y.preventDefault(),p.length>0&&h(p[u])):y.key==="Backspace"&&!o&&t.length>0&&g(t[t.length-1])};return i.jsxs("div",{className:"w-full max-w-md relative",children:[i.jsxs("div",{className:"flex flex-wrap items-center border border-gray-300 dark:border-dark-tremor-border rounded-md shadow-sm px-2 py-1 bg-white dark:bg-dark-tremor-background-subtle",children:[t.map(y=>i.jsxs("div",{className:`flex items-center rounded-full px-2 py-1 mr-2 my-1 text-xs ${a?a(y):"bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-200"}`,children:[i.jsx("span",{children:y}),i.jsx("button",{type:"button",onClick:()=>g(y),className:"ml-1 focus:outline-none cursor-pointer","aria-label":`Remove ${y}`,children:i.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:`M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414
4
- 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293
5
- 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z`,clipRule:"evenodd"})})})]},y)),i.jsx("input",{ref:f,type:"text",className:"flex-grow outline-none p-1 text-sm text-gray-900 dark:text-dark-tremor-content placeholder-gray-400 dark:placeholder-dark-tremor-content-subtle bg-transparent dark:bg-dark-tremor-background-subtle border-0",placeholder:t.length>0?"":n,value:o,onChange:y=>s(y.target.value),onKeyDown:b,onFocus:()=>c(!0),onBlur:()=>setTimeout(()=>c(!1),100)})]}),l&&p.length>0&&i.jsx("ul",{className:"absolute left-0 right-0 border border-gray-300 dark:border-dark-tremor-border mt-1 rounded-md shadow-lg bg-white dark:bg-dark-tremor-background-subtle max-h-40 overflow-y-auto z-10",children:p.map((y,v)=>i.jsx("li",{className:`cursor-pointer px-2 py-1 hover:bg-indigo-100 dark:hover:bg-dark-tremor-background ${v===u?"bg-indigo-200 dark:bg-dark-tremor-background-muted":""} text-gray-900 dark:text-dark-tremor-content`,onMouseEnter:()=>d(v),onMouseDown:()=>h(y),children:y},y))})]})},P9=["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"],A9=["200","201","204","301","302","400","401","403","404","500","502","503"],cS=e=>{try{return JSON.parse(e)}catch{return null}},vp=e=>{if(e==null)return null;if(typeof e=="object")return e;if(typeof e!="string")return null;const t=e.trim();if(!t)return null;const r=cS(t);if(r)return r;const n=t.match(/data:\s*(\{[\s\S]*\})/);if(n&&n[1]){const a=cS(n[1].trim());if(a)return a}return null},PF=e=>{if(!e||typeof e!="object")return{total:0,required:0};const t=e.properties||{},r=Array.isArray(e.required)?e.required.length:0;return{total:Object.keys(t).length,required:r}},AF=(e="")=>{const t=e.toLowerCase();return t.includes("json")?"json":t.includes("xml")?"xml":t.includes("html")?"html":t.includes("javascript")?"javascript":t.includes("css")?"css":t.includes("yaml")||t.includes("yml")?"yaml":t.includes("sql")?"sql":t.startsWith("text/")?"plaintext":"json"},MF=(e={},t)=>{if(!t||typeof t!="object")return{missing:[],extra:[]};const r=new Set(t.required||[]),n=new Set(Object.keys(t.properties||{})),a=Object.keys(e),o=Array.from(r).filter(l=>!a.includes(l)),s=a.filter(l=>!n.has(l));return{missing:o,extra:s}},Yh=(e="")=>{const t=e.toLowerCase();return t.includes("tool")?"blue":t.includes("prompt")?"indigo":t.includes("resource")?"emerald":t.includes("model")?"amber":"slate"},M9=(e="",t)=>{if(!t)return{type:"none",raw:null};const r=(e||"").toLowerCase(),n=t?.result?.tools||t?.tools||(Array.isArray(t?.result?.tools)?t.result.tools:[]),a=t?.result?.prompts,o=t?.result?.resources,s=t?.result?.structuredContent,l=t?.result?.content||t?.content||[],c=t?.result??t;return r==="tools/list"&&Array.isArray(n)?{type:"toolsList",tools:n,raw:c,content:l}:r==="prompts/list"&&Array.isArray(a)?{type:"promptsList",prompts:a,raw:c,content:l}:r==="resources/list"&&Array.isArray(o)?{type:"resourcesList",resources:o,raw:c,content:l}:s?{type:"structured",structuredContent:s,raw:c,content:l}:Array.isArray(l)&&l.length?{type:"content",content:l,raw:c}:{type:"raw",raw:c,content:l}},T9=(e=[])=>{if(!Array.isArray(e)||!e.length)return null;const t=e.filter(r=>r?.data&&r.event&&r.event.toLowerCase()==="message");return t.length?t.map(r=>r.data).join(`
6
- `):null},TF=({isOpen:e,onClose:t,sortField:r,sortDirection:n,filters:a,setSortField:o,setSortDirection:s,setFilters:l,tagOptions:c=[],mcpToolOptions:u=[],mcpResourceOptions:d=[],mcpPromptOptions:f=[],mcpCategoryOptions:p=[],mcpMethodOptions:h=[],persistFilters:g=!1,onPersistFiltersChange:b,persistSort:y=!1,onPersistSortChange:v})=>{const k={blue:"bg-blue-500/10 text-blue-700 dark:bg-blue-500/5 dark:text-blue-200",indigo:"bg-indigo-500/10 text-indigo-700 dark:bg-indigo-500/5 dark:text-indigo-200",emerald:"bg-emerald-500/10 text-emerald-700 dark:bg-emerald-500/5 dark:text-emerald-200",amber:"bg-amber-500/10 text-amber-700 dark:bg-amber-500/5 dark:text-amber-200",slate:"bg-slate-500/10 text-slate-700 dark:bg-slate-500/5 dark:text-slate-200"},N=U=>{const X=Yh(U);return k[X]||k.slate},w=U=>()=>k[U]||k.slate,E=u.length>0||(a.mcpTool||[]).length>0,C=d.length>0||(a.mcpResource||[]).length>0,O=f.length>0||(a.mcpPrompt||[]).length>0,D=p.length>0||(a.mcpCategory||[]).length>0,A=h.length>0||(a.mcpMethod||[]).length>0,M=()=>{o("time"),s("desc")},I=()=>{l({})},T=()=>{l(U=>({...U,timestampRange:void 0,customStart:void 0,customEnd:void 0}))},R=()=>{l(U=>({...U,status:[],method:[],path:""}))},L=()=>{l(U=>({...U,tags:[]}))},F=()=>{l(U=>({...U,mcpTool:[],mcpResource:[],mcpPrompt:[],mcpCategory:[],mcpMethod:[]}))},V=()=>{l(U=>({...U,durationMin:"",durationMax:"",host:""}))},H=U=>{const X=U.target.value;l(Y=>({...Y,timestampRange:X,customStart:void 0,customEnd:void 0}))},$=(U,X)=>{l(Y=>({...Y,timestampRange:{...typeof Y.timestampRange=="object"&&Y.timestampRange||{},[U]:X}}))},z=P9,W=A9;return i.jsxs(i.Fragment,{children:[e&&i.jsx("div",{className:"fixed inset-0 bg-black opacity-50",style:{zIndex:9998},onClick:t}),i.jsxs("div",{className:`fixed top-0 left-0 h-full w-[440px] max-w-full bg-white dark:bg-dark-tremor-background shadow-xl dark:shadow-dark-tremor-shadow transform transition-transform duration-300 flex flex-col
7
- ${e?"translate-x-0":"-translate-x-full"}
8
- `,style:{zIndex:9999},children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-300 dark:border-dark-tremor-border bg-gray-50 dark:bg-dark-tremor-background-subtle",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-dark-tremor-content-strong",children:"Filter & Sort"}),i.jsx("button",{onClick:t,className:"text-gray-600 dark:text-dark-tremor-content hover:text-gray-800 dark:hover:text-dark-tremor-content-strong focus:outline-none cursor-pointer border rounded px-1","aria-label":"Close",children:"×"})]}),i.jsxs("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",children:[i.jsxs("section",{className:"mb-6",children:[i.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-gray-200 dark:border-dark-tremor-border",children:[i.jsx("h3",{className:"text-xs font-bold text-gray-600 dark:text-dark-tremor-content uppercase tracking-wide",children:"Sorting"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-dark-tremor-content",children:[i.jsx("input",{type:"checkbox",checked:y,onChange:U=>v?.(U.target.checked?"true":"false"),className:"h-3 w-3 text-blue-600 dark:text-blue-500"}),"Keep on reload"]}),i.jsx("button",{onClick:M,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-tremor-content-subtle",children:"By field"}),i.jsxs("label",{className:"flex items-center text-xs",children:[i.jsx("input",{type:"radio",name:"sortField",value:"time",checked:r==="time",onChange:U=>o(U.target.value),className:"form-radio text-blue-600 dark:text-blue-500 h-3 w-3"}),i.jsx("span",{className:"ml-2 text-xs text-gray-700 dark:text-dark-tremor-content",children:"Timestamp"})]}),i.jsxs("label",{className:"flex items-center text-xs",children:[i.jsx("input",{type:"radio",name:"sortField",value:"status_code",checked:r==="status_code",onChange:U=>o(U.target.value),className:"form-radio text-blue-600 dark:text-blue-500 h-3 w-3"}),i.jsx("span",{className:"ml-2 text-xs text-gray-700 dark:text-dark-tremor-content",children:"Status"})]}),i.jsxs("label",{className:"flex items-center text-xs",children:[i.jsx("input",{type:"radio",name:"sortField",value:"method",checked:r==="method",onChange:U=>o(U.target.value),className:"form-radio text-blue-600 dark:text-blue-500 h-3 w-3"}),i.jsx("span",{className:"ml-2 text-xs text-gray-700 dark:text-dark-tremor-content",children:"Method"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-tremor-content-subtle",children:"Direction"}),i.jsxs("label",{className:"flex items-center text-xs",children:[i.jsx("input",{type:"radio",name:"sortDirection",value:"asc",checked:n==="asc",onChange:U=>s(U.target.value),className:"form-radio text-blue-600 dark:text-blue-500 h-3 w-3"}),i.jsx("span",{className:"ml-2 text-xs text-gray-700 dark:text-dark-tremor-content",children:"Ascending"})]}),i.jsxs("label",{className:"flex items-center text-xs",children:[i.jsx("input",{type:"radio",name:"sortDirection",value:"desc",checked:n==="desc",onChange:U=>s(U.target.value),className:"form-radio text-blue-600 dark:text-blue-500 h-3 w-3"}),i.jsx("span",{className:"ml-2 text-xs text-gray-700 dark:text-dark-tremor-content",children:"Descending"})]})]})]})]}),i.jsxs("section",{className:"mb-6",children:[i.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-gray-200 dark:border-dark-tremor-border",children:[i.jsx("h3",{className:"text-xs font-bold text-gray-600 dark:text-dark-tremor-content uppercase tracking-wide",children:"Filters"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-dark-tremor-content",children:[i.jsx("input",{type:"checkbox",checked:g,onChange:U=>b?.(U.target.checked?"true":"false"),className:"h-3 w-3 text-blue-600 dark:text-blue-500"}),"Keep on reload"]}),i.jsx("button",{onClick:I,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]})]}),i.jsxs("div",{className:"space-y-6 pt-4",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-tremor-content-subtle",children:"Time"}),i.jsx("button",{onClick:T,className:"text-[11px] text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Quick Time Range"}),i.jsxs("select",{value:typeof a.timestampRange=="string"?a.timestampRange:"",onChange:H,className:"block w-full border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm",children:[i.jsx("option",{value:"",children:"Any"}),i.jsx("option",{value:"5M",children:"Last 5 minutes"}),i.jsx("option",{value:"15M",children:"Last 15 minutes"}),i.jsx("option",{value:"30M",children:"Last 30 minutes"}),i.jsx("option",{value:"1H",children:"Last 1 hour"}),i.jsx("option",{value:"3H",children:"Last 3 hours"}),i.jsx("option",{value:"6H",children:"Last 6 hours"}),i.jsx("option",{value:"12H",children:"Last 12 hours"}),i.jsx("option",{value:"24H",children:"Last 24 hours"}),i.jsx("option",{value:"48H",children:"Last 48 hours"}),i.jsx("option",{value:"week",children:"Last Week"}),i.jsx("option",{value:"month",children:"Last Month"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Specific Time Range"}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("input",{type:"datetime-local",value:typeof a.timestampRange=="object"&&a.timestampRange.start?a.timestampRange.start:"",onChange:U=>$("start",U.target.value),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("input",{type:"datetime-local",value:typeof a.timestampRange=="object"&&a.timestampRange.end?a.timestampRange.end:"",onChange:U=>$("end",U.target.value),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]})]}),i.jsxs("div",{className:"space-y-4 pt-4 border-t border-gray-200 dark:border-dark-tremor-border",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-tremor-content-subtle",children:"HTTP"}),i.jsx("button",{onClick:R,className:"text-[11px] text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Status"}),i.jsx(tn,{options:W,selected:a.status||[],onChange:U=>l(X=>({...X,status:U})),placeholder:"Add status code...",colorFn:Qc})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Method"}),i.jsx(tn,{options:z,selected:a.method||[],onChange:U=>l(X=>({...X,method:U})),placeholder:"Add method...",colorFn:Kh})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Path"}),i.jsx("input",{type:"text",placeholder:"e.g. /api/users",value:a.path||"",onChange:U=>l(X=>({...X,path:U.target.value})),className:"block w-full border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]}),i.jsxs("div",{className:"space-y-4 pt-4 border-t border-gray-200 dark:border-dark-tremor-border",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-tremor-content-subtle",children:"Tags"}),i.jsx("button",{onClick:L,className:"text-[11px] text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Tags"}),i.jsx(tn,{options:c,selected:a.tags||[],onChange:U=>l(X=>({...X,tags:U})),placeholder:"Add tag..."})]}),E||C||O||D||A?i.jsxs("div",{className:"space-y-4 pt-4 border-t border-gray-200 dark:border-dark-tremor-border",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h5",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-tremor-content-subtle",children:"MCP"}),i.jsx("button",{onClick:F,className:"text-[11px] text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]}),E&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"MCP Tool"}),i.jsx(tn,{options:u,selected:a.mcpTool||[],onChange:U=>l(X=>({...X,mcpTool:U})),placeholder:"Add MCP tool...",colorFn:w("blue")})]}),C&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"MCP Resource"}),i.jsx(tn,{options:d,selected:a.mcpResource||[],onChange:U=>l(X=>({...X,mcpResource:U})),placeholder:"Add MCP resource...",colorFn:w("emerald")})]}),O&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"MCP Prompt"}),i.jsx(tn,{options:f,selected:a.mcpPrompt||[],onChange:U=>l(X=>({...X,mcpPrompt:U})),placeholder:"Add MCP prompt...",colorFn:w("indigo")})]}),A&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"MCP Method"}),i.jsx(tn,{options:h,selected:a.mcpMethod||[],onChange:U=>l(X=>({...X,mcpMethod:U})),placeholder:"Add MCP method...",colorFn:N})]}),D&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"MCP Category"}),i.jsx(tn,{options:p,selected:a.mcpCategory||[],onChange:U=>l(X=>({...X,mcpCategory:U})),placeholder:"Add MCP category...",colorFn:N})]})]}):null]}),i.jsxs("div",{className:"space-y-4 pt-4 border-t border-gray-200 dark:border-dark-tremor-border",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-tremor-content-subtle",children:"Timing & Host"}),i.jsx("button",{onClick:V,className:"text-[11px] text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Duration (ms)"}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("input",{type:"number",placeholder:"Min",value:a.durationMin||"",onChange:U=>l(X=>({...X,durationMin:U.target.value})),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("input",{type:"number",placeholder:"Max",value:a.durationMax||"",onChange:U=>l(X=>({...X,durationMax:U.target.value})),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Host"}),i.jsx("input",{type:"text",placeholder:"e.g. localhost",value:a.host||"",onChange:U=>l(X=>({...X,host:U.target.value})),className:"block w-full border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]})]})]})]})]})]})},Aj=({currentPage:e,totalPages:t,meta:r,onPageChange:n,alwaysShow:a=!0})=>{const o=g=>{const b=Number(g);return Number.isFinite(b)?b:null},s=o(r?.page??r?.current_page),l=o(r?.total_pages??r?.totalPages),c=Math.max(0,l??o(t)??0),u=s??o(e)??1,d=c>0?Math.min(Math.max(1,u),c):1;if(c===0||!a&&c<=1)return null;const f=typeof n=="function",p=g=>{f&&(g<1||g>c||g!==d&&n(g))},h=((g,b)=>{const y=[];if(b<=7)for(let v=1;v<=b;v++)y.push(v);else if(g<=4){for(let v=1;v<=5;v++)y.push(v);y.push("ellipsis"),y.push(b)}else if(g>=b-3){y.push(1),y.push("ellipsis");for(let v=b-4;v<=b;v++)y.push(v)}else y.push(1),y.push("ellipsis"),y.push(g-1),y.push(g),y.push(g+1),y.push("ellipsis"),y.push(b);return y})(d,c);return i.jsx("nav",{className:"p-2 border-t border-gray-300",children:i.jsxs("ul",{className:"flex items-center justify-center -space-x-px h-8 text-xs",children:[i.jsx("li",{children:i.jsxs("button",{onClick:()=>p(d-1),disabled:!f||d<=1,className:"flex items-center justify-center px-2 h-7 leading-tight text-gray-500 bg-white border border-e-0 border-gray-300 rounded-s-lg hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:[i.jsx("span",{className:"sr-only",children:"Previous"}),i.jsx("svg",{className:"w-2.5 h-2.5 rtl:rotate-180","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:i.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 1 1 5l4 4"})})]})}),h.map((g,b)=>{if(g==="ellipsis")return i.jsx("li",{children:i.jsx("span",{className:"flex items-center justify-center px-2 h-7 leading-tight text-gray-500 bg-white border border-gray-300 cursor-pointer",children:"..."})},`ellipsis-${b}`);const y=g===d;return i.jsx("li",{children:i.jsx("button",{onClick:()=>p(g),disabled:!f,className:y?"z-10 flex items-center justify-center px-2 h-7 leading-tight text-blue-600 border border-blue-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 disabled:cursor-not-allowed dark:border-gray-700 dark:bg-gray-700 dark:text-white cursor-pointer":"flex items-center justify-center px-2 h-7 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:g})},g)}),i.jsx("li",{children:i.jsxs("button",{onClick:()=>p(d+1),disabled:!f||d>=c,className:"flex items-center justify-center px-2 h-7 leading-tight text-gray-500 bg-white border border-gray-300 rounded-e-lg hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:[i.jsx("span",{className:"sr-only",children:"Next"}),i.jsx("svg",{className:"w-2.5 h-2.5 rtl:rotate-180","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:i.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})})]})})]})})},uS=({color:e="currentColor",size:t=24,className:r,...n})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...n,className:"remixicon "+(r||"")},x.createElement("path",{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"})),_F=({color:e="currentColor",size:t=24,className:r,...n})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...n,className:"remixicon "+(r||"")},x.createElement("path",{d:"M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V11H19L18.9999 6.413L11.2071 14.2071L9.79289 12.7929L17.5849 5H13V3H21Z"})),IF=({color:e="currentColor",size:t=24,className:r,...n})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...n,className:"remixicon "+(r||"")},x.createElement("path",{d:"M10.9042 2.10025L20.8037 3.51446L22.2179 13.414L13.0255 22.6063C12.635 22.9969 12.0019 22.9969 11.6113 22.6063L1.71184 12.7069C1.32131 12.3163 1.32131 11.6832 1.71184 11.2926L10.9042 2.10025ZM11.6113 4.22157L3.83316 11.9997L12.3184 20.485L20.0966 12.7069L19.036 5.28223L11.6113 4.22157ZM13.7327 10.5855C12.9516 9.80448 12.9516 8.53815 13.7327 7.7571C14.5137 6.97606 15.78 6.97606 16.5611 7.7571C17.3421 8.53815 17.3421 9.80448 16.5611 10.5855C15.78 11.3666 14.5137 11.3666 13.7327 10.5855Z"})),DF=({color:e="currentColor",size:t=24,className:r,...n})=>x.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...n,className:"remixicon "+(r||"")},x.createElement("path",{d:"M2 6L2 18H4L4 6H2ZM9.44975 7.05025L4.5 12L9.44727 16.9473L9.44826 13H14.5501L14.55 16.9492L19.5 11.9995L14.5503 7.04976L14.5502 11H9.44876L9.44975 7.05025ZM20 6H22V18H20V6Z"})),LF=({open:e,onClose:t,onConfirmAll:r,onConfirmFiltered:n,hasFilters:a})=>e?i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("div",{className:"flex-shrink-0 bg-red-100 rounded-full p-2",children:i.jsx("svg",{className:"size-6 text-red-600",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}),i.jsxs("div",{className:"ml-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:a?"Clear Requests":"Clear All Requests"}),i.jsx("p",{className:"mt-2 text-sm text-gray-500",children:a?"You have active filters. Would you like to clear only the filtered requests or all requests?":"Are you sure you want to clear all requests? This action cannot be undone."})]})]}),i.jsxs("div",{className:"mt-6 flex justify-end space-x-3",children:[i.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Cancel"}),a&&i.jsx("button",{onClick:()=>{n(),t()},className:"px-4 py-2 bg-yellow-500 text-white rounded hover:bg-yellow-600 text-sm",children:"Clear Filtered"}),i.jsx("button",{onClick:()=>{r(),t()},className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 text-sm",children:"Clear All"})]})]})]}):null,RF=({text:e,align:t="center"})=>t==="left"?i.jsxs("div",{className:"flex items-center my-1",children:[i.jsx("span",{className:"px-3 text-xs text-slate-600",children:e}),i.jsx("div",{className:"flex-grow border-t border-gray-300"})]}):t==="right"?i.jsxs("div",{className:"flex items-center my-1",children:[i.jsx("div",{className:"flex-grow border-t border-gray-300"}),i.jsx("span",{className:"px-3 text-xs text-slate-600",children:e})]}):i.jsxs("div",{className:"flex items-center my-1",children:[i.jsx("div",{className:"flex-grow border-t border-gray-300"}),i.jsx("span",{className:"px-3 text-xs text-slate-600",children:e}),i.jsx("div",{className:"flex-grow border-t border-gray-300"})]}),dS=e=>e==null?null:String(e),FF=({operations:e,onSelect:t,onRemove:r,clearOperations:n,clearFilteredOperations:a,syncOperations:o,selectedOperation:s,currentPage:l,totalPages:c,totalCount:u,onPageChange:d,sortField:f,sortDirection:p,filters:h,setSortField:g,setSortDirection:b,setFilters:y,isSyncing:v,tagOptions:k=[],mcpToolOptions:N=[],mcpResourceOptions:w=[],mcpPromptOptions:E=[],mcpCategoryOptions:C=[],mcpMethodOptions:O=[],persistFilters:D=!1,onPersistFiltersChange:A,persistSort:M=!1,onPersistSortChange:I})=>{const[T,R]=m.useState(!1),[L,F]=m.useState(!1),V=m.useRef(null),[H,$]=dr("showQueryParams","false"),z=H==="true",W=Object.entries(h||{}).reduce((G,[ee,re])=>ee==="timestampRange"&&typeof re=="object"?re.start||re.end?G+1:G:Array.isArray(re)?re.length>0?G+1:G:re?G+1:G,0),U=W>0?"bg-green-500 text-white":"bg-blue-500 text-white",X=G=>{const ee=new Date(G),re=String(ee.getDate()).padStart(2,"0"),pe=String(ee.getMonth()+1).padStart(2,"0");return`${ee.getFullYear()}-${pe}-${re}`},Y=(G=>G.reduce((ee,re)=>{const pe=re?.time||re?.request?.timestamp,te=pe?X(pe):"N/A";return ee[te]||(ee[te]=[]),ee[te].push(re),ee},{}))(e),ae=s?.id??null;return m.useEffect(()=>{if(!ae||!V.current)return;const G=setTimeout(()=>{V.current&&V.current.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},150);return()=>clearTimeout(G)},[ae]),i.jsxs("div",{className:"flex flex-col h-full relative",children:[i.jsxs("div",{className:"p-4 flex justify-between items-center [container-type:inline-size] [container-name:requestHeader]",children:[i.jsxs("span",{className:"font-bold text-xl text-tremor-content-strong dark:text-dark-tremor-content-strong [@container(max-width:360px)]:text-base [@container(max-width:310px)]:hidden",children:["Requests (",e.length," of ",u,")"]}),i.jsxs("div",{className:"space-x-2 relative",children:[i.jsxs("button",{className:`relative px-3 py-1 rounded text-xs cursor-pointer ${U}`,onClick:()=>R(!0),children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-4 h-4 text-white",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"})}),W>0&&i.jsx("span",{className:"absolute -top-1 -right-1 bg-green-700 text-white text-[10px] font-bold w-4 h-4 flex items-center justify-center rounded-full",children:W})]}),i.jsx("button",{className:`px-3 py-1 bg-teal-500 text-white rounded text-xs ${v?"opacity-75 cursor-not-allowed":"cursor-pointer"}`,onClick:o,disabled:v,children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:`w-4 h-4 text-white ${v?"animate-spin":""}`,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.0228 9.34841H21.0154M21.0154 9.34841V4.3558M21.0154 9.34841L17.8342 6.1655C16.8437 5.17312 15.5866 4.4202 14.1349 4.03121C9.73377 2.85194 5.21 5.46374 4.03073 9.86484M7.97677 14.6517H2.98413M2.98413 14.6517V19.6444M2.98413 14.6517L6.16502 17.8347C7.15555 18.8271 8.41261 19.589 9.86436 19.969C14.2654 21.1483 18.7892 18.5364 19.9685 14.1353"})})}),i.jsx("button",{className:"px-3 py-1 bg-red-500 text-white rounded text-xs cursor-pointer",onClick:()=>F(!0),children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-4 h-4 text-white",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"})})})]})]}),i.jsxs("div",{className:"flex items-center bg-gray-200 dark:bg-dark-tremor-background-subtle p-2 border-b border-gray-300 dark:border-dark-tremor-border text-sm font-bold text-tremor-content-strong dark:text-dark-tremor-content-strong cursor-pointer [container-type:inline-size] [container-name:requestlist]",onClick:()=>R(!0),children:[i.jsx("div",{className:"w-16 text-center",children:"Status"}),i.jsx("div",{className:"w-20 text-center",children:"Method"}),i.jsxs("div",{className:"flex-grow text-left flex items-center",children:[i.jsx("span",{children:"Path"}),i.jsx("button",{type:"button",className:`ml-2 p-1 rounded transition-colors cursor-pointer ${z?"text-blue-700 bg-blue-100 hover:bg-blue-200 dark:text-blue-400 dark:bg-blue-900/30 dark:hover:bg-blue-900/50":"text-gray-500 hover:bg-gray-300 dark:text-gray-400 dark:hover:bg-gray-700"}`,title:`Toggle query params (${z?"On":"Off"})`,"aria-label":`Show query params: ${z?"On":"Off"}`,"aria-pressed":z,onClick:G=>{G.stopPropagation(),$(z?"false":"true")},children:i.jsx(DF,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"w-20 text-center hidden [@container(min-width:450px)]:inline",children:"Time"}),i.jsx("div",{className:"w-16 text-right hidden [@container(min-width:530px)]:inline",children:"Duration"}),i.jsx("div",{className:"w-10"})]}),i.jsx("ul",{className:"overflow-y-auto flex-grow",style:{maxHeight:"calc(100vh - 40px - 100px - 49px - 64px)"},children:e.length===0?i.jsx("li",{className:"flex items-center justify-center h-full text-gray-500 dark:text-gray-400 text-2xl",children:"No operations"}):Object.entries(Y).map(([G,ee])=>i.jsxs(x.Fragment,{children:[i.jsx("li",{children:i.jsx(RF,{text:G,align:"center"})}),ee.map((re,pe)=>{const te=re.id||pe;return i.jsx(OF,{opId:te,operation:re,onSelect:t,onRemove:r,selected:s&&dS(s.id)===dS(te),showQueryParams:z,selectedOperationRef:V},te)})]},G))}),i.jsx(Aj,{currentPage:l,totalPages:c,onPageChange:d}),i.jsx(TF,{isOpen:T,onClose:()=>R(!1),sortField:f,sortDirection:p,filters:h,setSortField:g,setSortDirection:b,setFilters:y,tagOptions:k,mcpToolOptions:N,mcpResourceOptions:w,mcpPromptOptions:E,mcpCategoryOptions:C,mcpMethodOptions:O,persistFilters:D,onPersistFiltersChange:A,persistSort:M,onPersistSortChange:I}),i.jsx(LF,{open:L,onClose:()=>F(!1),onConfirmAll:n,onConfirmFiltered:a,hasFilters:W>0})]})},rp=({message:e,subMessage:t,onClose:r,type:n="success"})=>{const[a,o]=m.useState(3e3),[s,l]=m.useState(!1);m.useEffect(()=>{const h=setInterval(()=>{s||o(g=>Math.max(0,g-50))},50);return()=>clearInterval(h)},[s]),m.useEffect(()=>{a===0&&r()},[a,r]);const c=a/3e3*100,u=n==="error"?"border-red-500":"border-green-500",d=n==="error"?"text-red-500":"text-green-500",f=n==="error"?"bg-red-500":"bg-green-500",p=n==="error"?"M12 9v2m0 4h.01M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z":"M9 12.75L11.25 15L15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z";return i.jsx("div",{className:"fixed top-4 right-4 z-50 w-80",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:i.jsx("div",{className:`bg-white border-l-4 ${u} p-2 shadow-lg rounded-lg`,children:i.jsxs("div",{className:"flex items-start",children:[i.jsx("div",{className:"flex-shrink-0",children:i.jsx("svg",{className:`h-6 w-6 ${d}`,fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:p})})}),i.jsxs("div",{className:"ml-1 flex-1",children:[i.jsx("p",{className:"text-sm font-medium text-gray-900",children:e}),t&&i.jsx("p",{className:"mt-1 text-sm text-gray-500 break-words",children:t}),i.jsx("div",{className:`w-full h-1 rounded-t-lg ${f}`,style:{width:`${c}%`}})]}),i.jsx("div",{className:"ml-auto pl-1",children:i.jsxs("button",{onClick:r,className:`text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-${n==="error"?"red":"green"}-500`,children:[i.jsx("span",{className:"sr-only",children:"Close"}),i.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 0 1 1.414 0L10 8.586l4.293-4.293a1 1 0 1 1 1.414 1.414L11.414 10l4.293 4.293a1 1 0 0 1-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 1 1-1.414-1.414L8.586 10 4.293 5.707a1 1 0 0 1 0-1.414z",clipRule:"evenodd"})})]})})]})})})},$F=typeof document<"u"?x.useLayoutEffect:()=>{},li=e=>{var t;return(t=e?.ownerDocument)!==null&&t!==void 0?t:document},Ui=e=>e&&"window"in e&&e.window===e?e:li(e).defaultView||window;function qi(e,t){return t&&e?e.contains(t):!1}const gw=(e=document)=>e.activeElement;function _9(e){return e.target}function I9(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=I9(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Lt(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=I9(e))&&(n&&(n+=" "),n+=t);return n}function BF(e){if(HF())e.focus({preventScroll:!0});else{let t=zF(e);e.focus(),UF(t)}}let km=null;function HF(){if(km==null){km=!1;try{document.createElement("div").focus({get preventScroll(){return km=!0,!0}})}catch{}}return km}function zF(e){let t=e.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&r.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}function UF(e){for(let{element:t,scrollTop:r,scrollLeft:n}of e)t.scrollTop=r,t.scrollLeft=n}function Xh(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let r=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(r)&&r.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function D9(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function eu(e){let t=null;return()=>(t==null&&(t=e()),t)}const kp=eu(function(){return D9(/^Mac/i)}),qF=eu(function(){return D9(/^iPad/i)||kp()&&navigator.maxTouchPoints>1}),VF=eu(function(){return Xh(/AppleWebKit/i)&&!WF()}),WF=eu(function(){return Xh(/Chrome/i)}),KF=eu(function(){return Xh(/Android/i)}),YF=eu(function(){return Xh(/Firefox/i)});function Td(e,t,r=!0){var n,a;let{metaKey:o,ctrlKey:s,altKey:l,shiftKey:c}=t;YF()&&!((a=window.event)===null||a===void 0||(n=a.type)===null||n===void 0)&&n.startsWith("key")&&e.target==="_blank"&&(kp()?o=!0:s=!0);let u=VF()&&kp()&&!qF()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:o,ctrlKey:s,altKey:l,shiftKey:c}):new MouseEvent("click",{metaKey:o,ctrlKey:s,altKey:l,shiftKey:c,detail:1,bubbles:!0,cancelable:!0});Td.isOpening=r,BF(e),e.dispatchEvent(u),Td.isOpening=!1}Td.isOpening=!1;function L9(){let e=m.useRef(new Map),t=m.useCallback((a,o,s,l)=>{let c=l?.once?(...u)=>{e.current.delete(s),s(...u)}:s;e.current.set(s,{type:o,eventTarget:a,fn:c,options:l}),a.addEventListener(o,c,l)},[]),r=m.useCallback((a,o,s,l)=>{var c;let u=((c=e.current.get(s))===null||c===void 0?void 0:c.fn)||s;a.removeEventListener(o,u,l),e.current.delete(s)},[]),n=m.useCallback(()=>{e.current.forEach((a,o)=>{r(a.eventTarget,a.type,o,a.options)})},[r]);return m.useEffect(()=>n,[n]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:n}}function XF(e){return e.pointerType===""&&e.isTrusted?!0:KF()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function R9(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function GF(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function F9(e){let t=m.useRef({isFocused:!1,observer:null});return $F(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]),m.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let n=r.target,a=o=>{if(t.current.isFocused=!1,n.disabled){let s=R9(o);e?.(s)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};n.addEventListener("focusout",a,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&n.disabled){var o;(o=t.current.observer)===null||o===void 0||o.disconnect();let s=n===document.activeElement?null:document.activeElement;n.dispatchEvent(new FocusEvent("blur",{relatedTarget:s})),n.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:s}))}}),t.current.observer.observe(n,{attributes:!0,attributeFilter:["disabled"]})}},[e])}let ZF=!1,Ef=null;const bw=new Set;let gd=new Map,rl=!1,yw=!1;const JF={Tab:!0,Escape:!0};function Mj(e,t){for(let r of bw)r(e,t)}function QF(e){return!(e.metaKey||!kp()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function wp(e){rl=!0,!Td.isOpening&&QF(e)&&(Ef="keyboard",Mj("keyboard",e))}function ec(e){Ef="pointer","pointerType"in e&&e.pointerType,(e.type==="mousedown"||e.type==="pointerdown")&&(rl=!0,Mj("pointer",e))}function $9(e){!Td.isOpening&&XF(e)&&(rl=!0,Ef="virtual")}function B9(e){e.target===window||e.target===document||ZF||!e.isTrusted||(!rl&&!yw&&(Ef="virtual",Mj("virtual",e)),rl=!1,yw=!1)}function H9(){rl=!1,yw=!0}function xw(e){if(typeof window>"u"||typeof document>"u"||gd.get(Ui(e)))return;const t=Ui(e),r=li(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){rl=!0,n.apply(this,arguments)},r.addEventListener("keydown",wp,!0),r.addEventListener("keyup",wp,!0),r.addEventListener("click",$9,!0),t.addEventListener("focus",B9,!0),t.addEventListener("blur",H9,!1),typeof PointerEvent<"u"&&(r.addEventListener("pointerdown",ec,!0),r.addEventListener("pointermove",ec,!0),r.addEventListener("pointerup",ec,!0)),t.addEventListener("beforeunload",()=>{z9(e)},{once:!0}),gd.set(t,{focus:n})}const z9=(e,t)=>{const r=Ui(e),n=li(e);t&&n.removeEventListener("DOMContentLoaded",t),gd.has(r)&&(r.HTMLElement.prototype.focus=gd.get(r).focus,n.removeEventListener("keydown",wp,!0),n.removeEventListener("keyup",wp,!0),n.removeEventListener("click",$9,!0),r.removeEventListener("focus",B9,!0),r.removeEventListener("blur",H9,!1),typeof PointerEvent<"u"&&(n.removeEventListener("pointerdown",ec,!0),n.removeEventListener("pointermove",ec,!0),n.removeEventListener("pointerup",ec,!0)),gd.delete(r))};function e$(e){const t=li(e);let r;return t.readyState!=="loading"?xw(e):(r=()=>{xw(e)},t.addEventListener("DOMContentLoaded",r)),()=>z9(e,r)}typeof document<"u"&&e$();function vw(){return Ef!=="pointer"}const t$=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function r$(e,t,r){let n=li(r?.target);const a=typeof window<"u"?Ui(r?.target).HTMLInputElement:HTMLInputElement,o=typeof window<"u"?Ui(r?.target).HTMLTextAreaElement:HTMLTextAreaElement,s=typeof window<"u"?Ui(r?.target).HTMLElement:HTMLElement,l=typeof window<"u"?Ui(r?.target).KeyboardEvent:KeyboardEvent;return e=e||n.activeElement instanceof a&&!t$.has(n.activeElement.type)||n.activeElement instanceof o||n.activeElement instanceof s&&n.activeElement.isContentEditable,!(e&&t==="keyboard"&&r instanceof l&&!JF[r.key])}function n$(e,t,r){xw(),m.useEffect(()=>{if(r?.enabled===!1)return;let n=(a,o)=>{r$(!!r?.isTextInput,a,o)&&e(vw())};return bw.add(n),()=>{bw.delete(n)}},t)}function a$(e){let{isDisabled:t,onFocus:r,onBlur:n,onFocusChange:a}=e;const o=m.useCallback(c=>{if(c.target===c.currentTarget)return n&&n(c),a&&a(!1),!0},[n,a]),s=F9(o),l=m.useCallback(c=>{const u=li(c.target),d=u?gw(u):gw();c.target===c.currentTarget&&d===_9(c.nativeEvent)&&(r&&r(c),a&&a(!0),s(c))},[a,r,s]);return{focusProps:{onFocus:!t&&(r||a||n)?l:void 0,onBlur:!t&&(n||a)?o:void 0}}}function o$(e){let{isDisabled:t,onBlurWithin:r,onFocusWithin:n,onFocusWithinChange:a}=e,o=m.useRef({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:l}=L9(),c=m.useCallback(f=>{qi(f.currentTarget,f.target)&&o.current.isFocusWithin&&!qi(f.currentTarget,f.relatedTarget)&&(o.current.isFocusWithin=!1,l(),r&&r(f),a&&a(!1))},[r,a,o,l]),u=F9(c),d=m.useCallback(f=>{if(!qi(f.currentTarget,f.target))return;const p=li(f.target),h=gw(p);if(!o.current.isFocusWithin&&h===_9(f.nativeEvent)){n&&n(f),a&&a(!0),o.current.isFocusWithin=!0,u(f);let g=f.currentTarget;s(p,"focus",b=>{if(o.current.isFocusWithin&&!qi(g,b.target)){let y=new p.defaultView.FocusEvent("blur",{relatedTarget:b.target});GF(y,g);let v=R9(y);c(v)}},{capture:!0})}},[n,a,u,s,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:c}}}let kw=!1,wm=0;function s$(){kw=!0,setTimeout(()=>{kw=!1},50)}function fS(e){e.pointerType==="touch"&&s$()}function i$(){if(!(typeof document>"u"))return wm===0&&(typeof PointerEvent<"u"&&document.addEventListener("pointerup",fS)),wm++,()=>{wm--,!(wm>0)&&(typeof PointerEvent<"u"&&document.removeEventListener("pointerup",fS))}}function Za(e){let{onHoverStart:t,onHoverChange:r,onHoverEnd:n,isDisabled:a}=e,[o,s]=m.useState(!1),l=m.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;m.useEffect(i$,[]);let{addGlobalListener:c,removeAllGlobalListeners:u}=L9(),{hoverProps:d,triggerHoverEnd:f}=m.useMemo(()=>{let p=(b,y)=>{if(l.pointerType=y,a||y==="touch"||l.isHovered||!qi(b.currentTarget,b.target))return;l.isHovered=!0;let v=b.currentTarget;l.target=v,c(li(b.target),"pointerover",k=>{l.isHovered&&l.target&&!qi(l.target,k.target)&&h(k,k.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:v,pointerType:y}),r&&r(!0),s(!0)},h=(b,y)=>{let v=l.target;l.pointerType="",l.target=null,!(y==="touch"||!l.isHovered||!v)&&(l.isHovered=!1,u(),n&&n({type:"hoverend",target:v,pointerType:y}),r&&r(!1),s(!1))},g={};return typeof PointerEvent<"u"&&(g.onPointerEnter=b=>{kw&&b.pointerType==="mouse"||p(b,b.pointerType)},g.onPointerLeave=b=>{!a&&qi(b.currentTarget,b.target)&&h(b,b.pointerType)}),{hoverProps:g,triggerHoverEnd:h}},[t,r,n,a,l,c,u]);return m.useEffect(()=>{a&&f({currentTarget:l.target},l.pointerType)},[a]),{hoverProps:d,isHovered:o}}function Da(e={}){let{autoFocus:t=!1,isTextInput:r,within:n}=e,a=m.useRef({isFocused:!1,isFocusVisible:t||vw()}),[o,s]=m.useState(!1),[l,c]=m.useState(()=>a.current.isFocused&&a.current.isFocusVisible),u=m.useCallback(()=>c(a.current.isFocused&&a.current.isFocusVisible),[]),d=m.useCallback(h=>{a.current.isFocused=h,a.current.isFocusVisible=vw(),s(h),u()},[u]);n$(h=>{a.current.isFocusVisible=h,u()},[r,o],{enabled:o,isTextInput:r});let{focusProps:f}=a$({isDisabled:n,onFocusChange:d}),{focusWithinProps:p}=o$({isDisabled:!n,onFocusWithinChange:d});return{isFocused:o,isFocusVisible:l,focusProps:n?p:f}}var l$=Object.defineProperty,c$=(e,t,r)=>t in e?l$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uy=(e,t,r)=>(c$(e,typeof t!="symbol"?t+"":t,r),r);let u$=class{constructor(){uy(this,"current",this.detect()),uy(this,"handoffState","pending"),uy(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},mo=new u$;function ds(e){var t;return mo.isServer?null:e==null?document:(t=e?.ownerDocument)!=null?t:document}function Gs(e){var t,r;return mo.isServer?null:e==null?document:(r=(t=e?.getRootNode)==null?void 0:t.call(e))!=null?r:document}function Zs(e){var t,r;return(r=(t=Gs(e))==null?void 0:t.activeElement)!=null?r:null}function U9(e){return Zs(e)===e}function Gh(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Jn(){let e=[],t={addEventListener(r,n,a,o){return r.addEventListener(n,a,o),t.add(()=>r.removeEventListener(n,a,o))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return t.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return Gh(()=>{n.current&&r[0]()}),t.add(()=>{n.current=!1})},style(r,n,a){let o=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:a}),this.add(()=>{Object.assign(r.style,{[n]:o})})},group(r){let n=Jn();return r(n),this.add(()=>n.dispose())},add(r){return e.includes(r)||e.push(r),()=>{let n=e.indexOf(r);if(n>=0)for(let a of e.splice(n,1))a()}},dispose(){for(let r of e.splice(0))r()}};return t}function fs(){let[e]=m.useState(Jn);return m.useEffect(()=>()=>e.dispose(),[e]),e}let Ir=(e,t)=>{mo.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function es(e){let t=m.useRef(e);return Ir(()=>{t.current=e},[e]),t}let et=function(e){let t=es(e);return x.useCallback((...r)=>t.current(...r),[t])};function d$(e){let t=e.width/2,r=e.height/2;return{top:e.clientY-r,right:e.clientX+t,bottom:e.clientY+r,left:e.clientX-t}}function f$(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Zh({disabled:e=!1}={}){let t=m.useRef(null),[r,n]=m.useState(!1),a=fs(),o=et(()=>{t.current=null,n(!1),a.dispose()}),s=et(l=>{if(a.dispose(),t.current===null){t.current=l.currentTarget,n(!0);{let c=ds(l.currentTarget);a.addEventListener(c,"pointerup",o,!1),a.addEventListener(c,"pointermove",u=>{if(t.current){let d=d$(u);n(f$(d,t.current.getBoundingClientRect()))}},!1),a.addEventListener(c,"pointercancel",o,!1)}}});return{pressed:r,pressProps:e?{}:{onPointerDown:s,onPointerUp:o,onClick:o}}}function yn(e){return m.useMemo(()=>e,Object.values(e))}let m$=m.createContext(void 0);function Tj(){return m.useContext(m$)}function ww(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function ln(e,t,...r){if(e in t){let a=t[e];return typeof a=="function"?a(...r):a}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(a=>`"${a}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ln),n}var Aa=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Aa||{}),Rs=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Rs||{});function pr(){let e=h$();return m.useCallback(t=>p$({mergeRefs:e,...t}),[e])}function p$({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:a,visible:o=!0,name:s,mergeRefs:l}){l=l??g$;let c=q9(t,e);if(o)return jm(c,r,n,s,l);let u=a??0;if(u&2){let{static:d=!1,...f}=c;if(d)return jm(f,r,n,s,l)}if(u&1){let{unmount:d=!0,...f}=c;return ln(d?0:1,{0(){return null},1(){return jm({...f,hidden:!0,style:{display:"none"}},r,n,s,l)}})}return jm(c,r,n,s,l)}function jm(e,t={},r,n,a){let{as:o=r,children:s,refName:l="ref",...c}=dy(e,["unmount","static"]),u=e.ref!==void 0?{[l]:e.ref}:{},d=typeof s=="function"?s(t):s;"className"in c&&c.className&&typeof c.className=="function"&&(c.className=c.className(t)),c["aria-labelledby"]&&c["aria-labelledby"]===c.id&&(c["aria-labelledby"]=void 0);let f={};if(t){let p=!1,h=[];for(let[g,b]of Object.entries(t))typeof b=="boolean"&&(p=!0),b===!0&&h.push(g.replace(/([A-Z])/g,y=>`-${y.toLowerCase()}`));if(p){f["data-headlessui-state"]=h.join(" ");for(let g of h)f[`data-${g}`]=""}}if(tc(o)&&(Object.keys(Ms(c)).length>0||Object.keys(Ms(f)).length>0))if(!m.isValidElement(d)||Array.isArray(d)&&d.length>1||y$(d)){if(Object.keys(Ms(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Ms(c)).concat(Object.keys(Ms(f))).map(p=>` - ${p}`).join(`
9
- `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(p=>` - ${p}`).join(`
10
- `)].join(`
11
- `))}else{let p=d.props,h=p?.className,g=typeof h=="function"?(...v)=>ww(h(...v),c.className):ww(h,c.className),b=g?{className:g}:{},y=q9(d.props,Ms(dy(c,["ref"])));for(let v in f)v in y&&delete f[v];return m.cloneElement(d,Object.assign({},y,f,u,{ref:a(b$(d),u.ref)},b))}return m.createElement(o,Object.assign({},dy(c,["ref"]),!tc(o)&&u,!tc(o)&&f),d)}function h$(){let e=m.useRef([]),t=m.useCallback(r=>{for(let n of e.current)n!=null&&(typeof n=="function"?n(r):n.current=r)},[]);return(...r)=>{if(!r.every(n=>n==null))return e.current=r,t}}function g$(...e){return e.every(t=>t==null)?void 0:t=>{for(let r of e)r!=null&&(typeof r=="function"?r(t):r.current=t)}}function q9(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let a in n)a.startsWith("on")&&typeof n[a]=="function"?(r[a]!=null||(r[a]=[]),r[a].push(n[a])):t[a]=n[a];if(t.disabled||t["aria-disabled"])for(let n in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(n)&&(r[n]=[a=>{var o;return(o=a?.preventDefault)==null?void 0:o.call(a)}]);for(let n in r)Object.assign(t,{[n](a,...o){let s=r[n];for(let l of s){if((a instanceof Event||a?.nativeEvent instanceof Event)&&a.defaultPrevented)return;l(a,...o)}}});return t}function tu(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let a in n)a.startsWith("on")&&typeof n[a]=="function"?(r[a]!=null||(r[a]=[]),r[a].push(n[a])):t[a]=n[a];for(let n in r)Object.assign(t,{[n](...a){let o=r[n];for(let s of o)s?.(...a)}});return t}function sr(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Ms(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function dy(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}function b$(e){return x.version.split(".")[0]>="19"?e.props.ref:e.ref}function tc(e){return e===m.Fragment||e===Symbol.for("react.fragment")}function y$(e){return tc(e.type)}function x$(e,t,r){let[n,a]=m.useState(r),o=e!==void 0,s=m.useRef(o),l=m.useRef(!1),c=m.useRef(!1);return o&&!s.current&&!l.current?(l.current=!0,s.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!o&&s.current&&!c.current&&(c.current=!0,s.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[o?e:n,et(u=>(o||Qt.flushSync(()=>a(u)),t?.(u)))]}function v$(e){let[t]=m.useState(e);return t}function V9(e={},t=null,r=[]){for(let[n,a]of Object.entries(e))K9(r,W9(t,n),a);return r}function W9(e,t){return e?e+"["+t+"]":t}function K9(e,t,r){if(Array.isArray(r))for(let[n,a]of r.entries())K9(e,W9(t,n.toString()),a);else r instanceof Date?e.push([t,r.toISOString()]):typeof r=="boolean"?e.push([t,r?"1":"0"]):typeof r=="string"?e.push([t,r]):typeof r=="number"?e.push([t,`${r}`]):r==null?e.push([t,""]):w$(r)&&!m.isValidElement(r)&&V9(r,t,e)}function k$(e){var t,r;let n=(t=e?.form)!=null?t:e.closest("form");if(n){for(let a of n.elements)if(a!==e&&(a.tagName==="INPUT"&&a.type==="submit"||a.tagName==="BUTTON"&&a.type==="submit"||a.nodeName==="INPUT"&&a.type==="image")){a.click();return}(r=n.requestSubmit)==null||r.call(n)}}function w$(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let j$="span";var ts=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(ts||{});function N$(e,t){var r;let{features:n=1,...a}=e,o={ref:t,"aria-hidden":(n&2)===2?!0:(r=a["aria-hidden"])!=null?r:void 0,hidden:(n&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return pr()({ourProps:o,theirProps:a,slot:{},defaultTag:j$,name:"Hidden"})}let Js=sr(N$),E$=m.createContext(null);function S$({children:e}){let t=m.useContext(E$);if(!t)return x.createElement(x.Fragment,null,e);let{target:r}=t;return r?Qt.createPortal(x.createElement(x.Fragment,null,e),r):null}function C$({data:e,form:t,disabled:r,onReset:n,overrides:a}){let[o,s]=m.useState(null),l=fs();return m.useEffect(()=>{if(n&&o)return l.addEventListener(o,"reset",n)},[o,t,n]),x.createElement(S$,null,x.createElement(O$,{setForm:s,formId:t}),V9(e).map(([c,u])=>x.createElement(Js,{features:ts.Hidden,...Ms({key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:r,name:c,value:u,...a})})))}function O$({setForm:e,formId:t}){return m.useEffect(()=>{if(t){let r=document.getElementById(t);r&&e(r)}},[e,t]),t?null:x.createElement(Js,{features:ts.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:r=>{if(!r)return;let n=r.closest("form");n&&e(n)}})}let P$=m.createContext(void 0);function Y9(){return m.useContext(P$)}function X9(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Xo(e){return X9(e)&&"tagName"in e}function _n(e){return Xo(e)&&"accessKey"in e}function ma(e){return Xo(e)&&"tabIndex"in e}function A$(e){return Xo(e)&&"style"in e}function M$(e){return _n(e)&&e.nodeName==="IFRAME"}function G9(e){return _n(e)&&e.nodeName==="INPUT"}function jw(e){return _n(e)&&e.nodeName==="LABEL"}function T$(e){return _n(e)&&e.nodeName==="FIELDSET"}function Z9(e){return _n(e)&&e.nodeName==="LEGEND"}function _$(e){return Xo(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function pc(e){let t=e.parentElement,r=null;for(;t&&!T$(t);)Z9(t)&&(r=t),t=t.parentElement;let n=t?.getAttribute("disabled")==="";return n&&I$(r)?!1:n}function I$(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Z9(t))return!1;t=t.previousElementSibling}return!0}let J9=Symbol();function _j(e,t=!0){return Object.assign(e,{[J9]:t})}function Ur(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let r=et(n=>{for(let a of t.current)a!=null&&(typeof a=="function"?a(n):a.current=n)});return e.every(n=>n==null||n?.[J9])?void 0:r}let Jh=m.createContext(null);Jh.displayName="DescriptionContext";function Q9(){let e=m.useContext(Jh);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Q9),t}return e}function D$(){var e,t;return(t=(e=m.useContext(Jh))==null?void 0:e.value)!=null?t:void 0}function Ij(){let[e,t]=m.useState([]);return[e.length>0?e.join(" "):void 0,m.useMemo(()=>function(r){let n=et(o=>(t(s=>[...s,o]),()=>t(s=>{let l=s.slice(),c=l.indexOf(o);return c!==-1&&l.splice(c,1),l}))),a=m.useMemo(()=>({register:n,slot:r.slot,name:r.name,props:r.props,value:r.value}),[n,r.slot,r.name,r.props,r.value]);return x.createElement(Jh.Provider,{value:a},r.children)},[t])]}let L$="p";function R$(e,t){let r=m.useId(),n=Tj(),{id:a=`headlessui-description-${r}`,...o}=e,s=Q9(),l=Ur(t);Ir(()=>s.register(a),[a,s.register]);let c=yn({...s.slot,disabled:n||!1}),u={ref:l,...s.props,id:a};return pr()({ourProps:u,theirProps:o,slot:c,defaultTag:L$,name:s.name||"Description"})}let F$=sr(R$),eM=Object.assign(F$,{});var nr=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(nr||{});let Qh=m.createContext(null);Qh.displayName="LabelContext";function Dj(){let e=m.useContext(Qh);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Dj),t}return e}function tM(e){var t,r,n;let a=(r=(t=m.useContext(Qh))==null?void 0:t.value)!=null?r:void 0;return((n=void 0)!=null?n:0)>0?[a,...e].filter(Boolean).join(" "):a}function Lj({inherit:e=!1}={}){let t=tM(),[r,n]=m.useState([]),a=e?[t,...r].filter(Boolean):r;return[a.length>0?a.join(" "):void 0,m.useMemo(()=>function(o){let s=et(c=>(n(u=>[...u,c]),()=>n(u=>{let d=u.slice(),f=d.indexOf(c);return f!==-1&&d.splice(f,1),d}))),l=m.useMemo(()=>({register:s,slot:o.slot,name:o.name,props:o.props,value:o.value}),[s,o.slot,o.name,o.props,o.value]);return x.createElement(Qh.Provider,{value:l},o.children)},[n])]}let $$="label";function B$(e,t){var r;let n=m.useId(),a=Dj(),o=Y9(),s=Tj(),{id:l=`headlessui-label-${n}`,htmlFor:c=o??((r=a.props)==null?void 0:r.htmlFor),passive:u=!1,...d}=e,f=Ur(t);Ir(()=>a.register(l),[l,a.register]);let p=et(b=>{let y=b.currentTarget;if(!(b.target!==b.currentTarget&&_$(b.target))&&(jw(y)&&b.preventDefault(),a.props&&"onClick"in a.props&&typeof a.props.onClick=="function"&&a.props.onClick(b),jw(y))){let v=document.getElementById(y.htmlFor);if(v){let k=v.getAttribute("disabled");if(k==="true"||k==="")return;let N=v.getAttribute("aria-disabled");if(N==="true"||N==="")return;(G9(v)&&(v.type==="file"||v.type==="radio"||v.type==="checkbox")||v.role==="radio"||v.role==="checkbox"||v.role==="switch")&&v.click(),v.focus({preventScroll:!0})}}}),h=yn({...a.slot,disabled:s||!1}),g={ref:f,...a.props,id:l,htmlFor:c,onClick:p};return u&&("onClick"in g&&(delete g.htmlFor,delete g.onClick),"onClick"in d&&delete d.onClick),pr()({ourProps:g,theirProps:d,slot:h,defaultTag:c?$$:"div",name:a.name||"Label"})}let H$=sr(B$),z$=Object.assign(H$,{}),U$=m.createContext(()=>{});function eg({value:e,children:t}){return x.createElement(U$.Provider,{value:e},t)}function Pl(e,t,r){let n=r.initialDeps??[],a,o=!0;function s(){var l,c,u;let d;r.key&&(l=r.debug)!=null&&l.call(r)&&(d=Date.now());const f=e();if(!(f.length!==n.length||f.some((h,g)=>n[g]!==h)))return a;n=f;let p;if(r.key&&(c=r.debug)!=null&&c.call(r)&&(p=Date.now()),a=t(...f),r.key&&(u=r.debug)!=null&&u.call(r)){const h=Math.round((Date.now()-d)*100)/100,g=Math.round((Date.now()-p)*100)/100,b=g/16,y=(v,k)=>{for(v=String(v);v.length<k;)v=" "+v;return v};console.info(`%c⏱ ${y(g,5)} /${y(h,5)} ms`,`
12
- font-size: .6rem;
13
- font-weight: bold;
14
- color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,r?.key)}return r?.onChange&&!(o&&r.skipInitialOnChange)&&r.onChange(a),o=!1,a}return s.updateDeps=l=>{n=l},s}function mS(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const q$=(e,t)=>Math.abs(e-t)<1.01,V$=(e,t,r)=>{let n;return function(...a){e.clearTimeout(n),n=e.setTimeout(()=>t.apply(this,a),r)}},pS=e=>{const{offsetWidth:t,offsetHeight:r}=e;return{width:t,height:r}},W$=e=>e,K$=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1),n=[];for(let a=t;a<=r;a++)n.push(a);return n},Y$=(e,t)=>{const r=e.scrollElement;if(!r)return;const n=e.targetWindow;if(!n)return;const a=s=>{const{width:l,height:c}=s;t({width:Math.round(l),height:Math.round(c)})};if(a(pS(r)),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(s=>{const l=()=>{const c=s[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){a({width:u.inlineSize,height:u.blockSize});return}}a(pS(r))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return o.observe(r,{box:"border-box"}),()=>{o.unobserve(r)}},hS={passive:!0},gS=typeof window>"u"?!0:"onscrollend"in window,X$=(e,t)=>{const r=e.scrollElement;if(!r)return;const n=e.targetWindow;if(!n)return;let a=0;const o=e.options.useScrollendEvent&&gS?()=>{}:V$(n,()=>{t(a,!1)},e.options.isScrollingResetDelay),s=d=>()=>{const{horizontal:f,isRtl:p}=e.options;a=f?r.scrollLeft*(p&&-1||1):r.scrollTop,o(),t(a,d)},l=s(!0),c=s(!1);r.addEventListener("scroll",l,hS);const u=e.options.useScrollendEvent&&gS;return u&&r.addEventListener("scrollend",c,hS),()=>{r.removeEventListener("scroll",l),u&&r.removeEventListener("scrollend",c)}},G$=(e,t,r)=>{if(t?.borderBoxSize){const n=t.borderBoxSize[0];if(n)return Math.round(n[r.options.horizontal?"inlineSize":"blockSize"])}return e[r.options.horizontal?"offsetWidth":"offsetHeight"]},Z$=(e,{adjustments:t=0,behavior:r},n)=>{var a,o;const s=e+t;(o=(a=n.scrollElement)==null?void 0:a.scrollTo)==null||o.call(a,{[n.options.horizontal?"left":"top"]:s,behavior:r})};class J${constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let r=null;const n=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(a=>{a.forEach(o=>{const s=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()})}));return{disconnect:()=>{var a;(a=n())==null||a.disconnect(),r=null},observe:a=>{var o;return(o=n())==null?void 0:o.observe(a,{box:"border-box"})},unobserve:a=>{var o;return(o=n())==null?void 0:o.unobserve(a)}}})(),this.range=null,this.setOptions=r=>{Object.entries(r).forEach(([n,a])=>{typeof a>"u"&&delete r[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:W$,rangeExtractor:K$,onChange:()=>{},measureElement:G$,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...r}},this.notify=r=>{var n,a;(a=(n=this.options).onChange)==null||a.call(n,this,r)},this.maybeNotify=Pl(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=o,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,n)=>{const a=new Map,o=new Map;for(let s=n-1;s>=0;s--){const l=r[s];if(a.has(l.lane))continue;const c=o.get(l.lane);if(c==null||l.end>c.end?o.set(l.lane,l):l.end<c.end&&a.set(l.lane,!0),a.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((s,l)=>s.end===l.end?s.index-l.index:s.end-l.end)[0]:void 0},this.getMeasurementOptions=Pl(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(r,n,a,o,s,l)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:n,scrollMargin:a,getItemKey:o,enabled:s,lanes:l}),{key:!1}),this.getMeasurements=Pl(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:r,paddingStart:n,scrollMargin:a,getItemKey:o,enabled:s,lanes:l},c)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const p of this.laneAssignments.keys())p>=r&&this.laneAssignments.delete(p);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(p=>{this.itemSizeCache.set(p.key,p.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,u),f=new Array(l).fill(void 0);for(let p=0;p<u;p++){const h=d[p];h&&(f[h.lane]=p)}for(let p=u;p<r;p++){const h=o(p),g=this.laneAssignments.get(p);let b,y;if(g!==void 0&&this.options.lanes>1){b=g;const w=f[b],E=w!==void 0?d[w]:void 0;y=E?E.end+this.options.gap:n+a}else{const w=this.options.lanes===1?d[p-1]:this.getFurthestMeasurement(d,p);y=w?w.end+this.options.gap:n+a,b=w?w.lane:p%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(p,b)}const v=c.get(h),k=typeof v=="number"?v:this.options.estimateSize(p),N=y+k;d[p]={index:p,start:y,size:k,end:N,key:h,lane:b},f[b]=p}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Pl(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,n,a,o)=>this.range=r.length>0&&n>0?Q$({measurements:r,outerSize:n,scrollOffset:a,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Pl(()=>{let r=null,n=null;const a=this.calculateRange();return a&&(r=a.startIndex,n=a.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,n]},(r,n,a,o,s)=>o===null||s===null?[]:r({startIndex:o,endIndex:s,overscan:n,count:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const n=this.options.indexAttribute,a=r.getAttribute(n);return a?parseInt(a,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this._measureElement=(r,n)=>{const a=this.indexFromElement(r),o=this.measurementsCache[a];if(!o)return;const s=o.key,l=this.elementsCache.get(s);l!==r&&(l&&this.observer.unobserve(l),this.observer.observe(r),this.elementsCache.set(s,r)),r.isConnected&&this.resizeItem(a,this.options.measureElement(r,n,this))},this.resizeItem=(r,n)=>{const a=this.measurementsCache[r];if(!a)return;const o=this.itemSizeCache.get(a.key)??a.size,s=n-o;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(a,s,this):a.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=s,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(a.index),this.itemSizeCache=new Map(this.itemSizeCache.set(a.key,n)),this.notify(!1))},this.measureElement=r=>{if(!r){this.elementsCache.forEach((n,a)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(a))});return}this._measureElement(r,void 0)},this.getVirtualItems=Pl(()=>[this.getVirtualIndexes(),this.getMeasurements()],(r,n)=>{const a=[];for(let o=0,s=r.length;o<s;o++){const l=r[o],c=n[l];a.push(c)}return a},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=r=>{const n=this.getMeasurements();if(n.length!==0)return mS(n[rM(0,n.length-1,a=>mS(n[a]).start,r)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(r,n,a=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),s=this.getScrollOffset();n==="auto"&&(n=r>=s+o?"end":"start"),n==="center"?r+=(a-o)/2:n==="end"&&(r-=o);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,r),0)},this.getOffsetForIndex=(r,n="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const a=this.measurementsCache[r];if(!a)return;const o=this.getSize(),s=this.getScrollOffset();if(n==="auto")if(a.end>=s+o-this.options.scrollPaddingEnd)n="end";else if(a.start<=s+this.options.scrollPaddingStart)n="start";else return[s,n];if(n==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),n];const l=n==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,n,a.size),n]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(r,{align:n="start",behavior:a}={})=>{a==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(r,n),{adjustments:void 0,behavior:a})},this.scrollToIndex=(r,{align:n="auto",behavior:a}={})=>{a==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),r=Math.max(0,Math.min(r,this.options.count-1)),this.currentScrollToIndex=r;let o=0;const s=10,l=u=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(r,u);if(!d){console.warn("Failed to get offset for index:",r);return}const[f,p]=d;this._scrollToOffset(f,{adjustments:void 0,behavior:a}),this.targetWindow.requestAnimationFrame(()=>{const h=()=>{if(this.currentScrollToIndex!==r)return;const g=this.getScrollOffset(),b=this.getOffsetForIndex(r,p);if(!b){console.warn("Failed to get offset for index:",r);return}q$(b[0],g)||c(p)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(h):h()})},c=u=>{this.targetWindow&&this.currentScrollToIndex===r&&(o++,o<s?this.targetWindow.requestAnimationFrame(()=>l(u)):console.warn(`Failed to scroll to index ${r} after ${s} attempts.`))};l(n)},this.scrollBy=(r,{behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+r,{adjustments:void 0,behavior:n})},this.getTotalSize=()=>{var r;const n=this.getMeasurements();let a;if(n.length===0)a=this.options.paddingStart;else if(this.options.lanes===1)a=((r=n[n.length-1])==null?void 0:r.end)??0;else{const o=Array(this.options.lanes).fill(null);let s=n.length-1;for(;s>=0&&o.some(l=>l===null);){const l=n[s];o[l.lane]===null&&(o[l.lane]=l.end),s--}a=Math.max(...o.filter(l=>l!==null))}return Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(r,{adjustments:n,behavior:a})=>{this.options.scrollToFn(r,{behavior:a,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}}const rM=(e,t,r,n)=>{for(;e<=t;){const a=(e+t)/2|0,o=r(a);if(o<n)e=a+1;else if(o>n)t=a-1;else return a}return e>0?e-1:0};function Q$({measurements:e,outerSize:t,scrollOffset:r,lanes:n}){const a=e.length-1,o=c=>e[c].start;if(e.length<=n)return{startIndex:0,endIndex:a};let s=rM(0,a,o,r),l=s;if(n===1)for(;l<a&&e[l].end<r+t;)l++;else if(n>1){const c=Array(n).fill(0);for(;l<a&&c.some(d=>d<r+t);){const d=e[l];c[d.lane]=d.end,l++}const u=Array(n).fill(r+t);for(;s>=0&&u.some(d=>d>=r);){const d=e[s];u[d.lane]=d.start,s--}s=Math.max(0,s-s%n),l=Math.min(a,l+(n-1-l%n))}return{startIndex:s,endIndex:l}}const bS=typeof document<"u"?m.useLayoutEffect:m.useEffect;function eB({useFlushSync:e=!0,...t}){const r=m.useReducer(()=>({}),{})[1],n={...t,onChange:(o,s)=>{var l;e&&s?Qt.flushSync(r):r(),(l=t.onChange)==null||l.call(t,o,s)}},[a]=m.useState(()=>new J$(n));return a.setOptions(n),bS(()=>a._didMount(),[]),bS(()=>a._willUpdate()),a}function tB(e){return eB({observeElementRect:Y$,observeElementOffset:X$,scrollToFn:Z$,...e})}function yS(e){if(e===null)return{width:0,height:0};let{width:t,height:r}=e.getBoundingClientRect();return{width:t,height:r}}function nM(e,t,r=!1){let[n,a]=m.useState(()=>yS(t));return Ir(()=>{if(!t||!e)return;let o=Jn();return o.requestAnimationFrame(function s(){o.requestAnimationFrame(s),a(l=>{let c=yS(t);return c.width===l.width&&c.height===l.height?l:c})}),()=>{o.dispose()}},[t,e]),r?{width:`${n.width}px`,height:`${n.height}px`}:n}var aM=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(aM||{});function rB(e){let t=m.useRef(null),r=et(a=>{t.current=a.pointerType,!pc(a.currentTarget)&&a.pointerType==="mouse"&&a.button===aM.Left&&(a.preventDefault(),e(a))}),n=et(a=>{t.current!=="mouse"&&(pc(a.currentTarget)||e(a))});return{onPointerDown:r,onClick:n}}let oM=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e),this.set(e,t)),t}};var nB=Object.defineProperty,aB=(e,t,r)=>t in e?nB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oB=(e,t,r)=>(aB(e,t+"",r),r),sM=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},ja=(e,t,r)=>(sM(e,t,"read from private field"),r?r.call(e):t.get(e)),fy=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},xS=(e,t,r,n)=>(sM(e,t,"write to private field"),t.set(e,r),r),ao,cd,ud;let Rj=class{constructor(e){fy(this,ao,{}),fy(this,cd,new oM(()=>new Set)),fy(this,ud,new Set),oB(this,"disposables",Jn()),xS(this,ao,e),mo.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return ja(this,ao)}subscribe(e,t){if(mo.isServer)return()=>{};let r={selector:e,callback:t,current:e(ja(this,ao))};return ja(this,ud).add(r),this.disposables.add(()=>{ja(this,ud).delete(r)})}on(e,t){return mo.isServer?()=>{}:(ja(this,cd).get(e).add(t),this.disposables.add(()=>{ja(this,cd).get(e).delete(t)}))}send(e){let t=this.reduce(ja(this,ao),e);if(t!==ja(this,ao)){xS(this,ao,t);for(let r of ja(this,ud)){let n=r.selector(ja(this,ao));iM(r.current,n)||(r.current=n,r.callback(n))}for(let r of ja(this,cd).get(e.type))r(ja(this,ao),e)}}};ao=new WeakMap,cd=new WeakMap,ud=new WeakMap;function iM(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:my(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:my(e.entries(),t.entries()):vS(e)&&vS(t)?my(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function my(e,t){do{let r=e.next(),n=t.next();if(r.done&&n.done)return!0;if(r.done||n.done||!Object.is(r.value,n.value))return!1}while(!0)}function vS(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function kS(e){let[t,r]=e(),n=Jn();return(...a)=>{t(...a),n.dispose(),n.microTask(r)}}var sB=Object.defineProperty,iB=(e,t,r)=>t in e?sB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wS=(e,t,r)=>(iB(e,typeof t!="symbol"?t+"":t,r),r),lM=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(lM||{});let lB={0(e,t){let r=t.id,n=e.stack,a=e.stack.indexOf(r);if(a!==-1){let o=e.stack.slice();return o.splice(a,1),o.push(r),n=o,{...e,stack:n}}return{...e,stack:[...e.stack,r]}},1(e,t){let r=t.id,n=e.stack.indexOf(r);if(n===-1)return e;let a=e.stack.slice();return a.splice(n,1),{...e,stack:a}}},cB=class cM extends Rj{constructor(){super(...arguments),wS(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),wS(this,"selectors",{isTop:(t,r)=>t.stack[t.stack.length-1]===r,inStack:(t,r)=>t.stack.includes(r)})}static new(){return new cM({stack:[]})}reduce(t,r){return ln(r.type,lB,t,r)}};const Sf=new oM(()=>cB.new());var jS={exports:{}},py={},NS;function uB(){if(NS)return py;NS=1;var e=x;function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,a=e.useRef,o=e.useEffect,s=e.useMemo,l=e.useDebugValue;return py.useSyncExternalStoreWithSelector=function(c,u,d,f,p){var h=a(null);if(h.current===null){var g={hasValue:!1,value:null};h.current=g}else g=h.current;h=s(function(){function y(E){if(!v){if(v=!0,k=E,E=f(E),p!==void 0&&g.hasValue){var C=g.value;if(p(C,E))return N=C}return N=E}if(C=N,r(k,E))return C;var O=f(E);return p!==void 0&&p(C,O)?(k=E,C):(k=E,N=O)}var v=!1,k,N,w=d===void 0?null:d;return[function(){return y(u())},w===null?void 0:function(){return y(w())}]},[u,d,f,p]);var b=n(c,h[0],h[1]);return o(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},py}var ES;function dB(){return ES||(ES=1,jS.exports=uB()),jS.exports}var fB=dB();function jn(e,t,r=iM){return fB.useSyncExternalStoreWithSelector(et(n=>e.subscribe(mB,n)),et(()=>e.state),et(()=>e.state),et(t),r)}function mB(e){return e}function Cf(e,t){let r=m.useId(),n=Sf.get(t),[a,o]=jn(n,m.useCallback(s=>[n.selectors.isTop(s,r),n.selectors.inStack(s,r)],[n,r]));return Ir(()=>{if(e)return n.actions.push(r),()=>n.actions.pop(r)},[n,e,r]),e?o?a:!0:!1}let Nw=new Map,bd=new Map;function SS(e){var t;let r=(t=bd.get(e))!=null?t:0;return bd.set(e,r+1),r!==0?()=>CS(e):(Nw.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>CS(e))}function CS(e){var t;let r=(t=bd.get(e))!=null?t:1;if(r===1?bd.delete(e):bd.set(e,r-1),r!==1)return;let n=Nw.get(e);n&&(n["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert,Nw.delete(e))}function uM(e,{allowed:t,disallowed:r}={}){let n=Cf(e,"inert-others");Ir(()=>{var a,o;if(!n)return;let s=Jn();for(let c of(a=r?.())!=null?a:[])c&&s.add(SS(c));let l=(o=t?.())!=null?o:[];for(let c of l){if(!c)continue;let u=ds(c);if(!u)continue;let d=c.parentElement;for(;d&&d!==u.body;){for(let f of d.children)l.some(p=>f.contains(p))||s.add(SS(f));d=d.parentElement}}return s.dispose},[n,t,r])}function Fj(e,t,r){let n=es(a=>{let o=a.getBoundingClientRect();o.x===0&&o.y===0&&o.width===0&&o.height===0&&r()});m.useEffect(()=>{if(!e)return;let a=t===null?null:_n(t)?t:t.current;if(!a)return;let o=Jn();if(typeof ResizeObserver<"u"){let s=new ResizeObserver(()=>n.current(a));s.observe(a),o.add(()=>s.disconnect())}if(typeof IntersectionObserver<"u"){let s=new IntersectionObserver(()=>n.current(a));s.observe(a),o.add(()=>s.disconnect())}return()=>o.dispose()},[t,n,e])}let jp=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),pB=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var hn=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(hn||{}),hc=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(hc||{}),hB=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(hB||{});function Of(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(jp)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}function gB(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(pB)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}var tg=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(tg||{});function rg(e,t=0){var r;return e===((r=ds(e))==null?void 0:r.body)?!1:ln(t,{0(){return e.matches(jp)},1(){let n=e;for(;n!==null;){if(n.matches(jp))return!0;n=n.parentElement}return!1}})}function dM(e){Jn().nextFrame(()=>{let t=Zs(e);t&&ma(t)&&!rg(t,0)&&po(e)})}var bB=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(bB||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function po(e){e?.focus({preventScroll:!0})}let yB=["textarea","input"].join(",");function xB(e){var t,r;return(r=(t=e?.matches)==null?void 0:t.call(e,yB))!=null?r:!1}function fM(e,t=r=>r){return e.slice().sort((r,n)=>{let a=t(r),o=t(n);if(a===null||o===null)return 0;let s=a.compareDocumentPosition(o);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function vB(e,t,r=e===null?document.body:Gs(e)){return pa(Of(r),t,{relativeTo:e})}function pa(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:a=[]}={}){let o=Array.isArray(e)?e.length>0?Gs(e[0]):document:Gs(e),s=Array.isArray(e)?r?fM(e):e:t&64?gB(e):Of(e);a.length>0&&s.length>1&&(s=s.filter(h=>!a.some(g=>g!=null&&"current"in g?g?.current===h:g===h))),n=n??o?.activeElement;let l=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,s.indexOf(n))-1;if(t&4)return Math.max(0,s.indexOf(n))+1;if(t&8)return s.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},d=0,f=s.length,p;do{if(d>=f||d+f<=0)return 0;let h=c+d;if(t&16)h=(h+f)%f;else{if(h<0)return 3;if(h>=f)return 1}p=s[h],p?.focus(u),d+=l}while(p!==Zs(p));return t&6&&xB(p)&&p.select(),2}function mM(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function kB(){return/Android/gi.test(window.navigator.userAgent)}function OS(){return mM()||kB()}function Ul(e,t,r,n){let a=es(r);m.useEffect(()=>{if(!e)return;function o(s){a.current(s)}return document.addEventListener(t,o,n),()=>document.removeEventListener(t,o,n)},[e,t,n])}function pM(e,t,r,n){let a=es(r);m.useEffect(()=>{if(!e)return;function o(s){a.current(s)}return window.addEventListener(t,o,n),()=>window.removeEventListener(t,o,n)},[e,t,n])}const PS=30;function $j(e,t,r){let n=es(r),a=m.useCallback(function(l,c){if(l.defaultPrevented)return;let u=c(l);if(u===null||!u.getRootNode().contains(u)||!u.isConnected)return;let d=function f(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let f of d)if(f!==null&&(f.contains(u)||l.composed&&l.composedPath().includes(f)))return;return!rg(u,tg.Loose)&&u.tabIndex!==-1&&l.preventDefault(),n.current(l,u)},[n,t]),o=m.useRef(null);Ul(e,"pointerdown",l=>{var c,u;OS()||(o.current=((u=(c=l.composedPath)==null?void 0:c.call(l))==null?void 0:u[0])||l.target)},!0),Ul(e,"pointerup",l=>{if(OS()||!o.current)return;let c=o.current;return o.current=null,a(l,()=>c)},!0);let s=m.useRef({x:0,y:0});Ul(e,"touchstart",l=>{s.current.x=l.touches[0].clientX,s.current.y=l.touches[0].clientY},!0),Ul(e,"touchend",l=>{let c={x:l.changedTouches[0].clientX,y:l.changedTouches[0].clientY};if(!(Math.abs(c.x-s.current.x)>=PS||Math.abs(c.y-s.current.y)>=PS))return a(l,()=>ma(l.target)?l.target:null)},!0),pM(e,"blur",l=>a(l,()=>M$(window.document.activeElement)?window.document.activeElement:null),!0)}function nl(...e){return m.useMemo(()=>ds(...e),[...e])}function wB(...e){return m.useMemo(()=>Gs(...e),[...e])}var jB=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(jB||{});const Nm={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},NB=200,AS=5;function EB(e,{trigger:t,action:r,close:n,select:a}){let o=m.useRef(null),s=m.useRef(null),l=m.useRef(null);Ul(e&&t!==null,"pointerdown",c=>{X9(c?.target)&&t!=null&&t.contains(c.target)&&(s.current=c.x,l.current=c.y,o.current=c.timeStamp)}),Ul(e&&t!==null,"pointerup",c=>{var u,d;let f=o.current;if(f===null||(o.current=null,!ma(c.target))||Math.abs(c.x-((u=s.current)!=null?u:c.x))<AS&&Math.abs(c.y-((d=l.current)!=null?d:c.y))<AS)return;let p=r(c);switch(p.kind){case 0:return;case 1:{c.timeStamp-f>NB&&(a(p.target),n());break}case 2:{n();break}}},{capture:!0})}function Bj(e,t,r,n){let a=es(r);m.useEffect(()=>{e=e??window;function o(s){a.current(s)}return e.addEventListener(t,o,n),()=>e.removeEventListener(t,o,n)},[e,t,n])}function ng(e,t){return m.useMemo(()=>{var r;if(e.type)return e.type;let n=(r=e.as)!=null?r:"button";if(typeof n=="string"&&n.toLowerCase()==="button"||t?.tagName==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function SB(e){return m.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function CB(e,t){let r=e(),n=new Set;return{getSnapshot(){return r},subscribe(a){return n.add(a),()=>n.delete(a)},dispatch(a,...o){let s=t[a].call(r,...o);s&&(r=s,n.forEach(l=>l()))}}}function OB(){let e;return{before({doc:t}){var r;let n=t.documentElement,a=(r=t.defaultView)!=null?r:window;e=Math.max(0,a.innerWidth-n.clientWidth)},after({doc:t,d:r}){let n=t.documentElement,a=Math.max(0,n.clientWidth-n.offsetWidth),o=Math.max(0,e-a);r.style(n,"paddingRight",`${o}px`)}}}function PB(){return mM()?{before({doc:e,d:t,meta:r}){function n(a){for(let o of r().containers)for(let s of o())if(s.contains(a))return!0;return!1}t.microTask(()=>{var a;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let l=Jn();l.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>l.dispose()))}let o=(a=window.scrollY)!=null?a:window.pageYOffset,s=null;t.addEventListener(e,"click",l=>{if(ma(l.target))try{let c=l.target.closest("a");if(!c)return;let{hash:u}=new URL(c.href),d=e.querySelector(u);ma(d)&&!n(d)&&(s=d)}catch{}},!0),t.group(l=>{t.addEventListener(e,"touchstart",c=>{if(l.dispose(),ma(c.target)&&A$(c.target))if(n(c.target)){let u=c.target;for(;u.parentElement&&n(u.parentElement);)u=u.parentElement;l.style(u,"overscrollBehavior","contain")}else l.style(c.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",l=>{if(ma(l.target)){if(G9(l.target))return;if(n(l.target)){let c=l.target;for(;c.parentElement&&c.dataset.headlessuiPortal!==""&&!(c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth);)c=c.parentElement;c.dataset.headlessuiPortal===""&&l.preventDefault()}else l.preventDefault()}},{passive:!1}),t.add(()=>{var l;let c=(l=window.scrollY)!=null?l:window.pageYOffset;o!==c&&window.scrollTo(0,o),s&&s.isConnected&&(s.scrollIntoView({block:"nearest"}),s=null)})})}}:{}}function AB(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function MS(e){let t={};for(let r of e)Object.assign(t,r(t));return t}let Vi=CB(()=>new Map,{PUSH(e,t){var r;let n=(r=this.get(e))!=null?r:{doc:e,count:0,d:Jn(),meta:new Set,computedMeta:{}};return n.count++,n.meta.add(t),n.computedMeta=MS(n.meta),this.set(e,n),this},POP(e,t){let r=this.get(e);return r&&(r.count--,r.meta.delete(t),r.computedMeta=MS(r.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},r=[PB(),OB(),AB()];r.forEach(({before:n})=>n?.(t)),r.forEach(({after:n})=>n?.(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Vi.subscribe(()=>{let e=Vi.getSnapshot(),t=new Map;for(let[r]of e)t.set(r,r.documentElement.style.overflow);for(let r of e.values()){let n=t.get(r.doc)==="hidden",a=r.count!==0;(a&&!n||!a&&n)&&Vi.dispatch(r.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",r),r.count===0&&Vi.dispatch("TEARDOWN",r)}});function MB(e,t,r=()=>({containers:[]})){let n=SB(Vi),a=t?n.get(t):void 0,o=a?a.count>0:!1;return Ir(()=>{if(!(!t||!e))return Vi.dispatch("PUSH",t,r),()=>Vi.dispatch("POP",t,r)},[e,t]),o}function Hj(e,t,r=()=>[document.body]){let n=Cf(e,"scroll-lock");MB(n,t,a=>{var o;return{containers:[...(o=a.containers)!=null?o:[],r]}})}function TS(e){return[e.screenX,e.screenY]}function TB(){let e=m.useRef([-1,-1]);return{wasMoved(t){let r=TS(t);return e.current[0]===r[0]&&e.current[1]===r[1]?!1:(e.current=r,!0)},update(t){e.current=TS(t)}}}function _B(e=0){let[t,r]=m.useState(e),n=m.useCallback(c=>r(c),[]),a=m.useCallback(c=>r(u=>u|c),[]),o=m.useCallback(c=>(t&c)===c,[t]),s=m.useCallback(c=>r(u=>u&~c),[]),l=m.useCallback(c=>r(u=>u^c),[]);return{flags:t,setFlag:n,addFlag:a,hasFlag:o,removeFlag:s,toggleFlag:l}}var _S,IS;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((_S=process==null?void 0:O9)==null?void 0:_S.NODE_ENV)==="test"&&typeof((IS=Element?.prototype)==null?void 0:IS.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
15
- `)),[]});var IB=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(IB||{});function Pf(e){let t={};for(let r in e)e[r]===!0&&(t[`data-${r}`]="");return t}function Af(e,t,r,n){let[a,o]=m.useState(r),{hasFlag:s,addFlag:l,removeFlag:c}=_B(e&&a?3:0),u=m.useRef(!1),d=m.useRef(!1),f=fs();return Ir(()=>{var p;if(e){if(r&&o(!0),!t){r&&l(3);return}return(p=n?.start)==null||p.call(n,r),DB(t,{inFlight:u,prepare(){d.current?d.current=!1:d.current=u.current,u.current=!0,!d.current&&(r?(l(3),c(4)):(l(4),c(2)))},run(){d.current?r?(c(3),l(4)):(c(4),l(3)):r?c(1):l(1)},done(){var h;d.current&&FB(t)||(u.current=!1,c(7),r||o(!1),(h=n?.end)==null||h.call(n,r))}})}},[e,r,t,f]),e?[a,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function DB(e,{prepare:t,run:r,done:n,inFlight:a}){let o=Jn();return RB(e,{prepare:t,inFlight:a}),o.nextFrame(()=>{r(),o.requestAnimationFrame(()=>{o.add(LB(e,n))})}),o.dispose}function LB(e,t){var r,n;let a=Jn();if(!e)return a.dispose;let o=!1;a.add(()=>{o=!0});let s=(n=(r=e.getAnimations)==null?void 0:r.call(e).filter(l=>l instanceof CSSTransition))!=null?n:[];return s.length===0?(t(),a.dispose):(Promise.allSettled(s.map(l=>l.finished)).then(()=>{o||t()}),a.dispose)}function RB(e,{inFlight:t,prepare:r}){if(t!=null&&t.current){r();return}let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}function FB(e){var t,r;return((r=(t=e.getAnimations)==null?void 0:t.call(e))!=null?r:[]).some(n=>n instanceof CSSTransition&&n.playState!=="finished")}function $B(e,{container:t,accept:r,walk:n}){let a=m.useRef(r),o=m.useRef(n);m.useEffect(()=>{a.current=r,o.current=n},[r,n]),Ir(()=>{if(!t||!e)return;let s=ds(t);if(!s)return;let l=a.current,c=o.current,u=Object.assign(f=>l(f),{acceptNode:l}),d=s.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)c(d.currentNode)},[t,e,a,o])}function zj(e,t){let r=m.useRef([]),n=et(e);m.useEffect(()=>{let a=[...r.current];for(let[o,s]of t.entries())if(r.current[o]!==s){let l=n(t,a);return r.current=t,l}},[n,...t])}function ag(){return typeof window<"u"}function ru(e){return hM(e)?(e.nodeName||"").toLowerCase():"#document"}function ba(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ao(e){var t;return(t=(hM(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function hM(e){return ag()?e instanceof Node||e instanceof ba(e).Node:!1}function gn(e){return ag()?e instanceof Element||e instanceof ba(e).Element:!1}function ko(e){return ag()?e instanceof HTMLElement||e instanceof ba(e).HTMLElement:!1}function DS(e){return!ag()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ba(e).ShadowRoot}const BB=new Set(["inline","contents"]);function Mf(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Ka(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!BB.has(a)}const HB=new Set(["table","td","th"]);function zB(e){return HB.has(ru(e))}const UB=[":popover-open",":modal"];function og(e){return UB.some(t=>{try{return e.matches(t)}catch{return!1}})}const qB=["transform","translate","scale","rotate","perspective"],VB=["transform","translate","scale","rotate","perspective","filter"],WB=["paint","layout","strict","content"];function Uj(e){const t=qj(),r=gn(e)?Ka(e):e;return qB.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||VB.some(n=>(r.willChange||"").includes(n))||WB.some(n=>(r.contain||"").includes(n))}function KB(e){let t=Qs(e);for(;ko(t)&&!gc(t);){if(Uj(t))return t;if(og(t))return null;t=Qs(t)}return null}function qj(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const YB=new Set(["html","body","#document"]);function gc(e){return YB.has(ru(e))}function Ka(e){return ba(e).getComputedStyle(e)}function sg(e){return gn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qs(e){if(ru(e)==="html")return e;const t=e.assignedSlot||e.parentNode||DS(e)&&e.host||Ao(e);return DS(t)?t.host:t}function gM(e){const t=Qs(e);return gc(t)?e.ownerDocument?e.ownerDocument.body:e.body:ko(t)&&Mf(t)?t:gM(t)}function Vs(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=gM(e),o=a===((n=e.ownerDocument)==null?void 0:n.body),s=ba(a);if(o){const l=Ew(s);return t.concat(s,s.visualViewport||[],Mf(a)?a:[],l&&r?Vs(l):[])}return t.concat(a,Vs(a,[],r))}function Ew(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function XB(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:r,version:n}=t;return r+"/"+n}).join(" "):navigator.userAgent}const GB=["top","right","bottom","left"],wo=Math.min,mn=Math.max,bc=Math.round,Em=Math.floor,ho=e=>({x:e,y:e}),ZB={left:"right",right:"left",bottom:"top",top:"bottom"},JB={start:"end",end:"start"};function Sw(e,t,r){return mn(e,wo(t,r))}function Ya(e,t){return typeof e=="function"?e(t):e}function rs(e){return e.split("-")[0]}function nu(e){return e.split("-")[1]}function Vj(e){return e==="x"?"y":"x"}function Wj(e){return e==="y"?"height":"width"}const QB=new Set(["top","bottom"]);function so(e){return QB.has(rs(e))?"y":"x"}function Kj(e){return Vj(so(e))}function eH(e,t,r){r===void 0&&(r=!1);const n=nu(e),a=Kj(e),o=Wj(a);let s=a==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Np(s)),[s,Np(s)]}function tH(e){const t=Np(e);return[Cw(e),t,Cw(t)]}function Cw(e){return e.replace(/start|end/g,t=>JB[t])}const LS=["left","right"],RS=["right","left"],rH=["top","bottom"],nH=["bottom","top"];function aH(e,t,r){switch(e){case"top":case"bottom":return r?t?RS:LS:t?LS:RS;case"left":case"right":return t?rH:nH;default:return[]}}function oH(e,t,r,n){const a=nu(e);let o=aH(rs(e),r==="start",n);return a&&(o=o.map(s=>s+"-"+a),t&&(o=o.concat(o.map(Cw)))),o}function Np(e){return e.replace(/left|right|bottom|top/g,t=>ZB[t])}function sH(e){return{top:0,right:0,bottom:0,left:0,...e}}function bM(e){return typeof e!="number"?sH(e):{top:e,right:e,bottom:e,left:e}}function Ep(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function FS(e,t,r){let{reference:n,floating:a}=e;const o=so(t),s=Kj(t),l=Wj(s),c=rs(t),u=o==="y",d=n.x+n.width/2-a.width/2,f=n.y+n.height/2-a.height/2,p=n[l]/2-a[l]/2;let h;switch(c){case"top":h={x:d,y:n.y-a.height};break;case"bottom":h={x:d,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:f};break;case"left":h={x:n.x-a.width,y:f};break;default:h={x:n.x,y:n.y}}switch(nu(t)){case"start":h[s]-=p*(r&&u?-1:1);break;case"end":h[s]+=p*(r&&u?-1:1);break}return h}async function yM(e,t){var r;t===void 0&&(t={});const{x:n,y:a,platform:o,rects:s,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=Ya(t,e),g=bM(h),b=l[p?f==="floating"?"reference":"floating":f],y=Ep(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(b)))==null||r?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),v=f==="floating"?{x:n,y:a,width:s.floating.width,height:s.floating.height}:s.reference,k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),N=await(o.isElement==null?void 0:o.isElement(k))?await(o.getScale==null?void 0:o.getScale(k))||{x:1,y:1}:{x:1,y:1},w=Ep(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:k,strategy:c}):v);return{top:(y.top-w.top+g.top)/N.y,bottom:(w.bottom-y.bottom+g.bottom)/N.y,left:(y.left-w.left+g.left)/N.x,right:(w.right-y.right+g.right)/N.x}}const iH=async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:s}=r,l=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:f}=FS(u,n,c),p=n,h={},g=0;for(let y=0;y<l.length;y++){var b;const{name:v,fn:k}=l[y],{x:N,y:w,data:E,reset:C}=await k({x:d,y:f,initialPlacement:n,placement:p,strategy:a,middlewareData:h,rects:u,platform:{...s,detectOverflow:(b=s.detectOverflow)!=null?b:yM},elements:{reference:e,floating:t}});d=N??d,f=w??f,h={...h,[v]:{...h[v],...E}},C&&g<=50&&(g++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:a}):C.rects),{x:d,y:f}=FS(u,p,c)),y=-1)}return{x:d,y:f,placement:p,strategy:a,middlewareData:h}},lH=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:o,platform:s,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=Ya(e,t)||{};if(u==null)return{};const f=bM(d),p={x:r,y:n},h=Kj(a),g=Wj(h),b=await s.getDimensions(u),y=h==="y",v=y?"top":"left",k=y?"bottom":"right",N=y?"clientHeight":"clientWidth",w=o.reference[g]+o.reference[h]-p[h]-o.floating[g],E=p[h]-o.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let O=C?C[N]:0;(!O||!await(s.isElement==null?void 0:s.isElement(C)))&&(O=l.floating[N]||o.floating[g]);const D=w/2-E/2,A=O/2-b[g]/2-1,M=wo(f[v],A),I=wo(f[k],A),T=M,R=O-b[g]-I,L=O/2-b[g]/2+D,F=Sw(T,L,R),V=!c.arrow&&nu(a)!=null&&L!==F&&o.reference[g]/2-(L<T?M:I)-b[g]/2<0,H=V?L<T?L-T:L-R:0;return{[h]:p[h]+H,data:{[h]:F,centerOffset:L-F-H,...V&&{alignmentOffset:H}},reset:V}}}),cH=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:o,rects:s,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...y}=Ya(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const v=rs(a),k=so(l),N=rs(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(u.floating)),E=p||(N||!b?[Np(l)]:tH(l)),C=g!=="none";!p&&C&&E.push(...oH(l,b,g,w));const O=[l,...E],D=await c.detectOverflow(t,y),A=[];let M=((n=o.flip)==null?void 0:n.overflows)||[];if(d&&A.push(D[v]),f){const L=eH(a,s,w);A.push(D[L[0]],D[L[1]])}if(M=[...M,{placement:a,overflows:A}],!A.every(L=>L<=0)){var I,T;const L=(((I=o.flip)==null?void 0:I.index)||0)+1,F=O[L];if(F&&(!(f==="alignment"&&k!==so(F))||M.every(H=>so(H.placement)===k?H.overflows[0]>0:!0)))return{data:{index:L,overflows:M},reset:{placement:F}};let V=(T=M.filter(H=>H.overflows[0]<=0).sort((H,$)=>H.overflows[1]-$.overflows[1])[0])==null?void 0:T.placement;if(!V)switch(h){case"bestFit":{var R;const H=(R=M.filter($=>{if(C){const z=so($.placement);return z===k||z==="y"}return!0}).map($=>[$.placement,$.overflows.filter(z=>z>0).reduce((z,W)=>z+W,0)]).sort(($,z)=>$[1]-z[1])[0])==null?void 0:R[0];H&&(V=H);break}case"initialPlacement":V=l;break}if(a!==V)return{reset:{placement:V}}}return{}}}};function $S(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function BS(e){return GB.some(t=>e[t]>=0)}const uH=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...o}=Ya(e,t);switch(a){case"referenceHidden":{const s=await n.detectOverflow(t,{...o,elementContext:"reference"}),l=$S(s,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:BS(l)}}}case"escaped":{const s=await n.detectOverflow(t,{...o,altBoundary:!0}),l=$S(s,r.floating);return{data:{escapedOffsets:l,escaped:BS(l)}}}default:return{}}}}},xM=new Set(["left","top"]);async function dH(e,t){const{placement:r,platform:n,elements:a}=e,o=await(n.isRTL==null?void 0:n.isRTL(a.floating)),s=rs(r),l=nu(r),c=so(r)==="y",u=xM.has(s)?-1:1,d=o&&c?-1:1,f=Ya(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*d,y:p*u}:{x:p*u,y:h*d}}const fH=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:o,placement:s,middlewareData:l}=t,c=await dH(t,e);return s===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:s}}}}},mH=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:o}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:v=>{let{x:k,y:N}=v;return{x:k,y:N}}},...u}=Ya(e,t),d={x:r,y:n},f=await o.detectOverflow(t,u),p=so(rs(a)),h=Vj(p);let g=d[h],b=d[p];if(s){const v=h==="y"?"top":"left",k=h==="y"?"bottom":"right",N=g+f[v],w=g-f[k];g=Sw(N,g,w)}if(l){const v=p==="y"?"top":"left",k=p==="y"?"bottom":"right",N=b+f[v],w=b-f[k];b=Sw(N,b,w)}const y=c.fn({...t,[h]:g,[p]:b});return{...y,data:{x:y.x-r,y:y.y-n,enabled:{[h]:s,[p]:l}}}}}},pH=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:o,middlewareData:s}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Ya(e,t),d={x:r,y:n},f=so(a),p=Vj(f);let h=d[p],g=d[f];const b=Ya(l,t),y=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(c){const N=p==="y"?"height":"width",w=o.reference[p]-o.floating[N]+y.mainAxis,E=o.reference[p]+o.reference[N]-y.mainAxis;h<w?h=w:h>E&&(h=E)}if(u){var v,k;const N=p==="y"?"width":"height",w=xM.has(rs(a)),E=o.reference[f]-o.floating[N]+(w&&((v=s.offset)==null?void 0:v[f])||0)+(w?0:y.crossAxis),C=o.reference[f]+o.reference[N]+(w?0:((k=s.offset)==null?void 0:k[f])||0)-(w?y.crossAxis:0);g<E?g=E:g>C&&(g=C)}return{[p]:h,[f]:g}}}},hH=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:o,platform:s,elements:l}=t,{apply:c=()=>{},...u}=Ya(e,t),d=await s.detectOverflow(t,u),f=rs(a),p=nu(a),h=so(a)==="y",{width:g,height:b}=o.floating;let y,v;f==="top"||f==="bottom"?(y=f,v=p===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(v=f,y=p==="end"?"top":"bottom");const k=b-d.top-d.bottom,N=g-d.left-d.right,w=wo(b-d[y],k),E=wo(g-d[v],N),C=!t.middlewareData.shift;let O=w,D=E;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(D=N),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(O=k),C&&!p){const M=mn(d.left,0),I=mn(d.right,0),T=mn(d.top,0),R=mn(d.bottom,0);h?D=g-2*(M!==0||I!==0?M+I:mn(d.left,d.right)):O=b-2*(T!==0||R!==0?T+R:mn(d.top,d.bottom))}await c({...t,availableWidth:D,availableHeight:O});const A=await s.getDimensions(l.floating);return g!==A.width||b!==A.height?{reset:{rects:!0}}:{}}}};function vM(e){const t=Ka(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=ko(e),o=a?e.offsetWidth:r,s=a?e.offsetHeight:n,l=bc(r)!==o||bc(n)!==s;return l&&(r=o,n=s),{width:r,height:n,$:l}}function Yj(e){return gn(e)?e:e.contextElement}function rc(e){const t=Yj(e);if(!ko(t))return ho(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=vM(t);let s=(o?bc(r.width):r.width)/n,l=(o?bc(r.height):r.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const gH=ho(0);function kM(e){const t=ba(e);return!qj()||!t.visualViewport?gH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bH(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==ba(e)?!1:t}function al(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),o=Yj(e);let s=ho(1);t&&(n?gn(n)&&(s=rc(n)):s=rc(e));const l=bH(o,r,n)?kM(o):ho(0);let c=(a.left+l.x)/s.x,u=(a.top+l.y)/s.y,d=a.width/s.x,f=a.height/s.y;if(o){const p=ba(o),h=n&&gn(n)?ba(n):n;let g=p,b=Ew(g);for(;b&&n&&h!==g;){const y=rc(b),v=b.getBoundingClientRect(),k=Ka(b),N=v.left+(b.clientLeft+parseFloat(k.paddingLeft))*y.x,w=v.top+(b.clientTop+parseFloat(k.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,f*=y.y,c+=N,u+=w,g=ba(b),b=Ew(g)}}return Ep({width:d,height:f,x:c,y:u})}function ig(e,t){const r=sg(e).scrollLeft;return t?t.left+r:al(Ao(e)).left+r}function wM(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-ig(e,r),a=r.top+t.scrollTop;return{x:n,y:a}}function yH(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o=a==="fixed",s=Ao(n),l=t?og(t.floating):!1;if(n===s||l&&o)return r;let c={scrollLeft:0,scrollTop:0},u=ho(1);const d=ho(0),f=ko(n);if((f||!f&&!o)&&((ru(n)!=="body"||Mf(s))&&(c=sg(n)),ko(n))){const h=al(n);u=rc(n),d.x=h.x+n.clientLeft,d.y=h.y+n.clientTop}const p=s&&!f&&!o?wM(s,c):ho(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+p.x,y:r.y*u.y-c.scrollTop*u.y+d.y+p.y}}function xH(e){return Array.from(e.getClientRects())}function vH(e){const t=Ao(e),r=sg(e),n=e.ownerDocument.body,a=mn(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=mn(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+ig(e);const l=-r.scrollTop;return Ka(n).direction==="rtl"&&(s+=mn(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:s,y:l}}const HS=25;function kH(e,t){const r=ba(e),n=Ao(e),a=r.visualViewport;let o=n.clientWidth,s=n.clientHeight,l=0,c=0;if(a){o=a.width,s=a.height;const d=qj();(!d||d&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}const u=ig(n);if(u<=0){const d=n.ownerDocument,f=d.body,p=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(n.clientWidth-f.clientWidth-h);g<=HS&&(o-=g)}else u<=HS&&(o+=u);return{width:o,height:s,x:l,y:c}}const wH=new Set(["absolute","fixed"]);function jH(e,t){const r=al(e,!0,t==="fixed"),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=ko(e)?rc(e):ho(1),s=e.clientWidth*o.x,l=e.clientHeight*o.y,c=a*o.x,u=n*o.y;return{width:s,height:l,x:c,y:u}}function zS(e,t,r){let n;if(t==="viewport")n=kH(e,r);else if(t==="document")n=vH(Ao(e));else if(gn(t))n=jH(t,r);else{const a=kM(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Ep(n)}function jM(e,t){const r=Qs(e);return r===t||!gn(r)||gc(r)?!1:Ka(r).position==="fixed"||jM(r,t)}function NH(e,t){const r=t.get(e);if(r)return r;let n=Vs(e,[],!1).filter(l=>gn(l)&&ru(l)!=="body"),a=null;const o=Ka(e).position==="fixed";let s=o?Qs(e):e;for(;gn(s)&&!gc(s);){const l=Ka(s),c=Uj(s);!c&&l.position==="fixed"&&(a=null),(o?!c&&!a:!c&&l.position==="static"&&a&&wH.has(a.position)||Mf(s)&&!c&&jM(e,s))?n=n.filter(u=>u!==s):a=l,s=Qs(s)}return t.set(e,n),n}function EH(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o=[...r==="clippingAncestors"?og(t)?[]:NH(t,this._c):[].concat(r),n],s=o[0],l=o.reduce((c,u)=>{const d=zS(t,u,a);return c.top=mn(d.top,c.top),c.right=wo(d.right,c.right),c.bottom=wo(d.bottom,c.bottom),c.left=mn(d.left,c.left),c},zS(t,s,a));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function SH(e){const{width:t,height:r}=vM(e);return{width:t,height:r}}function CH(e,t,r){const n=ko(t),a=Ao(t),o=r==="fixed",s=al(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=ho(0);function u(){c.x=ig(a)}if(n||!n&&!o)if((ru(t)!=="body"||Mf(a))&&(l=sg(t)),n){const h=al(t,!0,o,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else a&&u();o&&!n&&a&&u();const d=a&&!n&&!o?wM(a,l):ho(0),f=s.left+l.scrollLeft-c.x-d.x,p=s.top+l.scrollTop-c.y-d.y;return{x:f,y:p,width:s.width,height:s.height}}function hy(e){return Ka(e).position==="static"}function US(e,t){if(!ko(e)||Ka(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Ao(e)===r&&(r=r.ownerDocument.body),r}function NM(e,t){const r=ba(e);if(og(e))return r;if(!ko(e)){let a=Qs(e);for(;a&&!gc(a);){if(gn(a)&&!hy(a))return a;a=Qs(a)}return r}let n=US(e,t);for(;n&&zB(n)&&hy(n);)n=US(n,t);return n&&gc(n)&&hy(n)&&!Uj(n)?r:n||KB(e)||r}const OH=async function(e){const t=this.getOffsetParent||NM,r=this.getDimensions,n=await r(e.floating);return{reference:CH(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function PH(e){return Ka(e).direction==="rtl"}const AH={convertOffsetParentRelativeRectToViewportRelativeRect:yH,getDocumentElement:Ao,getClippingRect:EH,getOffsetParent:NM,getElementRects:OH,getClientRects:xH,getDimensions:SH,getScale:rc,isElement:gn,isRTL:PH};function EM(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function MH(e,t){let r=null,n;const a=Ao(e);function o(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function s(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),o();const u=e.getBoundingClientRect(),{left:d,top:f,width:p,height:h}=u;if(l||t(),!p||!h)return;const g=Em(f),b=Em(a.clientWidth-(d+p)),y=Em(a.clientHeight-(f+h)),v=Em(d),k={rootMargin:-g+"px "+-b+"px "+-y+"px "+-v+"px",threshold:mn(0,wo(1,c))||1};let N=!0;function w(E){const C=E[0].intersectionRatio;if(C!==c){if(!N)return s();C?s(!1,C):n=setTimeout(()=>{s(!1,1e-7)},1e3)}C===1&&!EM(u,e.getBoundingClientRect())&&s(),N=!1}try{r=new IntersectionObserver(w,{...k,root:a.ownerDocument})}catch{r=new IntersectionObserver(w,k)}r.observe(e)}return s(!0),o}function lg(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=Yj(e),d=a||o?[...u?Vs(u):[],...Vs(t)]:[];d.forEach(v=>{a&&v.addEventListener("scroll",r,{passive:!0}),o&&v.addEventListener("resize",r)});const f=u&&l?MH(u,r):null;let p=-1,h=null;s&&(h=new ResizeObserver(v=>{let[k]=v;k&&k.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var N;(N=h)==null||N.observe(t)})),r()}),u&&!c&&h.observe(u),h.observe(t));let g,b=c?al(e):null;c&&y();function y(){const v=al(e);b&&!EM(b,v)&&r(),b=v,g=requestAnimationFrame(y)}return r(),()=>{var v;d.forEach(k=>{a&&k.removeEventListener("scroll",r),o&&k.removeEventListener("resize",r)}),f?.(),(v=h)==null||v.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const nc=yM,Xj=fH,Gj=mH,Zj=cH,SM=hH,TH=uH,qS=lH,_H=pH,Jj=(e,t,r)=>{const n=new Map,a={platform:AH,...r},o={...a.platform,_c:n};return iH(e,t,{...a,platform:o})};var IH=typeof document<"u",DH=function(){},np=IH?m.useLayoutEffect:DH;function Sp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!Sp(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;n--!==0;){const o=a[n];if(!(o==="_owner"&&e.$$typeof)&&!Sp(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function CM(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function VS(e,t){const r=CM(e);return Math.round(t*r)/r}function gy(e){const t=m.useRef(e);return np(()=>{t.current=e}),t}function OM(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=m.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=m.useState(n);Sp(p,n)||h(n);const[g,b]=m.useState(null),[y,v]=m.useState(null),k=m.useCallback($=>{$!==C.current&&(C.current=$,b($))},[]),N=m.useCallback($=>{$!==O.current&&(O.current=$,v($))},[]),w=o||g,E=s||y,C=m.useRef(null),O=m.useRef(null),D=m.useRef(d),A=c!=null,M=gy(c),I=gy(a),T=gy(u),R=m.useCallback(()=>{if(!C.current||!O.current)return;const $={placement:t,strategy:r,middleware:p};I.current&&($.platform=I.current),Jj(C.current,O.current,$).then(z=>{const W={...z,isPositioned:T.current!==!1};L.current&&!Sp(D.current,W)&&(D.current=W,Qt.flushSync(()=>{f(W)}))})},[p,t,r,I,T]);np(()=>{u===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,f($=>({...$,isPositioned:!1})))},[u]);const L=m.useRef(!1);np(()=>(L.current=!0,()=>{L.current=!1}),[]),np(()=>{if(w&&(C.current=w),E&&(O.current=E),w&&E){if(M.current)return M.current(w,E,R);R()}},[w,E,R,M,A]);const F=m.useMemo(()=>({reference:C,floating:O,setReference:k,setFloating:N}),[k,N]),V=m.useMemo(()=>({reference:w,floating:E}),[w,E]),H=m.useMemo(()=>{const $={position:r,left:0,top:0};if(!V.floating)return $;const z=VS(V.floating,d.x),W=VS(V.floating,d.y);return l?{...$,transform:"translate("+z+"px, "+W+"px)",...CM(V.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:z,top:W}},[r,l,V.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:R,refs:F,elements:V,floatingStyles:H}),[d,R,F,V,H])}const LH=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:a}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?qS({element:n.current,padding:a}).fn(r):{}:n?qS({element:n,padding:a}).fn(r):{}}}},Qj=(e,t)=>({...Xj(e),options:[e,t]}),PM=(e,t)=>({...Gj(e),options:[e,t]}),RH=(e,t)=>({..._H(e),options:[e,t]}),AM=(e,t)=>({...Zj(e),options:[e,t]}),MM=(e,t)=>({...SM(e),options:[e,t]}),FH=(e,t)=>({...TH(e),options:[e,t]}),$H=(e,t)=>({...LH(e),options:[e,t]}),TM={...Xs},BH=TM.useInsertionEffect,HH=BH||(e=>e());function _M(e){const t=m.useRef(()=>{});return HH(()=>{t.current=e}),m.useCallback(function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.current==null?void 0:t.current(...n)},[])}var Ow=typeof document<"u"?m.useLayoutEffect:m.useEffect;let WS=!1,zH=0;const KS=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+zH++;function UH(){const[e,t]=m.useState(()=>WS?KS():void 0);return Ow(()=>{e==null&&t(KS())},[]),m.useEffect(()=>{WS=!0},[]),e}const qH=TM.useId,VH=qH||UH;function WH(){const e=new Map;return{emit(t,r){var n;(n=e.get(t))==null||n.forEach(a=>a(r))},on(t,r){e.set(t,[...e.get(t)||[],r])},off(t,r){var n;e.set(t,((n=e.get(t))==null?void 0:n.filter(a=>a!==r))||[])}}}const KH=m.createContext(null),YH=m.createContext(null),XH=()=>{var e;return((e=m.useContext(KH))==null?void 0:e.id)||null},GH=()=>m.useContext(YH),ZH="data-floating-ui-focusable";function JH(e){const{open:t=!1,onOpenChange:r,elements:n}=e,a=VH(),o=m.useRef({}),[s]=m.useState(()=>WH()),l=XH()!=null,[c,u]=m.useState(n.reference),d=_M((h,g,b)=>{o.current.openEvent=h?g:void 0,s.emit("openchange",{open:h,event:g,reason:b,nested:l}),r?.(h,g,b)}),f=m.useMemo(()=>({setPositionReference:u}),[]),p=m.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return m.useMemo(()=>({dataRef:o,open:t,onOpenChange:d,elements:p,events:s,floatingId:a,refs:f}),[t,d,p,s,a,f])}function QH(e){e===void 0&&(e={});const{nodeId:t}=e,r=JH({...e,elements:{reference:null,floating:null,...e.elements}}),n=e.rootContext||r,a=n.elements,[o,s]=m.useState(null),[l,c]=m.useState(null),u=a?.domReference||o,d=m.useRef(null),f=GH();Ow(()=>{u&&(d.current=u)},[u]);const p=OM({...e,elements:{...a,...l&&{reference:l}}}),h=m.useCallback(k=>{const N=gn(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),contextElement:k}:k;c(N),p.refs.setReference(N)},[p.refs]),g=m.useCallback(k=>{(gn(k)||k===null)&&(d.current=k,s(k)),(gn(p.refs.reference.current)||p.refs.reference.current===null||k!==null&&!gn(k))&&p.refs.setReference(k)},[p.refs]),b=m.useMemo(()=>({...p.refs,setReference:g,setPositionReference:h,domReference:d}),[p.refs,g,h]),y=m.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),v=m.useMemo(()=>({...p,...n,refs:b,elements:y,nodeId:t}),[p,b,y,t,n]);return Ow(()=>{n.dataRef.current.floatingContext=v;const k=f?.nodesRef.current.find(N=>N.id===t);k&&(k.context=v)}),m.useMemo(()=>({...p,context:v,refs:b,elements:y}),[p,b,y,v])}const YS="active",XS="selected";function by(e,t,r){const n=new Map,a=r==="item";let o=e;if(a&&e){const{[YS]:s,[XS]:l,...c}=e;o=c}return{...r==="floating"&&{tabIndex:-1,[ZH]:""},...o,...t.map(s=>{const l=s?s[r]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((s,l)=>(l&&Object.entries(l).forEach(c=>{let[u,d]=c;if(!(a&&[YS,XS].includes(u)))if(u.indexOf("on")===0){if(n.has(u)||n.set(u,[]),typeof d=="function"){var f;(f=n.get(u))==null||f.push(d),s[u]=function(){for(var p,h=arguments.length,g=new Array(h),b=0;b<h;b++)g[b]=arguments[b];return(p=n.get(u))==null?void 0:p.map(y=>y(...g)).find(y=>y!==void 0)}}}else s[u]=d}),s),{})}}function ez(e){e===void 0&&(e=[]);const t=e.map(l=>l?.reference),r=e.map(l=>l?.floating),n=e.map(l=>l?.item),a=m.useCallback(l=>by(l,e,"reference"),t),o=m.useCallback(l=>by(l,e,"floating"),r),s=m.useCallback(l=>by(l,e,"item"),n);return m.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s}),[a,o,s])}function GS(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const tz=e=>({name:"inner",options:e,async fn(t){const{listRef:r,overflowRef:n,onFallbackChange:a,offset:o=0,index:s=0,minItemsVisible:l=4,referenceOverflowThreshold:c=0,scrollRef:u,...d}=Ya(e,t),{rects:f,elements:{floating:p}}=t,h=r.current[s],g=u?.current||p,b=p.clientTop||g.clientTop,y=p.clientTop!==0,v=g.clientTop!==0,k=p===g;if(!h)return{};const N={...t,...await Qj(-h.offsetTop-p.clientTop-f.reference.height/2-h.offsetHeight/2-o).fn(t)},w=await nc(GS(N,g.scrollHeight+b+p.clientTop),d),E=await nc(N,{...d,elementContext:"reference"}),C=mn(0,w.top),O=N.y+C,D=(g.scrollHeight>g.clientHeight?A=>A:bc)(mn(0,g.scrollHeight+(y&&k||v?b*2:0)-C-mn(0,w.bottom)));if(g.style.maxHeight=D+"px",g.scrollTop=C,a){const A=g.offsetHeight<h.offsetHeight*wo(l,r.current.length)-1||E.top>=-c||E.bottom>=-c;Qt.flushSync(()=>a(A))}return n&&(n.current=await nc(GS({...N,y:O},g.offsetHeight+b+p.clientTop),d)),{y:O}}});function rz(e,t){const{open:r,elements:n}=e,{enabled:a=!0,overflowRef:o,scrollRef:s,onChange:l}=t,c=_M(l),u=m.useRef(!1),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(!a)return;function h(b){if(b.ctrlKey||!g||o.current==null)return;const y=b.deltaY,v=o.current.top>=-.5,k=o.current.bottom>=-.5,N=g.scrollHeight-g.clientHeight,w=y<0?-1:1,E=y<0?"max":"min";g.scrollHeight<=g.clientHeight||(!v&&y>0||!k&&y<0?(b.preventDefault(),Qt.flushSync(()=>{c(C=>C+Math[E](y,N*w))})):/firefox/i.test(XB())&&(g.scrollTop+=y))}const g=s?.current||n.floating;if(r&&g)return g.addEventListener("wheel",h),requestAnimationFrame(()=>{d.current=g.scrollTop,o.current!=null&&(f.current={...o.current})}),()=>{d.current=null,f.current=null,g.removeEventListener("wheel",h)}},[a,r,n.floating,o,s,c]);const p=m.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const h=s?.current||n.floating;if(!(!o.current||!h||!u.current)){if(d.current!==null){const g=h.scrollTop-d.current;(o.current.bottom<-.5&&g<-1||o.current.top<-.5&&g>1)&&Qt.flushSync(()=>c(b=>b+g))}requestAnimationFrame(()=>{d.current=h.scrollTop})}}}),[n.floating,c,o,s]);return m.useMemo(()=>a?{floating:p}:{},[a,p])}let au=m.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});au.displayName="FloatingContext";let eN=m.createContext(null);eN.displayName="PlacementContext";function IM(e){return m.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function DM(){return m.useContext(au).setReference}function nz(){return m.useContext(au).getReferenceProps}function LM(){let{getFloatingProps:e,slot:t}=m.useContext(au);return m.useCallback((...r)=>Object.assign({},e(...r),{"data-anchor":t.anchor}),[e,t])}function RM(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=m.useContext(eN),r=m.useMemo(()=>e,[JSON.stringify(e,(a,o)=>{var s;return(s=o?.outerHTML)!=null?s:o})]);Ir(()=>{t?.(r??null)},[t,r]);let n=m.useContext(au);return m.useMemo(()=>[n.setFloating,e?n.styles:{}],[n.setFloating,e,n.styles])}let ZS=4;function FM({children:e,enabled:t=!0}){let[r,n]=m.useState(null),[a,o]=m.useState(0),s=m.useRef(null),[l,c]=m.useState(null);az(l);let u=t&&r!==null&&l!==null,{to:d="bottom",gap:f=0,offset:p=0,padding:h=0,inner:g}=oz(r,l),[b,y="center"]=d.split(" ");Ir(()=>{u&&o(0)},[u]);let{refs:v,floatingStyles:k,context:N}=QH({open:u,placement:b==="selection"?y==="center"?"bottom":`bottom-${y}`:y==="center"?`${b}`:`${b}-${y}`,strategy:"absolute",transform:!1,middleware:[Qj({mainAxis:b==="selection"?0:f,crossAxis:p}),PM({padding:h}),b!=="selection"&&AM({padding:h}),b==="selection"&&g?tz({...g,padding:h,overflowRef:s,offset:a,minItemsVisible:ZS,referenceOverflowThreshold:h,onFallbackChange(I){var T,R;if(!I)return;let L=N.elements.floating;if(!L)return;let F=parseFloat(getComputedStyle(L).scrollPaddingBottom)||0,V=Math.min(ZS,L.childElementCount),H=0,$=0;for(let z of(R=(T=N.elements.floating)==null?void 0:T.childNodes)!=null?R:[])if(_n(z)){let W=z.offsetTop,U=W+z.clientHeight+F,X=L.scrollTop,Y=X+L.clientHeight;if(W>=X&&U<=Y)V--;else{$=Math.max(0,Math.min(U,Y)-Math.max(W,X)),H=z.clientHeight;break}}V>=1&&o(z=>{let W=H*V-$+F;return z>=W?z:W})}}):null,MM({padding:h,apply({availableWidth:I,availableHeight:T,elements:R}){Object.assign(R.floating.style,{overflow:"auto",maxWidth:`${I}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${T}px)`})}})].filter(Boolean),whileElementsMounted:lg}),[w=b,E=y]=N.placement.split("-");b==="selection"&&(w="selection");let C=m.useMemo(()=>({anchor:[w,E].filter(Boolean).join(" ")}),[w,E]),O=rz(N,{overflowRef:s,onChange:o}),{getReferenceProps:D,getFloatingProps:A}=ez([O]),M=et(I=>{c(I),v.setFloating(I)});return m.createElement(eN.Provider,{value:n},m.createElement(au.Provider,{value:{setFloating:M,setReference:v.setReference,styles:k,getReferenceProps:D,getFloatingProps:A,slot:C}},e))}function az(e){Ir(()=>{if(!e)return;let t=new MutationObserver(()=>{let r=window.getComputedStyle(e).maxHeight,n=parseFloat(r);if(isNaN(n))return;let a=parseInt(r);isNaN(a)||n!==a&&(e.style.maxHeight=`${Math.ceil(n)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function oz(e,t){var r,n,a;let o=yy((r=e?.gap)!=null?r:"var(--anchor-gap, 0)",t),s=yy((n=e?.offset)!=null?n:"var(--anchor-offset, 0)",t),l=yy((a=e?.padding)!=null?a:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:s,padding:l}}function yy(e,t,r=void 0){let n=fs(),a=et((c,u)=>{if(c==null)return[r,null];if(typeof c=="number")return[c,null];if(typeof c=="string"){if(!u)return[r,null];let d=JS(c,u);return[d,f=>{let p=$M(c);{let h=p.map(g=>window.getComputedStyle(u).getPropertyValue(g));n.requestAnimationFrame(function g(){n.nextFrame(g);let b=!1;for(let[v,k]of p.entries()){let N=window.getComputedStyle(u).getPropertyValue(k);if(h[v]!==N){h[v]=N,b=!0;break}}if(!b)return;let y=JS(c,u);d!==y&&(f(y),d=y)})}return n.dispose}]}return[r,null]}),o=m.useMemo(()=>a(e,t)[0],[e,t]),[s=o,l]=m.useState();return Ir(()=>{let[c,u]=a(e,t);if(l(c),!!u)return u(l)},[e,t]),s}function $M(e){let t=/var\((.*)\)/.exec(e);if(t){let r=t[1].indexOf(",");if(r===-1)return[t[1]];let n=t[1].slice(0,r).trim(),a=t[1].slice(r+1).trim();return a?[n,...$M(a)]:[n]}return[]}function JS(e,t){let r=document.createElement("div");t.appendChild(r),r.style.setProperty("margin-top","0px","important"),r.style.setProperty("margin-top",e,"important");let n=parseFloat(window.getComputedStyle(r).marginTop)||0;return t.removeChild(r),n}let cg=m.createContext(null);cg.displayName="OpenClosedContext";var zr=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(zr||{});function ci(){return m.useContext(cg)}function ug({value:e,children:t}){return x.createElement(cg.Provider,{value:e},t)}function tN({children:e}){return x.createElement(cg.Provider,{value:null},e)}function sz(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Is=[];sz(()=>{function e(t){if(!ma(t.target)||t.target===document.body||Is[0]===t.target)return;let r=t.target;r=r.closest(jp),Is.unshift(r??t.target),Is=Is.filter(n=>n!=null&&n.isConnected),Is.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function iz(e){throw new Error("Unexpected object: "+e)}var nn=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(nn||{});function Sm(e,t){let r=t.resolveItems();if(r.length<=0)return null;let n=t.resolveActiveIndex(),a=n??-1;switch(e.focus){case 0:{for(let o=0;o<r.length;++o)if(!t.resolveDisabled(r[o],o,r))return o;return n}case 1:{a===-1&&(a=r.length);for(let o=a-1;o>=0;--o)if(!t.resolveDisabled(r[o],o,r))return o;return n}case 2:{for(let o=a+1;o<r.length;++o)if(!t.resolveDisabled(r[o],o,r))return o;return n}case 3:{for(let o=r.length-1;o>=0;--o)if(!t.resolveDisabled(r[o],o,r))return o;return n}case 4:{for(let o=0;o<r.length;++o)if(t.resolveId(r[o],o,r)===e.id)return o;return n}case 5:return null;default:iz(e)}}function dg(e){let t=et(e),r=m.useRef(!1);m.useEffect(()=>(r.current=!1,()=>{r.current=!0,Gh(()=>{r.current&&t()})}),[t])}let BM=m.createContext(!1);function lz(){return m.useContext(BM)}function QS(e){return x.createElement(BM.Provider,{value:e.force},e.children)}function cz(e){let t=lz(),r=m.useContext(zM),[n,a]=m.useState(()=>{var o;if(!t&&r!==null)return(o=r.current)!=null?o:null;if(mo.isServer)return null;let s=e?.getElementById("headlessui-portal-root");if(s)return s;if(e===null)return null;let l=e.createElement("div");return l.setAttribute("id","headlessui-portal-root"),e.body.appendChild(l)});return m.useEffect(()=>{n!==null&&(e!=null&&e.body.contains(n)||e==null||e.body.appendChild(n))},[n,e]),m.useEffect(()=>{t||r!==null&&a(r.current)},[r,a,t]),n}let HM=m.Fragment,uz=sr(function(e,t){let{ownerDocument:r=null,...n}=e,a=m.useRef(null),o=Ur(_j(p=>{a.current=p}),t),s=nl(a.current),l=r??s,c=cz(l),u=m.useContext(Pw),d=fs(),f=pr();return dg(()=>{var p;c&&c.childNodes.length<=0&&((p=c.parentElement)==null||p.removeChild(c))}),c?Qt.createPortal(x.createElement("div",{"data-headlessui-portal":"",ref:p=>{d.dispose(),u&&p&&d.add(u.register(p))}},f({ourProps:{ref:o},theirProps:n,slot:{},defaultTag:HM,name:"Portal"})),c):null});function dz(e,t){let r=Ur(t),{enabled:n=!0,ownerDocument:a,...o}=e,s=pr();return n?x.createElement(uz,{...o,ownerDocument:a,ref:r}):s({ourProps:{ref:r},theirProps:o,slot:{},defaultTag:HM,name:"Portal"})}let fz=m.Fragment,zM=m.createContext(null);function mz(e,t){let{target:r,...n}=e,a={ref:Ur(t)},o=pr();return x.createElement(zM.Provider,{value:r},o({ourProps:a,theirProps:n,defaultTag:fz,name:"Popover.Group"}))}let Pw=m.createContext(null);function UM(){let e=m.useContext(Pw),t=m.useRef([]),r=et(o=>(t.current.push(o),e&&e.register(o),()=>n(o))),n=et(o=>{let s=t.current.indexOf(o);s!==-1&&t.current.splice(s,1),e&&e.unregister(o)}),a=m.useMemo(()=>({register:r,unregister:n,portals:t}),[r,n,t]);return[t,m.useMemo(()=>function({children:o}){return x.createElement(Pw.Provider,{value:a},o)},[a])]}let pz=sr(dz),qM=sr(mz),rN=Object.assign(pz,{Group:qM});const ap={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function VM(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function hz(e,t,r){let n=Jn();if(t.kind==="Tracked"){let a=function(){o!==VM(e)&&(n.dispose(),r())},{position:o}=t,s=new ResizeObserver(a);s.observe(e),n.add(()=>s.disconnect()),n.addEventListener(window,"scroll",a,{passive:!0}),n.addEventListener(window,"resize",a)}return()=>n.dispose()}function gz(e,t=typeof document<"u"?document.defaultView:null,r){let n=Cf(e,"escape");Bj(t,"keydown",a=>{n&&(a.defaultPrevented||a.key===nr.Escape&&r(a))})}function bz(){var e;let[t]=m.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[r,n]=m.useState((e=t?.matches)!=null?e:!1);return Ir(()=>{if(!t)return;function a(o){n(o.matches)}return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[t]),r}function WM({defaultContainers:e=[],portals:t,mainTreeNode:r}={}){let n=et(()=>{var a,o;let s=ds(r),l=[];for(let c of e)c!==null&&(Xo(c)?l.push(c):"current"in c&&Xo(c.current)&&l.push(c.current));if(t!=null&&t.current)for(let c of t.current)l.push(c);for(let c of(a=s?.querySelectorAll("html > *, body > *"))!=null?a:[])c!==document.body&&c!==document.head&&Xo(c)&&c.id!=="headlessui-portal-root"&&(r&&(c.contains(r)||c.contains((o=r?.getRootNode())==null?void 0:o.host))||l.some(u=>c.contains(u))||l.push(c));return l});return{resolveContainers:n,contains:et(a=>n().some(o=>o.contains(a)))}}let KM=m.createContext(null);function Cp({children:e,node:t}){let[r,n]=m.useState(null),a=nN(t??r);return x.createElement(KM.Provider,{value:a},e,a===null&&x.createElement(Js,{features:ts.Hidden,ref:o=>{var s,l;if(o){for(let c of(l=(s=ds(o))==null?void 0:s.querySelectorAll("html > *, body > *"))!=null?l:[])if(c!==document.body&&c!==document.head&&Xo(c)&&c!=null&&c.contains(o)){n(c);break}}}}))}function nN(e=null){var t;return(t=m.useContext(KM))!=null?t:e}function yz(){let e=typeof document>"u";return"useSyncExternalStore"in Xs?(t=>t.useSyncExternalStore)(Xs)(()=>()=>{},()=>!1,()=>!e):!1}function fg(){let e=yz(),[t,r]=m.useState(mo.isHandoffComplete);return t&&mo.isHandoffComplete===!1&&r(!1),m.useEffect(()=>{t!==!0&&r(!0)},[t]),m.useEffect(()=>mo.handoff(),[]),e?!1:t}function aN(){let e=m.useRef(!1);return Ir(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var ha=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ha||{});function oN(){let e=m.useRef(0);return pM(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function YM(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let r of e.current)Xo(r.current)&&t.add(r.current);return t}let xz="div";var Li=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(Li||{});function vz(e,t){let r=m.useRef(null),n=Ur(r,t),{initialFocus:a,initialFocusFallback:o,containers:s,features:l=15,...c}=e;fg()||(l=0);let u=nl(r.current);Nz(l,{ownerDocument:u});let d=Ez(l,{ownerDocument:u,container:r,initialFocus:a,initialFocusFallback:o});Sz(l,{ownerDocument:u,container:r,containers:s,previousActiveElement:d});let f=oN(),p=et(k=>{if(!_n(r.current))return;let N=r.current;(w=>w())(()=>{ln(f.current,{[ha.Forwards]:()=>{pa(N,hn.First,{skipElements:[k.relatedTarget,o]})},[ha.Backwards]:()=>{pa(N,hn.Last,{skipElements:[k.relatedTarget,o]})}})})}),h=Cf(!!(l&2),"focus-trap#tab-lock"),g=fs(),b=m.useRef(!1),y={ref:n,onKeyDown(k){k.key=="Tab"&&(b.current=!0,g.requestAnimationFrame(()=>{b.current=!1}))},onBlur(k){if(!(l&4))return;let N=YM(s);_n(r.current)&&N.add(r.current);let w=k.relatedTarget;ma(w)&&w.dataset.headlessuiFocusGuard!=="true"&&(XM(N,w)||(b.current?pa(r.current,ln(f.current,{[ha.Forwards]:()=>hn.Next,[ha.Backwards]:()=>hn.Previous})|hn.WrapAround,{relativeTo:k.target}):ma(k.target)&&po(k.target)))}},v=pr();return x.createElement(x.Fragment,null,h&&x.createElement(Js,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:p,features:ts.Focusable}),v({ourProps:y,theirProps:c,defaultTag:xz,name:"FocusTrap"}),h&&x.createElement(Js,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:p,features:ts.Focusable}))}let kz=sr(vz),wz=Object.assign(kz,{features:Li});function jz(e=!0){let t=m.useRef(Is.slice());return zj(([r],[n])=>{n===!0&&r===!1&&Gh(()=>{t.current.splice(0)}),n===!1&&r===!0&&(t.current=Is.slice())},[e,Is,t]),et(()=>{var r;return(r=t.current.find(n=>n!=null&&n.isConnected))!=null?r:null})}function Nz(e,{ownerDocument:t}){let r=!!(e&8),n=jz(r);zj(()=>{r||U9(t?.body)&&po(n())},[r]),dg(()=>{r&&po(n())})}function Ez(e,{ownerDocument:t,container:r,initialFocus:n,initialFocusFallback:a}){let o=m.useRef(null),s=Cf(!!(e&1),"focus-trap#initial-focus"),l=aN();return zj(()=>{if(e===0)return;if(!s){a!=null&&a.current&&po(a.current);return}let c=r.current;c&&Gh(()=>{if(!l.current)return;let u=t?.activeElement;if(n!=null&&n.current){if(n?.current===u){o.current=u;return}}else if(c.contains(u)){o.current=u;return}if(n!=null&&n.current)po(n.current);else{if(e&16){if(pa(c,hn.First|hn.AutoFocus)!==hc.Error)return}else if(pa(c,hn.First)!==hc.Error)return;if(a!=null&&a.current&&(po(a.current),t?.activeElement===a.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}o.current=t?.activeElement})},[a,s,e]),o}function Sz(e,{ownerDocument:t,container:r,containers:n,previousActiveElement:a}){let o=aN(),s=!!(e&4);Bj(t?.defaultView,"focus",l=>{if(!s||!o.current)return;let c=YM(n);_n(r.current)&&c.add(r.current);let u=a.current;if(!u)return;let d=l.target;_n(d)?XM(c,d)?(a.current=d,po(d)):(l.preventDefault(),l.stopPropagation(),po(u)):po(a.current)},!0)}function XM(e,t){for(let r of e)if(r.contains(t))return!0;return!1}function GM(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!tc((t=e.as)!=null?t:JM)||x.Children.count(e.children)===1}let mg=m.createContext(null);mg.displayName="TransitionContext";var Cz=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Cz||{});function Oz(){let e=m.useContext(mg);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Pz(){let e=m.useContext(pg);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let pg=m.createContext(null);pg.displayName="NestingContext";function hg(e){return"children"in e?hg(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function ZM(e,t){let r=es(e),n=m.useRef([]),a=aN(),o=fs(),s=et((h,g=Rs.Hidden)=>{let b=n.current.findIndex(({el:y})=>y===h);b!==-1&&(ln(g,{[Rs.Unmount](){n.current.splice(b,1)},[Rs.Hidden](){n.current[b].state="hidden"}}),o.microTask(()=>{var y;!hg(n)&&a.current&&((y=r.current)==null||y.call(r))}))}),l=et(h=>{let g=n.current.find(({el:b})=>b===h);return g?g.state!=="visible"&&(g.state="visible"):n.current.push({el:h,state:"visible"}),()=>s(h,Rs.Unmount)}),c=m.useRef([]),u=m.useRef(Promise.resolve()),d=m.useRef({enter:[],leave:[]}),f=et((h,g,b)=>{c.current.splice(0),t&&(t.chains.current[g]=t.chains.current[g].filter(([y])=>y!==h)),t?.chains.current[g].push([h,new Promise(y=>{c.current.push(y)})]),t?.chains.current[g].push([h,new Promise(y=>{Promise.all(d.current[g].map(([v,k])=>k)).then(()=>y())})]),g==="enter"?u.current=u.current.then(()=>t?.wait.current).then(()=>b(g)):b(g)}),p=et((h,g,b)=>{Promise.all(d.current[g].splice(0).map(([y,v])=>v)).then(()=>{var y;(y=c.current.shift())==null||y()}).then(()=>b(g))});return m.useMemo(()=>({children:n,register:l,unregister:s,onStart:f,onStop:p,wait:u,chains:d}),[l,s,n,f,p,d,u])}let JM=m.Fragment,QM=Aa.RenderStrategy;function Az(e,t){var r,n;let{transition:a=!0,beforeEnter:o,afterEnter:s,beforeLeave:l,afterLeave:c,enter:u,enterFrom:d,enterTo:f,entered:p,leave:h,leaveFrom:g,leaveTo:b,...y}=e,[v,k]=m.useState(null),N=m.useRef(null),w=GM(e),E=Ur(...w?[N,t,k]:t===null?[]:[t]),C=(r=y.unmount)==null||r?Rs.Unmount:Rs.Hidden,{show:O,appear:D,initial:A}=Oz(),[M,I]=m.useState(O?"visible":"hidden"),T=Pz(),{register:R,unregister:L}=T;Ir(()=>R(N),[R,N]),Ir(()=>{if(C===Rs.Hidden&&N.current){if(O&&M!=="visible"){I("visible");return}return ln(M,{hidden:()=>L(N),visible:()=>R(N)})}},[M,N,R,L,O,C]);let F=fg();Ir(()=>{if(w&&F&&M==="visible"&&N.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[N,M,F,w]);let V=A&&!D,H=D&&O&&A,$=m.useRef(!1),z=ZM(()=>{$.current||(I("hidden"),L(N))},T),W=et(re=>{$.current=!0;let pe=re?"enter":"leave";z.onStart(N,pe,te=>{te==="enter"?o?.():te==="leave"&&l?.()})}),U=et(re=>{let pe=re?"enter":"leave";$.current=!1,z.onStop(N,pe,te=>{te==="enter"?s?.():te==="leave"&&c?.()}),pe==="leave"&&!hg(z)&&(I("hidden"),L(N))});m.useEffect(()=>{w&&a||(W(O),U(O))},[O,w,a]);let X=!(!a||!w||!F||V),[,Y]=Af(X,v,O,{start:W,end:U}),ae=Ms({ref:E,className:((n=ww(y.className,H&&u,H&&d,Y.enter&&u,Y.enter&&Y.closed&&d,Y.enter&&!Y.closed&&f,Y.leave&&h,Y.leave&&!Y.closed&&g,Y.leave&&Y.closed&&b,!Y.transition&&O&&p))==null?void 0:n.trim())||void 0,...Pf(Y)}),G=0;M==="visible"&&(G|=zr.Open),M==="hidden"&&(G|=zr.Closed),O&&M==="hidden"&&(G|=zr.Opening),!O&&M==="visible"&&(G|=zr.Closing);let ee=pr();return x.createElement(pg.Provider,{value:z},x.createElement(ug,{value:G},ee({ourProps:ae,theirProps:y,defaultTag:JM,features:QM,visible:M==="visible",name:"Transition.Child"})))}function Mz(e,t){let{show:r,appear:n=!1,unmount:a=!0,...o}=e,s=m.useRef(null),l=GM(e),c=Ur(...l?[s,t]:t===null?[]:[t]);fg();let u=ci();if(r===void 0&&u!==null&&(r=(u&zr.Open)===zr.Open),r===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[d,f]=m.useState(r?"visible":"hidden"),p=ZM(()=>{r||f("hidden")}),[h,g]=m.useState(!0),b=m.useRef([r]);Ir(()=>{h!==!1&&b.current[b.current.length-1]!==r&&(b.current.push(r),g(!1))},[b,r]);let y=m.useMemo(()=>({show:r,appear:n,initial:h}),[r,n,h]);Ir(()=>{r?f("visible"):!hg(p)&&s.current!==null&&f("hidden")},[r,p]);let v={unmount:a},k=et(()=>{var E;h&&g(!1),(E=e.beforeEnter)==null||E.call(e)}),N=et(()=>{var E;h&&g(!1),(E=e.beforeLeave)==null||E.call(e)}),w=pr();return x.createElement(pg.Provider,{value:p},x.createElement(mg.Provider,{value:y},w({ourProps:{...v,as:m.Fragment,children:x.createElement(e8,{ref:c,...v,...o,beforeEnter:k,beforeLeave:N})},theirProps:{},defaultTag:m.Fragment,features:QM,visible:d==="visible",name:"Transition"})))}function Tz(e,t){let r=m.useContext(mg)!==null,n=ci()!==null;return x.createElement(x.Fragment,null,!r&&n?x.createElement(Aw,{ref:t,...e}):x.createElement(e8,{ref:t,...e}))}let Aw=sr(Mz),e8=sr(Az),sN=sr(Tz),Mw=Object.assign(Aw,{Child:sN,Root:Aw});var _z=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(_z||{}),Iz=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Iz||{});let Dz={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},iN=m.createContext(null);iN.displayName="DialogContext";function gg(e){let t=m.useContext(iN);if(t===null){let r=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,gg),r}return t}function Lz(e,t){return ln(t.type,Dz,e,t)}let e5=sr(function(e,t){let r=m.useId(),{id:n=`headlessui-dialog-${r}`,open:a,onClose:o,initialFocus:s,role:l="dialog",autoFocus:c=!0,__demoMode:u=!1,unmount:d=!1,...f}=e,p=m.useRef(!1);l=function(){return l==="dialog"||l==="alertdialog"?l:(p.current||(p.current=!0,console.warn(`Invalid role [${l}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let h=ci();a===void 0&&h!==null&&(a=(h&zr.Open)===zr.Open);let g=m.useRef(null),b=Ur(g,t),y=nl(g.current),v=a?0:1,[k,N]=m.useReducer(Lz,{titleId:null,descriptionId:null,panelRef:m.createRef()}),w=et(()=>o(!1)),E=et(Y=>N({type:0,id:Y})),C=fg()?v===0:!1,[O,D]=UM(),A={get current(){var Y;return(Y=k.panelRef.current)!=null?Y:g.current}},M=nN(),{resolveContainers:I}=WM({mainTreeNode:M,portals:O,defaultContainers:[A]}),T=h!==null?(h&zr.Closing)===zr.Closing:!1;uM(u||T?!1:C,{allowed:et(()=>{var Y,ae;return[(ae=(Y=g.current)==null?void 0:Y.closest("[data-headlessui-portal]"))!=null?ae:null]}),disallowed:et(()=>{var Y;return[(Y=M?.closest("body > *:not(#headlessui-portal-root)"))!=null?Y:null]})});let R=Sf.get(null);Ir(()=>{if(C)return R.actions.push(n),()=>R.actions.pop(n)},[R,n,C]);let L=jn(R,m.useCallback(Y=>R.selectors.isTop(Y,n),[R,n]));$j(L,I,Y=>{Y.preventDefault(),w()}),gz(L,y?.defaultView,Y=>{Y.preventDefault(),Y.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),w()}),Hj(u||T?!1:C,y,I),Fj(C,g,w);let[F,V]=Ij(),H=m.useMemo(()=>[{dialogState:v,close:w,setTitleId:E,unmount:d},k],[v,w,E,d,k]),$=yn({open:v===0}),z={ref:b,id:n,role:l,tabIndex:-1,"aria-modal":u?void 0:v===0?!0:void 0,"aria-labelledby":k.titleId,"aria-describedby":F,unmount:d},W=!bz(),U=Li.None;C&&!u&&(U|=Li.RestoreFocus,U|=Li.TabLock,c&&(U|=Li.AutoFocus),W&&(U|=Li.InitialFocus));let X=pr();return x.createElement(tN,null,x.createElement(QS,{force:!0},x.createElement(rN,null,x.createElement(iN.Provider,{value:H},x.createElement(qM,{target:g},x.createElement(QS,{force:!1},x.createElement(V,{slot:$},x.createElement(D,null,x.createElement(wz,{initialFocus:s,initialFocusFallback:g,containers:I,features:U},x.createElement(eg,{value:w},X({ourProps:z,theirProps:f,slot:$,defaultTag:Rz,features:Fz,visible:v===0,name:"Dialog"})))))))))))}),Rz="div",Fz=Aa.RenderStrategy|Aa.Static;function $z(e,t){let{transition:r=!1,open:n,...a}=e,o=ci(),s=e.hasOwnProperty("open")||o!==null,l=e.hasOwnProperty("onClose");if(!s&&!l)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!s)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!l)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!o&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(n!==void 0||r)&&!a.static?x.createElement(Cp,null,x.createElement(Mw,{show:n,transition:r,unmount:a.unmount},x.createElement(e5,{ref:t,...a}))):x.createElement(Cp,null,x.createElement(e5,{ref:t,open:n,...a}))}let Bz="div";function Hz(e,t){let r=m.useId(),{id:n=`headlessui-dialog-panel-${r}`,transition:a=!1,...o}=e,[{dialogState:s,unmount:l},c]=gg("Dialog.Panel"),u=Ur(t,c.panelRef),d=yn({open:s===0}),f=et(y=>{y.stopPropagation()}),p={ref:u,id:n,onClick:f},h=a?sN:m.Fragment,g=a?{unmount:l}:{},b=pr();return x.createElement(h,{...g},b({ourProps:p,theirProps:o,slot:d,defaultTag:Bz,name:"Dialog.Panel"}))}let zz="div";function Uz(e,t){let{transition:r=!1,...n}=e,[{dialogState:a,unmount:o}]=gg("Dialog.Backdrop"),s=yn({open:a===0}),l={ref:t,"aria-hidden":!0},c=r?sN:m.Fragment,u=r?{unmount:o}:{},d=pr();return x.createElement(c,{...u},d({ourProps:l,theirProps:n,slot:s,defaultTag:zz,name:"Dialog.Backdrop"}))}let qz="h2";function Vz(e,t){let r=m.useId(),{id:n=`headlessui-dialog-title-${r}`,...a}=e,[{dialogState:o,setTitleId:s}]=gg("Dialog.Title"),l=Ur(t);m.useEffect(()=>(s(n),()=>s(null)),[n,s]);let c=yn({open:o===0}),u={ref:l,id:n};return pr()({ourProps:u,theirProps:a,slot:c,defaultTag:qz,name:"Dialog.Title"})}let Wz=sr($z),Kz=sr(Hz);sr(Uz);let Yz=sr(Vz),Cm=Object.assign(Wz,{Panel:Kz,Title:Yz,Description:eM});var t5;let Xz=(t5=x.startTransition)!=null?t5:function(e){e()};var Gz=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Gz||{}),Zz=(e=>(e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.SetButtonElement=4]="SetButtonElement",e[e.SetPanelElement=5]="SetPanelElement",e))(Zz||{});let Jz={0:e=>({...e,disclosureState:ln(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},2(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},3(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}},4(e,t){return e.buttonElement===t.element?e:{...e,buttonElement:t.element}},5(e,t){return e.panelElement===t.element?e:{...e,panelElement:t.element}}},lN=m.createContext(null);lN.displayName="DisclosureContext";function cN(e){let t=m.useContext(lN);if(t===null){let r=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,cN),r}return t}let uN=m.createContext(null);uN.displayName="DisclosureAPIContext";function t8(e){let t=m.useContext(uN);if(t===null){let r=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,t8),r}return t}let dN=m.createContext(null);dN.displayName="DisclosurePanelContext";function Qz(){return m.useContext(dN)}function eU(e,t){return ln(t.type,Jz,e,t)}let tU=m.Fragment;function rU(e,t){let{defaultOpen:r=!1,...n}=e,a=m.useRef(null),o=Ur(t,_j(b=>{a.current=b},e.as===void 0||tc(e.as))),s=m.useReducer(eU,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:l,buttonId:c},u]=s,d=et(b=>{u({type:1});let y=ds(a.current);if(!y||!c)return;(b?ma(b)?b:"current"in b&&ma(b.current)?b.current:y.getElementById(c):y.getElementById(c))?.focus()}),f=m.useMemo(()=>({close:d}),[d]),p=yn({open:l===0,close:d}),h={ref:o},g=pr();return x.createElement(lN.Provider,{value:s},x.createElement(uN.Provider,{value:f},x.createElement(eg,{value:d},x.createElement(ug,{value:ln(l,{0:zr.Open,1:zr.Closed})},g({ourProps:h,theirProps:n,slot:p,defaultTag:tU,name:"Disclosure"})))))}let nU="button";function aU(e,t){let r=m.useId(),{id:n=`headlessui-disclosure-button-${r}`,disabled:a=!1,autoFocus:o=!1,...s}=e,[l,c]=cN("Disclosure.Button"),u=Qz(),d=u===null?!1:u===l.panelId,f=m.useRef(null),p=Ur(f,t,et(A=>{if(!d)return c({type:4,element:A})}));m.useEffect(()=>{if(!d)return c({type:2,buttonId:n}),()=>{c({type:2,buttonId:null})}},[n,c,d]);let h=et(A=>{var M;if(d){if(l.disclosureState===1)return;switch(A.key){case nr.Space:case nr.Enter:A.preventDefault(),A.stopPropagation(),c({type:0}),(M=l.buttonElement)==null||M.focus();break}}else switch(A.key){case nr.Space:case nr.Enter:A.preventDefault(),A.stopPropagation(),c({type:0});break}}),g=et(A=>{A.key===nr.Space&&A.preventDefault()}),b=et(A=>{var M;pc(A.currentTarget)||a||(d?(c({type:0}),(M=l.buttonElement)==null||M.focus()):c({type:0}))}),{isFocusVisible:y,focusProps:v}=Da({autoFocus:o}),{isHovered:k,hoverProps:N}=Za({isDisabled:a}),{pressed:w,pressProps:E}=Zh({disabled:a}),C=yn({open:l.disclosureState===0,hover:k,active:w,disabled:a,focus:y,autofocus:o}),O=ng(e,l.buttonElement),D=tu(d?{ref:p,type:O,disabled:a||void 0,autoFocus:o,onKeyDown:h,onClick:b}:{ref:p,id:n,type:O,"aria-expanded":l.disclosureState===0,"aria-controls":l.panelElement?l.panelId:void 0,disabled:a||void 0,autoFocus:o,onKeyDown:h,onKeyUp:g,onClick:b},v,N,E);return pr()({ourProps:D,theirProps:s,slot:C,defaultTag:nU,name:"Disclosure.Button"})}let oU="div",sU=Aa.RenderStrategy|Aa.Static;function iU(e,t){let r=m.useId(),{id:n=`headlessui-disclosure-panel-${r}`,transition:a=!1,...o}=e,[s,l]=cN("Disclosure.Panel"),{close:c}=t8("Disclosure.Panel"),[u,d]=m.useState(null),f=Ur(t,et(k=>{Xz(()=>l({type:5,element:k}))}),d);m.useEffect(()=>(l({type:3,panelId:n}),()=>{l({type:3,panelId:null})}),[n,l]);let p=ci(),[h,g]=Af(a,u,p!==null?(p&zr.Open)===zr.Open:s.disclosureState===0),b=yn({open:s.disclosureState===0,close:c}),y={ref:f,id:n,...Pf(g)},v=pr();return x.createElement(tN,null,x.createElement(dN.Provider,{value:s.panelId},v({ourProps:y,theirProps:o,slot:b,defaultTag:oU,features:sU,visible:h,name:"Disclosure.Panel"})))}let lU=sr(rU),cU=sr(aU),uU=sr(iU),xy=Object.assign(lU,{Button:cU,Panel:uU}),r5=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function n5(e){var t,r;let n=(t=e.innerText)!=null?t:"",a=e.cloneNode(!0);if(!_n(a))return n;let o=!1;for(let l of a.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))l.remove(),o=!0;let s=o?(r=a.innerText)!=null?r:"":n;return r5.test(s)&&(s=s.replace(r5,"")),s}function dU(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let r=e.getAttribute("aria-labelledby");if(r){let n=r.split(" ").map(a=>{let o=document.getElementById(a);if(o){let s=o.getAttribute("aria-label");return typeof s=="string"?s.trim():n5(o).trim()}return null}).filter(Boolean);if(n.length>0)return n.join(", ")}return n5(e).trim()}function fU(e){let t=m.useRef(""),r=m.useRef("");return et(()=>{let n=e.current;if(!n)return"";let a=n.innerText;if(t.current===a)return r.current;let o=dU(n).trim().toLowerCase();return t.current=a,r.current=o,o})}var mU=Object.defineProperty,pU=(e,t,r)=>t in e?mU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,a5=(e,t,r)=>(pU(e,typeof t!="symbol"?t+"":t,r),r),An=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(An||{}),Op=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Op||{}),Or=(e=>(e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItems=5]="RegisterItems",e[e.UnregisterItems=6]="UnregisterItems",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetItemsElement=8]="SetItemsElement",e[e.SortItems=9]="SortItems",e[e.MarkButtonAsMoved=10]="MarkButtonAsMoved",e))(Or||{});function o5(e,t=r=>r){let r=e.activeItemIndex!==null?e.items[e.activeItemIndex]:null,n=fM(t(e.items.slice()),o=>o.dataRef.current.domRef.current),a=r?n.indexOf(r):null;return a===-1&&(a=null),{items:n,activeItemIndex:a}}let hU={1(e){if(e.menuState===1)return e;let t=e.buttonElement?ap.Tracked(VM(e.buttonElement)):e.buttonPositionState;return{...e,activeItemIndex:null,pendingFocus:{focus:nn.Nothing},menuState:1,buttonPositionState:t}},0(e,t){return e.menuState===0?e:{...e,__demoMode:!1,pendingFocus:t.focus,menuState:0,buttonPositionState:ap.Idle}},2:(e,t)=>{var r,n,a,o,s;if(e.menuState===1)return e;let l={...e,searchQuery:"",activationTrigger:(r=t.trigger)!=null?r:1,__demoMode:!1};if(t.focus===nn.Nothing)return{...l,activeItemIndex:null};if(t.focus===nn.Specific)return{...l,activeItemIndex:e.items.findIndex(d=>d.id===t.id)};if(t.focus===nn.Previous){let d=e.activeItemIndex;if(d!==null){let f=e.items[d].dataRef.current.domRef,p=Sm(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:h=>h.id,resolveDisabled:h=>h.dataRef.current.disabled});if(p!==null){let h=e.items[p].dataRef.current.domRef;if(((n=f.current)==null?void 0:n.previousElementSibling)===h.current||((a=h.current)==null?void 0:a.previousElementSibling)===null)return{...l,activeItemIndex:p}}}}else if(t.focus===nn.Next){let d=e.activeItemIndex;if(d!==null){let f=e.items[d].dataRef.current.domRef,p=Sm(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:h=>h.id,resolveDisabled:h=>h.dataRef.current.disabled});if(p!==null){let h=e.items[p].dataRef.current.domRef;if(((o=f.current)==null?void 0:o.nextElementSibling)===h.current||((s=h.current)==null?void 0:s.nextElementSibling)===null)return{...l,activeItemIndex:p}}}}let c=o5(e),u=Sm(t,{resolveItems:()=>c.items,resolveActiveIndex:()=>c.activeItemIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});return{...l,...c,activeItemIndex:u}},3:(e,t)=>{let r=e.searchQuery!==""?0:1,n=e.searchQuery+t.value.toLowerCase(),a=(e.activeItemIndex!==null?e.items.slice(e.activeItemIndex+r).concat(e.items.slice(0,e.activeItemIndex+r)):e.items).find(s=>{var l;return((l=s.dataRef.current.textValue)==null?void 0:l.startsWith(n))&&!s.dataRef.current.disabled}),o=a?e.items.indexOf(a):-1;return o===-1||o===e.activeItemIndex?{...e,searchQuery:n}:{...e,searchQuery:n,activeItemIndex:o,activationTrigger:1}},4(e){return e.searchQuery===""?e:{...e,searchQuery:"",searchActiveItemIndex:null}},5:(e,t)=>{let r=e.items.concat(t.items.map(a=>a)),n=e.activeItemIndex;return e.pendingFocus.focus!==nn.Nothing&&(n=Sm(e.pendingFocus,{resolveItems:()=>r,resolveActiveIndex:()=>e.activeItemIndex,resolveId:a=>a.id,resolveDisabled:a=>a.dataRef.current.disabled})),{...e,items:r,activeItemIndex:n,pendingFocus:{focus:nn.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let r=e.items,n=[],a=new Set(t.items);for(let[o,s]of r.entries())if(a.has(s.id)&&(n.push(o),a.delete(s.id),a.size===0))break;if(n.length>0){r=r.slice();for(let o of n.reverse())r.splice(o,1)}return{...e,items:r,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.itemsElement===t.element?e:{...e,itemsElement:t.element},9:e=>e.pendingShouldSort?{...e,...o5(e),pendingShouldSort:!1}:e,10(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:ap.Moved}}},gU=class r8 extends Rj{constructor(t){super(t),a5(this,"actions",{registerItem:kS(()=>{let r=[],n=new Set;return[(a,o)=>{n.has(o)||(n.add(o),r.push({id:a,dataRef:o}))},()=>(n.clear(),this.send({type:5,items:r.splice(0)}))]}),unregisterItem:kS(()=>{let r=[];return[n=>r.push(n),()=>this.send({type:6,items:r.splice(0)})]})}),a5(this,"selectors",{activeDescendantId(r){var n;let a=r.activeItemIndex,o=r.items;return a===null||(n=o[a])==null?void 0:n.id},isActive(r,n){var a;let o=r.activeItemIndex,s=r.items;return o!==null?((a=s[o])==null?void 0:a.id)===n:!1},shouldScrollIntoView(r,n){return r.__demoMode||r.menuState!==0||r.activationTrigger===0?!1:this.isActive(r,n)},didButtonMove(r){return r.buttonPositionState.kind==="Moved"}}),this.on(5,()=>{this.disposables.requestAnimationFrame(()=>{this.send({type:9})})});{let r=this.state.id,n=Sf.get(null);this.disposables.add(n.on(lM.Push,a=>{!n.selectors.isTop(a,r)&&this.state.menuState===0&&this.send({type:1})})),this.on(0,()=>n.actions.push(r)),this.on(1,()=>n.actions.pop(r))}this.disposables.group(r=>{this.on(1,n=>{n.buttonElement&&(r.dispose(),r.add(hz(n.buttonElement,n.buttonPositionState,()=>{this.send({type:10})})))})})}static new({id:t,__demoMode:r=!1}){return new r8({id:t,__demoMode:r,menuState:r?0:1,buttonElement:null,itemsElement:null,items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1,pendingShouldSort:!1,pendingFocus:{focus:nn.Nothing},buttonPositionState:ap.Idle})}reduce(t,r){return ln(r.type,hU,t,r)}};const n8=m.createContext(null);function fN(e){let t=m.useContext(n8);if(t===null){let r=new Error(`<${e} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,a8),r}return t}function a8({id:e,__demoMode:t=!1}){let r=m.useMemo(()=>gU.new({id:e,__demoMode:t}),[]);return dg(()=>r.dispose()),r}let bU=m.Fragment;function yU(e,t){let r=m.useId(),{__demoMode:n=!1,...a}=e,o=a8({id:r,__demoMode:n}),[s,l,c]=jn(o,y=>[y.menuState,y.itemsElement,y.buttonElement]),u=Ur(t),d=Sf.get(null),f=jn(d,m.useCallback(y=>d.selectors.isTop(y,r),[d,r]));$j(f,[c,l],(y,v)=>{var k;o.send({type:Or.CloseMenu}),rg(v,tg.Loose)||(y.preventDefault(),(k=o.state.buttonElement)==null||k.focus())});let p=et(()=>{o.send({type:Or.CloseMenu})}),h=yn({open:s===An.Open,close:p}),g={ref:u},b=pr();return x.createElement(FM,null,x.createElement(n8.Provider,{value:o},x.createElement(ug,{value:ln(s,{[An.Open]:zr.Open,[An.Closed]:zr.Closed})},b({ourProps:g,theirProps:a,slot:h,defaultTag:bU,name:"Menu"}))))}let xU="button";function vU(e,t){let r=fN("Menu.Button"),n=m.useId(),{id:a=`headlessui-menu-button-${n}`,disabled:o=!1,autoFocus:s=!1,...l}=e,c=m.useRef(null),u=nz(),d=Ur(t,c,DM(),et(M=>r.send({type:Or.SetButtonElement,element:M}))),f=et(M=>{switch(M.key){case nr.Space:case nr.Enter:case nr.ArrowDown:M.preventDefault(),M.stopPropagation(),r.send({type:Or.OpenMenu,focus:{focus:nn.First}});break;case nr.ArrowUp:M.preventDefault(),M.stopPropagation(),r.send({type:Or.OpenMenu,focus:{focus:nn.Last}});break}}),p=et(M=>{M.key===nr.Space&&M.preventDefault()}),[h,g,b]=jn(r,M=>[M.menuState,M.buttonElement,M.itemsElement]),y=h===An.Open;EB(y,{trigger:g,action:m.useCallback(M=>{if(g!=null&&g.contains(M.target))return Nm.Ignore;let I=M.target.closest('[role="menuitem"]:not([data-disabled])');return _n(I)?Nm.Select(I):b!=null&&b.contains(M.target)?Nm.Ignore:Nm.Close},[g,b]),close:m.useCallback(()=>r.send({type:Or.CloseMenu}),[]),select:m.useCallback(M=>M.click(),[])});let v=rB(M=>{var I;o||(h===An.Open?(Qt.flushSync(()=>r.send({type:Or.CloseMenu})),(I=c.current)==null||I.focus({preventScroll:!0})):(M.preventDefault(),r.send({type:Or.OpenMenu,focus:{focus:nn.Nothing},trigger:Op.Pointer})))}),{isFocusVisible:k,focusProps:N}=Da({autoFocus:s}),{isHovered:w,hoverProps:E}=Za({isDisabled:o}),{pressed:C,pressProps:O}=Zh({disabled:o}),D=yn({open:h===An.Open,active:C||h===An.Open,disabled:o,hover:w,focus:k,autofocus:s}),A=tu(u(),{ref:d,id:a,type:ng(e,c.current),"aria-haspopup":"menu","aria-controls":b?.id,"aria-expanded":h===An.Open,disabled:o||void 0,autoFocus:s,onKeyDown:f,onKeyUp:p},v,N,E,O);return pr()({ourProps:A,theirProps:l,slot:D,defaultTag:xU,name:"Menu.Button"})}let kU="div",wU=Aa.RenderStrategy|Aa.Static;function jU(e,t){let r=m.useId(),{id:n=`headlessui-menu-items-${r}`,anchor:a,portal:o=!1,modal:s=!0,transition:l=!1,...c}=e,u=IM(a),d=fN("Menu.Items"),[f,p]=RM(u),h=LM(),[g,b]=m.useState(null),y=Ur(t,u?f:null,et($=>d.send({type:Or.SetItemsElement,element:$})),b),[v,k]=jn(d,$=>[$.menuState,$.buttonElement]),N=nl(k),w=nl(g);u&&(o=!0);let E=ci(),[C,O]=Af(l,g,E!==null?(E&zr.Open)===zr.Open:v===An.Open);Fj(C,k,()=>{d.send({type:Or.CloseMenu})});let D=jn(d,$=>$.__demoMode),A=D?!1:s&&v===An.Open;Hj(A,w);let M=D?!1:s&&v===An.Open;uM(M,{allowed:m.useCallback(()=>[k,g],[k,g])});let I=jn(d,d.selectors.didButtonMove)?!1:C;m.useEffect(()=>{let $=g;$&&v===An.Open&&(U9($)||$.focus({preventScroll:!0}))},[v,g]),$B(v===An.Open,{container:g,accept($){return $.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:$.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk($){$.setAttribute("role","none")}});let T=fs(),R=et($=>{var z,W,U;switch(T.dispose(),$.key){case nr.Space:if(d.state.searchQuery!=="")return $.preventDefault(),$.stopPropagation(),d.send({type:Or.Search,value:$.key});case nr.Enter:if($.preventDefault(),$.stopPropagation(),d.state.activeItemIndex!==null){let{dataRef:X}=d.state.items[d.state.activeItemIndex];(W=(z=X.current)==null?void 0:z.domRef.current)==null||W.click()}d.send({type:Or.CloseMenu}),dM(d.state.buttonElement);break;case nr.ArrowDown:return $.preventDefault(),$.stopPropagation(),d.send({type:Or.GoToItem,focus:nn.Next});case nr.ArrowUp:return $.preventDefault(),$.stopPropagation(),d.send({type:Or.GoToItem,focus:nn.Previous});case nr.Home:case nr.PageUp:return $.preventDefault(),$.stopPropagation(),d.send({type:Or.GoToItem,focus:nn.First});case nr.End:case nr.PageDown:return $.preventDefault(),$.stopPropagation(),d.send({type:Or.GoToItem,focus:nn.Last});case nr.Escape:$.preventDefault(),$.stopPropagation(),Qt.flushSync(()=>d.send({type:Or.CloseMenu})),(U=d.state.buttonElement)==null||U.focus({preventScroll:!0});break;case nr.Tab:$.preventDefault(),$.stopPropagation(),Qt.flushSync(()=>d.send({type:Or.CloseMenu})),vB(d.state.buttonElement,$.shiftKey?hn.Previous:hn.Next);break;default:$.key.length===1&&(d.send({type:Or.Search,value:$.key}),T.setTimeout(()=>d.send({type:Or.ClearSearch}),350));break}}),L=et($=>{$.key===nr.Space&&$.preventDefault()}),F=yn({open:v===An.Open}),V=tu(u?h():{},{"aria-activedescendant":jn(d,d.selectors.activeDescendantId),"aria-labelledby":jn(d,$=>{var z;return(z=$.buttonElement)==null?void 0:z.id}),id:n,onKeyDown:R,onKeyUp:L,role:"menu",tabIndex:v===An.Open?0:void 0,ref:y,style:{...c.style,...p,"--button-width":nM(C,k,!0).width},...Pf(O)}),H=pr();return x.createElement(rN,{enabled:o?e.static||C:!1,ownerDocument:N},H({ourProps:V,theirProps:c,slot:F,defaultTag:kU,features:wU,visible:I,name:"Menu.Items"}))}let NU=m.Fragment;function EU(e,t){let r=m.useId(),{id:n=`headlessui-menu-item-${r}`,disabled:a=!1,...o}=e,s=fN("Menu.Item"),l=jn(s,I=>s.selectors.isActive(I,n)),c=m.useRef(null),u=Ur(t,c),d=jn(s,I=>s.selectors.shouldScrollIntoView(I,n));Ir(()=>{if(d)return Jn().requestAnimationFrame(()=>{var I,T;(T=(I=c.current)==null?void 0:I.scrollIntoView)==null||T.call(I,{block:"nearest"})})},[d,c]);let f=fU(c),p=m.useRef({disabled:a,domRef:c,get textValue(){return f()}});Ir(()=>{p.current.disabled=a},[p,a]),Ir(()=>(s.actions.registerItem(n,p),()=>s.actions.unregisterItem(n)),[p,n]);let h=et(()=>{s.send({type:Or.CloseMenu})}),g=et(I=>{if(a)return I.preventDefault();s.send({type:Or.CloseMenu}),dM(s.state.buttonElement)}),b=et(()=>{if(a)return s.send({type:Or.GoToItem,focus:nn.Nothing});s.send({type:Or.GoToItem,focus:nn.Specific,id:n})}),y=TB(),v=et(I=>y.update(I)),k=et(I=>{y.wasMoved(I)&&(a||l||s.send({type:Or.GoToItem,focus:nn.Specific,id:n,trigger:Op.Pointer}))}),N=et(I=>{y.wasMoved(I)&&(a||l&&s.state.activationTrigger===Op.Pointer&&s.send({type:Or.GoToItem,focus:nn.Nothing}))}),[w,E]=Lj(),[C,O]=Ij(),D=yn({active:l,focus:l,disabled:a,close:h}),A={id:n,ref:u,role:"menuitem",tabIndex:a===!0?void 0:-1,"aria-disabled":a===!0?!0:void 0,"aria-labelledby":w,"aria-describedby":C,disabled:void 0,onClick:g,onFocus:b,onPointerEnter:v,onMouseEnter:v,onPointerMove:k,onMouseMove:k,onPointerLeave:N,onMouseLeave:N},M=pr();return x.createElement(E,null,x.createElement(O,null,M({ourProps:A,theirProps:o,slot:D,defaultTag:NU,name:"Menu.Item"})))}let SU="div";function CU(e,t){let[r,n]=Lj(),a=e,o={ref:t,"aria-labelledby":r,role:"group"},s=pr();return x.createElement(n,null,s({ourProps:o,theirProps:a,slot:{},defaultTag:SU,name:"Menu.Section"}))}let OU="header";function PU(e,t){let r=m.useId(),{id:n=`headlessui-menu-heading-${r}`,...a}=e,o=Dj();Ir(()=>o.register(n),[n,o.register]);let s={id:n,ref:t,role:"presentation",...o.props};return pr()({ourProps:s,theirProps:a,slot:{},defaultTag:OU,name:"Menu.Heading"})}let AU="div";function MU(e,t){let r=e,n={ref:t,role:"separator"};return pr()({ourProps:n,theirProps:r,slot:{},defaultTag:AU,name:"Menu.Separator"})}let TU=sr(yU),Tw=sr(vU),_w=sr(jU),Bl=sr(EU),_U=sr(CU),IU=sr(PU),DU=sr(MU),s5=Object.assign(TU,{Button:Tw,Items:_w,Item:Bl,Section:_U,Heading:IU,Separator:DU});var LU=Object.defineProperty,RU=(e,t,r)=>t in e?LU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i5=(e,t,r)=>(RU(e,typeof t!="symbol"?t+"":t,r),r),an=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(an||{}),FU=(e=>(e[e.OpenPopover=0]="OpenPopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(FU||{});let $U={0:e=>e.popoverState===0?e:{...e,popoverState:0,__demoMode:!1},1(e){return e.popoverState===1?e:{...e,popoverState:1,__demoMode:!1}},2(e,t){return e.button===t.button?e:{...e,button:t.button}},3(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},4(e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},5(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},BU=class o8 extends Rj{constructor(t){super(t),i5(this,"actions",{close:()=>this.send({type:1}),refocusableClose:r=>{this.actions.close(),(r?_n(r)?r:"current"in r&&_n(r.current)?r.current:this.state.button:this.state.button)?.focus()},open:()=>this.send({type:0}),setButtonId:r=>this.send({type:3,buttonId:r}),setButton:r=>this.send({type:2,button:r}),setPanelId:r=>this.send({type:5,panelId:r}),setPanel:r=>this.send({type:4,panel:r})}),i5(this,"selectors",{isPortalled:r=>{var n;if(!r.button||!r.panel)return!1;let a=(n=ds(r.button))!=null?n:document;for(let f of a.querySelectorAll("body > *"))if(Number(f?.contains(r.button))^Number(f?.contains(r.panel)))return!0;let o=Of(a),s=o.indexOf(r.button),l=(s+o.length-1)%o.length,c=(s+1)%o.length,u=o[l],d=o[c];return!r.panel.contains(u)&&!r.panel.contains(d)}});{let r=this.state.id,n=Sf.get(null);this.on(0,()=>n.actions.push(r)),this.on(1,()=>n.actions.pop(r))}}static new({id:t,__demoMode:r=!1}){return new o8({id:t,__demoMode:r,popoverState:r?0:1,buttons:{current:[]},button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:{current:null},afterPanelSentinel:{current:null},afterButtonSentinel:{current:null}})}reduce(t,r){return ln(r.type,$U,t,r)}};const s8=m.createContext(null);function bg(e){let t=m.useContext(s8);if(t===null){let r=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,bg),r}return t}function HU({id:e,__demoMode:t=!1}){let r=m.useMemo(()=>BU.new({id:e,__demoMode:t}),[]);return dg(()=>r.dispose()),r}let mN=m.createContext(null);mN.displayName="PopoverGroupContext";function i8(){return m.useContext(mN)}let yg=m.createContext(null);yg.displayName="PopoverPanelContext";function zU(){return m.useContext(yg)}let UU="div";function qU(e,t){var r;let n=m.useId(),{__demoMode:a=!1,...o}=e,s=HU({id:n,__demoMode:a}),l=m.useRef(null),c=Ur(t,_j(L=>{l.current=L})),[u,d,f,p,h]=jn(s,m.useCallback(L=>[L.popoverState,L.button,L.panel,L.buttonId,L.panelId],[])),g=wB((r=l.current)!=null?r:d),b=es(p),y=es(h),v=m.useMemo(()=>({buttonId:b,panelId:y,close:s.actions.close}),[b,y,s]),k=i8(),N=k?.registerPopover,w=et(()=>{var L,F;let V=Zs((L=l.current)!=null?L:d);return(F=k?.isFocusWithinPopoverGroup())!=null?F:V&&(d?.contains(V)||f?.contains(V))});m.useEffect(()=>N?.(v),[N,v]);let[E,C]=UM(),O=nN(d),D=WM({mainTreeNode:O,portals:E,defaultContainers:[{get current(){return s.state.button}},{get current(){return s.state.panel}}]});Bj(g,"focus",L=>{var F,V,H,$,z,W;L.target!==window&&ma(L.target)&&s.state.popoverState===an.Open&&(w()||s.state.button&&s.state.panel&&(D.contains(L.target)||(V=(F=s.state.beforePanelSentinel.current)==null?void 0:F.contains)!=null&&V.call(F,L.target)||($=(H=s.state.afterPanelSentinel.current)==null?void 0:H.contains)!=null&&$.call(H,L.target)||(W=(z=s.state.afterButtonSentinel.current)==null?void 0:z.contains)!=null&&W.call(z,L.target)||s.actions.close()))},!0);let A=u===an.Open;$j(A,D.resolveContainers,(L,F)=>{s.actions.close(),rg(F,tg.Loose)||(L.preventDefault(),d?.focus())});let M=yn({open:u===an.Open,close:s.actions.refocusableClose}),I=jn(s,m.useCallback(L=>ln(L.popoverState,{[an.Open]:zr.Open,[an.Closed]:zr.Closed}),[])),T={ref:c},R=pr();return x.createElement(Cp,{node:O},x.createElement(FM,null,x.createElement(yg.Provider,{value:null},x.createElement(s8.Provider,{value:s},x.createElement(eg,{value:s.actions.refocusableClose},x.createElement(ug,{value:I},x.createElement(C,null,R({ourProps:T,theirProps:o,slot:M,defaultTag:UU,name:"Popover"}))))))))}let VU="button";function WU(e,t){let r=m.useId(),{id:n=`headlessui-popover-button-${r}`,disabled:a=!1,autoFocus:o=!1,...s}=e,l=bg("Popover.Button"),[c,u,d,f,p,h,g]=jn(l,m.useCallback(ae=>[ae.popoverState,l.selectors.isPortalled(ae),ae.button,ae.buttonId,ae.panel,ae.panelId,ae.afterButtonSentinel],[])),b=m.useRef(null),y=`headlessui-focus-sentinel-${m.useId()}`,v=i8(),k=v?.closeOthers,N=zU()!==null;m.useEffect(()=>{if(!N)return l.actions.setButtonId(n),()=>l.actions.setButtonId(null)},[N,n,l]);let[w]=m.useState(()=>Symbol()),E=Ur(b,t,DM(),et(ae=>{if(!N){if(ae)l.state.buttons.current.push(w);else{let G=l.state.buttons.current.indexOf(w);G!==-1&&l.state.buttons.current.splice(G,1)}l.state.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),ae&&l.actions.setButton(ae)}})),C=Ur(b,t),O=et(ae=>{var G,ee,re;if(N){if(l.state.popoverState===an.Closed)return;switch(ae.key){case nr.Space:case nr.Enter:ae.preventDefault(),(ee=(G=ae.target).click)==null||ee.call(G),l.actions.close(),(re=l.state.button)==null||re.focus();break}}else switch(ae.key){case nr.Space:case nr.Enter:ae.preventDefault(),ae.stopPropagation(),l.state.popoverState===an.Closed?(k?.(l.state.buttonId),l.actions.open()):l.actions.close();break;case nr.Escape:if(l.state.popoverState!==an.Open)return k?.(l.state.buttonId);if(!b.current)return;let pe=Zs(b.current);if(pe&&!b.current.contains(pe))return;ae.preventDefault(),ae.stopPropagation(),l.actions.close();break}}),D=et(ae=>{N||ae.key===nr.Space&&ae.preventDefault()}),A=et(ae=>{var G,ee;pc(ae.currentTarget)||a||(N?(l.actions.close(),(G=l.state.button)==null||G.focus()):(ae.preventDefault(),ae.stopPropagation(),l.state.popoverState===an.Closed?(k?.(l.state.buttonId),l.actions.open()):l.actions.close(),(ee=l.state.button)==null||ee.focus()))}),M=et(ae=>{ae.preventDefault(),ae.stopPropagation()}),{isFocusVisible:I,focusProps:T}=Da({autoFocus:o}),{isHovered:R,hoverProps:L}=Za({isDisabled:a}),{pressed:F,pressProps:V}=Zh({disabled:a}),H=c===an.Open,$=yn({open:H,active:F||H,disabled:a,hover:R,focus:I,autofocus:o}),z=ng(e,d),W=tu(N?{ref:C,type:z,onKeyDown:O,onClick:A,disabled:a||void 0,autoFocus:o}:{ref:E,id:f,type:z,"aria-expanded":c===an.Open,"aria-controls":p?h:void 0,disabled:a||void 0,autoFocus:o,onKeyDown:O,onKeyUp:D,onClick:A,onMouseDown:M},T,L,V),U=oN(),X=et(()=>{if(!_n(l.state.panel))return;let ae=l.state.panel;function G(){ln(U.current,{[ha.Forwards]:()=>pa(ae,hn.First),[ha.Backwards]:()=>pa(ae,hn.Last)})===hc.Error&&pa(Of(Gs(l.state.button)).filter(ee=>ee.dataset.headlessuiFocusGuard!=="true"),ln(U.current,{[ha.Forwards]:hn.Next,[ha.Backwards]:hn.Previous}),{relativeTo:l.state.button})}G()}),Y=pr();return x.createElement(x.Fragment,null,Y({ourProps:W,theirProps:s,slot:$,defaultTag:VU,name:"Popover.Button"}),H&&!N&&u&&x.createElement(Js,{id:y,ref:g,features:ts.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:X}))}let KU="div",YU=Aa.RenderStrategy|Aa.Static;function l8(e,t){let r=m.useId(),{id:n=`headlessui-popover-backdrop-${r}`,transition:a=!1,...o}=e,s=bg("Popover.Backdrop"),l=jn(s,m.useCallback(v=>v.popoverState,[])),[c,u]=m.useState(null),d=Ur(t,u),f=ci(),[p,h]=Af(a,c,f!==null?(f&zr.Open)===zr.Open:l===an.Open),g=et(v=>{if(pc(v.currentTarget))return v.preventDefault();s.actions.close()}),b=yn({open:l===an.Open}),y={ref:d,id:n,"aria-hidden":!0,onClick:g,...Pf(h)};return pr()({ourProps:y,theirProps:o,slot:b,defaultTag:KU,features:YU,visible:p,name:"Popover.Backdrop"})}let XU="div",GU=Aa.RenderStrategy|Aa.Static;function ZU(e,t){let r=m.useId(),{id:n=`headlessui-popover-panel-${r}`,focus:a=!1,anchor:o,portal:s=!1,modal:l=!1,transition:c=!1,...u}=e,d=bg("Popover.Panel"),f=jn(d,d.selectors.isPortalled),[p,h,g,b,y]=jn(d,m.useCallback(Y=>[Y.popoverState,Y.button,Y.__demoMode,Y.beforePanelSentinel,Y.afterPanelSentinel],[])),v=`headlessui-focus-sentinel-before-${r}`,k=`headlessui-focus-sentinel-after-${r}`,N=m.useRef(null),w=IM(o),[E,C]=RM(w),O=LM();w&&(s=!0);let[D,A]=m.useState(null),M=Ur(N,t,w?E:null,d.actions.setPanel,A),I=nl(h),T=nl(N.current);Ir(()=>(d.actions.setPanelId(n),()=>d.actions.setPanelId(null)),[n,d]);let R=ci(),[L,F]=Af(c,D,R!==null?(R&zr.Open)===zr.Open:p===an.Open);Fj(L,h,d.actions.close),Hj(g?!1:l&&L,T);let V=et(Y=>{var ae;switch(Y.key){case nr.Escape:if(d.state.popoverState!==an.Open||!N.current)return;let G=Zs(N.current);if(G&&!N.current.contains(G))return;Y.preventDefault(),Y.stopPropagation(),d.actions.close(),(ae=d.state.button)==null||ae.focus();break}});m.useEffect(()=>{var Y;e.static||p===an.Closed&&((Y=e.unmount)==null||Y)&&d.actions.setPanel(null)},[p,e.unmount,e.static,d]),m.useEffect(()=>{if(g||!a||p!==an.Open||!N.current)return;let Y=Zs(N.current);N.current.contains(Y)||pa(N.current,hn.First)},[g,a,N.current,p]);let H=yn({open:p===an.Open,close:d.actions.refocusableClose}),$=tu(w?O():{},{ref:M,id:n,onKeyDown:V,onBlur:a&&p===an.Open?Y=>{var ae,G,ee,re,pe;let te=Y.relatedTarget;te&&N.current&&((ae=N.current)!=null&&ae.contains(te)||(d.actions.close(),((ee=(G=b.current)==null?void 0:G.contains)!=null&&ee.call(G,te)||(pe=(re=y.current)==null?void 0:re.contains)!=null&&pe.call(re,te))&&te.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...u.style,...C,"--button-width":nM(L,h,!0).width},...Pf(F)}),z=oN(),W=et(()=>{let Y=N.current;if(!Y)return;function ae(){ln(z.current,{[ha.Forwards]:()=>{var G;pa(Y,hn.First)===hc.Error&&((G=d.state.afterPanelSentinel.current)==null||G.focus())},[ha.Backwards]:()=>{var G;(G=d.state.button)==null||G.focus({preventScroll:!0})}})}ae()}),U=et(()=>{let Y=N.current;if(!Y)return;function ae(){ln(z.current,{[ha.Forwards]:()=>{var G;if(!d.state.button)return;let ee=(G=Gs(d.state.button))!=null?G:document.body,re=Of(ee),pe=re.indexOf(d.state.button),te=re.slice(0,pe+1),se=[...re.slice(pe+1),...te];for(let ne of se.slice())if(ne.dataset.headlessuiFocusGuard==="true"||D!=null&&D.contains(ne)){let K=se.indexOf(ne);K!==-1&&se.splice(K,1)}pa(se,hn.First,{sorted:!1})},[ha.Backwards]:()=>{var G;pa(Y,hn.Previous)===hc.Error&&((G=d.state.button)==null||G.focus())}})}ae()}),X=pr();return x.createElement(tN,null,x.createElement(yg.Provider,{value:n},x.createElement(eg,{value:d.actions.refocusableClose},x.createElement(rN,{enabled:s?e.static||L:!1,ownerDocument:I},L&&f&&x.createElement(Js,{id:v,ref:b,features:ts.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:W}),X({ourProps:$,theirProps:u,slot:H,defaultTag:XU,features:GU,visible:L,name:"Popover.Panel"}),L&&f&&x.createElement(Js,{id:k,ref:y,features:ts.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:U})))))}let JU="div";function QU(e,t){let r=m.useRef(null),n=Ur(r,t),[a,o]=m.useState([]),s=et(b=>{o(y=>{let v=y.indexOf(b);if(v!==-1){let k=y.slice();return k.splice(v,1),k}return y})}),l=et(b=>(o(y=>[...y,b]),()=>s(b))),c=et(()=>{var b;let y=Gs(r.current);if(!y)return!1;let v=Zs(r.current);return(b=r.current)!=null&&b.contains(v)?!0:a.some(k=>{var N,w;return((N=y.getElementById(k.buttonId.current))==null?void 0:N.contains(v))||((w=y.getElementById(k.panelId.current))==null?void 0:w.contains(v))})}),u=et(b=>{for(let y of a)y.buttonId.current!==b&&y.close()}),d=m.useMemo(()=>({registerPopover:l,unregisterPopover:s,isFocusWithinPopoverGroup:c,closeOthers:u}),[l,s,c,u]),f=yn({}),p=e,h={ref:n},g=pr();return x.createElement(Cp,null,x.createElement(mN.Provider,{value:d},g({ourProps:h,theirProps:p,slot:f,defaultTag:JU,name:"Popover.Group"})))}let eq=sr(qU),tq=sr(WU),rq=sr(l8),nq=sr(l8),aq=sr(ZU),oq=sr(QU),vy=Object.assign(eq,{Button:tq,Backdrop:nq,Overlay:rq,Panel:aq,Group:oq}),pN=m.createContext(null);pN.displayName="GroupContext";let sq=m.Fragment;function iq(e){var t;let[r,n]=m.useState(null),[a,o]=Lj(),[s,l]=Ij(),c=m.useMemo(()=>({switch:r,setSwitch:n}),[r,n]),u={},d=e,f=pr();return x.createElement(l,{name:"Switch.Description",value:s},x.createElement(o,{name:"Switch.Label",value:a,props:{htmlFor:(t=c.switch)==null?void 0:t.id,onClick(p){r&&(jw(p.currentTarget)&&p.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},x.createElement(pN.Provider,{value:c},f({ourProps:u,theirProps:d,slot:{},defaultTag:sq,name:"Switch.Group"}))))}let lq="button";function cq(e,t){var r;let n=m.useId(),a=Y9(),o=Tj(),{id:s=a||`headlessui-switch-${n}`,disabled:l=o||!1,checked:c,defaultChecked:u,onChange:d,name:f,value:p,form:h,autoFocus:g=!1,...b}=e,y=m.useContext(pN),[v,k]=m.useState(null),N=m.useRef(null),w=Ur(N,t,y===null?null:y.setSwitch,k),E=v$(u),[C,O]=x$(c,d,E??!1),D=fs(),[A,M]=m.useState(!1),I=et(()=>{M(!0),O?.(!C),D.nextFrame(()=>{M(!1)})}),T=et(re=>{if(pc(re.currentTarget))return re.preventDefault();re.preventDefault(),I()}),R=et(re=>{re.key===nr.Space?(re.preventDefault(),I()):re.key===nr.Enter&&k$(re.currentTarget)}),L=et(re=>re.preventDefault()),F=tM(),V=D$(),{isFocusVisible:H,focusProps:$}=Da({autoFocus:g}),{isHovered:z,hoverProps:W}=Za({isDisabled:l}),{pressed:U,pressProps:X}=Zh({disabled:l}),Y=yn({checked:C,disabled:l,hover:z,focus:H,active:U,autofocus:g,changing:A}),ae=tu({id:s,ref:w,role:"switch",type:ng(e,v),tabIndex:e.tabIndex===-1?0:(r=e.tabIndex)!=null?r:0,"aria-checked":C,"aria-labelledby":F,"aria-describedby":V,disabled:l||void 0,autoFocus:g,onClick:T,onKeyUp:R,onKeyPress:L},$,W,X),G=m.useCallback(()=>{if(E!==void 0)return O?.(E)},[O,E]),ee=pr();return x.createElement(x.Fragment,null,f!=null&&x.createElement(C$,{disabled:l,data:{[f]:p||"on"},overrides:{type:"checkbox",checked:C},form:h,onReset:G}),ee({ourProps:ae,theirProps:b,slot:Y,defaultTag:lq,name:"Switch"}))}let uq=sr(cq),dq=iq,fq=z$,mq=eM,Tf=Object.assign(uq,{Group:dq,Label:fq,Description:mq});const on=({textToCopy:e,onCopy:t=()=>{},copiedTimeout:r=2500,showLabel:n=!0,labelText:a="Copy",copiedText:o="Copied"})=>{const[s,l]=m.useState(!1),c=f=>{f.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{l(!0),t(),setTimeout(()=>l(!1),r)}).catch(p=>{console.error("Failed to copy text:",p)})},u=()=>i.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4 align-middle",children:i.jsx("path",{fillRule:"evenodd",d:"M18.063 5.674a1 1 0 0 1 .263 1.39l-7.5 11a1 1 0 0 1-1.533.143l-4.5-4.5a1 1 0 1 1 1.414-1.414l3.647 3.647 6.82-10.003a1 1 0 0 1 1.39-.263Z",clipRule:"evenodd"})}),d=()=>i.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",className:"w-3 h-3",children:i.jsx("path",{d:"M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z",fill:"currentColor"})});return i.jsx("span",{className:"inline-flex items-center rounded font-sans text-xs font-normal leading-none tracking-normal text-token-text-secondary h-4",children:i.jsx("span",{"data-state":s?"copied":"closed",children:i.jsxs("button",{onClick:c,className:"inline-flex items-center justify-end gap-1 select-none py-1 cursor-pointer","aria-label":"Copy",children:[i.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center leading-none shrink-0",children:s?i.jsx(u,{}):i.jsx(d,{})}),n?i.jsx("span",{className:"whitespace-nowrap text-left",children:s?o:a}):null]})})})},l5=e=>e.replace(/\/+$/,"");class pq{constructor(t={}){this.apiEndpoint=l5(t.apiEndpoint||"/api"),this.defaultHeaders={"inspectr-client":"inspectr-app",...t.headers},this.jsonHeaders={...this.defaultHeaders,"Content-Type":"application/json"},this.registration=new hq(this),this.auth=new gq(this),this.operations=new xq(this),this.service=new vq(this),this.stats=new kq(this),this.mock=new jq(this),this.mcp=new bq(this),this.rules=new Nq(this),this.traces=new wq(this),this.connectors=new Eq(this),this.expose=new yq(this)}configure(t={}){t.apiEndpoint&&(this.apiEndpoint=l5(t.apiEndpoint)),t.headers&&(this.defaultHeaders={...this.defaultHeaders,...t.headers},this.jsonHeaders={...this.defaultHeaders,"Content-Type":"application/json"})}}class hq{constructor(t){this.client=t}async register(t){const r=await fetch(`${this.client.apiEndpoint}/register`,{method:"POST",headers:this.client.jsonHeaders,body:JSON.stringify(t)});if(!r.ok)throw new Error(`Registration failed (${r.status})`);return await r.json()}async getConfig(){const t=await fetch("/app/config");if(!t.ok)throw new Error(`Config load failed (${t.status})`);return await t.json()}}class gq{constructor(t){this.client=t}async getAuthenticationSettings(){const t=await fetch(`${this.client.apiEndpoint}/auth/settings`,{headers:this.client.defaultHeaders});if(!t.ok)throw new Error(`Authentication settings failed (${t.status})`);return await t.json()}async updateAuthenticationSettings(t){const r=await fetch(`${this.client.apiEndpoint}/auth/settings`,{method:"PATCH",headers:this.client.jsonHeaders,body:JSON.stringify(t)});if(!r.ok)throw new Error(`Update authentication settings failed (${r.status})`);return await r.json()}}class bq{constructor(t){this.client=t}async getMCPServerSettings(){const t=await fetch(`${this.client.apiEndpoint}/mcp/settings`,{headers:this.client.defaultHeaders});if(!t.ok)throw new Error(`MCP Server settings failed (${t.status})`);return await t.json()}async updateMCPServerSettings(t){const r=await fetch(`${this.client.apiEndpoint}/mcp/settings`,{method:"PATCH",headers:this.client.jsonHeaders,body:JSON.stringify(t)});if(!r.ok)throw new Error(`Update MCP Server settings failed (${r.status})`);return await r.json()}async updateAuthenticationSettings(t){return console.warn("[Inspectr SDK] mcp.updateAuthenticationSettings is deprecated. Use updateMCPServerSettings instead."),this.updateMCPServerSettings(t)}}class yq{constructor(t){this.client=t}async handleResponse(t,r){let n=null;try{n=await t.json()}catch{n=null}if(!t.ok){const a=n?.error||n?.message||`${r} (${t.status})`,o=new Error(a);throw o.status=t.status,o.payload=n,o}return n}async getExposeSettings(){const t=await fetch(`${this.client.apiEndpoint}/expose/settings`,{headers:this.client.defaultHeaders});return await this.handleResponse(t,"Expose settings failed")}async putExposeSettings(t){const r=await fetch(`${this.client.apiEndpoint}/expose/settings`,{method:"PUT",headers:this.client.jsonHeaders,body:JSON.stringify(t)});return await this.handleResponse(r,"Expose settings update failed")}}class xq{constructor(t){this.client=t}async getOperation(t){const r=await fetch(`${this.client.apiEndpoint}/operations/${t}`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!r.ok){const n=await r.json().catch(()=>({})),a=n?.error||n?.message||`Get ${t} failed (${r.status})`,o=new Error(a);throw o.status=r.status,o.body=n,o}return await r.json()}async deleteAll(){const t=await fetch(`${this.client.apiEndpoint}/operations`,{method:"DELETE",headers:this.client.defaultHeaders});if(!t.ok)throw new Error(`Delete all failed (${t.status})`)}async delete(t){const r=await fetch(`${this.client.apiEndpoint}/operations/${t}`,{method:"DELETE",headers:this.client.defaultHeaders});if(!(r.ok||r.status===404))throw new Error(`Delete ${t} failed (${r.status})`)}async replay(t,r={}){const n=t?.meta?.proxy?.url,{meta:a,timing:o,response:s,...l}=t,c=r.replay_target||r.replayTarget,u=c?{...l,replay_target:c}:l;c==="proxy"&&n&&u?.request?.url&&(u.request={...u.request,url:n});const d=await fetch(`${this.client.apiEndpoint}/replay`,{method:"POST",headers:this.client.jsonHeaders,body:JSON.stringify(u)});if(!d.ok)throw new Error(`Replay failed (${d.status})`);return await d.json()}async export({path:t,preset:r,since:n,until:a,format:o="json",indent:s}={}){let l;["postman","openapi","phar"].includes(o)?l=`${this.client.apiEndpoint}/operations/export/${o}`:l=`${this.client.apiEndpoint}/operations/export`;const c=new URLSearchParams;t&&c.append("path",t),r&&c.append("preset",r),n&&c.append("since",n),a&&c.append("until",a),s!==void 0&&c.append("indent",s);const u=await fetch(`${l}?${c}`,{headers:this.client.defaultHeaders});if(!u.ok){const d=u.headers.get("content-type")||"";let f=null,p=`Export failed (${u.status})`;if(d.toLowerCase().includes("application/json")){f=await u.json().catch(()=>null);const g=f?.error||f?.message||f?.detail||f?.title;g&&(p=g)}else{const g=await u.text().catch(()=>"");g&&(f=g,p=g)}const h=new Error(p);throw h.status=u.status,f!==null&&(h.body=f),h}return await u.blob()}async import(t){const r=new FormData;r.append("file",t),{...this.client.defaultHeaders};const n=await fetch(`${this.client.apiEndpoint}/operations/import`,{method:"POST",headers:this.client.defaultHeaders,body:r});if(!n.ok)throw new Error(`Import failed (${n.status})`)}async summarize(t={}){const r=new URLSearchParams,n=c=>{if(c!=null)return c instanceof Date?c.toISOString():String(c)},a=(c,u)=>{if(u==null)return;if(Array.isArray(u)){if(u.length===0)return;r.set(c,u.map(n).join(","));return}const d=n(u);d!==void 0&&r.set(c,d)};a("operation_id",t.operationId),a("since",t.since),a("until",t.until),a("sort_field",t.sortField),a("sort_direction",t.sortDirection),a("filter[status]",t.status),a("filter[statuses]",t.statuses),a("filter[path]",t.path),a("filter[host]",t.host),a("filter[method]",t.method),a("filter[methods]",t.methods),a("min_duration",t.minDuration),a("max_duration",t.maxDuration),a("filter[tag]",t.tag),a("filter[tags]",t.tags),a("filter[tag_any]",t.tagAny),a("filter[tags_any]",t.tagsAny);const o=r.toString(),s=`${this.client.apiEndpoint}/operations/summary${o?`?${o}`:""}`,l=await fetch(s,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!l.ok)throw new Error(`Operations summary failed (${l.status})`);return await l.json()}async getSeries(t={}){const{method:r,path:n}=t;if(!r)throw new Error("options.method is required");if(!n)throw new Error("options.path is required");const a=new URLSearchParams,o=d=>{if(d!=null)return d instanceof Date?d.toISOString():String(d)},s=(d,f)=>{if(f==null)return;if(Array.isArray(f)){if(!f.length)return;a.set(d,f.map(o).join(","));return}const p=o(f);p!==void 0&&a.set(d,p)};s("method",r),s("path",n),s("operation_id",t.operationId),s("since",t.since),s("until",t.until),s("host",t.host),s("min_duration",t.minDuration),s("max_duration",t.maxDuration),s("status",t.status),s("statuses",t.statuses),s("tag",t.tag),s("tags",t.tags),s("tag_any",t.tagAny),s("tags_any",t.tagsAny),s("series_limit",t.seriesLimit);const l=a.toString(),c=`${this.client.apiEndpoint}/operations/series${l?`?${l}`:""}`,u=await fetch(c,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!u.ok)throw new Error(`Operations series failed (${u.status})`);return await u.json()}async listTags(){const t=await fetch(`${this.client.apiEndpoint}/operations/tags`,{headers:this.client.defaultHeaders});if(!t.ok)throw new Error(`List tags failed (${t.status})`);return await t.json()}async listCompact(t={}){const r=new URLSearchParams,n=c=>{if(!(c==null||c===""))return c instanceof Date?c.toISOString():String(c)},a=(c,u)=>{if(!(u==null||u==="")){if(Array.isArray(u)){if(!u.length)return;r.set(c,u.map(d=>String(d)).join(","));return}r.set(c,String(u))}};a("operation_id",t.operationId),a("since",n(t.since)),a("until",n(t.until)),a("sort_field",t.sortField),a("sort_direction",t.sortDirection),a("page",t.page),a("limit",t.limit),a("filter[status]",t.status),a("filter[statuses]",t.statuses),a("filter[method]",t.method),a("filter[methods]",t.methods),a("filter[path]",t.path),a("filter[paths]",t.paths),a("filter[host]",t.host),a("filter[hosts]",t.hosts),a("min_duration",t.minDuration),a("max_duration",t.maxDuration),a("filter[tag]",t.tag),a("filter[tags]",t.tags),a("filter[tag_any]",t.tagAny),a("filter[tags_any]",t.tagsAny);const o=r.toString(),s=`${this.client.apiEndpoint}/operations/compact${o?`?${o}`:""}`,l=await fetch(s,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!l.ok)throw new Error(`List compact operations failed (${l.status})`);return await l.json()}async list(t={}){const r=new URLSearchParams,n=c=>{if(!(c==null||c===""))return c instanceof Date?c.toISOString():String(c)},a=(c,u)=>{if(!(u==null||u==="")){if(Array.isArray(u)){if(!u.length)return;r.set(c,u.map(d=>String(d)).join(","));return}r.set(c,String(u))}};a("operation_id",t.operationId),a("since",n(t.since)),a("until",n(t.until)),a("sort_field",t.sortField),a("sort_direction",t.sortDirection),a("page",t.page),a("limit",t.limit),a("filter[status]",t.status),a("filter[statuses]",t.statuses),a("filter[method]",t.method),a("filter[methods]",t.methods),a("filter[path]",t.path),a("filter[host]",t.host),a("min_duration",t.minDuration),a("max_duration",t.maxDuration),a("filter[tag]",t.tag),a("filter[tags]",t.tags),a("filter[tag_any]",t.tagAny),a("filter[tags_any]",t.tagsAny);const o=r.toString(),s=`${this.client.apiEndpoint}/operations${o?`?${o}`:""}`,l=await fetch(s,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!l.ok)throw new Error(`List operations failed (${l.status})`);return await l.json()}async deleteOperationTags(t,r={}){if(!t)throw new Error("Operation id is required");const n=new URLSearchParams,a=(c,u)=>{Array.isArray(u)?u.forEach(d=>{d!=null&&`${d}`!=""&&n.append(c,String(d))}):u!=null&&`${u}`!=""&&n.append(c,String(u))},o=(c,u)=>{Array.isArray(u)?u.length&&n.set(c,u.join(",")):u!=null&&`${u}`!=""&&n.set(c,String(u))};if(a("tag",r.tag),o("tags",r.tags),!n.has("tag")&&!n.has("tags"))throw new Error("At least one tag must be provided via options.tag or options.tags");const s=`${this.client.apiEndpoint}/operations/${encodeURIComponent(t)}/tags`,l=await fetch(`${s}?${n.toString()}`,{method:"DELETE",headers:this.client.defaultHeaders});if(!l.ok)throw new Error(`Delete operation tags failed (${l.status})`);return await l.json()}async deleteTag(t,r={}){if(!t)throw new Error("tag is required");const n=new URLSearchParams,a=c=>{if(c)return c instanceof Date?c.toISOString():c},o=(c,u)=>{u==null||u===""||Array.isArray(u)&&u.length===0||n.set(c,Array.isArray(u)?u.join(","):String(u))};o("since",a(r.since)),o("until",a(r.until)),o("method",r.method),o("path",r.path),o("host",r.host),Array.isArray(r.tagsAll)&&r.tagsAll.length&&o("tags_all",r.tagsAll),Array.isArray(r.tagsAny)&&r.tagsAny.length&&o("tags_any",r.tagsAny),Array.isArray(r.statuses)&&r.statuses.length&&o("statuses",r.statuses),o("limit",r.limit),o("page_size",r.pageSize);const s=`${this.client.apiEndpoint}/operations/tags/${encodeURIComponent(t)}`,l=await fetch(`${s}${n.toString()?"?"+n.toString():""}`,{method:"DELETE",headers:this.client.defaultHeaders});if(!l.ok)throw new Error(`Delete tag failed (${l.status})`);return await l.json()}async bulkDeleteTag(t={}){const{tag:r}=t;if(!r)throw new Error("options.tag is required");const n=new URLSearchParams,a=c=>{if(c)return c instanceof Date?c.toISOString():c},o=(c,u)=>{u==null||u===""||Array.isArray(u)&&u.length===0||n.set(c,Array.isArray(u)?u.join(","):String(u))};o("tag",r),o("since",a(t.since)),o("until",a(t.until)),o("method",t.method),o("path",t.path),o("host",t.host),Array.isArray(t.tagsAll)&&t.tagsAll.length&&o("tags_all",t.tagsAll),Array.isArray(t.tagsAny)&&t.tagsAny.length&&o("tags_any",t.tagsAny),Array.isArray(t.statuses)&&t.statuses.length&&o("statuses",t.statuses),o("limit",t.limit),o("page_size",t.pageSize),t.dryRun!==void 0&&t.dryRun!==null&&o("dry_run",t.dryRun?"true":"false");const s=`${this.client.apiEndpoint}/operations/tags/bulk-delete`,l=await fetch(`${s}?${n.toString()}`,{method:"POST",headers:this.client.defaultHeaders});if(!l.ok)throw new Error(`Bulk delete tag failed (${l.status})`);return await l.json()}}class vq{constructor(t){this.client=t}async getHealth(){const t=await fetch(`${this.client.apiEndpoint}/health`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`Health check failed (${t.status})`);return await t.json()}async getVersion(){const t=await fetch(`${this.client.apiEndpoint}/version`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`Version check failed (${t.status})`);return await t.json()}async ping(t){const r=await fetch(`${this.client.apiEndpoint}/ping/${t}`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!r.ok){const n=await r.json();throw new Error(`${n?.error||r.status}`)}return await r.json()}async getMetrics(){const t=await fetch(`${this.client.apiEndpoint}/metrics`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`Metrics failed (${t.status})`);return await t.json()}async getInfo(){const t=await fetch(`${this.client.apiEndpoint}/info`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`Info failed (${t.status})`);return await t.json()}async getLicense(){const t=await fetch(`${this.client.apiEndpoint}/license`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`License failed (${t.status})`);return await t.json()}async putLicense(t){const r=JSON.stringify({license_key:t}),n=await fetch(`${this.client.apiEndpoint}/license`,{method:"PUT",headers:this.client.jsonHeaders,body:r});if(!n.ok){const a=n.status,o=await n.json().catch(()=>({})),s=o?.error||o?.message||`License update failed (${a})`,l=new Error(s);throw l.status=a,l.code=o?.code,l.reason=o?.reason,l.details=o?.error||o?.message,l}return await n.json()}}class kq{constructor(t){this.client=t}async getOperations({group:t,start:r,end:n,tag:a}){const o=new URLSearchParams({group:t,start:r,end:n});a&&o.append("tag",a);const s=`${this.client.apiEndpoint}/stats/operations?${o.toString()}`,l=await fetch(s,{headers:this.client.defaultHeaders});if(!l.ok)throw new Error(`Stats operations failed (${l.status})`);return await l.json()}async getOverview(t={}){const r=c=>{if(!(c==null||c===""))return c instanceof Date?c.toISOString():String(c)},n=new URLSearchParams,a=(c,u)=>{u==null||u===""||n.set(c,String(u))};a("from",r(t.from)),a("to",r(t.to)),a("interval",t.interval),a("tag",t.tag);const o=n.toString(),s=`${this.client.apiEndpoint}/stats/operations/overview${o?`?${o}`:""}`,l=await fetch(s,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!l.ok)throw new Error(`Stats overview failed (${l.status})`);return await l.json()}async getMcpOperations(t={}){const r=c=>{if(!(c==null||c===""))return c instanceof Date?c.toISOString():String(c)},n=new URLSearchParams,a=(c,u)=>{u==null||u===""||n.set(c,String(u))};a("from",r(t.from)),a("to",r(t.to));const o=n.toString(),s=`${this.client.apiEndpoint}/stats/operations/mcp${o?`?${o}`:""}`,l=await fetch(s,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!l.ok)throw new Error(`Stats MCP operations failed (${l.status})`);return await l.json()}async getMcpBuckets(t={}){const r=c=>{if(!(c==null||c===""))return c instanceof Date?c.toISOString():String(c)},n=new URLSearchParams,a=(c,u)=>{u==null||u===""||n.set(c,String(u))};a("from",r(t.from)),a("to",r(t.to)),a("interval",t.interval),a("group",t.group);const o=n.toString(),s=`${this.client.apiEndpoint}/stats/operations/mcp/buckets${o?`?${o}`:""}`,l=await fetch(s,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!l.ok)throw new Error(`Stats MCP buckets failed (${l.status})`);return await l.json()}async getBuckets(t={}){const r=u=>{if(!(u==null||u===""))return u instanceof Date?u.toISOString():String(u)},n=new URLSearchParams,a=(u,d)=>{d==null||d===""||n.set(u,String(d))},o=(u,d)=>{if(d!=null)if(Array.isArray(d)){if(!d.length)return;n.set(u,d.map(f=>String(f)).join(","))}else n.set(u,String(d))};a("from",r(t.from)),a("to",r(t.to)),a("interval",t.interval),a("group",t.group),o("filter[method]",t.method),o("filter[status]",t.status),o("filter[status_class]",t.statusClass),o("filter[tag]",t.tag),o("filter[path]",t.path),a("path_prefix",t.pathPrefix),o("filter[host]",t.host);const s=n.toString(),l=`${this.client.apiEndpoint}/stats/operations/buckets${s?`?${s}`:""}`,c=await fetch(l,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!c.ok)throw new Error(`Stats buckets failed (${c.status})`);return await c.json()}async getBucketsGroup(t,r={}){if(!t)throw new Error("Stats buckets group is required");const n=d=>{if(!(d==null||d===""))return d instanceof Date?d.toISOString():String(d)},a=new URLSearchParams,o=(d,f)=>{f==null||f===""||a.set(d,String(f))},s=(d,f)=>{if(f!=null)if(Array.isArray(f)){if(!f.length)return;a.set(d,f.map(p=>String(p)).join(","))}else a.set(d,String(f))};o("from",n(r.from)),o("to",n(r.to)),o("interval",r.interval),o("group",r.group),s("filter[method]",r.method),s("filter[status]",r.status),s("filter[status_class]",r.statusClass),s("filter[tag]",r.tag),s("filter[path]",r.path),o("path_prefix",r.pathPrefix),s("filter[host]",r.host);const l=a.toString(),c=`${this.client.apiEndpoint}/stats/operations/buckets/${encodeURIComponent(t)}${l?`?${l}`:""}`,u=await fetch(c,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!u.ok)throw new Error(`Stats buckets failed (${u.status})`);return await u.json()}async aggregateBy(t,r={}){const n=["path","method","host","status_class","status","tag","protocol"];if(!n.includes(t))throw new Error(`Invalid dimension: ${t}. Allowed: ${n.join(", ")}`);const a=f=>{if(!(f==null||f===""))return f instanceof Date?f.toISOString():String(f)},o=new URLSearchParams,s=(f,p)=>{p==null||p===""||o.set(f,String(p))},l=(f,p)=>{if(p!=null)if(Array.isArray(p)){if(!p.length)return;o.set(f,p.map(h=>String(h)).join(","))}else o.set(f,String(p))};s("from",a(r.from)),s("to",a(r.to)),l("metrics",r.metrics),typeof r.limit=="number"&&s("limit",r.limit),s("order",r.order),l("method",r.method),l("status",r.status),l("status_class",r.statusClass),s("path",r.path),s("path_prefix",r.pathPrefix),s("host",r.host),l("tag",r.tag);const c=o.toString(),u=`${this.client.apiEndpoint}/stats/operations/aggregate/${encodeURIComponent(t)}${c?`?${c}`:""}`,d=await fetch(u,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!d.ok)throw new Error(`Stats aggregate failed (${d.status})`);return await d.json()}async deleteOperations(){const t=await fetch(`${this.client.apiEndpoint}/stats/operations`,{method:"DELETE",headers:this.client.defaultHeaders});if(t.status!==204)throw new Error(`Delete stats operations failed (${t.status})`)}}class wq{constructor(t){this.client=t}async list(t={}){const r=new URLSearchParams,{page:n,limit:a,source:o,search:s}=t;n!=null&&r.set("page",String(n)),a!=null&&r.set("limit",String(a)),o&&r.set("source",o),s&&r.set("search",s);const l=r.toString(),c=`${this.client.apiEndpoint}/traces${l?`?${l}`:""}`,u=await fetch(c,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!u.ok)throw new Error(`Trace list failed (${u.status})`);return await u.json()}async get(t,r={}){if(!t)throw new Error("Trace ID is required");const n=new URLSearchParams,{page:a,limit:o}=r;a!=null&&n.set("page",String(a)),o!=null&&n.set("limit",String(o));const s=n.toString(),l=`${this.client.apiEndpoint}/traces/${encodeURIComponent(t)}${s?`?${s}`:""}`,c=await fetch(l,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!c.ok)throw new Error(`Trace detail failed (${c.status})`);return await c.json()}}class jq{constructor(t){this.client=t}async getConfig(){const t=await fetch(`${this.client.apiEndpoint}/mock`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`Mock info failed (${t.status})`);return await t.json()}async launch(t){const r=`${this.client.apiEndpoint}/mock/launch?openapi=`+encodeURIComponent(t),n=await fetch(r,{method:"GET",headers:this.client.defaultHeaders});if(!n.ok){const a=await n.json().catch(()=>({}));throw new Error(a.error||`Mock launch failed (${n.status})`)}return await n.json()}}class Nq{constructor(t){this.client=t}async export(t={}){const r=t?.id,n=r?`${this.client.apiEndpoint}/rules/${encodeURIComponent(r)}/export`:`${this.client.apiEndpoint}/rules/export`,a=await fetch(n,{method:"GET",headers:{...this.client.defaultHeaders,Accept:"application/x-yaml"}});if(!a.ok){let d="";try{d=await a.text()}catch{}throw new Error(`Rules export failed (${a.status})${d?`: ${d}`:""}`)}const o=await a.blob(),s=a.headers.get("Content-Type")||"application/x-yaml",l=a.headers.get("Content-Disposition")||"",c=/filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i.exec(l),u=decodeURIComponent(c?.[1]||c?.[2]||"rules.yaml");return{blob:o,filename:u,contentType:s}}async import(t,r={}){const n=t&&typeof t=="object"&&(t instanceof Blob||t instanceof File)?t:String(t??""),a=r?.overwrite===!0,o=`${this.client.apiEndpoint}/rules/import`+(a?"?overwrite=true":""),s=await fetch(o,{method:"POST",headers:{...this.client.defaultHeaders,"Content-Type":"application/x-yaml",Accept:"application/json"},body:n});if(!s.ok){let l={};try{l=await s.json()}catch{try{l={message:await s.text()}}catch{}}const c=l?.error||l?.message||`Rules import failed (${s.status})`,u=new Error(c);throw u.status=s.status,u.body=l,u}try{return await s.json()}catch{return{}}}async applyToHistory(t,r={}){if(!t)throw new Error("Rule id is required");const n=new URLSearchParams,a=u=>{if(u)return u instanceof Date?u.toISOString():u},o=(u,d)=>{d==null||d===""||n.set(u,String(d))};o("since",a(r.since)),o("until",a(r.until)),o("method",r.method),o("path",r.path),o("host",r.host),Array.isArray(r.tagsAll)&&r.tagsAll.length&&o("tags_all",r.tagsAll.join(",")),Array.isArray(r.tagsAny)&&r.tagsAny.length&&o("tags_any",r.tagsAny.join(",")),Array.isArray(r.statuses)&&r.statuses.length&&o("statuses",r.statuses.join(",")),typeof r.limit=="number"&&o("limit",r.limit),typeof r.pageSize=="number"&&o("page_size",r.pageSize);const s=r.dryRun!==!1;o("dry_run",s);const l=`${this.client.apiEndpoint}/rules/${encodeURIComponent(t)}/apply`+(n.toString()?`?${n.toString()}`:""),c=await fetch(l,{method:"POST",headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!c.ok){let u={};try{u=await c.json()}catch{}const d=u?.error||u?.message||`Apply rule failed (${c.status})`,f=new Error(d);throw f.status=c.status,f.body=u,f}return await c.json()}async list({page:t,limit:r}={}){let n=`${this.client.apiEndpoint}/rules`;const a=new URLSearchParams;t&&a.set("page",t),r&&a.set("limit",r),a.toString()&&(n+=`?${a.toString()}`);const o=await fetch(n,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!o.ok)throw new Error(`Rules load failed (${o.status})`);return await o.json()}async create(t){const r=await fetch(`${this.client.apiEndpoint}/rules`,{method:"POST",headers:this.client.jsonHeaders,body:JSON.stringify(t)});if(!r.ok){const n=await r.json().catch(()=>({})),a=n?.error||n?.message||`Rule create failed (${r.status})`,o=new Error(a);throw o.status=r.status,o.body=n,o}return await r.json()}async get(t){const r=await fetch(`${this.client.apiEndpoint}/rules/${t}`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!r.ok)throw new Error(`Rule load failed (${r.status})`);return await r.json()}async replace(t,r){const n=await fetch(`${this.client.apiEndpoint}/rules/${t}`,{method:"PUT",headers:this.client.jsonHeaders,body:JSON.stringify(r)});if(!n.ok){const a=await n.json().catch(()=>({})),o=a?.error||a?.message||`Rule update failed (${n.status})`,s=new Error(o);throw s.status=n.status,s.body=a,s}return await n.json()}async delete(t){const r=await fetch(`${this.client.apiEndpoint}/rules/${t}`,{method:"DELETE",headers:this.client.defaultHeaders});if(!(r.ok||r.status===204)){const n=await r.json().catch(()=>({})),a=n?.error||n?.message||`Rule delete failed (${r.status})`,o=new Error(a);throw o.status=r.status,o.body=n,o}}async update(t,r){return this.replace(t,r)}async getEvents({page:t,limit:r}={}){let n=`${this.client.apiEndpoint}/rules/events`;const a=new URLSearchParams;t&&a.set("page",t),r&&a.set("limit",r),a.toString()&&(n+=`?${a.toString()}`);const o=await fetch(n,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!o.ok)throw new Error(`Rules events failed (${o.status})`);return await o.json()}async getActions({page:t,limit:r}={}){let n=`${this.client.apiEndpoint}/rules/actions`;const a=new URLSearchParams;t&&a.set("page",t),r&&a.set("limit",r),a.toString()&&(n+=`?${a.toString()}`);const o=await fetch(n,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!o.ok)throw new Error(`Rules actions failed (${o.status})`);return await o.json()}async getOperators({page:t,limit:r}={}){let n=`${this.client.apiEndpoint}/rules/operators`;const a=new URLSearchParams;t&&a.set("page",t),r&&a.set("limit",r),a.toString()&&(n+=`?${a.toString()}`);const o=await fetch(n,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!o.ok)throw new Error(`Rules operators failed (${o.status})`);const s=await o.json();return Array.isArray(s)?s:s&&Array.isArray(s.operators)?s.operators:[]}}class Eq{constructor(t){this.client=t}async list({page:t,limit:r}={}){let n=`${this.client.apiEndpoint}/connectors`;const a=new URLSearchParams;t&&a.set("page",t),r&&a.set("limit",r),a.toString()&&(n+=`?${a.toString()}`);const o=await fetch(n,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!o.ok)throw new Error(`Connectors list failed (${o.status})`);return await o.json()}async create(t){const r=await fetch(`${this.client.apiEndpoint}/connectors`,{method:"POST",headers:this.client.jsonHeaders,body:JSON.stringify(t)});if(!r.ok){const n=await r.json().catch(()=>({})),a=n?.error||n?.message||`Connector create failed (${r.status})`,o=new Error(a);throw o.status=r.status,o.body=n,o}return await r.json()}async get(t){const r=await fetch(`${this.client.apiEndpoint}/connectors/${encodeURIComponent(t)}`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!r.ok)throw new Error(`Connector load failed (${r.status})`);return await r.json()}async update(t,r){const n=await fetch(`${this.client.apiEndpoint}/connectors/${encodeURIComponent(t)}`,{method:"PUT",headers:this.client.jsonHeaders,body:JSON.stringify(r)});if(!n.ok){const a=await n.json().catch(()=>({})),o=a?.error||a?.message||`Connector update failed (${n.status})`,s=new Error(o);throw s.status=n.status,s.body=a,s}return await n.json()}async delete(t){const r=await fetch(`${this.client.apiEndpoint}/connectors/${encodeURIComponent(t)}`,{method:"DELETE",headers:this.client.defaultHeaders});if(!(r.ok||r.status===204)){const n=await r.json().catch(()=>({})),a=n?.error||n?.message||`Connector delete failed (${r.status})`,o=new Error(a);throw o.status=r.status,o.body=n,o}}}const Sq=[":","="],Cq=e=>e==null?"":typeof e=="string"?e:String(e),yc=e=>{const t=Cq(e).trim();if(!t)return null;let r=-1,n="";for(const s of Sq){const l=t.indexOf(s);if(l>0&&l<t.length-1){r=l,n=s;break}}if(r===-1)return{type:"simple",raw:t,display:t,key:null,value:null,separator:null,token:t.toLowerCase()};const a=t.slice(0,r).trim(),o=t.slice(r+1).trim();return!a||!o?{type:"simple",raw:t,display:t,key:null,value:null,separator:null,token:t.toLowerCase()}:{type:"kv",raw:t,display:`${a}:${o}`,key:a,value:o,separator:n,token:`${a}:${o}`.toLowerCase(),keyToken:a.toLowerCase()}},_f=e=>Array.isArray(e)?e.map(yc).filter(Boolean):[],c8=e=>Array.isArray(e)?e.map(yc).filter(Boolean).map(t=>t.token):[],c5=e=>{if(!e)return[];if(Array.isArray(e.__normalizedTags))return e.__normalizedTags;const t=_f(e?.tags||[]);return e.__normalizedTags=t,t},ol=e=>e==null?null:String(e).trim()||null,Fu=(e,t)=>{if(!Array.isArray(e))return null;for(const r of e)if(typeof r=="string"){for(const n of t)if(r.startsWith(n)){const a=ol(r.slice(n.length));if(a)return a}}return null},ky=(e,t,r)=>!e||typeof e!="object"?null:ol(e[r])||(e.category===t&&e.name?ol(e.name):null),$u=(e,t)=>{const r=new Set;return e.forEach(n=>{const a=n?.[t];if(Array.isArray(a)){a.forEach(s=>{const l=ol(s);l&&r.add(l)});return}const o=ol(a);o&&r.add(o)}),Array.from(r).sort((n,a)=>n.localeCompare(a))};class Oq{constructor(){this.db=new mc("InspectrDB"),this.db.version(1).stores({events:"id, time, operation_id, method, status_code, path, duration, server"}),this.db.version(2).stores({events:"id, time, operation_id, method, status_code, path, duration, server"}),this.db.version(3).stores({events:"id, time, operation_id, method, status_code, path, duration, server, mcp_tool, mcp_resource, mcp_prompt"}),this.db.version(4).stores({events:"id, time, operation_id, method, status_code, path, duration, server, mcp_tool, mcp_resource, mcp_prompt, mcp_category, mcp_method"})}transformEvent(t){const{id:r,data:n,operation_id:a}=t,o=t?.__syncRunId,s=_f(n?.meta?.tags||[]),l=Array.isArray(n?.meta?.tags)?n.meta.tags:[],c=n?.meta?.mcp||n?.meta?.trace?.mcp||null,u=ky(c,"tool","tool_name")||Fu(l,["mcp.tool.","mcp.tool:"]),d=ky(c,"resource","resource_name")||Fu(l,["mcp.resource.","mcp.resource:"]),f=ky(c,"prompt","prompt_name")||Fu(l,["mcp.prompt.","mcp.prompt:"]),p=ol(c?.category)||Fu(l,["mcp.category.","mcp.category:"]),h=ol(c?.method)||Fu(l,["mcp.method.","mcp.method:"]);return{id:r,time:n.request.timestamp,operation_id:a,method:n.request.method,url:n.request.url,server:n.request.server,path:n.request.path,query_params:n.request.query_params||[],client_ip:n.request.client_ip,duration:n.timing.duration,status_code:n.response?.status,mcp_tool:u,mcp_resource:d,mcp_prompt:f,mcp_category:p,mcp_method:h,...o?{last_synced_at:o}:{},tagTokens:s.map(g=>g.token),tags:s.map(g=>g.display)}}async upsertEvent(t){const r=this.transformEvent(t);return await this.db.events.put(r)}async bulkUpsertEvents(t){const r=t.map(n=>this.transformEvent(n));return await this.db.transaction("rw",this.db.events,()=>this.db.events.bulkPut(r))}async deleteEvent(t){return await this.db.events.delete(t)}async getEvent(t){return await this.db.events.get(t)}async queryEvents(t={}){const{filters:r={},sort:n={field:"time",order:"desc"},page:a=1,pageSize:o=20}=t;if(!(r.timestampRange||r.status&&r.status.length||r.method&&r.method.length||r.path||r.durationMin||r.durationMax||r.host||r.tags&&r.tags.length||r.mcpTool&&r.mcpTool.length||r.mcpResource&&r.mcpResource.length||r.mcpPrompt&&r.mcpPrompt.length||r.mcpCategory&&r.mcpCategory.length||r.mcpMethod&&r.mcpMethod.length)){const p=this.db.events,h=p.count();let g=p.orderBy(n.field);n.order==="desc"&&(g=g.reverse());const b=g.offset((a-1)*o).limit(o).toArray(),[y,v]=await Promise.all([b,h]);return{results:y,totalCount:v}}let s=this.db.events.toCollection();if(r.timestampRange){if(typeof r.timestampRange=="string"){let p=new Date;switch(r.timestampRange){case"5M":p.setMinutes(p.getMinutes()-5);break;case"15M":p.setMinutes(p.getMinutes()-15);break;case"30M":p.setMinutes(p.getMinutes()-30);break;case"1H":p.setHours(p.getHours()-1);break;case"3H":p.setHours(p.getHours()-3);break;case"6H":p.setHours(p.getHours()-6);break;case"12H":p.setHours(p.getHours()-12);break;case"24H":p.setHours(p.getHours()-24);break;case"48H":p.setHours(p.getHours()-48);break;case"week":p.setDate(p.getDate()-7);break;case"month":p.setMonth(p.getMonth()-1);break}s=s.filter(h=>new Date(h.time)>=p)}else if(typeof r.timestampRange=="object"){if(r.timestampRange.start&&r.timestampRange.end){const p=new Date(r.timestampRange.start),h=new Date(r.timestampRange.end);s=s.filter(g=>{const b=new Date(g.time);return b>=p&&b<=h})}else if(r.timestampRange.start){const p=new Date(r.timestampRange.start);s=s.filter(h=>new Date(h.time)>=p)}else if(r.timestampRange.end){const p=new Date(r.timestampRange.end);s=s.filter(h=>new Date(h.time)<=p)}}}if(r.status&&Array.isArray(r.status)&&r.status.length>0&&(s=s.filter(p=>p.status_code===null||p.status_code===void 0?!1:r.status.includes(String(p.status_code)))),r.method&&Array.isArray(r.method)&&r.method.length>0){const p=r.method.map(h=>h.toLowerCase());s=s.filter(h=>p.includes(h.method.toLowerCase()))}if(r.path&&(s=s.filter(p=>p.path.includes(r.path))),r.durationMin&&(s=s.filter(p=>Number(p.duration)>=Number(r.durationMin))),r.durationMax&&(s=s.filter(p=>Number(p.duration)<=Number(r.durationMax))),r.host&&(s=s.filter(p=>p.server.toLowerCase().includes(r.host.toLowerCase()))),r.tags&&Array.isArray(r.tags)&&r.tags.length>0){const p=c8(r.tags);p.length>0&&(s=s.filter(h=>{const g=Array.isArray(h.tagTokens)&&h.tagTokens.length>0?h.tagTokens:c5(h).map(b=>b.token);return!g||g.length===0?!1:p.every(b=>g.includes(b))}))}const l=(p,h)=>{if(!Array.isArray(h)||h.length===0)return!0;if(!p)return!1;const g=Array.isArray(p)?p:[p],b=new Set(g.map(y=>String(y).toLowerCase()));return h.some(y=>b.has(String(y).toLowerCase()))};r.mcpTool&&Array.isArray(r.mcpTool)&&r.mcpTool.length>0&&(s=s.filter(p=>l(p.mcp_tool,r.mcpTool))),r.mcpResource&&Array.isArray(r.mcpResource)&&r.mcpResource.length>0&&(s=s.filter(p=>l(p.mcp_resource,r.mcpResource))),r.mcpPrompt&&Array.isArray(r.mcpPrompt)&&r.mcpPrompt.length>0&&(s=s.filter(p=>l(p.mcp_prompt,r.mcpPrompt))),r.mcpCategory&&Array.isArray(r.mcpCategory)&&r.mcpCategory.length>0&&(s=s.filter(p=>l(p.mcp_category,r.mcpCategory))),r.mcpMethod&&Array.isArray(r.mcpMethod)&&r.mcpMethod.length>0&&(s=s.filter(p=>l(p.mcp_method,r.mcpMethod)));const c=await s.count();let u;if(typeof s.orderBy=="function")try{u=s.orderBy(n.field),n.order==="desc"&&(u=u.reverse())}catch(p){console.error("[EventDB] orderBy error, fallback sorting:",p),u=(await s.toArray()).sort((h,g)=>{const b=n.field;return h[b]<g[b]?n.order==="asc"?-1:1:h[b]>g[b]?n.order==="asc"?1:-1:0})}else u=(await s.toArray()).sort((p,h)=>{const g=n.field;return p[g]<h[g]?n.order==="asc"?-1:1:p[g]>h[g]?n.order==="asc"?1:-1:0});const d=(a-1)*o;let f;return Array.isArray(u)?f=u.slice(d,d+o):typeof u.offset=="function"?f=await u.offset(d).limit(o).toArray():f=[],{results:f,totalCount:c}}async clearEvents(){return await this.db.events.clear()}async removeEventsNotSynced(t){return t?await this.db.events.filter(r=>r.last_synced_at!==t).delete():0}async getAllTagOptions(){const t=await this.db.events.toArray(),r=new Map;return t.forEach(n=>{c5(n).forEach(a=>{r.has(a.token)||r.set(a.token,a.display)})}),Array.from(r.values()).sort((n,a)=>n.localeCompare(a))}async getAllMcpToolOptions(){const t=await this.db.events.toArray();return $u(t,"mcp_tool")}async getAllMcpResourceOptions(){const t=await this.db.events.toArray();return $u(t,"mcp_resource")}async getAllMcpPromptOptions(){const t=await this.db.events.toArray();return $u(t,"mcp_prompt")}async getAllMcpCategoryOptions(){const t=await this.db.events.toArray();return $u(t,"mcp_category")}async getAllMcpMethodOptions(){const t=await this.db.events.toArray();return $u(t,"mcp_method")}}const Fr=new Oq,u8=m.createContext({apiEndpoint:"/api",setApiEndpoint:()=>{},connectionStatus:"reconnecting",setConnectionStatus:()=>{},sseEndpoint:"",ingressEndpoint:"",channelCode:"",setChannelCode:()=>{},channel:"",setChannel:()=>{},token:"",reRegistrationFailedRef:{current:!1},userInitiatedRegistrationRef:{current:!1},handleRegister:()=>{},attemptReRegistration:()=>{},toast:null,setToast:()=>{},debugMode:!1,client:null}),fr=()=>m.useContext(u8),Pq=({children:e})=>{const[t,r]=dr("apiEndpoint","/api"),n=t?t.replace(/\/+$/,""):"/api",a=De=>{r(De&&De.replace(/\/+$/,""))},[o,s]=m.useState("disconnected"),[l,c]=dr("sseEndpoint",""),[u,d]=dr("ingressEndpoint",""),[f,p]=dr("channelCode",""),[h,g]=dr("channel",""),[b,y]=dr("token",""),[v,k]=dr("expires",""),[,N]=dr("expose","false"),[w,E]=m.useState(!1),[C,O]=m.useState(null),D=m.useRef(0),A=m.useRef(!1),M=6,I=5e3,T=typeof window<"u"&&window.location.hostname==="localhost",R=typeof window<"u"&&localStorage.getItem("debug")==="true";m.useEffect(()=>{R&&console.log("[Inspectr] Debug Mode enabled")},[]);const L=()=>{const De=new URLSearchParams(window.location.search),ut=new URLSearchParams(window.location.hash.split("?")[1]||""),ct=nt=>De.get(nt)||ut.get(nt),Nt=De.get("channelCode"),yt=De.get("channel"),ft=De.get("token"),Ct=De.get("sseEndpoint"),Ae=Nt||ct("channelCode"),ke=yt||ct("channel"),Ie=ft||ct("token"),qe=Ct||ct("sseEndpoint");return Ae||ke||Ie||qe?(console.log("🔍 Found credentials in query params"),Ae&&p(Ae),ke&&g(ke),Ie&&y(Ie),qe&&c(qe),window.history.replaceState({},"",`${window.location.pathname}${De.toString()?"?"+De.toString():""}`),!0):!1},F=()=>f&&h&&b?(console.log("✅ Using stored credentials from localStorage"),!0):!1,[V,H]=dr("proxyEndpoint",""),[$,z]=m.useState(()=>new pq({apiEndpoint:n}));m.useEffect(()=>{$.configure({apiEndpoint:n})},[n]);const W=async()=>{console.log("🔄 Fetching /app/config (Localhost, No credentials found)");try{const De=await $.registration.getConfig();De?.token&&De?.sse_endpoint&&De?.channel_code&&(console.log("✅ Loaded from /app/config:",De),p(De.channel_code),g(De.channel),y(De.token),c(De.sse_endpoint),d(De.ingress_endpoint),H(De.proxy_endpoint),N(De.expose?"true":"false"))}catch(De){console.error("❌ Failed to load /app/config:",De)}},U=async(De=f,ut=h,ct=b,Nt)=>{try{let yt={};De&&ut?yt={channel:ut,channel_code:De}:ct&&(yt={token:ct}),console.log("📤 Registering with:",yt);const ft=await $.registration.register(yt);if(ft?.token&&ft?.sse_endpoint&&ft?.channel_code)return console.log("✅ Registration successful"),D.current=0,A.current=!1,p(ft.channel_code),g(ft.channel),y(ft.token),k(ft.expires),c(ft.sse_endpoint),d(ft.ingress_endpoint),H(ft.proxy_endpoint),N(ft.expose?"true":"false"),Nt&&O({message:"Registration Successful",subMessage:"Your channel and access code have been registered."}),s("connected"),!0;throw console.error("❌ Registration failed:",ft),O({message:"Registration Failed",subMessage:"Please check your channel and access code.",type:"error"}),s("disconnected"),new Error("Registration failed")}catch(yt){throw console.error("❌ Registration error:",yt),O({message:"Registration Error",subMessage:"An error occurred during registration.",type:"error"}),s("disconnected"),yt}},X=()=>{A.current||(s("reconnecting"),D.current<M?(D.current+=1,console.log(`🔄 Attempting re-registration (${D.current}/${M}) in ${I/1e3} seconds...`),setTimeout(async()=>{try{await U()}catch(De){console.log("❌ Re-registration attempt failed:",De),X()}},I)):(console.log(`❌ Re-registration failed after ${M} attempts. Giving up.`),D.current=0,A.current=!0,s("disconnected")))},Y=()=>{D.current=0,A.current=!1};m.useEffect(()=>{(async()=>typeof window>"u"||(L()||!F()&&T&&await W(),E(!0)))()},[]);const ae=m.useRef(!1);m.useEffect(()=>{if(w){if(ae.current){ae.current=!1;return}if(b&&!l&&!A.current){console.log("🔄 Have token but missing sseEndpoint, re-registering"),U("","",b);return}console.log("🔄 Auto-registering with stored credentials:",h,f),h&&f?U(f,h):console.log("⚠️ Missing credentials for auto-registration, skipping.")}},[w,h,f,b,l]);const[G,ee]=dr("lastEventId",""),re=m.useRef(null),pe=m.useRef(!1),te=50,se=50,ne=m.useRef(0),K=m.useRef(0),ge=m.useRef([]),ye=m.useRef(null),me=()=>{if(re.current){try{re.current.close()}catch{}re.current=null}},Se=De=>{if(me(),!l||!b)return;const ut=De??G;let ct=`${l}?token=${encodeURIComponent(b)}`;if(ut){const Ct=ct.includes("?")?"&":"?";ct=`${ct}${Ct}last_event_id=${encodeURIComponent(ut)}`}const Nt=new EventSource(ct);re.current=Nt,console.log(`🔄 SSE connecting with ${ct}`),s(pe.current?"reconnecting":"connecting"),Nt.onopen=()=>{pe.current=!0,s("connected"),R&&console.log("📡️ SSE connection opened.")};const yt=Ct=>{try{if(!Ct.data||Ct.data.trim()===""){R&&console.warn("Received empty sync event data, skipping");return}const Ae=JSON.parse(Ct.data);if(R&&console.log("[Inspectr] Received sync event:",Ae),Ae?.type!=="dev.inspectr.platform.sse.v1.sync_complete")return;const ke=ye.current;ye.current=null,(async()=>{const Ie=Number(Ae?.data?.record_count||0);if(ge.current.length){const qe=ge.current;ge.current=[],K.current=0,ne.current=performance.now(),await Fr.bulkUpsertEvents(qe)}if(R&&console.log(`[Inspectr] Sync complete: ${Ie} synced`),ke){const qe=await Fr.removeEventsNotSynced(ke);R&&console.log(`[Inspectr] Sync cleanup: ${qe} removed`)}})().catch(Ie=>console.error("Failed to finalize sync pruning",Ie))}catch(Ae){console.error("Error parsing SSE sync event:",Ae)}},ft=Ct=>{try{const Ae=performance.now();if(Ae-ne.current>te&&(ne.current=Ae,K.current=0),K.current++,!Ct.data||Ct.data.trim()===""){R&&console.warn("Received empty SSE data, skipping");return}const ke=JSON.parse(Ct.data);R&&console.log("[Inspectr] Received event:",ke),ke.operation_id?(ke.id=ke.operation_id,ee(ke.operation_id)):ke.id=ke.id||`req-${Math.random().toString(36).slice(2,11)}`,ye.current&&(ke.__syncRunId=ye.current),K.current<se?Fr.upsertEvent(ke).catch(Ie=>console.error("Error saving event to DB:",Ie)):(ge.current.push(ke),K.current===se&&setTimeout(async()=>{try{await Fr.bulkUpsertEvents(ge.current)}catch(Ie){console.error("bulk save failed",Ie)}finally{ge.current=[],K.current=0,ne.current=performance.now()}},te))}catch(Ae){console.error("Error parsing SSE Inspectr data:",Ae)}};Nt.onmessage=ft,Nt.addEventListener("sync",yt),Nt.onerror=Ct=>{if(console.error("❌ SSE connection error:",Ct),s("reconnecting"),A.current){console.log("❌ Maximum re-registration attempts reached. Closing EventSource."),s("disconnected");try{Nt.close()}catch{}return}console.log("🔄 Starting re-registration retry loop due to SSE error."),X()}},Re=()=>{me(),s("disconnected"),console.log("📡️ SSE connection closed.")},Te="sync",Je=()=>{R&&console.log("[Inspectr] Syncing all operations..."),ye.current=Date.now(),ee(Te),Se(Te)};m.useEffect(()=>{if(!(!l||!b))return Y(),Se(),()=>{Re()}},[l,b]),m.useEffect(()=>{const De=()=>{try{me()}catch{}};return window.addEventListener("beforeunload",De),()=>window.removeEventListener("beforeunload",De)},[]);const rt={apiEndpoint:n,setApiEndpoint:a,connectionStatus:o,setConnectionStatus:s,sseEndpoint:l,ingressEndpoint:u,proxyEndpoint:V,setProxyEndpoint:H,channelCode:f,setChannelCode:p,channel:h,setChannel:g,token:b,reRegistrationFailedRef:A,userInitiatedRegistrationRef:ae,handleRegister:U,attemptReRegistration:X,resetReRegistration:Y,toast:C,setToast:O,debugMode:R,client:$,lastEventId:G,setLastEventId:ee,connect:Se,disconnect:Re,syncOperations:Je,eventSource:re.current};return i.jsx(u8.Provider,{value:rt,children:e})};function Uo(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),r===!1||!n.defaultPrevented)return t?.(n)}}function u5(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function d8(...e){return t=>{let r=!1;const n=e.map(a=>{const o=u5(a,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let a=0;a<n.length;a++){const o=n[a];typeof o=="function"?o():u5(e[a],null)}}}}function hl(...e){return m.useCallback(d8(...e),e)}function f8(e,t=[]){let r=[];function n(o,s){const l=m.createContext(s),c=r.length;r=[...r,s];const u=f=>{const{scope:p,children:h,...g}=f,b=p?.[e]?.[c]||l,y=m.useMemo(()=>g,Object.values(g));return i.jsx(b.Provider,{value:y,children:h})};u.displayName=o+"Provider";function d(f,p){const h=p?.[e]?.[c]||l,g=m.useContext(h);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const a=()=>{const o=r.map(s=>m.createContext(s));return function(s){const l=s?.[e]||o;return m.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return a.scopeName=e,[n,Aq(a,...t)]}function Aq(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){const o=n.reduce((s,{useScope:l,scopeName:c})=>{const u=l(a)[`__scope${c}`];return{...s,...u}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function Mq(e){const t=Tq(e),r=m.forwardRef((n,a)=>{const{children:o,...s}=n,l=m.Children.toArray(o),c=l.find(Iq);if(c){const u=c.props.children,d=l.map(f=>f===c?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return i.jsx(t,{...s,ref:a,children:m.isValidElement(u)?m.cloneElement(u,void 0,d):null})}return i.jsx(t,{...s,ref:a,children:o})});return r.displayName=`${e}.Slot`,r}function Tq(e){const t=m.forwardRef((r,n)=>{const{children:a,...o}=r;if(m.isValidElement(a)){const s=Lq(a),l=Dq(o,a.props);return a.type!==m.Fragment&&(l.ref=n?d8(n,s):s),m.cloneElement(a,l)}return m.Children.count(a)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var m8=Symbol("radix.slottable");function _q(e){const t=({children:r})=>i.jsx(i.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=m8,t}function Iq(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===m8}function Dq(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...s)=>{const l=o(...s);return a(...s),l}:a&&(r[n]=a):n==="style"?r[n]={...a,...o}:n==="className"&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}function Lq(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Rq=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ui=Rq.reduce((e,t)=>{const r=Mq(`Primitive.${t}`),n=m.forwardRef((a,o)=>{const{asChild:s,...l}=a,c=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Fq(e,t){e&&Qt.flushSync(()=>e.dispatchEvent(t))}function xg(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...r)=>t.current?.(...r),[])}function $q(e,t=globalThis?.document){const r=xg(e);m.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Bq="DismissableLayer",Iw="dismissableLayer.update",Hq="dismissableLayer.pointerDownOutside",zq="dismissableLayer.focusOutside",d5,p8=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),h8=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:l,...c}=e,u=m.useContext(p8),[d,f]=m.useState(null),p=d?.ownerDocument??globalThis?.document,[,h]=m.useState({}),g=hl(t,O=>f(O)),b=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=b.indexOf(y),k=d?b.indexOf(d):-1,N=u.layersWithOutsidePointerEventsDisabled.size>0,w=k>=v,E=Vq(O=>{const D=O.target,A=[...u.branches].some(M=>M.contains(D));!w||A||(a?.(O),s?.(O),O.defaultPrevented||l?.())},p),C=Wq(O=>{const D=O.target;[...u.branches].some(A=>A.contains(D))||(o?.(O),s?.(O),O.defaultPrevented||l?.())},p);return $q(O=>{k===u.layers.size-1&&(n?.(O),!O.defaultPrevented&&l&&(O.preventDefault(),l()))},p),m.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(d5=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),f5(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=d5)}},[d,p,r,u]),m.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),f5())},[d,u]),m.useEffect(()=>{const O=()=>h({});return document.addEventListener(Iw,O),()=>document.removeEventListener(Iw,O)},[]),i.jsx(ui.div,{...c,ref:g,style:{pointerEvents:N?w?"auto":"none":void 0,...e.style},onFocusCapture:Uo(e.onFocusCapture,C.onFocusCapture),onBlurCapture:Uo(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Uo(e.onPointerDownCapture,E.onPointerDownCapture)})});h8.displayName=Bq;var Uq="DismissableLayerBranch",qq=m.forwardRef((e,t)=>{const r=m.useContext(p8),n=m.useRef(null),a=hl(t,n);return m.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),i.jsx(ui.div,{...e,ref:a})});qq.displayName=Uq;function Vq(e,t=globalThis?.document){const r=xg(e),n=m.useRef(!1),a=m.useRef(()=>{});return m.useEffect(()=>{const o=l=>{if(l.target&&!n.current){let c=function(){g8(Hq,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",o),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Wq(e,t=globalThis?.document){const r=xg(e),n=m.useRef(!1);return m.useEffect(()=>{const a=o=>{o.target&&!n.current&&g8(zq,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function f5(){const e=new CustomEvent(Iw);document.dispatchEvent(e)}function g8(e,t,r,{discrete:n}){const a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Fq(a,o):a.dispatchEvent(o)}var ei=globalThis?.document?m.useLayoutEffect:()=>{},Kq=Xs[" useId ".trim().toString()]||(()=>{}),Yq=0;function Xq(e){const[t,r]=m.useState(Kq());return ei(()=>{r(n=>n??String(Yq++))},[e]),t?`radix-${t}`:""}var Gq="Arrow",b8=m.forwardRef((e,t)=>{const{children:r,width:n=10,height:a=5,...o}=e;return i.jsx(ui.svg,{...o,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});b8.displayName=Gq;var Zq=b8;function Jq(e){const[t,r]=m.useState(void 0);return ei(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const o=a[0];let s,l;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,l=u.blockSize}else s=e.offsetWidth,l=e.offsetHeight;r({width:s,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var hN="Popper",[y8,x8]=f8(hN),[Qq,v8]=y8(hN),k8=e=>{const{__scopePopper:t,children:r}=e,[n,a]=m.useState(null);return i.jsx(Qq,{scope:t,anchor:n,onAnchorChange:a,children:r})};k8.displayName=hN;var w8="PopperAnchor",j8=m.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...a}=e,o=v8(w8,r),s=m.useRef(null),l=hl(t,s),c=m.useRef(null);return m.useEffect(()=>{const u=c.current;c.current=n?.current||s.current,u!==c.current&&o.onAnchorChange(c.current)}),n?null:i.jsx(ui.div,{...a,ref:l})});j8.displayName=w8;var gN="PopperContent",[eV,tV]=y8(gN),N8=m.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:o="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:h="optimized",onPlaced:g,...b}=e,y=v8(gN,r),[v,k]=m.useState(null),N=hl(t,re=>k(re)),[w,E]=m.useState(null),C=Jq(w),O=C?.width??0,D=C?.height??0,A=n+(o!=="center"?"-"+o:""),M=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},I=Array.isArray(u)?u:[u],T=I.length>0,R={padding:M,boundary:I.filter(nV),altBoundary:T},{refs:L,floatingStyles:F,placement:V,isPositioned:H,middlewareData:$}=OM({strategy:"fixed",placement:A,whileElementsMounted:(...re)=>lg(...re,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[Qj({mainAxis:a+D,alignmentAxis:s}),c&&PM({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?RH():void 0,...R}),c&&AM({...R}),MM({...R,apply:({elements:re,rects:pe,availableWidth:te,availableHeight:se})=>{const{width:ne,height:K}=pe.reference,ge=re.floating.style;ge.setProperty("--radix-popper-available-width",`${te}px`),ge.setProperty("--radix-popper-available-height",`${se}px`),ge.setProperty("--radix-popper-anchor-width",`${ne}px`),ge.setProperty("--radix-popper-anchor-height",`${K}px`)}}),w&&$H({element:w,padding:l}),aV({arrowWidth:O,arrowHeight:D}),p&&FH({strategy:"referenceHidden",...R})]}),[z,W]=C8(V),U=xg(g);ei(()=>{H&&U?.()},[H,U]);const X=$.arrow?.x,Y=$.arrow?.y,ae=$.arrow?.centerOffset!==0,[G,ee]=m.useState();return ei(()=>{v&&ee(window.getComputedStyle(v).zIndex)},[v]),i.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:H?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[$.transformOrigin?.x,$.transformOrigin?.y].join(" "),...$.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(eV,{scope:r,placedSide:z,onArrowChange:E,arrowX:X,arrowY:Y,shouldHideArrow:ae,children:i.jsx(ui.div,{"data-side":z,"data-align":W,...b,ref:N,style:{...b.style,animation:H?void 0:"none"}})})})});N8.displayName=gN;var E8="PopperArrow",rV={top:"bottom",right:"left",bottom:"top",left:"right"},S8=m.forwardRef(function(e,t){const{__scopePopper:r,...n}=e,a=tV(E8,r),o=rV[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(Zq,{...n,ref:t,style:{...n.style,display:"block"}})})});S8.displayName=E8;function nV(e){return e!==null}var aV=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,o=a.arrow?.centerOffset!==0,s=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[c,u]=C8(r),d={start:"0%",center:"50%",end:"100%"}[u],f=(a.arrow?.x??0)+s/2,p=(a.arrow?.y??0)+l/2;let h="",g="";return c==="bottom"?(h=o?d:`${f}px`,g=`${-l}px`):c==="top"?(h=o?d:`${f}px`,g=`${n.floating.height+l}px`):c==="right"?(h=`${-l}px`,g=o?d:`${p}px`):c==="left"&&(h=`${n.floating.width+l}px`,g=o?d:`${p}px`),{data:{x:h,y:g}}}});function C8(e){const[t,r="center"]=e.split("-");return[t,r]}var oV=k8,sV=j8,iV=N8,lV=S8,cV="Portal",O8=m.forwardRef((e,t)=>{const{container:r,...n}=e,[a,o]=m.useState(!1);ei(()=>o(!0),[]);const s=r||a&&globalThis?.document?.body;return s?xF.createPortal(i.jsx(ui.div,{...n,ref:t}),s):null});O8.displayName=cV;function uV(e,t){return m.useReducer((r,n)=>t[r][n]??r,e)}var bN=e=>{const{present:t,children:r}=e,n=dV(t),a=typeof r=="function"?r({present:n.isPresent}):m.Children.only(r),o=hl(n.ref,fV(a));return typeof r=="function"||n.isPresent?m.cloneElement(a,{ref:o}):null};bN.displayName="Presence";function dV(e){const[t,r]=m.useState(),n=m.useRef(null),a=m.useRef(e),o=m.useRef("none"),s=e?"mounted":"unmounted",[l,c]=uV(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const u=Om(n.current);o.current=l==="mounted"?u:"none"},[l]),ei(()=>{const u=n.current,d=a.current;if(d!==e){const f=o.current,p=Om(u);e?c("MOUNT"):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&f!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),ei(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=h=>{const g=Om(n.current).includes(CSS.escape(h.animationName));if(h.target===t&&g&&(c("ANIMATION_END"),!a.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},p=h=>{h.target===t&&(o.current=Om(n.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function Om(e){return e?.animationName||"none"}function fV(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var mV=Xs[" useInsertionEffect ".trim().toString()]||ei;function pV({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,o,s]=hV({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:a;{const d=m.useRef(e!==void 0);m.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${n} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,n])}const u=m.useCallback(d=>{if(l){const f=gV(d)?d(e):d;f!==e&&s.current?.(f)}else o(d)},[l,e,o,s]);return[c,u]}function hV({defaultProp:e,onChange:t}){const[r,n]=m.useState(e),a=m.useRef(r),o=m.useRef(t);return mV(()=>{o.current=t},[t]),m.useEffect(()=>{a.current!==r&&(o.current?.(r),a.current=r)},[r,a]),[r,n,o]}function gV(e){return typeof e=="function"}var bV=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),yV="VisuallyHidden",P8=m.forwardRef((e,t)=>i.jsx(ui.span,{...e,ref:t,style:{...bV,...e.style}}));P8.displayName=yV;var xV=P8,[vg]=f8("Tooltip",[x8]),kg=x8(),A8="TooltipProvider",vV=700,Dw="tooltip.open",[kV,yN]=vg(A8),M8=e=>{const{__scopeTooltip:t,delayDuration:r=vV,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:o}=e,s=m.useRef(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),i.jsx(kV,{scope:t,isOpenDelayedRef:s,delayDuration:r,onOpen:m.useCallback(()=>{window.clearTimeout(c.current),s.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(u=>{l.current=u},[]),disableHoverableContent:a,children:o})};M8.displayName=A8;var _d="Tooltip",[wV,If]=vg(_d),T8=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:o,disableHoverableContent:s,delayDuration:l}=e,c=yN(_d,e.__scopeTooltip),u=kg(t),[d,f]=m.useState(null),p=Xq(),h=m.useRef(0),g=s??c.disableHoverableContent,b=l??c.delayDuration,y=m.useRef(!1),[v,k]=pV({prop:n,defaultProp:a??!1,onChange:O=>{O?(c.onOpen(),document.dispatchEvent(new CustomEvent(Dw))):c.onClose(),o?.(O)},caller:_d}),N=m.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),w=m.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,k(!0)},[k]),E=m.useCallback(()=>{window.clearTimeout(h.current),h.current=0,k(!1)},[k]),C=m.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,k(!0),h.current=0},b)},[b,k]);return m.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),i.jsx(oV,{...u,children:i.jsx(wV,{scope:t,contentId:p,open:v,stateAttribute:N,trigger:d,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{c.isOpenDelayedRef.current?C():w()},[c.isOpenDelayedRef,C,w]),onTriggerLeave:m.useCallback(()=>{g?E():(window.clearTimeout(h.current),h.current=0)},[E,g]),onOpen:w,onClose:E,disableHoverableContent:g,children:r})})};T8.displayName=_d;var Lw="TooltipTrigger",_8=m.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=If(Lw,r),o=yN(Lw,r),s=kg(r),l=m.useRef(null),c=hl(t,l,a.onTriggerChange),u=m.useRef(!1),d=m.useRef(!1),f=m.useCallback(()=>u.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),i.jsx(sV,{asChild:!0,...s,children:i.jsx(ui.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:c,onPointerMove:Uo(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:Uo(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:Uo(e.onPointerDown,()=>{a.open&&a.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Uo(e.onFocus,()=>{u.current||a.onOpen()}),onBlur:Uo(e.onBlur,a.onClose),onClick:Uo(e.onClick,a.onClose)})})});_8.displayName=Lw;var xN="TooltipPortal",[jV,NV]=vg(xN,{forceMount:void 0}),I8=e=>{const{__scopeTooltip:t,forceMount:r,children:n,container:a}=e,o=If(xN,t);return i.jsx(jV,{scope:t,forceMount:r,children:i.jsx(bN,{present:r||o.open,children:i.jsx(O8,{asChild:!0,container:a,children:n})})})};I8.displayName=xN;var xc="TooltipContent",D8=m.forwardRef((e,t)=>{const r=NV(xc,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...o}=e,s=If(xc,e.__scopeTooltip);return i.jsx(bN,{present:n||s.open,children:s.disableHoverableContent?i.jsx(L8,{side:a,...o,ref:t}):i.jsx(EV,{side:a,...o,ref:t})})}),EV=m.forwardRef((e,t)=>{const r=If(xc,e.__scopeTooltip),n=yN(xc,e.__scopeTooltip),a=m.useRef(null),o=hl(t,a),[s,l]=m.useState(null),{trigger:c,onClose:u}=r,d=a.current,{onPointerInTransitChange:f}=n,p=m.useCallback(()=>{l(null),f(!1)},[f]),h=m.useCallback((g,b)=>{const y=g.currentTarget,v={x:g.clientX,y:g.clientY},k=PV(v,y.getBoundingClientRect()),N=AV(v,k),w=MV(b.getBoundingClientRect()),E=_V([...N,...w]);l(E),f(!0)},[f]);return m.useEffect(()=>()=>p(),[p]),m.useEffect(()=>{if(c&&d){const g=y=>h(y,d),b=y=>h(y,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",b)}}},[c,d,h,p]),m.useEffect(()=>{if(s){const g=b=>{const y=b.target,v={x:b.clientX,y:b.clientY},k=c?.contains(y)||d?.contains(y),N=!TV(v,s);k?p():N&&(p(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,s,u,p]),i.jsx(L8,{...e,ref:o})}),[SV,CV]=vg(_d,{isInside:!1}),OV=_q("TooltipContent"),L8=m.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:s,...l}=e,c=If(xc,r),u=kg(r),{onClose:d}=c;return m.useEffect(()=>(document.addEventListener(Dw,d),()=>document.removeEventListener(Dw,d)),[d]),m.useEffect(()=>{if(c.trigger){const f=p=>{p.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),i.jsx(h8,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:i.jsxs(iV,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[i.jsx(OV,{children:n}),i.jsx(SV,{scope:r,isInside:!0,children:i.jsx(xV,{id:c.contentId,role:"tooltip",children:a||n})})]})})});D8.displayName=xc;var R8="TooltipArrow",F8=m.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=kg(r);return CV(R8,r).isInside?null:i.jsx(lV,{...a,...n,ref:t})});F8.displayName=R8;function PV(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,a,o)){case o:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function AV(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function MV(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function TV(e,t){const{x:r,y:n}=e;let a=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const l=t[o],c=t[s],u=l.x,d=l.y,f=c.x,p=c.y;d>n!=p>n&&r<(f-u)*(n-d)/(p-d)+u&&(a=!a)}return a}function _V(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),IV(t)}function IV(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const a=e[n];for(;t.length>=2;){const o=t[t.length-1],s=t[t.length-2];if((o.x-s.x)*(a.y-s.y)>=(o.y-s.y)*(a.x-s.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const o=r[r.length-1],s=r[r.length-2];if((o.x-s.x)*(a.y-s.y)>=(o.y-s.y)*(a.x-s.x))r.pop();else break}r.push(a)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var DV=M8,LV=T8,RV=_8,FV=I8,$V=D8,BV=F8;function ya(...e){return e.filter(Boolean).join(" ")}const Df=x.forwardRef(({children:e,className:t,content:r,delayDuration:n,defaultOpen:a,open:o,onClick:s,onOpenChange:l,showArrow:c=!0,side:u,sideOffset:d=10,asChild:f,...p},h)=>i.jsx(DV,{delayDuration:150,children:i.jsxs(LV,{open:o,defaultOpen:a,onOpenChange:l,delayDuration:n,"tremor-id":"tremor-raw",children:[i.jsx(RV,{onClick:s,asChild:f,children:e}),i.jsx(FV,{children:i.jsxs($V,{ref:h,side:u,sideOffset:d,align:"center",className:ya("max-w-60 select-none rounded-md px-2.5 py-1.5 text-sm leading-5 shadow-md","text-gray-50 dark:text-gray-900","bg-gray-900 dark:bg-gray-50","will-change-[transform,opacity]","data-[side=bottom]:animate-slide-down-and-fade data-[side=left]:animate-slide-left-and-fade data-[side=right]:animate-slide-right-and-fade data-[side=top]:animate-slide-up-and-fade data-[state=closed]:animate-hide",t),...p,children:[r,c&&i.jsx(BV,{className:"border-none fill-gray-900 dark:fill-gray-50",width:12,height:7,"aria-hidden":"true"})]})})]})}));Df.displayName="Tooltip";function HV({operation:e,onClick:t}){const r=e?.meta?.inspectr?.guard||{},n=e?.request?.headers||[],a=({children:s})=>i.jsxs("span",{onClick:t,className:"py-1 px-1.5 inline-flex items-center gap-x-1 text-xs font-medium bg-blue-100 text-blue-800 rounded-md dark:bg-blue-500/10 dark:text-blue-500 cursor-pointer select-none hover:ring-1 ring-blue-300",children:[i.jsxs("svg",{className:"shrink-0 h-3 w-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),i.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),s]});if(r["inspectr-auth-token"])return i.jsx(a,{children:"Guard Token"});if(r["inspectr-auth-key"])return i.jsx(a,{children:"Guard Key"});if(n.find(s=>{const l=s?.name;return l?l.toLowerCase().replace(/[^a-z]/g,"").includes("apikey"):!1}))return i.jsx(a,{children:"API Key"});const o=n.find(s=>s.name&&s.name.toLowerCase()==="authorization");if(o&&o.value){const s=o.value.toLowerCase();return s.startsWith("basic")?i.jsx(a,{children:"Basic Auth"}):s.startsWith("bearer")?i.jsx(a,{children:"Bearer"}):i.jsx(a,{children:"Auth"})}return null}const $8=({mcp:e,showCategory:t=!1,showToolName:r=!1,showMethod:n=!1,onClick:a})=>{if(!e)return null;const{category:o,tool_name:s,method:l}=e;return i.jsxs("span",{onClick:a,role:a?"button":void 0,tabIndex:a?0:void 0,className:`inline-flex items-center gap-2 rounded-full bg-sky-100 px-3 py-1 text-xs font-semibold uppercase tracking-wide text-sky-700 dark:bg-sky-900/40 dark:text-sky-200 ${a?"cursor-pointer hover:ring-2 hover:ring-sky-200 focus:outline-none focus:ring-2 focus:ring-sky-300":""}`,children:[i.jsx("span",{children:"MCP"}),t&&o?i.jsx("span",{className:"rounded bg-white px-1 py-0.5 text-[10px] font-semibold uppercase text-sky-700 shadow-sm dark:bg-sky-900/60 dark:text-sky-100",children:o}):null,r&&s?i.jsx("span",{className:"font-mono text-[11px] normal-case text-sky-800 dark:text-sky-100",children:s}):null,n&&l?i.jsx("span",{className:"text-[11px] normal-case text-sky-600 dark:text-sky-200",children:l}):null]})};function wg({open:e,rule:t,isDeleting:r,error:n,onCancel:a,onConfirm:o,title:s,description:l,confirmLabel:c}){if(!e)return null;const u=s||"Delete rule?",d=l||i.jsxs(i.Fragment,{children:["This will permanently remove ",i.jsx("span",{className:"font-medium",children:t?.name||"this rule"}),". Actions triggered by this rule will no longer run."]}),f=c||"Delete Rule";return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:i.jsxs("div",{className:"w-full max-w-md rounded-lg border border-gray-200 bg-white p-6 shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:u}),i.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:d}),n&&i.jsx("p",{className:"mt-3 text-sm text-red-600 dark:text-red-400",children:n}),i.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[i.jsx("button",{type:"button",onClick:a,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",disabled:r,children:"Cancel"}),i.jsx("button",{type:"button",onClick:o,disabled:r,className:"inline-flex items-center rounded-md border border-transparent bg-red-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-300 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-red-500 dark:hover:bg-red-400",children:r?"Deleting…":f})]})]})})}function sl({tag:e,showRemove:t=!1,onRemove:r,removeLabel:n="Remove tag"}){const a=typeof e=="string"?yc(e):e;if(!a)return null;const o=()=>{t&&r?.(a)},s=t?i.jsx("button",{type:"button",onClick:o,className:"inline-flex size-4 -mr-1.5 p-0.5 items-center justify-center rounded-full text-[11px] font-semibold text-red-700 transition hover:bg-red-50 focus:outline-none dark:text-red-300 dark:hover:bg-red-950","aria-label":`${n} ${a.display}`.trim(),title:`${n} ${a.display}`.trim(),children:i.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{"fill-rule":"evenodd",d:`M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414
16
- 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293
17
- 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z`,"clip-rule":"evenodd"})})}):null;return a.type==="kv"?i.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-slate-100 pl-2.5 pr-2.5 py-1 text-xs text-slate-700 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content",children:[i.jsxs("span",{className:"font-semibold uppercase tracking-wide text-[10px] text-slate-500 dark:text-dark-tremor-content",children:[a.key,":"]}),i.jsx("span",{className:"font-mono text-[11px] text-slate-700 dark:text-dark-tremor-content",children:a.value}),s]}):i.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-slate-100 pl-2.5 pr-2.5 py-1 font-mono text-[11px] font-medium text-slate-700 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content",children:[a.display,s]})}const vN="flex items-center space-x-2 border border-slate-600 dark:border-blue-500 text-slate-700 dark:text-white bg-slate-100 dark:bg-blue-600 rounded focus:outline-none cursor-pointer transition-transform duration-150 ease-in-out active:scale-95 hover:bg-slate-200 dark:hover:bg-blue-700 active:ring active:ring-slate-300 dark:active:ring-blue-400",m5=`${vN} px-2 py-1`,p5=`${vN} px-2 py-1 rounded-r-none border-r-0`,h5=`${vN} px-1 py-1 rounded-l-none`,zV="flex items-center space-x-2 px-2 py-1 border border-purple-500 text-purple-600 dark:text-purple-200 bg-purple-50 dark:bg-purple-900/30 rounded focus:outline-none cursor-pointer transition-transform duration-150 ease-in-out active:scale-95 hover:bg-purple-100 dark:hover:bg-purple-800/50 active:ring active:ring-purple-200 dark:active:ring-purple-400",Pm=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})}),UV=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"h-4 w-4",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M7.5 10.5L12 15m0 0l4.5-4.5M12 15V3"})}),qV=()=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"h-4 w-4",children:[i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.91 11.672a.375.375 0 0 1 0 .656l-5.603 3.113a.375.375 0 0 1-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112Z"})]}),VV=({className:e=""})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:`h-4 w-4 ${e}`,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"})}),WV=({className:e="",...t})=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",...t,children:[i.jsx("path",{d:"M10 6h8"}),i.jsx("path",{d:"M12 16h6"}),i.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),i.jsx("path",{d:"M8 11h7"})]}),wy=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"h-4 w-4",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})}),g5=()=>i.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",className:"w-3 h-3",children:i.jsx("path",{d:"M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z",fill:"currentColor"})}),b5=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4 text-slate-600 dark:text-white",children:i.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.293l3.71-4.06a.75.75 0 1 1 1.1 1.02l-4.25 4.65a.75.75 0 0 1-1.1 0l-4.25-4.65a.75.75 0 0 1 .02-1.06Z",clipRule:"evenodd"})});function KV({hasTrace:e=!1,traceHref:t=null,onViewTrace:r,onDownload:n,onCopyCurl:a,onCopyInspectrCurl:o,onCopyOperation:s,copyActionKey:l="curl",onCopyActionChange:c,copiedCurl:u=!1,copiedOperation:d=!1,hasInspectrCurl:f=!1,onReplay:p,replayTarget:h="original",onReplayTargetChange:g,hasProxy:b=!1,replayed:y=!1,onRefresh:v,isRefreshing:k=!1}){const N=l==="curl",w=l==="proxy_curl",E=N||w?u:d,C=w?"Copy Proxy cURL":N?"Copy cURL":"Copy Operation",O=N||w?"Copied cURL":"Copied Operation",D=N||w?i.jsx(wy,{}):i.jsx(g5,{}),A=w?o:N?a:s,M=typeof v=="function",I=h==="original",T=I?"Replay to original host":"Replay via Inspectr",R=e?"text-xs hidden [@container(min-width:620px)]:inline":"text-xs hidden [@container(min-width:520px)]:inline";return i.jsxs("div",{className:"flex space-x-2",children:[e?i.jsxs("a",{href:t||"#traces",onClick:L=>{typeof r=="function"&&t&&window.location.hash===t&&(L.preventDefault(),r())},className:zV,children:[i.jsx(WV,{className:"h-4 w-4"}),i.jsx("span",{className:R,children:"View trace"})]}):null,i.jsx("button",{onClick:n,className:m5,"aria-label":"Export as JSON",children:i.jsx(UV,{})}),i.jsxs("div",{className:"relative flex",children:[i.jsxs("button",{onClick:A,className:p5,children:[E?i.jsx(Pm,{}):D,i.jsx("span",{className:R,children:E?O:C})]}),i.jsxs(s5,{children:[i.jsx(Tw,{className:h5,"aria-label":"Select copy action",children:i.jsx(b5,{})}),i.jsxs(_w,{className:"absolute right-0 top-full z-20 mt-1 w-48 rounded-lg border border-slate-200 bg-white p-1 text-sm text-slate-700 shadow-lg focus:outline-none dark:border-dark-tremor-border dark:bg-dark-tremor-background dark:text-dark-tremor-content",children:[i.jsx(Bl,{children:i.jsxs("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 data-[focus]:bg-slate-100 dark:data-[focus]:bg-dark-tremor-background-subtle",onClick:()=>c?.("curl"),children:[i.jsx(wy,{}),"Copy cURL"]})}),f?i.jsx(Bl,{children:i.jsxs("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 data-[focus]:bg-slate-100 dark:data-[focus]:bg-dark-tremor-background-subtle",onClick:()=>c?.("proxy_curl"),children:[i.jsx(wy,{}),"Copy Proxy cURL"]})}):null,i.jsx(Bl,{children:i.jsxs("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 data-[focus]:bg-slate-100 dark:data-[focus]:bg-dark-tremor-background-subtle",onClick:()=>c?.("operation"),children:[i.jsx(g5,{}),"Copy Operation"]})})]})]})]}),i.jsxs("div",{className:"relative flex",children:[i.jsxs("button",{onClick:p,className:p5,"aria-label":T,children:[y?i.jsx(Pm,{}):i.jsx(qV,{}),i.jsx("span",{className:R,children:y?"Replayed":"Replay"})]}),i.jsxs(s5,{children:[i.jsx(Tw,{className:h5,"aria-label":"Select replay target",children:i.jsx(b5,{})}),i.jsxs(_w,{className:"absolute right-0 top-full z-20 mt-1 w-44 rounded-lg border border-slate-200 bg-white p-1 text-sm text-slate-700 shadow-lg focus:outline-none dark:border-dark-tremor-border dark:bg-dark-tremor-background dark:text-dark-tremor-content",children:[i.jsx(Bl,{children:i.jsxs("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-right data-[focus]:bg-slate-100 dark:data-[focus]:bg-dark-tremor-background-subtle",onClick:()=>g?.("original"),children:[I?i.jsx(Pm,{}):null,"Replay to host"]})}),i.jsx(Bl,{disabled:!b,children:i.jsxs("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-right data-[focus]:bg-slate-100 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 dark:data-[focus]:bg-dark-tremor-background-subtle",onClick:()=>g?.("proxy"),disabled:!b,children:[I?null:i.jsx(Pm,{}),"Replay via Inspectr ",b?"":" (unavailable)"]})})]})]})]}),M?i.jsx("button",{onClick:v,className:m5,"aria-label":"Refresh operation",children:i.jsx(VV,{className:k?"animate-spin":""})}):null]})}const YV=new Set(["content-length","transfer-encoding","connection","keep-alive","host","te","trailer","upgrade","proxy-connection","via","forwarded","x-forwarded-for","x-forwarded-host","x-forwarded-proto","x-real-ip","user-agent","origin","referer","dnt","postman-token"]),XV=["sec-fetch-","sec-ch-ua"],GV=e=>{if(!e)return!1;const t=e.toLowerCase();return YV.has(t)?!1:!XV.some(r=>t.startsWith(r))},ZV=({operation:e,setCurrentTab:t,onRefresh:r,isRefreshing:n=!1})=>{const{client:a,setToast:o,proxyEndpoint:s}=fr(),[l,c]=m.useState(!1),[u,d]=m.useState(!1),[f,p]=m.useState(!1),[h,g]=m.useState(!1),[b,y]=m.useState(!1),[v,k]=m.useState(!1),[N,w]=dr("copyActionPreference","curl"),[E,C]=dr("replayTargetPreference","original"),O=N==="operation"?"operation":N==="proxy_curl"?"proxy_curl":"curl",D=E==="proxy"?"proxy":"original",[A,M]=m.useState(()=>e?.meta?.tags||[]);m.useEffect(()=>{M(e?.meta?.tags||[])},[e?.id,e?.operation_id,e?.meta?.tags]);const[I,T]=m.useState(null),[R,L]=m.useState(!1),[F,V]=m.useState(""),H=()=>{if(!e?.request)return{headers:0,body:0,total:0};const ke=e.request.headers_size||0,Ie=e.request.body_size||0;return{headers:ke,body:Ie,total:ke+Ie}},$=()=>{if(!e?.response)return{headers:0,body:0,total:0};const ke=e.response.headers_size||0,Ie=e.response.body_size||0;return{headers:ke,body:Ie,total:ke+Ie}},z=H(),W=$(),U=_f(A),X=U.length>0,Y=!!(s||e?.meta?.proxy?.url),ae=!!e?.meta?.proxy?.url;m.useEffect(()=>{!Y&&E==="proxy"&&C("original")},[Y,E,C]),m.useEffect(()=>{!ae&&N==="proxy_curl"&&w("curl")},[N,ae,w]);const G=ke=>{if(!e?.request)return;const{request:Ie}=e,{method:qe,url:nt,headers:dt=[],body:wt}=Ie;let pt=`curl -X ${qe} '${ke||nt}'`;return dt.filter(Le=>GV(Le?.name)).forEach(Le=>{pt+=` -H '${Le.name}: ${Le.value}'`}),wt&&(pt+=` --data '${wt}'`),pt},ee=()=>{const ke=G();navigator.clipboard.writeText(ke).then(()=>{c(!0),setTimeout(()=>c(!1),2500)}).catch(Ie=>{console.error("[Inspectr] Failed to copy cURL command:",Ie),p(!0)})},re=()=>{const ke=e?.meta?.proxy?.url;if(!ke||!e?.request?.url)return null;try{const Ie=new URL(ke),qe=new URL(e.request.url);return Ie.pathname=qe.pathname||Ie.pathname,Ie.search=qe.search,Ie.toString()}catch(Ie){return console.warn("[Inspectr] Failed to build Inspectr cURL URL:",Ie),ke}},pe=()=>{const ke=re();if(!ke)return;const Ie=G(ke);navigator.clipboard.writeText(Ie).then(()=>{c(!0),setTimeout(()=>c(!1),2500)}).catch(qe=>{console.error("[Inspectr] Failed to copy Inspectr cURL command:",qe),p(!0)})},te=()=>{try{const ke=e?{...e}:{},Ie=JSON.stringify(ke,null,2);navigator.clipboard.writeText(Ie).then(()=>{d(!0),setTimeout(()=>d(!1),2500)}).catch(qe=>{console.error("[Inspectr] Failed to copy operation JSON:",qe),o?.({type:"error",message:"Failed to copy operation",subMessage:qe?.message||"Unable to copy the operation details."})})}catch(ke){console.error("[Inspectr] Failed to copy operation JSON:",ke),o?.({type:"error",message:"Failed to copy operation",subMessage:ke?.message||"Unable to copy the operation details."})}},se=()=>{navigator.clipboard.writeText(e.request.url).then(()=>{g(!0)}).catch(ke=>{console.error("[Inspectr] Failed to copy URL:",ke)})},ne=()=>{a.operations.replay(e,{replayTarget:D}).then(()=>{k(!0),setTimeout(()=>k(!1),2500)}).catch(ke=>{console.error("[Inspectr] Failed to replay request:",ke),y(!0)})},K=()=>{try{const ke=e?{...e}:{},Ie=JSON.stringify(ke,null,2),qe=new Blob([Ie],{type:"application/json"}),nt=`operation_${e?.id?String(e.id):String(Date.now())}.json`,dt=URL.createObjectURL(qe),wt=document.createElement("a");wt.href=dt,wt.download=nt,document.body.appendChild(wt),wt.click(),wt.remove(),URL.revokeObjectURL(dt)}catch(ke){console.error("[Inspectr] Failed to download operation JSON:",ke)}},ge=ke=>{T(ke),V("")},ye=()=>{T(null),V("")},me=async()=>{if(!I)return;const ke=e?.operation_id??e?.id;if(!a?.operations||!ke){V("Operation or client not available");return}try{L(!0),V(""),await a.operations.deleteOperationTags(ke,{tag:I.raw});const Ie=I.token||yc(I.raw)?.token;M(qe=>Array.isArray(qe)?qe.filter(nt=>{const dt=yc(nt);return!dt||dt.token!==Ie}):[]),o?.({type:"success",message:`Tag "${I.display}" removed from this operation`}),T(null)}catch(Ie){console.error("Delete operation tag failed",Ie),V(Ie?.message||"Failed to delete tag"),o?.({type:"error",message:Ie?.message||"Failed to delete tag"})}finally{L(!1)}},Se=e?.meta?.trace||null,Re=Se?.trace_id||null,Te=e?.operation_id||e?.id||null,Je=Re?encodeURIComponent(Re):null,rt=Te?encodeURIComponent(Te):null,De=Je?`#traces/${Je}${rt?`/${rt}`:""}`:null;Se?.source;const ut=e?.meta?.mcp,ct=ut&&typeof ut=="object"&&Object.keys(ut).some(ke=>ut[ke]!==void 0)?ut:null,Nt=!!Re,yt=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"h-4 w-4",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})}),ft=()=>{const ke=e?.meta?.inspectr?.guard||{},Ie=ke["inspectr-auth-key"],qe=ke["inspectr-auth-token"];if(Ie||qe){typeof t=="function"&&t("meta"),setTimeout(()=>{window.dispatchEvent(new CustomEvent("inspectr:openMetaGuard",{detail:{name:qe?"inspectr-auth-token":"inspectr-auth-key"}}))},150);return}typeof t=="function"?(t("request"),setTimeout(()=>{window.dispatchEvent(new CustomEvent("inspectr:openRequestHeaders"))},50)):window.dispatchEvent(new CustomEvent("inspectr:openRequestHeaders"))},Ct=()=>{if(!De)return;const ke=De;window.location.hash===ke?window.dispatchEvent(new HashChangeEvent("hashchange")):window.location.hash=ke},Ae=()=>{typeof t=="function"&&t("mcp")};return i.jsxs("div",{className:"mb-4 p-4 bg-white dark:bg-dark-tremor-background border border-gray-300 dark:border-dark-tremor-border rounded shadow dark:shadow-dark-tremor-shadow relative [container-type:inline-size] [container-name:requestdetail] ",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"font-bold text-xl text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Request Details"}),i.jsx(HV,{operation:e,onClick:ft}),i.jsx($8,{mcp:ct,showCategory:!0,onClick:Ae})]}),i.jsx(KV,{hasTrace:Nt,traceHref:De,onViewTrace:Ct,onDownload:K,onCopyCurl:ee,onCopyInspectrCurl:pe,onCopyOperation:te,copyActionKey:O,onCopyActionChange:w,copiedCurl:l,copiedOperation:u,hasInspectrCurl:ae,onReplay:ne,replayTarget:D,onReplayTargetChange:C,hasProxy:Y,replayed:v,onRefresh:r,isRefreshing:n})]}),i.jsxs("div",{className:"flex flex-col space-y-1",children:[i.jsxs("div",{className:"flex items-center space-x-2 font-mono text-base",children:[i.jsx("span",{className:`font-bold ${Nf(e?.request?.method)}`,children:e?.request?.method}),i.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:e?.request?.path}),i.jsx("span",{className:`inline-flex px-3 py-1 text-xs font-semibold rounded-full ${Qc(e?.response?.status)}`,children:e?.response?.status}),i.jsx("span",{className:"text-sm dark:text-dark-tremor-content",children:e?.response?.status_text})]}),i.jsxs("div",{className:"flex items-center text-gray-600 dark:text-dark-tremor-content",children:[i.jsx("span",{onClick:se,className:"cursor-pointer",children:e?.request?.url}),i.jsx(on,{textToCopy:e.request.url,showLabel:!1})]}),i.jsxs("div",{className:"text-gray-500 dark:text-dark-tremor-content text-xs",children:["Received on"," ",i.jsx("span",{className:"font-semibold",children:Tn(e?.request?.timestamp)})," • Took ",i.jsx("span",{className:"font-semibold",children:Yn(e?.timing?.duration)})," ","to respond •",i.jsxs(vy,{className:"relative inline-block",children:[i.jsxs("span",{className:"flex items-center pl-1",children:["size",i.jsx("span",{className:"font-semibold pl-1",children:Ei(W.total)}),i.jsx(vy.Button,{className:"cursor-pointer pl-1",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"12",height:"12",children:i.jsx("path",{d:"M20 22H4C3.44772 22 3 21.5523 3 21V3C3 2.44772 3.44772 2 4 2H20C20.5523 2 21 2.44772 21 3V21C21 21.5523 20.5523 22 20 22ZM19 20V4H5V20H19ZM8 7H16V9H8V7ZM8 11H16V13H8V11ZM8 15H16V17H8V15Z"})})})]}),i.jsx(vy.Panel,{className:"absolute z-10 mt-2 w-72 -translate-x-1/2 transform px-4 sm:px-0",children:i.jsxs("div",{className:"rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 bg-white dark:bg-dark-tremor-background p-3",children:[i.jsx("div",{className:"text-sm font-semibold mb-2",children:"Request Size"}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[i.jsx("div",{children:"Total:"}),i.jsx("div",{className:"font-mono text-right",children:Ei(z.total)}),i.jsx("div",{children:"Headers:"}),i.jsx("div",{className:"font-mono text-right",children:Ei(z.headers)}),i.jsx("div",{children:"Body:"}),i.jsx("div",{className:"font-mono text-right",children:Ei(z.body)})]}),i.jsx("div",{className:"text-sm font-semibold mt-3 mb-2",children:"Response Size"}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[i.jsx("div",{children:"Total:"}),i.jsx("div",{className:"font-mono text-right",children:Ei(W.total)}),i.jsx("div",{children:"Headers:"}),i.jsx("div",{className:"font-mono text-right",children:Ei(W.headers)}),i.jsx("div",{children:"Body:"}),i.jsx("div",{className:"font-mono text-right",children:Ei(W.body)})]})]})})]}),e?.meta?.proxy?.url&&i.jsxs(i.Fragment,{children:[i.jsx("span",{children:" • Proxy "}),i.jsx("div",{className:"relative inline-block align-middle",children:i.jsx(Df,{side:"right",content:e.meta.proxy.url,children:i.jsx(yt,{className:"relative inline-block"})})})]})]})]}),X&&i.jsxs("div",{className:"mt-4",children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:"Tags"}),i.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:U.map(ke=>i.jsx(sl,{tag:ke,showRemove:!0,onRemove:()=>ge(ke)},ke.token||ke.display))})]}),i.jsx(wg,{open:!!I,isDeleting:R,error:F,onCancel:ye,onConfirm:me,title:"Remove tag from this operation?",description:I?i.jsxs(i.Fragment,{children:["This will remove the tag ",i.jsx("span",{className:"font-semibold",children:I.display})," ","from this operation. This action cannot be undone."]}):"",confirmLabel:"Remove Tag"}),f&&i.jsx(rp,{message:"Failed to copy cURL command!",subMessage:"Please try again.",onClose:()=>p(!1),type:"error"}),h&&i.jsx(rp,{message:"URL copied!",subMessage:"The request URL has been copied to your clipboard.",onClose:()=>g(!1)}),b&&i.jsx(rp,{message:"Replay failed!",subMessage:"Failed to replay the request. Please try again.",onClose:()=>y(!1),type:"error"})]})};function y5(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function JV(e){if(Array.isArray(e))return e}function QV(e,t,r){return(t=sW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eW(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function tW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
18
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function v5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?x5(Object(r),!0).forEach(function(n){QV(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x5(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rW(e,t){if(e==null)return{};var r,n,a=nW(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function nW(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function aW(e,t){return JV(e)||eW(e,t)||iW(e,t)||tW()}function oW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sW(e){var t=oW(e,"string");return typeof t=="symbol"?t:t+""}function iW(e,t){if(e){if(typeof e=="string")return y5(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y5(e,t):void 0}}function lW(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function w5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?k5(Object(r),!0).forEach(function(n){lW(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k5(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cW(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(a,o){return o(a)},n)}}function dd(e){return function t(){for(var r=this,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return a.length>=e.length?e.apply(this,a):function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return t.apply(r,[].concat(a,l))}}}function Pp(e){return{}.toString.call(e).includes("Object")}function uW(e){return!Object.keys(e).length}function Id(e){return typeof e=="function"}function dW(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function fW(e,t){return Pp(t)||Ws("changeType"),Object.keys(t).some(function(r){return!dW(e,r)})&&Ws("changeField"),t}function mW(e){Id(e)||Ws("selectorType")}function pW(e){Id(e)||Pp(e)||Ws("handlerType"),Pp(e)&&Object.values(e).some(function(t){return!Id(t)})&&Ws("handlersType")}function hW(e){e||Ws("initialIsRequired"),Pp(e)||Ws("initialType"),uW(e)&&Ws("initialContent")}function gW(e,t){throw new Error(e[t]||e.default)}var bW={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Ws=dd(gW)(bW),Am={changes:fW,selector:mW,handler:pW,initial:hW};function yW(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Am.initial(e),Am.handler(t);var r={current:e},n=dd(kW)(r,t),a=dd(vW)(r),o=dd(Am.changes)(e),s=dd(xW)(r);function l(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Am.selector(u),u(r.current)}function c(u){cW(n,a,o,s)(u)}return[l,c]}function xW(e,t){return Id(t)?t(e.current):t}function vW(e,t){return e.current=w5(w5({},e.current),t),t}function kW(e,t,r){return Id(t)?t(e.current):Object.keys(r).forEach(function(n){var a;return(a=t[n])===null||a===void 0?void 0:a.call(t,e.current[n])}),r}var wW={create:yW},jW={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function NW(e){return function t(){for(var r=this,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return a.length>=e.length?e.apply(this,a):function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return t.apply(r,[].concat(a,l))}}}function EW(e){return{}.toString.call(e).includes("Object")}function SW(e){return e||j5("configIsRequired"),EW(e)||j5("configType"),e.urls?(CW(),{paths:{vs:e.urls.monacoBase}}):e}function CW(){console.warn(B8.deprecation)}function OW(e,t){throw new Error(e[t]||e.default)}var B8={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
19
- You are using deprecated way of configuration.
20
-
21
- Instead of using
22
- monaco.config({ urls: { monacoBase: '...' } })
23
- use
24
- monaco.config({ paths: { vs: '...' } })
25
-
26
- For more please check the link https://github.com/suren-atoyan/monaco-loader#config
27
- `},j5=NW(OW)(B8),PW={config:SW},AW=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(a,o){return o(a)},n)}};function H8(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],H8(e[r],t[r]))}),v5(v5({},e),t)}var MW={type:"cancelation",msg:"operation is manually canceled"};function jy(e){var t=!1,r=new Promise(function(n,a){e.then(function(o){return t?a(MW):n(o)}),e.catch(a)});return r.cancel=function(){return t=!0},r}var TW=["monaco"],_W=wW.create({config:jW,isInitialized:!1,resolve:null,reject:null,monaco:null}),z8=aW(_W,2),Lf=z8[0],jg=z8[1];function IW(e){var t=PW.config(e),r=t.monaco,n=rW(t,TW);jg(function(a){return{config:H8(a.config,n),monaco:r}})}function DW(){var e=Lf(function(t){var r=t.monaco,n=t.isInitialized,a=t.resolve;return{monaco:r,isInitialized:n,resolve:a}});if(!e.isInitialized){if(jg({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),jy(Ny);if(window.monaco&&window.monaco.editor)return U8(window.monaco),e.resolve(window.monaco),jy(Ny);AW(LW,FW)($W)}return jy(Ny)}function LW(e){return document.body.appendChild(e)}function RW(e){var t=document.createElement("script");return e&&(t.src=e),t}function FW(e){var t=Lf(function(n){var a=n.config,o=n.reject;return{config:a,reject:o}}),r=RW("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function $W(){var e=Lf(function(r){var n=r.config,a=r.resolve,o=r.reject;return{config:n,resolve:a,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){var n=r.m||r;U8(n),e.resolve(n)},function(r){e.reject(r)})}function U8(e){Lf().monaco||jg({monaco:e})}function BW(){return Lf(function(e){var t=e.monaco;return t})}var Ny=new Promise(function(e,t){return jg({resolve:e,reject:t})}),q8={config:IW,init:DW,__getMonacoInstance:BW},HW={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Ey=HW,zW={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},UW=zW;function qW({children:e}){return x.createElement("div",{style:UW.container},e)}var VW=qW,WW=VW;function KW({width:e,height:t,isEditorReady:r,loading:n,_ref:a,className:o,wrapperProps:s}){return x.createElement("section",{style:{...Ey.wrapper,width:e,height:t},...s},!r&&x.createElement(WW,null,n),x.createElement("div",{ref:a,style:{...Ey.fullWidth,...!r&&Ey.hide},className:o}))}var YW=KW,V8=m.memo(YW);function XW(e){m.useEffect(e,[])}var W8=XW;function GW(e,t,r=!0){let n=m.useRef(!0);m.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var ia=GW;function yd(){}function ql(e,t,r,n){return ZW(e,n)||JW(e,t,r,n)}function ZW(e,t){return e.editor.getModel(K8(e,t))}function JW(e,t,r,n){return e.editor.createModel(t,r,n?K8(e,n):void 0)}function K8(e,t){return e.Uri.parse(t)}function QW({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:a,originalModelPath:o,modifiedModelPath:s,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:d="Loading...",options:f={},height:p="100%",width:h="100%",className:g,wrapperProps:b={},beforeMount:y=yd,onMount:v=yd}){let[k,N]=m.useState(!1),[w,E]=m.useState(!0),C=m.useRef(null),O=m.useRef(null),D=m.useRef(null),A=m.useRef(v),M=m.useRef(y),I=m.useRef(!1);W8(()=>{let F=q8.init();return F.then(V=>(O.current=V)&&E(!1)).catch(V=>V?.type!=="cancelation"&&console.error("Monaco initialization: error:",V)),()=>C.current?L():F.cancel()}),ia(()=>{if(C.current&&O.current){let F=C.current.getOriginalEditor(),V=ql(O.current,e||"",n||r||"text",o||"");V!==F.getModel()&&F.setModel(V)}},[o],k),ia(()=>{if(C.current&&O.current){let F=C.current.getModifiedEditor(),V=ql(O.current,t||"",a||r||"text",s||"");V!==F.getModel()&&F.setModel(V)}},[s],k),ia(()=>{let F=C.current.getModifiedEditor();F.getOption(O.current.editor.EditorOption.readOnly)?F.setValue(t||""):t!==F.getValue()&&(F.executeEdits("",[{range:F.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),F.pushUndoStop())},[t],k),ia(()=>{C.current?.getModel()?.original.setValue(e||"")},[e],k),ia(()=>{let{original:F,modified:V}=C.current.getModel();O.current.editor.setModelLanguage(F,n||r||"text"),O.current.editor.setModelLanguage(V,a||r||"text")},[r,n,a],k),ia(()=>{O.current?.editor.setTheme(u)},[u],k),ia(()=>{C.current?.updateOptions(f)},[f],k);let T=m.useCallback(()=>{if(!O.current)return;M.current(O.current);let F=ql(O.current,e||"",n||r||"text",o||""),V=ql(O.current,t||"",a||r||"text",s||"");C.current?.setModel({original:F,modified:V})},[r,t,a,e,n,o,s]),R=m.useCallback(()=>{!I.current&&D.current&&(C.current=O.current.editor.createDiffEditor(D.current,{automaticLayout:!0,...f}),T(),O.current?.editor.setTheme(u),N(!0),I.current=!0)},[f,u,T]);m.useEffect(()=>{k&&A.current(C.current,O.current)},[k]),m.useEffect(()=>{!w&&!k&&R()},[w,k,R]);function L(){let F=C.current?.getModel();l||F?.original?.dispose(),c||F?.modified?.dispose(),C.current?.dispose()}return x.createElement(V8,{width:h,height:p,isEditorReady:k,loading:d,_ref:D,className:g,wrapperProps:b})}var eK=QW;m.memo(eK);function tK(e){let t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}var rK=tK,Mm=new Map;function nK({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:a,path:o,theme:s="light",line:l,loading:c="Loading...",options:u={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:p=!1,width:h="100%",height:g="100%",className:b,wrapperProps:y={},beforeMount:v=yd,onMount:k=yd,onChange:N,onValidate:w=yd}){let[E,C]=m.useState(!1),[O,D]=m.useState(!0),A=m.useRef(null),M=m.useRef(null),I=m.useRef(null),T=m.useRef(k),R=m.useRef(v),L=m.useRef(),F=m.useRef(n),V=rK(o),H=m.useRef(!1),$=m.useRef(!1);W8(()=>{let U=q8.init();return U.then(X=>(A.current=X)&&D(!1)).catch(X=>X?.type!=="cancelation"&&console.error("Monaco initialization: error:",X)),()=>M.current?W():U.cancel()}),ia(()=>{let U=ql(A.current,e||n||"",t||a||"",o||r||"");U!==M.current?.getModel()&&(f&&Mm.set(V,M.current?.saveViewState()),M.current?.setModel(U),f&&M.current?.restoreViewState(Mm.get(o)))},[o],E),ia(()=>{M.current?.updateOptions(u)},[u],E),ia(()=>{!M.current||n===void 0||(M.current.getOption(A.current.editor.EditorOption.readOnly)?M.current.setValue(n):n!==M.current.getValue()&&($.current=!0,M.current.executeEdits("",[{range:M.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),M.current.pushUndoStop(),$.current=!1))},[n],E),ia(()=>{let U=M.current?.getModel();U&&a&&A.current?.editor.setModelLanguage(U,a)},[a],E),ia(()=>{l!==void 0&&M.current?.revealLine(l)},[l],E),ia(()=>{A.current?.editor.setTheme(s)},[s],E);let z=m.useCallback(()=>{if(!(!I.current||!A.current)&&!H.current){R.current(A.current);let U=o||r,X=ql(A.current,n||e||"",t||a||"",U||"");M.current=A.current?.editor.create(I.current,{model:X,automaticLayout:!0,...u},d),f&&M.current.restoreViewState(Mm.get(U)),A.current.editor.setTheme(s),l!==void 0&&M.current.revealLine(l),C(!0),H.current=!0}},[e,t,r,n,a,o,u,d,f,s,l]);m.useEffect(()=>{E&&T.current(M.current,A.current)},[E]),m.useEffect(()=>{!O&&!E&&z()},[O,E,z]),F.current=n,m.useEffect(()=>{E&&N&&(L.current?.dispose(),L.current=M.current?.onDidChangeModelContent(U=>{$.current||N(M.current.getValue(),U)}))},[E,N]),m.useEffect(()=>{if(E){let U=A.current.editor.onDidChangeMarkers(X=>{let Y=M.current.getModel()?.uri;if(Y&&X.find(ae=>ae.path===Y.path)){let ae=A.current.editor.getModelMarkers({resource:Y});w?.(ae)}});return()=>{U?.dispose()}}return()=>{}},[E,w]);function W(){L.current?.dispose(),p?f&&Mm.set(o,M.current.saveViewState()):M.current.getModel()?.dispose(),M.current.dispose()}return x.createElement(V8,{width:h,height:g,isEditorReady:E,loading:c,_ref:I,className:b,wrapperProps:y})}var aK=nK,oK=m.memo(aK),ns=oK;const sK=({open:e,onClose:t,decoded:r})=>{if(!e)return null;const n=JSON.stringify(r,null,2),a=o=>o?new Date(o*1e3).toLocaleString():"N/A";return i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 p-6 z-10 flex flex-col max-h-[94vh] overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("div",{className:"flex-shrink-0 bg-blue-100 rounded-full p-2",children:i.jsxs("svg",{className:"w-6 h-6",viewBox:"0 0 48 48",children:[i.jsx("polygon",{fill:"#546e7a",points:"21.906,31.772 24.507,29.048 27.107,31.772 27.107,43 21.906,43"}),i.jsx("polygon",{fill:"#f50057",points:"17.737,29.058 21.442,28.383 21.945,32.115 15.345,41.199 11.138,38.141"}),i.jsx("polygon",{fill:"#d500f9",points:"15.962,24.409 19.355,26.041 17.569,29.356 6.89,32.825 5.283,27.879"}),i.jsx("polygon",{fill:"#29b6f6",points:"17.256,19.607 19.042,22.922 15.649,24.554 4.97,21.084 6.577,16.137"}),i.jsx("polygon",{fill:"#00e5ff",points:"21.126,16.482 20.623,20.214 16.918,19.539 10.318,10.455 14.526,7.398"}),i.jsx("polygon",{fill:"#546e7a",points:"26.094,16.228 23.493,18.952 20.893,16.228 20.893,5 26.094,5"}),i.jsx("polygon",{fill:"#f50057",points:"30.262,18.943 26.558,19.618 26.055,15.886 32.654,6.802 36.862,9.859"}),i.jsx("polygon",{fill:"#d500f9",points:"32.039,23.59 28.645,21.958 30.431,18.643 41.11,15.174 42.717,20.12"}),i.jsx("polygon",{fill:"#29b6f6",points:"30.744,28.393 28.958,25.078 32.351,23.447 43.03,26.916 41.423,31.863"}),i.jsx("polygon",{fill:"#00e5ff",points:"26.874,31.518 27.378,27.786 31.082,28.461 37.682,37.545 33.474,40.602"})]})}),i.jsxs("div",{className:"ml-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Decoded JWT"}),i.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Below is the decoded JWT information."})]})]}),i.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800 focus:outline-none cursor-pointer","aria-label":"Close",children:"×"})]}),i.jsxs("div",{className:"relative mt-4 flex-1 min-h-0",children:[i.jsx("div",{className:"absolute top-2 right-2 z-10",children:i.jsx(on,{textToCopy:n})}),i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsx("pre",{className:"bg-gray-100 p-2 rounded text-xs text-gray-700 overflow-x-auto overflow-y-auto max-h-[70vh]",children:n}),r&&i.jsxs("div",{className:"mt-2 text-sm text-gray-600",children:[r?.payload?.iat&&i.jsxs("p",{children:["Issued At (iat): ",a(r.payload.iat)]}),r?.payload?.nbf&&i.jsxs("p",{children:["Not Before (nbf): ",a(r.payload.nbf)]}),r?.payload?.exp&&i.jsxs("p",{children:["Expires At (exp): ",a(r.payload.exp)]})]})]})]}),i.jsx("div",{className:"mt-4 flex justify-end",children:i.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Close"})})]})]})},as=e=>{e.editor.defineTheme("tremor-dark",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#334155","editor.foreground":"#e1e7ef"}})},os=()=>{if(typeof window<"u"){const e=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,t=document.documentElement.classList.contains("dark");if(e||t)return"tremor-dark"}return"light"},N5=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";return t},iK=e=>{try{const t=e.split(".");if(t.length!==3)return null;const r=JSON.parse(atob(N5(t[0]))),n=JSON.parse(atob(N5(t[1])));return{header:r,payload:n,signature:t[2]}}catch(t){return console.error("Failed to decode JWT:",t),null}},lK=e=>typeof e!="string"?!1:((e.startsWith("Bearer ")||e.startsWith("bearer "))&&(e=e.slice(7).trim()),/^[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+$/.test(e)),Sy=({open:e,className:t=""})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`h-4 w-4 text-tremor-content transition-transform dark:text-dark-tremor-content ${e?"rotate-180":"rotate-0"} ${t}`,"aria-hidden":"true",children:i.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.084l3.71-3.854a.75.75 0 0 1 1.08 1.04l-4.25 4.417a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z",clipRule:"evenodd"})}),cK=({operation:e})=>{const[t,r]=m.useState(!1),[n,a]=m.useState(!1),[o,s]=m.useState(!0),l=m.useRef(null);m.useEffect(()=>{const w=()=>{a(!0),setTimeout(()=>{l.current?.scrollIntoView({behavior:"smooth",block:"start"})},0)};return window.addEventListener("inspectr:openRequestHeaders",w),()=>window.removeEventListener("inspectr:openRequestHeaders",w)},[]);const[c,u]=m.useState(!1),[d,f]=m.useState(null),p=w=>w?Array.isArray(w)?w.map(E=>({name:E.name??E.key??"",value:E.value})):typeof w=="object"?"name"in w&&"value"in w?[{name:w.name,value:w.value}]:Object.entries(w).map(([E,C])=>({name:E,value:C})):[]:[],h=w=>{const E=w.startsWith("Bearer ")||w.startsWith("bearer ")?w.slice(7).trim():w,C=iK(E);C&&(f(C),u(!0))},g=(w,E)=>{if(!w)return null;const C=w.toLowerCase(),O=C.replace(/[^a-z]/g,"");if(C==="authorization"){const D=String(E||"").toLowerCase();return D.startsWith("basic")?"Basic":D.startsWith("bearer")?"Bearer":"Auth"}return O.includes("apikey")?"API Key":O.includes("inspectrauthkey")?"Key":O.includes("inspectrauthtoken")?"Token":null},b=({label:w})=>i.jsxs("span",{className:"ml-2 py-0.5 px-1.5 inline-flex items-center gap-x-1 text-[10px] font-medium bg-blue-100 text-blue-800 rounded-md dark:bg-blue-500/10 dark:text-blue-500",children:[i.jsxs("svg",{className:"shrink-0 h-3 w-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),i.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),w]}),y=(w,E=!1)=>w.map(C=>{const O=E?g(C.name,C.value):null;return i.jsxs("tr",{children:[i.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-slate-500 dark:text-dark-tremor-content text-xs",children:i.jsxs("div",{className:"flex items-center",children:[i.jsx("span",{children:C.name}),O&&i.jsx(b,{label:O})]})}),i.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-xs dark:text-dark-tremor-content",children:i.jsxs("div",{className:"flex flex-wrap items-center",children:[i.jsx("span",{className:"min-w-0 break-all flex-1",children:C.value}),lK(C.value)&&i.jsx("button",{onClick:()=>h(C.value),className:"ml-2 p-1 text-blue-500 dark:text-blue-400 text-xs border border-slate-600 dark:border-slate-500 rounded cursor-pointer",children:i.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 48 48",children:[i.jsx("polygon",{fill:"#546e7a",points:"21.906,31.772 24.507,29.048 27.107,31.772 27.107,43 21.906,43"}),i.jsx("polygon",{fill:"#f50057",points:"17.737,29.058 21.442,28.383 21.945,32.115 15.345,41.199 11.138,38.141"}),i.jsx("polygon",{fill:"#d500f9",points:"15.962,24.409 19.355,26.041 17.569,29.356 6.89,32.825 5.283,27.879"}),i.jsx("polygon",{fill:"#29b6f6",points:"17.256,19.607 19.042,22.922 15.649,24.554 4.97,21.084 6.577,16.137"}),i.jsx("polygon",{fill:"#00e5ff",points:"21.126,16.482 20.623,20.214 16.918,19.539 10.318,10.455 14.526,7.398"}),i.jsx("polygon",{fill:"#546e7a",points:"26.094,16.228 23.493,18.952 20.893,16.228 20.893,5 26.094,5"}),i.jsx("polygon",{fill:"#f50057",points:"30.262,18.943 26.558,19.618 26.055,15.886 32.654,6.802 36.862,9.859"}),i.jsx("polygon",{fill:"#d500f9",points:"32.039,23.59 28.645,21.958 30.431,18.643 41.11,15.174 42.717,20.12"}),i.jsx("polygon",{fill:"#29b6f6",points:"30.744,28.393 28.958,25.078 32.351,23.447 43.03,26.916 41.423,31.863"}),i.jsx("polygon",{fill:"#00e5ff",points:"26.874,31.518 27.378,27.786 31.082,28.461 37.682,37.545 33.474,40.602"})]})})]})})]},C.name)}),v=e.request.body,k=!v||typeof v=="object"&&Object.keys(v).length===0||typeof v=="string"&&(v.trim()===""||v.trim()==="{}"),N=w=>{try{const E=JSON.parse(w);return JSON.stringify(E,null,2)}catch{return w}};return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsxs("div",{className:`mb-4 border border-slate-200 dark:border-dark-tremor-border ${t?"rounded-tremor-small rounded-b-none":"rounded-tremor-small"}`,children:[i.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong cursor-pointer flex items-center justify-between",onClick:()=>r(!t),type:"button",children:[i.jsxs("span",{children:["Query Parameters (",(e?.request?.query_params??[]).length,")"]}),i.jsx(Sy,{open:t})]}),t&&i.jsx("div",{className:"p-0 border-t border-tremor-border dark:border-dark-tremor-border",children:i.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300 dark:border-dark-tremor-border",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100 dark:bg-blue-900/30",children:[i.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 w-1/4 text-sm text-left font-semibold text-gray-700 dark:text-white",children:"Key"}),i.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 text-sm text-left font-semibold text-gray-700 dark:text-white",children:"Value"})]})}),i.jsx("tbody",{children:y(e?.request?.query_params??[],!1)})]})})]}),i.jsxs("div",{className:`mb-4 border border-slate-200 dark:border-dark-tremor-border ${n?"rounded-tremor-small rounded-b-none":"rounded-tremor-small"}`,ref:l,children:[i.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong cursor-pointer flex items-center justify-between",onClick:()=>a(!n),type:"button",children:[i.jsxs("span",{children:["Headers (",p(e?.request?.headers).length,")"]}),i.jsx(Sy,{open:n})]}),n&&i.jsx("div",{className:"p-0",children:i.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300 dark:border-dark-tremor-border",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100 dark:bg-blue-900/30",children:[i.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 w-1/4 text-left text-sm font-semibold text-gray-700 dark:text-white",children:"Header"}),i.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 text-left text-sm font-semibold text-gray-700 dark:text-white",children:"Value"})]})}),i.jsx("tbody",{children:y(p(e?.request?.headers),!0)})]})})]}),i.jsxs("div",{className:`${o?"flex flex-col flex-1":""} mb-4 border border-slate-200 dark:border-dark-tremor-border ${o?"rounded-tremor-small rounded-b-none":"rounded-tremor-small"} bg-white dark:bg-dark-tremor-background-subtle overflow-hidden`,children:[i.jsxs("button",{type:"button",onClick:()=>s(!o),className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong cursor-pointer flex items-center justify-between",children:[i.jsx("span",{children:"Request Body"}),i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(on,{textToCopy:N(v),showLabel:!0}),i.jsx(Sy,{open:o})]})]}),o?i.jsx("div",{className:"border-t border-tremor-border dark:border-dark-tremor-border flex flex-col flex-1",children:k?i.jsx("div",{className:"p-4 flex-1 bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content",children:"No payload"}):i.jsx(ns,{height:"100%",className:"flex-1",defaultLanguage:"json",value:N(v),theme:os(),beforeMount:as,options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}})}):null]}),i.jsx(sK,{open:c,decoded:d,onClose:()=>{u(!1),f(null)}})]})};var op={exports:{}},Cy={exports:{}},E5;function uK(){return E5||(E5=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ParsingError=void 0;class r extends Error{constructor(w,E){super(w),this.cause=E}}t.ParsingError=r;let n;function a(){return c(!1)||p()||f()||d()||l()}function o(){return b(/\s*/),c(!0)||f()||u()||l()}function s(){const N=l(),w=[];let E,C=o();for(;C;){if(C.node.type==="Element"){if(E)throw new Error("Found multiple root nodes");E=C.node}C.excluded||w.push(C.node),C=o()}if(!E)throw new r("Failed to parse XML","Root Element not found");if(n.xml.length!==0)throw new r("Failed to parse XML","Not Well-Formed XML");return{declaration:N?N.node:null,root:E,children:w}}function l(){const N=b(/^<\?([\w-:.]+)\s*/);if(!N)return;const w={name:N[1],type:"ProcessingInstruction",content:""},E=n.xml.indexOf("?>");if(E>-1)w.content=n.xml.substring(0,E).trim(),n.xml=n.xml.slice(E);else throw new r("Failed to parse XML","ProcessingInstruction closing tag not found");return b(/\?>/),{excluded:n.options.filter(w)===!1,node:w}}function c(N){const w=b(/^<([^?!</>\s]+)\s*/);if(!w)return;const E={type:"Element",name:w[1],attributes:{},children:[]},C=N?!1:n.options.filter(E)===!1;for(;!(y()||v(">")||v("?>")||v("/>"));){const D=h();if(D)E.attributes[D.name]=D.value;else return}if(b(/^\s*\/>/))return E.children=null,{excluded:C,node:E};b(/\??>/);let O=a();for(;O;)O.excluded||E.children.push(O.node),O=a();if(n.options.strictMode){const D=`</${E.name}>`;if(n.xml.startsWith(D))n.xml=n.xml.slice(D.length);else throw new r("Failed to parse XML",`Closing tag not matching "${D}"`)}else b(/^<\/[\w-:.\u00C0-\u00FF]+\s*>/);return{excluded:C,node:E}}function u(){const N=b(/^<!DOCTYPE\s+\S+\s+SYSTEM[^>]*>/)||b(/^<!DOCTYPE\s+\S+\s+PUBLIC[^>]*>/)||b(/^<!DOCTYPE\s+\S+\s*\[[^\]]*]>/)||b(/^<!DOCTYPE\s+\S+\s*>/);if(N){const w={type:"DocumentType",content:N[0]};return{excluded:n.options.filter(w)===!1,node:w}}}function d(){if(n.xml.startsWith("<![CDATA[")){const N=n.xml.indexOf("]]>");if(N>-1){const w=N+3,E={type:"CDATA",content:n.xml.substring(0,w)};return n.xml=n.xml.slice(w),{excluded:n.options.filter(E)===!1,node:E}}}}function f(){const N=b(/^<!--[\s\S]*?-->/);if(N){const w={type:"Comment",content:N[0]};return{excluded:n.options.filter(w)===!1,node:w}}}function p(){const N=b(/^([^<]+)/);if(N){const w={type:"Text",content:N[1]};return{excluded:n.options.filter(w)===!1,node:w}}}function h(){const N=b(/([^=]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)\s*/);if(N)return{name:N[1].trim(),value:g(N[2].trim())}}function g(N){return N.replace(/^['"]|['"]$/g,"")}function b(N){const w=n.xml.match(N);if(w)return n.xml=n.xml.slice(w[0].length),w}function y(){return n.xml.length===0}function v(N){return n.xml.indexOf(N)===0}function k(N,w={}){N=N.trim();const E=w.filter||(()=>!0);return n={xml:N,options:Object.assign(Object.assign({},w),{filter:E,strictMode:w.strictMode===!0})},s()}e.exports=k,t.default=k}(Cy,Cy.exports)),Cy.exports}var S5=op.exports,C5;function dK(){return C5||(C5=1,function(e,t){var r=S5&&S5.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(uK());function a(g){if(!g.options.indentation&&!g.options.lineSeparator)return;g.content+=g.options.lineSeparator;let b;for(b=0;b<g.level;b++)g.content+=g.options.indentation}function o(g){g.content=g.content.replace(/ +$/,"");let b;for(b=0;b<g.level;b++)g.content+=g.options.indentation}function s(g,b){g.content+=b}function l(g,b,y){if(g.type==="Element")d(g,b,y);else if(g.type==="ProcessingInstruction")p(g,b);else if(typeof g.content=="string")c(g.content,b,y);else throw new Error("Unknown node type: "+g.type)}function c(g,b,y){if(!y){const v=g.trim();(b.options.lineSeparator||v.length===0)&&(g=v)}g.length>0&&(!y&&b.content.length>0&&a(b),s(b,g))}function u(g,b){const y="/"+g.join("/"),v=g[g.length-1];return b.includes(v)||b.includes(y)}function d(g,b,y){if(b.path.push(g.name),!y&&b.content.length>0&&a(b),s(b,"<"+g.name),f(b,g.attributes),g.children===null||b.options.forceSelfClosingEmptyTag&&g.children.length===0){const v=b.options.whiteSpaceAtEndOfSelfclosingTag?" />":"/>";s(b,v)}else if(g.children.length===0)s(b,"></"+g.name+">");else{const v=g.children;s(b,">"),b.level++;let k=g.attributes["xml:space"]==="preserve"||y,N=!1;if(!k&&b.options.ignoredPaths&&(N=u(b.path,b.options.ignoredPaths),k=N),!k&&b.options.collapseContent){let w=!1,E=!1,C=!1;v.forEach(function(O,D){O.type==="Text"?(O.content.includes(`
28
- `)?(E=!0,O.content=O.content.trim()):(D===0||D===v.length-1)&&!y&&O.content.trim().length===0&&(O.content=""),(O.content.trim().length>0||v.length===1)&&(w=!0)):O.type==="CDATA"?w=!0:C=!0}),w&&(!C||!E)&&(k=!0)}v.forEach(function(w){l(w,b,y||k)}),b.level--,!y&&!k&&a(b),N&&o(b),s(b,"</"+g.name+">")}b.path.pop()}function f(g,b){Object.keys(b).forEach(function(y){const v=b[y].replace(/"/g,"&quot;");s(g," "+y+'="'+v+'"')})}function p(g,b){b.content.length>0&&a(b),s(b,"<?"+g.name),s(b," "+g.content.trim()),s(b,"?>")}function h(g,b={}){b.indentation="indentation"in b?b.indentation:" ",b.collapseContent=b.collapseContent===!0,b.lineSeparator="lineSeparator"in b?b.lineSeparator:`\r
29
- `,b.whiteSpaceAtEndOfSelfclosingTag=b.whiteSpaceAtEndOfSelfclosingTag===!0,b.throwOnFailure=b.throwOnFailure!==!1;try{const y=(0,n.default)(g,{filter:b.filter,strictMode:b.strictMode}),v={content:"",level:0,options:b,path:[]};return y.declaration&&p(y.declaration,v),y.children.forEach(function(k){l(k,v,!1)}),b.lineSeparator?v.content.replace(/\r\n/g,`
30
- `).replace(/\n/g,b.lineSeparator):v.content}catch(y){if(b.throwOnFailure)throw y;return g}}h.minify=(g,b={})=>h(g,Object.assign(Object.assign({},b),{indentation:"",lineSeparator:""})),e.exports=h,t.default=h}(op,op.exports)),op.exports}var fK=dK();const mK=mr(fK);function Y8(e){try{return mK(e,{indentation:" ",collapseContent:!0,lineSeparator:`
31
- `})}catch{return e}}function pK(e){if(!e)return[];const t=[];let r=null;const n=String(e).split(/\r?\n/);for(const a of n){if(a===""){r&&(t.push({...r,timestamp:r.timestamp??Date.now()}),r=null);continue}if(a.startsWith(":")){const c=a.slice(1).trimStart();t.push({event:"comment",data:c,timestamp:Date.now()});continue}const o=a.indexOf(":");if(o===-1)continue;r||(r={});const s=a.slice(0,o).trim(),l=a.slice(o+1).trimStart();if(s==="data")r.data=r.data?r.data+`
32
- `+l:l;else if(s==="timestamp"||s==="time"){const c=Number(l);r.timestamp=Number.isNaN(c)?l:c}else r[s]=l}return r&&t.push({...r,timestamp:r.timestamp??Date.now()}),t}const O5=({frames:e,raw:t})=>{const r=x.useMemo(()=>e&&e.length?e:pK(t),[e,t]),[n,a]=x.useState({}),[o,s]=x.useState(null),[l,c]=x.useState("asc"),u=y=>{const v=y.timestamp??y.time;if(v==null)return 0;if(typeof v=="number")return v;const k=Number(v);if(!Number.isNaN(k))return k;const N=new Date(v).getTime();return Number.isNaN(N)?0:N},d=(y,v)=>String(y||"").localeCompare(String(v||"")),f=x.useMemo(()=>{if(!o)return r;const y=l==="asc"?1:-1;return[...r].sort((v,k)=>{let N=0;return o==="id"?N=d(v.id,k.id):o==="type"?N=d(v.event,k.event):o==="data"?N=d(v.data,k.data):o==="time"&&(N=u(v)-u(k)),N*y})},[r,o,l]),p=y=>{o!==y?(s(y),c("asc")):l==="asc"?c("desc"):l==="desc"?(s(null),c("asc")):(s(y),c("asc"))};if(!r||!r.length)return i.jsx("div",{className:"p-4",children:"No event frames"});const h=y=>{try{return JSON.parse(y)}catch{return null}},g=y=>{const v=y.timestamp??y.time;if(!v)return"";const k=new Date(v);if(Number.isNaN(k.getTime()))return typeof v=="string"?v:"";const N=(w,E=2)=>String(w).padStart(E,"0");return`${N(k.getHours())}:${N(k.getMinutes())}:${N(k.getSeconds())}.${N(k.getMilliseconds(),3)}`},b=y=>{if(!y)return"";if(y==="comment")return"bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-gray-200";const v=["bg-blue-200 text-blue-800 dark:bg-blue-700 dark:text-blue-200","bg-green-200 text-green-800 dark:bg-green-700 dark:text-green-200","bg-red-200 text-red-800 dark:bg-red-700 dark:text-red-200","bg-yellow-200 text-yellow-800 dark:bg-yellow-700 dark:text-yellow-200","bg-purple-200 text-purple-800 dark:bg-purple-700 dark:text-purple-200","bg-pink-200 text-pink-800 dark:bg-pink-700 dark:text-pink-200"],k=[...y].reduce((N,w)=>N+w.charCodeAt(0),0);return v[k%v.length]};return i.jsx("div",{className:"overflow-auto h-full",children:i.jsxs("table",{className:"w-full border-collapse border border-slate-200 dark:border-dark-tremor-border",children:[i.jsxs("colgroup",{children:[i.jsx("col",{className:"w-1/6"})," ",i.jsx("col",{className:"w-1/6"})," ",i.jsx("col",{})," ",i.jsx("col",{className:"w-[12ch]"})," "]}),i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100 dark:bg-dark-tremor-background-subtle",children:[i.jsx("th",{className:"sticky top-0 z-10 border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white bg-gray-100 dark:bg-dark-tremor-background-subtle cursor-pointer select-none",onClick:()=>p("id"),"aria-sort":o==="id"?l==="asc"?"ascending":"descending":"none",children:i.jsxs("span",{className:"inline-flex items-center gap-1",children:["ID ",o==="id"?l==="asc"?"▲":"▼":""]})}),i.jsx("th",{className:"sticky top-0 z-10 border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white bg-gray-100 dark:bg-dark-tremor-background-subtle cursor-pointer select-none",onClick:()=>p("type"),"aria-sort":o==="type"?l==="asc"?"ascending":"descending":"none",children:i.jsxs("span",{className:"inline-flex items-center gap-1",children:["Type ",o==="type"?l==="asc"?"▲":"▼":""]})}),i.jsx("th",{className:"sticky top-0 z-10 border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white bg-gray-100 dark:bg-dark-tremor-background-subtle cursor-pointer select-none",onClick:()=>p("data"),"aria-sort":o==="data"?l==="asc"?"ascending":"descending":"none",children:i.jsxs("span",{className:"inline-flex items-center gap-1",children:["Data ",o==="data"?l==="asc"?"▲":"▼":""]})}),i.jsx("th",{className:"sticky top-0 z-10 border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white bg-gray-100 dark:bg-dark-tremor-background-subtle whitespace-nowrap cursor-pointer select-none",onClick:()=>p("time"),"aria-sort":o==="time"?l==="asc"?"ascending":"descending":"none",children:i.jsxs("span",{className:"inline-flex items-center gap-1",children:["Time ",o==="time"?l==="asc"?"▲":"▼":""]})})]})}),i.jsx("tbody",{children:f.map((y,v)=>{const k=y.id??v,N=h(y.data),w=!!n[k];return i.jsxs(x.Fragment,{children:[i.jsxs("tr",{className:"align-top",children:[i.jsx("td",{className:"border px-2 py-1 font-mono text-xs text-slate-500 dark:text-dark-tremor-content",children:y.id||""}),i.jsx("td",{className:"border px-2 py-1",children:y.event?i.jsx("span",{className:`inline-flex items-center rounded px-2.5 py-0.5 font-mono text-xs font-medium ${b(y.event)}`,children:y.event}):""}),i.jsx("td",{className:"border px-2 py-1 font-mono text-xs whitespace-pre-wrap break-all dark:text-dark-tremor-content",children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("div",{className:"flex-1 min-w-0 break-all whitespace-pre-wrap",children:y.data}),N&&i.jsx("button",{className:"self-start shrink-0 px-2 py-1 text-xs rounded bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200",title:w?"Hide formatted JSON":"Show formatted JSON","aria-expanded":w,onClick:()=>a(E=>({...E,[k]:!E[k]})),children:w?"Hide":"Preview"})]})}),i.jsx("td",{className:"border px-2 py-1 font-mono text-xs text-slate-500 dark:text-dark-tremor-content whitespace-nowrap w-[12ch]",children:g(y)})]}),N&&w&&i.jsx("tr",{children:i.jsx("td",{className:"border px-2 py-2 bg-slate-50 dark:bg-dark-tremor-background-subtle",colSpan:4,children:i.jsx(ns,{height:"260px",language:"json",value:JSON.stringify(N,null,2),theme:os(),beforeMount:as,options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}})})})]},k)})})]})})},P5=e=>{if(typeof e!="string"||e.trim()==="")return"";const t=e.trim();try{if(typeof globalThis<"u"&&typeof globalThis.atob=="function")return globalThis.atob(t)}catch{}try{if(typeof Buffer<"u")return Buffer.from(t,"base64").toString("binary")}catch{}return""},hK=e=>{const t=e.length,r=new Uint8Array(t);for(let n=0;n<t;n+=1)r[n]=e.charCodeAt(n)&255;return r},A5=({open:e,className:t=""})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`h-4 w-4 text-tremor-content transition-transform dark:text-dark-tremor-content ${e?"rotate-180":"rotate-0"} ${t}`,"aria-hidden":"true",children:i.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.084l3.71-3.854a.75.75 0 0 1 1.08 1.04l-4.25 4.417a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z",clipRule:"evenodd"})}),gK=({operation:e})=>{const[t,r]=m.useState(!1),[n,a]=m.useState("source"),[o,s]=m.useState(!0),l=e?.id,c=G=>G?Array.isArray(G)?G.map(ee=>({name:ee.name??ee.key??"",value:ee.value})):typeof G=="object"?"name"in G&&"value"in G?[{name:G.name,value:G.value}]:Object.entries(G).map(([ee,re])=>({name:ee,value:re})):[]:[],u=G=>G.map(ee=>i.jsxs("tr",{children:[i.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-slate-500 dark:text-dark-tremor-content text-xs",children:ee.name}),i.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-xs dark:text-dark-tremor-content",children:i.jsx("div",{className:"flex flex-wrap items-center",children:i.jsx("span",{className:"min-w-0 break-all flex-1",children:ee.value})})})]},ee.name)),d=typeof e?.response?.body=="string"?e.response.body:void 0,f=e?.response?.body_encoding,p=(typeof f=="string"?f.toLowerCase():"utf8")==="base64",h=p&&typeof d=="string"?P5(d):d,g=typeof h=="string"&&h!==""?h:d,b=d,y=!g||typeof g=="object"&&Object.keys(g).length===0||typeof g=="string"&&(g.trim()===""||g.trim()==="{}"),v=(G,ee)=>{if(typeof G!="string")return G;if(ee&&ee.includes("json"))try{const re=JSON.parse(G);return JSON.stringify(re,null,2)}catch{return G}return ee&&ee.includes("xml")?Y8(G):G},k=(()=>{const G=c(e?.response?.headers).find(ee=>ee.name?.toLowerCase()==="content-type"||ee.key?.toLowerCase()==="content-type")?.value;return typeof G=="string"?G.split(";")[0].trim():void 0})(),N=k||"application/octet-stream",w=typeof k=="string"&&k.includes("text/html");typeof k=="string"&&k.includes("xml");const E=typeof k=="string"&&k.startsWith("image/"),C=typeof k=="string"&&k.includes("text/event-stream"),O=e?.response?.event_frames||[],D=Array.isArray(O)&&O.length>0||C,A=(G=>{if(!G)return"json";const ee=G.toLowerCase();return ee.includes("json")?"json":ee.includes("html")?"html":ee.includes("xml")?"xml":ee.includes("javascript")?"javascript":ee.includes("css")?"css":ee.includes("yaml")||ee.includes("yml")?"yaml":ee.includes("sql")?"sql":(ee.startsWith("text/"),"plaintext")})(k),M=w||E||D,I=M&&(E||p);m.useEffect(()=>{l&&a(I?"preview":"source")},[l,I]);const T=typeof b=="string"?b:"",R=T.trim(),L=E&&R?R.startsWith("data:")?T:p?`data:${N};base64,${T}`:`data:${N};charset=utf-8,${encodeURIComponent(T)}`:"",F=()=>{const G=c(e?.response?.headers).find(ee=>ee.name?.toLowerCase()==="content-disposition"||ee.key?.toLowerCase()==="content-disposition")?.value;if(typeof G=="string"){const ee=G.match(/filename\*=UTF-8''([^;]+)/i);if(ee&&ee[1])try{return decodeURIComponent(ee[1])}catch{return ee[1]}const re=G.match(/filename=\"?([^\";]+)\"?/i);if(re&&re[1])return re[1]}return`operation-response-${e?.id?String(e.id):Date.now().toString()}`},V=()=>{if(typeof d!="string"||d==="")return null;if(p){const G=P5(d);if(!G)return null;const ee=hK(G);return new Blob([ee],{type:N})}return new Blob([d],{type:`${N};charset=utf-8`})},H=()=>{if(typeof document>"u")return;const G=V();if(!G)return;const ee=URL.createObjectURL(G),re=F(),pe=document.createElement("a");pe.href=ee,pe.download=re,document.body.appendChild(pe),pe.click(),pe.remove(),URL.revokeObjectURL(ee)},$=c(e?.response?.headers).find(G=>String(G.name??G.key??"").toLowerCase()==="content-disposition")?.value,z=typeof $=="string"?$:"",W=/attachment/i.test(z)||/filename\*=|filename=/i.test(z),U=typeof d=="string"&&d.trim().length>0,X=typeof k=="string"?k.toLowerCase():"",Y=X.startsWith("text/")||X.includes("json")||X.includes("xml")||X.includes("html")||X.includes("javascript")||X.includes("css")||X.includes("yaml")||X.includes("yml")||X.includes("sql"),ae=U&&(p||E||N==="application/octet-stream"||W||X!==""&&!Y);return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsxs("div",{className:`mb-4 border border-slate-200 dark:border-dark-tremor-border ${t?"rounded-tremor-small rounded-b-none":"rounded-tremor-small"}`,children:[i.jsxs("button",{type:"button",className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong cursor-pointer flex items-center justify-between",onClick:()=>r(!t),children:[i.jsxs("span",{children:["Headers (",c(e?.response?.headers).length,")"]}),i.jsx(A5,{open:t})]}),t&&i.jsx("div",{className:"p-0 border-t border-tremor-border dark:border-dark-tremor-border",children:i.jsxs("table",{className:"w-full border-collapse border border-gray-300 dark:border-dark-tremor-border",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100 dark:bg-blue-900/30",children:[i.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 w-1/4 text-left text-sm font-semibold text-gray-700 dark:text-white",children:"Header"}),i.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 text-left text-sm font-semibold text-gray-700 dark:text-white",children:"Value"})]})}),i.jsx("tbody",{children:u(c(e?.response?.headers))})]})})]}),i.jsxs("div",{className:`${o?"flex flex-col flex-1":""} border border-slate-200 dark:border-dark-tremor-border ${o?"rounded-tremor-small rounded-b-none":"rounded-tremor-small"} bg-white dark:bg-dark-tremor-background-subtle overflow-hidden`,children:[i.jsxs("button",{type:"button",onClick:()=>s(!o),className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong cursor-pointer flex items-center justify-between",children:[i.jsx("span",{children:"Response Body"}),i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"flex items-center",onClick:G=>G.stopPropagation(),children:i.jsxs("div",{className:"flex items-center space-x-2 mr-2",children:[M&&i.jsxs("div",{className:"flex space-x-1",children:[i.jsx("button",{type:"button",onClick:()=>a("source"),className:`px-2 py-1 text-xs rounded ${n==="source"?"bg-blue-600 dark:bg-blue-700 text-white":"bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200"}`,children:"Source"}),D?i.jsx("button",{type:"button",onClick:()=>a("events"),className:`px-2 py-1 text-xs rounded ${n==="events"?"bg-blue-600 dark:bg-blue-700 text-white":"bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200"}`,children:"Events"}):i.jsx("button",{type:"button",onClick:()=>a("preview"),className:`px-2 py-1 text-xs rounded ${n==="preview"?"bg-blue-600 dark:bg-blue-700 text-white":"bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200"}`,children:"Preview"})]}),ae&&i.jsx("button",{type:"button",onClick:H,className:"px-2 py-1 text-xs rounded bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-400 dark:hover:bg-gray-600",children:"Download"}),i.jsx(on,{textToCopy:(w||E||C?g??"":v(g,k))??""})]})}),i.jsx(A5,{open:o})]})]}),o?i.jsx(i.Fragment,{children:D&&n==="events"?i.jsx(O5,{frames:O,raw:g??""}):C?n==="events"?i.jsx(O5,{frames:O,raw:g??""}):y?i.jsx("div",{className:"p-4 flex-1 bg-white dark:bg-dark-tremor-background-subtle rounded-b shadow dark:shadow-dark-tremor-shadow dark:text-dark-tremor-content",children:"No payload"}):i.jsx(ns,{height:"100%",className:"flex-1",language:"plaintext",value:g??"",theme:os(),beforeMount:as,options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}}):y?i.jsx("div",{className:"p-4 flex-1 bg-white dark:bg-dark-tremor-background-subtle rounded-b shadow dark:shadow-dark-tremor-shadow dark:text-dark-tremor-content",children:"No payload"}):n==="preview"&&w?i.jsx("iframe",{title:"HTML Preview",srcDoc:g??"",className:"flex-1 w-full h-full border-none"}):n==="preview"&&E?L?i.jsx("div",{className:"flex-1 w-full h-full overflow-auto bg-white dark:bg-dark-tremor-background-subtle",children:i.jsx("img",{alt:"Response Preview",src:L,className:"max-w-none"})}):i.jsx("div",{className:"p-4 flex-1 bg-white dark:bg-dark-tremor-background-subtle rounded-b shadow dark:shadow-dark-tremor-shadow dark:text-dark-tremor-content",children:"Unable to render image preview"}):i.jsx(ns,{height:"100%",className:"flex-1",language:A,value:v(g,k)??"",theme:os(),beforeMount:as,options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}})}):null]})]})},M5=e=>e?Array.isArray(e)?e:Object.entries(e).map(([t,r])=>({name:t,value:r})):[],bK=({operation:e})=>{const t=M5(e?.meta?.inspectr?.guard),r=M5(e?.meta?.inspectr?.directives),[n,a]=m.useState(null),o=m.useRef(null);m.useEffect(()=>{const l=c=>{const u=c?.detail?.name;a(u||null),o.current?.scrollIntoView({behavior:"smooth",block:"start"}),u&&setTimeout(()=>a(null),1600)};return window.addEventListener("inspectr:openMetaGuard",l),()=>window.removeEventListener("inspectr:openMetaGuard",l)},[]);const s=({label:l})=>i.jsxs("span",{className:"ml-2 py-0.5 px-1.5 inline-flex items-center gap-x-1 text-[10px] font-medium bg-blue-100 text-blue-800 rounded-md dark:bg-blue-500/10 dark:text-blue-500",children:[i.jsxs("svg",{className:"shrink-0 h-3 w-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),i.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),l]});return t.length===0&&r.length===0?i.jsx("div",{className:"text-gray-500 dark:text-dark-tremor-content text-sm",children:"No Inspectr metadata"}):i.jsxs("div",{className:"space-y-4",children:[t.length>0&&i.jsxs("div",{ref:o,children:[i.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong",children:["Guard (",(t??[]).length,")"]}),i.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300 dark:border-dark-tremor-border",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100 dark:bg-blue-900/30",children:[i.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 w-1/4 text-left font-semibold text-gray-700 dark:text-white",children:"API Key"}),i.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white",children:"Value"})]})}),i.jsx("tbody",{children:t.map(l=>{const c=l.name==="inspectr-auth-token",u=l.name==="inspectr-auth-key",d=n&&n===l.name;return i.jsxs("tr",{className:d?"bg-blue-50 dark:bg-blue-950/30":"",children:[i.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-slate-500 dark:text-dark-tremor-content text-xs",children:i.jsxs("div",{className:"flex items-center",children:[i.jsx("span",{children:l.name}),c&&i.jsx(s,{label:"Guard Token"}),u&&i.jsx(s,{label:"Guard Key"})]})}),i.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-xs break-all dark:text-dark-tremor-content",children:l.value})]},l.name)})})]})]}),r.length>0&&i.jsxs("div",{children:[i.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong",children:["Directives (",(r??[]).length,")"]}),i.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300 dark:border-dark-tremor-border",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-gray-100 dark:bg-blue-900/30",children:[i.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 w-1/4 text-left font-semibold text-gray-700 dark:text-white",children:"Directive"}),i.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white",children:"Value"})]})}),i.jsx("tbody",{children:r.map(l=>i.jsxs("tr",{children:[i.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-slate-500 dark:text-dark-tremor-content text-xs",children:l.name}),i.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-xs break-all dark:text-dark-tremor-content",children:l.value})]},l.name))})]})]})]})};function Be(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}var Oy,T5;function Qn(){if(T5)return Oy;T5=1;var e=Array.isArray;return Oy=e,Oy}var Py,_5;function X8(){if(_5)return Py;_5=1;var e=typeof ld=="object"&&ld&&ld.Object===Object&&ld;return Py=e,Py}var Ay,I5;function Mo(){if(I5)return Ay;I5=1;var e=X8(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ay=r,Ay}var My,D5;function Rf(){if(D5)return My;D5=1;var e=Mo(),t=e.Symbol;return My=t,My}var Ty,L5;function yK(){if(L5)return Ty;L5=1;var e=Rf(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,a=e?e.toStringTag:void 0;function o(s){var l=r.call(s,a),c=s[a];try{s[a]=void 0;var u=!0}catch{}var d=n.call(s);return u&&(l?s[a]=c:delete s[a]),d}return Ty=o,Ty}var _y,R5;function xK(){if(R5)return _y;R5=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return _y=r,_y}var Iy,F5;function ms(){if(F5)return Iy;F5=1;var e=Rf(),t=yK(),r=xK(),n="[object Null]",a="[object Undefined]",o=e?e.toStringTag:void 0;function s(l){return l==null?l===void 0?a:n:o&&o in Object(l)?t(l):r(l)}return Iy=s,Iy}var Dy,$5;function ps(){if($5)return Dy;$5=1;function e(t){return t!=null&&typeof t=="object"}return Dy=e,Dy}var Ly,B5;function ou(){if(B5)return Ly;B5=1;var e=ms(),t=ps(),r="[object Symbol]";function n(a){return typeof a=="symbol"||t(a)&&e(a)==r}return Ly=n,Ly}var Ry,H5;function kN(){if(H5)return Ry;H5=1;var e=Qn(),t=ou(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(o,s){if(e(o))return!1;var l=typeof o;return l=="number"||l=="symbol"||l=="boolean"||o==null||t(o)?!0:n.test(o)||!r.test(o)||s!=null&&o in Object(s)}return Ry=a,Ry}var Fy,z5;function di(){if(z5)return Fy;z5=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Fy=e,Fy}var $y,U5;function wN(){if(U5)return $y;U5=1;var e=ms(),t=di(),r="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",o="[object Proxy]";function s(l){if(!t(l))return!1;var c=e(l);return c==n||c==a||c==r||c==o}return $y=s,$y}var By,q5;function vK(){if(q5)return By;q5=1;var e=Mo(),t=e["__core-js_shared__"];return By=t,By}var Hy,V5;function kK(){if(V5)return Hy;V5=1;var e=vK(),t=function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function r(n){return!!t&&t in n}return Hy=r,Hy}var zy,W5;function G8(){if(W5)return zy;W5=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return zy=r,zy}var Uy,K5;function wK(){if(K5)return Uy;K5=1;var e=wN(),t=kK(),r=di(),n=G8(),a=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,c=s.toString,u=l.hasOwnProperty,d=RegExp("^"+c.call(u).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(p){if(!r(p)||t(p))return!1;var h=e(p)?d:o;return h.test(n(p))}return Uy=f,Uy}var qy,Y5;function jK(){if(Y5)return qy;Y5=1;function e(t,r){return t?.[r]}return qy=e,qy}var Vy,X5;function gl(){if(X5)return Vy;X5=1;var e=wK(),t=jK();function r(n,a){var o=t(n,a);return e(o)?o:void 0}return Vy=r,Vy}var Wy,G5;function Ng(){if(G5)return Wy;G5=1;var e=gl(),t=e(Object,"create");return Wy=t,Wy}var Ky,Z5;function NK(){if(Z5)return Ky;Z5=1;var e=Ng();function t(){this.__data__=e?e(null):{},this.size=0}return Ky=t,Ky}var Yy,J5;function EK(){if(J5)return Yy;J5=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Yy=e,Yy}var Xy,Q5;function SK(){if(Q5)return Xy;Q5=1;var e=Ng(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function a(o){var s=this.__data__;if(e){var l=s[o];return l===t?void 0:l}return n.call(s,o)?s[o]:void 0}return Xy=a,Xy}var Gy,e4;function CK(){if(e4)return Gy;e4=1;var e=Ng(),t=Object.prototype,r=t.hasOwnProperty;function n(a){var o=this.__data__;return e?o[a]!==void 0:r.call(o,a)}return Gy=n,Gy}var Zy,t4;function OK(){if(t4)return Zy;t4=1;var e=Ng(),t="__lodash_hash_undefined__";function r(n,a){var o=this.__data__;return this.size+=this.has(n)?0:1,o[n]=e&&a===void 0?t:a,this}return Zy=r,Zy}var Jy,r4;function PK(){if(r4)return Jy;r4=1;var e=NK(),t=EK(),r=SK(),n=CK(),a=OK();function o(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=n,o.prototype.set=a,Jy=o,Jy}var Qy,n4;function AK(){if(n4)return Qy;n4=1;function e(){this.__data__=[],this.size=0}return Qy=e,Qy}var ex,a4;function jN(){if(a4)return ex;a4=1;function e(t,r){return t===r||t!==t&&r!==r}return ex=e,ex}var tx,o4;function Eg(){if(o4)return tx;o4=1;var e=jN();function t(r,n){for(var a=r.length;a--;)if(e(r[a][0],n))return a;return-1}return tx=t,tx}var rx,s4;function MK(){if(s4)return rx;s4=1;var e=Eg(),t=Array.prototype,r=t.splice;function n(a){var o=this.__data__,s=e(o,a);if(s<0)return!1;var l=o.length-1;return s==l?o.pop():r.call(o,s,1),--this.size,!0}return rx=n,rx}var nx,i4;function TK(){if(i4)return nx;i4=1;var e=Eg();function t(r){var n=this.__data__,a=e(n,r);return a<0?void 0:n[a][1]}return nx=t,nx}var ax,l4;function _K(){if(l4)return ax;l4=1;var e=Eg();function t(r){return e(this.__data__,r)>-1}return ax=t,ax}var ox,c4;function IK(){if(c4)return ox;c4=1;var e=Eg();function t(r,n){var a=this.__data__,o=e(a,r);return o<0?(++this.size,a.push([r,n])):a[o][1]=n,this}return ox=t,ox}var sx,u4;function Sg(){if(u4)return sx;u4=1;var e=AK(),t=MK(),r=TK(),n=_K(),a=IK();function o(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=n,o.prototype.set=a,sx=o,sx}var ix,d4;function NN(){if(d4)return ix;d4=1;var e=gl(),t=Mo(),r=e(t,"Map");return ix=r,ix}var lx,f4;function DK(){if(f4)return lx;f4=1;var e=PK(),t=Sg(),r=NN();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return lx=n,lx}var cx,m4;function LK(){if(m4)return cx;m4=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return cx=e,cx}var ux,p4;function Cg(){if(p4)return ux;p4=1;var e=LK();function t(r,n){var a=r.__data__;return e(n)?a[typeof n=="string"?"string":"hash"]:a.map}return ux=t,ux}var dx,h4;function RK(){if(h4)return dx;h4=1;var e=Cg();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return dx=t,dx}var fx,g4;function FK(){if(g4)return fx;g4=1;var e=Cg();function t(r){return e(this,r).get(r)}return fx=t,fx}var mx,b4;function $K(){if(b4)return mx;b4=1;var e=Cg();function t(r){return e(this,r).has(r)}return mx=t,mx}var px,y4;function BK(){if(y4)return px;y4=1;var e=Cg();function t(r,n){var a=e(this,r),o=a.size;return a.set(r,n),this.size+=a.size==o?0:1,this}return px=t,px}var hx,x4;function EN(){if(x4)return hx;x4=1;var e=DK(),t=RK(),r=FK(),n=$K(),a=BK();function o(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=r,o.prototype.has=n,o.prototype.set=a,hx=o,hx}var gx,v4;function Z8(){if(v4)return gx;v4=1;var e=EN(),t="Expected a function";function r(n,a){if(typeof n!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var o=function(){var s=arguments,l=a?a.apply(this,s):s[0],c=o.cache;if(c.has(l))return c.get(l);var u=n.apply(this,s);return o.cache=c.set(l,u)||c,u};return o.cache=new(r.Cache||e),o}return r.Cache=e,gx=r,gx}var bx,k4;function HK(){if(k4)return bx;k4=1;var e=Z8(),t=500;function r(n){var a=e(n,function(s){return o.size===t&&o.clear(),s}),o=a.cache;return a}return bx=r,bx}var yx,w4;function zK(){if(w4)return yx;w4=1;var e=HK(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(a){var o=[];return a.charCodeAt(0)===46&&o.push(""),a.replace(t,function(s,l,c,u){o.push(c?u.replace(r,"$1"):l||s)}),o});return yx=n,yx}var xx,j4;function SN(){if(j4)return xx;j4=1;function e(t,r){for(var n=-1,a=t==null?0:t.length,o=Array(a);++n<a;)o[n]=r(t[n],n,t);return o}return xx=e,xx}var vx,N4;function UK(){if(N4)return vx;N4=1;var e=Rf(),t=SN(),r=Qn(),n=ou(),a=e?e.prototype:void 0,o=a?a.toString:void 0;function s(l){if(typeof l=="string")return l;if(r(l))return t(l,s)+"";if(n(l))return o?o.call(l):"";var c=l+"";return c=="0"&&1/l==-1/0?"-0":c}return vx=s,vx}var kx,E4;function J8(){if(E4)return kx;E4=1;var e=UK();function t(r){return r==null?"":e(r)}return kx=t,kx}var wx,S4;function Q8(){if(S4)return wx;S4=1;var e=Qn(),t=kN(),r=zK(),n=J8();function a(o,s){return e(o)?o:t(o,s)?[o]:r(n(o))}return wx=a,wx}var jx,C4;function Og(){if(C4)return jx;C4=1;var e=ou();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return jx=t,jx}var Nx,O4;function CN(){if(O4)return Nx;O4=1;var e=Q8(),t=Og();function r(n,a){a=e(a,n);for(var o=0,s=a.length;n!=null&&o<s;)n=n[t(a[o++])];return o&&o==s?n:void 0}return Nx=r,Nx}var Ex,P4;function eT(){if(P4)return Ex;P4=1;var e=CN();function t(r,n,a){var o=r==null?void 0:e(r,n);return o===void 0?a:o}return Ex=t,Ex}var qK=eT();const xa=mr(qK);var Sx,A4;function VK(){if(A4)return Sx;A4=1;function e(t){return t==null}return Sx=e,Sx}var WK=VK();const vt=mr(WK);var Cx,M4;function KK(){if(M4)return Cx;M4=1;var e=ms(),t=Qn(),r=ps(),n="[object String]";function a(o){return typeof o=="string"||!t(o)&&r(o)&&e(o)==n}return Cx=a,Cx}var YK=KK();const il=mr(YK);var XK=wN();const jt=mr(XK);var GK=di();const su=mr(GK);var T4={exports:{}},cr={},_4;function ZK(){if(_4)return cr;_4=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g;g=Symbol.for("react.module.reference");function b(y){if(typeof y=="object"&&y!==null){var v=y.$$typeof;switch(v){case e:switch(y=y.type,y){case r:case a:case n:case u:case d:return y;default:switch(y=y&&y.$$typeof,y){case l:case s:case c:case p:case f:case o:return y;default:return v}}case t:return v}}}return cr.ContextConsumer=s,cr.ContextProvider=o,cr.Element=e,cr.ForwardRef=c,cr.Fragment=r,cr.Lazy=p,cr.Memo=f,cr.Portal=t,cr.Profiler=a,cr.StrictMode=n,cr.Suspense=u,cr.SuspenseList=d,cr.isAsyncMode=function(){return!1},cr.isConcurrentMode=function(){return!1},cr.isContextConsumer=function(y){return b(y)===s},cr.isContextProvider=function(y){return b(y)===o},cr.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===e},cr.isForwardRef=function(y){return b(y)===c},cr.isFragment=function(y){return b(y)===r},cr.isLazy=function(y){return b(y)===p},cr.isMemo=function(y){return b(y)===f},cr.isPortal=function(y){return b(y)===t},cr.isProfiler=function(y){return b(y)===a},cr.isStrictMode=function(y){return b(y)===n},cr.isSuspense=function(y){return b(y)===u},cr.isSuspenseList=function(y){return b(y)===d},cr.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===r||y===a||y===n||y===u||y===d||y===h||typeof y=="object"&&y!==null&&(y.$$typeof===p||y.$$typeof===f||y.$$typeof===o||y.$$typeof===s||y.$$typeof===c||y.$$typeof===g||y.getModuleId!==void 0)},cr.typeOf=b,cr}var I4;function JK(){return I4||(I4=1,T4.exports=ZK()),T4.exports}var QK=JK(),Ox,D4;function tT(){if(D4)return Ox;D4=1;var e=ms(),t=ps(),r="[object Number]";function n(a){return typeof a=="number"||t(a)&&e(a)==r}return Ox=n,Ox}var Px,L4;function eY(){if(L4)return Px;L4=1;var e=tT();function t(r){return e(r)&&r!=+r}return Px=t,Px}var tY=eY();const iu=mr(tY);var rY=tT();const nY=mr(rY);var Fn=function(e){return e===0?0:e>0?1:-1},Wi=function(e){return il(e)&&e.indexOf("%")===e.length-1},ze=function(e){return nY(e)&&!iu(e)},aY=function(e){return vt(e)},bn=function(e){return ze(e)||il(e)},oY=0,fi=function(e){var t=++oY;return"".concat(e||"").concat(t)},$n=function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ze(e)&&!il(e))return r;var a;if(Wi(e)){var o=e.indexOf("%");a=t*parseFloat(e.slice(0,o))/100}else a=+e;return iu(a)&&(a=r),n&&a>t&&(a=t),a},Ds=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},sY=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;n<t;n++)if(!r[e[n]])r[e[n]]=!0;else return!0;return!1},Xr=function(e,t){return ze(e)&&ze(t)?function(r){return e+r*(t-e)}:function(){return t}};function Ap(e,t,r){return!e||!e.length?null:e.find(function(n){return n&&(typeof t=="function"?t(n):xa(n,t))===r})}var iY=function(e){if(!e||!e.length)return null;for(var t=e.length,r=0,n=0,a=0,o=0,s=1/0,l=-1/0,c=0,u=0,d=0;d<t;d++)c=e[d].cx||0,u=e[d].cy||0,r+=c,n+=u,a+=c*u,o+=c*c,s=Math.min(s,c),l=Math.max(l,c);var f=t*o!==r*r?(t*a-r*n)/(t*o-r*r):0;return{xmin:s,xmax:l,a:f,b:(n-f*r)/t}},lY=function(e,t){return ze(e)&&ze(t)?e-t:il(e)&&il(t)?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():String(e).localeCompare(String(t))};function ac(e,t){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(t,r)||e[r]!==t[r]))return!1;for(var n in t)if({}.hasOwnProperty.call(t,n)&&!{}.hasOwnProperty.call(e,n))return!1;return!0}function Rw(e){"@babel/helpers - typeof";return Rw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rw(e)}var cY=["viewBox","children"],uY=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],R4=["points","pathLength"],dY={svg:cY,polygon:R4,polyline:R4},ON=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],Mp=function(e,t){if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(m.isValidElement(e)&&(r=e.props),!su(r))return null;var n={};return Object.keys(r).forEach(function(a){ON.includes(a)&&(n[a]=t||function(o){return r[a](r,o)})}),n},fY=function(e,t,r){return function(n){return e(t,r,n),null}},ti=function(e,t,r){if(!su(e)||Rw(e)!=="object")return null;var n=null;return Object.keys(e).forEach(function(a){var o=e[a];ON.includes(a)&&typeof o=="function"&&(n||(n={}),n[a]=fY(o,t,r))}),n},mY=["children"],pY=["children"];function F4(e,t){if(e==null)return{};var r=hY(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function hY(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Fw(e){"@babel/helpers - typeof";return Fw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fw(e)}var $4={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Go=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},B4=null,Ax=null,PN=function e(t){if(t===B4&&Array.isArray(Ax))return Ax;var r=[];return m.Children.forEach(t,function(n){vt(n)||(QK.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),Ax=r,B4=t,r};function zn(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(a){return Go(a)}):n=[Go(t)],PN(e).forEach(function(a){var o=xa(a,"type.displayName")||xa(a,"type.name");n.indexOf(o)!==-1&&r.push(a)}),r}function sa(e,t){var r=zn(e,t);return r&&r[0]}var H4=function(e){if(!e||!e.props)return!1;var t=e.props,r=t.width,n=t.height;return!(!ze(r)||r<=0||!ze(n)||n<=0)},gY=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],bY=function(e){return e&&e.type&&il(e.type)&&gY.indexOf(e.type)>=0},rT=function(e){return e&&Fw(e)==="object"&&"clipDot"in e},yY=function(e,t,r,n){var a,o=(a=dY?.[n])!==null&&a!==void 0?a:[];return t.startsWith("data-")||!jt(e)&&(n&&o.includes(t)||uY.includes(t))||r&&ON.includes(t)},mt=function(e,t,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(m.isValidElement(e)&&(n=e.props),!su(n))return null;var a={};return Object.keys(n).forEach(function(o){var s;yY((s=n)===null||s===void 0?void 0:s[o],o,t,r)&&(a[o]=n[o])}),a},$w=function e(t,r){if(t===r)return!0;var n=m.Children.count(t);if(n!==m.Children.count(r))return!1;if(n===0)return!0;if(n===1)return z4(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var a=0;a<n;a++){var o=t[a],s=r[a];if(Array.isArray(o)||Array.isArray(s)){if(!e(o,s))return!1}else if(!z4(o,s))return!1}return!0},z4=function(e,t){if(vt(e)&&vt(t))return!0;if(!vt(e)&&!vt(t)){var r=e.props||{},n=r.children,a=F4(r,mY),o=t.props||{},s=o.children,l=F4(o,pY);return n&&s?ac(a,l)&&$w(n,s):!n&&!s?ac(a,l):!1}return!1},U4=function(e,t){var r=[],n={};return PN(e).forEach(function(a,o){if(bY(a))r.push(a);else if(a){var s=Go(a.type),l=t[s]||{},c=l.handler,u=l.once;if(c&&(!u||!n[s])){var d=c(a,s,o);r.push(d),n[s]=!0}}}),r},xY=function(e){var t=e&&e.type;return t&&$4[t]?$4[t]:null},vY=function(e,t){return PN(t).indexOf(e)},kY=["children","width","height","viewBox","className","style","title","desc"];function Bw(){return Bw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Bw.apply(this,arguments)}function wY(e,t){if(e==null)return{};var r=jY(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function jY(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Hw(e){var t=e.children,r=e.width,n=e.height,a=e.viewBox,o=e.className,s=e.style,l=e.title,c=e.desc,u=wY(e,kY),d=a||{width:r,height:n,x:0,y:0},f=Lt("recharts-surface",o);return x.createElement("svg",Bw({},mt(u,!0,"svg"),{className:f,width:r,height:n,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),x.createElement("title",null,l),x.createElement("desc",null,c),t)}var NY=["children","className"];function zw(){return zw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},zw.apply(this,arguments)}function EY(e,t){if(e==null)return{};var r=SY(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function SY(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Rt=x.forwardRef(function(e,t){var r=e.children,n=e.className,a=EY(e,NY),o=Lt("recharts-layer",n);return x.createElement("g",zw({className:o},mt(a,!0),{ref:t}),r)}),Va=function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),a=2;a<r;a++)n[a-2]=arguments[a]},Mx,q4;function CY(){if(q4)return Mx;q4=1;function e(t,r,n){var a=-1,o=t.length;r<0&&(r=-r>o?0:o+r),n=n>o?o:n,n<0&&(n+=o),o=r>n?0:n-r>>>0,r>>>=0;for(var s=Array(o);++a<o;)s[a]=t[a+r];return s}return Mx=e,Mx}var Tx,V4;function OY(){if(V4)return Tx;V4=1;var e=CY();function t(r,n,a){var o=r.length;return a=a===void 0?o:a,!n&&a>=o?r:e(r,n,a)}return Tx=t,Tx}var _x,W4;function nT(){if(W4)return _x;W4=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=t+r+n,o="\\ufe0e\\ufe0f",s="\\u200d",l=RegExp("["+s+e+a+o+"]");function c(u){return l.test(u)}return _x=c,_x}var Ix,K4;function PY(){if(K4)return Ix;K4=1;function e(t){return t.split("")}return Ix=e,Ix}var Dx,Y4;function AY(){if(Y4)return Dx;Y4=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=t+r+n,o="\\ufe0e\\ufe0f",s="["+e+"]",l="["+a+"]",c="\\ud83c[\\udffb-\\udfff]",u="(?:"+l+"|"+c+")",d="[^"+e+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",h="\\u200d",g=u+"?",b="["+o+"]?",y="(?:"+h+"(?:"+[d,f,p].join("|")+")"+b+g+")*",v=b+g+y,k="(?:"+[d+l+"?",l,f,p,s].join("|")+")",N=RegExp(c+"(?="+c+")|"+k+v,"g");function w(E){return E.match(N)||[]}return Dx=w,Dx}var Lx,X4;function MY(){if(X4)return Lx;X4=1;var e=PY(),t=nT(),r=AY();function n(a){return t(a)?r(a):e(a)}return Lx=n,Lx}var Rx,G4;function TY(){if(G4)return Rx;G4=1;var e=OY(),t=nT(),r=MY(),n=J8();function a(o){return function(s){s=n(s);var l=t(s)?r(s):void 0,c=l?l[0]:s.charAt(0),u=l?e(l,1).join(""):s.slice(1);return c[o]()+u}}return Rx=a,Rx}var Fx,Z4;function _Y(){if(Z4)return Fx;Z4=1;var e=TY(),t=e("toUpperCase");return Fx=t,Fx}var IY=_Y();const Pg=mr(IY);function $r(e){return function(){return e}}const aT=Math.cos,Tp=Math.sin,Ja=Math.sqrt,_p=Math.PI,Ag=2*_p,Uw=Math.PI,qw=2*Uw,Mi=1e-6,DY=qw-Mi;function oT(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function LY(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return oT;const r=10**t;return function(n){this._+=n[0];for(let a=1,o=n.length;a<o;++a)this._+=Math.round(arguments[a]*r)/r+n[a]}}class RY{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?oT:LY(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,a){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+a}`}bezierCurveTo(t,r,n,a,o,s){this._append`C${+t},${+r},${+n},${+a},${this._x1=+o},${this._y1=+s}`}arcTo(t,r,n,a,o){if(t=+t,r=+r,n=+n,a=+a,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,l=this._y1,c=n-t,u=a-r,d=s-t,f=l-r,p=d*d+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(p>Mi)if(!(Math.abs(f*c-u*d)>Mi)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let h=n-s,g=a-l,b=c*c+u*u,y=h*h+g*g,v=Math.sqrt(b),k=Math.sqrt(p),N=o*Math.tan((Uw-Math.acos((b+p-y)/(2*v*k)))/2),w=N/k,E=N/v;Math.abs(w-1)>Mi&&this._append`L${t+w*d},${r+w*f}`,this._append`A${o},${o},0,0,${+(f*h>d*g)},${this._x1=t+E*c},${this._y1=r+E*u}`}}arc(t,r,n,a,o,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(a),c=n*Math.sin(a),u=t+l,d=r+c,f=1^s,p=s?a-o:o-a;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Mi||Math.abs(this._y1-d)>Mi)&&this._append`L${u},${d}`,n&&(p<0&&(p=p%qw+qw),p>DY?this._append`A${n},${n},0,1,${f},${t-l},${r-c}A${n},${n},0,1,${f},${this._x1=u},${this._y1=d}`:p>Mi&&this._append`A${n},${n},0,${+(p>=Uw)},${f},${this._x1=t+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(t,r,n,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}}function AN(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new RY(t)}function MN(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function sT(e){this._context=e}sT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Mg(e){return new sT(e)}function iT(e){return e[0]}function lT(e){return e[1]}function cT(e,t){var r=$r(!0),n=null,a=Mg,o=null,s=AN(l);e=typeof e=="function"?e:e===void 0?iT:$r(e),t=typeof t=="function"?t:t===void 0?lT:$r(t);function l(c){var u,d=(c=MN(c)).length,f,p=!1,h;for(n==null&&(o=a(h=s())),u=0;u<=d;++u)!(u<d&&r(f=c[u],u,c))===p&&((p=!p)?o.lineStart():o.lineEnd()),p&&o.point(+e(f,u,c),+t(f,u,c));if(h)return o=null,h+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:$r(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:$r(+c),l):t},l.defined=function(c){return arguments.length?(r=typeof c=="function"?c:$r(!!c),l):r},l.curve=function(c){return arguments.length?(a=c,n!=null&&(o=a(n)),l):a},l.context=function(c){return arguments.length?(c==null?n=o=null:o=a(n=c),l):n},l}function Tm(e,t,r){var n=null,a=$r(!0),o=null,s=Mg,l=null,c=AN(u);e=typeof e=="function"?e:e===void 0?iT:$r(+e),t=typeof t=="function"?t:$r(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?lT:$r(+r);function u(f){var p,h,g,b=(f=MN(f)).length,y,v=!1,k,N=new Array(b),w=new Array(b);for(o==null&&(l=s(k=c())),p=0;p<=b;++p){if(!(p<b&&a(y=f[p],p,f))===v)if(v=!v)h=p,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),g=p-1;g>=h;--g)l.point(N[g],w[g]);l.lineEnd(),l.areaEnd()}v&&(N[p]=+e(y,p,f),w[p]=+t(y,p,f),l.point(n?+n(y,p,f):N[p],r?+r(y,p,f):w[p]))}if(k)return l=null,k+""||null}function d(){return cT().defined(a).curve(s).context(o)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:$r(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:$r(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:$r(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:$r(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:$r(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:$r(+f),u):r},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(r)},u.lineX1=function(){return d().x(n).y(t)},u.defined=function(f){return arguments.length?(a=typeof f=="function"?f:$r(!!f),u):a},u.curve=function(f){return arguments.length?(s=f,o!=null&&(l=s(o)),u):s},u.context=function(f){return arguments.length?(f==null?o=l=null:l=s(o=f),u):o},u}class uT{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function FY(e){return new uT(e,!0)}function $Y(e){return new uT(e,!1)}const TN={draw(e,t){const r=Ja(t/_p);e.moveTo(r,0),e.arc(0,0,r,0,Ag)}},BY={draw(e,t){const r=Ja(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},dT=Ja(1/3),HY=dT*2,zY={draw(e,t){const r=Ja(t/HY),n=r*dT;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},UY={draw(e,t){const r=Ja(t),n=-r/2;e.rect(n,n,r,r)}},qY=.8908130915292852,fT=Tp(_p/10)/Tp(7*_p/10),VY=Tp(Ag/10)*fT,WY=-aT(Ag/10)*fT,KY={draw(e,t){const r=Ja(t*qY),n=VY*r,a=WY*r;e.moveTo(0,-r),e.lineTo(n,a);for(let o=1;o<5;++o){const s=Ag*o/5,l=aT(s),c=Tp(s);e.lineTo(c*r,-l*r),e.lineTo(l*n-c*a,c*n+l*a)}e.closePath()}},$x=Ja(3),YY={draw(e,t){const r=-Ja(t/($x*3));e.moveTo(0,r*2),e.lineTo(-$x*r,-r),e.lineTo($x*r,-r),e.closePath()}},Na=-.5,Ea=Ja(3)/2,Vw=1/Ja(12),XY=(Vw/2+1)*3,GY={draw(e,t){const r=Ja(t/XY),n=r/2,a=r*Vw,o=n,s=r*Vw+r,l=-o,c=s;e.moveTo(n,a),e.lineTo(o,s),e.lineTo(l,c),e.lineTo(Na*n-Ea*a,Ea*n+Na*a),e.lineTo(Na*o-Ea*s,Ea*o+Na*s),e.lineTo(Na*l-Ea*c,Ea*l+Na*c),e.lineTo(Na*n+Ea*a,Na*a-Ea*n),e.lineTo(Na*o+Ea*s,Na*s-Ea*o),e.lineTo(Na*l+Ea*c,Na*c-Ea*l),e.closePath()}};function ZY(e,t){let r=null,n=AN(a);e=typeof e=="function"?e:$r(e||TN),t=typeof t=="function"?t:$r(t===void 0?64:+t);function a(){let o;if(r||(r=o=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),o)return r=null,o+""||null}return a.type=function(o){return arguments.length?(e=typeof o=="function"?o:$r(o),a):e},a.size=function(o){return arguments.length?(t=typeof o=="function"?o:$r(+o),a):t},a.context=function(o){return arguments.length?(r=o??null,a):r},a}function Ip(){}function Dp(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function mT(e){this._context=e}mT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Dp(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Dp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function JY(e){return new mT(e)}function pT(e){this._context=e}pT.prototype={areaStart:Ip,areaEnd:Ip,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Dp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function QY(e){return new pT(e)}function hT(e){this._context=e}hT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Dp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function eX(e){return new hT(e)}function gT(e){this._context=e}gT.prototype={areaStart:Ip,areaEnd:Ip,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function tX(e){return new gT(e)}function J4(e){return e<0?-1:1}function Q4(e,t,r){var n=e._x1-e._x0,a=t-e._x1,o=(e._y1-e._y0)/(n||a<0&&-0),s=(r-e._y1)/(a||n<0&&-0),l=(o*a+s*n)/(n+a);return(J4(o)+J4(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(l))||0}function e3(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Bx(e,t,r){var n=e._x0,a=e._y0,o=e._x1,s=e._y1,l=(o-n)/3;e._context.bezierCurveTo(n+l,a+l*t,o-l,s-l*r,o,s)}function Lp(e){this._context=e}Lp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Bx(this,this._t0,e3(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Bx(this,e3(this,r=Q4(this,e,t)),r);break;default:Bx(this,this._t0,r=Q4(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function bT(e){this._context=new yT(e)}(bT.prototype=Object.create(Lp.prototype)).point=function(e,t){Lp.prototype.point.call(this,t,e)};function yT(e){this._context=e}yT.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,a,o){this._context.bezierCurveTo(t,e,n,r,o,a)}};function rX(e){return new Lp(e)}function nX(e){return new bT(e)}function xT(e){this._context=e}xT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=t3(e),a=t3(t),o=0,s=1;s<r;++o,++s)this._context.bezierCurveTo(n[0][o],a[0][o],n[1][o],a[1][o],e[s],t[s]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function t3(e){var t,r=e.length-1,n,a=new Array(r),o=new Array(r),s=new Array(r);for(a[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<r-1;++t)a[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(a[r-1]=2,o[r-1]=7,s[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=a[t]/o[t-1],o[t]-=n,s[t]-=n*s[t-1];for(a[r-1]=s[r-1]/o[r-1],t=r-2;t>=0;--t)a[t]=(s[t]-a[t+1])/o[t];for(o[r-1]=(e[r]+a[r-1])/2,t=0;t<r-1;++t)o[t]=2*e[t+1]-a[t+1];return[a,o]}function aX(e){return new xT(e)}function Tg(e,t){this._context=e,this._t=t}Tg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function oX(e){return new Tg(e,.5)}function sX(e){return new Tg(e,0)}function iX(e){return new Tg(e,1)}function vc(e,t){if((s=e.length)>1)for(var r=1,n,a,o=e[t[0]],s,l=o.length;r<s;++r)for(a=o,o=e[t[r]],n=0;n<l;++n)o[n][1]+=o[n][0]=isNaN(a[n][1])?a[n][0]:a[n][1]}function Ww(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function lX(e,t){return e[t]}function cX(e){const t=[];return t.key=e,t}function uX(){var e=$r([]),t=Ww,r=vc,n=lX;function a(o){var s=Array.from(e.apply(this,arguments),cX),l,c=s.length,u=-1,d;for(const f of o)for(l=0,++u;l<c;++l)(s[l][u]=[0,+n(f,s[l].key,u,o)]).data=f;for(l=0,d=MN(t(s));l<c;++l)s[d[l]].index=l;return r(s,d),s}return a.keys=function(o){return arguments.length?(e=typeof o=="function"?o:$r(Array.from(o)),a):e},a.value=function(o){return arguments.length?(n=typeof o=="function"?o:$r(+o),a):n},a.order=function(o){return arguments.length?(t=o==null?Ww:typeof o=="function"?o:$r(Array.from(o)),a):t},a.offset=function(o){return arguments.length?(r=o??vc,a):r},a}function dX(e,t){if((n=e.length)>0){for(var r,n,a=0,o=e[0].length,s;a<o;++a){for(s=r=0;r<n;++r)s+=e[r][a][1]||0;if(s)for(r=0;r<n;++r)e[r][a][1]/=s}vc(e,t)}}function fX(e,t){if((a=e.length)>0){for(var r=0,n=e[t[0]],a,o=n.length;r<o;++r){for(var s=0,l=0;s<a;++s)l+=e[s][r][1]||0;n[r][1]+=n[r][0]=-l/2}vc(e,t)}}function mX(e,t){if(!(!((s=e.length)>0)||!((o=(a=e[t[0]]).length)>0))){for(var r=0,n=1,a,o,s;n<o;++n){for(var l=0,c=0,u=0;l<s;++l){for(var d=e[t[l]],f=d[n][1]||0,p=d[n-1][1]||0,h=(f-p)/2,g=0;g<l;++g){var b=e[t[g]],y=b[n][1]||0,v=b[n-1][1]||0;h+=y-v}c+=f,u+=h*f}a[n-1][1]+=a[n-1][0]=r,c&&(r-=u/c)}a[n-1][1]+=a[n-1][0]=r,vc(e,t)}}function Dd(e){"@babel/helpers - typeof";return Dd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dd(e)}var pX=["type","size","sizeType"];function Kw(){return Kw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kw.apply(this,arguments)}function r3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function n3(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?r3(Object(r),!0).forEach(function(n){hX(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):r3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hX(e,t,r){return t=gX(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gX(e){var t=bX(e,"string");return Dd(t)=="symbol"?t:t+""}function bX(e,t){if(Dd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Dd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yX(e,t){if(e==null)return{};var r=xX(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function xX(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var vT={symbolCircle:TN,symbolCross:BY,symbolDiamond:zY,symbolSquare:UY,symbolStar:KY,symbolTriangle:YY,symbolWye:GY},vX=Math.PI/180,kX=function(e){var t="symbol".concat(Pg(e));return vT[t]||TN},wX=function(e,t,r){if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*vX;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.pow(Math.tan(n),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},jX=function(e,t){vT["symbol".concat(Pg(e))]=t},_g=function(e){var t=e.type,r=t===void 0?"circle":t,n=e.size,a=n===void 0?64:n,o=e.sizeType,s=o===void 0?"area":o,l=yX(e,pX),c=n3(n3({},l),{},{type:r,size:a,sizeType:s}),u=function(){var g=kX(r),b=ZY().type(g).size(wX(a,s,r));return b()},d=c.className,f=c.cx,p=c.cy,h=mt(c,!0);return f===+f&&p===+p&&a===+a?x.createElement("path",Kw({},h,{className:Lt("recharts-symbols",d),transform:"translate(".concat(f,", ").concat(p,")"),d:u()})):null};_g.registerSymbol=jX;function kc(e){"@babel/helpers - typeof";return kc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kc(e)}function Yw(){return Yw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yw.apply(this,arguments)}function a3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function NX(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?a3(Object(r),!0).forEach(function(n){Ld(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function EX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function SX(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,wT(n.key),n)}}function CX(e,t,r){return t&&SX(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function OX(e,t,r){return t=Rp(t),PX(e,kT()?Reflect.construct(t,r||[],Rp(e).constructor):t.apply(e,r))}function PX(e,t){if(t&&(kc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return AX(e)}function AX(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kT=function(){return!!e})()}function Rp(e){return Rp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rp(e)}function MX(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Xw(e,t)}function Xw(e,t){return Xw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Xw(e,t)}function Ld(e,t,r){return t=wT(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wT(e){var t=TX(e,"string");return kc(t)=="symbol"?t:t+""}function TX(e,t){if(kc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(kc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ra=32,_N=function(e){function t(){return EX(this,t),OX(this,t,arguments)}return MX(t,e),CX(t,[{key:"renderIcon",value:function(r){var n=this.props.inactiveColor,a=Ra/2,o=Ra/6,s=Ra/3,l=r.inactive?n:r.color;if(r.type==="plainline")return x.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:a,x2:Ra,y2:a,className:"recharts-legend-icon"});if(r.type==="line")return x.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(a,"h").concat(s,`
33
- A`).concat(o,",").concat(o,",0,1,1,").concat(2*s,",").concat(a,`
34
- H`).concat(Ra,"M").concat(2*s,",").concat(a,`
35
- A`).concat(o,",").concat(o,",0,1,1,").concat(s,",").concat(a),className:"recharts-legend-icon"});if(r.type==="rect")return x.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(Ra/8,"h").concat(Ra,"v").concat(Ra*3/4,"h").concat(-32,"z"),className:"recharts-legend-icon"});if(x.isValidElement(r.legendIcon)){var c=NX({},r);return delete c.legendIcon,x.cloneElement(r.legendIcon,c)}return x.createElement(_g,{fill:l,cx:a,cy:a,size:Ra,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,n=this.props,a=n.payload,o=n.iconSize,s=n.layout,l=n.formatter,c=n.inactiveColor,u={x:0,y:0,width:Ra,height:Ra},d={display:s==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(p,h){var g=p.formatter||l,b=Lt(Ld(Ld({"recharts-legend-item":!0},"legend-item-".concat(h),!0),"inactive",p.inactive));if(p.type==="none")return null;var y=jt(p.value)?null:p.value;Va(!jt(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var v=p.inactive?c:p.color;return x.createElement("li",Yw({className:b,style:d,key:"legend-item-".concat(h)},ti(r.props,p,h)),x.createElement(Hw,{width:o,height:o,viewBox:u,style:f},r.renderIcon(p)),x.createElement("span",{className:"recharts-legend-item-text",style:{color:v}},g?g(y,p,h):y))})}},{key:"render",value:function(){var r=this.props,n=r.payload,a=r.layout,o=r.align;if(!n||!n.length)return null;var s={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return x.createElement("ul",{className:"recharts-default-legend",style:s},this.renderItems())}}])}(m.PureComponent);Ld(_N,"displayName","Legend");Ld(_N,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Hx,o3;function _X(){if(o3)return Hx;o3=1;var e=Sg();function t(){this.__data__=new e,this.size=0}return Hx=t,Hx}var zx,s3;function IX(){if(s3)return zx;s3=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return zx=e,zx}var Ux,i3;function DX(){if(i3)return Ux;i3=1;function e(t){return this.__data__.get(t)}return Ux=e,Ux}var qx,l3;function LX(){if(l3)return qx;l3=1;function e(t){return this.__data__.has(t)}return qx=e,qx}var Vx,c3;function RX(){if(c3)return Vx;c3=1;var e=Sg(),t=NN(),r=EN(),n=200;function a(o,s){var l=this.__data__;if(l instanceof e){var c=l.__data__;if(!t||c.length<n-1)return c.push([o,s]),this.size=++l.size,this;l=this.__data__=new r(c)}return l.set(o,s),this.size=l.size,this}return Vx=a,Vx}var Wx,u3;function jT(){if(u3)return Wx;u3=1;var e=Sg(),t=_X(),r=IX(),n=DX(),a=LX(),o=RX();function s(l){var c=this.__data__=new e(l);this.size=c.size}return s.prototype.clear=t,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=a,s.prototype.set=o,Wx=s,Wx}var Kx,d3;function FX(){if(d3)return Kx;d3=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return Kx=t,Kx}var Yx,f3;function $X(){if(f3)return Yx;f3=1;function e(t){return this.__data__.has(t)}return Yx=e,Yx}var Xx,m3;function NT(){if(m3)return Xx;m3=1;var e=EN(),t=FX(),r=$X();function n(a){var o=-1,s=a==null?0:a.length;for(this.__data__=new e;++o<s;)this.add(a[o])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,Xx=n,Xx}var Gx,p3;function ET(){if(p3)return Gx;p3=1;function e(t,r){for(var n=-1,a=t==null?0:t.length;++n<a;)if(r(t[n],n,t))return!0;return!1}return Gx=e,Gx}var Zx,h3;function ST(){if(h3)return Zx;h3=1;function e(t,r){return t.has(r)}return Zx=e,Zx}var Jx,g3;function CT(){if(g3)return Jx;g3=1;var e=NT(),t=ET(),r=ST(),n=1,a=2;function o(s,l,c,u,d,f){var p=c&n,h=s.length,g=l.length;if(h!=g&&!(p&&g>h))return!1;var b=f.get(s),y=f.get(l);if(b&&y)return b==l&&y==s;var v=-1,k=!0,N=c&a?new e:void 0;for(f.set(s,l),f.set(l,s);++v<h;){var w=s[v],E=l[v];if(u)var C=p?u(E,w,v,l,s,f):u(w,E,v,s,l,f);if(C!==void 0){if(C)continue;k=!1;break}if(N){if(!t(l,function(O,D){if(!r(N,D)&&(w===O||d(w,O,c,u,f)))return N.push(D)})){k=!1;break}}else if(!(w===E||d(w,E,c,u,f))){k=!1;break}}return f.delete(s),f.delete(l),k}return Jx=o,Jx}var Qx,b3;function BX(){if(b3)return Qx;b3=1;var e=Mo(),t=e.Uint8Array;return Qx=t,Qx}var ev,y3;function HX(){if(y3)return ev;y3=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(a,o){n[++r]=[o,a]}),n}return ev=e,ev}var tv,x3;function IN(){if(x3)return tv;x3=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(a){n[++r]=a}),n}return tv=e,tv}var rv,v3;function zX(){if(v3)return rv;v3=1;var e=Rf(),t=BX(),r=jN(),n=CT(),a=HX(),o=IN(),s=1,l=2,c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Map]",p="[object Number]",h="[object RegExp]",g="[object Set]",b="[object String]",y="[object Symbol]",v="[object ArrayBuffer]",k="[object DataView]",N=e?e.prototype:void 0,w=N?N.valueOf:void 0;function E(C,O,D,A,M,I,T){switch(D){case k:if(C.byteLength!=O.byteLength||C.byteOffset!=O.byteOffset)return!1;C=C.buffer,O=O.buffer;case v:return!(C.byteLength!=O.byteLength||!I(new t(C),new t(O)));case c:case u:case p:return r(+C,+O);case d:return C.name==O.name&&C.message==O.message;case h:case b:return C==O+"";case f:var R=a;case g:var L=A&s;if(R||(R=o),C.size!=O.size&&!L)return!1;var F=T.get(C);if(F)return F==O;A|=l,T.set(C,O);var V=n(R(C),R(O),A,M,I,T);return T.delete(C),V;case y:if(w)return w.call(C)==w.call(O)}return!1}return rv=E,rv}var nv,k3;function OT(){if(k3)return nv;k3=1;function e(t,r){for(var n=-1,a=r.length,o=t.length;++n<a;)t[o+n]=r[n];return t}return nv=e,nv}var av,w3;function UX(){if(w3)return av;w3=1;var e=OT(),t=Qn();function r(n,a,o){var s=a(n);return t(n)?s:e(s,o(n))}return av=r,av}var ov,j3;function qX(){if(j3)return ov;j3=1;function e(t,r){for(var n=-1,a=t==null?0:t.length,o=0,s=[];++n<a;){var l=t[n];r(l,n,t)&&(s[o++]=l)}return s}return ov=e,ov}var sv,N3;function VX(){if(N3)return sv;N3=1;function e(){return[]}return sv=e,sv}var iv,E3;function WX(){if(E3)return iv;E3=1;var e=qX(),t=VX(),r=Object.prototype,n=r.propertyIsEnumerable,a=Object.getOwnPropertySymbols,o=a?function(s){return s==null?[]:(s=Object(s),e(a(s),function(l){return n.call(s,l)}))}:t;return iv=o,iv}var lv,S3;function KX(){if(S3)return lv;S3=1;function e(t,r){for(var n=-1,a=Array(t);++n<t;)a[n]=r(n);return a}return lv=e,lv}var cv,C3;function YX(){if(C3)return cv;C3=1;var e=ms(),t=ps(),r="[object Arguments]";function n(a){return t(a)&&e(a)==r}return cv=n,cv}var uv,O3;function DN(){if(O3)return uv;O3=1;var e=YX(),t=ps(),r=Object.prototype,n=r.hasOwnProperty,a=r.propertyIsEnumerable,o=e(function(){return arguments}())?e:function(s){return t(s)&&n.call(s,"callee")&&!a.call(s,"callee")};return uv=o,uv}var sp={exports:{}},dv,P3;function XX(){if(P3)return dv;P3=1;function e(){return!1}return dv=e,dv}sp.exports;var A3;function PT(){return A3||(A3=1,function(e,t){var r=Mo(),n=XX(),a=t&&!t.nodeType&&t,o=a&&!0&&e&&!e.nodeType&&e,s=o&&o.exports===a,l=s?r.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||n;e.exports=u}(sp,sp.exports)),sp.exports}var fv,M3;function LN(){if(M3)return fv;M3=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,a){var o=typeof n;return a=a??e,!!a&&(o=="number"||o!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<a}return fv=r,fv}var mv,T3;function RN(){if(T3)return mv;T3=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return mv=t,mv}var pv,_3;function GX(){if(_3)return pv;_3=1;var e=ms(),t=RN(),r=ps(),n="[object Arguments]",a="[object Array]",o="[object Boolean]",s="[object Date]",l="[object Error]",c="[object Function]",u="[object Map]",d="[object Number]",f="[object Object]",p="[object RegExp]",h="[object Set]",g="[object String]",b="[object WeakMap]",y="[object ArrayBuffer]",v="[object DataView]",k="[object Float32Array]",N="[object Float64Array]",w="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",O="[object Uint8Array]",D="[object Uint8ClampedArray]",A="[object Uint16Array]",M="[object Uint32Array]",I={};I[k]=I[N]=I[w]=I[E]=I[C]=I[O]=I[D]=I[A]=I[M]=!0,I[n]=I[a]=I[y]=I[o]=I[v]=I[s]=I[l]=I[c]=I[u]=I[d]=I[f]=I[p]=I[h]=I[g]=I[b]=!1;function T(R){return r(R)&&t(R.length)&&!!I[e(R)]}return pv=T,pv}var hv,I3;function AT(){if(I3)return hv;I3=1;function e(t){return function(r){return t(r)}}return hv=e,hv}var ip={exports:{}};ip.exports;var D3;function ZX(){return D3||(D3=1,function(e,t){var r=X8(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===n,s=o&&r.process,l=function(){try{var c=a&&a.require&&a.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}}();e.exports=l}(ip,ip.exports)),ip.exports}var gv,L3;function MT(){if(L3)return gv;L3=1;var e=GX(),t=AT(),r=ZX(),n=r&&r.isTypedArray,a=n?t(n):e;return gv=a,gv}var bv,R3;function JX(){if(R3)return bv;R3=1;var e=KX(),t=DN(),r=Qn(),n=PT(),a=LN(),o=MT(),s=Object.prototype,l=s.hasOwnProperty;function c(u,d){var f=r(u),p=!f&&t(u),h=!f&&!p&&n(u),g=!f&&!p&&!h&&o(u),b=f||p||h||g,y=b?e(u.length,String):[],v=y.length;for(var k in u)(d||l.call(u,k))&&!(b&&(k=="length"||h&&(k=="offset"||k=="parent")||g&&(k=="buffer"||k=="byteLength"||k=="byteOffset")||a(k,v)))&&y.push(k);return y}return bv=c,bv}var yv,F3;function QX(){if(F3)return yv;F3=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,a=typeof n=="function"&&n.prototype||e;return r===a}return yv=t,yv}var xv,$3;function TT(){if($3)return xv;$3=1;function e(t,r){return function(n){return t(r(n))}}return xv=e,xv}var vv,B3;function eG(){if(B3)return vv;B3=1;var e=TT(),t=e(Object.keys,Object);return vv=t,vv}var kv,H3;function tG(){if(H3)return kv;H3=1;var e=QX(),t=eG(),r=Object.prototype,n=r.hasOwnProperty;function a(o){if(!e(o))return t(o);var s=[];for(var l in Object(o))n.call(o,l)&&l!="constructor"&&s.push(l);return s}return kv=a,kv}var wv,z3;function Ff(){if(z3)return wv;z3=1;var e=wN(),t=RN();function r(n){return n!=null&&t(n.length)&&!e(n)}return wv=r,wv}var jv,U3;function Ig(){if(U3)return jv;U3=1;var e=JX(),t=tG(),r=Ff();function n(a){return r(a)?e(a):t(a)}return jv=n,jv}var Nv,q3;function rG(){if(q3)return Nv;q3=1;var e=UX(),t=WX(),r=Ig();function n(a){return e(a,r,t)}return Nv=n,Nv}var Ev,V3;function nG(){if(V3)return Ev;V3=1;var e=rG(),t=1,r=Object.prototype,n=r.hasOwnProperty;function a(o,s,l,c,u,d){var f=l&t,p=e(o),h=p.length,g=e(s),b=g.length;if(h!=b&&!f)return!1;for(var y=h;y--;){var v=p[y];if(!(f?v in s:n.call(s,v)))return!1}var k=d.get(o),N=d.get(s);if(k&&N)return k==s&&N==o;var w=!0;d.set(o,s),d.set(s,o);for(var E=f;++y<h;){v=p[y];var C=o[v],O=s[v];if(c)var D=f?c(O,C,v,s,o,d):c(C,O,v,o,s,d);if(!(D===void 0?C===O||u(C,O,l,c,d):D)){w=!1;break}E||(E=v=="constructor")}if(w&&!E){var A=o.constructor,M=s.constructor;A!=M&&"constructor"in o&&"constructor"in s&&!(typeof A=="function"&&A instanceof A&&typeof M=="function"&&M instanceof M)&&(w=!1)}return d.delete(o),d.delete(s),w}return Ev=a,Ev}var Sv,W3;function aG(){if(W3)return Sv;W3=1;var e=gl(),t=Mo(),r=e(t,"DataView");return Sv=r,Sv}var Cv,K3;function oG(){if(K3)return Cv;K3=1;var e=gl(),t=Mo(),r=e(t,"Promise");return Cv=r,Cv}var Ov,Y3;function _T(){if(Y3)return Ov;Y3=1;var e=gl(),t=Mo(),r=e(t,"Set");return Ov=r,Ov}var Pv,X3;function sG(){if(X3)return Pv;X3=1;var e=gl(),t=Mo(),r=e(t,"WeakMap");return Pv=r,Pv}var Av,G3;function iG(){if(G3)return Av;G3=1;var e=aG(),t=NN(),r=oG(),n=_T(),a=sG(),o=ms(),s=G8(),l="[object Map]",c="[object Object]",u="[object Promise]",d="[object Set]",f="[object WeakMap]",p="[object DataView]",h=s(e),g=s(t),b=s(r),y=s(n),v=s(a),k=o;return(e&&k(new e(new ArrayBuffer(1)))!=p||t&&k(new t)!=l||r&&k(r.resolve())!=u||n&&k(new n)!=d||a&&k(new a)!=f)&&(k=function(N){var w=o(N),E=w==c?N.constructor:void 0,C=E?s(E):"";if(C)switch(C){case h:return p;case g:return l;case b:return u;case y:return d;case v:return f}return w}),Av=k,Av}var Mv,Z3;function lG(){if(Z3)return Mv;Z3=1;var e=jT(),t=CT(),r=zX(),n=nG(),a=iG(),o=Qn(),s=PT(),l=MT(),c=1,u="[object Arguments]",d="[object Array]",f="[object Object]",p=Object.prototype,h=p.hasOwnProperty;function g(b,y,v,k,N,w){var E=o(b),C=o(y),O=E?d:a(b),D=C?d:a(y);O=O==u?f:O,D=D==u?f:D;var A=O==f,M=D==f,I=O==D;if(I&&s(b)){if(!s(y))return!1;E=!0,A=!1}if(I&&!A)return w||(w=new e),E||l(b)?t(b,y,v,k,N,w):r(b,y,O,v,k,N,w);if(!(v&c)){var T=A&&h.call(b,"__wrapped__"),R=M&&h.call(y,"__wrapped__");if(T||R){var L=T?b.value():b,F=R?y.value():y;return w||(w=new e),N(L,F,v,k,w)}}return I?(w||(w=new e),n(b,y,v,k,N,w)):!1}return Mv=g,Mv}var Tv,J3;function FN(){if(J3)return Tv;J3=1;var e=lG(),t=ps();function r(n,a,o,s,l){return n===a?!0:n==null||a==null||!t(n)&&!t(a)?n!==n&&a!==a:e(n,a,o,s,r,l)}return Tv=r,Tv}var _v,Q3;function cG(){if(Q3)return _v;Q3=1;var e=jT(),t=FN(),r=1,n=2;function a(o,s,l,c){var u=l.length,d=u,f=!c;if(o==null)return!d;for(o=Object(o);u--;){var p=l[u];if(f&&p[2]?p[1]!==o[p[0]]:!(p[0]in o))return!1}for(;++u<d;){p=l[u];var h=p[0],g=o[h],b=p[1];if(f&&p[2]){if(g===void 0&&!(h in o))return!1}else{var y=new e;if(c)var v=c(g,b,h,o,s,y);if(!(v===void 0?t(b,g,r|n,c,y):v))return!1}}return!0}return _v=a,_v}var Iv,eC;function IT(){if(eC)return Iv;eC=1;var e=di();function t(r){return r===r&&!e(r)}return Iv=t,Iv}var Dv,tC;function uG(){if(tC)return Dv;tC=1;var e=IT(),t=Ig();function r(n){for(var a=t(n),o=a.length;o--;){var s=a[o],l=n[s];a[o]=[s,l,e(l)]}return a}return Dv=r,Dv}var Lv,rC;function DT(){if(rC)return Lv;rC=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return Lv=e,Lv}var Rv,nC;function dG(){if(nC)return Rv;nC=1;var e=cG(),t=uG(),r=DT();function n(a){var o=t(a);return o.length==1&&o[0][2]?r(o[0][0],o[0][1]):function(s){return s===a||e(s,a,o)}}return Rv=n,Rv}var Fv,aC;function fG(){if(aC)return Fv;aC=1;function e(t,r){return t!=null&&r in Object(t)}return Fv=e,Fv}var $v,oC;function mG(){if(oC)return $v;oC=1;var e=Q8(),t=DN(),r=Qn(),n=LN(),a=RN(),o=Og();function s(l,c,u){c=e(c,l);for(var d=-1,f=c.length,p=!1;++d<f;){var h=o(c[d]);if(!(p=l!=null&&u(l,h)))break;l=l[h]}return p||++d!=f?p:(f=l==null?0:l.length,!!f&&a(f)&&n(h,f)&&(r(l)||t(l)))}return $v=s,$v}var Bv,sC;function pG(){if(sC)return Bv;sC=1;var e=fG(),t=mG();function r(n,a){return n!=null&&t(n,a,e)}return Bv=r,Bv}var Hv,iC;function hG(){if(iC)return Hv;iC=1;var e=FN(),t=eT(),r=pG(),n=kN(),a=IT(),o=DT(),s=Og(),l=1,c=2;function u(d,f){return n(d)&&a(f)?o(s(d),f):function(p){var h=t(p,d);return h===void 0&&h===f?r(p,d):e(f,h,l|c)}}return Hv=u,Hv}var zv,lC;function lu(){if(lC)return zv;lC=1;function e(t){return t}return zv=e,zv}var Uv,cC;function gG(){if(cC)return Uv;cC=1;function e(t){return function(r){return r?.[t]}}return Uv=e,Uv}var qv,uC;function bG(){if(uC)return qv;uC=1;var e=CN();function t(r){return function(n){return e(n,r)}}return qv=t,qv}var Vv,dC;function yG(){if(dC)return Vv;dC=1;var e=gG(),t=bG(),r=kN(),n=Og();function a(o){return r(o)?e(n(o)):t(o)}return Vv=a,Vv}var Wv,fC;function To(){if(fC)return Wv;fC=1;var e=dG(),t=hG(),r=lu(),n=Qn(),a=yG();function o(s){return typeof s=="function"?s:s==null?r:typeof s=="object"?n(s)?t(s[0],s[1]):e(s):a(s)}return Wv=o,Wv}var Kv,mC;function LT(){if(mC)return Kv;mC=1;function e(t,r,n,a){for(var o=t.length,s=n+(a?1:-1);a?s--:++s<o;)if(r(t[s],s,t))return s;return-1}return Kv=e,Kv}var Yv,pC;function xG(){if(pC)return Yv;pC=1;function e(t){return t!==t}return Yv=e,Yv}var Xv,hC;function vG(){if(hC)return Xv;hC=1;function e(t,r,n){for(var a=n-1,o=t.length;++a<o;)if(t[a]===r)return a;return-1}return Xv=e,Xv}var Gv,gC;function kG(){if(gC)return Gv;gC=1;var e=LT(),t=xG(),r=vG();function n(a,o,s){return o===o?r(a,o,s):e(a,t,s)}return Gv=n,Gv}var Zv,bC;function wG(){if(bC)return Zv;bC=1;var e=kG();function t(r,n){var a=r==null?0:r.length;return!!a&&e(r,n,0)>-1}return Zv=t,Zv}var Jv,yC;function jG(){if(yC)return Jv;yC=1;function e(t,r,n){for(var a=-1,o=t==null?0:t.length;++a<o;)if(n(r,t[a]))return!0;return!1}return Jv=e,Jv}var Qv,xC;function NG(){if(xC)return Qv;xC=1;function e(){}return Qv=e,Qv}var e0,vC;function EG(){if(vC)return e0;vC=1;var e=_T(),t=NG(),r=IN(),n=1/0,a=e&&1/r(new e([,-0]))[1]==n?function(o){return new e(o)}:t;return e0=a,e0}var t0,kC;function SG(){if(kC)return t0;kC=1;var e=NT(),t=wG(),r=jG(),n=ST(),a=EG(),o=IN(),s=200;function l(c,u,d){var f=-1,p=t,h=c.length,g=!0,b=[],y=b;if(d)g=!1,p=r;else if(h>=s){var v=u?null:a(c);if(v)return o(v);g=!1,p=n,y=new e}else y=u?[]:b;e:for(;++f<h;){var k=c[f],N=u?u(k):k;if(k=d||k!==0?k:0,g&&N===N){for(var w=y.length;w--;)if(y[w]===N)continue e;u&&y.push(N),b.push(k)}else p(y,N,d)||(y!==b&&y.push(N),b.push(k))}return b}return t0=l,t0}var r0,wC;function CG(){if(wC)return r0;wC=1;var e=To(),t=SG();function r(n,a){return n&&n.length?t(n,e(a,2)):[]}return r0=r,r0}var OG=CG();const jC=mr(OG);function RT(e,t,r){return t===!0?jC(e,r):jt(t)?jC(e,t):e}function wc(e){"@babel/helpers - typeof";return wc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wc(e)}var PG=["ref"];function NC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Fo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?NC(Object(r),!0).forEach(function(n){Dg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NC(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function AG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function EC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,$T(n.key),n)}}function MG(e,t,r){return t&&EC(e.prototype,t),r&&EC(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function TG(e,t,r){return t=Fp(t),_G(e,FT()?Reflect.construct(t,r||[],Fp(e).constructor):t.apply(e,r))}function _G(e,t){if(t&&(wc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return IG(e)}function IG(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function FT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(FT=function(){return!!e})()}function Fp(e){return Fp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fp(e)}function DG(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Gw(e,t)}function Gw(e,t){return Gw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Gw(e,t)}function Dg(e,t,r){return t=$T(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $T(e){var t=LG(e,"string");return wc(t)=="symbol"?t:t+""}function LG(e,t){if(wc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(wc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function RG(e,t){if(e==null)return{};var r=FG(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function FG(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function $G(e){return e.value}function BG(e,t){if(x.isValidElement(e))return x.cloneElement(e,t);if(typeof e=="function")return x.createElement(e,t);t.ref;var r=RG(t,PG);return x.createElement(_N,r)}var SC=1,go=function(e){function t(){var r;AG(this,t);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return r=TG(this,t,[].concat(a)),Dg(r,"lastBoundingBox",{width:-1,height:-1}),r}return DG(t,e),MG(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,n=this.getBBox();n?(Math.abs(n.width-this.lastBoundingBox.width)>SC||Math.abs(n.height-this.lastBoundingBox.height)>SC)&&(this.lastBoundingBox.width=n.width,this.lastBoundingBox.height=n.height,r&&r(n)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Fo({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var n=this.props,a=n.layout,o=n.align,s=n.verticalAlign,l=n.margin,c=n.chartWidth,u=n.chartHeight,d,f;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&a==="vertical"){var p=this.getBBoxSnapshot();d={left:((c||0)-p.width)/2}}else d=o==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(s==="middle"){var h=this.getBBoxSnapshot();f={top:((u||0)-h.height)/2}}else f=s==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return Fo(Fo({},d),f)}},{key:"render",value:function(){var r=this,n=this.props,a=n.content,o=n.width,s=n.height,l=n.wrapperStyle,c=n.payloadUniqBy,u=n.payload,d=Fo(Fo({position:"absolute",width:o||"auto",height:s||"auto"},this.getDefaultPosition(l)),l);return x.createElement("div",{className:"recharts-legend-wrapper",style:d,ref:function(f){r.wrapperNode=f}},BG(a,Fo(Fo({},this.props),{},{payload:RT(u,c,$G)})))}}],[{key:"getWithHeight",value:function(r,n){var a=Fo(Fo({},this.defaultProps),r.props),o=a.layout;return o==="vertical"&&ze(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||n}:null}}])}(m.PureComponent);Dg(go,"displayName","Legend");Dg(go,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var n0,CC;function HG(){if(CC)return n0;CC=1;var e=Rf(),t=DN(),r=Qn(),n=e?e.isConcatSpreadable:void 0;function a(o){return r(o)||t(o)||!!(n&&o&&o[n])}return n0=a,n0}var a0,OC;function BT(){if(OC)return a0;OC=1;var e=OT(),t=HG();function r(n,a,o,s,l){var c=-1,u=n.length;for(o||(o=t),l||(l=[]);++c<u;){var d=n[c];a>0&&o(d)?a>1?r(d,a-1,o,s,l):e(l,d):s||(l[l.length]=d)}return l}return a0=r,a0}var o0,PC;function zG(){if(PC)return o0;PC=1;function e(t){return function(r,n,a){for(var o=-1,s=Object(r),l=a(r),c=l.length;c--;){var u=l[t?c:++o];if(n(s[u],u,s)===!1)break}return r}}return o0=e,o0}var s0,AC;function UG(){if(AC)return s0;AC=1;var e=zG(),t=e();return s0=t,s0}var i0,MC;function HT(){if(MC)return i0;MC=1;var e=UG(),t=Ig();function r(n,a){return n&&e(n,a,t)}return i0=r,i0}var l0,TC;function qG(){if(TC)return l0;TC=1;var e=Ff();function t(r,n){return function(a,o){if(a==null)return a;if(!e(a))return r(a,o);for(var s=a.length,l=n?s:-1,c=Object(a);(n?l--:++l<s)&&o(c[l],l,c)!==!1;);return a}}return l0=t,l0}var c0,_C;function $N(){if(_C)return c0;_C=1;var e=HT(),t=qG(),r=t(e);return c0=r,c0}var u0,IC;function zT(){if(IC)return u0;IC=1;var e=$N(),t=Ff();function r(n,a){var o=-1,s=t(n)?Array(n.length):[];return e(n,function(l,c,u){s[++o]=a(l,c,u)}),s}return u0=r,u0}var d0,DC;function VG(){if(DC)return d0;DC=1;function e(t,r){var n=t.length;for(t.sort(r);n--;)t[n]=t[n].value;return t}return d0=e,d0}var f0,LC;function WG(){if(LC)return f0;LC=1;var e=ou();function t(r,n){if(r!==n){var a=r!==void 0,o=r===null,s=r===r,l=e(r),c=n!==void 0,u=n===null,d=n===n,f=e(n);if(!u&&!f&&!l&&r>n||l&&c&&d&&!u&&!f||o&&c&&d||!a&&d||!s)return 1;if(!o&&!l&&!f&&r<n||f&&a&&s&&!o&&!l||u&&a&&s||!c&&s||!d)return-1}return 0}return f0=t,f0}var m0,RC;function KG(){if(RC)return m0;RC=1;var e=WG();function t(r,n,a){for(var o=-1,s=r.criteria,l=n.criteria,c=s.length,u=a.length;++o<c;){var d=e(s[o],l[o]);if(d){if(o>=u)return d;var f=a[o];return d*(f=="desc"?-1:1)}}return r.index-n.index}return m0=t,m0}var p0,FC;function YG(){if(FC)return p0;FC=1;var e=SN(),t=CN(),r=To(),n=zT(),a=VG(),o=AT(),s=KG(),l=lu(),c=Qn();function u(d,f,p){f.length?f=e(f,function(b){return c(b)?function(y){return t(y,b.length===1?b[0]:b)}:b}):f=[l];var h=-1;f=e(f,o(r));var g=n(d,function(b,y,v){var k=e(f,function(N){return N(b)});return{criteria:k,index:++h,value:b}});return a(g,function(b,y){return s(b,y,p)})}return p0=u,p0}var h0,$C;function XG(){if($C)return h0;$C=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return h0=e,h0}var g0,BC;function GG(){if(BC)return g0;BC=1;var e=XG(),t=Math.max;function r(n,a,o){return a=t(a===void 0?n.length-1:a,0),function(){for(var s=arguments,l=-1,c=t(s.length-a,0),u=Array(c);++l<c;)u[l]=s[a+l];l=-1;for(var d=Array(a+1);++l<a;)d[l]=s[l];return d[a]=o(u),e(n,this,d)}}return g0=r,g0}var b0,HC;function ZG(){if(HC)return b0;HC=1;function e(t){return function(){return t}}return b0=e,b0}var y0,zC;function UT(){if(zC)return y0;zC=1;var e=gl(),t=function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}}();return y0=t,y0}var x0,UC;function JG(){if(UC)return x0;UC=1;var e=ZG(),t=UT(),r=lu(),n=t?function(a,o){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:r;return x0=n,x0}var v0,qC;function QG(){if(qC)return v0;qC=1;var e=800,t=16,r=Date.now;function n(a){var o=0,s=0;return function(){var l=r(),c=t-(l-s);if(s=l,c>0){if(++o>=e)return arguments[0]}else o=0;return a.apply(void 0,arguments)}}return v0=n,v0}var k0,VC;function eZ(){if(VC)return k0;VC=1;var e=JG(),t=QG(),r=t(e);return k0=r,k0}var w0,WC;function tZ(){if(WC)return w0;WC=1;var e=lu(),t=GG(),r=eZ();function n(a,o){return r(t(a,o,e),a+"")}return w0=n,w0}var j0,KC;function Lg(){if(KC)return j0;KC=1;var e=jN(),t=Ff(),r=LN(),n=di();function a(o,s,l){if(!n(l))return!1;var c=typeof s;return(c=="number"?t(l)&&r(s,l.length):c=="string"&&s in l)?e(l[s],o):!1}return j0=a,j0}var N0,YC;function rZ(){if(YC)return N0;YC=1;var e=BT(),t=YG(),r=tZ(),n=Lg(),a=r(function(o,s){if(o==null)return[];var l=s.length;return l>1&&n(o,s[0],s[1])?s=[]:l>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),t(o,e(s,1),[])});return N0=a,N0}var nZ=rZ();const BN=mr(nZ);function Rd(e){"@babel/helpers - typeof";return Rd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rd(e)}function Zw(){return Zw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zw.apply(this,arguments)}function aZ(e,t){return lZ(e)||iZ(e,t)||sZ(e,t)||oZ()}function oZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
36
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sZ(e,t){if(e){if(typeof e=="string")return XC(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return XC(e,t)}}function XC(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function iZ(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function lZ(e){if(Array.isArray(e))return e}function GC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function E0(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?GC(Object(r),!0).forEach(function(n){cZ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):GC(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cZ(e,t,r){return t=uZ(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uZ(e){var t=dZ(e,"string");return Rd(t)=="symbol"?t:t+""}function dZ(e,t){if(Rd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Rd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fZ(e){return Array.isArray(e)&&bn(e[0])&&bn(e[1])?e.join(" ~ "):e}var mZ=function(e){var t=e.separator,r=t===void 0?" : ":t,n=e.contentStyle,a=n===void 0?{}:n,o=e.itemStyle,s=o===void 0?{}:o,l=e.labelStyle,c=l===void 0?{}:l,u=e.payload,d=e.formatter,f=e.itemSorter,p=e.wrapperClassName,h=e.labelClassName,g=e.label,b=e.labelFormatter,y=e.accessibilityLayer,v=y===void 0?!1:y,k=function(){if(u&&u.length){var M={padding:0,margin:0},I=(f?BN(u,f):u).map(function(T,R){if(T.type==="none")return null;var L=E0({display:"block",paddingTop:4,paddingBottom:4,color:T.color||"#000"},s),F=T.formatter||d||fZ,V=T.value,H=T.name,$=V,z=H;if(F&&$!=null&&z!=null){var W=F(V,H,T,R,u);if(Array.isArray(W)){var U=aZ(W,2);$=U[0],z=U[1]}else $=W}return x.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(R),style:L},bn(z)?x.createElement("span",{className:"recharts-tooltip-item-name"},z):null,bn(z)?x.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,x.createElement("span",{className:"recharts-tooltip-item-value"},$),x.createElement("span",{className:"recharts-tooltip-item-unit"},T.unit||""))});return x.createElement("ul",{className:"recharts-tooltip-item-list",style:M},I)}return null},N=E0({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),w=E0({margin:0},c),E=!vt(g),C=E?g:"",O=Lt("recharts-default-tooltip",p),D=Lt("recharts-tooltip-label",h);E&&b&&u!==void 0&&u!==null&&(C=b(g,u));var A=v?{role:"status","aria-live":"assertive"}:{};return x.createElement("div",Zw({className:O,style:N},A),x.createElement("p",{className:D,style:w},x.isValidElement(C)?C:"".concat(C)),k())};function Fd(e){"@babel/helpers - typeof";return Fd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fd(e)}function _m(e,t,r){return t=pZ(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pZ(e){var t=hZ(e,"string");return Fd(t)=="symbol"?t:t+""}function hZ(e,t){if(Fd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Fd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Bu="recharts-tooltip-wrapper",gZ={visibility:"hidden"};function bZ(e){var t=e.coordinate,r=e.translateX,n=e.translateY;return Lt(Bu,_m(_m(_m(_m({},"".concat(Bu,"-right"),ze(r)&&t&&ze(t.x)&&r>=t.x),"".concat(Bu,"-left"),ze(r)&&t&&ze(t.x)&&r<t.x),"".concat(Bu,"-bottom"),ze(n)&&t&&ze(t.y)&&n>=t.y),"".concat(Bu,"-top"),ze(n)&&t&&ze(t.y)&&n<t.y))}function ZC(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.key,a=e.offsetTopLeft,o=e.position,s=e.reverseDirection,l=e.tooltipDimension,c=e.viewBox,u=e.viewBoxDimension;if(o&&ze(o[n]))return o[n];var d=r[n]-l-a,f=r[n]+a;if(t[n])return s[n]?d:f;if(s[n]){var p=d,h=c[n];return p<h?Math.max(f,c[n]):Math.max(d,c[n])}var g=f+l,b=c[n]+u;return g>b?Math.max(d,c[n]):Math.max(f,c[n])}function yZ(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function xZ(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,a=e.position,o=e.reverseDirection,s=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return s.height>0&&s.width>0&&r?(d=ZC({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:c,viewBoxDimension:c.width}),f=ZC({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:c,viewBoxDimension:c.height}),u=yZ({translateX:d,translateY:f,useTranslate3d:l})):u=gZ,{cssProperties:u,cssClasses:bZ({translateX:d,translateY:f,coordinate:r})}}function jc(e){"@babel/helpers - typeof";return jc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jc(e)}function JC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function QC(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?JC(Object(r),!0).forEach(function(n){Qw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JC(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function vZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kZ(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,VT(n.key),n)}}function wZ(e,t,r){return t&&kZ(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function jZ(e,t,r){return t=$p(t),NZ(e,qT()?Reflect.construct(t,r||[],$p(e).constructor):t.apply(e,r))}function NZ(e,t){if(t&&(jc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return EZ(e)}function EZ(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qT=function(){return!!e})()}function $p(e){return $p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$p(e)}function SZ(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Jw(e,t)}function Jw(e,t){return Jw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Jw(e,t)}function Qw(e,t,r){return t=VT(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function VT(e){var t=CZ(e,"string");return jc(t)=="symbol"?t:t+""}function CZ(e,t){if(jc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(jc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var eO=1,OZ=function(e){function t(){var r;vZ(this,t);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return r=jZ(this,t,[].concat(a)),Qw(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),Qw(r,"handleKeyDown",function(s){if(s.key==="Escape"){var l,c,u,d;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=r.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(u=(d=r.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&u!==void 0?u:0}})}}),r}return SZ(t,e),wZ(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>eO||Math.abs(r.height-this.state.lastBoundingBox.height)>eO)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,n;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,n=this.props,a=n.active,o=n.allowEscapeViewBox,s=n.animationDuration,l=n.animationEasing,c=n.children,u=n.coordinate,d=n.hasPayload,f=n.isAnimationActive,p=n.offset,h=n.position,g=n.reverseDirection,b=n.useTranslate3d,y=n.viewBox,v=n.wrapperStyle,k=xZ({allowEscapeViewBox:o,coordinate:u,offsetTopLeft:p,position:h,reverseDirection:g,tooltipBox:this.state.lastBoundingBox,useTranslate3d:b,viewBox:y}),N=k.cssClasses,w=k.cssProperties,E=QC(QC({transition:f&&a?"transform ".concat(s,"ms ").concat(l):void 0},w),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&d?"visible":"hidden",position:"absolute",top:0,left:0},v);return x.createElement("div",{tabIndex:-1,className:N,style:E,ref:function(C){r.wrapperNode=C}},c)}}])}(m.PureComponent),PZ=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},hs={isSsr:PZ()};function Nc(e){"@babel/helpers - typeof";return Nc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nc(e)}function tO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function rO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tO(Object(r),!0).forEach(function(n){HN(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function AZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MZ(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,KT(n.key),n)}}function TZ(e,t,r){return t&&MZ(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _Z(e,t,r){return t=Bp(t),IZ(e,WT()?Reflect.construct(t,r||[],Bp(e).constructor):t.apply(e,r))}function IZ(e,t){if(t&&(Nc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return DZ(e)}function DZ(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function WT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(WT=function(){return!!e})()}function Bp(e){return Bp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bp(e)}function LZ(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&e2(e,t)}function e2(e,t){return e2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},e2(e,t)}function HN(e,t,r){return t=KT(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function KT(e){var t=RZ(e,"string");return Nc(t)=="symbol"?t:t+""}function RZ(e,t){if(Nc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Nc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function FZ(e){return e.dataKey}function $Z(e,t){return x.isValidElement(e)?x.cloneElement(e,t):typeof e=="function"?x.createElement(e,t):x.createElement(mZ,t)}var qn=function(e){function t(){return AZ(this,t),_Z(this,t,arguments)}return LZ(t,e),TZ(t,[{key:"render",value:function(){var r=this,n=this.props,a=n.active,o=n.allowEscapeViewBox,s=n.animationDuration,l=n.animationEasing,c=n.content,u=n.coordinate,d=n.filterNull,f=n.isAnimationActive,p=n.offset,h=n.payload,g=n.payloadUniqBy,b=n.position,y=n.reverseDirection,v=n.useTranslate3d,k=n.viewBox,N=n.wrapperStyle,w=h??[];d&&w.length&&(w=RT(h.filter(function(C){return C.value!=null&&(C.hide!==!0||r.props.includeHidden)}),g,FZ));var E=w.length>0;return x.createElement(OZ,{allowEscapeViewBox:o,animationDuration:s,animationEasing:l,isAnimationActive:f,active:a,coordinate:u,hasPayload:E,offset:p,position:b,reverseDirection:y,useTranslate3d:v,viewBox:k,wrapperStyle:N},$Z(c,rO(rO({},this.props),{},{payload:w})))}}])}(m.PureComponent);HN(qn,"displayName","Tooltip");HN(qn,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!hs.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var S0,nO;function BZ(){if(nO)return S0;nO=1;var e=Mo(),t=function(){return e.Date.now()};return S0=t,S0}var C0,aO;function HZ(){if(aO)return C0;aO=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return C0=t,C0}var O0,oO;function zZ(){if(oO)return O0;oO=1;var e=HZ(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return O0=r,O0}var P0,sO;function YT(){if(sO)return P0;sO=1;var e=zZ(),t=di(),r=ou(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt;function c(u){if(typeof u=="number")return u;if(r(u))return n;if(t(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=t(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=e(u);var f=o.test(u);return f||s.test(u)?l(u.slice(2),f?2:8):a.test(u)?n:+u}return P0=c,P0}var A0,iO;function UZ(){if(iO)return A0;iO=1;var e=di(),t=BZ(),r=YT(),n="Expected a function",a=Math.max,o=Math.min;function s(l,c,u){var d,f,p,h,g,b,y=0,v=!1,k=!1,N=!0;if(typeof l!="function")throw new TypeError(n);c=r(c)||0,e(u)&&(v=!!u.leading,k="maxWait"in u,p=k?a(r(u.maxWait)||0,c):p,N="trailing"in u?!!u.trailing:N);function w(R){var L=d,F=f;return d=f=void 0,y=R,h=l.apply(F,L),h}function E(R){return y=R,g=setTimeout(D,c),v?w(R):h}function C(R){var L=R-b,F=R-y,V=c-L;return k?o(V,p-F):V}function O(R){var L=R-b,F=R-y;return b===void 0||L>=c||L<0||k&&F>=p}function D(){var R=t();if(O(R))return A(R);g=setTimeout(D,C(R))}function A(R){return g=void 0,N&&d?w(R):(d=f=void 0,h)}function M(){g!==void 0&&clearTimeout(g),y=0,d=b=f=g=void 0}function I(){return g===void 0?h:A(t())}function T(){var R=t(),L=O(R);if(d=arguments,f=this,b=R,L){if(g===void 0)return E(b);if(k)return clearTimeout(g),g=setTimeout(D,c),w(b)}return g===void 0&&(g=setTimeout(D,c)),h}return T.cancel=M,T.flush=I,T}return A0=s,A0}var M0,lO;function qZ(){if(lO)return M0;lO=1;var e=UZ(),t=di(),r="Expected a function";function n(a,o,s){var l=!0,c=!0;if(typeof a!="function")throw new TypeError(r);return t(s)&&(l="leading"in s?!!s.leading:l,c="trailing"in s?!!s.trailing:c),e(a,o,{leading:l,maxWait:o,trailing:c})}return M0=n,M0}var VZ=qZ();const XT=mr(VZ);function $d(e){"@babel/helpers - typeof";return $d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$d(e)}function cO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Im(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cO(Object(r),!0).forEach(function(n){WZ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function WZ(e,t,r){return t=KZ(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function KZ(e){var t=YZ(e,"string");return $d(t)=="symbol"?t:t+""}function YZ(e,t){if($d(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if($d(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function XZ(e,t){return QZ(e)||JZ(e,t)||ZZ(e,t)||GZ()}function GZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
37
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZZ(e,t){if(e){if(typeof e=="string")return uO(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uO(e,t)}}function uO(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function JZ(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function QZ(e){if(Array.isArray(e))return e}var mi=m.forwardRef(function(e,t){var r=e.aspect,n=e.initialDimension,a=n===void 0?{width:-1,height:-1}:n,o=e.width,s=o===void 0?"100%":o,l=e.height,c=l===void 0?"100%":l,u=e.minWidth,d=u===void 0?0:u,f=e.minHeight,p=e.maxHeight,h=e.children,g=e.debounce,b=g===void 0?0:g,y=e.id,v=e.className,k=e.onResize,N=e.style,w=N===void 0?{}:N,E=m.useRef(null),C=m.useRef();C.current=k,m.useImperativeHandle(t,function(){return Object.defineProperty(E.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),E.current},configurable:!0})});var O=m.useState({containerWidth:a.width,containerHeight:a.height}),D=XZ(O,2),A=D[0],M=D[1],I=m.useCallback(function(R,L){M(function(F){var V=Math.round(R),H=Math.round(L);return F.containerWidth===V&&F.containerHeight===H?F:{containerWidth:V,containerHeight:H}})},[]);m.useEffect(function(){var R=function($){var z,W=$[0].contentRect,U=W.width,X=W.height;I(U,X),(z=C.current)===null||z===void 0||z.call(C,U,X)};b>0&&(R=XT(R,b,{trailing:!0,leading:!1}));var L=new ResizeObserver(R),F=E.current.getBoundingClientRect(),V=F.width,H=F.height;return I(V,H),L.observe(E.current),function(){L.disconnect()}},[I,b]);var T=m.useMemo(function(){var R=A.containerWidth,L=A.containerHeight;if(R<0||L<0)return null;Va(Wi(s)||Wi(c),`The width(%s) and height(%s) are both fixed numbers,
38
- maybe you don't need to use a ResponsiveContainer.`,s,c),Va(!r||r>0,"The aspect(%s) must be greater than zero.",r);var F=Wi(s)?R:s,V=Wi(c)?L:c;r&&r>0&&(F?V=F/r:V&&(F=V*r),p&&V>p&&(V=p)),Va(F>0||V>0,`The width(%s) and height(%s) of chart should be greater than 0,
39
- please check the style of container, or the props width(%s) and height(%s),
40
- or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
41
- height and width.`,F,V,s,c,d,f,r);var H=!Array.isArray(h)&&Go(h.type).endsWith("Chart");return x.Children.map(h,function($){return x.isValidElement($)?m.cloneElement($,Im({width:F,height:V},H?{style:Im({height:"100%",width:"100%",maxHeight:V,maxWidth:F},$.props.style)}:{})):$})},[r,h,c,p,f,d,A,s]);return x.createElement("div",{id:y?"".concat(y):void 0,className:Lt("recharts-responsive-container",v),style:Im(Im({},w),{},{width:s,height:c,minWidth:d,minHeight:f,maxHeight:p}),ref:E},T)}),Rg=function(e){return null};Rg.displayName="Cell";function Bd(e){"@babel/helpers - typeof";return Bd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bd(e)}function dO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function t2(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dO(Object(r),!0).forEach(function(n){eJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function eJ(e,t,r){return t=tJ(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tJ(e){var t=rJ(e,"string");return Bd(t)=="symbol"?t:t+""}function rJ(e,t){if(Bd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Bd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Al={widthCache:{},cacheCount:0},nJ=2e3,aJ={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},fO="recharts_measurement_span";function oJ(e){var t=t2({},e);return Object.keys(t).forEach(function(r){t[r]||delete t[r]}),t}var xd=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||hs.isSsr)return{width:0,height:0};var r=oJ(t),n=JSON.stringify({text:e,copyStyle:r});if(Al.widthCache[n])return Al.widthCache[n];try{var a=document.getElementById(fO);a||(a=document.createElement("span"),a.setAttribute("id",fO),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=t2(t2({},aJ),r);Object.assign(a.style,o),a.textContent="".concat(e);var s=a.getBoundingClientRect(),l={width:s.width,height:s.height};return Al.widthCache[n]=l,++Al.cacheCount>nJ&&(Al.cacheCount=0,Al.widthCache={}),l}catch{return{width:0,height:0}}},sJ=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function Hd(e){"@babel/helpers - typeof";return Hd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hd(e)}function Hp(e,t){return uJ(e)||cJ(e,t)||lJ(e,t)||iJ()}function iJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
42
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lJ(e,t){if(e){if(typeof e=="string")return mO(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return mO(e,t)}}function mO(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function cJ(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function uJ(e){if(Array.isArray(e))return e}function dJ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,mJ(n.key),n)}}function fJ(e,t,r){return t&&pO(e.prototype,t),r&&pO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function mJ(e){var t=pJ(e,"string");return Hd(t)=="symbol"?t:t+""}function pJ(e,t){if(Hd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Hd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var hO=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,gO=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,hJ=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,gJ=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,GT={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},bJ=Object.keys(GT),Vl="NaN";function yJ(e,t){return e*GT[t]}var Dm=function(){function e(t,r){dJ(this,e),this.num=t,this.unit=r,this.num=t,this.unit=r,Number.isNaN(t)&&(this.unit=""),r!==""&&!hJ.test(r)&&(this.num=NaN,this.unit=""),bJ.includes(r)&&(this.num=yJ(t,r),this.unit="px")}return fJ(e,[{key:"add",value:function(t){return this.unit!==t.unit?new e(NaN,""):new e(this.num+t.num,this.unit)}},{key:"subtract",value:function(t){return this.unit!==t.unit?new e(NaN,""):new e(this.num-t.num,this.unit)}},{key:"multiply",value:function(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new e(NaN,""):new e(this.num*t.num,this.unit||t.unit)}},{key:"divide",value:function(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new e(NaN,""):new e(this.num/t.num,this.unit||t.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(t){var r,n=(r=gJ.exec(t))!==null&&r!==void 0?r:[],a=Hp(n,3),o=a[1],s=a[2];return new e(parseFloat(o),s??"")}}])}();function ZT(e){if(e.includes(Vl))return Vl;for(var t=e;t.includes("*")||t.includes("/");){var r,n=(r=hO.exec(t))!==null&&r!==void 0?r:[],a=Hp(n,4),o=a[1],s=a[2],l=a[3],c=Dm.parse(o??""),u=Dm.parse(l??""),d=s==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return Vl;t=t.replace(hO,d.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var f,p=(f=gO.exec(t))!==null&&f!==void 0?f:[],h=Hp(p,4),g=h[1],b=h[2],y=h[3],v=Dm.parse(g??""),k=Dm.parse(y??""),N=b==="+"?v.add(k):v.subtract(k);if(N.isNaN())return Vl;t=t.replace(gO,N.toString())}return t}var bO=/\(([^()]*)\)/;function xJ(e){for(var t=e;t.includes("(");){var r=bO.exec(t),n=Hp(r,2),a=n[1];t=t.replace(bO,ZT(a))}return t}function vJ(e){var t=e.replace(/\s+/g,"");return t=xJ(t),t=ZT(t),t}function kJ(e){try{return vJ(e)}catch{return Vl}}function T0(e){var t=kJ(e.slice(5,-1));return t===Vl?"":t}var wJ=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],jJ=["dx","dy","angle","className","breakAll"];function r2(){return r2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r2.apply(this,arguments)}function yO(e,t){if(e==null)return{};var r=NJ(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function NJ(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function xO(e,t){return OJ(e)||CJ(e,t)||SJ(e,t)||EJ()}function EJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
43
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SJ(e,t){if(e){if(typeof e=="string")return vO(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vO(e,t)}}function vO(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function CJ(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function OJ(e){if(Array.isArray(e))return e}var JT=/[ \f\n\r\t\v\u2028\u2029]+/,QT=function(e){var t=e.children,r=e.breakAll,n=e.style;try{var a=[];vt(t)||(r?a=t.toString().split(""):a=t.toString().split(JT));var o=a.map(function(l){return{word:l,width:xd(l,n).width}}),s=r?0:xd(" ",n).width;return{wordsWithComputedWidth:o,spaceWidth:s}}catch{return null}},PJ=function(e,t,r,n,a){var o=e.maxLines,s=e.children,l=e.style,c=e.breakAll,u=ze(o),d=s,f=function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return R.reduce(function(L,F){var V=F.word,H=F.width,$=L[L.length-1];if($&&(n==null||a||$.width+H+r<Number(n)))$.words.push(V),$.width+=H+r;else{var z={words:[V],width:H};L.push(z)}return L},[])},p=f(t),h=function(R){return R.reduce(function(L,F){return L.width>F.width?L:F})};if(!u)return p;for(var g="…",b=function(R){var L=d.slice(0,R),F=QT({breakAll:c,style:l,children:L+g}).wordsWithComputedWidth,V=f(F),H=V.length>o||h(V).width>Number(n);return[H,V]},y=0,v=d.length-1,k=0,N;y<=v&&k<=d.length-1;){var w=Math.floor((y+v)/2),E=w-1,C=b(E),O=xO(C,2),D=O[0],A=O[1],M=b(w),I=xO(M,1),T=I[0];if(!D&&!T&&(y=w+1),D&&T&&(v=w-1),!D&&T){N=A;break}k++}return N||p},kO=function(e){var t=vt(e)?[]:e.toString().split(JT);return[{words:t}]},AJ=function(e){var t=e.width,r=e.scaleToFit,n=e.children,a=e.style,o=e.breakAll,s=e.maxLines;if((t||r)&&!hs.isSsr){var l,c,u=QT({breakAll:o,children:n,style:a});if(u){var d=u.wordsWithComputedWidth,f=u.spaceWidth;l=d,c=f}else return kO(n);return PJ({breakAll:o,children:n,maxLines:s,style:a},l,c,t,r)}return kO(n)},wO="#808080",ll=function(e){var t=e.x,r=t===void 0?0:t,n=e.y,a=n===void 0?0:n,o=e.lineHeight,s=o===void 0?"1em":o,l=e.capHeight,c=l===void 0?"0.71em":l,u=e.scaleToFit,d=u===void 0?!1:u,f=e.textAnchor,p=f===void 0?"start":f,h=e.verticalAnchor,g=h===void 0?"end":h,b=e.fill,y=b===void 0?wO:b,v=yO(e,wJ),k=m.useMemo(function(){return AJ({breakAll:v.breakAll,children:v.children,maxLines:v.maxLines,scaleToFit:d,style:v.style,width:v.width})},[v.breakAll,v.children,v.maxLines,d,v.style,v.width]),N=v.dx,w=v.dy,E=v.angle,C=v.className,O=v.breakAll,D=yO(v,jJ);if(!bn(r)||!bn(a))return null;var A=r+(ze(N)?N:0),M=a+(ze(w)?w:0),I;switch(g){case"start":I=T0("calc(".concat(c,")"));break;case"middle":I=T0("calc(".concat((k.length-1)/2," * -").concat(s," + (").concat(c," / 2))"));break;default:I=T0("calc(".concat(k.length-1," * -").concat(s,")"));break}var T=[];if(d){var R=k[0].width,L=v.width;T.push("scale(".concat((ze(L)?L/R:1)/R,")"))}return E&&T.push("rotate(".concat(E,", ").concat(A,", ").concat(M,")")),T.length&&(D.transform=T.join(" ")),x.createElement("text",r2({},mt(D,!0),{x:A,y:M,className:Lt("recharts-text",C),textAnchor:p,fill:y.includes("url")?wO:y}),k.map(function(F,V){var H=F.words.join(O?"":" ");return x.createElement("tspan",{x:A,dy:V===0?I:s,key:"".concat(H,"-").concat(V)},H)}))};function Ks(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function MJ(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function zN(e){let t,r,n;e.length!==2?(t=Ks,r=(l,c)=>Ks(e(l),c),n=(l,c)=>e(l)-c):(t=e===Ks||e===MJ?e:TJ,r=e,n=e);function a(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<0?u=f+1:d=f}while(u<d)}return u}function o(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<=0?u=f+1:d=f}while(u<d)}return u}function s(l,c,u=0,d=l.length){const f=a(l,c,u,d-1);return f>u&&n(l[f-1],c)>-n(l[f],c)?f-1:f}return{left:a,center:s,right:o}}function TJ(){return 0}function e_(e){return e===null?NaN:+e}function*_J(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const IJ=zN(Ks),$f=IJ.right;zN(e_).center;class jO extends Map{constructor(t,r=RJ){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,a]of t)this.set(n,a)}get(t){return super.get(NO(this,t))}has(t){return super.has(NO(this,t))}set(t,r){return super.set(DJ(this,t),r)}delete(t){return super.delete(LJ(this,t))}}function NO({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function DJ({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function LJ({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function RJ(e){return e!==null&&typeof e=="object"?e.valueOf():e}function FJ(e=Ks){if(e===Ks)return t_;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function t_(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const $J=Math.sqrt(50),BJ=Math.sqrt(10),HJ=Math.sqrt(2);function zp(e,t,r){const n=(t-e)/Math.max(0,r),a=Math.floor(Math.log10(n)),o=n/Math.pow(10,a),s=o>=$J?10:o>=BJ?5:o>=HJ?2:1;let l,c,u;return a<0?(u=Math.pow(10,-a)/s,l=Math.round(e*u),c=Math.round(t*u),l/u<e&&++l,c/u>t&&--c,u=-u):(u=Math.pow(10,a)*s,l=Math.round(e/u),c=Math.round(t/u),l*u<e&&++l,c*u>t&&--c),c<l&&.5<=r&&r<2?zp(e,t,r*2):[l,c,u]}function n2(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const n=t<e,[a,o,s]=n?zp(t,e,r):zp(e,t,r);if(!(o>=a))return[];const l=o-a+1,c=new Array(l);if(n)if(s<0)for(let u=0;u<l;++u)c[u]=(o-u)/-s;else for(let u=0;u<l;++u)c[u]=(o-u)*s;else if(s<0)for(let u=0;u<l;++u)c[u]=(a+u)/-s;else for(let u=0;u<l;++u)c[u]=(a+u)*s;return c}function a2(e,t,r){return t=+t,e=+e,r=+r,zp(e,t,r)[2]}function o2(e,t,r){t=+t,e=+e,r=+r;const n=t<e,a=n?a2(t,e,r):a2(e,t,r);return(n?-1:1)*(a<0?1/-a:a)}function EO(e,t){let r;for(const n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function SO(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function r_(e,t,r=0,n=1/0,a){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(a=a===void 0?t_:FJ(a);n>r;){if(n-r>600){const c=n-r+1,u=t-r+1,d=Math.log(c),f=.5*Math.exp(2*d/3),p=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(r,Math.floor(t-u*f/c+p)),g=Math.min(n,Math.floor(t+(c-u)*f/c+p));r_(e,t,h,g,a)}const o=e[t];let s=r,l=n;for(Hu(e,r,t),a(e[n],o)>0&&Hu(e,r,n);s<l;){for(Hu(e,s,l),++s,--l;a(e[s],o)<0;)++s;for(;a(e[l],o)>0;)--l}a(e[r],o)===0?Hu(e,r,l):(++l,Hu(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function Hu(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function zJ(e,t,r){if(e=Float64Array.from(_J(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return SO(e);if(t>=1)return EO(e);var n,a=(n-1)*t,o=Math.floor(a),s=EO(r_(e,o).subarray(0,o+1)),l=SO(e.subarray(o+1));return s+(l-s)*(a-o)}}function UJ(e,t,r=e_){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,a=(n-1)*t,o=Math.floor(a),s=+r(e[o],o,e),l=+r(e[o+1],o+1,e);return s+(l-s)*(a-o)}}function qJ(e,t,r){e=+e,t=+t,r=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+r;for(var n=-1,a=Math.max(0,Math.ceil((t-e)/r))|0,o=new Array(a);++n<a;)o[n]=e+n*r;return o}function La(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function gs(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const s2=Symbol("implicit");function UN(){var e=new jO,t=[],r=[],n=s2;function a(o){let s=e.get(o);if(s===void 0){if(n!==s2)return n;e.set(o,s=t.push(o)-1)}return r[s%r.length]}return a.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new jO;for(const s of o)e.has(s)||e.set(s,t.push(s)-1);return a},a.range=function(o){return arguments.length?(r=Array.from(o),a):r.slice()},a.unknown=function(o){return arguments.length?(n=o,a):n},a.copy=function(){return UN(t,r).unknown(n)},La.apply(a,arguments),a}function zd(){var e=UN().unknown(void 0),t=e.domain,r=e.range,n=0,a=1,o,s,l=!1,c=0,u=0,d=.5;delete e.unknown;function f(){var p=t().length,h=a<n,g=h?a:n,b=h?n:a;o=(b-g)/Math.max(1,p-c+u*2),l&&(o=Math.floor(o)),g+=(b-g-o*(p-c))*d,s=o*(1-c),l&&(g=Math.round(g),s=Math.round(s));var y=qJ(p).map(function(v){return g+o*v});return r(h?y.reverse():y)}return e.domain=function(p){return arguments.length?(t(p),f()):t()},e.range=function(p){return arguments.length?([n,a]=p,n=+n,a=+a,f()):[n,a]},e.rangeRound=function(p){return[n,a]=p,n=+n,a=+a,l=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(p){return arguments.length?(l=!!p,f()):l},e.padding=function(p){return arguments.length?(c=Math.min(1,u=+p),f()):c},e.paddingInner=function(p){return arguments.length?(c=Math.min(1,p),f()):c},e.paddingOuter=function(p){return arguments.length?(u=+p,f()):u},e.align=function(p){return arguments.length?(d=Math.max(0,Math.min(1,p)),f()):d},e.copy=function(){return zd(t(),[n,a]).round(l).paddingInner(c).paddingOuter(u).align(d)},La.apply(f(),arguments)}function n_(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return n_(t())},e}function vd(){return n_(zd.apply(null,arguments).paddingInner(1))}function qN(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function a_(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Bf(){}var Ud=.7,Up=1/Ud,oc="\\s*([+-]?\\d+)\\s*",qd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",bo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",VJ=/^#([0-9a-f]{3,8})$/,WJ=new RegExp(`^rgb\\(${oc},${oc},${oc}\\)$`),KJ=new RegExp(`^rgb\\(${bo},${bo},${bo}\\)$`),YJ=new RegExp(`^rgba\\(${oc},${oc},${oc},${qd}\\)$`),XJ=new RegExp(`^rgba\\(${bo},${bo},${bo},${qd}\\)$`),GJ=new RegExp(`^hsl\\(${qd},${bo},${bo}\\)$`),ZJ=new RegExp(`^hsla\\(${qd},${bo},${bo},${qd}\\)$`),CO={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};qN(Bf,Vd,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:OO,formatHex:OO,formatHex8:JJ,formatHsl:QJ,formatRgb:PO,toString:PO});function OO(){return this.rgb().formatHex()}function JJ(){return this.rgb().formatHex8()}function QJ(){return o_(this).formatHsl()}function PO(){return this.rgb().formatRgb()}function Vd(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=VJ.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?AO(t):r===3?new Wn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Lm(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Lm(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=WJ.exec(e))?new Wn(t[1],t[2],t[3],1):(t=KJ.exec(e))?new Wn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=YJ.exec(e))?Lm(t[1],t[2],t[3],t[4]):(t=XJ.exec(e))?Lm(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=GJ.exec(e))?_O(t[1],t[2]/100,t[3]/100,1):(t=ZJ.exec(e))?_O(t[1],t[2]/100,t[3]/100,t[4]):CO.hasOwnProperty(e)?AO(CO[e]):e==="transparent"?new Wn(NaN,NaN,NaN,0):null}function AO(e){return new Wn(e>>16&255,e>>8&255,e&255,1)}function Lm(e,t,r,n){return n<=0&&(e=t=r=NaN),new Wn(e,t,r,n)}function eQ(e){return e instanceof Bf||(e=Vd(e)),e?(e=e.rgb(),new Wn(e.r,e.g,e.b,e.opacity)):new Wn}function i2(e,t,r,n){return arguments.length===1?eQ(e):new Wn(e,t,r,n??1)}function Wn(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}qN(Wn,i2,a_(Bf,{brighter(e){return e=e==null?Up:Math.pow(Up,e),new Wn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ud:Math.pow(Ud,e),new Wn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Wn(Ji(this.r),Ji(this.g),Ji(this.b),qp(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:MO,formatHex:MO,formatHex8:tQ,formatRgb:TO,toString:TO}));function MO(){return`#${Ki(this.r)}${Ki(this.g)}${Ki(this.b)}`}function tQ(){return`#${Ki(this.r)}${Ki(this.g)}${Ki(this.b)}${Ki((isNaN(this.opacity)?1:this.opacity)*255)}`}function TO(){const e=qp(this.opacity);return`${e===1?"rgb(":"rgba("}${Ji(this.r)}, ${Ji(this.g)}, ${Ji(this.b)}${e===1?")":`, ${e})`}`}function qp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ji(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ki(e){return e=Ji(e),(e<16?"0":"")+e.toString(16)}function _O(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Ua(e,t,r,n)}function o_(e){if(e instanceof Ua)return new Ua(e.h,e.s,e.l,e.opacity);if(e instanceof Bf||(e=Vd(e)),!e)return new Ua;if(e instanceof Ua)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,a=Math.min(t,r,n),o=Math.max(t,r,n),s=NaN,l=o-a,c=(o+a)/2;return l?(t===o?s=(r-n)/l+(r<n)*6:r===o?s=(n-t)/l+2:s=(t-r)/l+4,l/=c<.5?o+a:2-o-a,s*=60):l=c>0&&c<1?0:s,new Ua(s,l,c,e.opacity)}function rQ(e,t,r,n){return arguments.length===1?o_(e):new Ua(e,t,r,n??1)}function Ua(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}qN(Ua,rQ,a_(Bf,{brighter(e){return e=e==null?Up:Math.pow(Up,e),new Ua(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ud:Math.pow(Ud,e),new Ua(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,a=2*r-n;return new Wn(_0(e>=240?e-240:e+120,a,n),_0(e,a,n),_0(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new Ua(IO(this.h),Rm(this.s),Rm(this.l),qp(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=qp(this.opacity);return`${e===1?"hsl(":"hsla("}${IO(this.h)}, ${Rm(this.s)*100}%, ${Rm(this.l)*100}%${e===1?")":`, ${e})`}`}}));function IO(e){return e=(e||0)%360,e<0?e+360:e}function Rm(e){return Math.max(0,Math.min(1,e||0))}function _0(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const VN=e=>()=>e;function nQ(e,t){return function(r){return e+r*t}}function aQ(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function oQ(e){return(e=+e)==1?s_:function(t,r){return r-t?aQ(t,r,e):VN(isNaN(t)?r:t)}}function s_(e,t){var r=t-e;return r?nQ(e,r):VN(isNaN(e)?t:e)}const DO=function e(t){var r=oQ(t);function n(a,o){var s=r((a=i2(a)).r,(o=i2(o)).r),l=r(a.g,o.g),c=r(a.b,o.b),u=s_(a.opacity,o.opacity);return function(d){return a.r=s(d),a.g=l(d),a.b=c(d),a.opacity=u(d),a+""}}return n.gamma=e,n}(1);function sQ(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),a;return function(o){for(a=0;a<r;++a)n[a]=e[a]*(1-o)+t[a]*o;return n}}function iQ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function lQ(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,a=new Array(n),o=new Array(r),s;for(s=0;s<n;++s)a[s]=cu(e[s],t[s]);for(;s<r;++s)o[s]=t[s];return function(l){for(s=0;s<n;++s)o[s]=a[s](l);return o}}function cQ(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Vp(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function uQ(e,t){var r={},n={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?r[a]=cu(e[a],t[a]):n[a]=t[a];return function(o){for(a in r)n[a]=r[a](o);return n}}var l2=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,I0=new RegExp(l2.source,"g");function dQ(e){return function(){return e}}function fQ(e){return function(t){return e(t)+""}}function mQ(e,t){var r=l2.lastIndex=I0.lastIndex=0,n,a,o,s=-1,l=[],c=[];for(e=e+"",t=t+"";(n=l2.exec(e))&&(a=I0.exec(t));)(o=a.index)>r&&(o=t.slice(r,o),l[s]?l[s]+=o:l[++s]=o),(n=n[0])===(a=a[0])?l[s]?l[s]+=a:l[++s]=a:(l[++s]=null,c.push({i:s,x:Vp(n,a)})),r=I0.lastIndex;return r<t.length&&(o=t.slice(r),l[s]?l[s]+=o:l[++s]=o),l.length<2?c[0]?fQ(c[0].x):dQ(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function cu(e,t){var r=typeof t,n;return t==null||r==="boolean"?VN(t):(r==="number"?Vp:r==="string"?(n=Vd(t))?(t=n,DO):mQ:t instanceof Vd?DO:t instanceof Date?cQ:iQ(t)?sQ:Array.isArray(t)?lQ:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?uQ:Vp)(e,t)}function WN(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function pQ(e,t){t===void 0&&(t=e,e=cu);for(var r=0,n=t.length-1,a=t[0],o=new Array(n<0?0:n);r<n;)o[r]=e(a,a=t[++r]);return function(s){var l=Math.max(0,Math.min(n-1,Math.floor(s*=n)));return o[l](s-l)}}function hQ(e){return function(){return e}}function Wp(e){return+e}var LO=[0,1];function Bn(e){return e}function c2(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:hQ(isNaN(t)?NaN:.5)}function gQ(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function bQ(e,t,r){var n=e[0],a=e[1],o=t[0],s=t[1];return a<n?(n=c2(a,n),o=r(s,o)):(n=c2(n,a),o=r(o,s)),function(l){return o(n(l))}}function yQ(e,t,r){var n=Math.min(e.length,t.length)-1,a=new Array(n),o=new Array(n),s=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<n;)a[s]=c2(e[s],e[s+1]),o[s]=r(t[s],t[s+1]);return function(l){var c=$f(e,l,1,n)-1;return o[c](a[c](l))}}function Hf(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Fg(){var e=LO,t=LO,r=cu,n,a,o,s=Bn,l,c,u;function d(){var p=Math.min(e.length,t.length);return s!==Bn&&(s=gQ(e[0],e[p-1])),l=p>2?yQ:bQ,c=u=null,f}function f(p){return p==null||isNaN(p=+p)?o:(c||(c=l(e.map(n),t,r)))(n(s(p)))}return f.invert=function(p){return s(a((u||(u=l(t,e.map(n),Vp)))(p)))},f.domain=function(p){return arguments.length?(e=Array.from(p,Wp),d()):e.slice()},f.range=function(p){return arguments.length?(t=Array.from(p),d()):t.slice()},f.rangeRound=function(p){return t=Array.from(p),r=WN,d()},f.clamp=function(p){return arguments.length?(s=p?!0:Bn,d()):s!==Bn},f.interpolate=function(p){return arguments.length?(r=p,d()):r},f.unknown=function(p){return arguments.length?(o=p,f):o},function(p,h){return n=p,a=h,d()}}function KN(){return Fg()(Bn,Bn)}function xQ(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Kp(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Ec(e){return e=Kp(Math.abs(e)),e?e[1]:NaN}function vQ(e,t){return function(r,n){for(var a=r.length,o=[],s=0,l=e[0],c=0;a>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),o.push(r.substring(a-=l,a+l)),!((c+=l+1)>n));)l=e[s=(s+1)%e.length];return o.reverse().join(t)}}function kQ(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var wQ=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Wd(e){if(!(t=wQ.exec(e)))throw new Error("invalid format: "+e);var t;return new YN({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Wd.prototype=YN.prototype;function YN(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}YN.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function jQ(e){e:for(var t=e.length,r=1,n=-1,a;r<t;++r)switch(e[r]){case".":n=a=r;break;case"0":n===0&&(n=r),a=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(a+1):e}var Yp;function NQ(e,t){var r=Kp(e,t);if(!r)return Yp=void 0,e.toPrecision(t);var n=r[0],a=r[1],o=a-(Yp=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,s=n.length;return o===s?n:o>s?n+new Array(o-s+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Kp(e,Math.max(0,t+o-1))[0]}function RO(e,t){var r=Kp(e,t);if(!r)return e+"";var n=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+new Array(a-n.length+2).join("0")}const FO={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:xQ,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>RO(e*100,t),r:RO,s:NQ,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function $O(e){return e}var BO=Array.prototype.map,HO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function EQ(e){var t=e.grouping===void 0||e.thousands===void 0?$O:vQ(BO.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?$O:kQ(BO.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,p){f=Wd(f);var h=f.fill,g=f.align,b=f.sign,y=f.symbol,v=f.zero,k=f.width,N=f.comma,w=f.precision,E=f.trim,C=f.type;C==="n"?(N=!0,C="g"):FO[C]||(w===void 0&&(w=12),E=!0,C="g"),(v||h==="0"&&g==="=")&&(v=!0,h="0",g="=");var O=(p&&p.prefix!==void 0?p.prefix:"")+(y==="$"?r:y==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():""),D=(y==="$"?n:/[%p]/.test(C)?s:"")+(p&&p.suffix!==void 0?p.suffix:""),A=FO[C],M=/[defgprs%]/.test(C);w=w===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function I(T){var R=O,L=D,F,V,H;if(C==="c")L=A(T)+L,T="";else{T=+T;var $=T<0||1/T<0;if(T=isNaN(T)?c:A(Math.abs(T),w),E&&(T=jQ(T)),$&&+T==0&&b!=="+"&&($=!1),R=($?b==="("?b:l:b==="-"||b==="("?"":b)+R,L=(C==="s"&&!isNaN(T)&&Yp!==void 0?HO[8+Yp/3]:"")+L+($&&b==="("?")":""),M){for(F=-1,V=T.length;++F<V;)if(H=T.charCodeAt(F),48>H||H>57){L=(H===46?a+T.slice(F+1):T.slice(F))+L,T=T.slice(0,F);break}}}N&&!v&&(T=t(T,1/0));var z=R.length+T.length+L.length,W=z<k?new Array(k-z+1).join(h):"";switch(N&&v&&(T=t(W+T,W.length?k-L.length:1/0),W=""),g){case"<":T=R+T+L+W;break;case"=":T=R+W+T+L;break;case"^":T=W.slice(0,z=W.length>>1)+R+T+L+W.slice(z);break;default:T=W+R+T+L;break}return o(T)}return I.toString=function(){return f+""},I}function d(f,p){var h=Math.max(-8,Math.min(8,Math.floor(Ec(p)/3)))*3,g=Math.pow(10,-h),b=u((f=Wd(f),f.type="f",f),{suffix:HO[8+h/3]});return function(y){return b(g*y)}}return{format:u,formatPrefix:d}}var Fm,XN,i_;SQ({thousands:",",grouping:[3],currency:["$",""]});function SQ(e){return Fm=EQ(e),XN=Fm.format,i_=Fm.formatPrefix,Fm}function CQ(e){return Math.max(0,-Ec(Math.abs(e)))}function OQ(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ec(t)/3)))*3-Ec(Math.abs(e)))}function PQ(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Ec(t)-Ec(e))+1}function l_(e,t,r,n){var a=o2(e,t,r),o;switch(n=Wd(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=OQ(a,s))&&(n.precision=o),i_(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=PQ(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=CQ(a))&&(n.precision=o-(n.type==="%")*2);break}}return XN(n)}function pi(e){var t=e.domain;return e.ticks=function(r){var n=t();return n2(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var a=t();return l_(a[0],a[a.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),a=0,o=n.length-1,s=n[a],l=n[o],c,u,d=10;for(l<s&&(u=s,s=l,l=u,u=a,a=o,o=u);d-- >0;){if(u=a2(s,l,r),u===c)return n[a]=s,n[o]=l,t(n);if(u>0)s=Math.floor(s/u)*u,l=Math.ceil(l/u)*u;else if(u<0)s=Math.ceil(s*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function Xp(){var e=KN();return e.copy=function(){return Hf(e,Xp())},La.apply(e,arguments),pi(e)}function c_(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,Wp),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return c_(e).unknown(t)},e=arguments.length?Array.from(e,Wp):[0,1],pi(r)}function u_(e,t){e=e.slice();var r=0,n=e.length-1,a=e[r],o=e[n],s;return o<a&&(s=r,r=n,n=s,s=a,a=o,o=s),e[r]=t.floor(a),e[n]=t.ceil(o),e}function zO(e){return Math.log(e)}function UO(e){return Math.exp(e)}function AQ(e){return-Math.log(-e)}function MQ(e){return-Math.exp(-e)}function TQ(e){return isFinite(e)?+("1e"+e):e<0?0:e}function _Q(e){return e===10?TQ:e===Math.E?Math.exp:t=>Math.pow(e,t)}function IQ(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function qO(e){return(t,r)=>-e(-t,r)}function GN(e){const t=e(zO,UO),r=t.domain;let n=10,a,o;function s(){return a=IQ(n),o=_Q(n),r()[0]<0?(a=qO(a),o=qO(o),e(AQ,MQ)):e(zO,UO),t}return t.base=function(l){return arguments.length?(n=+l,s()):n},t.domain=function(l){return arguments.length?(r(l),s()):r()},t.ticks=l=>{const c=r();let u=c[0],d=c[c.length-1];const f=d<u;f&&([u,d]=[d,u]);let p=a(u),h=a(d),g,b;const y=l==null?10:+l;let v=[];if(!(n%1)&&h-p<y){if(p=Math.floor(p),h=Math.ceil(h),u>0){for(;p<=h;++p)for(g=1;g<n;++g)if(b=p<0?g/o(-p):g*o(p),!(b<u)){if(b>d)break;v.push(b)}}else for(;p<=h;++p)for(g=n-1;g>=1;--g)if(b=p>0?g/o(-p):g*o(p),!(b<u)){if(b>d)break;v.push(b)}v.length*2<y&&(v=n2(u,d,y))}else v=n2(p,h,Math.min(h-p,y)).map(o);return f?v.reverse():v},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Wd(c)).precision==null&&(c.trim=!0),c=XN(c)),l===1/0)return c;const u=Math.max(1,n*l/t.ticks().length);return d=>{let f=d/o(Math.round(a(d)));return f*n<n-.5&&(f*=n),f<=u?c(d):""}},t.nice=()=>r(u_(r(),{floor:l=>o(Math.floor(a(l))),ceil:l=>o(Math.ceil(a(l)))})),t}function d_(){const e=GN(Fg()).domain([1,10]);return e.copy=()=>Hf(e,d_()).base(e.base()),La.apply(e,arguments),e}function VO(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function WO(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function ZN(e){var t=1,r=e(VO(t),WO(t));return r.constant=function(n){return arguments.length?e(VO(t=+n),WO(t)):t},pi(r)}function f_(){var e=ZN(Fg());return e.copy=function(){return Hf(e,f_()).constant(e.constant())},La.apply(e,arguments)}function KO(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function DQ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function LQ(e){return e<0?-e*e:e*e}function JN(e){var t=e(Bn,Bn),r=1;function n(){return r===1?e(Bn,Bn):r===.5?e(DQ,LQ):e(KO(r),KO(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,n()):r},pi(t)}function QN(){var e=JN(Fg());return e.copy=function(){return Hf(e,QN()).exponent(e.exponent())},La.apply(e,arguments),e}function RQ(){return QN.apply(null,arguments).exponent(.5)}function YO(e){return Math.sign(e)*e*e}function FQ(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function m_(){var e=KN(),t=[0,1],r=!1,n;function a(o){var s=FQ(e(o));return isNaN(s)?n:r?Math.round(s):s}return a.invert=function(o){return e.invert(YO(o))},a.domain=function(o){return arguments.length?(e.domain(o),a):e.domain()},a.range=function(o){return arguments.length?(e.range((t=Array.from(o,Wp)).map(YO)),a):t.slice()},a.rangeRound=function(o){return a.range(o).round(!0)},a.round=function(o){return arguments.length?(r=!!o,a):r},a.clamp=function(o){return arguments.length?(e.clamp(o),a):e.clamp()},a.unknown=function(o){return arguments.length?(n=o,a):n},a.copy=function(){return m_(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},La.apply(a,arguments),pi(a)}function p_(){var e=[],t=[],r=[],n;function a(){var s=0,l=Math.max(1,t.length);for(r=new Array(l-1);++s<l;)r[s-1]=UJ(e,s/l);return o}function o(s){return s==null||isNaN(s=+s)?n:t[$f(r,s)]}return o.invertExtent=function(s){var l=t.indexOf(s);return l<0?[NaN,NaN]:[l>0?r[l-1]:e[0],l<r.length?r[l]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let l of s)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(Ks),a()},o.range=function(s){return arguments.length?(t=Array.from(s),a()):t.slice()},o.unknown=function(s){return arguments.length?(n=s,o):n},o.quantiles=function(){return r.slice()},o.copy=function(){return p_().domain(e).range(t).unknown(n)},La.apply(o,arguments)}function h_(){var e=0,t=1,r=1,n=[.5],a=[0,1],o;function s(c){return c!=null&&c<=c?a[$f(n,c,0,r)]:o}function l(){var c=-1;for(n=new Array(r);++c<r;)n[c]=((c+1)*t-(c-r)*e)/(r+1);return s}return s.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},s.range=function(c){return arguments.length?(r=(a=Array.from(c)).length-1,l()):a.slice()},s.invertExtent=function(c){var u=a.indexOf(c);return u<0?[NaN,NaN]:u<1?[e,n[0]]:u>=r?[n[r-1],t]:[n[u-1],n[u]]},s.unknown=function(c){return arguments.length&&(o=c),s},s.thresholds=function(){return n.slice()},s.copy=function(){return h_().domain([e,t]).range(a).unknown(o)},La.apply(pi(s),arguments)}function g_(){var e=[.5],t=[0,1],r,n=1;function a(o){return o!=null&&o<=o?t[$f(e,o,0,n)]:r}return a.domain=function(o){return arguments.length?(e=Array.from(o),n=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(o){return arguments.length?(t=Array.from(o),n=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},a.unknown=function(o){return arguments.length?(r=o,a):r},a.copy=function(){return g_().domain(e).range(t).unknown(r)},La.apply(a,arguments)}const D0=new Date,L0=new Date;function xn(e,t,r,n){function a(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return a.floor=o=>(e(o=new Date(+o)),o),a.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),a.round=o=>{const s=a(o),l=a.ceil(o);return o-s<l-o?s:l},a.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),a.range=(o,s,l)=>{const c=[];if(o=a.ceil(o),l=l==null?1:Math.floor(l),!(o<s)||!(l>0))return c;let u;do c.push(u=new Date(+o)),t(o,l),e(o);while(u<o&&o<s);return c},a.filter=o=>xn(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;t(s,-1),!o(s););else for(;--l>=0;)for(;t(s,1),!o(s););}),r&&(a.count=(o,s)=>(D0.setTime(+o),L0.setTime(+s),e(D0),e(L0),Math.floor(r(D0,L0))),a.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?a.filter(n?s=>n(s)%o===0:s=>a.count(0,s)%o===0):a)),a}const Gp=xn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Gp.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?xn(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Gp);Gp.range;const qo=1e3,Pa=qo*60,Vo=Pa*60,ss=Vo*24,e1=ss*7,XO=ss*30,R0=ss*365,Yi=xn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*qo)},(e,t)=>(t-e)/qo,e=>e.getUTCSeconds());Yi.range;const t1=xn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*qo)},(e,t)=>{e.setTime(+e+t*Pa)},(e,t)=>(t-e)/Pa,e=>e.getMinutes());t1.range;const r1=xn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Pa)},(e,t)=>(t-e)/Pa,e=>e.getUTCMinutes());r1.range;const n1=xn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*qo-e.getMinutes()*Pa)},(e,t)=>{e.setTime(+e+t*Vo)},(e,t)=>(t-e)/Vo,e=>e.getHours());n1.range;const a1=xn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Vo)},(e,t)=>(t-e)/Vo,e=>e.getUTCHours());a1.range;const zf=xn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Pa)/ss,e=>e.getDate()-1);zf.range;const $g=xn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ss,e=>e.getUTCDate()-1);$g.range;const b_=xn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ss,e=>Math.floor(e/ss));b_.range;function bl(e){return xn(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Pa)/e1)}const Bg=bl(0),Zp=bl(1),$Q=bl(2),BQ=bl(3),Sc=bl(4),HQ=bl(5),zQ=bl(6);Bg.range;Zp.range;$Q.range;BQ.range;Sc.range;HQ.range;zQ.range;function yl(e){return xn(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/e1)}const Hg=yl(0),Jp=yl(1),UQ=yl(2),qQ=yl(3),Cc=yl(4),VQ=yl(5),WQ=yl(6);Hg.range;Jp.range;UQ.range;qQ.range;Cc.range;VQ.range;WQ.range;const o1=xn(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());o1.range;const s1=xn(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());s1.range;const is=xn(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());is.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xn(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});is.range;const ls=xn(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ls.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xn(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});ls.range;function y_(e,t,r,n,a,o){const s=[[Yi,1,qo],[Yi,5,5*qo],[Yi,15,15*qo],[Yi,30,30*qo],[o,1,Pa],[o,5,5*Pa],[o,15,15*Pa],[o,30,30*Pa],[a,1,Vo],[a,3,3*Vo],[a,6,6*Vo],[a,12,12*Vo],[n,1,ss],[n,2,2*ss],[r,1,e1],[t,1,XO],[t,3,3*XO],[e,1,R0]];function l(u,d,f){const p=d<u;p&&([u,d]=[d,u]);const h=f&&typeof f.range=="function"?f:c(u,d,f),g=h?h.range(u,+d+1):[];return p?g.reverse():g}function c(u,d,f){const p=Math.abs(d-u)/f,h=zN(([,,y])=>y).right(s,p);if(h===s.length)return e.every(o2(u/R0,d/R0,f));if(h===0)return Gp.every(Math.max(o2(u,d,f),1));const[g,b]=s[p/s[h-1][2]<s[h][2]/p?h-1:h];return g.every(b)}return[l,c]}const[KQ,YQ]=y_(ls,s1,Hg,b_,a1,r1),[XQ,GQ]=y_(is,o1,Bg,zf,n1,t1);function F0(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function $0(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function zu(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function ZQ(e){var t=e.dateTime,r=e.date,n=e.time,a=e.periods,o=e.days,s=e.shortDays,l=e.months,c=e.shortMonths,u=Uu(a),d=qu(a),f=Uu(o),p=qu(o),h=Uu(s),g=qu(s),b=Uu(l),y=qu(l),v=Uu(c),k=qu(c),N={a:H,A:$,b:z,B:W,c:null,d:t6,e:t6,f:vee,g:Aee,G:Tee,H:bee,I:yee,j:xee,L:x_,m:kee,M:wee,p:U,q:X,Q:a6,s:o6,S:jee,u:Nee,U:Eee,V:See,w:Cee,W:Oee,x:null,X:null,y:Pee,Y:Mee,Z:_ee,"%":n6},w={a:Y,A:ae,b:G,B:ee,c:null,d:r6,e:r6,f:Ree,g:Kee,G:Xee,H:Iee,I:Dee,j:Lee,L:k_,m:Fee,M:$ee,p:re,q:pe,Q:a6,s:o6,S:Bee,u:Hee,U:zee,V:Uee,w:qee,W:Vee,x:null,X:null,y:Wee,Y:Yee,Z:Gee,"%":n6},E={a:M,A:I,b:T,B:R,c:L,d:QO,e:QO,f:mee,g:JO,G:ZO,H:e6,I:e6,j:cee,L:fee,m:lee,M:uee,p:A,q:iee,Q:hee,s:gee,S:dee,u:ree,U:nee,V:aee,w:tee,W:oee,x:F,X:V,y:JO,Y:ZO,Z:see,"%":pee};N.x=C(r,N),N.X=C(n,N),N.c=C(t,N),w.x=C(r,w),w.X=C(n,w),w.c=C(t,w);function C(te,se){return function(ne){var K=[],ge=-1,ye=0,me=te.length,Se,Re,Te;for(ne instanceof Date||(ne=new Date(+ne));++ge<me;)te.charCodeAt(ge)===37&&(K.push(te.slice(ye,ge)),(Re=GO[Se=te.charAt(++ge)])!=null?Se=te.charAt(++ge):Re=Se==="e"?" ":"0",(Te=se[Se])&&(Se=Te(ne,Re)),K.push(Se),ye=ge+1);return K.push(te.slice(ye,ge)),K.join("")}}function O(te,se){return function(ne){var K=zu(1900,void 0,1),ge=D(K,te,ne+="",0),ye,me;if(ge!=ne.length)return null;if("Q"in K)return new Date(K.Q);if("s"in K)return new Date(K.s*1e3+("L"in K?K.L:0));if(se&&!("Z"in K)&&(K.Z=0),"p"in K&&(K.H=K.H%12+K.p*12),K.m===void 0&&(K.m="q"in K?K.q:0),"V"in K){if(K.V<1||K.V>53)return null;"w"in K||(K.w=1),"Z"in K?(ye=$0(zu(K.y,0,1)),me=ye.getUTCDay(),ye=me>4||me===0?Jp.ceil(ye):Jp(ye),ye=$g.offset(ye,(K.V-1)*7),K.y=ye.getUTCFullYear(),K.m=ye.getUTCMonth(),K.d=ye.getUTCDate()+(K.w+6)%7):(ye=F0(zu(K.y,0,1)),me=ye.getDay(),ye=me>4||me===0?Zp.ceil(ye):Zp(ye),ye=zf.offset(ye,(K.V-1)*7),K.y=ye.getFullYear(),K.m=ye.getMonth(),K.d=ye.getDate()+(K.w+6)%7)}else("W"in K||"U"in K)&&("w"in K||(K.w="u"in K?K.u%7:"W"in K?1:0),me="Z"in K?$0(zu(K.y,0,1)).getUTCDay():F0(zu(K.y,0,1)).getDay(),K.m=0,K.d="W"in K?(K.w+6)%7+K.W*7-(me+5)%7:K.w+K.U*7-(me+6)%7);return"Z"in K?(K.H+=K.Z/100|0,K.M+=K.Z%100,$0(K)):F0(K)}}function D(te,se,ne,K){for(var ge=0,ye=se.length,me=ne.length,Se,Re;ge<ye;){if(K>=me)return-1;if(Se=se.charCodeAt(ge++),Se===37){if(Se=se.charAt(ge++),Re=E[Se in GO?se.charAt(ge++):Se],!Re||(K=Re(te,ne,K))<0)return-1}else if(Se!=ne.charCodeAt(K++))return-1}return K}function A(te,se,ne){var K=u.exec(se.slice(ne));return K?(te.p=d.get(K[0].toLowerCase()),ne+K[0].length):-1}function M(te,se,ne){var K=h.exec(se.slice(ne));return K?(te.w=g.get(K[0].toLowerCase()),ne+K[0].length):-1}function I(te,se,ne){var K=f.exec(se.slice(ne));return K?(te.w=p.get(K[0].toLowerCase()),ne+K[0].length):-1}function T(te,se,ne){var K=v.exec(se.slice(ne));return K?(te.m=k.get(K[0].toLowerCase()),ne+K[0].length):-1}function R(te,se,ne){var K=b.exec(se.slice(ne));return K?(te.m=y.get(K[0].toLowerCase()),ne+K[0].length):-1}function L(te,se,ne){return D(te,t,se,ne)}function F(te,se,ne){return D(te,r,se,ne)}function V(te,se,ne){return D(te,n,se,ne)}function H(te){return s[te.getDay()]}function $(te){return o[te.getDay()]}function z(te){return c[te.getMonth()]}function W(te){return l[te.getMonth()]}function U(te){return a[+(te.getHours()>=12)]}function X(te){return 1+~~(te.getMonth()/3)}function Y(te){return s[te.getUTCDay()]}function ae(te){return o[te.getUTCDay()]}function G(te){return c[te.getUTCMonth()]}function ee(te){return l[te.getUTCMonth()]}function re(te){return a[+(te.getUTCHours()>=12)]}function pe(te){return 1+~~(te.getUTCMonth()/3)}return{format:function(te){var se=C(te+="",N);return se.toString=function(){return te},se},parse:function(te){var se=O(te+="",!1);return se.toString=function(){return te},se},utcFormat:function(te){var se=C(te+="",w);return se.toString=function(){return te},se},utcParse:function(te){var se=O(te+="",!0);return se.toString=function(){return te},se}}}var GO={"-":"",_:" ",0:"0"},Nn=/^\s*\d+/,JQ=/^%/,QQ=/[\\^$*+?|[\]().{}]/g;function or(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",o=a.length;return n+(o<r?new Array(r-o+1).join(t)+a:a)}function eee(e){return e.replace(QQ,"\\$&")}function Uu(e){return new RegExp("^(?:"+e.map(eee).join("|")+")","i")}function qu(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function tee(e,t,r){var n=Nn.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function ree(e,t,r){var n=Nn.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function nee(e,t,r){var n=Nn.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function aee(e,t,r){var n=Nn.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function oee(e,t,r){var n=Nn.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function ZO(e,t,r){var n=Nn.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function JO(e,t,r){var n=Nn.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function see(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function iee(e,t,r){var n=Nn.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function lee(e,t,r){var n=Nn.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function QO(e,t,r){var n=Nn.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function cee(e,t,r){var n=Nn.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function e6(e,t,r){var n=Nn.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function uee(e,t,r){var n=Nn.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function dee(e,t,r){var n=Nn.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function fee(e,t,r){var n=Nn.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function mee(e,t,r){var n=Nn.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function pee(e,t,r){var n=JQ.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function hee(e,t,r){var n=Nn.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function gee(e,t,r){var n=Nn.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function t6(e,t){return or(e.getDate(),t,2)}function bee(e,t){return or(e.getHours(),t,2)}function yee(e,t){return or(e.getHours()%12||12,t,2)}function xee(e,t){return or(1+zf.count(is(e),e),t,3)}function x_(e,t){return or(e.getMilliseconds(),t,3)}function vee(e,t){return x_(e,t)+"000"}function kee(e,t){return or(e.getMonth()+1,t,2)}function wee(e,t){return or(e.getMinutes(),t,2)}function jee(e,t){return or(e.getSeconds(),t,2)}function Nee(e){var t=e.getDay();return t===0?7:t}function Eee(e,t){return or(Bg.count(is(e)-1,e),t,2)}function v_(e){var t=e.getDay();return t>=4||t===0?Sc(e):Sc.ceil(e)}function See(e,t){return e=v_(e),or(Sc.count(is(e),e)+(is(e).getDay()===4),t,2)}function Cee(e){return e.getDay()}function Oee(e,t){return or(Zp.count(is(e)-1,e),t,2)}function Pee(e,t){return or(e.getFullYear()%100,t,2)}function Aee(e,t){return e=v_(e),or(e.getFullYear()%100,t,2)}function Mee(e,t){return or(e.getFullYear()%1e4,t,4)}function Tee(e,t){var r=e.getDay();return e=r>=4||r===0?Sc(e):Sc.ceil(e),or(e.getFullYear()%1e4,t,4)}function _ee(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+or(t/60|0,"0",2)+or(t%60,"0",2)}function r6(e,t){return or(e.getUTCDate(),t,2)}function Iee(e,t){return or(e.getUTCHours(),t,2)}function Dee(e,t){return or(e.getUTCHours()%12||12,t,2)}function Lee(e,t){return or(1+$g.count(ls(e),e),t,3)}function k_(e,t){return or(e.getUTCMilliseconds(),t,3)}function Ree(e,t){return k_(e,t)+"000"}function Fee(e,t){return or(e.getUTCMonth()+1,t,2)}function $ee(e,t){return or(e.getUTCMinutes(),t,2)}function Bee(e,t){return or(e.getUTCSeconds(),t,2)}function Hee(e){var t=e.getUTCDay();return t===0?7:t}function zee(e,t){return or(Hg.count(ls(e)-1,e),t,2)}function w_(e){var t=e.getUTCDay();return t>=4||t===0?Cc(e):Cc.ceil(e)}function Uee(e,t){return e=w_(e),or(Cc.count(ls(e),e)+(ls(e).getUTCDay()===4),t,2)}function qee(e){return e.getUTCDay()}function Vee(e,t){return or(Jp.count(ls(e)-1,e),t,2)}function Wee(e,t){return or(e.getUTCFullYear()%100,t,2)}function Kee(e,t){return e=w_(e),or(e.getUTCFullYear()%100,t,2)}function Yee(e,t){return or(e.getUTCFullYear()%1e4,t,4)}function Xee(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Cc(e):Cc.ceil(e),or(e.getUTCFullYear()%1e4,t,4)}function Gee(){return"+0000"}function n6(){return"%"}function a6(e){return+e}function o6(e){return Math.floor(+e/1e3)}var Ml,j_,N_;Zee({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Zee(e){return Ml=ZQ(e),j_=Ml.format,Ml.parse,N_=Ml.utcFormat,Ml.utcParse,Ml}function Jee(e){return new Date(e)}function Qee(e){return e instanceof Date?+e:+new Date(+e)}function i1(e,t,r,n,a,o,s,l,c,u){var d=KN(),f=d.invert,p=d.domain,h=u(".%L"),g=u(":%S"),b=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),k=u("%b %d"),N=u("%B"),w=u("%Y");function E(C){return(c(C)<C?h:l(C)<C?g:s(C)<C?b:o(C)<C?y:n(C)<C?a(C)<C?v:k:r(C)<C?N:w)(C)}return d.invert=function(C){return new Date(f(C))},d.domain=function(C){return arguments.length?p(Array.from(C,Qee)):p().map(Jee)},d.ticks=function(C){var O=p();return e(O[0],O[O.length-1],C??10)},d.tickFormat=function(C,O){return O==null?E:u(O)},d.nice=function(C){var O=p();return(!C||typeof C.range!="function")&&(C=t(O[0],O[O.length-1],C??10)),C?p(u_(O,C)):d},d.copy=function(){return Hf(d,i1(e,t,r,n,a,o,s,l,c,u))},d}function ete(){return La.apply(i1(XQ,GQ,is,o1,Bg,zf,n1,t1,Yi,j_).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function tte(){return La.apply(i1(KQ,YQ,ls,s1,Hg,$g,a1,r1,Yi,N_).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function zg(){var e=0,t=1,r,n,a,o,s=Bn,l=!1,c;function u(f){return f==null||isNaN(f=+f)?c:s(a===0?.5:(f=(o(f)-r)*a,l?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([e,t]=f,r=o(e=+e),n=o(t=+t),a=r===n?0:1/(n-r),u):[e,t]},u.clamp=function(f){return arguments.length?(l=!!f,u):l},u.interpolator=function(f){return arguments.length?(s=f,u):s};function d(f){return function(p){var h,g;return arguments.length?([h,g]=p,s=f(h,g),u):[s(0),s(1)]}}return u.range=d(cu),u.rangeRound=d(WN),u.unknown=function(f){return arguments.length?(c=f,u):c},function(f){return o=f,r=f(e),n=f(t),a=r===n?0:1/(n-r),u}}function hi(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function E_(){var e=pi(zg()(Bn));return e.copy=function(){return hi(e,E_())},gs.apply(e,arguments)}function S_(){var e=GN(zg()).domain([1,10]);return e.copy=function(){return hi(e,S_()).base(e.base())},gs.apply(e,arguments)}function C_(){var e=ZN(zg());return e.copy=function(){return hi(e,C_()).constant(e.constant())},gs.apply(e,arguments)}function l1(){var e=JN(zg());return e.copy=function(){return hi(e,l1()).exponent(e.exponent())},gs.apply(e,arguments)}function rte(){return l1.apply(null,arguments).exponent(.5)}function O_(){var e=[],t=Bn;function r(n){if(n!=null&&!isNaN(n=+n))return t(($f(e,n,1)-1)/(e.length-1))}return r.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let a of n)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Ks),r},r.interpolator=function(n){return arguments.length?(t=n,r):t},r.range=function(){return e.map((n,a)=>t(a/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(a,o)=>zJ(e,o/n))},r.copy=function(){return O_(t).domain(e)},gs.apply(r,arguments)}function Ug(){var e=0,t=.5,r=1,n=1,a,o,s,l,c,u=Bn,d,f=!1,p;function h(b){return isNaN(b=+b)?p:(b=.5+((b=+d(b))-o)*(n*b<n*o?l:c),u(f?Math.max(0,Math.min(1,b)):b))}h.domain=function(b){return arguments.length?([e,t,r]=b,a=d(e=+e),o=d(t=+t),s=d(r=+r),l=a===o?0:.5/(o-a),c=o===s?0:.5/(s-o),n=o<a?-1:1,h):[e,t,r]},h.clamp=function(b){return arguments.length?(f=!!b,h):f},h.interpolator=function(b){return arguments.length?(u=b,h):u};function g(b){return function(y){var v,k,N;return arguments.length?([v,k,N]=y,u=pQ(b,[v,k,N]),h):[u(0),u(.5),u(1)]}}return h.range=g(cu),h.rangeRound=g(WN),h.unknown=function(b){return arguments.length?(p=b,h):p},function(b){return d=b,a=b(e),o=b(t),s=b(r),l=a===o?0:.5/(o-a),c=o===s?0:.5/(s-o),n=o<a?-1:1,h}}function P_(){var e=pi(Ug()(Bn));return e.copy=function(){return hi(e,P_())},gs.apply(e,arguments)}function A_(){var e=GN(Ug()).domain([.1,1,10]);return e.copy=function(){return hi(e,A_()).base(e.base())},gs.apply(e,arguments)}function M_(){var e=ZN(Ug());return e.copy=function(){return hi(e,M_()).constant(e.constant())},gs.apply(e,arguments)}function c1(){var e=JN(Ug());return e.copy=function(){return hi(e,c1()).exponent(e.exponent())},gs.apply(e,arguments)}function nte(){return c1.apply(null,arguments).exponent(.5)}const s6=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:zd,scaleDiverging:P_,scaleDivergingLog:A_,scaleDivergingPow:c1,scaleDivergingSqrt:nte,scaleDivergingSymlog:M_,scaleIdentity:c_,scaleImplicit:s2,scaleLinear:Xp,scaleLog:d_,scaleOrdinal:UN,scalePoint:vd,scalePow:QN,scaleQuantile:p_,scaleQuantize:h_,scaleRadial:m_,scaleSequential:E_,scaleSequentialLog:S_,scaleSequentialPow:l1,scaleSequentialQuantile:O_,scaleSequentialSqrt:rte,scaleSequentialSymlog:C_,scaleSqrt:RQ,scaleSymlog:f_,scaleThreshold:g_,scaleTime:ete,scaleUtc:tte,tickFormat:l_},Symbol.toStringTag,{value:"Module"}));var B0,i6;function qg(){if(i6)return B0;i6=1;var e=ou();function t(r,n,a){for(var o=-1,s=r.length;++o<s;){var l=r[o],c=n(l);if(c!=null&&(u===void 0?c===c&&!e(c):a(c,u)))var u=c,d=l}return d}return B0=t,B0}var H0,l6;function T_(){if(l6)return H0;l6=1;function e(t,r){return t>r}return H0=e,H0}var z0,c6;function ate(){if(c6)return z0;c6=1;var e=qg(),t=T_(),r=lu();function n(a){return a&&a.length?e(a,r,t):void 0}return z0=n,z0}var ote=ate();const Fs=mr(ote);var U0,u6;function __(){if(u6)return U0;u6=1;function e(t,r){return t<r}return U0=e,U0}var q0,d6;function ste(){if(d6)return q0;d6=1;var e=qg(),t=__(),r=lu();function n(a){return a&&a.length?e(a,r,t):void 0}return q0=n,q0}var ite=ste();const Vg=mr(ite);var V0,f6;function lte(){if(f6)return V0;f6=1;var e=SN(),t=To(),r=zT(),n=Qn();function a(o,s){var l=n(o)?e:r;return l(o,t(s,3))}return V0=a,V0}var W0,m6;function cte(){if(m6)return W0;m6=1;var e=BT(),t=lte();function r(n,a){return e(t(n,a),1)}return W0=r,W0}var ute=cte();const dte=mr(ute);var K0,p6;function fte(){if(p6)return K0;p6=1;var e=FN();function t(r,n){return e(r,n)}return K0=t,K0}var mte=fte();const ri=mr(mte);var uu=1e9,pte={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},d1,Vr=!0,Ma="[DecimalError] ",Qi=Ma+"Invalid argument: ",u1=Ma+"Exponent out of range: ",du=Math.floor,Ti=Math.pow,hte=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,da,wn=1e7,Br=7,I_=9007199254740991,Qp=du(I_/Br),lt={};lt.absoluteValue=lt.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};lt.comparedTo=lt.cmp=function(e){var t,r,n,a,o=this;if(e=new o.constructor(e),o.s!==e.s)return o.s||-e.s;if(o.e!==e.e)return o.e>e.e^o.s<0?1:-1;for(n=o.d.length,a=e.d.length,t=0,r=n<a?n:a;t<r;++t)if(o.d[t]!==e.d[t])return o.d[t]>e.d[t]^o.s<0?1:-1;return n===a?0:n>a^o.s<0?1:-1};lt.decimalPlaces=lt.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*Br;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};lt.dividedBy=lt.div=function(e){return Zo(this,new this.constructor(e))};lt.dividedToIntegerBy=lt.idiv=function(e){var t=this,r=t.constructor;return Ar(Zo(t,new r(e),0,1),r.precision)};lt.equals=lt.eq=function(e){return!this.cmp(e)};lt.exponent=function(){return sn(this)};lt.greaterThan=lt.gt=function(e){return this.cmp(e)>0};lt.greaterThanOrEqualTo=lt.gte=function(e){return this.cmp(e)>=0};lt.isInteger=lt.isint=function(){return this.e>this.d.length-2};lt.isNegative=lt.isneg=function(){return this.s<0};lt.isPositive=lt.ispos=function(){return this.s>0};lt.isZero=function(){return this.s===0};lt.lessThan=lt.lt=function(e){return this.cmp(e)<0};lt.lessThanOrEqualTo=lt.lte=function(e){return this.cmp(e)<1};lt.logarithm=lt.log=function(e){var t,r=this,n=r.constructor,a=n.precision,o=a+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(da))throw Error(Ma+"NaN");if(r.s<1)throw Error(Ma+(r.s?"NaN":"-Infinity"));return r.eq(da)?new n(0):(Vr=!1,t=Zo(Kd(r,o),Kd(e,o),o),Vr=!0,Ar(t,a))};lt.minus=lt.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?R_(t,e):D_(t,(e.s=-e.s,e))};lt.modulo=lt.mod=function(e){var t,r=this,n=r.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(Ma+"NaN");return r.s?(Vr=!1,t=Zo(r,e,0,1).times(e),Vr=!0,r.minus(t)):Ar(new n(r),a)};lt.naturalExponential=lt.exp=function(){return L_(this)};lt.naturalLogarithm=lt.ln=function(){return Kd(this)};lt.negated=lt.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};lt.plus=lt.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?D_(t,e):R_(t,(e.s=-e.s,e))};lt.precision=lt.sd=function(e){var t,r,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Qi+e);if(t=sn(a)+1,n=a.d.length-1,r=n*Br+1,n=a.d[n],n){for(;n%10==0;n/=10)r--;for(n=a.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};lt.squareRoot=lt.sqrt=function(){var e,t,r,n,a,o,s,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Ma+"NaN")}for(e=sn(l),Vr=!1,a=Math.sqrt(+l),a==0||a==1/0?(t=io(l.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=du((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(a.toString()),r=c.precision,a=s=r+3;;)if(o=n,n=o.plus(Zo(l,o,s+2)).times(.5),io(o.d).slice(0,s)===(t=io(n.d)).slice(0,s)){if(t=t.slice(s-3,s+1),a==s&&t=="4999"){if(Ar(o,r+1,0),o.times(o).eq(l)){n=o;break}}else if(t!="9999")break;s+=4}return Vr=!0,Ar(n,r)};lt.times=lt.mul=function(e){var t,r,n,a,o,s,l,c,u,d=this,f=d.constructor,p=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,r=d.e+e.e,c=p.length,u=h.length,c<u&&(o=p,p=h,h=o,s=c,c=u,u=s),o=[],s=c+u,n=s;n--;)o.push(0);for(n=u;--n>=0;){for(t=0,a=c+n;a>n;)l=o[a]+h[n]*p[a-n-1]+t,o[a--]=l%wn|0,t=l/wn|0;o[a]=(o[a]+t)%wn|0}for(;!o[--s];)o.pop();return t?++r:o.shift(),e.d=o,e.e=r,Vr?Ar(e,f.precision):e};lt.toDecimalPlaces=lt.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(jo(e,0,uu),t===void 0?t=n.rounding:jo(t,0,8),Ar(r,e+sn(r)+1,t))};lt.toExponential=function(e,t){var r,n=this,a=n.constructor;return e===void 0?r=cl(n,!0):(jo(e,0,uu),t===void 0?t=a.rounding:jo(t,0,8),n=Ar(new a(n),e+1,t),r=cl(n,!0,e+1)),r};lt.toFixed=function(e,t){var r,n,a=this,o=a.constructor;return e===void 0?cl(a):(jo(e,0,uu),t===void 0?t=o.rounding:jo(t,0,8),n=Ar(new o(a),e+sn(a)+1,t),r=cl(n.abs(),!1,e+sn(n)+1),a.isneg()&&!a.isZero()?"-"+r:r)};lt.toInteger=lt.toint=function(){var e=this,t=e.constructor;return Ar(new t(e),sn(e)+1,t.rounding)};lt.toNumber=function(){return+this};lt.toPower=lt.pow=function(e){var t,r,n,a,o,s,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(da);if(l=new c(l),!l.s){if(e.s<1)throw Error(Ma+"Infinity");return l}if(l.eq(da))return l;if(n=c.precision,e.eq(da))return Ar(l,n);if(t=e.e,r=e.d.length-1,s=t>=r,o=l.s,s){if((r=d<0?-d:d)<=I_){for(a=new c(da),t=Math.ceil(n/Br+4),Vr=!1;r%2&&(a=a.times(l),g6(a.d,t)),r=du(r/2),r!==0;)l=l.times(l),g6(l.d,t);return Vr=!0,e.s<0?new c(da).div(a):Ar(a,n)}}else if(o<0)throw Error(Ma+"NaN");return o=o<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,Vr=!1,a=e.times(Kd(l,n+u)),Vr=!0,a=L_(a),a.s=o,a};lt.toPrecision=function(e,t){var r,n,a=this,o=a.constructor;return e===void 0?(r=sn(a),n=cl(a,r<=o.toExpNeg||r>=o.toExpPos)):(jo(e,1,uu),t===void 0?t=o.rounding:jo(t,0,8),a=Ar(new o(a),e,t),r=sn(a),n=cl(a,e<=r||r<=o.toExpNeg,e)),n};lt.toSignificantDigits=lt.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(jo(e,1,uu),t===void 0?t=n.rounding:jo(t,0,8)),Ar(new n(r),e,t)};lt.toString=lt.valueOf=lt.val=lt.toJSON=lt[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=sn(e),r=e.constructor;return cl(e,t<=r.toExpNeg||t>=r.toExpPos)};function D_(e,t){var r,n,a,o,s,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),Vr?Ar(t,f):t;if(c=e.d,u=t.d,s=e.e,a=t.e,c=c.slice(),o=s-a,o){for(o<0?(n=c,o=-o,l=u.length):(n=u,a=s,l=c.length),s=Math.ceil(f/Br),l=s>l?s+1:l+1,o>l&&(o=l,n.length=1),n.reverse();o--;)n.push(0);n.reverse()}for(l=c.length,o=u.length,l-o<0&&(o=l,n=u,u=c,c=n),r=0;o;)r=(c[--o]=c[o]+u[o]+r)/wn|0,c[o]%=wn;for(r&&(c.unshift(r),++a),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=a,Vr?Ar(t,f):t}function jo(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Qi+e)}function io(e){var t,r,n,a=e.length-1,o="",s=e[0];if(a>0){for(o+=s,t=1;t<a;t++)n=e[t]+"",r=Br-n.length,r&&(o+=Ts(r)),o+=n;s=e[t],n=s+"",r=Br-n.length,r&&(o+=Ts(r))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}var Zo=function(){function e(n,a){var o,s=0,l=n.length;for(n=n.slice();l--;)o=n[l]*a+s,n[l]=o%wn|0,s=o/wn|0;return s&&n.unshift(s),n}function t(n,a,o,s){var l,c;if(o!=s)c=o>s?1:-1;else for(l=c=0;l<o;l++)if(n[l]!=a[l]){c=n[l]>a[l]?1:-1;break}return c}function r(n,a,o){for(var s=0;o--;)n[o]-=s,s=n[o]<a[o]?1:0,n[o]=s*wn+n[o]-a[o];for(;!n[0]&&n.length>1;)n.shift()}return function(n,a,o,s){var l,c,u,d,f,p,h,g,b,y,v,k,N,w,E,C,O,D,A=n.constructor,M=n.s==a.s?1:-1,I=n.d,T=a.d;if(!n.s)return new A(n);if(!a.s)throw Error(Ma+"Division by zero");for(c=n.e-a.e,O=T.length,E=I.length,h=new A(M),g=h.d=[],u=0;T[u]==(I[u]||0);)++u;if(T[u]>(I[u]||0)&&--c,o==null?k=o=A.precision:s?k=o+(sn(n)-sn(a))+1:k=o,k<0)return new A(0);if(k=k/Br+2|0,u=0,O==1)for(d=0,T=T[0],k++;(u<E||d)&&k--;u++)N=d*wn+(I[u]||0),g[u]=N/T|0,d=N%T|0;else{for(d=wn/(T[0]+1)|0,d>1&&(T=e(T,d),I=e(I,d),O=T.length,E=I.length),w=O,b=I.slice(0,O),y=b.length;y<O;)b[y++]=0;D=T.slice(),D.unshift(0),C=T[0],T[1]>=wn/2&&++C;do d=0,l=t(T,b,O,y),l<0?(v=b[0],O!=y&&(v=v*wn+(b[1]||0)),d=v/C|0,d>1?(d>=wn&&(d=wn-1),f=e(T,d),p=f.length,y=b.length,l=t(f,b,p,y),l==1&&(d--,r(f,O<p?D:T,p))):(d==0&&(l=d=1),f=T.slice()),p=f.length,p<y&&f.unshift(0),r(b,f,y),l==-1&&(y=b.length,l=t(T,b,O,y),l<1&&(d++,r(b,O<y?D:T,y))),y=b.length):l===0&&(d++,b=[0]),g[u++]=d,l&&b[0]?b[y++]=I[w]||0:(b=[I[w]],y=1);while((w++<E||b[0]!==void 0)&&k--)}return g[0]||g.shift(),h.e=c,Ar(h,s?o+sn(h)+1:o)}}();function L_(e,t){var r,n,a,o,s,l,c=0,u=0,d=e.constructor,f=d.precision;if(sn(e)>16)throw Error(u1+sn(e));if(!e.s)return new d(da);for(Vr=!1,l=f,s=new d(.03125);e.abs().gte(.1);)e=e.times(s),u+=5;for(n=Math.log(Ti(2,u))/Math.LN10*2+5|0,l+=n,r=a=o=new d(da),d.precision=l;;){if(a=Ar(a.times(e),l),r=r.times(++c),s=o.plus(Zo(a,r,l)),io(s.d).slice(0,l)===io(o.d).slice(0,l)){for(;u--;)o=Ar(o.times(o),l);return d.precision=f,t==null?(Vr=!0,Ar(o,f)):o}o=s}}function sn(e){for(var t=e.e*Br,r=e.d[0];r>=10;r/=10)t++;return t}function Y0(e,t,r){if(t>e.LN10.sd())throw Vr=!0,r&&(e.precision=r),Error(Ma+"LN10 precision limit exceeded");return Ar(new e(e.LN10),t)}function Ts(e){for(var t="";e--;)t+="0";return t}function Kd(e,t){var r,n,a,o,s,l,c,u,d,f=1,p=10,h=e,g=h.d,b=h.constructor,y=b.precision;if(h.s<1)throw Error(Ma+(h.s?"NaN":"-Infinity"));if(h.eq(da))return new b(0);if(t==null?(Vr=!1,u=y):u=t,h.eq(10))return t==null&&(Vr=!0),Y0(b,u);if(u+=p,b.precision=u,r=io(g),n=r.charAt(0),o=sn(h),Math.abs(o)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)h=h.times(e),r=io(h.d),n=r.charAt(0),f++;o=sn(h),n>1?(h=new b("0."+r),o++):h=new b(n+"."+r.slice(1))}else return c=Y0(b,u+2,y).times(o+""),h=Kd(new b(n+"."+r.slice(1)),u-p).plus(c),b.precision=y,t==null?(Vr=!0,Ar(h,y)):h;for(l=s=h=Zo(h.minus(da),h.plus(da),u),d=Ar(h.times(h),u),a=3;;){if(s=Ar(s.times(d),u),c=l.plus(Zo(s,new b(a),u)),io(c.d).slice(0,u)===io(l.d).slice(0,u))return l=l.times(2),o!==0&&(l=l.plus(Y0(b,u+2,y).times(o+""))),l=Zo(l,new b(f),u),b.precision=y,t==null?(Vr=!0,Ar(l,y)):l;l=c,a+=2}}function h6(e,t){var r,n,a;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(n,a),t){if(a-=n,r=r-n-1,e.e=du(r/Br),e.d=[],n=(r+1)%Br,r<0&&(n+=Br),n<a){for(n&&e.d.push(+t.slice(0,n)),a-=Br;n<a;)e.d.push(+t.slice(n,n+=Br));t=t.slice(n),n=Br-t.length}else n-=a;for(;n--;)t+="0";if(e.d.push(+t),Vr&&(e.e>Qp||e.e<-Qp))throw Error(u1+r)}else e.s=0,e.e=0,e.d=[0];return e}function Ar(e,t,r){var n,a,o,s,l,c,u,d,f=e.d;for(s=1,o=f[0];o>=10;o/=10)s++;if(n=t-s,n<0)n+=Br,a=t,u=f[d=0];else{if(d=Math.ceil((n+1)/Br),o=f.length,d>=o)return e;for(u=o=f[d],s=1;o>=10;o/=10)s++;n%=Br,a=n-Br+s}if(r!==void 0&&(o=Ti(10,s-a-1),l=u/o%10|0,c=t<0||f[d+1]!==void 0||u%o,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?a>0?u/Ti(10,s-a):0:f[d-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(o=sn(e),f.length=1,t=t-o-1,f[0]=Ti(10,(Br-t%Br)%Br),e.e=du(-t/Br)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=d,o=1,d--):(f.length=d+1,o=Ti(10,Br-n),f[d]=a>0?(u/Ti(10,s-a)%Ti(10,a)|0)*o:0),c)for(;;)if(d==0){(f[0]+=o)==wn&&(f[0]=1,++e.e);break}else{if(f[d]+=o,f[d]!=wn)break;f[d--]=0,o=1}for(n=f.length;f[--n]===0;)f.pop();if(Vr&&(e.e>Qp||e.e<-Qp))throw Error(u1+sn(e));return e}function R_(e,t){var r,n,a,o,s,l,c,u,d,f,p=e.constructor,h=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),Vr?Ar(t,h):t;if(c=e.d,f=t.d,n=t.e,u=e.e,c=c.slice(),s=u-n,s){for(d=s<0,d?(r=c,s=-s,l=f.length):(r=f,n=u,l=c.length),a=Math.max(Math.ceil(h/Br),l)+2,s>a&&(s=a,r.length=1),r.reverse(),a=s;a--;)r.push(0);r.reverse()}else{for(a=c.length,l=f.length,d=a<l,d&&(l=a),a=0;a<l;a++)if(c[a]!=f[a]){d=c[a]<f[a];break}s=0}for(d&&(r=c,c=f,f=r,t.s=-t.s),l=c.length,a=f.length-l;a>0;--a)c[l++]=0;for(a=f.length;a>s;){if(c[--a]<f[a]){for(o=a;o&&c[--o]===0;)c[o]=wn-1;--c[o],c[a]+=wn}c[a]-=f[a]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(t.d=c,t.e=n,Vr?Ar(t,h):t):new p(0)}function cl(e,t,r){var n,a=sn(e),o=io(e.d),s=o.length;return t?(r&&(n=r-s)>0?o=o.charAt(0)+"."+o.slice(1)+Ts(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+Ts(-a-1)+o,r&&(n=r-s)>0&&(o+=Ts(n))):a>=s?(o+=Ts(a+1-s),r&&(n=r-a-1)>0&&(o=o+"."+Ts(n))):((n=a+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-s)>0&&(a+1===s&&(o+="."),o+=Ts(n))),e.s<0?"-"+o:o}function g6(e,t){if(e.length>t)return e.length=t,!0}function F_(e){var t,r,n;function a(o){var s=this;if(!(s instanceof a))return new a(o);if(s.constructor=a,o instanceof a){s.s=o.s,s.e=o.e,s.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Qi+o);if(o>0)s.s=1;else if(o<0)o=-o,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(o===~~o&&o<1e7){s.e=0,s.d=[o];return}return h6(s,o.toString())}else if(typeof o!="string")throw Error(Qi+o);if(o.charCodeAt(0)===45?(o=o.slice(1),s.s=-1):s.s=1,hte.test(o))h6(s,o);else throw Error(Qi+o)}if(a.prototype=lt,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=F_,a.config=a.set=gte,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return a.config(e),a}function gte(e){if(!e||typeof e!="object")throw Error(Ma+"Object expected");var t,r,n,a=["precision",1,uu,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if((n=e[r=a[t]])!==void 0)if(du(n)===n&&n>=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(Qi+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Qi+r+": "+n);return this}var d1=F_(pte);da=new d1(1);const jr=d1;function bte(e){return kte(e)||vte(e)||xte(e)||yte()}function yte(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
44
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xte(e,t){if(e){if(typeof e=="string")return u2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u2(e,t)}}function vte(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function kte(e){if(Array.isArray(e))return u2(e)}function u2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var wte=function(e){return e},$_={},B_=function(e){return e===$_},b6=function(e){return function t(){return arguments.length===0||arguments.length===1&&B_(arguments.length<=0?void 0:arguments[0])?t:e.apply(void 0,arguments)}},jte=function e(t,r){return t===1?r:b6(function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=a.filter(function(l){return l!==$_}).length;return s>=t?r.apply(void 0,a):e(t-s,b6(function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var d=a.map(function(f){return B_(f)?c.shift():f});return r.apply(void 0,bte(d).concat(c))}))})},Wg=function(e){return jte(e.length,e)},d2=function(e,t){for(var r=[],n=e;n<t;++n)r[n-e]=n;return r},Nte=Wg(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(r){return t[r]}).map(e)}),Ete=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.length)return wte;var n=t.reverse(),a=n[0],o=n.slice(1);return function(){return o.reduce(function(s,l){return l(s)},a.apply(void 0,arguments))}},f2=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},H_=function(e){var t=null,r=null;return function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return t&&a.every(function(s,l){return s===t[l]})||(t=a,r=e.apply(void 0,a)),r}};function Ste(e){var t;return e===0?t=1:t=Math.floor(new jr(e).abs().log(10).toNumber())+1,t}function Cte(e,t,r){for(var n=new jr(e),a=0,o=[];n.lt(t)&&a<1e5;)o.push(n.toNumber()),n=n.add(r),a++;return o}var Ote=Wg(function(e,t,r){var n=+e,a=+t;return n+r*(a-n)}),Pte=Wg(function(e,t,r){var n=t-+e;return n=n||1/0,(r-e)/n}),Ate=Wg(function(e,t,r){var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});const Kg={rangeStep:Cte,getDigitCount:Ste,interpolateNumber:Ote,uninterpolateNumber:Pte,uninterpolateTruncation:Ate};function m2(e){return _te(e)||Tte(e)||z_(e)||Mte()}function Mte(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
45
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tte(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function _te(e){if(Array.isArray(e))return p2(e)}function Yd(e,t){return Lte(e)||Dte(e,t)||z_(e,t)||Ite()}function Ite(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
46
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z_(e,t){if(e){if(typeof e=="string")return p2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return p2(e,t)}}function p2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Dte(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,a=!1,o=void 0;try{for(var s=e[Symbol.iterator](),l;!(n=(l=s.next()).done)&&(r.push(l.value),!(t&&r.length===t));n=!0);}catch(c){a=!0,o=c}finally{try{!n&&s.return!=null&&s.return()}finally{if(a)throw o}}return r}}function Lte(e){if(Array.isArray(e))return e}function U_(e){var t=Yd(e,2),r=t[0],n=t[1],a=r,o=n;return r>n&&(a=n,o=r),[a,o]}function q_(e,t,r){if(e.lte(0))return new jr(0);var n=Kg.getDigitCount(e.toNumber()),a=new jr(10).pow(n),o=e.div(a),s=n!==1?.05:.1,l=new jr(Math.ceil(o.div(s).toNumber())).add(r).mul(s),c=l.mul(a);return t?c:new jr(Math.ceil(c))}function Rte(e,t,r){var n=1,a=new jr(e);if(!a.isint()&&r){var o=Math.abs(e);o<1?(n=new jr(10).pow(Kg.getDigitCount(e)-1),a=new jr(Math.floor(a.div(n).toNumber())).mul(n)):o>1&&(a=new jr(Math.floor(e)))}else e===0?a=new jr(Math.floor((t-1)/2)):r||(a=new jr(Math.floor(e)));var s=Math.floor((t-1)/2),l=Ete(Nte(function(c){return a.add(new jr(c-s).mul(n)).toNumber()}),d2);return l(0,t)}function V_(e,t,r,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new jr(0),tickMin:new jr(0),tickMax:new jr(0)};var o=q_(new jr(t).sub(e).div(r-1),n,a),s;e<=0&&t>=0?s=new jr(0):(s=new jr(e).add(t).div(2),s=s.sub(new jr(s).mod(o)));var l=Math.ceil(s.sub(e).div(o).toNumber()),c=Math.ceil(new jr(t).sub(s).div(o).toNumber()),u=l+c+1;return u>r?V_(e,t,r,n,a+1):(u<r&&(c=t>0?c+(r-u):c,l=t>0?l:l+(r-u)),{step:o,tickMin:s.sub(new jr(l).mul(o)),tickMax:s.add(new jr(c).mul(o))})}function Fte(e){var t=Yd(e,2),r=t[0],n=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(a,2),l=U_([r,n]),c=Yd(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(m2(d2(0,a-1).map(function(){return 1/0}))):[].concat(m2(d2(0,a-1).map(function(){return-1/0})),[d]);return r>n?f2(f):f}if(u===d)return Rte(u,a,o);var p=V_(u,d,s,o),h=p.step,g=p.tickMin,b=p.tickMax,y=Kg.rangeStep(g,b.add(new jr(.1).mul(h)),h);return r>n?f2(y):y}function $te(e,t){var r=Yd(e,2),n=r[0],a=r[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=U_([n,a]),l=Yd(s,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[n,a];if(c===u)return[c];var d=Math.max(t,2),f=q_(new jr(u).sub(c).div(d-1),o,0),p=[].concat(m2(Kg.rangeStep(new jr(c),new jr(u).sub(new jr(.99).mul(f)),f)),[u]);return n>a?f2(p):p}var Bte=H_(Fte),Hte=H_($te),zte="Invariant failed";function ul(e,t){throw new Error(zte)}var Ute=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Oc(e){"@babel/helpers - typeof";return Oc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oc(e)}function eh(){return eh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},eh.apply(this,arguments)}function qte(e,t){return Yte(e)||Kte(e,t)||Wte(e,t)||Vte()}function Vte(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
47
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wte(e,t){if(e){if(typeof e=="string")return y6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y6(e,t)}}function y6(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Kte(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function Yte(e){if(Array.isArray(e))return e}function Xte(e,t){if(e==null)return{};var r=Gte(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Gte(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Zte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jte(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Y_(n.key),n)}}function Qte(e,t,r){return t&&Jte(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ere(e,t,r){return t=th(t),tre(e,W_()?Reflect.construct(t,r||[],th(e).constructor):t.apply(e,r))}function tre(e,t){if(t&&(Oc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rre(e)}function rre(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W_(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(W_=function(){return!!e})()}function th(e){return th=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},th(e)}function nre(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h2(e,t)}function h2(e,t){return h2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},h2(e,t)}function K_(e,t,r){return t=Y_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y_(e){var t=are(e,"string");return Oc(t)=="symbol"?t:t+""}function are(e,t){if(Oc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Oc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var fu=function(e){function t(){return Zte(this,t),ere(this,t,arguments)}return nre(t,e),Qte(t,[{key:"render",value:function(){var r=this.props,n=r.offset,a=r.layout,o=r.width,s=r.dataKey,l=r.data,c=r.dataPointFormatter,u=r.xAxis,d=r.yAxis,f=Xte(r,Ute),p=mt(f,!1);this.props.direction==="x"&&u.type!=="number"&&ul();var h=l.map(function(g){var b=c(g,s),y=b.x,v=b.y,k=b.value,N=b.errorVal;if(!N)return null;var w=[],E,C;if(Array.isArray(N)){var O=qte(N,2);E=O[0],C=O[1]}else E=C=N;if(a==="vertical"){var D=u.scale,A=v+n,M=A+o,I=A-o,T=D(k-E),R=D(k+C);w.push({x1:R,y1:M,x2:R,y2:I}),w.push({x1:T,y1:A,x2:R,y2:A}),w.push({x1:T,y1:M,x2:T,y2:I})}else if(a==="horizontal"){var L=d.scale,F=y+n,V=F-o,H=F+o,$=L(k-E),z=L(k+C);w.push({x1:V,y1:z,x2:H,y2:z}),w.push({x1:F,y1:$,x2:F,y2:z}),w.push({x1:V,y1:$,x2:H,y2:$})}return x.createElement(Rt,eh({className:"recharts-errorBar",key:"bar-".concat(w.map(function(W){return"".concat(W.x1,"-").concat(W.x2,"-").concat(W.y1,"-").concat(W.y2)}))},p),w.map(function(W){return x.createElement("line",eh({},W,{key:"line-".concat(W.x1,"-").concat(W.x2,"-").concat(W.y1,"-").concat(W.y2)}))}))});return x.createElement(Rt,{className:"recharts-errorBars"},h)}}])}(x.Component);K_(fu,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});K_(fu,"displayName","ErrorBar");function Xd(e){"@babel/helpers - typeof";return Xd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xd(e)}function x6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Si(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?x6(Object(r),!0).forEach(function(n){ore(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ore(e,t,r){return t=sre(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sre(e){var t=ire(e,"string");return Xd(t)=="symbol"?t:t+""}function ire(e,t){if(Xd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Xd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var X_=function(e){var t=e.children,r=e.formattedGraphicalItems,n=e.legendWidth,a=e.legendContent,o=sa(t,go);if(!o)return null;var s=go.defaultProps,l=s!==void 0?Si(Si({},s),o.props):{},c;return o.props&&o.props.payload?c=o.props&&o.props.payload:a==="children"?c=(r||[]).reduce(function(u,d){var f=d.item,p=d.props,h=p.sectors||p.data||[];return u.concat(h.map(function(g){return{type:o.props.iconType||f.props.legendType,value:g.name,color:g.fill,payload:g}}))},[]):c=(r||[]).map(function(u){var d=u.item,f=d.type.defaultProps,p=f!==void 0?Si(Si({},f),d.props):{},h=p.dataKey,g=p.name,b=p.legendType,y=p.hide;return{inactive:y,dataKey:h,type:l.iconType||b||"square",color:f1(d),value:g||h,payload:p}}),Si(Si(Si({},l),go.getWithHeight(o,n)),{},{payload:c,item:o})};function Gd(e){"@babel/helpers - typeof";return Gd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gd(e)}function v6(e){return dre(e)||ure(e)||cre(e)||lre()}function lre(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
48
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cre(e,t){if(e){if(typeof e=="string")return g2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g2(e,t)}}function ure(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function dre(e){if(Array.isArray(e))return g2(e)}function g2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function k6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Zr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?k6(Object(r),!0).forEach(function(n){sc(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sc(e,t,r){return t=fre(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fre(e){var t=mre(e,"string");return Gd(t)=="symbol"?t:t+""}function mre(e,t){if(Gd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Gd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hr(e,t,r){return vt(e)||vt(t)?r:bn(t)?xa(e,t,r):jt(t)?t(e):r}function lp(e,t,r,n){var a=dte(e,function(l){return Hr(l,t)});if(r==="number"){var o=a.filter(function(l){return ze(l)||parseFloat(l)});return o.length?[Vg(o),Fs(o)]:[1/0,-1/0]}var s=n?a.filter(function(l){return!vt(l)}):a;return s.map(function(l){return bn(l)||l instanceof Date?l:""})}var pre=function(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,s=(t=r?.length)!==null&&t!==void 0?t:0;if(s<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var l=a.range,c=0;c<s;c++){var u=c>0?n[c-1].coordinate:n[s-1].coordinate,d=n[c].coordinate,f=c>=s-1?n[0].coordinate:n[c+1].coordinate,p=void 0;if(Fn(d-u)!==Fn(f-d)){var h=[];if(Fn(f-d)===Fn(l[1]-l[0])){p=f;var g=d+l[1]-l[0];h[0]=Math.min(g,(g+u)/2),h[1]=Math.max(g,(g+u)/2)}else{p=u;var b=f+l[1]-l[0];h[0]=Math.min(d,(b+d)/2),h[1]=Math.max(d,(b+d)/2)}var y=[Math.min(d,(p+d)/2),Math.max(d,(p+d)/2)];if(e>y[0]&&e<=y[1]||e>=h[0]&&e<=h[1]){o=n[c].index;break}}else{var v=Math.min(u,f),k=Math.max(u,f);if(e>(v+d)/2&&e<=(k+d)/2){o=n[c].index;break}}}else for(var N=0;N<s;N++)if(N===0&&e<=(r[N].coordinate+r[N+1].coordinate)/2||N>0&&N<s-1&&e>(r[N].coordinate+r[N-1].coordinate)/2&&e<=(r[N].coordinate+r[N+1].coordinate)/2||N===s-1&&e>(r[N].coordinate+r[N-1].coordinate)/2){o=r[N].index;break}return o},f1=function(e){var t,r=e,n=r.type.displayName,a=(t=e.type)!==null&&t!==void 0&&t.defaultProps?Zr(Zr({},e.type.defaultProps),e.props):e.props,o=a.stroke,s=a.fill,l;switch(n){case"Line":l=o;break;case"Area":case"Radar":l=o&&o!=="none"?o:s;break;default:l=s;break}return l},hre=function(e){var t=e.barSize,r=e.totalSize,n=e.stackGroups,a=n===void 0?{}:n;if(!a)return{};for(var o={},s=Object.keys(a),l=0,c=s.length;l<c;l++)for(var u=a[s[l]].stackGroups,d=Object.keys(u),f=0,p=d.length;f<p;f++){var h=u[d[f]],g=h.items,b=h.cateAxisId,y=g.filter(function(C){return Go(C.type).indexOf("Bar")>=0});if(y&&y.length){var v=y[0].type.defaultProps,k=v!==void 0?Zr(Zr({},v),y[0].props):y[0].props,N=k.barSize,w=k[b];o[w]||(o[w]=[]);var E=vt(N)?t:N;o[w].push({item:y[0],stackList:y.slice(1),barSize:vt(E)?void 0:$n(E,r,0)})}}return o},gre=function(e){var t=e.barGap,r=e.barCategoryGap,n=e.bandSize,a=e.sizeList,o=a===void 0?[]:a,s=e.maxBarSize,l=o.length;if(l<1)return null;var c=$n(t,n,0,!0),u,d=[];if(o[0].barSize===+o[0].barSize){var f=!1,p=n/l,h=o.reduce(function(N,w){return N+w.barSize||0},0);h+=(l-1)*c,h>=n&&(h-=(l-1)*c,c=0),h>=n&&p>0&&(f=!0,p*=.9,h=l*p);var g=(n-h)/2>>0,b={offset:g-c,size:0};u=o.reduce(function(N,w){var E={item:w.item,position:{offset:b.offset+b.size+c,size:f?p:w.barSize}},C=[].concat(v6(N),[E]);return b=C[C.length-1].position,w.stackList&&w.stackList.length&&w.stackList.forEach(function(O){C.push({item:O,position:b})}),C},d)}else{var y=$n(r,n,0,!0);n-2*y-(l-1)*c<=0&&(c=0);var v=(n-2*y-(l-1)*c)/l;v>1&&(v>>=0);var k=s===+s?Math.min(v,s):v;u=o.reduce(function(N,w,E){var C=[].concat(v6(N),[{item:w.item,position:{offset:y+(v+c)*E+(v-k)/2,size:k}}]);return w.stackList&&w.stackList.length&&w.stackList.forEach(function(O){C.push({item:O,position:C[C.length-1].position})}),C},d)}return u},bre=function(e,t,r,n){var a=r.children,o=r.width,s=r.margin,l=o-(s.left||0)-(s.right||0),c=X_({children:a,legendWidth:l});if(c){var u=n||{},d=u.width,f=u.height,p=c.align,h=c.verticalAlign,g=c.layout;if((g==="vertical"||g==="horizontal"&&h==="middle")&&p!=="center"&&ze(e[p]))return Zr(Zr({},e),{},sc({},p,e[p]+(d||0)));if((g==="horizontal"||g==="vertical"&&p==="center")&&h!=="middle"&&ze(e[h]))return Zr(Zr({},e),{},sc({},h,e[h]+(f||0)))}return e},yre=function(e,t,r){return vt(t)?!0:e==="horizontal"?t==="yAxis":e==="vertical"||r==="x"?t==="xAxis":r==="y"?t==="yAxis":!0},G_=function(e,t,r,n,a){var o=t.props.children,s=zn(o,fu).filter(function(c){return yre(n,a,c.props.direction)});if(s&&s.length){var l=s.map(function(c){return c.props.dataKey});return e.reduce(function(c,u){var d=Hr(u,r);if(vt(d))return c;var f=Array.isArray(d)?[Vg(d),Fs(d)]:[d,d],p=l.reduce(function(h,g){var b=Hr(u,g,0),y=f[0]-Math.abs(Array.isArray(b)?b[0]:b),v=f[1]+Math.abs(Array.isArray(b)?b[1]:b);return[Math.min(y,h[0]),Math.max(v,h[1])]},[1/0,-1/0]);return[Math.min(p[0],c[0]),Math.max(p[1],c[1])]},[1/0,-1/0])}return null},xre=function(e,t,r,n,a){var o=t.map(function(s){return G_(e,s,r,a,n)}).filter(function(s){return!vt(s)});return o&&o.length?o.reduce(function(s,l){return[Math.min(s[0],l[0]),Math.max(s[1],l[1])]},[1/0,-1/0]):null},Z_=function(e,t,r,n,a){var o=t.map(function(l){var c=l.props.dataKey;return r==="number"&&c&&G_(e,l,c,n)||lp(e,c,r,a)});if(r==="number")return o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]);var s={};return o.reduce(function(l,c){for(var u=0,d=c.length;u<d;u++)s[c[u]]||(s[c[u]]=!0,l.push(c[u]));return l},[])},J_=function(e,t){return e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis"},Q_=function(e,t,r,n){if(n)return e.map(function(l){return l.coordinate});var a,o,s=e.map(function(l){return l.coordinate===t&&(a=!0),l.coordinate===r&&(o=!0),l.coordinate});return a||s.push(t),o||s.push(r),s},Wo=function(e,t,r){if(!e)return null;var n=e.scale,a=e.duplicateDomain,o=e.type,s=e.range,l=e.realScaleType==="scaleBand"?n.bandwidth()/2:2,c=(t||r)&&o==="category"&&n.bandwidth?n.bandwidth()/l:0;if(c=e.axisType==="angleAxis"&&s?.length>=2?Fn(s[0]-s[1])*2*c:c,t&&(e.ticks||e.niceTicks)){var u=(e.ticks||e.niceTicks).map(function(d){var f=a?a.indexOf(d):d;return{coordinate:n(f)+c,value:d,offset:c}});return u.filter(function(d){return!iu(d.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(d,f){return{coordinate:n(d)+c,value:d,index:f,offset:c}}):n.ticks&&!r?n.ticks(e.tickCount).map(function(d){return{coordinate:n(d)+c,value:d,offset:c}}):n.domain().map(function(d,f){return{coordinate:n(d)+c,value:a?a[d]:d,index:f,offset:c}})},X0=new WeakMap,$m=function(e,t){if(typeof t!="function")return e;X0.has(e)||X0.set(e,new WeakMap);var r=X0.get(e);if(r.has(t))return r.get(t);var n=function(){e.apply(void 0,arguments),t.apply(void 0,arguments)};return r.set(t,n),n},eI=function(e,t,r){var n=e.scale,a=e.type,o=e.layout,s=e.axisType;if(n==="auto")return o==="radial"&&s==="radiusAxis"?{scale:zd(),realScaleType:"band"}:o==="radial"&&s==="angleAxis"?{scale:Xp(),realScaleType:"linear"}:a==="category"&&t&&(t.indexOf("LineChart")>=0||t.indexOf("AreaChart")>=0||t.indexOf("ComposedChart")>=0&&!r)?{scale:vd(),realScaleType:"point"}:a==="category"?{scale:zd(),realScaleType:"band"}:{scale:Xp(),realScaleType:"linear"};if(il(n)){var l="scale".concat(Pg(n));return{scale:(s6[l]||vd)(),realScaleType:s6[l]?l:"point"}}return jt(n)?{scale:n}:{scale:vd(),realScaleType:"point"}},w6=1e-4,tI=function(e){var t=e.domain();if(!(!t||t.length<=2)){var r=t.length,n=e.range(),a=Math.min(n[0],n[1])-w6,o=Math.max(n[0],n[1])+w6,s=e(t[0]),l=e(t[r-1]);(s<a||s>o||l<a||l>o)&&e.domain([t[0],t[r-1]])}},vre=function(e,t){if(!e)return null;for(var r=0,n=e.length;r<n;r++)if(e[r].item===t)return e[r].position;return null},kre=function(e,t){if(!t||t.length!==2||!ze(t[0])||!ze(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),a=[e[0],e[1]];return(!ze(e[0])||e[0]<r)&&(a[0]=r),(!ze(e[1])||e[1]>n)&&(a[1]=n),a[0]>n&&(a[0]=n),a[1]<r&&(a[1]=r),a},wre=function(e){var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r<n;++r)for(var a=0,o=0,s=0;s<t;++s){var l=iu(e[s][r][1])?e[s][r][0]:e[s][r][1];l>=0?(e[s][r][0]=a,e[s][r][1]=a+l,a=e[s][r][1]):(e[s][r][0]=o,e[s][r][1]=o+l,o=e[s][r][1])}},jre=function(e){var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r<n;++r)for(var a=0,o=0;o<t;++o){var s=iu(e[o][r][1])?e[o][r][0]:e[o][r][1];s>=0?(e[o][r][0]=a,e[o][r][1]=a+s,a=e[o][r][1]):(e[o][r][0]=0,e[o][r][1]=0)}},Nre={sign:wre,expand:dX,none:vc,silhouette:fX,wiggle:mX,positive:jre},Ere=function(e,t,r){var n=t.map(function(s){return s.props.dataKey}),a=Nre[r],o=uX().keys(n).value(function(s,l){return+Hr(s,l,0)}).order(Ww).offset(a);return o(e)},Sre=function(e,t,r,n,a,o){if(!e)return null;var s=o?t.reverse():t,l={},c=s.reduce(function(d,f){var p,h=(p=f.type)!==null&&p!==void 0&&p.defaultProps?Zr(Zr({},f.type.defaultProps),f.props):f.props,g=h.stackId,b=h.hide;if(b)return d;var y=h[r],v=d[y]||{hasStack:!1,stackGroups:{}};if(bn(g)){var k=v.stackGroups[g]||{numericAxisId:r,cateAxisId:n,items:[]};k.items.push(f),v.hasStack=!0,v.stackGroups[g]=k}else v.stackGroups[fi("_stackId_")]={numericAxisId:r,cateAxisId:n,items:[f]};return Zr(Zr({},d),{},sc({},y,v))},l),u={};return Object.keys(c).reduce(function(d,f){var p=c[f];if(p.hasStack){var h={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(g,b){var y=p.stackGroups[b];return Zr(Zr({},g),{},sc({},b,{numericAxisId:r,cateAxisId:n,items:y.items,stackedData:Ere(e,y.items,a)}))},h)}return Zr(Zr({},d),{},sc({},f,p))},u)},rI=function(e,t){var r=t.realScaleType,n=t.type,a=t.tickCount,o=t.originalDomain,s=t.allowDecimals,l=r||t.scale;if(l!=="auto"&&l!=="linear")return null;if(a&&n==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var c=e.domain();if(!c.length)return null;var u=Bte(c,a,s);return e.domain([Vg(u),Fs(u)]),{niceTicks:u}}if(a&&n==="number"){var d=e.domain(),f=Hte(d,a,s);return{niceTicks:f}}return null};function Pc(e){var t=e.axis,r=e.ticks,n=e.bandSize,a=e.entry,o=e.index,s=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!vt(a[t.dataKey])){var l=Ap(r,"value",a[t.dataKey]);if(l)return l.coordinate+n/2}return r[o]?r[o].coordinate+n/2:null}var c=Hr(a,vt(s)?t.dataKey:s);return vt(c)?null:t.scale(c)}var j6=function(e){var t=e.axis,r=e.ticks,n=e.offset,a=e.bandSize,o=e.entry,s=e.index;if(t.type==="category")return r[s]?r[s].coordinate+n:null;var l=Hr(o,t.dataKey,t.domain[s]);return vt(l)?null:t.scale(l)-a/2+n},Cre=function(e){var t=e.numericAxis,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);return n<=0&&a>=0?0:a<0?a:n}return r[0]},Ore=function(e,t){var r,n=(r=e.type)!==null&&r!==void 0&&r.defaultProps?Zr(Zr({},e.type.defaultProps),e.props):e.props,a=n.stackId;if(bn(a)){var o=t[a];if(o){var s=o.items.indexOf(e);return s>=0?o.stackedData[s]:null}}return null},Pre=function(e){return e.reduce(function(t,r){return[Vg(r.concat([t[0]]).filter(ze)),Fs(r.concat([t[1]]).filter(ze))]},[1/0,-1/0])},nI=function(e,t,r){return Object.keys(e).reduce(function(n,a){var o=e[a],s=o.stackedData,l=s.reduce(function(c,u){var d=Pre(u.slice(t,r+1));return[Math.min(c[0],d[0]),Math.max(c[1],d[1])]},[1/0,-1/0]);return[Math.min(l[0],n[0]),Math.max(l[1],n[1])]},[1/0,-1/0]).map(function(n){return n===1/0||n===-1/0?0:n})},N6=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,E6=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,b2=function(e,t,r){if(jt(e))return e(t,r);if(!Array.isArray(e))return t;var n=[];if(ze(e[0]))n[0]=r?e[0]:Math.min(e[0],t[0]);else if(N6.test(e[0])){var a=+N6.exec(e[0])[1];n[0]=t[0]-a}else jt(e[0])?n[0]=e[0](t[0]):n[0]=t[0];if(ze(e[1]))n[1]=r?e[1]:Math.max(e[1],t[1]);else if(E6.test(e[1])){var o=+E6.exec(e[1])[1];n[1]=t[1]+o}else jt(e[1])?n[1]=e[1](t[1]):n[1]=t[1];return n},rh=function(e,t,r){if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var a=BN(t,function(d){return d.coordinate}),o=1/0,s=1,l=a.length;s<l;s++){var c=a[s],u=a[s-1];o=Math.min((c.coordinate||0)-(u.coordinate||0),o)}return o===1/0?0:o}return r?void 0:0},S6=function(e,t,r){return!e||!e.length||ri(e,xa(r,"type.defaultProps.domain"))?t:e},aI=function(e,t){var r=e.type.defaultProps?Zr(Zr({},e.type.defaultProps),e.props):e.props,n=r.dataKey,a=r.name,o=r.unit,s=r.formatter,l=r.tooltipType,c=r.chartType,u=r.hide;return Zr(Zr({},mt(e,!1)),{},{dataKey:n,unit:o,formatter:s,name:a||n,color:f1(e),value:Hr(t,n),type:l,payload:t,chartType:c,hide:u})};function Zd(e){"@babel/helpers - typeof";return Zd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zd(e)}function C6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function zo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?C6(Object(r),!0).forEach(function(n){oI(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function oI(e,t,r){return t=Are(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Are(e){var t=Mre(e,"string");return Zd(t)=="symbol"?t:t+""}function Mre(e,t){if(Zd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Zd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Tre(e,t){return Lre(e)||Dre(e,t)||Ire(e,t)||_re()}function _re(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
49
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ire(e,t){if(e){if(typeof e=="string")return O6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return O6(e,t)}}function O6(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Dre(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function Lre(e){if(Array.isArray(e))return e}var nh=Math.PI/180,Rre=function(e){return e*180/Math.PI},_r=function(e,t,r,n){return{x:e+Math.cos(-nh*n)*r,y:t+Math.sin(-nh*n)*r}},sI=function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(t-(r.top||0)-(r.bottom||0)))/2},Fre=function(e,t,r,n,a){var o=e.width,s=e.height,l=e.startAngle,c=e.endAngle,u=$n(e.cx,o,o/2),d=$n(e.cy,s,s/2),f=sI(o,s,r),p=$n(e.innerRadius,f,0),h=$n(e.outerRadius,f,f*.8),g=Object.keys(t);return g.reduce(function(b,y){var v=t[y],k=v.domain,N=v.reversed,w;if(vt(v.range))n==="angleAxis"?w=[l,c]:n==="radiusAxis"&&(w=[p,h]),N&&(w=[w[1],w[0]]);else{w=v.range;var E=w,C=Tre(E,2);l=C[0],c=C[1]}var O=eI(v,a),D=O.realScaleType,A=O.scale;A.domain(k).range(w),tI(A);var M=rI(A,zo(zo({},v),{},{realScaleType:D})),I=zo(zo(zo({},v),M),{},{range:w,radius:h,realScaleType:D,scale:A,cx:u,cy:d,innerRadius:p,outerRadius:h,startAngle:l,endAngle:c});return zo(zo({},b),{},oI({},y,I))},{})},$re=function(e,t){var r=e.x,n=e.y,a=t.x,o=t.y;return Math.sqrt(Math.pow(r-a,2)+Math.pow(n-o,2))},Bre=function(e,t){var r=e.x,n=e.y,a=t.cx,o=t.cy,s=$re({x:r,y:n},{x:a,y:o});if(s<=0)return{radius:s};var l=(r-a)/s,c=Math.acos(l);return n>o&&(c=2*Math.PI-c),{radius:s,angle:Rre(c),angleInRadian:c}},Hre=function(e){var t=e.startAngle,r=e.endAngle,n=Math.floor(t/360),a=Math.floor(r/360),o=Math.min(n,a);return{startAngle:t-o*360,endAngle:r-o*360}},zre=function(e,t){var r=t.startAngle,n=t.endAngle,a=Math.floor(r/360),o=Math.floor(n/360),s=Math.min(a,o);return e+s*360},P6=function(e,t){var r=e.x,n=e.y,a=Bre({x:r,y:n},t),o=a.radius,s=a.angle,l=t.innerRadius,c=t.outerRadius;if(o<l||o>c)return!1;if(o===0)return!0;var u=Hre(t),d=u.startAngle,f=u.endAngle,p=s,h;if(d<=f){for(;p>f;)p-=360;for(;p<d;)p+=360;h=p>=d&&p<=f}else{for(;p>d;)p-=360;for(;p<f;)p+=360;h=p>=f&&p<=d}return h?zo(zo({},t),{},{radius:o,angle:zre(p,t)}):null},iI=function(e){return!m.isValidElement(e)&&!jt(e)&&typeof e!="boolean"?e.className:""};function Jd(e){"@babel/helpers - typeof";return Jd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jd(e)}var Ure=["offset"];function qre(e){return Yre(e)||Kre(e)||Wre(e)||Vre()}function Vre(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
50
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wre(e,t){if(e){if(typeof e=="string")return y2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y2(e,t)}}function Kre(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Yre(e){if(Array.isArray(e))return y2(e)}function y2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Xre(e,t){if(e==null)return{};var r=Gre(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Gre(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function A6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function fn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?A6(Object(r),!0).forEach(function(n){Zre(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zre(e,t,r){return t=Jre(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jre(e){var t=Qre(e,"string");return Jd(t)=="symbol"?t:t+""}function Qre(e,t){if(Jd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Jd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qd(){return Qd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qd.apply(this,arguments)}var ene=function(e){var t=e.value,r=e.formatter,n=vt(e.children)?t:e.children;return jt(r)?r(n):n},tne=function(e,t){var r=Fn(t-e),n=Math.min(Math.abs(t-e),360);return r*n},rne=function(e,t,r){var n=e.position,a=e.viewBox,o=e.offset,s=e.className,l=a,c=l.cx,u=l.cy,d=l.innerRadius,f=l.outerRadius,p=l.startAngle,h=l.endAngle,g=l.clockWise,b=(d+f)/2,y=tne(p,h),v=y>=0?1:-1,k,N;n==="insideStart"?(k=p+v*o,N=g):n==="insideEnd"?(k=h-v*o,N=!g):n==="end"&&(k=h+v*o,N=g),N=y<=0?N:!N;var w=_r(c,u,b,k),E=_r(c,u,b,k+(N?1:-1)*359),C="M".concat(w.x,",").concat(w.y,`
51
- A`).concat(b,",").concat(b,",0,1,").concat(N?0:1,`,
52
- `).concat(E.x,",").concat(E.y),O=vt(e.id)?fi("recharts-radial-line-"):e.id;return x.createElement("text",Qd({},r,{dominantBaseline:"central",className:Lt("recharts-radial-bar-label",s)}),x.createElement("defs",null,x.createElement("path",{id:O,d:C})),x.createElement("textPath",{xlinkHref:"#".concat(O)},t))},nne=function(e){var t=e.viewBox,r=e.offset,n=e.position,a=t,o=a.cx,s=a.cy,l=a.innerRadius,c=a.outerRadius,u=a.startAngle,d=a.endAngle,f=(u+d)/2;if(n==="outside"){var p=_r(o,s,c+r,f),h=p.x,g=p.y;return{x:h,y:g,textAnchor:h>=o?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:o,y:s,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:o,y:s,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:o,y:s,textAnchor:"middle",verticalAnchor:"end"};var b=(l+c)/2,y=_r(o,s,b,f),v=y.x,k=y.y;return{x:v,y:k,textAnchor:"middle",verticalAnchor:"middle"}},ane=function(e){var t=e.viewBox,r=e.parentViewBox,n=e.offset,a=e.position,o=t,s=o.x,l=o.y,c=o.width,u=o.height,d=u>=0?1:-1,f=d*n,p=d>0?"end":"start",h=d>0?"start":"end",g=c>=0?1:-1,b=g*n,y=g>0?"end":"start",v=g>0?"start":"end";if(a==="top"){var k={x:s+c/2,y:l-d*n,textAnchor:"middle",verticalAnchor:p};return fn(fn({},k),r?{height:Math.max(l-r.y,0),width:c}:{})}if(a==="bottom"){var N={x:s+c/2,y:l+u+f,textAnchor:"middle",verticalAnchor:h};return fn(fn({},N),r?{height:Math.max(r.y+r.height-(l+u),0),width:c}:{})}if(a==="left"){var w={x:s-b,y:l+u/2,textAnchor:y,verticalAnchor:"middle"};return fn(fn({},w),r?{width:Math.max(w.x-r.x,0),height:u}:{})}if(a==="right"){var E={x:s+c+b,y:l+u/2,textAnchor:v,verticalAnchor:"middle"};return fn(fn({},E),r?{width:Math.max(r.x+r.width-E.x,0),height:u}:{})}var C=r?{width:c,height:u}:{};return a==="insideLeft"?fn({x:s+b,y:l+u/2,textAnchor:v,verticalAnchor:"middle"},C):a==="insideRight"?fn({x:s+c-b,y:l+u/2,textAnchor:y,verticalAnchor:"middle"},C):a==="insideTop"?fn({x:s+c/2,y:l+f,textAnchor:"middle",verticalAnchor:h},C):a==="insideBottom"?fn({x:s+c/2,y:l+u-f,textAnchor:"middle",verticalAnchor:p},C):a==="insideTopLeft"?fn({x:s+b,y:l+f,textAnchor:v,verticalAnchor:h},C):a==="insideTopRight"?fn({x:s+c-b,y:l+f,textAnchor:y,verticalAnchor:h},C):a==="insideBottomLeft"?fn({x:s+b,y:l+u-f,textAnchor:v,verticalAnchor:p},C):a==="insideBottomRight"?fn({x:s+c-b,y:l+u-f,textAnchor:y,verticalAnchor:p},C):su(a)&&(ze(a.x)||Wi(a.x))&&(ze(a.y)||Wi(a.y))?fn({x:s+$n(a.x,c),y:l+$n(a.y,u),textAnchor:"end",verticalAnchor:"end"},C):fn({x:s+c/2,y:l+u/2,textAnchor:"middle",verticalAnchor:"middle"},C)},one=function(e){return"cx"in e&&ze(e.cx)};function Nr(e){var t=e.offset,r=t===void 0?5:t,n=Xre(e,Ure),a=fn({offset:r},n),o=a.viewBox,s=a.position,l=a.value,c=a.children,u=a.content,d=a.className,f=d===void 0?"":d,p=a.textBreakAll;if(!o||vt(l)&&vt(c)&&!m.isValidElement(u)&&!jt(u))return null;if(m.isValidElement(u))return m.cloneElement(u,a);var h;if(jt(u)){if(h=m.createElement(u,a),m.isValidElement(h))return h}else h=ene(a);var g=one(o),b=mt(a,!0);if(g&&(s==="insideStart"||s==="insideEnd"||s==="end"))return rne(a,h,b);var y=g?nne(a):ane(a);return x.createElement(ll,Qd({className:Lt("recharts-label",f)},b,y,{breakAll:p}),h)}Nr.displayName="Label";var lI=function(e){var t=e.cx,r=e.cy,n=e.angle,a=e.startAngle,o=e.endAngle,s=e.r,l=e.radius,c=e.innerRadius,u=e.outerRadius,d=e.x,f=e.y,p=e.top,h=e.left,g=e.width,b=e.height,y=e.clockWise,v=e.labelViewBox;if(v)return v;if(ze(g)&&ze(b)){if(ze(d)&&ze(f))return{x:d,y:f,width:g,height:b};if(ze(p)&&ze(h))return{x:p,y:h,width:g,height:b}}return ze(d)&&ze(f)?{x:d,y:f,width:0,height:0}:ze(t)&&ze(r)?{cx:t,cy:r,startAngle:a||n||0,endAngle:o||n||0,innerRadius:c||0,outerRadius:u||l||s||0,clockWise:y}:e.viewBox?e.viewBox:{}},sne=function(e,t){return e?e===!0?x.createElement(Nr,{key:"label-implicit",viewBox:t}):bn(e)?x.createElement(Nr,{key:"label-implicit",viewBox:t,value:e}):m.isValidElement(e)?e.type===Nr?m.cloneElement(e,{key:"label-implicit",viewBox:t}):x.createElement(Nr,{key:"label-implicit",content:e,viewBox:t}):jt(e)?x.createElement(Nr,{key:"label-implicit",content:e,viewBox:t}):su(e)?x.createElement(Nr,Qd({viewBox:t},e,{key:"label-implicit"})):null:null},ine=function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,a=lI(e),o=zn(n,Nr).map(function(l,c){return m.cloneElement(l,{viewBox:t||a,key:"label-".concat(c)})});if(!r)return o;var s=sne(e.label,t||a);return[s].concat(qre(o))};Nr.parseViewBox=lI;Nr.renderCallByParent=ine;var G0,M6;function lne(){if(M6)return G0;M6=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return G0=e,G0}var cne=lne();const une=mr(cne);function ef(e){"@babel/helpers - typeof";return ef=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ef(e)}var dne=["valueAccessor"],fne=["data","dataKey","clockWise","id","textBreakAll"];function mne(e){return bne(e)||gne(e)||hne(e)||pne()}function pne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
53
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hne(e,t){if(e){if(typeof e=="string")return x2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return x2(e,t)}}function gne(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function bne(e){if(Array.isArray(e))return x2(e)}function x2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ah(){return ah=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ah.apply(this,arguments)}function T6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function _6(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?T6(Object(r),!0).forEach(function(n){yne(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function yne(e,t,r){return t=xne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xne(e){var t=vne(e,"string");return ef(t)=="symbol"?t:t+""}function vne(e,t){if(ef(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ef(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function I6(e,t){if(e==null)return{};var r=kne(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function kne(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var wne=function(e){return Array.isArray(e.value)?une(e.value):e.value};function Wa(e){var t=e.valueAccessor,r=t===void 0?wne:t,n=I6(e,dne),a=n.data,o=n.dataKey,s=n.clockWise,l=n.id,c=n.textBreakAll,u=I6(n,fne);return!a||!a.length?null:x.createElement(Rt,{className:"recharts-label-list"},a.map(function(d,f){var p=vt(o)?r(d,f):Hr(d&&d.payload,o),h=vt(l)?{}:{id:"".concat(l,"-").concat(f)};return x.createElement(Nr,ah({},mt(d,!0),u,h,{parentViewBox:d.parentViewBox,value:p,textBreakAll:c,viewBox:Nr.parseViewBox(vt(s)?d:_6(_6({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}Wa.displayName="LabelList";function jne(e,t){return e?e===!0?x.createElement(Wa,{key:"labelList-implicit",data:t}):x.isValidElement(e)||jt(e)?x.createElement(Wa,{key:"labelList-implicit",data:t,content:e}):su(e)?x.createElement(Wa,ah({data:t},e,{key:"labelList-implicit"})):null:null}function Nne(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,a=zn(n,Wa).map(function(s,l){return m.cloneElement(s,{data:t,key:"labelList-".concat(l)})});if(!r)return a;var o=jne(e.label,t);return[o].concat(mne(a))}Wa.renderCallByParent=Nne;function tf(e){"@babel/helpers - typeof";return tf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tf(e)}function v2(){return v2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v2.apply(this,arguments)}function D6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function L6(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?D6(Object(r),!0).forEach(function(n){Ene(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):D6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ene(e,t,r){return t=Sne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sne(e){var t=Cne(e,"string");return tf(t)=="symbol"?t:t+""}function Cne(e,t){if(tf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(tf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var One=function(e,t){var r=Fn(t-e),n=Math.min(Math.abs(t-e),359.999);return r*n},Bm=function(e){var t=e.cx,r=e.cy,n=e.radius,a=e.angle,o=e.sign,s=e.isExternal,l=e.cornerRadius,c=e.cornerIsExternal,u=l*(s?1:-1)+n,d=Math.asin(l/u)/nh,f=c?a:a+o*d,p=_r(t,r,u,f),h=_r(t,r,n,f),g=c?a-o*d:a,b=_r(t,r,u*Math.cos(d*nh),g);return{center:p,circleTangency:h,lineTangency:b,theta:d}},cI=function(e){var t=e.cx,r=e.cy,n=e.innerRadius,a=e.outerRadius,o=e.startAngle,s=e.endAngle,l=One(o,s),c=o+l,u=_r(t,r,a,o),d=_r(t,r,a,c),f="M ".concat(u.x,",").concat(u.y,`
54
- A `).concat(a,",").concat(a,`,0,
55
- `).concat(+(Math.abs(l)>180),",").concat(+(o>c),`,
56
- `).concat(d.x,",").concat(d.y,`
57
- `);if(n>0){var p=_r(t,r,n,o),h=_r(t,r,n,c);f+="L ".concat(h.x,",").concat(h.y,`
58
- A `).concat(n,",").concat(n,`,0,
59
- `).concat(+(Math.abs(l)>180),",").concat(+(o<=c),`,
60
- `).concat(p.x,",").concat(p.y," Z")}else f+="L ".concat(t,",").concat(r," Z");return f},Pne=function(e){var t=e.cx,r=e.cy,n=e.innerRadius,a=e.outerRadius,o=e.cornerRadius,s=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,u=e.endAngle,d=Fn(u-c),f=Bm({cx:t,cy:r,radius:a,angle:c,sign:d,cornerRadius:o,cornerIsExternal:l}),p=f.circleTangency,h=f.lineTangency,g=f.theta,b=Bm({cx:t,cy:r,radius:a,angle:u,sign:-d,cornerRadius:o,cornerIsExternal:l}),y=b.circleTangency,v=b.lineTangency,k=b.theta,N=l?Math.abs(c-u):Math.abs(c-u)-g-k;if(N<0)return s?"M ".concat(h.x,",").concat(h.y,`
61
- a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
62
- a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
63
- `):cI({cx:t,cy:r,innerRadius:n,outerRadius:a,startAngle:c,endAngle:u});var w="M ".concat(h.x,",").concat(h.y,`
64
- A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(p.x,",").concat(p.y,`
65
- A`).concat(a,",").concat(a,",0,").concat(+(N>180),",").concat(+(d<0),",").concat(y.x,",").concat(y.y,`
66
- A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(v.x,",").concat(v.y,`
67
- `);if(n>0){var E=Bm({cx:t,cy:r,radius:n,angle:c,sign:d,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),C=E.circleTangency,O=E.lineTangency,D=E.theta,A=Bm({cx:t,cy:r,radius:n,angle:u,sign:-d,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),M=A.circleTangency,I=A.lineTangency,T=A.theta,R=l?Math.abs(c-u):Math.abs(c-u)-D-T;if(R<0&&o===0)return"".concat(w,"L").concat(t,",").concat(r,"Z");w+="L".concat(I.x,",").concat(I.y,`
68
- A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(M.x,",").concat(M.y,`
69
- A`).concat(n,",").concat(n,",0,").concat(+(R>180),",").concat(+(d>0),",").concat(C.x,",").concat(C.y,`
70
- A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(O.x,",").concat(O.y,"Z")}else w+="L".concat(t,",").concat(r,"Z");return w},Ane={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},m1=function(e){var t=L6(L6({},Ane),e),r=t.cx,n=t.cy,a=t.innerRadius,o=t.outerRadius,s=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=t.className;if(o<a||u===d)return null;var p=Lt("recharts-sector",f),h=o-a,g=$n(s,h,0,!0),b;return g>0&&Math.abs(u-d)<360?b=Pne({cx:r,cy:n,innerRadius:a,outerRadius:o,cornerRadius:Math.min(g,h/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):b=cI({cx:r,cy:n,innerRadius:a,outerRadius:o,startAngle:u,endAngle:d}),x.createElement("path",v2({},mt(t,!0),{className:p,d:b,role:"img"}))};function rf(e){"@babel/helpers - typeof";return rf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rf(e)}function k2(){return k2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},k2.apply(this,arguments)}function R6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function F6(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?R6(Object(r),!0).forEach(function(n){Mne(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Mne(e,t,r){return t=Tne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tne(e){var t=_ne(e,"string");return rf(t)=="symbol"?t:t+""}function _ne(e,t){if(rf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(rf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $6={curveBasisClosed:QY,curveBasisOpen:eX,curveBasis:JY,curveBumpX:FY,curveBumpY:$Y,curveLinearClosed:tX,curveLinear:Mg,curveMonotoneX:rX,curveMonotoneY:nX,curveNatural:aX,curveStep:oX,curveStepAfter:iX,curveStepBefore:sX},Hm=function(e){return e.x===+e.x&&e.y===+e.y},Vu=function(e){return e.x},Wu=function(e){return e.y},Ine=function(e,t){if(jt(e))return e;var r="curve".concat(Pg(e));return(r==="curveMonotone"||r==="curveBump")&&t?$6["".concat(r).concat(t==="vertical"?"Y":"X")]:$6[r]||Mg},Dne=function(e){var t=e.type,r=t===void 0?"linear":t,n=e.points,a=n===void 0?[]:n,o=e.baseLine,s=e.layout,l=e.connectNulls,c=l===void 0?!1:l,u=Ine(r,s),d=c?a.filter(function(g){return Hm(g)}):a,f;if(Array.isArray(o)){var p=c?o.filter(function(g){return Hm(g)}):o,h=d.map(function(g,b){return F6(F6({},g),{},{base:p[b]})});return s==="vertical"?f=Tm().y(Wu).x1(Vu).x0(function(g){return g.base.x}):f=Tm().x(Vu).y1(Wu).y0(function(g){return g.base.y}),f.defined(Hm).curve(u),f(h)}return s==="vertical"&&ze(o)?f=Tm().y(Wu).x1(Vu).x0(o):ze(o)?f=Tm().x(Vu).y1(Wu).y0(o):f=cT().x(Vu).y(Wu),f.defined(Hm).curve(u),f(d)},Ys=function(e){var t=e.className,r=e.points,n=e.path,a=e.pathRef;if((!r||!r.length)&&!n)return null;var o=r&&r.length?Dne(e):n;return m.createElement("path",k2({},mt(e,!1),Mp(e),{className:Lt("recharts-curve",t),d:o,ref:a}))},Z0={exports:{}},J0,B6;function Lne(){if(B6)return J0;B6=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return J0=e,J0}var Q0,H6;function Rne(){if(H6)return Q0;H6=1;var e=Lne();function t(){}function r(){}return r.resetWarningCache=t,Q0=function(){function n(s,l,c,u,d,f){if(f!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}n.isRequired=n;function a(){return n}var o={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:a,element:n,elementType:n,instanceOf:a,node:n,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:r,resetWarningCache:t};return o.PropTypes=o,o},Q0}var z6;function Fne(){return z6||(z6=1,Z0.exports=Rne()()),Z0.exports}var $ne=Fne();const ur=mr($ne),{getOwnPropertyNames:Bne,getOwnPropertySymbols:Hne}=Object,{hasOwnProperty:zne}=Object.prototype;function ek(e,t){return function(r,n,a){return e(r,n,a)&&t(r,n,a)}}function zm(e){return function(t,r,n){if(!t||!r||typeof t!="object"||typeof r!="object")return e(t,r,n);const{cache:a}=n,o=a.get(t),s=a.get(r);if(o&&s)return o===r&&s===t;a.set(t,r),a.set(r,t);const l=e(t,r,n);return a.delete(t),a.delete(r),l}}function Une(e){return e?.[Symbol.toStringTag]}function U6(e){return Bne(e).concat(Hne(e))}const qne=Object.hasOwn||((e,t)=>zne.call(e,t));function xl(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const Vne="__v",Wne="__o",Kne="_owner",{getOwnPropertyDescriptor:q6,keys:V6}=Object;function Yne(e,t){return e.byteLength===t.byteLength&&oh(new Uint8Array(e),new Uint8Array(t))}function Xne(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function Gne(e,t){return e.byteLength===t.byteLength&&oh(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Zne(e,t){return xl(e.getTime(),t.getTime())}function Jne(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Qne(e,t){return e===t}function W6(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const a=new Array(n),o=e.entries();let s,l,c=0;for(;(s=o.next())&&!s.done;){const u=t.entries();let d=!1,f=0;for(;(l=u.next())&&!l.done;){if(a[f]){f++;continue}const p=s.value,h=l.value;if(r.equals(p[0],h[0],c,f,e,t,r)&&r.equals(p[1],h[1],p[0],h[0],e,t,r)){d=a[f]=!0;break}f++}if(!d)return!1;c++}return!0}const eae=xl;function tae(e,t,r){const n=V6(e);let a=n.length;if(V6(t).length!==a)return!1;for(;a-- >0;)if(!uI(e,t,r,n[a]))return!1;return!0}function Ku(e,t,r){const n=U6(e);let a=n.length;if(U6(t).length!==a)return!1;let o,s,l;for(;a-- >0;)if(o=n[a],!uI(e,t,r,o)||(s=q6(e,o),l=q6(t,o),(s||l)&&(!s||!l||s.configurable!==l.configurable||s.enumerable!==l.enumerable||s.writable!==l.writable)))return!1;return!0}function rae(e,t){return xl(e.valueOf(),t.valueOf())}function nae(e,t){return e.source===t.source&&e.flags===t.flags}function K6(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const a=new Array(n),o=e.values();let s,l;for(;(s=o.next())&&!s.done;){const c=t.values();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(!a[d]&&r.equals(s.value,l.value,s.value,l.value,e,t,r)){u=a[d]=!0;break}d++}if(!u)return!1}return!0}function oh(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function aae(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function uI(e,t,r,n){return(n===Kne||n===Wne||n===Vne)&&(e.$$typeof||t.$$typeof)?!0:qne(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}const oae="[object ArrayBuffer]",sae="[object Arguments]",iae="[object Boolean]",lae="[object DataView]",cae="[object Date]",uae="[object Error]",dae="[object Map]",fae="[object Number]",mae="[object Object]",pae="[object RegExp]",hae="[object Set]",gae="[object String]",bae={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},yae="[object URL]",xae=Object.prototype.toString;function vae({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:a,areFunctionsEqual:o,areMapsEqual:s,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:d,areSetsEqual:f,areTypedArraysEqual:p,areUrlsEqual:h,unknownTagComparators:g}){return function(b,y,v){if(b===y)return!0;if(b==null||y==null)return!1;const k=typeof b;if(k!==typeof y)return!1;if(k!=="object")return k==="number"?l(b,y,v):k==="function"?o(b,y,v):!1;const N=b.constructor;if(N!==y.constructor)return!1;if(N===Object)return c(b,y,v);if(Array.isArray(b))return t(b,y,v);if(N===Date)return n(b,y,v);if(N===RegExp)return d(b,y,v);if(N===Map)return s(b,y,v);if(N===Set)return f(b,y,v);const w=xae.call(b);if(w===cae)return n(b,y,v);if(w===pae)return d(b,y,v);if(w===dae)return s(b,y,v);if(w===hae)return f(b,y,v);if(w===mae)return typeof b.then!="function"&&typeof y.then!="function"&&c(b,y,v);if(w===yae)return h(b,y,v);if(w===uae)return a(b,y,v);if(w===sae)return c(b,y,v);if(bae[w])return p(b,y,v);if(w===oae)return e(b,y,v);if(w===lae)return r(b,y,v);if(w===iae||w===fae||w===gae)return u(b,y,v);if(g){let E=g[w];if(!E){const C=Une(b);C&&(E=g[C])}if(E)return E(b,y,v)}return!1}}function kae({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:Yne,areArraysEqual:r?Ku:Xne,areDataViewsEqual:Gne,areDatesEqual:Zne,areErrorsEqual:Jne,areFunctionsEqual:Qne,areMapsEqual:r?ek(W6,Ku):W6,areNumbersEqual:eae,areObjectsEqual:r?Ku:tae,arePrimitiveWrappersEqual:rae,areRegExpsEqual:nae,areSetsEqual:r?ek(K6,Ku):K6,areTypedArraysEqual:r?ek(oh,Ku):oh,areUrlsEqual:aae,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){const a=zm(n.areArraysEqual),o=zm(n.areMapsEqual),s=zm(n.areObjectsEqual),l=zm(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:s,areSetsEqual:l})}return n}function wae(e){return function(t,r,n,a,o,s,l){return e(t,r,l)}}function jae({circular:e,comparator:t,createState:r,equals:n,strict:a}){if(r)return function(s,l){const{cache:c=e?new WeakMap:void 0,meta:u}=r();return t(s,l,{cache:c,equals:n,meta:u,strict:a})};if(e)return function(s,l){return t(s,l,{cache:new WeakMap,equals:n,meta:void 0,strict:a})};const o={cache:void 0,equals:n,meta:void 0,strict:a};return function(s,l){return t(s,l,o)}}const Nae=gi();gi({strict:!0});gi({circular:!0});gi({circular:!0,strict:!0});gi({createInternalComparator:()=>xl});gi({strict:!0,createInternalComparator:()=>xl});gi({circular:!0,createInternalComparator:()=>xl});gi({circular:!0,createInternalComparator:()=>xl,strict:!0});function gi(e={}){const{circular:t=!1,createInternalComparator:r,createState:n,strict:a=!1}=e,o=kae(e),s=vae(o),l=r?r(s):wae(s);return jae({circular:t,comparator:s,createState:n,equals:l,strict:a})}function Eae(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function Y6(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function a(o){r<0&&(r=o),o-r>t?(e(o),r=-1):Eae(a)};requestAnimationFrame(n)}function w2(e){"@babel/helpers - typeof";return w2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w2(e)}function Sae(e){return Aae(e)||Pae(e)||Oae(e)||Cae()}function Cae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
71
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Oae(e,t){if(e){if(typeof e=="string")return X6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return X6(e,t)}}function X6(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Pae(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Aae(e){if(Array.isArray(e))return e}function Mae(){var e={},t=function(){return null},r=!1,n=function a(o){if(!r){if(Array.isArray(o)){if(!o.length)return;var s=o,l=Sae(s),c=l[0],u=l.slice(1);if(typeof c=="number"){Y6(a.bind(null,u),c);return}a(c),Y6(a.bind(null,u));return}w2(o)==="object"&&(e=o,t(e)),typeof o=="function"&&o()}};return{stop:function(){r=!0},start:function(a){r=!1,n(a)},subscribe:function(a){return t=a,function(){t=function(){return null}}}}}function nf(e){"@babel/helpers - typeof";return nf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nf(e)}function G6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Z6(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?G6(Object(r),!0).forEach(function(n){dI(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function dI(e,t,r){return t=Tae(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tae(e){var t=_ae(e,"string");return nf(t)==="symbol"?t:String(t)}function _ae(e,t){if(nf(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(nf(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Iae=function(e,t){return[Object.keys(e),Object.keys(t)].reduce(function(r,n){return r.filter(function(a){return n.includes(a)})})},Dae=function(e){return e},Lae=function(e){return e.replace(/([A-Z])/g,function(t){return"-".concat(t.toLowerCase())})},kd=function(e,t){return Object.keys(t).reduce(function(r,n){return Z6(Z6({},r),{},dI({},n,e(n,t[n])))},{})},J6=function(e,t,r){return e.map(function(n){return"".concat(Lae(n)," ").concat(t,"ms ").concat(r)}).join(",")};function Rae(e,t){return Bae(e)||$ae(e,t)||fI(e,t)||Fae()}function Fae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
72
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $ae(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function Bae(e){if(Array.isArray(e))return e}function Hae(e){return qae(e)||Uae(e)||fI(e)||zae()}function zae(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
73
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fI(e,t){if(e){if(typeof e=="string")return j2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j2(e,t)}}function Uae(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function qae(e){if(Array.isArray(e))return j2(e)}function j2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var sh=1e-4,mI=function(e,t){return[0,3*e,3*t-6*e,3*e-3*t+1]},pI=function(e,t){return e.map(function(r,n){return r*Math.pow(t,n)}).reduce(function(r,n){return r+n})},Q6=function(e,t){return function(r){var n=mI(e,t);return pI(n,r)}},Vae=function(e,t){return function(r){var n=mI(e,t),a=[].concat(Hae(n.map(function(o,s){return o*s}).slice(1)),[0]);return pI(a,r)}},eP=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t[0],a=t[1],o=t[2],s=t[3];if(t.length===1)switch(t[0]){case"linear":n=0,a=0,o=1,s=1;break;case"ease":n=.25,a=.1,o=.25,s=1;break;case"ease-in":n=.42,a=0,o=1,s=1;break;case"ease-out":n=.42,a=0,o=.58,s=1;break;case"ease-in-out":n=0,a=0,o=.58,s=1;break;default:{var l=t[0].split("(");if(l[0]==="cubic-bezier"&&l[1].split(")")[0].split(",").length===4){var c=l[1].split(")")[0].split(",").map(function(b){return parseFloat(b)}),u=Rae(c,4);n=u[0],a=u[1],o=u[2],s=u[3]}}}var d=Q6(n,o),f=Q6(a,s),p=Vae(n,o),h=function(b){return b>1?1:b<0?0:b},g=function(b){for(var y=b>1?1:b,v=y,k=0;k<8;++k){var N=d(v)-y,w=p(v);if(Math.abs(N-y)<sh||w<sh)return f(v);v=h(v-N/w)}return f(v)};return g.isStepper=!1,g},Wae=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,r=t===void 0?100:t,n=e.damping,a=n===void 0?8:n,o=e.dt,s=o===void 0?17:o,l=function(c,u,d){var f=-(c-u)*r,p=d*a,h=d+(f-p)*s/1e3,g=d*s/1e3+c;return Math.abs(g-u)<sh&&Math.abs(h)<sh?[u,0]:[g,h]};return l.isStepper=!0,l.dt=s,l},Kae=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t[0];if(typeof n=="string")switch(n){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return eP(n);case"spring":return Wae();default:if(n.split("(")[0]==="cubic-bezier")return eP(n)}return typeof n=="function"?n:null};function af(e){"@babel/helpers - typeof";return af=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},af(e)}function tP(e){return Gae(e)||Xae(e)||hI(e)||Yae()}function Yae(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
74
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xae(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Gae(e){if(Array.isArray(e))return E2(e)}function rP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Sn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?rP(Object(r),!0).forEach(function(n){N2(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function N2(e,t,r){return t=Zae(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zae(e){var t=Jae(e,"string");return af(t)==="symbol"?t:String(t)}function Jae(e,t){if(af(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(af(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qae(e,t){return roe(e)||toe(e,t)||hI(e,t)||eoe()}function eoe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
75
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hI(e,t){if(e){if(typeof e=="string")return E2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E2(e,t)}}function E2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function toe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function roe(e){if(Array.isArray(e))return e}var ih=function(e,t,r){return e+(t-e)*r},S2=function(e){var t=e.from,r=e.to;return t!==r},noe=function e(t,r,n){var a=kd(function(o,s){if(S2(s)){var l=t(s.from,s.to,s.velocity),c=Qae(l,2),u=c[0],d=c[1];return Sn(Sn({},s),{},{from:u,velocity:d})}return s},r);return n<1?kd(function(o,s){return S2(s)?Sn(Sn({},s),{},{velocity:ih(s.velocity,a[o].velocity,n),from:ih(s.from,a[o].from,n)}):s},r):e(t,a,n-1)};const aoe=function(e,t,r,n,a){var o=Iae(e,t),s=o.reduce(function(y,v){return Sn(Sn({},y),{},N2({},v,[e[v],t[v]]))},{}),l=o.reduce(function(y,v){return Sn(Sn({},y),{},N2({},v,{from:e[v],velocity:0,to:t[v]}))},{}),c=-1,u,d,f=function(){return null},p=function(){return kd(function(y,v){return v.from},l)},h=function(){return!Object.values(l).filter(S2).length},g=function(y){u||(u=y);var v=y-u,k=v/r.dt;l=noe(r,l,k),a(Sn(Sn(Sn({},e),t),p())),u=y,h()||(c=requestAnimationFrame(f))},b=function(y){d||(d=y);var v=(y-d)/n,k=kd(function(w,E){return ih.apply(void 0,tP(E).concat([r(v)]))},s);if(a(Sn(Sn(Sn({},e),t),k)),v<1)c=requestAnimationFrame(f);else{var N=kd(function(w,E){return ih.apply(void 0,tP(E).concat([r(1)]))},s);a(Sn(Sn(Sn({},e),t),N))}};return f=r.isStepper?g:b,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(c)}}};function Ac(e){"@babel/helpers - typeof";return Ac=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ac(e)}var ooe=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function soe(e,t){if(e==null)return{};var r=ioe(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function ioe(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,o;for(o=0;o<n.length;o++)a=n[o],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}function tk(e){return doe(e)||uoe(e)||coe(e)||loe()}function loe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
76
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function coe(e,t){if(e){if(typeof e=="string")return C2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return C2(e,t)}}function uoe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function doe(e){if(Array.isArray(e))return C2(e)}function C2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function nP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Fa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nP(Object(r),!0).forEach(function(n){fd(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fd(e,t,r){return t=gI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function foe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function moe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,gI(n.key),n)}}function poe(e,t,r){return t&&moe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function gI(e){var t=hoe(e,"string");return Ac(t)==="symbol"?t:String(t)}function hoe(e,t){if(Ac(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ac(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function goe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O2(e,t)}function O2(e,t){return O2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},O2(e,t)}function boe(e){var t=yoe();return function(){var r=lh(e),n;if(t){var a=lh(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return P2(this,n)}}function P2(e,t){if(t&&(Ac(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return A2(e)}function A2(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yoe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function lh(e){return lh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lh(e)}var Ta=function(e){goe(r,e);var t=boe(r);function r(n,a){var o;foe(this,r),o=t.call(this,n,a);var s=o.props,l=s.isActive,c=s.attributeName,u=s.from,d=s.to,f=s.steps,p=s.children,h=s.duration;if(o.handleStyleChange=o.handleStyleChange.bind(A2(o)),o.changeStyle=o.changeStyle.bind(A2(o)),!l||h<=0)return o.state={style:{}},typeof p=="function"&&(o.state={style:d}),P2(o);if(f&&f.length)o.state={style:f[0].style};else if(u){if(typeof p=="function")return o.state={style:u},P2(o);o.state={style:c?fd({},c,u):u}}else o.state={style:{}};return o}return poe(r,[{key:"componentDidMount",value:function(){var n=this.props,a=n.isActive,o=n.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(n){var a=this.props,o=a.isActive,s=a.canBegin,l=a.attributeName,c=a.shouldReAnimate,u=a.to,d=a.from,f=this.state.style;if(s){if(!o){var p={style:l?fd({},l,u):u};this.state&&f&&(l&&f[l]!==u||!l&&f!==u)&&this.setState(p);return}if(!(Nae(n.to,u)&&n.canBegin&&n.isActive)){var h=!n.canBegin||!n.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var g=h||c?d:n.to;if(this.state&&f){var b={style:l?fd({},l,g):g};(l&&f[l]!==g||!l&&f!==g)&&this.setState(b)}this.runAnimation(Fa(Fa({},this.props),{},{from:g,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var n=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),n&&n()}},{key:"handleStyleChange",value:function(n){this.changeStyle(n)}},{key:"changeStyle",value:function(n){this.mounted&&this.setState({style:n})}},{key:"runJSAnimation",value:function(n){var a=this,o=n.from,s=n.to,l=n.duration,c=n.easing,u=n.begin,d=n.onAnimationEnd,f=n.onAnimationStart,p=aoe(o,s,Kae(c),l,this.changeStyle),h=function(){a.stopJSAnimation=p()};this.manager.start([f,u,h,l,d])}},{key:"runStepAnimation",value:function(n){var a=this,o=n.steps,s=n.begin,l=n.onAnimationStart,c=o[0],u=c.style,d=c.duration,f=d===void 0?0:d,p=function(h,g,b){if(b===0)return h;var y=g.duration,v=g.easing,k=v===void 0?"ease":v,N=g.style,w=g.properties,E=g.onAnimationEnd,C=b>0?o[b-1]:g,O=w||Object.keys(N);if(typeof k=="function"||k==="spring")return[].concat(tk(h),[a.runJSAnimation.bind(a,{from:C.style,to:N,duration:y,easing:k}),y]);var D=J6(O,y,k),A=Fa(Fa(Fa({},C.style),N),{},{transition:D});return[].concat(tk(h),[A,y,E]).filter(Dae)};return this.manager.start([l].concat(tk(o.reduce(p,[u,Math.max(f,s)])),[n.onAnimationEnd]))}},{key:"runAnimation",value:function(n){this.manager||(this.manager=Mae());var a=n.begin,o=n.duration,s=n.attributeName,l=n.to,c=n.easing,u=n.onAnimationStart,d=n.onAnimationEnd,f=n.steps,p=n.children,h=this.manager;if(this.unSubscribe=h.subscribe(this.handleStyleChange),typeof c=="function"||typeof p=="function"||c==="spring"){this.runJSAnimation(n);return}if(f.length>1){this.runStepAnimation(n);return}var g=s?fd({},s,l):l,b=J6(Object.keys(g),o,c);h.start([u,a,Fa(Fa({},g),{},{transition:b}),o,d])}},{key:"render",value:function(){var n=this.props,a=n.children;n.begin;var o=n.duration;n.attributeName,n.easing;var s=n.isActive;n.steps,n.from,n.to,n.canBegin,n.onAnimationEnd,n.shouldReAnimate,n.onAnimationReStart;var l=soe(n,ooe),c=m.Children.count(a),u=this.state.style;if(typeof a=="function")return a(u);if(!s||c===0||o<=0)return a;var d=function(f){var p=f.props,h=p.style,g=h===void 0?{}:h,b=p.className,y=m.cloneElement(f,Fa(Fa({},l),{},{style:Fa(Fa({},g),u),className:b}));return y};return c===1?d(m.Children.only(a)):x.createElement("div",null,m.Children.map(a,function(f){return d(f)}))}}]),r}(m.PureComponent);Ta.displayName="Animate";Ta.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Ta.propTypes={from:ur.oneOfType([ur.object,ur.string]),to:ur.oneOfType([ur.object,ur.string]),attributeName:ur.string,duration:ur.number,begin:ur.number,easing:ur.oneOfType([ur.string,ur.func]),steps:ur.arrayOf(ur.shape({duration:ur.number.isRequired,style:ur.object.isRequired,easing:ur.oneOfType([ur.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),ur.func]),properties:ur.arrayOf("string"),onAnimationEnd:ur.func})),children:ur.oneOfType([ur.node,ur.func]),isActive:ur.bool,canBegin:ur.bool,onAnimationEnd:ur.func,shouldReAnimate:ur.bool,onAnimationStart:ur.func,onAnimationReStart:ur.func};function of(e){"@babel/helpers - typeof";return of=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},of(e)}function ch(){return ch=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ch.apply(this,arguments)}function xoe(e,t){return joe(e)||woe(e,t)||koe(e,t)||voe()}function voe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
77
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function koe(e,t){if(e){if(typeof e=="string")return aP(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return aP(e,t)}}function aP(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function woe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function joe(e){if(Array.isArray(e))return e}function oP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function sP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oP(Object(r),!0).forEach(function(n){Noe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Noe(e,t,r){return t=Eoe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Eoe(e){var t=Soe(e,"string");return of(t)=="symbol"?t:t+""}function Soe(e,t){if(of(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(of(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iP=function(e,t,r,n,a){var o=Math.min(Math.abs(r)/2,Math.abs(n)/2),s=n>=0?1:-1,l=r>=0?1:-1,c=n>=0&&r>=0||n<0&&r<0?1:0,u;if(o>0&&a instanceof Array){for(var d=[0,0,0,0],f=0,p=4;f<p;f++)d[f]=a[f]>o?o:a[f];u="M".concat(e,",").concat(t+s*d[0]),d[0]>0&&(u+="A ".concat(d[0],",").concat(d[0],",0,0,").concat(c,",").concat(e+l*d[0],",").concat(t)),u+="L ".concat(e+r-l*d[1],",").concat(t),d[1]>0&&(u+="A ".concat(d[1],",").concat(d[1],",0,0,").concat(c,`,
78
- `).concat(e+r,",").concat(t+s*d[1])),u+="L ".concat(e+r,",").concat(t+n-s*d[2]),d[2]>0&&(u+="A ".concat(d[2],",").concat(d[2],",0,0,").concat(c,`,
79
- `).concat(e+r-l*d[2],",").concat(t+n)),u+="L ".concat(e+l*d[3],",").concat(t+n),d[3]>0&&(u+="A ".concat(d[3],",").concat(d[3],",0,0,").concat(c,`,
80
- `).concat(e,",").concat(t+n-s*d[3])),u+="Z"}else if(o>0&&a===+a&&a>0){var h=Math.min(o,a);u="M ".concat(e,",").concat(t+s*h,`
81
- A `).concat(h,",").concat(h,",0,0,").concat(c,",").concat(e+l*h,",").concat(t,`
82
- L `).concat(e+r-l*h,",").concat(t,`
83
- A `).concat(h,",").concat(h,",0,0,").concat(c,",").concat(e+r,",").concat(t+s*h,`
84
- L `).concat(e+r,",").concat(t+n-s*h,`
85
- A `).concat(h,",").concat(h,",0,0,").concat(c,",").concat(e+r-l*h,",").concat(t+n,`
86
- L `).concat(e+l*h,",").concat(t+n,`
87
- A `).concat(h,",").concat(h,",0,0,").concat(c,",").concat(e,",").concat(t+n-s*h," Z")}else u="M ".concat(e,",").concat(t," h ").concat(r," v ").concat(n," h ").concat(-r," Z");return u},Coe=function(e,t){if(!e||!t)return!1;var r=e.x,n=e.y,a=t.x,o=t.y,s=t.width,l=t.height;if(Math.abs(s)>0&&Math.abs(l)>0){var c=Math.min(a,a+s),u=Math.max(a,a+s),d=Math.min(o,o+l),f=Math.max(o,o+l);return r>=c&&r<=u&&n>=d&&n<=f}return!1},Ooe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},p1=function(e){var t=sP(sP({},Ooe),e),r=m.useRef(),n=m.useState(-1),a=xoe(n,2),o=a[0],s=a[1];m.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var N=r.current.getTotalLength();N&&s(N)}catch{}},[]);var l=t.x,c=t.y,u=t.width,d=t.height,f=t.radius,p=t.className,h=t.animationEasing,g=t.animationDuration,b=t.animationBegin,y=t.isAnimationActive,v=t.isUpdateAnimationActive;if(l!==+l||c!==+c||u!==+u||d!==+d||u===0||d===0)return null;var k=Lt("recharts-rectangle",p);return v?x.createElement(Ta,{canBegin:o>0,from:{width:u,height:d,x:l,y:c},to:{width:u,height:d,x:l,y:c},duration:g,animationEasing:h,isActive:v},function(N){var w=N.width,E=N.height,C=N.x,O=N.y;return x.createElement(Ta,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:g,isActive:y,easing:h},x.createElement("path",ch({},mt(t,!0),{className:k,d:iP(C,O,w,E,f),ref:r})))}):x.createElement("path",ch({},mt(t,!0),{className:k,d:iP(l,c,u,d,f)}))},Poe=["points","className","baseLinePoints","connectNulls"];function Wl(){return Wl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wl.apply(this,arguments)}function Aoe(e,t){if(e==null)return{};var r=Moe(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Moe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function lP(e){return Doe(e)||Ioe(e)||_oe(e)||Toe()}function Toe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
88
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _oe(e,t){if(e){if(typeof e=="string")return M2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return M2(e,t)}}function Ioe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Doe(e){if(Array.isArray(e))return M2(e)}function M2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var cP=function(e){return e&&e.x===+e.x&&e.y===+e.y},Loe=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=[[]];return e.forEach(function(r){cP(r)?t[t.length-1].push(r):t[t.length-1].length>0&&t.push([])}),cP(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},wd=function(e,t){var r=Loe(e);t&&(r=[r.reduce(function(a,o){return[].concat(lP(a),lP(o))},[])]);var n=r.map(function(a){return a.reduce(function(o,s,l){return"".concat(o).concat(l===0?"M":"L").concat(s.x,",").concat(s.y)},"")}).join("");return r.length===1?"".concat(n,"Z"):n},Roe=function(e,t,r){var n=wd(e,r);return"".concat(n.slice(-1)==="Z"?n.slice(0,-1):n,"L").concat(wd(t.reverse(),r).slice(1))},Foe=function(e){var t=e.points,r=e.className,n=e.baseLinePoints,a=e.connectNulls,o=Aoe(e,Poe);if(!t||!t.length)return null;var s=Lt("recharts-polygon",r);if(n&&n.length){var l=o.stroke&&o.stroke!=="none",c=Roe(t,n,a);return x.createElement("g",{className:s},x.createElement("path",Wl({},mt(o,!0),{fill:c.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:c})),l?x.createElement("path",Wl({},mt(o,!0),{fill:"none",d:wd(t,a)})):null,l?x.createElement("path",Wl({},mt(o,!0),{fill:"none",d:wd(n,a)})):null)}var u=wd(t,a);return x.createElement("path",Wl({},mt(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",className:s,d:u}))};function T2(){return T2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},T2.apply(this,arguments)}var No=function(e){var t=e.cx,r=e.cy,n=e.r,a=e.className,o=Lt("recharts-dot",a);return t===+t&&r===+r&&n===+n?m.createElement("circle",T2({},mt(e,!1),Mp(e),{className:o,cx:t,cy:r,r:n})):null};function sf(e){"@babel/helpers - typeof";return sf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sf(e)}var $oe=["x","y","top","left","width","height","className"];function _2(){return _2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_2.apply(this,arguments)}function uP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Boe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uP(Object(r),!0).forEach(function(n){Hoe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Hoe(e,t,r){return t=zoe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zoe(e){var t=Uoe(e,"string");return sf(t)=="symbol"?t:t+""}function Uoe(e,t){if(sf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(sf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qoe(e,t){if(e==null)return{};var r=Voe(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Voe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Woe=function(e,t,r,n,a,o){return"M".concat(e,",").concat(a,"v").concat(n,"M").concat(o,",").concat(t,"h").concat(r)},Koe=function(e){var t=e.x,r=t===void 0?0:t,n=e.y,a=n===void 0?0:n,o=e.top,s=o===void 0?0:o,l=e.left,c=l===void 0?0:l,u=e.width,d=u===void 0?0:u,f=e.height,p=f===void 0?0:f,h=e.className,g=qoe(e,$oe),b=Boe({x:r,y:a,top:s,left:c,width:d,height:p},g);return!ze(r)||!ze(a)||!ze(d)||!ze(p)||!ze(s)||!ze(c)?null:x.createElement("path",_2({},mt(b,!0),{className:Lt("recharts-cross",h),d:Woe(r,a,d,p,s,c)}))},rk,dP;function Yoe(){if(dP)return rk;dP=1;var e=qg(),t=T_(),r=To();function n(a,o){return a&&a.length?e(a,r(o,2),t):void 0}return rk=n,rk}var Xoe=Yoe();const Goe=mr(Xoe);var nk,fP;function Zoe(){if(fP)return nk;fP=1;var e=qg(),t=To(),r=__();function n(a,o){return a&&a.length?e(a,t(o,2),r):void 0}return nk=n,nk}var Joe=Zoe();const Qoe=mr(Joe);var ese=["cx","cy","angle","ticks","axisLine"],tse=["ticks","tick","angle","tickFormatter","stroke"];function Mc(e){"@babel/helpers - typeof";return Mc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mc(e)}function jd(){return jd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jd.apply(this,arguments)}function mP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ci(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?mP(Object(r),!0).forEach(function(n){Yg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function pP(e,t){if(e==null)return{};var r=rse(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function rse(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function nse(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,yI(n.key),n)}}function ase(e,t,r){return t&&hP(e.prototype,t),r&&hP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ose(e,t,r){return t=uh(t),sse(e,bI()?Reflect.construct(t,r||[],uh(e).constructor):t.apply(e,r))}function sse(e,t){if(t&&(Mc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ise(e)}function ise(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bI=function(){return!!e})()}function uh(e){return uh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uh(e)}function lse(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&I2(e,t)}function I2(e,t){return I2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},I2(e,t)}function Yg(e,t,r){return t=yI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yI(e){var t=cse(e,"string");return Mc(t)=="symbol"?t:t+""}function cse(e,t){if(Mc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Mc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Xg=function(e){function t(){return nse(this,t),ose(this,t,arguments)}return lse(t,e),ase(t,[{key:"getTickValueCoord",value:function(r){var n=r.coordinate,a=this.props,o=a.angle,s=a.cx,l=a.cy;return _r(s,l,n,o)}},{key:"getTickTextAnchor",value:function(){var r=this.props.orientation,n;switch(r){case"left":n="end";break;case"right":n="start";break;default:n="middle";break}return n}},{key:"getViewBox",value:function(){var r=this.props,n=r.cx,a=r.cy,o=r.angle,s=r.ticks,l=Goe(s,function(u){return u.coordinate||0}),c=Qoe(s,function(u){return u.coordinate||0});return{cx:n,cy:a,startAngle:o,endAngle:o,innerRadius:c.coordinate||0,outerRadius:l.coordinate||0}}},{key:"renderAxisLine",value:function(){var r=this.props,n=r.cx,a=r.cy,o=r.angle,s=r.ticks,l=r.axisLine,c=pP(r,ese),u=s.reduce(function(h,g){return[Math.min(h[0],g.coordinate),Math.max(h[1],g.coordinate)]},[1/0,-1/0]),d=_r(n,a,u[0],o),f=_r(n,a,u[1],o),p=Ci(Ci(Ci({},mt(c,!1)),{},{fill:"none"},mt(l,!1)),{},{x1:d.x,y1:d.y,x2:f.x,y2:f.y});return x.createElement("line",jd({className:"recharts-polar-radius-axis-line"},p))}},{key:"renderTicks",value:function(){var r=this,n=this.props,a=n.ticks,o=n.tick,s=n.angle,l=n.tickFormatter,c=n.stroke,u=pP(n,tse),d=this.getTickTextAnchor(),f=mt(u,!1),p=mt(o,!1),h=a.map(function(g,b){var y=r.getTickValueCoord(g),v=Ci(Ci(Ci(Ci({textAnchor:d,transform:"rotate(".concat(90-s,", ").concat(y.x,", ").concat(y.y,")")},f),{},{stroke:"none",fill:c},p),{},{index:b},y),{},{payload:g});return x.createElement(Rt,jd({className:Lt("recharts-polar-radius-axis-tick",iI(o)),key:"tick-".concat(g.coordinate)},ti(r.props,g,b)),t.renderTickItem(o,v,l?l(g.value,b):g.value))});return x.createElement(Rt,{className:"recharts-polar-radius-axis-ticks"},h)}},{key:"render",value:function(){var r=this.props,n=r.ticks,a=r.axisLine,o=r.tick;return!n||!n.length?null:x.createElement(Rt,{className:Lt("recharts-polar-radius-axis",this.props.className)},a&&this.renderAxisLine(),o&&this.renderTicks(),Nr.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(r,n,a){var o;return x.isValidElement(r)?o=x.cloneElement(r,n):jt(r)?o=r(n):o=x.createElement(ll,jd({},n,{className:"recharts-polar-radius-axis-tick-value"}),a),o}}])}(m.PureComponent);Yg(Xg,"displayName","PolarRadiusAxis");Yg(Xg,"axisType","radiusAxis");Yg(Xg,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function Tc(e){"@babel/helpers - typeof";return Tc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tc(e)}function Ri(){return Ri=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ri.apply(this,arguments)}function gP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Oi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gP(Object(r),!0).forEach(function(n){Gg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function use(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,vI(n.key),n)}}function dse(e,t,r){return t&&bP(e.prototype,t),r&&bP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function fse(e,t,r){return t=dh(t),mse(e,xI()?Reflect.construct(t,r||[],dh(e).constructor):t.apply(e,r))}function mse(e,t){if(t&&(Tc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pse(e)}function pse(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xI=function(){return!!e})()}function dh(e){return dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dh(e)}function hse(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&D2(e,t)}function D2(e,t){return D2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},D2(e,t)}function Gg(e,t,r){return t=vI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vI(e){var t=gse(e,"string");return Tc(t)=="symbol"?t:t+""}function gse(e,t){if(Tc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Tc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var bse=Math.PI/180,yse=1e-5,Zg=function(e){function t(){return use(this,t),fse(this,t,arguments)}return hse(t,e),dse(t,[{key:"getTickLineCoord",value:function(r){var n=this.props,a=n.cx,o=n.cy,s=n.radius,l=n.orientation,c=n.tickSize,u=c||8,d=_r(a,o,s,r.coordinate),f=_r(a,o,s+(l==="inner"?-1:1)*u,r.coordinate);return{x1:d.x,y1:d.y,x2:f.x,y2:f.y}}},{key:"getTickTextAnchor",value:function(r){var n=this.props.orientation,a=Math.cos(-r.coordinate*bse),o;return a>yse?o=n==="outer"?"start":"end":a<-1e-5?o=n==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,n=r.cx,a=r.cy,o=r.radius,s=r.axisLine,l=r.axisLineType,c=Oi(Oi({},mt(this.props,!1)),{},{fill:"none"},mt(s,!1));if(l==="circle")return x.createElement(No,Ri({className:"recharts-polar-angle-axis-line"},c,{cx:n,cy:a,r:o}));var u=this.props.ticks,d=u.map(function(f){return _r(n,a,o,f.coordinate)});return x.createElement(Foe,Ri({className:"recharts-polar-angle-axis-line"},c,{points:d}))}},{key:"renderTicks",value:function(){var r=this,n=this.props,a=n.ticks,o=n.tick,s=n.tickLine,l=n.tickFormatter,c=n.stroke,u=mt(this.props,!1),d=mt(o,!1),f=Oi(Oi({},u),{},{fill:"none"},mt(s,!1)),p=a.map(function(h,g){var b=r.getTickLineCoord(h),y=r.getTickTextAnchor(h),v=Oi(Oi(Oi({textAnchor:y},u),{},{stroke:"none",fill:c},d),{},{index:g,payload:h,x:b.x2,y:b.y2});return x.createElement(Rt,Ri({className:Lt("recharts-polar-angle-axis-tick",iI(o)),key:"tick-".concat(h.coordinate)},ti(r.props,h,g)),s&&x.createElement("line",Ri({className:"recharts-polar-angle-axis-tick-line"},f,b)),o&&t.renderTickItem(o,v,l?l(h.value,g):h.value))});return x.createElement(Rt,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,n=r.ticks,a=r.radius,o=r.axisLine;return a<=0||!n||!n.length?null:x.createElement(Rt,{className:Lt("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,n,a){var o;return x.isValidElement(r)?o=x.cloneElement(r,n):jt(r)?o=r(n):o=x.createElement(ll,Ri({},n,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])}(m.PureComponent);Gg(Zg,"displayName","PolarAngleAxis");Gg(Zg,"axisType","angleAxis");Gg(Zg,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var ak,yP;function xse(){if(yP)return ak;yP=1;var e=TT(),t=e(Object.getPrototypeOf,Object);return ak=t,ak}var ok,xP;function vse(){if(xP)return ok;xP=1;var e=ms(),t=xse(),r=ps(),n="[object Object]",a=Function.prototype,o=Object.prototype,s=a.toString,l=o.hasOwnProperty,c=s.call(Object);function u(d){if(!r(d)||e(d)!=n)return!1;var f=t(d);if(f===null)return!0;var p=l.call(f,"constructor")&&f.constructor;return typeof p=="function"&&p instanceof p&&s.call(p)==c}return ok=u,ok}var kse=vse();const wse=mr(kse);var sk,vP;function jse(){if(vP)return sk;vP=1;var e=ms(),t=ps(),r="[object Boolean]";function n(a){return a===!0||a===!1||t(a)&&e(a)==r}return sk=n,sk}var Nse=jse();const Ese=mr(Nse);function lf(e){"@babel/helpers - typeof";return lf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lf(e)}function fh(){return fh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fh.apply(this,arguments)}function Sse(e,t){return Ase(e)||Pse(e,t)||Ose(e,t)||Cse()}function Cse(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
89
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ose(e,t){if(e){if(typeof e=="string")return kP(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kP(e,t)}}function kP(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Pse(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function Ase(e){if(Array.isArray(e))return e}function wP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function jP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wP(Object(r),!0).forEach(function(n){Mse(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Mse(e,t,r){return t=Tse(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tse(e){var t=_se(e,"string");return lf(t)=="symbol"?t:t+""}function _se(e,t){if(lf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(lf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var NP=function(e,t,r,n,a){var o=r-n,s;return s="M ".concat(e,",").concat(t),s+="L ".concat(e+r,",").concat(t),s+="L ".concat(e+r-o/2,",").concat(t+a),s+="L ".concat(e+r-o/2-n,",").concat(t+a),s+="L ".concat(e,",").concat(t," Z"),s},Ise={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Dse=function(e){var t=jP(jP({},Ise),e),r=m.useRef(),n=m.useState(-1),a=Sse(n,2),o=a[0],s=a[1];m.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var k=r.current.getTotalLength();k&&s(k)}catch{}},[]);var l=t.x,c=t.y,u=t.upperWidth,d=t.lowerWidth,f=t.height,p=t.className,h=t.animationEasing,g=t.animationDuration,b=t.animationBegin,y=t.isUpdateAnimationActive;if(l!==+l||c!==+c||u!==+u||d!==+d||f!==+f||u===0&&d===0||f===0)return null;var v=Lt("recharts-trapezoid",p);return y?x.createElement(Ta,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:f,x:l,y:c},to:{upperWidth:u,lowerWidth:d,height:f,x:l,y:c},duration:g,animationEasing:h,isActive:y},function(k){var N=k.upperWidth,w=k.lowerWidth,E=k.height,C=k.x,O=k.y;return x.createElement(Ta,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:g,easing:h},x.createElement("path",fh({},mt(t,!0),{className:v,d:NP(C,O,N,w,E),ref:r})))}):x.createElement("g",null,x.createElement("path",fh({},mt(t,!0),{className:v,d:NP(l,c,u,d,f)})))},Lse=["option","shapeType","propTransformer","activeClassName","isActive"];function cf(e){"@babel/helpers - typeof";return cf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cf(e)}function Rse(e,t){if(e==null)return{};var r=Fse(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Fse(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function EP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function mh(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?EP(Object(r),!0).forEach(function(n){$se(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $se(e,t,r){return t=Bse(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bse(e){var t=Hse(e,"string");return cf(t)=="symbol"?t:t+""}function Hse(e,t){if(cf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(cf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zse(e,t){return mh(mh({},t),e)}function Use(e,t){return e==="symbols"}function SP(e){var t=e.shapeType,r=e.elementProps;switch(t){case"rectangle":return x.createElement(p1,r);case"trapezoid":return x.createElement(Dse,r);case"sector":return x.createElement(m1,r);case"symbols":if(Use(t))return x.createElement(_g,r);break;default:return null}}function qse(e){return m.isValidElement(e)?e.props:e}function ph(e){var t=e.option,r=e.shapeType,n=e.propTransformer,a=n===void 0?zse:n,o=e.activeClassName,s=o===void 0?"recharts-active-shape":o,l=e.isActive,c=Rse(e,Lse),u;if(m.isValidElement(t))u=m.cloneElement(t,mh(mh({},c),qse(t)));else if(jt(t))u=t(c);else if(wse(t)&&!Ese(t)){var d=a(t,c);u=x.createElement(SP,{shapeType:r,elementProps:d})}else{var f=c;u=x.createElement(SP,{shapeType:r,elementProps:f})}return l?x.createElement(Rt,{className:s},u):u}function Jg(e,t){return t!=null&&"trapezoids"in e.props}function Qg(e,t){return t!=null&&"sectors"in e.props}function uf(e,t){return t!=null&&"points"in e.props}function Vse(e,t){var r,n,a=e.x===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.x)||e.x===t.x,o=e.y===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.y)||e.y===t.y;return a&&o}function Wse(e,t){var r=e.endAngle===t.endAngle,n=e.startAngle===t.startAngle;return r&&n}function Kse(e,t){var r=e.x===t.x,n=e.y===t.y,a=e.z===t.z;return r&&n&&a}function Yse(e,t){var r;return Jg(e,t)?r=Vse:Qg(e,t)?r=Wse:uf(e,t)&&(r=Kse),r}function Xse(e,t){var r;return Jg(e,t)?r="trapezoids":Qg(e,t)?r="sectors":uf(e,t)&&(r="points"),r}function Gse(e,t){if(Jg(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(Qg(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return uf(e,t)?t.payload:{}}function Zse(e){var t=e.activeTooltipItem,r=e.graphicalItem,n=e.itemData,a=Xse(r,t),o=Gse(r,t),s=n.filter(function(c,u){var d=ri(o,c),f=r.props[a].filter(function(g){var b=Yse(r,t);return b(g,t)}),p=r.props[a].indexOf(f[f.length-1]),h=u===p;return d&&h}),l=n.indexOf(s[s.length-1]);return l}var cp;function _c(e){"@babel/helpers - typeof";return _c=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_c(e)}function Kl(){return Kl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kl.apply(this,arguments)}function CP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Mr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?CP(Object(r),!0).forEach(function(n){Oa(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Jse(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function OP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,wI(n.key),n)}}function Qse(e,t,r){return t&&OP(e.prototype,t),r&&OP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function eie(e,t,r){return t=hh(t),tie(e,kI()?Reflect.construct(t,r||[],hh(e).constructor):t.apply(e,r))}function tie(e,t){if(t&&(_c(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rie(e)}function rie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kI=function(){return!!e})()}function hh(e){return hh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hh(e)}function nie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&L2(e,t)}function L2(e,t){return L2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},L2(e,t)}function Oa(e,t,r){return t=wI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wI(e){var t=aie(e,"string");return _c(t)=="symbol"?t:t+""}function aie(e,t){if(_c(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(_c(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var bs=function(e){function t(r){var n;return Jse(this,t),n=eie(this,t,[r]),Oa(n,"pieRef",null),Oa(n,"sectorRefs",[]),Oa(n,"id",fi("recharts-pie-")),Oa(n,"handleAnimationEnd",function(){var a=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),jt(a)&&a()}),Oa(n,"handleAnimationStart",function(){var a=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),jt(a)&&a()}),n.state={isAnimationFinished:!r.isAnimationActive,prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,sectorToFocus:0},n}return nie(t,e),Qse(t,[{key:"isActiveIndex",value:function(r){var n=this.props.activeIndex;return Array.isArray(n)?n.indexOf(r)!==-1:r===n}},{key:"hasActiveIndex",value:function(){var r=this.props.activeIndex;return Array.isArray(r)?r.length!==0:r||r===0}},{key:"renderLabels",value:function(r){var n=this.props.isAnimationActive;if(n&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.label,s=a.labelLine,l=a.dataKey,c=a.valueKey,u=mt(this.props,!1),d=mt(o,!1),f=mt(s,!1),p=o&&o.offsetRadius||20,h=r.map(function(g,b){var y=(g.startAngle+g.endAngle)/2,v=_r(g.cx,g.cy,g.outerRadius+p,y),k=Mr(Mr(Mr(Mr({},u),g),{},{stroke:"none"},d),{},{index:b,textAnchor:t.getTextAnchor(v.x,g.cx)},v),N=Mr(Mr(Mr(Mr({},u),g),{},{fill:"none",stroke:g.fill},f),{},{index:b,points:[_r(g.cx,g.cy,g.outerRadius,y),v]}),w=l;return vt(l)&&vt(c)?w="value":vt(l)&&(w=c),x.createElement(Rt,{key:"label-".concat(g.startAngle,"-").concat(g.endAngle,"-").concat(g.midAngle,"-").concat(b)},s&&t.renderLabelLineItem(s,N,"line"),t.renderLabelItem(o,k,Hr(g,w)))});return x.createElement(Rt,{className:"recharts-pie-labels"},h)}},{key:"renderSectorsStatically",value:function(r){var n=this,a=this.props,o=a.activeShape,s=a.blendStroke,l=a.inactiveShape;return r.map(function(c,u){if(c?.startAngle===0&&c?.endAngle===0&&r.length!==1)return null;var d=n.isActiveIndex(u),f=l&&n.hasActiveIndex()?l:null,p=d?o:f,h=Mr(Mr({},c),{},{stroke:s?c.fill:c.stroke,tabIndex:-1});return x.createElement(Rt,Kl({ref:function(g){g&&!n.sectorRefs.includes(g)&&n.sectorRefs.push(g)},tabIndex:-1,className:"recharts-pie-sector"},ti(n.props,c,u),{key:"sector-".concat(c?.startAngle,"-").concat(c?.endAngle,"-").concat(c.midAngle,"-").concat(u)}),x.createElement(ph,Kl({option:p,isActive:d,shapeType:"sector"},h)))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,n=this.props,a=n.sectors,o=n.isAnimationActive,s=n.animationBegin,l=n.animationDuration,c=n.animationEasing,u=n.animationId,d=this.state,f=d.prevSectors,p=d.prevIsAnimationActive;return x.createElement(Ta,{begin:s,duration:l,isActive:o,easing:c,from:{t:0},to:{t:1},key:"pie-".concat(u,"-").concat(p),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(h){var g=h.t,b=[],y=a&&a[0],v=y.startAngle;return a.forEach(function(k,N){var w=f&&f[N],E=N>0?xa(k,"paddingAngle",0):0;if(w){var C=Xr(w.endAngle-w.startAngle,k.endAngle-k.startAngle),O=Mr(Mr({},k),{},{startAngle:v+E,endAngle:v+C(g)+E});b.push(O),v=O.endAngle}else{var D=k.endAngle,A=k.startAngle,M=Xr(0,D-A),I=M(g),T=Mr(Mr({},k),{},{startAngle:v+E,endAngle:v+I+E});b.push(T),v=T.endAngle}}),x.createElement(Rt,null,r.renderSectorsStatically(b))})}},{key:"attachKeyboardHandlers",value:function(r){var n=this;r.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++n.state.sectorToFocus%n.sectorRefs.length;n.sectorRefs[o].focus(),n.setState({sectorToFocus:o});break}case"ArrowRight":{var s=--n.state.sectorToFocus<0?n.sectorRefs.length-1:n.state.sectorToFocus%n.sectorRefs.length;n.sectorRefs[s].focus(),n.setState({sectorToFocus:s});break}case"Escape":{n.sectorRefs[n.state.sectorToFocus].blur(),n.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,n=r.sectors,a=r.isAnimationActive,o=this.state.prevSectors;return a&&n&&n.length&&(!o||!ri(o,n))?this.renderSectorsWithAnimation():this.renderSectorsStatically(n)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,n=this.props,a=n.hide,o=n.sectors,s=n.className,l=n.label,c=n.cx,u=n.cy,d=n.innerRadius,f=n.outerRadius,p=n.isAnimationActive,h=this.state.isAnimationFinished;if(a||!o||!o.length||!ze(c)||!ze(u)||!ze(d)||!ze(f))return null;var g=Lt("recharts-pie",s);return x.createElement(Rt,{tabIndex:this.props.rootTabIndex,className:g,ref:function(b){r.pieRef=b}},this.renderSectors(),l&&this.renderLabels(o),Nr.renderCallByParent(this.props,null,!1),(!p||h)&&Wa.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return n.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:n.curSectors,isAnimationFinished:!0}:r.sectors!==n.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,n){return r>n?"start":r<n?"end":"middle"}},{key:"renderLabelLineItem",value:function(r,n,a){if(x.isValidElement(r))return x.cloneElement(r,n);if(jt(r))return r(n);var o=Lt("recharts-pie-label-line",typeof r!="boolean"?r.className:"");return x.createElement(Ys,Kl({},n,{key:a,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(r,n,a){if(x.isValidElement(r))return x.cloneElement(r,n);var o=a;if(jt(r)&&(o=r(n),x.isValidElement(o)))return o;var s=Lt("recharts-pie-label-text",typeof r!="boolean"&&!jt(r)?r.className:"");return x.createElement(ll,Kl({},n,{alignmentBaseline:"middle",className:s}),o)}}])}(m.PureComponent);cp=bs;Oa(bs,"displayName","Pie");Oa(bs,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!hs.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});Oa(bs,"parseDeltaAngle",function(e,t){var r=Fn(t-e),n=Math.min(Math.abs(t-e),360);return r*n});Oa(bs,"getRealPieData",function(e){var t=e.data,r=e.children,n=mt(e,!1),a=zn(r,Rg);return t&&t.length?t.map(function(o,s){return Mr(Mr(Mr({payload:o},n),o),a&&a[s]&&a[s].props)}):a&&a.length?a.map(function(o){return Mr(Mr({},n),o.props)}):[]});Oa(bs,"parseCoordinateOfPie",function(e,t){var r=t.top,n=t.left,a=t.width,o=t.height,s=sI(a,o),l=n+$n(e.cx,a,a/2),c=r+$n(e.cy,o,o/2),u=$n(e.innerRadius,s,0),d=$n(e.outerRadius,s,s*.8),f=e.maxRadius||Math.sqrt(a*a+o*o)/2;return{cx:l,cy:c,innerRadius:u,outerRadius:d,maxRadius:f}});Oa(bs,"getComposedData",function(e){var t=e.item,r=e.offset,n=t.type.defaultProps!==void 0?Mr(Mr({},t.type.defaultProps),t.props):t.props,a=cp.getRealPieData(n);if(!a||!a.length)return null;var o=n.cornerRadius,s=n.startAngle,l=n.endAngle,c=n.paddingAngle,u=n.dataKey,d=n.nameKey,f=n.valueKey,p=n.tooltipType,h=Math.abs(n.minAngle),g=cp.parseCoordinateOfPie(n,r),b=cp.parseDeltaAngle(s,l),y=Math.abs(b),v=u;vt(u)&&vt(f)?(Va(!1,`Use "dataKey" to specify the value of pie,
90
- the props "valueKey" will be deprecated in 1.1.0`),v="value"):vt(u)&&(Va(!1,`Use "dataKey" to specify the value of pie,
91
- the props "valueKey" will be deprecated in 1.1.0`),v=f);var k=a.filter(function(D){return Hr(D,v,0)!==0}).length,N=(y>=360?k:k-1)*c,w=y-k*h-N,E=a.reduce(function(D,A){var M=Hr(A,v,0);return D+(ze(M)?M:0)},0),C;if(E>0){var O;C=a.map(function(D,A){var M=Hr(D,v,0),I=Hr(D,d,A),T=(ze(M)?M:0)/E,R;A?R=O.endAngle+Fn(b)*c*(M!==0?1:0):R=s;var L=R+Fn(b)*((M!==0?h:0)+T*w),F=(R+L)/2,V=(g.innerRadius+g.outerRadius)/2,H=[{name:I,value:M,payload:D,dataKey:v,type:p}],$=_r(g.cx,g.cy,V,F);return O=Mr(Mr(Mr({percent:T,cornerRadius:o,name:I,tooltipPayload:H,midAngle:F,middleRadius:V,tooltipPosition:$},D),g),{},{value:Hr(D,v),startAngle:R,endAngle:L,payload:D,paddingAngle:Fn(b)*c}),O})}return Mr(Mr({},g),{},{sectors:C,data:a})});var ik,PP;function oie(){if(PP)return ik;PP=1;var e=Math.ceil,t=Math.max;function r(n,a,o,s){for(var l=-1,c=t(e((a-n)/(o||1)),0),u=Array(c);c--;)u[s?c:++l]=n,n+=o;return u}return ik=r,ik}var lk,AP;function jI(){if(AP)return lk;AP=1;var e=YT(),t=1/0,r=17976931348623157e292;function n(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-1/0){var o=a<0?-1:1;return o*r}return a===a?a:0}return lk=n,lk}var ck,MP;function sie(){if(MP)return ck;MP=1;var e=oie(),t=Lg(),r=jI();function n(a){return function(o,s,l){return l&&typeof l!="number"&&t(o,s,l)&&(s=l=void 0),o=r(o),s===void 0?(s=o,o=0):s=r(s),l=l===void 0?o<s?1:-1:r(l),e(o,s,l,a)}}return ck=n,ck}var uk,TP;function iie(){if(TP)return uk;TP=1;var e=sie(),t=e();return uk=t,uk}var lie=iie();const gh=mr(lie);function df(e){"@babel/helpers - typeof";return df=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},df(e)}function _P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function IP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_P(Object(r),!0).forEach(function(n){NI(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_P(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function NI(e,t,r){return t=cie(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cie(e){var t=uie(e,"string");return df(t)=="symbol"?t:t+""}function uie(e,t){if(df(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(df(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var die=["Webkit","Moz","O","ms"],fie=function(e,t){var r=e.replace(/(\w)/,function(a){return a.toUpperCase()}),n=die.reduce(function(a,o){return IP(IP({},a),{},NI({},o+r,t))},{});return n[e]=t,n};function Ic(e){"@babel/helpers - typeof";return Ic=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ic(e)}function bh(){return bh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bh.apply(this,arguments)}function DP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function dk(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?DP(Object(r),!0).forEach(function(n){oa(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function LP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,SI(n.key),n)}}function pie(e,t,r){return t&&LP(e.prototype,t),r&&LP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function hie(e,t,r){return t=yh(t),gie(e,EI()?Reflect.construct(t,r||[],yh(e).constructor):t.apply(e,r))}function gie(e,t){if(t&&(Ic(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bie(e)}function bie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function EI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(EI=function(){return!!e})()}function yh(e){return yh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yh(e)}function yie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&R2(e,t)}function R2(e,t){return R2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},R2(e,t)}function oa(e,t,r){return t=SI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SI(e){var t=xie(e,"string");return Ic(t)=="symbol"?t:t+""}function xie(e,t){if(Ic(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ic(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var vie=function(e){var t=e.data,r=e.startIndex,n=e.endIndex,a=e.x,o=e.width,s=e.travellerWidth;if(!t||!t.length)return{};var l=t.length,c=vd().domain(gh(0,l)).range([a,a+o-s]),u=c.domain().map(function(d){return c(d)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:c(r),endX:c(n),scale:c,scaleValues:u}},RP=function(e){return e.changedTouches&&!!e.changedTouches.length},Dc=function(e){function t(r){var n;return mie(this,t),n=hie(this,t,[r]),oa(n,"handleDrag",function(a){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(a):n.state.isSlideMoving&&n.handleSlideDrag(a)}),oa(n,"handleTouchMove",function(a){a.changedTouches!=null&&a.changedTouches.length>0&&n.handleDrag(a.changedTouches[0])}),oa(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=n.props,o=a.endIndex,s=a.onDragEnd,l=a.startIndex;s?.({endIndex:o,startIndex:l})}),n.detachDragEndListener()}),oa(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),oa(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),oa(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),oa(n,"handleSlideDragStart",function(a){var o=RP(a)?a.changedTouches[0]:a;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return yie(t,e),pie(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var n=r.startX,a=r.endX,o=this.state.scaleValues,s=this.props,l=s.gap,c=s.data,u=c.length-1,d=Math.min(n,a),f=Math.max(n,a),p=t.getIndexInRange(o,d),h=t.getIndexInRange(o,f);return{startIndex:p-p%l,endIndex:h===u?u:h-h%l}}},{key:"getTextOfTick",value:function(r){var n=this.props,a=n.data,o=n.tickFormatter,s=n.dataKey,l=Hr(a[r],s,r);return jt(o)?o(l,r):l}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var n=this.state,a=n.slideMoveStartX,o=n.startX,s=n.endX,l=this.props,c=l.x,u=l.width,d=l.travellerWidth,f=l.startIndex,p=l.endIndex,h=l.onChange,g=r.pageX-a;g>0?g=Math.min(g,c+u-d-s,c+u-d-o):g<0&&(g=Math.max(g,c-o,c-s));var b=this.getIndex({startX:o+g,endX:s+g});(b.startIndex!==f||b.endIndex!==p)&&h&&h(b),this.setState({startX:o+g,endX:s+g,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,n){var a=RP(n)?n.changedTouches[0]:n;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var n=this.state,a=n.brushMoveStartX,o=n.movingTravellerId,s=n.endX,l=n.startX,c=this.state[o],u=this.props,d=u.x,f=u.width,p=u.travellerWidth,h=u.onChange,g=u.gap,b=u.data,y={startX:this.state.startX,endX:this.state.endX},v=r.pageX-a;v>0?v=Math.min(v,d+f-p-c):v<0&&(v=Math.max(v,d-c)),y[o]=c+v;var k=this.getIndex(y),N=k.startIndex,w=k.endIndex,E=function(){var C=b.length-1;return o==="startX"&&(s>l?N%g===0:w%g===0)||s<l&&w===C||o==="endX"&&(s>l?w%g===0:N%g===0)||s>l&&w===C};this.setState(oa(oa({},o,c+v),"brushMoveStartX",r.pageX),function(){h&&E()&&h(k)})}},{key:"handleTravellerMoveKeyboard",value:function(r,n){var a=this,o=this.state,s=o.scaleValues,l=o.startX,c=o.endX,u=this.state[n],d=s.indexOf(u);if(d!==-1){var f=d+r;if(!(f===-1||f>=s.length)){var p=s[f];n==="startX"&&p>=c||n==="endX"&&p<=l||this.setState(oa({},n,p),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,n=r.x,a=r.y,o=r.width,s=r.height,l=r.fill,c=r.stroke;return x.createElement("rect",{stroke:c,fill:l,x:n,y:a,width:o,height:s})}},{key:"renderPanorama",value:function(){var r=this.props,n=r.x,a=r.y,o=r.width,s=r.height,l=r.data,c=r.children,u=r.padding,d=m.Children.only(c);return d?x.cloneElement(d,{x:n,y:a,width:o,height:s,margin:u,compact:!0,data:l}):null}},{key:"renderTravellerLayer",value:function(r,n){var a,o,s=this,l=this.props,c=l.y,u=l.travellerWidth,d=l.height,f=l.traveller,p=l.ariaLabel,h=l.data,g=l.startIndex,b=l.endIndex,y=Math.max(r,this.props.x),v=dk(dk({},mt(this.props,!1)),{},{x:y,y:c,width:u,height:d}),k=p||"Min value: ".concat((a=h[g])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=h[b])===null||o===void 0?void 0:o.name);return x.createElement(Rt,{tabIndex:0,role:"slider","aria-label":k,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[n],onTouchStart:this.travellerDragStartHandlers[n],onKeyDown:function(N){["ArrowLeft","ArrowRight"].includes(N.key)&&(N.preventDefault(),N.stopPropagation(),s.handleTravellerMoveKeyboard(N.key==="ArrowRight"?1:-1,n))},onFocus:function(){s.setState({isTravellerFocused:!0})},onBlur:function(){s.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(f,v))}},{key:"renderSlide",value:function(r,n){var a=this.props,o=a.y,s=a.height,l=a.stroke,c=a.travellerWidth,u=Math.min(r,n)+c,d=Math.max(Math.abs(n-r)-c,0);return x.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:l,fillOpacity:.2,x:u,y:o,width:d,height:s})}},{key:"renderText",value:function(){var r=this.props,n=r.startIndex,a=r.endIndex,o=r.y,s=r.height,l=r.travellerWidth,c=r.stroke,u=this.state,d=u.startX,f=u.endX,p=5,h={pointerEvents:"none",fill:c};return x.createElement(Rt,{className:"recharts-brush-texts"},x.createElement(ll,bh({textAnchor:"end",verticalAnchor:"middle",x:Math.min(d,f)-p,y:o+s/2},h),this.getTextOfTick(n)),x.createElement(ll,bh({textAnchor:"start",verticalAnchor:"middle",x:Math.max(d,f)+l+p,y:o+s/2},h),this.getTextOfTick(a)))}},{key:"render",value:function(){var r=this.props,n=r.data,a=r.className,o=r.children,s=r.x,l=r.y,c=r.width,u=r.height,d=r.alwaysShowText,f=this.state,p=f.startX,h=f.endX,g=f.isTextActive,b=f.isSlideMoving,y=f.isTravellerMoving,v=f.isTravellerFocused;if(!n||!n.length||!ze(s)||!ze(l)||!ze(c)||!ze(u)||c<=0||u<=0)return null;var k=Lt("recharts-brush",a),N=x.Children.count(o)===1,w=fie("userSelect","none");return x.createElement(Rt,{className:k,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:w},this.renderBackground(),N&&this.renderPanorama(),this.renderSlide(p,h),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(h,"endX"),(g||b||y||v||d)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var n=r.x,a=r.y,o=r.width,s=r.height,l=r.stroke,c=Math.floor(a+s/2)-1;return x.createElement(x.Fragment,null,x.createElement("rect",{x:n,y:a,width:o,height:s,fill:l,stroke:"none"}),x.createElement("line",{x1:n+1,y1:c,x2:n+o-1,y2:c,fill:"none",stroke:"#fff"}),x.createElement("line",{x1:n+1,y1:c+2,x2:n+o-1,y2:c+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,n){var a;return x.isValidElement(r)?a=x.cloneElement(r,n):jt(r)?a=r(n):a=t.renderDefaultTraveller(n),a}},{key:"getDerivedStateFromProps",value:function(r,n){var a=r.data,o=r.width,s=r.x,l=r.travellerWidth,c=r.updateId,u=r.startIndex,d=r.endIndex;if(a!==n.prevData||c!==n.prevUpdateId)return dk({prevData:a,prevTravellerWidth:l,prevUpdateId:c,prevX:s,prevWidth:o},a&&a.length?vie({data:a,width:o,x:s,travellerWidth:l,startIndex:u,endIndex:d}):{scale:null,scaleValues:null});if(n.scale&&(o!==n.prevWidth||s!==n.prevX||l!==n.prevTravellerWidth)){n.scale.range([s,s+o-l]);var f=n.scale.domain().map(function(p){return n.scale(p)});return{prevData:a,prevTravellerWidth:l,prevUpdateId:c,prevX:s,prevWidth:o,startX:n.scale(r.startIndex),endX:n.scale(r.endIndex),scaleValues:f}}return null}},{key:"getIndexInRange",value:function(r,n){for(var a=r.length,o=0,s=a-1;s-o>1;){var l=Math.floor((o+s)/2);r[l]>n?s=l:o=l}return n>=r[s]?s:o}}])}(m.PureComponent);oa(Dc,"displayName","Brush");oa(Dc,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var fk,FP;function kie(){if(FP)return fk;FP=1;var e=$N();function t(r,n){var a;return e(r,function(o,s,l){return a=n(o,s,l),!a}),!!a}return fk=t,fk}var mk,$P;function wie(){if($P)return mk;$P=1;var e=ET(),t=To(),r=kie(),n=Qn(),a=Lg();function o(s,l,c){var u=n(s)?e:r;return c&&a(s,l,c)&&(l=void 0),u(s,t(l,3))}return mk=o,mk}var jie=wie();const Nie=mr(jie);var yo=function(e,t){var r=e.alwaysShow,n=e.ifOverflow;return r&&(n="extendDomain"),n===t},pk,BP;function Eie(){if(BP)return pk;BP=1;var e=UT();function t(r,n,a){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):r[n]=a}return pk=t,pk}var hk,HP;function Sie(){if(HP)return hk;HP=1;var e=Eie(),t=HT(),r=To();function n(a,o){var s={};return o=r(o,3),t(a,function(l,c,u){e(s,c,o(l,c,u))}),s}return hk=n,hk}var Cie=Sie();const Oie=mr(Cie);var gk,zP;function Pie(){if(zP)return gk;zP=1;function e(t,r){for(var n=-1,a=t==null?0:t.length;++n<a;)if(!r(t[n],n,t))return!1;return!0}return gk=e,gk}var bk,UP;function Aie(){if(UP)return bk;UP=1;var e=$N();function t(r,n){var a=!0;return e(r,function(o,s,l){return a=!!n(o,s,l),a}),a}return bk=t,bk}var yk,qP;function Mie(){if(qP)return yk;qP=1;var e=Pie(),t=Aie(),r=To(),n=Qn(),a=Lg();function o(s,l,c){var u=n(s)?e:t;return c&&a(s,l,c)&&(l=void 0),u(s,r(l,3))}return yk=o,yk}var Tie=Mie();const CI=mr(Tie);var _ie=["x","y"];function ff(e){"@babel/helpers - typeof";return ff=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ff(e)}function F2(){return F2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},F2.apply(this,arguments)}function VP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Yu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?VP(Object(r),!0).forEach(function(n){Iie(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):VP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Iie(e,t,r){return t=Die(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Die(e){var t=Lie(e,"string");return ff(t)=="symbol"?t:t+""}function Lie(e,t){if(ff(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ff(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rie(e,t){if(e==null)return{};var r=Fie(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Fie(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function $ie(e,t){var r=e.x,n=e.y,a=Rie(e,_ie),o="".concat(r),s=parseInt(o,10),l="".concat(n),c=parseInt(l,10),u="".concat(t.height||a.height),d=parseInt(u,10),f="".concat(t.width||a.width),p=parseInt(f,10);return Yu(Yu(Yu(Yu(Yu({},t),a),s?{x:s}:{}),c?{y:c}:{}),{},{height:d,width:p,name:t.name,radius:t.radius})}function WP(e){return x.createElement(ph,F2({shapeType:"rectangle",propTransformer:$ie,activeClassName:"recharts-active-bar"},e))}var Bie=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,n){if(typeof e=="number")return e;var a=ze(r)||aY(r);return a?e(r,n):(a||ul(),t)}},Hie=["value","background"],OI;function Lc(e){"@babel/helpers - typeof";return Lc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lc(e)}function zie(e,t){if(e==null)return{};var r=Uie(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Uie(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function xh(){return xh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xh.apply(this,arguments)}function KP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function rn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KP(Object(r),!0).forEach(function(n){$s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,AI(n.key),n)}}function Vie(e,t,r){return t&&YP(e.prototype,t),r&&YP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Wie(e,t,r){return t=vh(t),Kie(e,PI()?Reflect.construct(t,r||[],vh(e).constructor):t.apply(e,r))}function Kie(e,t){if(t&&(Lc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Yie(e)}function Yie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function PI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PI=function(){return!!e})()}function vh(e){return vh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vh(e)}function Xie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$2(e,t)}function $2(e,t){return $2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},$2(e,t)}function $s(e,t,r){return t=AI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function AI(e){var t=Gie(e,"string");return Lc(t)=="symbol"?t:t+""}function Gie(e,t){if(Lc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Lc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var bi=function(e){function t(){var r;qie(this,t);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return r=Wie(this,t,[].concat(a)),$s(r,"state",{isAnimationFinished:!1}),$s(r,"id",fi("recharts-bar-")),$s(r,"handleAnimationEnd",function(){var s=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),s&&s()}),$s(r,"handleAnimationStart",function(){var s=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),s&&s()}),r}return Xie(t,e),Vie(t,[{key:"renderRectanglesStatically",value:function(r){var n=this,a=this.props,o=a.shape,s=a.dataKey,l=a.activeIndex,c=a.activeBar,u=mt(this.props,!1);return r&&r.map(function(d,f){var p=f===l,h=p?c:o,g=rn(rn(rn({},u),d),{},{isActive:p,option:h,index:f,dataKey:s,onAnimationStart:n.handleAnimationStart,onAnimationEnd:n.handleAnimationEnd});return x.createElement(Rt,xh({className:"recharts-bar-rectangle"},ti(n.props,d,f),{key:"rectangle-".concat(d?.x,"-").concat(d?.y,"-").concat(d?.value,"-").concat(f)}),x.createElement(WP,g))})}},{key:"renderRectanglesWithAnimation",value:function(){var r=this,n=this.props,a=n.data,o=n.layout,s=n.isAnimationActive,l=n.animationBegin,c=n.animationDuration,u=n.animationEasing,d=n.animationId,f=this.state.prevData;return x.createElement(Ta,{begin:l,duration:c,isActive:s,easing:u,from:{t:0},to:{t:1},key:"bar-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(p){var h=p.t,g=a.map(function(b,y){var v=f&&f[y];if(v){var k=Xr(v.x,b.x),N=Xr(v.y,b.y),w=Xr(v.width,b.width),E=Xr(v.height,b.height);return rn(rn({},b),{},{x:k(h),y:N(h),width:w(h),height:E(h)})}if(o==="horizontal"){var C=Xr(0,b.height),O=C(h);return rn(rn({},b),{},{y:b.y+b.height-O,height:O})}var D=Xr(0,b.width),A=D(h);return rn(rn({},b),{},{width:A})});return x.createElement(Rt,null,r.renderRectanglesStatically(g))})}},{key:"renderRectangles",value:function(){var r=this.props,n=r.data,a=r.isAnimationActive,o=this.state.prevData;return a&&n&&n.length&&(!o||!ri(o,n))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(n)}},{key:"renderBackground",value:function(){var r=this,n=this.props,a=n.data,o=n.dataKey,s=n.activeIndex,l=mt(this.props.background,!1);return a.map(function(c,u){c.value;var d=c.background,f=zie(c,Hie);if(!d)return null;var p=rn(rn(rn(rn(rn({},f),{},{fill:"#eee"},d),l),ti(r.props,c,u)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:o,index:u,className:"recharts-bar-background-rectangle"});return x.createElement(WP,xh({key:"background-bar-".concat(u),option:r.props.background,isActive:u===s},p))})}},{key:"renderErrorBar",value:function(r,n){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.data,s=a.xAxis,l=a.yAxis,c=a.layout,u=a.children,d=zn(u,fu);if(!d)return null;var f=c==="vertical"?o[0].height/2:o[0].width/2,p=function(g,b){var y=Array.isArray(g.value)?g.value[1]:g.value;return{x:g.x,y:g.y,value:y,errorVal:Hr(g,b)}},h={clipPath:r?"url(#clipPath-".concat(n,")"):null};return x.createElement(Rt,h,d.map(function(g){return x.cloneElement(g,{key:"error-bar-".concat(n,"-").concat(g.props.dataKey),data:o,xAxis:s,yAxis:l,layout:c,offset:f,dataPointFormatter:p})}))}},{key:"render",value:function(){var r=this.props,n=r.hide,a=r.data,o=r.className,s=r.xAxis,l=r.yAxis,c=r.left,u=r.top,d=r.width,f=r.height,p=r.isAnimationActive,h=r.background,g=r.id;if(n||!a||!a.length)return null;var b=this.state.isAnimationFinished,y=Lt("recharts-bar",o),v=s&&s.allowDataOverflow,k=l&&l.allowDataOverflow,N=v||k,w=vt(g)?this.id:g;return x.createElement(Rt,{className:y},v||k?x.createElement("defs",null,x.createElement("clipPath",{id:"clipPath-".concat(w)},x.createElement("rect",{x:v?c:c-d/2,y:k?u:u-f/2,width:v?d:d*2,height:k?f:f*2}))):null,x.createElement(Rt,{className:"recharts-bar-rectangles",clipPath:N?"url(#clipPath-".concat(w,")"):null},h?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(N,w),(!p||b)&&Wa.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:n.curData}:r.data!==n.curData?{curData:r.data}:null}}])}(m.PureComponent);OI=bi;$s(bi,"displayName","Bar");$s(bi,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!hs.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});$s(bi,"getComposedData",function(e){var t=e.props,r=e.item,n=e.barPosition,a=e.bandSize,o=e.xAxis,s=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,p=e.offset,h=vre(n,r);if(!h)return null;var g=t.layout,b=r.type.defaultProps,y=b!==void 0?rn(rn({},b),r.props):r.props,v=y.dataKey,k=y.children,N=y.minPointSize,w=g==="horizontal"?s:o,E=u?w.scale.domain():null,C=Cre({numericAxis:w}),O=zn(k,Rg),D=f.map(function(A,M){var I,T,R,L,F,V;u?I=kre(u[d+M],E):(I=Hr(A,v),Array.isArray(I)||(I=[C,I]));var H=Bie(N,OI.defaultProps.minPointSize)(I[1],M);if(g==="horizontal"){var $,z=[s.scale(I[0]),s.scale(I[1])],W=z[0],U=z[1];T=j6({axis:o,ticks:l,bandSize:a,offset:h.offset,entry:A,index:M}),R=($=U??W)!==null&&$!==void 0?$:void 0,L=h.size;var X=W-U;if(F=Number.isNaN(X)?0:X,V={x:T,y:s.y,width:L,height:s.height},Math.abs(H)>0&&Math.abs(F)<Math.abs(H)){var Y=Fn(F||H)*(Math.abs(H)-Math.abs(F));R-=Y,F+=Y}}else{var ae=[o.scale(I[0]),o.scale(I[1])],G=ae[0],ee=ae[1];if(T=G,R=j6({axis:s,ticks:c,bandSize:a,offset:h.offset,entry:A,index:M}),L=ee-G,F=h.size,V={x:o.x,y:R,width:o.width,height:F},Math.abs(H)>0&&Math.abs(L)<Math.abs(H)){var re=Fn(L||H)*(Math.abs(H)-Math.abs(L));L+=re}}return rn(rn(rn({},A),{},{x:T,y:R,width:L,height:F,value:u?I:I[1],payload:A,background:V},O&&O[M]&&O[M].props),{},{tooltipPayload:[aI(r,A)],tooltipPosition:{x:T+L/2,y:R+F/2}})});return rn({data:D,layout:g},p)});function mf(e){"@babel/helpers - typeof";return mf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mf(e)}function Zie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function XP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,MI(n.key),n)}}function Jie(e,t,r){return t&&XP(e.prototype,t),r&&XP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function GP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ha(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?GP(Object(r),!0).forEach(function(n){eb(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):GP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function eb(e,t,r){return t=MI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MI(e){var t=Qie(e,"string");return mf(t)=="symbol"?t:t+""}function Qie(e,t){if(mf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(mf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var tb=function(e,t,r,n,a){var o=e.width,s=e.height,l=e.layout,c=e.children,u=Object.keys(t),d={left:r.left,leftMirror:r.left,right:o-r.right,rightMirror:o-r.right,top:r.top,topMirror:r.top,bottom:s-r.bottom,bottomMirror:s-r.bottom},f=!!sa(c,bi);return u.reduce(function(p,h){var g=t[h],b=g.orientation,y=g.domain,v=g.padding,k=v===void 0?{}:v,N=g.mirror,w=g.reversed,E="".concat(b).concat(N?"Mirror":""),C,O,D,A,M;if(g.type==="number"&&(g.padding==="gap"||g.padding==="no-gap")){var I=y[1]-y[0],T=1/0,R=g.categoricalDomain.sort(lY);if(R.forEach(function(Y,ae){ae>0&&(T=Math.min((Y||0)-(R[ae-1]||0),T))}),Number.isFinite(T)){var L=T/I,F=g.layout==="vertical"?r.height:r.width;if(g.padding==="gap"&&(C=L*F/2),g.padding==="no-gap"){var V=$n(e.barCategoryGap,L*F),H=L*F/2;C=H-V-(H-V)/F*V}}}n==="xAxis"?O=[r.left+(k.left||0)+(C||0),r.left+r.width-(k.right||0)-(C||0)]:n==="yAxis"?O=l==="horizontal"?[r.top+r.height-(k.bottom||0),r.top+(k.top||0)]:[r.top+(k.top||0)+(C||0),r.top+r.height-(k.bottom||0)-(C||0)]:O=g.range,w&&(O=[O[1],O[0]]);var $=eI(g,a,f),z=$.scale,W=$.realScaleType;z.domain(y).range(O),tI(z);var U=rI(z,Ha(Ha({},g),{},{realScaleType:W}));n==="xAxis"?(M=b==="top"&&!N||b==="bottom"&&N,D=r.left,A=d[E]-M*g.height):n==="yAxis"&&(M=b==="left"&&!N||b==="right"&&N,D=d[E]-M*g.width,A=r.top);var X=Ha(Ha(Ha({},g),U),{},{realScaleType:W,x:D,y:A,scale:z,width:n==="xAxis"?r.width:g.width,height:n==="yAxis"?r.height:g.height});return X.bandSize=rh(X,U),!g.hide&&n==="xAxis"?d[E]+=(M?-1:1)*X.height:g.hide||(d[E]+=(M?-1:1)*X.width),Ha(Ha({},p),{},eb({},h,X))},{})},TI=function(e,t){var r=e.x,n=e.y,a=t.x,o=t.y;return{x:Math.min(r,a),y:Math.min(n,o),width:Math.abs(a-r),height:Math.abs(o-n)}},ele=function(e){var t=e.x1,r=e.y1,n=e.x2,a=e.y2;return TI({x:t,y:r},{x:n,y:a})},_I=function(){function e(t){Zie(this,e),this.scale=t}return Jie(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.bandAware,a=r.position;if(t!==void 0){if(a)switch(a){case"start":return this.scale(t);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+o}case"end":{var s=this.bandwidth?this.bandwidth():0;return this.scale(t)+s}default:return this.scale(t)}if(n){var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+l}return this.scale(t)}}},{key:"isInRange",value:function(t){var r=this.range(),n=r[0],a=r[r.length-1];return n<=a?t>=n&&t<=a:t>=a&&t<=n}}],[{key:"create",value:function(t){return new e(t)}}])}();eb(_I,"EPS",1e-4);var h1=function(e){var t=Object.keys(e).reduce(function(r,n){return Ha(Ha({},r),{},eb({},n,_I.create(e[n])))},{});return Ha(Ha({},t),{},{apply:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.bandAware,o=n.position;return Oie(r,function(s,l){return t[l].apply(s,{bandAware:a,position:o})})},isInRange:function(r){return CI(r,function(n,a){return t[a].isInRange(n)})}})};function tle(e){return(e%180+180)%180}var rle=function(e){var t=e.width,r=e.height,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=tle(n),o=a*Math.PI/180,s=Math.atan(r/t),l=o>s&&o<Math.PI-s?r/Math.sin(o):t/Math.cos(o);return Math.abs(l)},xk,ZP;function nle(){if(ZP)return xk;ZP=1;var e=To(),t=Ff(),r=Ig();function n(a){return function(o,s,l){var c=Object(o);if(!t(o)){var u=e(s,3);o=r(o),s=function(f){return u(c[f],f,c)}}var d=a(o,s,l);return d>-1?c[u?o[d]:d]:void 0}}return xk=n,xk}var vk,JP;function ale(){if(JP)return vk;JP=1;var e=jI();function t(r){var n=e(r),a=n%1;return n===n?a?n-a:n:0}return vk=t,vk}var kk,QP;function ole(){if(QP)return kk;QP=1;var e=LT(),t=To(),r=ale(),n=Math.max;function a(o,s,l){var c=o==null?0:o.length;if(!c)return-1;var u=l==null?0:r(l);return u<0&&(u=n(c+u,0)),e(o,t(s,3),u)}return kk=a,kk}var wk,eA;function sle(){if(eA)return wk;eA=1;var e=nle(),t=ole(),r=e(t);return wk=r,wk}var ile=sle();const lle=mr(ile);var cle=Z8();const ule=mr(cle);var dle=ule(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),g1=m.createContext(void 0),b1=m.createContext(void 0),II=m.createContext(void 0),DI=m.createContext({}),LI=m.createContext(void 0),RI=m.createContext(0),FI=m.createContext(0),tA=function(e){var t=e.state,r=t.xAxisMap,n=t.yAxisMap,a=t.offset,o=e.clipPathId,s=e.children,l=e.width,c=e.height,u=dle(a);return x.createElement(g1.Provider,{value:r},x.createElement(b1.Provider,{value:n},x.createElement(DI.Provider,{value:a},x.createElement(II.Provider,{value:u},x.createElement(LI.Provider,{value:o},x.createElement(RI.Provider,{value:c},x.createElement(FI.Provider,{value:l},s)))))))},fle=function(){return m.useContext(LI)},$I=function(e){var t=m.useContext(g1);t==null&&ul();var r=t[e];return r==null&&ul(),r},mle=function(){var e=m.useContext(g1);return Ds(e)},ple=function(){var e=m.useContext(b1),t=lle(e,function(r){return CI(r.domain,Number.isFinite)});return t||Ds(e)},BI=function(e){var t=m.useContext(b1);t==null&&ul();var r=t[e];return r==null&&ul(),r},hle=function(){var e=m.useContext(II);return e},gle=function(){return m.useContext(DI)},y1=function(){return m.useContext(FI)},x1=function(){return m.useContext(RI)};function Rc(e){"@babel/helpers - typeof";return Rc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rc(e)}function ble(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yle(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,zI(n.key),n)}}function xle(e,t,r){return t&&yle(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function vle(e,t,r){return t=kh(t),kle(e,HI()?Reflect.construct(t,r||[],kh(e).constructor):t.apply(e,r))}function kle(e,t){if(t&&(Rc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wle(e)}function wle(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function HI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(HI=function(){return!!e})()}function kh(e){return kh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},kh(e)}function jle(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&B2(e,t)}function B2(e,t){return B2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},B2(e,t)}function rA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function nA(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?rA(Object(r),!0).forEach(function(n){v1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function v1(e,t,r){return t=zI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zI(e){var t=Nle(e,"string");return Rc(t)=="symbol"?t:t+""}function Nle(e,t){if(Rc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Rc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Ele(e,t){return Ple(e)||Ole(e,t)||Cle(e,t)||Sle()}function Sle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
92
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cle(e,t){if(e){if(typeof e=="string")return aA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return aA(e,t)}}function aA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ole(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function Ple(e){if(Array.isArray(e))return e}function H2(){return H2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},H2.apply(this,arguments)}var Ale=function(e,t){var r;return x.isValidElement(e)?r=x.cloneElement(e,t):jt(e)?r=e(t):r=x.createElement("line",H2({},t,{className:"recharts-reference-line-line"})),r},Mle=function(e,t,r,n,a,o,s,l,c){var u=a.x,d=a.y,f=a.width,p=a.height;if(r){var h=c.y,g=e.y.apply(h,{position:o});if(yo(c,"discard")&&!e.y.isInRange(g))return null;var b=[{x:u+f,y:g},{x:u,y:g}];return l==="left"?b.reverse():b}if(t){var y=c.x,v=e.x.apply(y,{position:o});if(yo(c,"discard")&&!e.x.isInRange(v))return null;var k=[{x:v,y:d+p},{x:v,y:d}];return s==="top"?k.reverse():k}if(n){var N=c.segment,w=N.map(function(E){return e.apply(E,{position:o})});return yo(c,"discard")&&Nie(w,function(E){return!e.isInRange(E)})?null:w}return null};function Tle(e){var t=e.x,r=e.y,n=e.segment,a=e.xAxisId,o=e.yAxisId,s=e.shape,l=e.className,c=e.alwaysShow,u=fle(),d=$I(a),f=BI(o),p=hle();if(!u||!p)return null;Va(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var h=h1({x:d.scale,y:f.scale}),g=bn(t),b=bn(r),y=n&&n.length===2,v=Mle(h,g,b,y,p,e.position,d.orientation,f.orientation,e);if(!v)return null;var k=Ele(v,2),N=k[0],w=N.x,E=N.y,C=k[1],O=C.x,D=C.y,A=yo(e,"hidden")?"url(#".concat(u,")"):void 0,M=nA(nA({clipPath:A},mt(e,!0)),{},{x1:w,y1:E,x2:O,y2:D});return x.createElement(Rt,{className:Lt("recharts-reference-line",l)},Ale(s,M),Nr.renderCallByParent(e,ele({x1:w,y1:E,x2:O,y2:D})))}var k1=function(e){function t(){return ble(this,t),vle(this,t,arguments)}return jle(t,e),xle(t,[{key:"render",value:function(){return x.createElement(Tle,this.props)}}])}(x.Component);v1(k1,"displayName","ReferenceLine");v1(k1,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function z2(){return z2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},z2.apply(this,arguments)}function Fc(e){"@babel/helpers - typeof";return Fc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fc(e)}function oA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function sA(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oA(Object(r),!0).forEach(function(n){rb(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _le(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ile(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,qI(n.key),n)}}function Dle(e,t,r){return t&&Ile(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lle(e,t,r){return t=wh(t),Rle(e,UI()?Reflect.construct(t,r||[],wh(e).constructor):t.apply(e,r))}function Rle(e,t){if(t&&(Fc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fle(e)}function Fle(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function UI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(UI=function(){return!!e})()}function wh(e){return wh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wh(e)}function $le(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U2(e,t)}function U2(e,t){return U2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},U2(e,t)}function rb(e,t,r){return t=qI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qI(e){var t=Ble(e,"string");return Fc(t)=="symbol"?t:t+""}function Ble(e,t){if(Fc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Fc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Hle=function(e){var t=e.x,r=e.y,n=e.xAxis,a=e.yAxis,o=h1({x:n.scale,y:a.scale}),s=o.apply({x:t,y:r},{bandAware:!0});return yo(e,"discard")&&!o.isInRange(s)?null:s},nb=function(e){function t(){return _le(this,t),Lle(this,t,arguments)}return $le(t,e),Dle(t,[{key:"render",value:function(){var r=this.props,n=r.x,a=r.y,o=r.r,s=r.alwaysShow,l=r.clipPathId,c=bn(n),u=bn(a);if(Va(s===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!c||!u)return null;var d=Hle(this.props);if(!d)return null;var f=d.x,p=d.y,h=this.props,g=h.shape,b=h.className,y=yo(this.props,"hidden")?"url(#".concat(l,")"):void 0,v=sA(sA({clipPath:y},mt(this.props,!0)),{},{cx:f,cy:p});return x.createElement(Rt,{className:Lt("recharts-reference-dot",b)},t.renderDot(g,v),Nr.renderCallByParent(this.props,{x:f-o,y:p-o,width:2*o,height:2*o}))}}])}(x.Component);rb(nb,"displayName","ReferenceDot");rb(nb,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});rb(nb,"renderDot",function(e,t){var r;return x.isValidElement(e)?r=x.cloneElement(e,t):jt(e)?r=e(t):r=x.createElement(No,z2({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),r});function q2(){return q2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},q2.apply(this,arguments)}function $c(e){"@babel/helpers - typeof";return $c=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$c(e)}function iA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function lA(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?iA(Object(r),!0).forEach(function(n){ab(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function zle(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ule(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,WI(n.key),n)}}function qle(e,t,r){return t&&Ule(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vle(e,t,r){return t=jh(t),Wle(e,VI()?Reflect.construct(t,r||[],jh(e).constructor):t.apply(e,r))}function Wle(e,t){if(t&&($c(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Kle(e)}function Kle(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function VI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(VI=function(){return!!e})()}function jh(e){return jh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},jh(e)}function Yle(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&V2(e,t)}function V2(e,t){return V2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},V2(e,t)}function ab(e,t,r){return t=WI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function WI(e){var t=Xle(e,"string");return $c(t)=="symbol"?t:t+""}function Xle(e,t){if($c(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if($c(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Gle=function(e,t,r,n,a){var o=a.x1,s=a.x2,l=a.y1,c=a.y2,u=a.xAxis,d=a.yAxis;if(!u||!d)return null;var f=h1({x:u.scale,y:d.scale}),p={x:e?f.x.apply(o,{position:"start"}):f.x.rangeMin,y:r?f.y.apply(l,{position:"start"}):f.y.rangeMin},h={x:t?f.x.apply(s,{position:"end"}):f.x.rangeMax,y:n?f.y.apply(c,{position:"end"}):f.y.rangeMax};return yo(a,"discard")&&(!f.isInRange(p)||!f.isInRange(h))?null:TI(p,h)},ob=function(e){function t(){return zle(this,t),Vle(this,t,arguments)}return Yle(t,e),qle(t,[{key:"render",value:function(){var r=this.props,n=r.x1,a=r.x2,o=r.y1,s=r.y2,l=r.className,c=r.alwaysShow,u=r.clipPathId;Va(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var d=bn(n),f=bn(a),p=bn(o),h=bn(s),g=this.props.shape;if(!d&&!f&&!p&&!h&&!g)return null;var b=Gle(d,f,p,h,this.props);if(!b&&!g)return null;var y=yo(this.props,"hidden")?"url(#".concat(u,")"):void 0;return x.createElement(Rt,{className:Lt("recharts-reference-area",l)},t.renderRect(g,lA(lA({clipPath:y},mt(this.props,!0)),b)),Nr.renderCallByParent(this.props,b))}}])}(x.Component);ab(ob,"displayName","ReferenceArea");ab(ob,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});ab(ob,"renderRect",function(e,t){var r;return x.isValidElement(e)?r=x.cloneElement(e,t):jt(e)?r=e(t):r=x.createElement(p1,q2({},t,{className:"recharts-reference-area-rect"})),r});function KI(e,t,r){if(t<1)return[];if(t===1&&r===void 0)return e;for(var n=[],a=0;a<e.length;a+=t)n.push(e[a]);return n}function Zle(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return rle(n,r)}function Jle(e,t,r){var n=r==="width",a=e.x,o=e.y,s=e.width,l=e.height;return t===1?{start:n?a:o,end:n?a+s:o+l}:{start:n?a+s:o+l,end:n?a:o}}function Nh(e,t,r,n,a){if(e*t<e*n||e*t>e*a)return!1;var o=r();return e*(t-e*o/2-n)>=0&&e*(t+e*o/2-a)<=0}function Qle(e,t){return KI(e,t+1)}function ece(e,t,r,n,a){for(var o=(n||[]).slice(),s=t.start,l=t.end,c=0,u=1,d=s,f=function(){var h=n?.[c];if(h===void 0)return{v:KI(n,u)};var g=c,b,y=function(){return b===void 0&&(b=r(h,g)),b},v=h.coordinate,k=c===0||Nh(e,v,y,d,l);k||(c=0,d=s,u+=1),k&&(d=v+e*(y()/2+a),c+=u)},p;u<=o.length;)if(p=f(),p)return p.v;return[]}function pf(e){"@babel/helpers - typeof";return pf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pf(e)}function cA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Pn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cA(Object(r),!0).forEach(function(n){tce(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tce(e,t,r){return t=rce(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rce(e){var t=nce(e,"string");return pf(t)=="symbol"?t:t+""}function nce(e,t){if(pf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(pf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ace(e,t,r,n,a){for(var o=(n||[]).slice(),s=o.length,l=t.start,c=t.end,u=function(f){var p=o[f],h,g=function(){return h===void 0&&(h=r(p,f)),h};if(f===s-1){var b=e*(p.coordinate+e*g()/2-c);o[f]=p=Pn(Pn({},p),{},{tickCoord:b>0?p.coordinate-b*e:p.coordinate})}else o[f]=p=Pn(Pn({},p),{},{tickCoord:p.coordinate});var y=Nh(e,p.tickCoord,g,l,c);y&&(c=p.tickCoord-e*(g()/2+a),o[f]=Pn(Pn({},p),{},{isShow:!0}))},d=s-1;d>=0;d--)u(d);return o}function oce(e,t,r,n,a,o){var s=(n||[]).slice(),l=s.length,c=t.start,u=t.end;if(o){var d=n[l-1],f=r(d,l-1),p=e*(d.coordinate+e*f/2-u);s[l-1]=d=Pn(Pn({},d),{},{tickCoord:p>0?d.coordinate-p*e:d.coordinate});var h=Nh(e,d.tickCoord,function(){return f},c,u);h&&(u=d.tickCoord-e*(f/2+a),s[l-1]=Pn(Pn({},d),{},{isShow:!0}))}for(var g=o?l-1:l,b=function(v){var k=s[v],N,w=function(){return N===void 0&&(N=r(k,v)),N};if(v===0){var E=e*(k.coordinate-e*w()/2-c);s[v]=k=Pn(Pn({},k),{},{tickCoord:E<0?k.coordinate-E*e:k.coordinate})}else s[v]=k=Pn(Pn({},k),{},{tickCoord:k.coordinate});var C=Nh(e,k.tickCoord,w,c,u);C&&(c=k.tickCoord+e*(w()/2+a),s[v]=Pn(Pn({},k),{},{isShow:!0}))},y=0;y<g;y++)b(y);return s}function w1(e,t,r){var n=e.tick,a=e.ticks,o=e.viewBox,s=e.minTickGap,l=e.orientation,c=e.interval,u=e.tickFormatter,d=e.unit,f=e.angle;if(!a||!a.length||!n)return[];if(ze(c)||hs.isSsr)return Qle(a,typeof c=="number"&&ze(c)?c:0);var p=[],h=l==="top"||l==="bottom"?"width":"height",g=d&&h==="width"?xd(d,{fontSize:t,letterSpacing:r}):{width:0,height:0},b=function(k,N){var w=jt(u)?u(k.value,N):k.value;return h==="width"?Zle(xd(w,{fontSize:t,letterSpacing:r}),g,f):xd(w,{fontSize:t,letterSpacing:r})[h]},y=a.length>=2?Fn(a[1].coordinate-a[0].coordinate):1,v=Jle(o,y,h);return c==="equidistantPreserveStart"?ece(y,v,b,a,s):(c==="preserveStart"||c==="preserveStartEnd"?p=oce(y,v,b,a,s,c==="preserveStartEnd"):p=ace(y,v,b,a,s),p.filter(function(k){return k.isShow}))}var sce=["viewBox"],ice=["viewBox"],lce=["ticks"];function Bc(e){"@babel/helpers - typeof";return Bc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bc(e)}function Yl(){return Yl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yl.apply(this,arguments)}function uA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function dn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uA(Object(r),!0).forEach(function(n){j1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jk(e,t){if(e==null)return{};var r=cce(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function cce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function uce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dA(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,XI(n.key),n)}}function dce(e,t,r){return t&&dA(e.prototype,t),r&&dA(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function fce(e,t,r){return t=Eh(t),mce(e,YI()?Reflect.construct(t,r||[],Eh(e).constructor):t.apply(e,r))}function mce(e,t){if(t&&(Bc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pce(e)}function pce(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function YI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(YI=function(){return!!e})()}function Eh(e){return Eh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Eh(e)}function hce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&W2(e,t)}function W2(e,t){return W2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},W2(e,t)}function j1(e,t,r){return t=XI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function XI(e){var t=gce(e,"string");return Bc(t)=="symbol"?t:t+""}function gce(e,t){if(Bc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Bc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var mu=function(e){function t(r){var n;return uce(this,t),n=fce(this,t,[r]),n.state={fontSize:"",letterSpacing:""},n}return hce(t,e),dce(t,[{key:"shouldComponentUpdate",value:function(r,n){var a=r.viewBox,o=jk(r,sce),s=this.props,l=s.viewBox,c=jk(s,ice);return!ac(a,l)||!ac(o,c)||!ac(n,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var n=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];n&&this.setState({fontSize:window.getComputedStyle(n).fontSize,letterSpacing:window.getComputedStyle(n).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var n=this.props,a=n.x,o=n.y,s=n.width,l=n.height,c=n.orientation,u=n.tickSize,d=n.mirror,f=n.tickMargin,p,h,g,b,y,v,k=d?-1:1,N=r.tickSize||u,w=ze(r.tickCoord)?r.tickCoord:r.coordinate;switch(c){case"top":p=h=r.coordinate,b=o+ +!d*l,g=b-k*N,v=g-k*f,y=w;break;case"left":g=b=r.coordinate,h=a+ +!d*s,p=h-k*N,y=p-k*f,v=w;break;case"right":g=b=r.coordinate,h=a+ +d*s,p=h+k*N,y=p+k*f,v=w;break;default:p=h=r.coordinate,b=o+ +d*l,g=b+k*N,v=g+k*f,y=w;break}return{line:{x1:p,y1:g,x2:h,y2:b},tick:{x:y,y:v}}}},{key:"getTickTextAnchor",value:function(){var r=this.props,n=r.orientation,a=r.mirror,o;switch(n){case"left":o=a?"start":"end";break;case"right":o=a?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var r=this.props,n=r.orientation,a=r.mirror,o="end";switch(n){case"left":case"right":o="middle";break;case"top":o=a?"start":"end";break;default:o=a?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var r=this.props,n=r.x,a=r.y,o=r.width,s=r.height,l=r.orientation,c=r.mirror,u=r.axisLine,d=dn(dn(dn({},mt(this.props,!1)),mt(u,!1)),{},{fill:"none"});if(l==="top"||l==="bottom"){var f=+(l==="top"&&!c||l==="bottom"&&c);d=dn(dn({},d),{},{x1:n,y1:a+f*s,x2:n+o,y2:a+f*s})}else{var p=+(l==="left"&&!c||l==="right"&&c);d=dn(dn({},d),{},{x1:n+p*o,y1:a,x2:n+p*o,y2:a+s})}return x.createElement("line",Yl({},d,{className:Lt("recharts-cartesian-axis-line",xa(u,"className"))}))}},{key:"renderTicks",value:function(r,n,a){var o=this,s=this.props,l=s.tickLine,c=s.stroke,u=s.tick,d=s.tickFormatter,f=s.unit,p=w1(dn(dn({},this.props),{},{ticks:r}),n,a),h=this.getTickTextAnchor(),g=this.getTickVerticalAnchor(),b=mt(this.props,!1),y=mt(u,!1),v=dn(dn({},b),{},{fill:"none"},mt(l,!1)),k=p.map(function(N,w){var E=o.getTickLineCoord(N),C=E.line,O=E.tick,D=dn(dn(dn(dn({textAnchor:h,verticalAnchor:g},b),{},{stroke:"none",fill:c},y),O),{},{index:w,payload:N,visibleTicksCount:p.length,tickFormatter:d});return x.createElement(Rt,Yl({className:"recharts-cartesian-axis-tick",key:"tick-".concat(N.value,"-").concat(N.coordinate,"-").concat(N.tickCoord)},ti(o.props,N,w)),l&&x.createElement("line",Yl({},v,C,{className:Lt("recharts-cartesian-axis-tick-line",xa(l,"className"))})),u&&t.renderTickItem(u,D,"".concat(jt(d)?d(N.value,w):N.value).concat(f||"")))});return x.createElement("g",{className:"recharts-cartesian-axis-ticks"},k)}},{key:"render",value:function(){var r=this,n=this.props,a=n.axisLine,o=n.width,s=n.height,l=n.ticksGenerator,c=n.className,u=n.hide;if(u)return null;var d=this.props,f=d.ticks,p=jk(d,lce),h=f;return jt(l)&&(h=f&&f.length>0?l(this.props):l(p)),o<=0||s<=0||!h||!h.length?null:x.createElement(Rt,{className:Lt("recharts-cartesian-axis",c),ref:function(g){r.layerReference=g}},a&&this.renderAxisLine(),this.renderTicks(h,this.state.fontSize,this.state.letterSpacing),Nr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,n,a){var o,s=Lt(n.className,"recharts-cartesian-axis-tick-value");return x.isValidElement(r)?o=x.cloneElement(r,dn(dn({},n),{},{className:s})):jt(r)?o=r(dn(dn({},n),{},{className:s})):o=x.createElement(ll,Yl({},n,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])}(m.Component);j1(mu,"displayName","CartesianAxis");j1(mu,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var bce=["x1","y1","x2","y2","key"],yce=["offset"];function dl(e){"@babel/helpers - typeof";return dl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dl(e)}function fA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Mn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fA(Object(r),!0).forEach(function(n){xce(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xce(e,t,r){return t=vce(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vce(e){var t=kce(e,"string");return dl(t)=="symbol"?t:t+""}function kce(e,t){if(dl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(dl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Xi(){return Xi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Xi.apply(this,arguments)}function mA(e,t){if(e==null)return{};var r=wce(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function wce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var jce=function(e){var t=e.fill;if(!t||t==="none")return null;var r=e.fillOpacity,n=e.x,a=e.y,o=e.width,s=e.height,l=e.ry;return x.createElement("rect",{x:n,y:a,ry:l,width:o,height:s,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function GI(e,t){var r;if(x.isValidElement(e))r=x.cloneElement(e,t);else if(jt(e))r=e(t);else{var n=t.x1,a=t.y1,o=t.x2,s=t.y2,l=t.key,c=mA(t,bce),u=mt(c,!1);u.offset;var d=mA(u,yce);r=x.createElement("line",Xi({},d,{x1:n,y1:a,x2:o,y2:s,fill:"none",key:l}))}return r}function Nce(e){var t=e.x,r=e.width,n=e.horizontal,a=n===void 0?!0:n,o=e.horizontalPoints;if(!a||!o||!o.length)return null;var s=o.map(function(l,c){var u=Mn(Mn({},e),{},{x1:t,y1:l,x2:t+r,y2:l,key:"line-".concat(c),index:c});return GI(a,u)});return x.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function Ece(e){var t=e.y,r=e.height,n=e.vertical,a=n===void 0?!0:n,o=e.verticalPoints;if(!a||!o||!o.length)return null;var s=o.map(function(l,c){var u=Mn(Mn({},e),{},{x1:l,y1:t,x2:l,y2:t+r,key:"line-".concat(c),index:c});return GI(a,u)});return x.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function Sce(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,a=e.y,o=e.width,s=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=l.map(function(p){return Math.round(p+a-a)}).sort(function(p,h){return p-h});a!==d[0]&&d.unshift(0);var f=d.map(function(p,h){var g=!d[h+1],b=g?a+s-p:d[h+1]-p;if(b<=0)return null;var y=h%t.length;return x.createElement("rect",{key:"react-".concat(h),y:p,x:n,height:b,width:o,stroke:"none",fill:t[y],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return x.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Cce(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,a=e.fillOpacity,o=e.x,s=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!r||!n||!n.length)return null;var d=u.map(function(p){return Math.round(p+o-o)}).sort(function(p,h){return p-h});o!==d[0]&&d.unshift(0);var f=d.map(function(p,h){var g=!d[h+1],b=g?o+l-p:d[h+1]-p;if(b<=0)return null;var y=h%n.length;return x.createElement("rect",{key:"react-".concat(h),x:p,y:s,width:b,height:c,stroke:"none",fill:n[y],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return x.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Oce=function(e,t){var r=e.xAxis,n=e.width,a=e.height,o=e.offset;return Q_(w1(Mn(Mn(Mn({},mu.defaultProps),r),{},{ticks:Wo(r,!0),viewBox:{x:0,y:0,width:n,height:a}})),o.left,o.left+o.width,t)},Pce=function(e,t){var r=e.yAxis,n=e.width,a=e.height,o=e.offset;return Q_(w1(Mn(Mn(Mn({},mu.defaultProps),r),{},{ticks:Wo(r,!0),viewBox:{x:0,y:0,width:n,height:a}})),o.top,o.top+o.height,t)},Tl={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Uf(e){var t,r,n,a,o,s,l=y1(),c=x1(),u=gle(),d=Mn(Mn({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Tl.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Tl.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:Tl.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:Tl.horizontalFill,vertical:(o=e.vertical)!==null&&o!==void 0?o:Tl.vertical,verticalFill:(s=e.verticalFill)!==null&&s!==void 0?s:Tl.verticalFill,x:ze(e.x)?e.x:u.left,y:ze(e.y)?e.y:u.top,width:ze(e.width)?e.width:u.width,height:ze(e.height)?e.height:u.height}),f=d.x,p=d.y,h=d.width,g=d.height,b=d.syncWithTicks,y=d.horizontalValues,v=d.verticalValues,k=mle(),N=ple();if(!ze(h)||h<=0||!ze(g)||g<=0||!ze(f)||f!==+f||!ze(p)||p!==+p)return null;var w=d.verticalCoordinatesGenerator||Oce,E=d.horizontalCoordinatesGenerator||Pce,C=d.horizontalPoints,O=d.verticalPoints;if((!C||!C.length)&&jt(E)){var D=y&&y.length,A=E({yAxis:N?Mn(Mn({},N),{},{ticks:D?y:N.ticks}):void 0,width:l,height:c,offset:u},D?!0:b);Va(Array.isArray(A),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(dl(A),"]")),Array.isArray(A)&&(C=A)}if((!O||!O.length)&&jt(w)){var M=v&&v.length,I=w({xAxis:k?Mn(Mn({},k),{},{ticks:M?v:k.ticks}):void 0,width:l,height:c,offset:u},M?!0:b);Va(Array.isArray(I),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(dl(I),"]")),Array.isArray(I)&&(O=I)}return x.createElement("g",{className:"recharts-cartesian-grid"},x.createElement(jce,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),x.createElement(Nce,Xi({},d,{offset:u,horizontalPoints:C,xAxis:k,yAxis:N})),x.createElement(Ece,Xi({},d,{offset:u,verticalPoints:O,xAxis:k,yAxis:N})),x.createElement(Sce,Xi({},d,{horizontalPoints:C})),x.createElement(Cce,Xi({},d,{verticalPoints:O})))}Uf.displayName="CartesianGrid";var Ace=["type","layout","connectNulls","ref"],Mce=["key"];function Hc(e){"@babel/helpers - typeof";return Hc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hc(e)}function pA(e,t){if(e==null)return{};var r=Tce(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Tce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Nd(){return Nd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Nd.apply(this,arguments)}function hA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function aa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hA(Object(r),!0).forEach(function(n){za(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _l(e){return Lce(e)||Dce(e)||Ice(e)||_ce()}function _ce(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
93
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ice(e,t){if(e){if(typeof e=="string")return K2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return K2(e,t)}}function Dce(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Lce(e){if(Array.isArray(e))return K2(e)}function K2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Rce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gA(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,JI(n.key),n)}}function Fce(e,t,r){return t&&gA(e.prototype,t),r&&gA(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $ce(e,t,r){return t=Sh(t),Bce(e,ZI()?Reflect.construct(t,r||[],Sh(e).constructor):t.apply(e,r))}function Bce(e,t){if(t&&(Hc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hce(e)}function Hce(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ZI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ZI=function(){return!!e})()}function Sh(e){return Sh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sh(e)}function zce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Y2(e,t)}function Y2(e,t){return Y2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Y2(e,t)}function za(e,t,r){return t=JI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function JI(e){var t=Uce(e,"string");return Hc(t)=="symbol"?t:t+""}function Uce(e,t){if(Hc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Hc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ni=function(e){function t(){var r;Rce(this,t);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return r=$ce(this,t,[].concat(a)),za(r,"state",{isAnimationFinished:!0,totalLength:0}),za(r,"generateSimpleStrokeDasharray",function(s,l){return"".concat(l,"px ").concat(s-l,"px")}),za(r,"getStrokeDasharray",function(s,l,c){var u=c.reduce(function(v,k){return v+k});if(!u)return r.generateSimpleStrokeDasharray(l,s);for(var d=Math.floor(s/u),f=s%u,p=l-s,h=[],g=0,b=0;g<c.length;b+=c[g],++g)if(b+c[g]>f){h=[].concat(_l(c.slice(0,g)),[f-b]);break}var y=h.length%2===0?[0,p]:[p];return[].concat(_l(t.repeat(c,d)),_l(h),y).map(function(v){return"".concat(v,"px")}).join(", ")}),za(r,"id",fi("recharts-line-")),za(r,"pathRef",function(s){r.mainCurve=s}),za(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),za(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return zce(t,e),Fce(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,n){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,s=a.xAxis,l=a.yAxis,c=a.layout,u=a.children,d=zn(u,fu);if(!d)return null;var f=function(h,g){return{x:h.x,y:h.y,value:h.value,errorVal:Hr(h.payload,g)}},p={clipPath:r?"url(#clipPath-".concat(n,")"):null};return x.createElement(Rt,p,d.map(function(h){return x.cloneElement(h,{key:"bar-".concat(h.props.dataKey),data:o,xAxis:s,yAxis:l,layout:c,dataPointFormatter:f})}))}},{key:"renderDots",value:function(r,n,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var s=this.props,l=s.dot,c=s.points,u=s.dataKey,d=mt(this.props,!1),f=mt(l,!0),p=c.map(function(g,b){var y=aa(aa(aa({key:"dot-".concat(b),r:3},d),f),{},{index:b,cx:g.x,cy:g.y,value:g.value,dataKey:u,payload:g.payload,points:c});return t.renderDotItem(l,y)}),h={clipPath:r?"url(#clipPath-".concat(n?"":"dots-").concat(a,")"):null};return x.createElement(Rt,Nd({className:"recharts-line-dots",key:"dots"},h),p)}},{key:"renderCurveStatically",value:function(r,n,a,o){var s=this.props,l=s.type,c=s.layout,u=s.connectNulls;s.ref;var d=pA(s,Ace),f=aa(aa(aa({},mt(d,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:n?"url(#clipPath-".concat(a,")"):null,points:r},o),{},{type:l,layout:c,connectNulls:u});return x.createElement(Ys,Nd({},f,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,n){var a=this,o=this.props,s=o.points,l=o.strokeDasharray,c=o.isAnimationActive,u=o.animationBegin,d=o.animationDuration,f=o.animationEasing,p=o.animationId,h=o.animateNewValues,g=o.width,b=o.height,y=this.state,v=y.prevPoints,k=y.totalLength;return x.createElement(Ta,{begin:u,duration:d,isActive:c,easing:f,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(N){var w=N.t;if(v){var E=v.length/s.length,C=s.map(function(I,T){var R=Math.floor(T*E);if(v[R]){var L=v[R],F=Xr(L.x,I.x),V=Xr(L.y,I.y);return aa(aa({},I),{},{x:F(w),y:V(w)})}if(h){var H=Xr(g*2,I.x),$=Xr(b/2,I.y);return aa(aa({},I),{},{x:H(w),y:$(w)})}return aa(aa({},I),{},{x:I.x,y:I.y})});return a.renderCurveStatically(C,r,n)}var O=Xr(0,k),D=O(w),A;if(l){var M="".concat(l).split(/[,\s]+/gim).map(function(I){return parseFloat(I)});A=a.getStrokeDasharray(D,k,M)}else A=a.generateSimpleStrokeDasharray(k,D);return a.renderCurveStatically(s,r,n,{strokeDasharray:A})})}},{key:"renderCurve",value:function(r,n){var a=this.props,o=a.points,s=a.isAnimationActive,l=this.state,c=l.prevPoints,u=l.totalLength;return s&&o&&o.length&&(!c&&u>0||!ri(c,o))?this.renderCurveWithAnimation(r,n):this.renderCurveStatically(o,r,n)}},{key:"render",value:function(){var r,n=this.props,a=n.hide,o=n.dot,s=n.points,l=n.className,c=n.xAxis,u=n.yAxis,d=n.top,f=n.left,p=n.width,h=n.height,g=n.isAnimationActive,b=n.id;if(a||!s||!s.length)return null;var y=this.state.isAnimationFinished,v=s.length===1,k=Lt("recharts-line",l),N=c&&c.allowDataOverflow,w=u&&u.allowDataOverflow,E=N||w,C=vt(b)?this.id:b,O=(r=mt(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},D=O.r,A=D===void 0?3:D,M=O.strokeWidth,I=M===void 0?2:M,T=rT(o)?o:{},R=T.clipDot,L=R===void 0?!0:R,F=A*2+I;return x.createElement(Rt,{className:k},N||w?x.createElement("defs",null,x.createElement("clipPath",{id:"clipPath-".concat(C)},x.createElement("rect",{x:N?f:f-p/2,y:w?d:d-h/2,width:N?p:p*2,height:w?h:h*2})),!L&&x.createElement("clipPath",{id:"clipPath-dots-".concat(C)},x.createElement("rect",{x:f-F/2,y:d-F/2,width:p+F,height:h+F}))):null,!v&&this.renderCurve(E,C),this.renderErrorBar(E,C),(v||o)&&this.renderDots(E,L,C),(!g||y)&&Wa.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:n.curPoints}:r.points!==n.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,n){for(var a=r.length%2!==0?[].concat(_l(r),[0]):r,o=[],s=0;s<n;++s)o=[].concat(_l(o),_l(a));return o}},{key:"renderDotItem",value:function(r,n){var a;if(x.isValidElement(r))a=x.cloneElement(r,n);else if(jt(r))a=r(n);else{var o=n.key,s=pA(n,Mce),l=Lt("recharts-line-dot",typeof r!="boolean"?r.className:"");a=x.createElement(No,Nd({key:o},s,{className:l}))}return a}}])}(m.PureComponent);za(ni,"displayName","Line");za(ni,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!hs.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});za(ni,"getComposedData",function(e){var t=e.props,r=e.xAxis,n=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.dataKey,l=e.bandSize,c=e.displayedData,u=e.offset,d=t.layout,f=c.map(function(p,h){var g=Hr(p,s);return d==="horizontal"?{x:Pc({axis:r,ticks:a,bandSize:l,entry:p,index:h}),y:vt(g)?null:n.scale(g),value:g,payload:p}:{x:vt(g)?null:r.scale(g),y:Pc({axis:n,ticks:o,bandSize:l,entry:p,index:h}),value:g,payload:p}});return aa({points:f,layout:d},u)});var qce=["layout","type","stroke","connectNulls","isRange","ref"],Vce=["key"],QI;function zc(e){"@babel/helpers - typeof";return zc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zc(e)}function eD(e,t){if(e==null)return{};var r=Wce(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Wce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Gi(){return Gi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Gi.apply(this,arguments)}function bA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function As(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bA(Object(r),!0).forEach(function(n){lo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Kce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yA(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,rD(n.key),n)}}function Yce(e,t,r){return t&&yA(e.prototype,t),r&&yA(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xce(e,t,r){return t=Ch(t),Gce(e,tD()?Reflect.construct(t,r||[],Ch(e).constructor):t.apply(e,r))}function Gce(e,t){if(t&&(zc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Zce(e)}function Zce(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tD(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tD=function(){return!!e})()}function Ch(e){return Ch=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ch(e)}function Jce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&X2(e,t)}function X2(e,t){return X2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},X2(e,t)}function lo(e,t,r){return t=rD(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rD(e){var t=Qce(e,"string");return zc(t)=="symbol"?t:t+""}function Qce(e,t){if(zc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(zc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ys=function(e){function t(){var r;Kce(this,t);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return r=Xce(this,t,[].concat(a)),lo(r,"state",{isAnimationFinished:!0}),lo(r,"id",fi("recharts-area-")),lo(r,"handleAnimationEnd",function(){var s=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),jt(s)&&s()}),lo(r,"handleAnimationStart",function(){var s=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),jt(s)&&s()}),r}return Jce(t,e),Yce(t,[{key:"renderDots",value:function(r,n,a){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var l=this.props,c=l.dot,u=l.points,d=l.dataKey,f=mt(this.props,!1),p=mt(c,!0),h=u.map(function(b,y){var v=As(As(As({key:"dot-".concat(y),r:3},f),p),{},{index:y,cx:b.x,cy:b.y,dataKey:d,value:b.value,payload:b.payload,points:u});return t.renderDotItem(c,v)}),g={clipPath:r?"url(#clipPath-".concat(n?"":"dots-").concat(a,")"):null};return x.createElement(Rt,Gi({className:"recharts-area-dots"},g),h)}},{key:"renderHorizontalRect",value:function(r){var n=this.props,a=n.baseLine,o=n.points,s=n.strokeWidth,l=o[0].x,c=o[o.length-1].x,u=r*Math.abs(l-c),d=Fs(o.map(function(f){return f.y||0}));return ze(a)&&typeof a=="number"?d=Math.max(a,d):a&&Array.isArray(a)&&a.length&&(d=Math.max(Fs(a.map(function(f){return f.y||0})),d)),ze(d)?x.createElement("rect",{x:l<c?l:l-u,y:0,width:u,height:Math.floor(d+(s?parseInt("".concat(s),10):1))}):null}},{key:"renderVerticalRect",value:function(r){var n=this.props,a=n.baseLine,o=n.points,s=n.strokeWidth,l=o[0].y,c=o[o.length-1].y,u=r*Math.abs(l-c),d=Fs(o.map(function(f){return f.x||0}));return ze(a)&&typeof a=="number"?d=Math.max(a,d):a&&Array.isArray(a)&&a.length&&(d=Math.max(Fs(a.map(function(f){return f.x||0})),d)),ze(d)?x.createElement("rect",{x:0,y:l<c?l:l-u,width:d+(s?parseInt("".concat(s),10):1),height:Math.floor(u)}):null}},{key:"renderClipRect",value:function(r){var n=this.props.layout;return n==="vertical"?this.renderVerticalRect(r):this.renderHorizontalRect(r)}},{key:"renderAreaStatically",value:function(r,n,a,o){var s=this.props,l=s.layout,c=s.type,u=s.stroke,d=s.connectNulls,f=s.isRange;s.ref;var p=eD(s,qce);return x.createElement(Rt,{clipPath:a?"url(#clipPath-".concat(o,")"):null},x.createElement(Ys,Gi({},mt(p,!0),{points:r,connectNulls:d,type:c,baseLine:n,layout:l,stroke:"none",className:"recharts-area-area"})),u!=="none"&&x.createElement(Ys,Gi({},mt(this.props,!1),{className:"recharts-area-curve",layout:l,type:c,connectNulls:d,fill:"none",points:r})),u!=="none"&&f&&x.createElement(Ys,Gi({},mt(this.props,!1),{className:"recharts-area-curve",layout:l,type:c,connectNulls:d,fill:"none",points:n})))}},{key:"renderAreaWithAnimation",value:function(r,n){var a=this,o=this.props,s=o.points,l=o.baseLine,c=o.isAnimationActive,u=o.animationBegin,d=o.animationDuration,f=o.animationEasing,p=o.animationId,h=this.state,g=h.prevPoints,b=h.prevBaseLine;return x.createElement(Ta,{begin:u,duration:d,isActive:c,easing:f,from:{t:0},to:{t:1},key:"area-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(y){var v=y.t;if(g){var k=g.length/s.length,N=s.map(function(O,D){var A=Math.floor(D*k);if(g[A]){var M=g[A],I=Xr(M.x,O.x),T=Xr(M.y,O.y);return As(As({},O),{},{x:I(v),y:T(v)})}return O}),w;if(ze(l)&&typeof l=="number"){var E=Xr(b,l);w=E(v)}else if(vt(l)||iu(l)){var C=Xr(b,0);w=C(v)}else w=l.map(function(O,D){var A=Math.floor(D*k);if(b[A]){var M=b[A],I=Xr(M.x,O.x),T=Xr(M.y,O.y);return As(As({},O),{},{x:I(v),y:T(v)})}return O});return a.renderAreaStatically(N,w,r,n)}return x.createElement(Rt,null,x.createElement("defs",null,x.createElement("clipPath",{id:"animationClipPath-".concat(n)},a.renderClipRect(v))),x.createElement(Rt,{clipPath:"url(#animationClipPath-".concat(n,")")},a.renderAreaStatically(s,l,r,n)))})}},{key:"renderArea",value:function(r,n){var a=this.props,o=a.points,s=a.baseLine,l=a.isAnimationActive,c=this.state,u=c.prevPoints,d=c.prevBaseLine,f=c.totalLength;return l&&o&&o.length&&(!u&&f>0||!ri(u,o)||!ri(d,s))?this.renderAreaWithAnimation(r,n):this.renderAreaStatically(o,s,r,n)}},{key:"render",value:function(){var r,n=this.props,a=n.hide,o=n.dot,s=n.points,l=n.className,c=n.top,u=n.left,d=n.xAxis,f=n.yAxis,p=n.width,h=n.height,g=n.isAnimationActive,b=n.id;if(a||!s||!s.length)return null;var y=this.state.isAnimationFinished,v=s.length===1,k=Lt("recharts-area",l),N=d&&d.allowDataOverflow,w=f&&f.allowDataOverflow,E=N||w,C=vt(b)?this.id:b,O=(r=mt(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},D=O.r,A=D===void 0?3:D,M=O.strokeWidth,I=M===void 0?2:M,T=rT(o)?o:{},R=T.clipDot,L=R===void 0?!0:R,F=A*2+I;return x.createElement(Rt,{className:k},N||w?x.createElement("defs",null,x.createElement("clipPath",{id:"clipPath-".concat(C)},x.createElement("rect",{x:N?u:u-p/2,y:w?c:c-h/2,width:N?p:p*2,height:w?h:h*2})),!L&&x.createElement("clipPath",{id:"clipPath-dots-".concat(C)},x.createElement("rect",{x:u-F/2,y:c-F/2,width:p+F,height:h+F}))):null,v?null:this.renderArea(E,C),(o||v)&&this.renderDots(E,L,C),(!g||y)&&Wa.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:n.curPoints,prevBaseLine:n.curBaseLine}:r.points!==n.curPoints||r.baseLine!==n.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(m.PureComponent);QI=ys;lo(ys,"displayName","Area");lo(ys,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!hs.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});lo(ys,"getBaseValue",function(e,t,r,n){var a=e.layout,o=e.baseValue,s=t.props.baseValue,l=s??o;if(ze(l)&&typeof l=="number")return l;var c=a==="horizontal"?n:r,u=c.scale.domain();if(c.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});lo(ys,"getComposedData",function(e){var t=e.props,r=e.item,n=e.xAxis,a=e.yAxis,o=e.xAxisTicks,s=e.yAxisTicks,l=e.bandSize,c=e.dataKey,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,p=e.offset,h=t.layout,g=u&&u.length,b=QI.getBaseValue(t,r,n,a),y=h==="horizontal",v=!1,k=f.map(function(w,E){var C;g?C=u[d+E]:(C=Hr(w,c),Array.isArray(C)?v=!0:C=[b,C]);var O=C[1]==null||g&&Hr(w,c)==null;return y?{x:Pc({axis:n,ticks:o,bandSize:l,entry:w,index:E}),y:O?null:a.scale(C[1]),value:C,payload:w}:{x:O?null:n.scale(C[1]),y:Pc({axis:a,ticks:s,bandSize:l,entry:w,index:E}),value:C,payload:w}}),N;return g||v?N=k.map(function(w){var E=Array.isArray(w.value)?w.value[0]:null;return y?{x:w.x,y:E!=null&&w.y!=null?a.scale(E):null}:{x:E!=null?n.scale(E):null,y:w.y}}):N=y?a.scale(b):n.scale(b),As({points:k,baseLine:N,layout:h,isRange:v},p)});lo(ys,"renderDotItem",function(e,t){var r;if(x.isValidElement(e))r=x.cloneElement(e,t);else if(jt(e))r=e(t);else{var n=Lt("recharts-area-dot",typeof e!="boolean"?e.className:""),a=t.key,o=eD(t,Vce);r=x.createElement(No,Gi({},o,{key:a,className:n}))}return r});function Uc(e){"@babel/helpers - typeof";return Uc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uc(e)}function eue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,oD(n.key),n)}}function rue(e,t,r){return t&&tue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function nue(e,t,r){return t=Oh(t),aue(e,nD()?Reflect.construct(t,r||[],Oh(e).constructor):t.apply(e,r))}function aue(e,t){if(t&&(Uc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return oue(e)}function oue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nD(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nD=function(){return!!e})()}function Oh(e){return Oh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oh(e)}function sue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&G2(e,t)}function G2(e,t){return G2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},G2(e,t)}function aD(e,t,r){return t=oD(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oD(e){var t=iue(e,"string");return Uc(t)=="symbol"?t:t+""}function iue(e,t){if(Uc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Uc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var qf=function(e){function t(){return eue(this,t),nue(this,t,arguments)}return sue(t,e),rue(t,[{key:"render",value:function(){return null}}])}(m.Component);aD(qf,"displayName","ZAxis");aD(qf,"defaultProps",{zAxisId:0,range:[64,64],scale:"auto",type:"number"});var lue=["option","isActive"];function Ed(){return Ed=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ed.apply(this,arguments)}function cue(e,t){if(e==null)return{};var r=uue(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function uue(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function due(e){var t=e.option,r=e.isActive,n=cue(e,lue);return typeof t=="string"?m.createElement(ph,Ed({option:m.createElement(_g,Ed({type:t},n)),isActive:r,shapeType:"symbols"},n)):m.createElement(ph,Ed({option:t,isActive:r,shapeType:"symbols"},n))}function qc(e){"@babel/helpers - typeof";return qc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qc(e)}function Sd(){return Sd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sd.apply(this,arguments)}function xA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Sa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xA(Object(r),!0).forEach(function(n){Bs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vA(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,iD(n.key),n)}}function mue(e,t,r){return t&&vA(e.prototype,t),r&&vA(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function pue(e,t,r){return t=Ph(t),hue(e,sD()?Reflect.construct(t,r||[],Ph(e).constructor):t.apply(e,r))}function hue(e,t){if(t&&(qc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gue(e)}function gue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sD(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sD=function(){return!!e})()}function Ph(e){return Ph=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ph(e)}function bue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Z2(e,t)}function Z2(e,t){return Z2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Z2(e,t)}function Bs(e,t,r){return t=iD(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iD(e){var t=yue(e,"string");return qc(t)=="symbol"?t:t+""}function yue(e,t){if(qc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(qc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Vf=function(e){function t(){var r;fue(this,t);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return r=pue(this,t,[].concat(a)),Bs(r,"state",{isAnimationFinished:!1}),Bs(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0})}),Bs(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1})}),Bs(r,"id",fi("recharts-scatter-")),r}return bue(t,e),mue(t,[{key:"renderSymbolsStatically",value:function(r){var n=this,a=this.props,o=a.shape,s=a.activeShape,l=a.activeIndex,c=mt(this.props,!1);return r.map(function(u,d){var f=l===d,p=f?s:o,h=Sa(Sa({},c),u);return x.createElement(Rt,Sd({className:"recharts-scatter-symbol",key:"symbol-".concat(u?.cx,"-").concat(u?.cy,"-").concat(u?.size,"-").concat(d)},ti(n.props,u,d),{role:"img"}),x.createElement(due,Sd({option:p,isActive:f,key:"symbol-".concat(d)},h)))})}},{key:"renderSymbolsWithAnimation",value:function(){var r=this,n=this.props,a=n.points,o=n.isAnimationActive,s=n.animationBegin,l=n.animationDuration,c=n.animationEasing,u=n.animationId,d=this.state.prevPoints;return x.createElement(Ta,{begin:s,duration:l,isActive:o,easing:c,from:{t:0},to:{t:1},key:"pie-".concat(u),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(f){var p=f.t,h=a.map(function(g,b){var y=d&&d[b];if(y){var v=Xr(y.cx,g.cx),k=Xr(y.cy,g.cy),N=Xr(y.size,g.size);return Sa(Sa({},g),{},{cx:v(p),cy:k(p),size:N(p)})}var w=Xr(0,g.size);return Sa(Sa({},g),{},{size:w(p)})});return x.createElement(Rt,null,r.renderSymbolsStatically(h))})}},{key:"renderSymbols",value:function(){var r=this.props,n=r.points,a=r.isAnimationActive,o=this.state.prevPoints;return a&&n&&n.length&&(!o||!ri(o,n))?this.renderSymbolsWithAnimation():this.renderSymbolsStatically(n)}},{key:"renderErrorBar",value:function(){var r=this.props.isAnimationActive;if(r&&!this.state.isAnimationFinished)return null;var n=this.props,a=n.points,o=n.xAxis,s=n.yAxis,l=n.children,c=zn(l,fu);return c?c.map(function(u,d){var f=u.props,p=f.direction,h=f.dataKey;return x.cloneElement(u,{key:"".concat(p,"-").concat(h,"-").concat(a[d]),data:a,xAxis:o,yAxis:s,layout:p==="x"?"vertical":"horizontal",dataPointFormatter:function(g,b){return{x:g.cx,y:g.cy,value:p==="x"?+g.node.x:+g.node.y,errorVal:Hr(g,b)}}})}):null}},{key:"renderLine",value:function(){var r=this.props,n=r.points,a=r.line,o=r.lineType,s=r.lineJointType,l=mt(this.props,!1),c=mt(a,!1),u,d;if(o==="joint")u=n.map(function(k){return{x:k.cx,y:k.cy}});else if(o==="fitting"){var f=iY(n),p=f.xmin,h=f.xmax,g=f.a,b=f.b,y=function(k){return g*k+b};u=[{x:p,y:y(p)},{x:h,y:y(h)}]}var v=Sa(Sa(Sa({},l),{},{fill:"none",stroke:l&&l.fill},c),{},{points:u});return x.isValidElement(a)?d=x.cloneElement(a,v):jt(a)?d=a(v):d=x.createElement(Ys,Sd({},v,{type:s})),x.createElement(Rt,{className:"recharts-scatter-line",key:"recharts-scatter-line"},d)}},{key:"render",value:function(){var r=this.props,n=r.hide,a=r.points,o=r.line,s=r.className,l=r.xAxis,c=r.yAxis,u=r.left,d=r.top,f=r.width,p=r.height,h=r.id,g=r.isAnimationActive;if(n||!a||!a.length)return null;var b=this.state.isAnimationFinished,y=Lt("recharts-scatter",s),v=l&&l.allowDataOverflow,k=c&&c.allowDataOverflow,N=v||k,w=vt(h)?this.id:h;return x.createElement(Rt,{className:y,clipPath:N?"url(#clipPath-".concat(w,")"):null},v||k?x.createElement("defs",null,x.createElement("clipPath",{id:"clipPath-".concat(w)},x.createElement("rect",{x:v?u:u-f/2,y:k?d:d-p/2,width:v?f:f*2,height:k?p:p*2}))):null,o&&this.renderLine(),this.renderErrorBar(),x.createElement(Rt,{key:"recharts-scatter-symbols"},this.renderSymbols()),(!g||b)&&Wa.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:n.curPoints}:r.points!==n.curPoints?{curPoints:r.points}:null}}])}(m.PureComponent);Bs(Vf,"displayName","Scatter");Bs(Vf,"defaultProps",{xAxisId:0,yAxisId:0,zAxisId:0,legendType:"circle",lineType:"joint",lineJointType:"linear",data:[],shape:"circle",hide:!1,isAnimationActive:!hs.isSsr,animationBegin:0,animationDuration:400,animationEasing:"linear"});Bs(Vf,"getComposedData",function(e){var t=e.xAxis,r=e.yAxis,n=e.zAxis,a=e.item,o=e.displayedData,s=e.xAxisTicks,l=e.yAxisTicks,c=e.offset,u=a.props.tooltipType,d=zn(a.props.children,Rg),f=vt(t.dataKey)?a.props.dataKey:t.dataKey,p=vt(r.dataKey)?a.props.dataKey:r.dataKey,h=n&&n.dataKey,g=n?n.range:qf.defaultProps.range,b=g&&g[0],y=t.scale.bandwidth?t.scale.bandwidth():0,v=r.scale.bandwidth?r.scale.bandwidth():0,k=o.map(function(N,w){var E=Hr(N,f),C=Hr(N,p),O=!vt(h)&&Hr(N,h)||"-",D=[{name:vt(t.dataKey)?a.props.name:t.name||t.dataKey,unit:t.unit||"",value:E,payload:N,dataKey:f,type:u},{name:vt(r.dataKey)?a.props.name:r.name||r.dataKey,unit:r.unit||"",value:C,payload:N,dataKey:p,type:u}];O!=="-"&&D.push({name:n.name||n.dataKey,unit:n.unit||"",value:O,payload:N,dataKey:h,type:u});var A=Pc({axis:t,ticks:s,bandSize:y,entry:N,index:w,dataKey:f}),M=Pc({axis:r,ticks:l,bandSize:v,entry:N,index:w,dataKey:p}),I=O!=="-"?n.scale(O):b,T=Math.sqrt(Math.max(I,0)/Math.PI);return Sa(Sa({},N),{},{cx:A,cy:M,x:A-T,y:M-T,xAxis:t,yAxis:r,zAxis:n,width:2*T,height:2*T,size:I,node:{x:E,y:C,z:O},tooltipPayload:D,tooltipPosition:{x:A,y:M},payload:N},d&&d[w]&&d[w].props)});return Sa({points:k},c)});function Vc(e){"@babel/helpers - typeof";return Vc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vc(e)}function xue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,uD(n.key),n)}}function kue(e,t,r){return t&&vue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function wue(e,t,r){return t=Ah(t),jue(e,lD()?Reflect.construct(t,r||[],Ah(e).constructor):t.apply(e,r))}function jue(e,t){if(t&&(Vc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nue(e)}function Nue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lD(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lD=function(){return!!e})()}function Ah(e){return Ah=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ah(e)}function Eue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&J2(e,t)}function J2(e,t){return J2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},J2(e,t)}function cD(e,t,r){return t=uD(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uD(e){var t=Sue(e,"string");return Vc(t)=="symbol"?t:t+""}function Sue(e,t){if(Vc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Vc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Q2(){return Q2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Q2.apply(this,arguments)}function Cue(e){var t=e.xAxisId,r=y1(),n=x1(),a=$I(t);return a==null?null:m.createElement(mu,Q2({},a,{className:Lt("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(o){return Wo(o,!0)}}))}var Xn=function(e){function t(){return xue(this,t),wue(this,t,arguments)}return Eue(t,e),kue(t,[{key:"render",value:function(){return m.createElement(Cue,this.props)}}])}(m.Component);cD(Xn,"displayName","XAxis");cD(Xn,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function Wc(e){"@babel/helpers - typeof";return Wc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wc(e)}function Oue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,mD(n.key),n)}}function Aue(e,t,r){return t&&Pue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mue(e,t,r){return t=Mh(t),Tue(e,dD()?Reflect.construct(t,r||[],Mh(e).constructor):t.apply(e,r))}function Tue(e,t){if(t&&(Wc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _ue(e)}function _ue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dD(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dD=function(){return!!e})()}function Mh(e){return Mh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mh(e)}function Iue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ej(e,t)}function ej(e,t){return ej=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},ej(e,t)}function fD(e,t,r){return t=mD(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mD(e){var t=Due(e,"string");return Wc(t)=="symbol"?t:t+""}function Due(e,t){if(Wc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Wc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function tj(){return tj=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tj.apply(this,arguments)}var Lue=function(e){var t=e.yAxisId,r=y1(),n=x1(),a=BI(t);return a==null?null:m.createElement(mu,tj({},a,{className:Lt("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(o){return Wo(o,!0)}}))},Gn=function(e){function t(){return Oue(this,t),Mue(this,t,arguments)}return Iue(t,e),Aue(t,[{key:"render",value:function(){return m.createElement(Lue,this.props)}}])}(m.Component);fD(Gn,"displayName","YAxis");fD(Gn,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function kA(e){return Bue(e)||$ue(e)||Fue(e)||Rue()}function Rue(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
94
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fue(e,t){if(e){if(typeof e=="string")return rj(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rj(e,t)}}function $ue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Bue(e){if(Array.isArray(e))return rj(e)}function rj(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var nj=function(e,t,r,n,a){var o=zn(e,k1),s=zn(e,nb),l=[].concat(kA(o),kA(s)),c=zn(e,ob),u="".concat(n,"Id"),d=n[0],f=t;if(l.length&&(f=l.reduce(function(g,b){if(b.props[u]===r&&yo(b.props,"extendDomain")&&ze(b.props[d])){var y=b.props[d];return[Math.min(g[0],y),Math.max(g[1],y)]}return g},f)),c.length){var p="".concat(d,"1"),h="".concat(d,"2");f=c.reduce(function(g,b){if(b.props[u]===r&&yo(b.props,"extendDomain")&&ze(b.props[p])&&ze(b.props[h])){var y=b.props[p],v=b.props[h];return[Math.min(g[0],y,v),Math.max(g[1],y,v)]}return g},f)}return a&&a.length&&(f=a.reduce(function(g,b){return ze(b)?[Math.min(g[0],b),Math.max(g[1],b)]:g},f)),f},wA={exports:{}},jA;function Hue(){return jA||(jA=1,function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function a(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function o(c,u,d,f,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new a(d,f||c,p),g=r?r+u:u;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],h]:c._events[g].push(h):(c._events[g]=h,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],u,d;if(this._eventsCount===0)return c;for(d in u=this._events)t.call(u,d)&&c.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},l.prototype.listeners=function(c){var u=r?r+c:c,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var f=0,p=d.length,h=new Array(p);f<p;f++)h[f]=d[f].fn;return h},l.prototype.listenerCount=function(c){var u=r?r+c:c,d=this._events[u];return d?d.fn?1:d.length:0},l.prototype.emit=function(c,u,d,f,p,h){var g=r?r+c:c;if(!this._events[g])return!1;var b=this._events[g],y=arguments.length,v,k;if(b.fn){switch(b.once&&this.removeListener(c,b.fn,void 0,!0),y){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,u),!0;case 3:return b.fn.call(b.context,u,d),!0;case 4:return b.fn.call(b.context,u,d,f),!0;case 5:return b.fn.call(b.context,u,d,f,p),!0;case 6:return b.fn.call(b.context,u,d,f,p,h),!0}for(k=1,v=new Array(y-1);k<y;k++)v[k-1]=arguments[k];b.fn.apply(b.context,v)}else{var N=b.length,w;for(k=0;k<N;k++)switch(b[k].once&&this.removeListener(c,b[k].fn,void 0,!0),y){case 1:b[k].fn.call(b[k].context);break;case 2:b[k].fn.call(b[k].context,u);break;case 3:b[k].fn.call(b[k].context,u,d);break;case 4:b[k].fn.call(b[k].context,u,d,f);break;default:if(!v)for(w=1,v=new Array(y-1);w<y;w++)v[w-1]=arguments[w];b[k].fn.apply(b[k].context,v)}}return!0},l.prototype.on=function(c,u,d){return o(this,c,u,d,!1)},l.prototype.once=function(c,u,d){return o(this,c,u,d,!0)},l.prototype.removeListener=function(c,u,d,f){var p=r?r+c:c;if(!this._events[p])return this;if(!u)return s(this,p),this;var h=this._events[p];if(h.fn)h.fn===u&&(!f||h.once)&&(!d||h.context===d)&&s(this,p);else{for(var g=0,b=[],y=h.length;g<y;g++)(h[g].fn!==u||f&&!h[g].once||d&&h[g].context!==d)&&b.push(h[g]);b.length?this._events[p]=b.length===1?b[0]:b:s(this,p)}return this},l.prototype.removeAllListeners=function(c){var u;return c?(u=r?r+c:c,this._events[u]&&s(this,u)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,e.exports=l}(wA)),wA.exports}var zue=Hue();const Uue=mr(zue);var Nk=new Uue,Ek="recharts.syncMouseEvents";function hf(e){"@babel/helpers - typeof";return hf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hf(e)}function que(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,pD(n.key),n)}}function Wue(e,t,r){return t&&Vue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sk(e,t,r){return t=pD(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pD(e){var t=Kue(e,"string");return hf(t)=="symbol"?t:t+""}function Kue(e,t){if(hf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(hf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Yue=function(){function e(){que(this,e),Sk(this,"activeIndex",0),Sk(this,"coordinateList",[]),Sk(this,"layout","horizontal")}return Wue(e,[{key:"setDetails",value:function(t){var r,n=t.coordinateList,a=n===void 0?null:n,o=t.container,s=o===void 0?null:o,l=t.layout,c=l===void 0?null:l,u=t.offset,d=u===void 0?null:u,f=t.mouseHandlerCallback,p=f===void 0?null:f;this.coordinateList=(r=a??this.coordinateList)!==null&&r!==void 0?r:[],this.container=s??this.container,this.layout=c??this.layout,this.offset=d??this.offset,this.mouseHandlerCallback=p??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(t){if(this.coordinateList.length!==0)switch(t.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(t){this.activeIndex=t}},{key:"spoofMouse",value:function(){var t,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var n=this.container.getBoundingClientRect(),a=n.x,o=n.y,s=n.height,l=this.coordinateList[this.activeIndex].coordinate,c=((t=window)===null||t===void 0?void 0:t.scrollX)||0,u=((r=window)===null||r===void 0?void 0:r.scrollY)||0,d=a+l+c,f=o+this.offset.top+s/2+u;this.mouseHandlerCallback({pageX:d,pageY:f})}}}])}();function Xue(e,t,r){if(r==="number"&&t===!0&&Array.isArray(e)){var n=e?.[0],a=e?.[1];if(n&&a&&ze(n)&&ze(a))return!0}return!1}function Gue(e,t,r,n){var a=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-a:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-a,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function hD(e){var t=e.cx,r=e.cy,n=e.radius,a=e.startAngle,o=e.endAngle,s=_r(t,r,n,a),l=_r(t,r,n,o);return{points:[s,l],cx:t,cy:r,radius:n,startAngle:a,endAngle:o}}function Zue(e,t,r){var n,a,o,s;if(e==="horizontal")n=t.x,o=n,a=r.top,s=r.top+r.height;else if(e==="vertical")a=t.y,s=a,n=r.left,o=r.left+r.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,c=t.cy,u=t.innerRadius,d=t.outerRadius,f=t.angle,p=_r(l,c,u,f),h=_r(l,c,d,f);n=p.x,a=p.y,o=h.x,s=h.y}else return hD(t);return[{x:n,y:a},{x:o,y:s}]}function gf(e){"@babel/helpers - typeof";return gf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gf(e)}function NA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Um(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?NA(Object(r),!0).forEach(function(n){Jue(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Jue(e,t,r){return t=Que(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Que(e){var t=ede(e,"string");return gf(t)=="symbol"?t:t+""}function ede(e,t){if(gf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(gf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tde(e){var t,r,n=e.element,a=e.tooltipEventType,o=e.isActive,s=e.activeCoordinate,l=e.activePayload,c=e.offset,u=e.activeTooltipIndex,d=e.tooltipAxisBandSize,f=e.layout,p=e.chartName,h=(t=n.props.cursor)!==null&&t!==void 0?t:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!h||!o||!s||p!=="ScatterChart"&&a!=="axis")return null;var g,b=Ys;if(p==="ScatterChart")g=s,b=Koe;else if(p==="BarChart")g=Gue(f,s,c,d),b=p1;else if(f==="radial"){var y=hD(s),v=y.cx,k=y.cy,N=y.radius,w=y.startAngle,E=y.endAngle;g={cx:v,cy:k,startAngle:w,endAngle:E,innerRadius:N,outerRadius:N},b=m1}else g={points:Zue(f,s,c)},b=Ys;var C=Um(Um(Um(Um({stroke:"#ccc",pointerEvents:"none"},c),g),mt(h,!1)),{},{payload:l,payloadIndex:u,className:Lt("recharts-tooltip-cursor",h.className)});return m.isValidElement(h)?m.cloneElement(h,C):m.createElement(b,C)}var rde=["item"],nde=["children","className","width","height","style","compact","title","desc"];function Kc(e){"@babel/helpers - typeof";return Kc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kc(e)}function Xl(){return Xl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Xl.apply(this,arguments)}function EA(e,t){return sde(e)||ode(e,t)||bD(e,t)||ade()}function ade(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
95
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ode(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,s,l=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(c=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function sde(e){if(Array.isArray(e))return e}function SA(e,t){if(e==null)return{};var r=ide(e,t),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function ide(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function lde(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cde(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,yD(n.key),n)}}function ude(e,t,r){return t&&cde(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function dde(e,t,r){return t=Th(t),fde(e,gD()?Reflect.construct(t,r||[],Th(e).constructor):t.apply(e,r))}function fde(e,t){if(t&&(Kc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mde(e)}function mde(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gD(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gD=function(){return!!e})()}function Th(e){return Th=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Th(e)}function pde(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&aj(e,t)}function aj(e,t){return aj=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},aj(e,t)}function Yc(e){return bde(e)||gde(e)||bD(e)||hde()}function hde(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
96
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bD(e,t){if(e){if(typeof e=="string")return oj(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return oj(e,t)}}function gde(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function bde(e){if(Array.isArray(e))return oj(e)}function oj(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function CA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ce(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?CA(Object(r),!0).forEach(function(n){St(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function St(e,t,r){return t=yD(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yD(e){var t=yde(e,"string");return Kc(t)=="symbol"?t:t+""}function yde(e,t){if(Kc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Kc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var xde={xAxis:["bottom","top"],yAxis:["left","right"]},vde={width:"100%",height:"100%"},xD={x:0,y:0};function qm(e){return e}var kde=function(e,t){return t==="horizontal"?e.x:t==="vertical"?e.y:t==="centric"?e.angle:e.radius},wde=function(e,t,r,n){var a=t.find(function(u){return u&&u.index===r});if(a){if(e==="horizontal")return{x:a.coordinate,y:n.y};if(e==="vertical")return{x:n.x,y:a.coordinate};if(e==="centric"){var o=a.coordinate,s=n.radius;return Ce(Ce(Ce({},n),_r(n.cx,n.cy,s,o)),{},{angle:o,radius:s})}var l=a.coordinate,c=n.angle;return Ce(Ce(Ce({},n),_r(n.cx,n.cy,l,c)),{},{angle:c,radius:l})}return xD},sb=function(e,t){var r=t.graphicalItems,n=t.dataStartIndex,a=t.dataEndIndex,o=(r??[]).reduce(function(s,l){var c=l.props.data;return c&&c.length?[].concat(Yc(s),Yc(c)):s},[]);return o.length>0?o:e&&e.length&&ze(n)&&ze(a)?e.slice(n,a+1):[]};function vD(e){return e==="number"?[0,"auto"]:void 0}var sj=function(e,t,r,n){var a=e.graphicalItems,o=e.tooltipAxis,s=sb(t,e);return r<0||!a||!a.length||r>=s.length?null:a.reduce(function(l,c){var u,d=(u=c.props.data)!==null&&u!==void 0?u:t;d&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=r&&(d=d.slice(e.dataStartIndex,e.dataEndIndex+1));var f;if(o.dataKey&&!o.allowDuplicatedCategory){var p=d===void 0?s:d;f=Ap(p,o.dataKey,n)}else f=d&&d[r]||s[r];return f?[].concat(Yc(l),[aI(c,f)]):l},[])},OA=function(e,t,r,n){var a=n||{x:e.chartX,y:e.chartY},o=kde(a,r),s=e.orderedTooltipTicks,l=e.tooltipAxis,c=e.tooltipTicks,u=pre(o,s,c,l);if(u>=0&&c){var d=c[u]&&c[u].value,f=sj(e,t,u,d),p=wde(r,s,u,a);return{activeTooltipIndex:u,activeLabel:d,activePayload:f,activeCoordinate:p}}return null},jde=function(e,t){var r=t.axes,n=t.graphicalItems,a=t.axisType,o=t.axisIdKey,s=t.stackGroups,l=t.dataStartIndex,c=t.dataEndIndex,u=e.layout,d=e.children,f=e.stackOffset,p=J_(u,a);return r.reduce(function(h,g){var b,y=g.type.defaultProps!==void 0?Ce(Ce({},g.type.defaultProps),g.props):g.props,v=y.type,k=y.dataKey,N=y.allowDataOverflow,w=y.allowDuplicatedCategory,E=y.scale,C=y.ticks,O=y.includeHidden,D=y[o];if(h[D])return h;var A=sb(e.data,{graphicalItems:n.filter(function(U){var X,Y=o in U.props?U.props[o]:(X=U.type.defaultProps)===null||X===void 0?void 0:X[o];return Y===D}),dataStartIndex:l,dataEndIndex:c}),M=A.length,I,T,R;Xue(y.domain,N,v)&&(I=b2(y.domain,null,N),p&&(v==="number"||E!=="auto")&&(R=lp(A,k,"category")));var L=vD(v);if(!I||I.length===0){var F,V=(F=y.domain)!==null&&F!==void 0?F:L;if(k){if(I=lp(A,k,v),v==="category"&&p){var H=sY(I);w&&H?(T=I,I=gh(0,M)):w||(I=S6(V,I,g).reduce(function(U,X){return U.indexOf(X)>=0?U:[].concat(Yc(U),[X])},[]))}else if(v==="category")w?I=I.filter(function(U){return U!==""&&!vt(U)}):I=S6(V,I,g).reduce(function(U,X){return U.indexOf(X)>=0||X===""||vt(X)?U:[].concat(Yc(U),[X])},[]);else if(v==="number"){var $=xre(A,n.filter(function(U){var X,Y,ae=o in U.props?U.props[o]:(X=U.type.defaultProps)===null||X===void 0?void 0:X[o],G="hide"in U.props?U.props.hide:(Y=U.type.defaultProps)===null||Y===void 0?void 0:Y.hide;return ae===D&&(O||!G)}),k,a,u);$&&(I=$)}p&&(v==="number"||E!=="auto")&&(R=lp(A,k,"category"))}else p?I=gh(0,M):s&&s[D]&&s[D].hasStack&&v==="number"?I=f==="expand"?[0,1]:nI(s[D].stackGroups,l,c):I=Z_(A,n.filter(function(U){var X=o in U.props?U.props[o]:U.type.defaultProps[o],Y="hide"in U.props?U.props.hide:U.type.defaultProps.hide;return X===D&&(O||!Y)}),v,u,!0);if(v==="number")I=nj(d,I,D,a,C),V&&(I=b2(V,I,N));else if(v==="category"&&V){var z=V,W=I.every(function(U){return z.indexOf(U)>=0});W&&(I=z)}}return Ce(Ce({},h),{},St({},D,Ce(Ce({},y),{},{axisType:a,domain:I,categoricalDomain:R,duplicateDomain:T,originalDomain:(b=y.domain)!==null&&b!==void 0?b:L,isCategorical:p,layout:u})))},{})},Nde=function(e,t){var r=t.graphicalItems,n=t.Axis,a=t.axisType,o=t.axisIdKey,s=t.stackGroups,l=t.dataStartIndex,c=t.dataEndIndex,u=e.layout,d=e.children,f=sb(e.data,{graphicalItems:r,dataStartIndex:l,dataEndIndex:c}),p=f.length,h=J_(u,a),g=-1;return r.reduce(function(b,y){var v=y.type.defaultProps!==void 0?Ce(Ce({},y.type.defaultProps),y.props):y.props,k=v[o],N=vD("number");if(!b[k]){g++;var w;return h?w=gh(0,p):s&&s[k]&&s[k].hasStack?(w=nI(s[k].stackGroups,l,c),w=nj(d,w,k,a)):(w=b2(N,Z_(f,r.filter(function(E){var C,O,D=o in E.props?E.props[o]:(C=E.type.defaultProps)===null||C===void 0?void 0:C[o],A="hide"in E.props?E.props.hide:(O=E.type.defaultProps)===null||O===void 0?void 0:O.hide;return D===k&&!A}),"number",u),n.defaultProps.allowDataOverflow),w=nj(d,w,k,a)),Ce(Ce({},b),{},St({},k,Ce(Ce({axisType:a},n.defaultProps),{},{hide:!0,orientation:xa(xde,"".concat(a,".").concat(g%2),null),domain:w,originalDomain:N,isCategorical:h,layout:u})))}return b},{})},Ede=function(e,t){var r=t.axisType,n=r===void 0?"xAxis":r,a=t.AxisComp,o=t.graphicalItems,s=t.stackGroups,l=t.dataStartIndex,c=t.dataEndIndex,u=e.children,d="".concat(n,"Id"),f=zn(u,a),p={};return f&&f.length?p=jde(e,{axes:f,graphicalItems:o,axisType:n,axisIdKey:d,stackGroups:s,dataStartIndex:l,dataEndIndex:c}):o&&o.length&&(p=Nde(e,{Axis:a,graphicalItems:o,axisType:n,axisIdKey:d,stackGroups:s,dataStartIndex:l,dataEndIndex:c})),p},Sde=function(e){var t=Ds(e),r=Wo(t,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:BN(r,function(n){return n.coordinate}),tooltipAxis:t,tooltipAxisBandSize:rh(t,r)}},PA=function(e){var t=e.children,r=e.defaultShowTooltip,n=sa(t,Dc),a=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),n&&n.props&&(n.props.startIndex>=0&&(a=n.props.startIndex),n.props.endIndex>=0&&(o=n.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},Cde=function(e){return!e||!e.length?!1:e.some(function(t){var r=Go(t&&t.type);return r&&r.indexOf("Bar")>=0})},AA=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Ode=function(e,t){var r=e.props,n=e.graphicalItems,a=e.xAxisMap,o=a===void 0?{}:a,s=e.yAxisMap,l=s===void 0?{}:s,c=r.width,u=r.height,d=r.children,f=r.margin||{},p=sa(d,Dc),h=sa(d,go),g=Object.keys(l).reduce(function(w,E){var C=l[E],O=C.orientation;return!C.mirror&&!C.hide?Ce(Ce({},w),{},St({},O,w[O]+C.width)):w},{left:f.left||0,right:f.right||0}),b=Object.keys(o).reduce(function(w,E){var C=o[E],O=C.orientation;return!C.mirror&&!C.hide?Ce(Ce({},w),{},St({},O,xa(w,"".concat(O))+C.height)):w},{top:f.top||0,bottom:f.bottom||0}),y=Ce(Ce({},b),g),v=y.bottom;p&&(y.bottom+=p.props.height||Dc.defaultProps.height),h&&t&&(y=bre(y,n,r,t));var k=c-y.left-y.right,N=u-y.top-y.bottom;return Ce(Ce({brushBottom:v},y),{},{width:Math.max(k,0),height:Math.max(N,0)})},Pde=function(e,t){if(t==="xAxis")return e[t].width;if(t==="yAxis")return e[t].height},Wf=function(e){var t=e.chartName,r=e.GraphicalChild,n=e.defaultTooltipEventType,a=n===void 0?"axis":n,o=e.validateTooltipEventTypes,s=o===void 0?["axis"]:o,l=e.axisComponents,c=e.legendContent,u=e.formatAxisMap,d=e.defaultProps,f=function(b,y){var v=y.graphicalItems,k=y.stackGroups,N=y.offset,w=y.updateId,E=y.dataStartIndex,C=y.dataEndIndex,O=b.barSize,D=b.layout,A=b.barGap,M=b.barCategoryGap,I=b.maxBarSize,T=AA(D),R=T.numericAxisName,L=T.cateAxisName,F=Cde(v),V=[];return v.forEach(function(H,$){var z=sb(b.data,{graphicalItems:[H],dataStartIndex:E,dataEndIndex:C}),W=H.type.defaultProps!==void 0?Ce(Ce({},H.type.defaultProps),H.props):H.props,U=W.dataKey,X=W.maxBarSize,Y=W["".concat(R,"Id")],ae=W["".concat(L,"Id")],G={},ee=l.reduce(function(Je,rt){var De=y["".concat(rt.axisType,"Map")],ut=W["".concat(rt.axisType,"Id")];De&&De[ut]||rt.axisType==="zAxis"||ul();var ct=De[ut];return Ce(Ce({},Je),{},St(St({},rt.axisType,ct),"".concat(rt.axisType,"Ticks"),Wo(ct)))},G),re=ee[L],pe=ee["".concat(L,"Ticks")],te=k&&k[Y]&&k[Y].hasStack&&Ore(H,k[Y].stackGroups),se=Go(H.type).indexOf("Bar")>=0,ne=rh(re,pe),K=[],ge=F&&hre({barSize:O,stackGroups:k,totalSize:Pde(ee,L)});if(se){var ye,me,Se=vt(X)?I:X,Re=(ye=(me=rh(re,pe,!0))!==null&&me!==void 0?me:Se)!==null&&ye!==void 0?ye:0;K=gre({barGap:A,barCategoryGap:M,bandSize:Re!==ne?Re:ne,sizeList:ge[ae],maxBarSize:Se}),Re!==ne&&(K=K.map(function(Je){return Ce(Ce({},Je),{},{position:Ce(Ce({},Je.position),{},{offset:Je.position.offset-Re/2})})}))}var Te=H&&H.type&&H.type.getComposedData;Te&&V.push({props:Ce(Ce({},Te(Ce(Ce({},ee),{},{displayedData:z,props:b,dataKey:U,item:H,bandSize:ne,barPosition:K,offset:N,stackedData:te,layout:D,dataStartIndex:E,dataEndIndex:C}))),{},St(St(St({key:H.key||"item-".concat($)},R,ee[R]),L,ee[L]),"animationId",w)),childIndex:vY(H,b.children),item:H})}),V},p=function(b,y){var v=b.props,k=b.dataStartIndex,N=b.dataEndIndex,w=b.updateId;if(!H4({props:v}))return null;var E=v.children,C=v.layout,O=v.stackOffset,D=v.data,A=v.reverseStackOrder,M=AA(C),I=M.numericAxisName,T=M.cateAxisName,R=zn(E,r),L=Sre(D,R,"".concat(I,"Id"),"".concat(T,"Id"),O,A),F=l.reduce(function(W,U){var X="".concat(U.axisType,"Map");return Ce(Ce({},W),{},St({},X,Ede(v,Ce(Ce({},U),{},{graphicalItems:R,stackGroups:U.axisType===I&&L,dataStartIndex:k,dataEndIndex:N}))))},{}),V=Ode(Ce(Ce({},F),{},{props:v,graphicalItems:R}),y?.legendBBox);Object.keys(F).forEach(function(W){F[W]=u(v,F[W],V,W.replace("Map",""),t)});var H=F["".concat(T,"Map")],$=Sde(H),z=f(v,Ce(Ce({},F),{},{dataStartIndex:k,dataEndIndex:N,updateId:w,graphicalItems:R,stackGroups:L,offset:V}));return Ce(Ce({formattedGraphicalItems:z,graphicalItems:R,offset:V,stackGroups:L},$),F)},h=function(b){function y(v){var k,N,w;return lde(this,y),w=dde(this,y,[v]),St(w,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),St(w,"accessibilityManager",new Yue),St(w,"handleLegendBBoxUpdate",function(E){if(E){var C=w.state,O=C.dataStartIndex,D=C.dataEndIndex,A=C.updateId;w.setState(Ce({legendBBox:E},p({props:w.props,dataStartIndex:O,dataEndIndex:D,updateId:A},Ce(Ce({},w.state),{},{legendBBox:E}))))}}),St(w,"handleReceiveSyncEvent",function(E,C,O){if(w.props.syncId===E){if(O===w.eventEmitterSymbol&&typeof w.props.syncMethod!="function")return;w.applySyncEvent(C)}}),St(w,"handleBrushChange",function(E){var C=E.startIndex,O=E.endIndex;if(C!==w.state.dataStartIndex||O!==w.state.dataEndIndex){var D=w.state.updateId;w.setState(function(){return Ce({dataStartIndex:C,dataEndIndex:O},p({props:w.props,dataStartIndex:C,dataEndIndex:O,updateId:D},w.state))}),w.triggerSyncEvent({dataStartIndex:C,dataEndIndex:O})}}),St(w,"handleMouseEnter",function(E){var C=w.getMouseInfo(E);if(C){var O=Ce(Ce({},C),{},{isTooltipActive:!0});w.setState(O),w.triggerSyncEvent(O);var D=w.props.onMouseEnter;jt(D)&&D(O,E)}}),St(w,"triggeredAfterMouseMove",function(E){var C=w.getMouseInfo(E),O=C?Ce(Ce({},C),{},{isTooltipActive:!0}):{isTooltipActive:!1};w.setState(O),w.triggerSyncEvent(O);var D=w.props.onMouseMove;jt(D)&&D(O,E)}),St(w,"handleItemMouseEnter",function(E){w.setState(function(){return{isTooltipActive:!0,activeItem:E,activePayload:E.tooltipPayload,activeCoordinate:E.tooltipPosition||{x:E.cx,y:E.cy}}})}),St(w,"handleItemMouseLeave",function(){w.setState(function(){return{isTooltipActive:!1}})}),St(w,"handleMouseMove",function(E){E.persist(),w.throttleTriggeredAfterMouseMove(E)}),St(w,"handleMouseLeave",function(E){w.throttleTriggeredAfterMouseMove.cancel();var C={isTooltipActive:!1};w.setState(C),w.triggerSyncEvent(C);var O=w.props.onMouseLeave;jt(O)&&O(C,E)}),St(w,"handleOuterEvent",function(E){var C=xY(E),O=xa(w.props,"".concat(C));if(C&&jt(O)){var D,A;/.*touch.*/i.test(C)?A=w.getMouseInfo(E.changedTouches[0]):A=w.getMouseInfo(E),O((D=A)!==null&&D!==void 0?D:{},E)}}),St(w,"handleClick",function(E){var C=w.getMouseInfo(E);if(C){var O=Ce(Ce({},C),{},{isTooltipActive:!0});w.setState(O),w.triggerSyncEvent(O);var D=w.props.onClick;jt(D)&&D(O,E)}}),St(w,"handleMouseDown",function(E){var C=w.props.onMouseDown;if(jt(C)){var O=w.getMouseInfo(E);C(O,E)}}),St(w,"handleMouseUp",function(E){var C=w.props.onMouseUp;if(jt(C)){var O=w.getMouseInfo(E);C(O,E)}}),St(w,"handleTouchMove",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&w.throttleTriggeredAfterMouseMove(E.changedTouches[0])}),St(w,"handleTouchStart",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&w.handleMouseDown(E.changedTouches[0])}),St(w,"handleTouchEnd",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&w.handleMouseUp(E.changedTouches[0])}),St(w,"handleDoubleClick",function(E){var C=w.props.onDoubleClick;if(jt(C)){var O=w.getMouseInfo(E);C(O,E)}}),St(w,"handleContextMenu",function(E){var C=w.props.onContextMenu;if(jt(C)){var O=w.getMouseInfo(E);C(O,E)}}),St(w,"triggerSyncEvent",function(E){w.props.syncId!==void 0&&Nk.emit(Ek,w.props.syncId,E,w.eventEmitterSymbol)}),St(w,"applySyncEvent",function(E){var C=w.props,O=C.layout,D=C.syncMethod,A=w.state.updateId,M=E.dataStartIndex,I=E.dataEndIndex;if(E.dataStartIndex!==void 0||E.dataEndIndex!==void 0)w.setState(Ce({dataStartIndex:M,dataEndIndex:I},p({props:w.props,dataStartIndex:M,dataEndIndex:I,updateId:A},w.state)));else if(E.activeTooltipIndex!==void 0){var T=E.chartX,R=E.chartY,L=E.activeTooltipIndex,F=w.state,V=F.offset,H=F.tooltipTicks;if(!V)return;if(typeof D=="function")L=D(H,E);else if(D==="value"){L=-1;for(var $=0;$<H.length;$++)if(H[$].value===E.activeLabel){L=$;break}}var z=Ce(Ce({},V),{},{x:V.left,y:V.top}),W=Math.min(T,z.x+z.width),U=Math.min(R,z.y+z.height),X=H[L]&&H[L].value,Y=sj(w.state,w.props.data,L),ae=H[L]?{x:O==="horizontal"?H[L].coordinate:W,y:O==="horizontal"?U:H[L].coordinate}:xD;w.setState(Ce(Ce({},E),{},{activeLabel:X,activeCoordinate:ae,activePayload:Y,activeTooltipIndex:L}))}else w.setState(E)}),St(w,"renderCursor",function(E){var C,O=w.state,D=O.isTooltipActive,A=O.activeCoordinate,M=O.activePayload,I=O.offset,T=O.activeTooltipIndex,R=O.tooltipAxisBandSize,L=w.getTooltipEventType(),F=(C=E.props.active)!==null&&C!==void 0?C:D,V=w.props.layout,H=E.key||"_recharts-cursor";return x.createElement(tde,{key:H,activeCoordinate:A,activePayload:M,activeTooltipIndex:T,chartName:t,element:E,isActive:F,layout:V,offset:I,tooltipAxisBandSize:R,tooltipEventType:L})}),St(w,"renderPolarAxis",function(E,C,O){var D=xa(E,"type.axisType"),A=xa(w.state,"".concat(D,"Map")),M=E.type.defaultProps,I=M!==void 0?Ce(Ce({},M),E.props):E.props,T=A&&A[I["".concat(D,"Id")]];return m.cloneElement(E,Ce(Ce({},T),{},{className:Lt(D,T.className),key:E.key||"".concat(C,"-").concat(O),ticks:Wo(T,!0)}))}),St(w,"renderPolarGrid",function(E){var C=E.props,O=C.radialLines,D=C.polarAngles,A=C.polarRadius,M=w.state,I=M.radiusAxisMap,T=M.angleAxisMap,R=Ds(I),L=Ds(T),F=L.cx,V=L.cy,H=L.innerRadius,$=L.outerRadius;return m.cloneElement(E,{polarAngles:Array.isArray(D)?D:Wo(L,!0).map(function(z){return z.coordinate}),polarRadius:Array.isArray(A)?A:Wo(R,!0).map(function(z){return z.coordinate}),cx:F,cy:V,innerRadius:H,outerRadius:$,key:E.key||"polar-grid",radialLines:O})}),St(w,"renderLegend",function(){var E=w.state.formattedGraphicalItems,C=w.props,O=C.children,D=C.width,A=C.height,M=w.props.margin||{},I=D-(M.left||0)-(M.right||0),T=X_({children:O,formattedGraphicalItems:E,legendWidth:I,legendContent:c});if(!T)return null;var R=T.item,L=SA(T,rde);return m.cloneElement(R,Ce(Ce({},L),{},{chartWidth:D,chartHeight:A,margin:M,onBBoxUpdate:w.handleLegendBBoxUpdate}))}),St(w,"renderTooltip",function(){var E,C=w.props,O=C.children,D=C.accessibilityLayer,A=sa(O,qn);if(!A)return null;var M=w.state,I=M.isTooltipActive,T=M.activeCoordinate,R=M.activePayload,L=M.activeLabel,F=M.offset,V=(E=A.props.active)!==null&&E!==void 0?E:I;return m.cloneElement(A,{viewBox:Ce(Ce({},F),{},{x:F.left,y:F.top}),active:V,label:L,payload:V?R:[],coordinate:T,accessibilityLayer:D})}),St(w,"renderBrush",function(E){var C=w.props,O=C.margin,D=C.data,A=w.state,M=A.offset,I=A.dataStartIndex,T=A.dataEndIndex,R=A.updateId;return m.cloneElement(E,{key:E.key||"_recharts-brush",onChange:$m(w.handleBrushChange,E.props.onChange),data:D,x:ze(E.props.x)?E.props.x:M.left,y:ze(E.props.y)?E.props.y:M.top+M.height+M.brushBottom-(O.bottom||0),width:ze(E.props.width)?E.props.width:M.width,startIndex:I,endIndex:T,updateId:"brush-".concat(R)})}),St(w,"renderReferenceElement",function(E,C,O){if(!E)return null;var D=w,A=D.clipPathId,M=w.state,I=M.xAxisMap,T=M.yAxisMap,R=M.offset,L=E.type.defaultProps||{},F=E.props,V=F.xAxisId,H=V===void 0?L.xAxisId:V,$=F.yAxisId,z=$===void 0?L.yAxisId:$;return m.cloneElement(E,{key:E.key||"".concat(C,"-").concat(O),xAxis:I[H],yAxis:T[z],viewBox:{x:R.left,y:R.top,width:R.width,height:R.height},clipPathId:A})}),St(w,"renderActivePoints",function(E){var C=E.item,O=E.activePoint,D=E.basePoint,A=E.childIndex,M=E.isRange,I=[],T=C.props.key,R=C.item.type.defaultProps!==void 0?Ce(Ce({},C.item.type.defaultProps),C.item.props):C.item.props,L=R.activeDot,F=R.dataKey,V=Ce(Ce({index:A,dataKey:F,cx:O.x,cy:O.y,r:4,fill:f1(C.item),strokeWidth:2,stroke:"#fff",payload:O.payload,value:O.value},mt(L,!1)),Mp(L));return I.push(y.renderActiveDot(L,V,"".concat(T,"-activePoint-").concat(A))),D?I.push(y.renderActiveDot(L,Ce(Ce({},V),{},{cx:D.x,cy:D.y}),"".concat(T,"-basePoint-").concat(A))):M&&I.push(null),I}),St(w,"renderGraphicChild",function(E,C,O){var D=w.filterFormatItem(E,C,O);if(!D)return null;var A=w.getTooltipEventType(),M=w.state,I=M.isTooltipActive,T=M.tooltipAxis,R=M.activeTooltipIndex,L=M.activeLabel,F=w.props.children,V=sa(F,qn),H=D.props,$=H.points,z=H.isRange,W=H.baseLine,U=D.item.type.defaultProps!==void 0?Ce(Ce({},D.item.type.defaultProps),D.item.props):D.item.props,X=U.activeDot,Y=U.hide,ae=U.activeBar,G=U.activeShape,ee=!!(!Y&&I&&V&&(X||ae||G)),re={};A!=="axis"&&V&&V.props.trigger==="click"?re={onClick:$m(w.handleItemMouseEnter,E.props.onClick)}:A!=="axis"&&(re={onMouseLeave:$m(w.handleItemMouseLeave,E.props.onMouseLeave),onMouseEnter:$m(w.handleItemMouseEnter,E.props.onMouseEnter)});var pe=m.cloneElement(E,Ce(Ce({},D.props),re));function te(De){return typeof T.dataKey=="function"?T.dataKey(De.payload):null}if(ee)if(R>=0){var se,ne;if(T.dataKey&&!T.allowDuplicatedCategory){var K=typeof T.dataKey=="function"?te:"payload.".concat(T.dataKey.toString());se=Ap($,K,L),ne=z&&W&&Ap(W,K,L)}else se=$?.[R],ne=z&&W&&W[R];if(G||ae){var ge=E.props.activeIndex!==void 0?E.props.activeIndex:R;return[m.cloneElement(E,Ce(Ce(Ce({},D.props),re),{},{activeIndex:ge})),null,null]}if(!vt(se))return[pe].concat(Yc(w.renderActivePoints({item:D,activePoint:se,basePoint:ne,childIndex:R,isRange:z})))}else{var ye,me=(ye=w.getItemByXY(w.state.activeCoordinate))!==null&&ye!==void 0?ye:{graphicalItem:pe},Se=me.graphicalItem,Re=Se.item,Te=Re===void 0?E:Re,Je=Se.childIndex,rt=Ce(Ce(Ce({},D.props),re),{},{activeIndex:Je});return[m.cloneElement(Te,rt),null,null]}return z?[pe,null,null]:[pe,null]}),St(w,"renderCustomized",function(E,C,O){return m.cloneElement(E,Ce(Ce({key:"recharts-customized-".concat(O)},w.props),w.state))}),St(w,"renderMap",{CartesianGrid:{handler:qm,once:!0},ReferenceArea:{handler:w.renderReferenceElement},ReferenceLine:{handler:qm},ReferenceDot:{handler:w.renderReferenceElement},XAxis:{handler:qm},YAxis:{handler:qm},Brush:{handler:w.renderBrush,once:!0},Bar:{handler:w.renderGraphicChild},Line:{handler:w.renderGraphicChild},Area:{handler:w.renderGraphicChild},Radar:{handler:w.renderGraphicChild},RadialBar:{handler:w.renderGraphicChild},Scatter:{handler:w.renderGraphicChild},Pie:{handler:w.renderGraphicChild},Funnel:{handler:w.renderGraphicChild},Tooltip:{handler:w.renderCursor,once:!0},PolarGrid:{handler:w.renderPolarGrid,once:!0},PolarAngleAxis:{handler:w.renderPolarAxis},PolarRadiusAxis:{handler:w.renderPolarAxis},Customized:{handler:w.renderCustomized}}),w.clipPathId="".concat((k=v.id)!==null&&k!==void 0?k:fi("recharts"),"-clip"),w.throttleTriggeredAfterMouseMove=XT(w.triggeredAfterMouseMove,(N=v.throttleDelay)!==null&&N!==void 0?N:1e3/60),w.state={},w}return pde(y,b),ude(y,[{key:"componentDidMount",value:function(){var v,k;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(v=this.props.margin.left)!==null&&v!==void 0?v:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var v=this.props,k=v.children,N=v.data,w=v.height,E=v.layout,C=sa(k,qn);if(C){var O=C.props.defaultIndex;if(!(typeof O!="number"||O<0||O>this.state.tooltipTicks.length-1)){var D=this.state.tooltipTicks[O]&&this.state.tooltipTicks[O].value,A=sj(this.state,N,O,D),M=this.state.tooltipTicks[O].coordinate,I=(this.state.offset.top+w)/2,T=E==="horizontal",R=T?{x:M,y:I}:{y:M,x:I},L=this.state.formattedGraphicalItems.find(function(V){var H=V.item;return H.type.name==="Scatter"});L&&(R=Ce(Ce({},R),L.props.points[O].tooltipPosition),A=L.props.points[O].tooltipPayload);var F={activeTooltipIndex:O,isTooltipActive:!0,activeLabel:D,activePayload:A,activeCoordinate:R};this.setState(F),this.renderCursor(C),this.accessibilityManager.setIndex(O)}}}},{key:"getSnapshotBeforeUpdate",value:function(v,k){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==k.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==v.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==v.margin){var N,w;this.accessibilityManager.setDetails({offset:{left:(N=this.props.margin.left)!==null&&N!==void 0?N:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0}})}return null}},{key:"componentDidUpdate",value:function(v){$w([sa(v.children,qn)],[sa(this.props.children,qn)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var v=sa(this.props.children,qn);if(v&&typeof v.props.shared=="boolean"){var k=v.props.shared?"axis":"item";return s.indexOf(k)>=0?k:a}return a}},{key:"getMouseInfo",value:function(v){if(!this.container)return null;var k=this.container,N=k.getBoundingClientRect(),w=sJ(N),E={chartX:Math.round(v.pageX-w.left),chartY:Math.round(v.pageY-w.top)},C=N.width/k.offsetWidth||1,O=this.inRange(E.chartX,E.chartY,C);if(!O)return null;var D=this.state,A=D.xAxisMap,M=D.yAxisMap,I=this.getTooltipEventType(),T=OA(this.state,this.props.data,this.props.layout,O);if(I!=="axis"&&A&&M){var R=Ds(A).scale,L=Ds(M).scale,F=R&&R.invert?R.invert(E.chartX):null,V=L&&L.invert?L.invert(E.chartY):null;return Ce(Ce({},E),{},{xValue:F,yValue:V},T)}return T?Ce(Ce({},E),T):null}},{key:"inRange",value:function(v,k){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,w=this.props.layout,E=v/N,C=k/N;if(w==="horizontal"||w==="vertical"){var O=this.state.offset,D=E>=O.left&&E<=O.left+O.width&&C>=O.top&&C<=O.top+O.height;return D?{x:E,y:C}:null}var A=this.state,M=A.angleAxisMap,I=A.radiusAxisMap;if(M&&I){var T=Ds(M);return P6({x:E,y:C},T)}return null}},{key:"parseEventsOfWrapper",value:function(){var v=this.props.children,k=this.getTooltipEventType(),N=sa(v,qn),w={};N&&k==="axis"&&(N.props.trigger==="click"?w={onClick:this.handleClick}:w={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var E=Mp(this.props,this.handleOuterEvent);return Ce(Ce({},E),w)}},{key:"addListener",value:function(){Nk.on(Ek,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Nk.removeListener(Ek,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(v,k,N){for(var w=this.state.formattedGraphicalItems,E=0,C=w.length;E<C;E++){var O=w[E];if(O.item===v||O.props.key===v.key||k===Go(O.item.type)&&N===O.childIndex)return O}return null}},{key:"renderClipPath",value:function(){var v=this.clipPathId,k=this.state.offset,N=k.left,w=k.top,E=k.height,C=k.width;return x.createElement("defs",null,x.createElement("clipPath",{id:v},x.createElement("rect",{x:N,y:w,height:E,width:C})))}},{key:"getXScales",value:function(){var v=this.state.xAxisMap;return v?Object.entries(v).reduce(function(k,N){var w=EA(N,2),E=w[0],C=w[1];return Ce(Ce({},k),{},St({},E,C.scale))},{}):null}},{key:"getYScales",value:function(){var v=this.state.yAxisMap;return v?Object.entries(v).reduce(function(k,N){var w=EA(N,2),E=w[0],C=w[1];return Ce(Ce({},k),{},St({},E,C.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(v){var k;return(k=this.state.xAxisMap)===null||k===void 0||(k=k[v])===null||k===void 0?void 0:k.scale}},{key:"getYScaleByAxisId",value:function(v){var k;return(k=this.state.yAxisMap)===null||k===void 0||(k=k[v])===null||k===void 0?void 0:k.scale}},{key:"getItemByXY",value:function(v){var k=this.state,N=k.formattedGraphicalItems,w=k.activeItem;if(N&&N.length)for(var E=0,C=N.length;E<C;E++){var O=N[E],D=O.props,A=O.item,M=A.type.defaultProps!==void 0?Ce(Ce({},A.type.defaultProps),A.props):A.props,I=Go(A.type);if(I==="Bar"){var T=(D.data||[]).find(function(V){return Coe(v,V)});if(T)return{graphicalItem:O,payload:T}}else if(I==="RadialBar"){var R=(D.data||[]).find(function(V){return P6(v,V)});if(R)return{graphicalItem:O,payload:R}}else if(Jg(O,w)||Qg(O,w)||uf(O,w)){var L=Zse({graphicalItem:O,activeTooltipItem:w,itemData:M.data}),F=M.activeIndex===void 0?L:M.activeIndex;return{graphicalItem:Ce(Ce({},O),{},{childIndex:F}),payload:uf(O,w)?M.data[L]:O.props.data[L]}}}return null}},{key:"render",value:function(){var v=this;if(!H4(this))return null;var k=this.props,N=k.children,w=k.className,E=k.width,C=k.height,O=k.style,D=k.compact,A=k.title,M=k.desc,I=SA(k,nde),T=mt(I,!1);if(D)return x.createElement(tA,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},x.createElement(Hw,Xl({},T,{width:E,height:C,title:A,desc:M}),this.renderClipPath(),U4(N,this.renderMap)));if(this.props.accessibilityLayer){var R,L;T.tabIndex=(R=this.props.tabIndex)!==null&&R!==void 0?R:0,T.role=(L=this.props.role)!==null&&L!==void 0?L:"application",T.onKeyDown=function(V){v.accessibilityManager.keyboardEvent(V)},T.onFocus=function(){v.accessibilityManager.focus()}}var F=this.parseEventsOfWrapper();return x.createElement(tA,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},x.createElement("div",Xl({className:Lt("recharts-wrapper",w),style:Ce({position:"relative",cursor:"default",width:E,height:C},O)},F,{ref:function(V){v.container=V}}),x.createElement(Hw,Xl({},T,{width:E,height:C,title:A,desc:M,style:vde}),this.renderClipPath(),U4(N,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(m.Component);St(h,"displayName",t),St(h,"defaultProps",Ce({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},d)),St(h,"getDerivedStateFromProps",function(b,y){var v=b.dataKey,k=b.data,N=b.children,w=b.width,E=b.height,C=b.layout,O=b.stackOffset,D=b.margin,A=y.dataStartIndex,M=y.dataEndIndex;if(y.updateId===void 0){var I=PA(b);return Ce(Ce(Ce({},I),{},{updateId:0},p(Ce(Ce({props:b},I),{},{updateId:0}),y)),{},{prevDataKey:v,prevData:k,prevWidth:w,prevHeight:E,prevLayout:C,prevStackOffset:O,prevMargin:D,prevChildren:N})}if(v!==y.prevDataKey||k!==y.prevData||w!==y.prevWidth||E!==y.prevHeight||C!==y.prevLayout||O!==y.prevStackOffset||!ac(D,y.prevMargin)){var T=PA(b),R={chartX:y.chartX,chartY:y.chartY,isTooltipActive:y.isTooltipActive},L=Ce(Ce({},OA(y,k,C)),{},{updateId:y.updateId+1}),F=Ce(Ce(Ce({},T),R),L);return Ce(Ce(Ce({},F),p(Ce({props:b},F),y)),{},{prevDataKey:v,prevData:k,prevWidth:w,prevHeight:E,prevLayout:C,prevStackOffset:O,prevMargin:D,prevChildren:N})}if(!$w(N,y.prevChildren)){var V,H,$,z,W=sa(N,Dc),U=W&&(V=(H=W.props)===null||H===void 0?void 0:H.startIndex)!==null&&V!==void 0?V:A,X=W&&($=(z=W.props)===null||z===void 0?void 0:z.endIndex)!==null&&$!==void 0?$:M,Y=U!==A||X!==M,ae=!vt(k),G=ae&&!Y?y.updateId:y.updateId+1;return Ce(Ce({updateId:G},p(Ce(Ce({props:b},y),{},{updateId:G,dataStartIndex:U,dataEndIndex:X}),y)),{},{prevChildren:N,dataStartIndex:U,dataEndIndex:X})}return null}),St(h,"renderActiveDot",function(b,y,v){var k;return m.isValidElement(b)?k=m.cloneElement(b,y):jt(b)?k=b(y):k=x.createElement(No,y),x.createElement(Rt,{className:"recharts-active-dot",key:v},k)});var g=m.forwardRef(function(b,y){return x.createElement(h,Xl({},b,{ref:y}))});return g.displayName=h.displayName,g},kD=Wf({chartName:"LineChart",GraphicalChild:ni,axisComponents:[{axisType:"xAxis",AxisComp:Xn},{axisType:"yAxis",AxisComp:Gn}],formatAxisMap:tb}),wD=Wf({chartName:"BarChart",GraphicalChild:bi,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Xn},{axisType:"yAxis",AxisComp:Gn}],formatAxisMap:tb}),Ade=Wf({chartName:"PieChart",GraphicalChild:bs,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Zg},{axisType:"radiusAxis",AxisComp:Xg}],formatAxisMap:Fre,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),Mde=Wf({chartName:"ScatterChart",GraphicalChild:Vf,defaultTooltipEventType:"item",validateTooltipEventTypes:["item"],axisComponents:[{axisType:"xAxis",AxisComp:Xn},{axisType:"yAxis",AxisComp:Gn},{axisType:"zAxis",AxisComp:qf}],formatAxisMap:tb}),jD=Wf({chartName:"AreaChart",GraphicalChild:ys,axisComponents:[{axisType:"xAxis",AxisComp:Xn},{axisType:"yAxis",AxisComp:Gn}],formatAxisMap:tb});const Tde=e=>{m.useEffect(()=>{const t=()=>{e()};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[e])},Pr={Increase:"increase",ModerateIncrease:"moderateIncrease",Decrease:"decrease",ModerateDecrease:"moderateDecrease",Unchanged:"unchanged"},Qe={Slate:"slate",Gray:"gray",Zinc:"zinc",Neutral:"neutral",Stone:"stone",Red:"red",Orange:"orange",Amber:"amber",Yellow:"yellow",Lime:"lime",Green:"green",Emerald:"emerald",Teal:"teal",Cyan:"cyan",Sky:"sky",Blue:"blue",Indigo:"indigo",Violet:"violet",Purple:"purple",Fuchsia:"fuchsia",Pink:"pink",Rose:"rose"},ib={SM:"sm"},ic={Left:"left",Right:"right"},MA={Top:"top",Bottom:"bottom"},We={background:500,darkBackground:600,border:500,darkBorder:700,ring:300,iconRing:500,lightText:400,text:500,iconText:600,darkText:700},_o=[Qe.Blue,Qe.Cyan,Qe.Sky,Qe.Indigo,Qe.Violet,Qe.Purple,Qe.Fuchsia,Qe.Slate,Qe.Gray,Qe.Zinc,Qe.Neutral,Qe.Stone,Qe.Red,Qe.Orange,Qe.Amber,Qe.Yellow,Qe.Lime,Qe.Green,Qe.Emerald,Qe.Teal,Qe.Pink,Qe.Rose],N1="-",_de=e=>{const t=Dde(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{const o=a.split(N1);return o[0]===""&&o.length!==1&&o.shift(),ND(o,t)||Ide(a)},getConflictingClassGroupIds:(a,o)=>{const s=r[a]||[];return o&&n[a]?[...s,...n[a]]:s}}},ND=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?ND(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const o=e.join(N1);return t.validators.find(({validator:s})=>s(o))?.classGroupId},TA=/^\[(.+)\]$/,Ide=e=>{if(TA.test(e)){const t=TA.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Dde=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return Rde(Object.entries(e.classGroups),r).forEach(([a,o])=>{ij(o,n,a,t)}),n},ij=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?t:_A(t,a);o.classGroupId=r;return}if(typeof a=="function"){if(Lde(a)){ij(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([o,s])=>{ij(s,_A(t,o),r,n)})})},_A=(e,t)=>{let r=e;return t.split(N1).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Lde=e=>e.isThemeGetter,Rde=(e,t)=>t?e.map(([r,n])=>{const a=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,l])=>[t+s,l])):o);return[r,a]}):e,Fde=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(o,s)=>{r.set(o,s),t++,t>e&&(t=0,n=r,r=new Map)};return{get(o){let s=r.get(o);if(s!==void 0)return s;if((s=n.get(o))!==void 0)return a(o,s),s},set(o,s){r.has(o)?r.set(o,s):a(o,s)}}},ED="!",$de=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,a=t[0],o=t.length,s=l=>{const c=[];let u=0,d=0,f;for(let y=0;y<l.length;y++){let v=l[y];if(u===0){if(v===a&&(n||l.slice(y,y+o)===t)){c.push(l.slice(d,y)),d=y+o;continue}if(v==="/"){f=y;continue}}v==="["?u++:v==="]"&&u--}const p=c.length===0?l:l.substring(d),h=p.startsWith(ED),g=h?p.substring(1):p,b=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:b}};return r?l=>r({className:l,parseClassName:s}):s},Bde=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},Hde=e=>({cache:Fde(e.cacheSize),parseClassName:$de(e),..._de(e)}),zde=/\s+/,Ude=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a}=t,o=[],s=e.trim().split(zde);let l="";for(let c=s.length-1;c>=0;c-=1){const u=s[c],{modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:h}=r(u);let g=!!h,b=n(g?p.substring(0,h):p);if(!b){if(!g){l=u+(l.length>0?" "+l:l);continue}if(b=n(p),!b){l=u+(l.length>0?" "+l:l);continue}g=!1}const y=Bde(d).join(":"),v=f?y+ED:y,k=v+b;if(o.includes(k))continue;o.push(k);const N=a(b,g);for(let w=0;w<N.length;++w){const E=N[w];o.push(v+E)}l=u+(l.length>0?" "+l:l)}return l};function qde(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=SD(t))&&(n&&(n+=" "),n+=r);return n}const SD=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=SD(e[n]))&&(r&&(r+=" "),r+=t);return r};function IA(e,...t){let r,n,a,o=s;function s(c){const u=t.reduce((d,f)=>f(d),e());return r=Hde(u),n=r.cache.get,a=r.cache.set,o=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=Ude(c,r);return a(c,d),d}return function(){return o(qde.apply(null,arguments))}}const Rr=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},CD=/^\[(?:([a-z-]+):)?(.+)\]$/i,Vde=/^\d+\/\d+$/,Wde=new Set(["px","full","screen"]),Kde=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Yde=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Xde=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Gde=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Zde=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$o=e=>lc(e)||Wde.has(e)||Vde.test(e),Es=e=>pu(e,"length",ofe),lc=e=>!!e&&!Number.isNaN(Number(e)),Ck=e=>pu(e,"number",lc),Xu=e=>!!e&&Number.isInteger(Number(e)),Jde=e=>e.endsWith("%")&&lc(e.slice(0,-1)),$t=e=>CD.test(e),Ss=e=>Kde.test(e),Qde=new Set(["length","size","percentage"]),efe=e=>pu(e,Qde,OD),tfe=e=>pu(e,"position",OD),rfe=new Set(["image","url"]),nfe=e=>pu(e,rfe,ife),afe=e=>pu(e,"",sfe),Gu=()=>!0,pu=(e,t,r)=>{const n=CD.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},ofe=e=>Yde.test(e)&&!Xde.test(e),OD=()=>!1,sfe=e=>Gde.test(e),ife=e=>Zde.test(e),DA=()=>{const e=Rr("colors"),t=Rr("spacing"),r=Rr("blur"),n=Rr("brightness"),a=Rr("borderColor"),o=Rr("borderRadius"),s=Rr("borderSpacing"),l=Rr("borderWidth"),c=Rr("contrast"),u=Rr("grayscale"),d=Rr("hueRotate"),f=Rr("invert"),p=Rr("gap"),h=Rr("gradientColorStops"),g=Rr("gradientColorStopPositions"),b=Rr("inset"),y=Rr("margin"),v=Rr("opacity"),k=Rr("padding"),N=Rr("saturate"),w=Rr("scale"),E=Rr("sepia"),C=Rr("skew"),O=Rr("space"),D=Rr("translate"),A=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",$t,t],T=()=>[$t,t],R=()=>["",$o,Es],L=()=>["auto",lc,$t],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$=()=>["start","end","center","between","around","evenly","stretch"],z=()=>["","0",$t],W=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[lc,$t];return{cacheSize:500,separator:":",theme:{colors:[Gu],spacing:[$o,Es],blur:["none","",Ss,$t],brightness:U(),borderColor:[e],borderRadius:["none","","full",Ss,$t],borderSpacing:T(),borderWidth:R(),contrast:U(),grayscale:z(),hueRotate:U(),invert:z(),gap:T(),gradientColorStops:[e],gradientColorStopPositions:[Jde,Es],inset:I(),margin:I(),opacity:U(),padding:T(),saturate:U(),scale:U(),sepia:z(),skew:U(),space:T(),translate:T()},classGroups:{aspect:[{aspect:["auto","square","video",$t]}],container:["container"],columns:[{columns:[Ss]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...F(),$t]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Xu,$t]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",$t]}],grow:[{grow:z()}],shrink:[{shrink:z()}],order:[{order:["first","last","none",Xu,$t]}],"grid-cols":[{"grid-cols":[Gu]}],"col-start-end":[{col:["auto",{span:["full",Xu,$t]},$t]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[Gu]}],"row-start-end":[{row:["auto",{span:[Xu,$t]},$t]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",$t]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",$t]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...$()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...$(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...$(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[k]}],px:[{px:[k]}],py:[{py:[k]}],ps:[{ps:[k]}],pe:[{pe:[k]}],pt:[{pt:[k]}],pr:[{pr:[k]}],pb:[{pb:[k]}],pl:[{pl:[k]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",$t,t]}],"min-w":[{"min-w":[$t,t,"min","max","fit"]}],"max-w":[{"max-w":[$t,t,"none","full","min","max","fit","prose",{screen:[Ss]},Ss]}],h:[{h:[$t,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[$t,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[$t,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[$t,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ss,Es]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ck]}],"font-family":[{font:[Gu]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",$t]}],"line-clamp":[{"line-clamp":["none",lc,Ck]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",$o,$t]}],"list-image":[{"list-image":["none",$t]}],"list-style-type":[{list:["none","disc","decimal",$t]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",$o,Es]}],"underline-offset":[{"underline-offset":["auto",$o,$t]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$t]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",$t]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),tfe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",efe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},nfe]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:V()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[$o,$t]}],"outline-w":[{outline:[$o,Es]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[$o,Es]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ss,afe]}],"shadow-color":[{shadow:[Gu]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...H(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Ss,$t]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[N]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",$t]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",$t]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",$t]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[Xu,$t]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",$t]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",$t]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",$t]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[$o,Es,Ck]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},lfe=(e,{cacheSize:t,prefix:r,separator:n,experimentalParseClassName:a,extend:o={},override:s={}})=>{md(e,"cacheSize",t),md(e,"prefix",r),md(e,"separator",n),md(e,"experimentalParseClassName",a);for(const l in s)cfe(e[l],s[l]);for(const l in o)ufe(e[l],o[l]);return e},md=(e,t,r)=>{r!==void 0&&(e[t]=r)},cfe=(e,t)=>{if(t)for(const r in t)md(e,r,t[r])},ufe=(e,t)=>{if(t)for(const r in t){const n=t[r];n!==void 0&&(e[r]=(e[r]||[]).concat(n))}},dfe=(e,...t)=>typeof e=="function"?IA(DA,e,...t):IA(()=>lfe(DA(),e),...t),J=dfe({extend:{classGroups:{shadow:[{shadow:[{tremor:["input","card","dropdown"],"dark-tremor":["input","card","dropdown"]}]}],rounded:[{rounded:[{tremor:["small","default","full"],"dark-tremor":["small","default","full"]}]}],"font-size":[{text:[{tremor:["default","title","metric"],"dark-tremor":["default","title","metric"]}]}]}}}),ffe=["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"],mfe=e=>ffe.includes(e),PD=(e,t)=>{if(t||e===Pr.Unchanged)return e;switch(e){case Pr.Increase:return Pr.Decrease;case Pr.ModerateIncrease:return Pr.ModerateDecrease;case Pr.Decrease:return Pr.Increase;case Pr.ModerateDecrease:return Pr.ModerateIncrease}return""},xo=e=>e.toString(),E1=e=>e.reduce((t,r)=>t+r,0),pfe=(e,t)=>{for(let r=0;r<t.length;r++)if(t[r]===e)return!0;return!1};function xs(e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}function kt(e){return t=>`tremor-${e}-${t}`}function He(e,t){const r=mfe(e);if(e==="white"||e==="black"||e==="transparent"||!t||!r){const n=(a=>a.includes("#")||a.includes("--")||a.includes("rgb"))(e)?`[${e}]`:e;return{bgColor:`bg-${n} dark:bg-${n}`,hoverBgColor:`hover:bg-${n} dark:hover:bg-${n}`,selectBgColor:`data-[selected]:bg-${n} dark:data-[selected]:bg-${n}`,textColor:`text-${n} dark:text-${n}`,selectTextColor:`data-[selected]:text-${n} dark:data-[selected]:text-${n}`,hoverTextColor:`hover:text-${n} dark:hover:text-${n}`,borderColor:`border-${n} dark:border-${n}`,selectBorderColor:`data-[selected]:border-${n} dark:data-[selected]:border-${n}`,hoverBorderColor:`hover:border-${n} dark:hover:border-${n}`,ringColor:`ring-${n} dark:ring-${n}`,strokeColor:`stroke-${n} dark:stroke-${n}`,fillColor:`fill-${n} dark:fill-${n}`}}return{bgColor:`bg-${e}-${t} dark:bg-${e}-${t}`,selectBgColor:`data-[selected]:bg-${e}-${t} dark:data-[selected]:bg-${e}-${t}`,hoverBgColor:`hover:bg-${e}-${t} dark:hover:bg-${e}-${t}`,textColor:`text-${e}-${t} dark:text-${e}-${t}`,selectTextColor:`data-[selected]:text-${e}-${t} dark:data-[selected]:text-${e}-${t}`,hoverTextColor:`hover:text-${e}-${t} dark:hover:text-${e}-${t}`,borderColor:`border-${e}-${t} dark:border-${e}-${t}`,selectBorderColor:`data-[selected]:border-${e}-${t} dark:data-[selected]:border-${e}-${t}`,hoverBorderColor:`hover:border-${e}-${t} dark:hover:border-${e}-${t}`,ringColor:`ring-${e}-${t} dark:ring-${e}-${t}`,strokeColor:`stroke-${e}-${t} dark:stroke-${e}-${t}`,fillColor:`fill-${e}-${t} dark:fill-${e}-${t}`}}const hfe=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),x.createElement("path",{d:"M8 12L14 6V18L8 12Z"}))},gfe=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),x.createElement("path",{d:"M16 12L10 18V6L16 12Z"}))},S1=kt("Legend"),bfe=({name:e,color:t,onClick:r,activeLegend:n})=>{const a=!!r;return x.createElement("li",{className:J(S1("legendItem"),"group inline-flex items-center px-2 py-0.5 rounded-tremor-small transition whitespace-nowrap",a?"cursor-pointer":"cursor-default","text-tremor-content",a?"hover:bg-tremor-background-subtle":"","dark:text-dark-tremor-content",a?"dark:hover:bg-dark-tremor-background-subtle":""),onClick:o=>{o.stopPropagation(),r?.(e,t)}},x.createElement("svg",{className:J("flex-none h-2 w-2 mr-1.5",He(t,We.text).textColor,n&&n!==e?"opacity-40":"opacity-100"),fill:"currentColor",viewBox:"0 0 8 8"},x.createElement("circle",{cx:4,cy:4,r:4})),x.createElement("p",{className:J("whitespace-nowrap truncate text-tremor-default","text-tremor-content",a?"group-hover:text-tremor-content-emphasis":"","dark:text-dark-tremor-content",n&&n!==e?"opacity-40":"opacity-100",a?"dark:group-hover:text-dark-tremor-content-emphasis":"")},e))},LA=({icon:e,onClick:t,disabled:r})=>{const n=e,[a,o]=x.useState(!1),s=x.useRef(null);return x.useEffect(()=>(a?s.current=setInterval(()=>{t?.()},300):clearInterval(s.current),()=>clearInterval(s.current)),[a,t]),m.useEffect(()=>{r&&(clearInterval(s.current),o(!1))},[r]),x.createElement("button",{type:"button",className:J(S1("legendSliderButton"),"w-5 group inline-flex items-center truncate rounded-tremor-small transition",r?"cursor-not-allowed":"cursor-pointer",r?"text-tremor-content-subtle":"text-tremor-content hover:text-tremor-content-emphasis hover:bg-tremor-background-subtle",r?"dark:text-dark-tremor-subtle":"dark:text-dark-tremor dark:hover:text-tremor-content-emphasis dark:hover:bg-dark-tremor-background-subtle"),disabled:r,onClick:l=>{l.stopPropagation(),t?.()},onMouseDown:l=>{l.stopPropagation(),o(!0)},onMouseUp:l=>{l.stopPropagation(),o(!1)}},x.createElement(n,{className:"w-full"}))},AD=x.forwardRef((e,t)=>{const{categories:r,colors:n=_o,className:a,onClickLegendItem:o,activeLegend:s,enableLegendSlider:l=!1}=e,c=Be(e,["categories","colors","className","onClickLegendItem","activeLegend","enableLegendSlider"]),u=x.useRef(null),d=x.useRef(null),[f,p]=x.useState(null),[h,g]=x.useState(null),b=x.useRef(null),y=m.useCallback(()=>{const w=u?.current;if(!w)return;const E=w.scrollLeft>0,C=w.scrollWidth-w.clientWidth>w.scrollLeft;p({left:E,right:C})},[p]),v=m.useCallback(w=>{var E,C;const O=u?.current,D=d?.current,A=(E=O?.clientWidth)!==null&&E!==void 0?E:0,M=(C=D?.clientWidth)!==null&&C!==void 0?C:0;O&&l&&(O.scrollTo({left:w==="left"?O.scrollLeft-A+M:O.scrollLeft+A-M,behavior:"smooth"}),setTimeout(()=>{y()},400))},[l,y]);x.useEffect(()=>{const w=E=>{E==="ArrowLeft"?v("left"):E==="ArrowRight"&&v("right")};return h?(w(h),b.current=setInterval(()=>{w(h)},300)):clearInterval(b.current),()=>clearInterval(b.current)},[h,v]);const k=w=>{w.stopPropagation(),w.key!=="ArrowLeft"&&w.key!=="ArrowRight"||(w.preventDefault(),g(w.key))},N=w=>{w.stopPropagation(),g(null)};return x.useEffect(()=>{const w=u?.current;return l&&(y(),w?.addEventListener("keydown",k),w?.addEventListener("keyup",N)),()=>{w?.removeEventListener("keydown",k),w?.removeEventListener("keyup",N)}},[y,l]),x.createElement("ol",Object.assign({ref:t,className:J(S1("root"),"relative overflow-hidden",a)},c),x.createElement("div",{ref:u,tabIndex:0,className:J("h-full flex",l?f?.right||f?.left?"pl-4 pr-12 items-center overflow-auto snap-mandatory [&::-webkit-scrollbar]:hidden [scrollbar-width:none]":"":"flex-wrap")},r.map((w,E)=>x.createElement(bfe,{key:`item-${E}`,name:w,color:n[E%n.length],onClick:o,activeLegend:s}))),l&&(f?.right||f?.left)?x.createElement(x.Fragment,null,x.createElement("div",{className:J("bg-tremor-background","dark:bg-dark-tremor-background","absolute flex top-0 pr-1 bottom-0 right-0 items-center justify-center h-full"),ref:d},x.createElement(LA,{icon:hfe,onClick:()=>{g(null),v("left")},disabled:!f?.left}),x.createElement(LA,{icon:gfe,onClick:()=>{g(null),v("right")},disabled:!f?.right}))):null)});AD.displayName="Legend";const lb=({payload:e},t,r,n,a,o)=>{const s=m.useRef(null);Tde(()=>{var c,u;r((u=(c=s.current)===null||c===void 0?void 0:c.clientHeight)?Number(u)+20:60)});const l=e.filter(c=>c.type!=="none");return x.createElement("div",{ref:s,className:"flex items-center justify-end"},x.createElement(AD,{categories:l.map(c=>c.value),colors:l.map(c=>t.get(c.value)),onClickLegendItem:a,activeLegend:n,enableLegendSlider:o}))},C1=({children:e})=>x.createElement("div",{className:J("rounded-tremor-default text-tremor-default border","bg-tremor-background shadow-tremor-dropdown border-tremor-border","dark:bg-dark-tremor-background dark:shadow-dark-tremor-dropdown dark:border-dark-tremor-border")},e),O1=({value:e,name:t,color:r})=>x.createElement("div",{className:"flex items-center justify-between space-x-8"},x.createElement("div",{className:"flex items-center space-x-2"},x.createElement("span",{className:J("shrink-0 rounded-tremor-full border-2 h-3 w-3","border-tremor-background shadow-tremor-card","dark:border-dark-tremor-background dark:shadow-dark-tremor-card",He(r,We.background).bgColor)}),x.createElement("p",{className:J("text-right whitespace-nowrap","text-tremor-content","dark:text-dark-tremor-content")},t)),x.createElement("p",{className:J("font-medium tabular-nums text-right whitespace-nowrap","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e)),P1=({active:e,payload:t,label:r,categoryColors:n,valueFormatter:a})=>{if(e&&t){const o=t.filter(s=>s.type!=="none");return x.createElement(C1,null,x.createElement("div",{className:J("border-tremor-border border-b px-4 py-2","dark:border-dark-tremor-border")},x.createElement("p",{className:J("font-medium","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},r)),x.createElement("div",{className:J("px-4 py-2 space-y-1")},o.map(({value:s,name:l},c)=>{var u;return x.createElement(O1,{key:`id-${c}`,value:a(s),name:l,color:(u=n.get(l))!==null&&u!==void 0?u:Qe.Blue})})))}return null},vs=({className:e,noDataText:t="No data"})=>x.createElement("div",{className:J("flex items-center justify-center w-full h-full border border-dashed rounded-tremor-default","border-tremor-border","dark:border-dark-tremor-border",e)},x.createElement("p",{className:J("text-tremor-content text-tremor-default","dark:text-dark-tremor-content")},t)),vl=(e,t)=>{const r=new Map;return e.forEach((n,a)=>{r.set(n,t[a%t.length])}),r},ai=(e,t,r)=>[e?"auto":t??0,r??"auto"],yfe=(e,t)=>{if(!t)return[];const r=new Set;return e.forEach(n=>{r.add(n[t])}),Array.from(r)};function bf(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r)if(!n.includes(a)||!bf(e[a],t[a]))return!1;return!0}function cc(e,t){const r=[];for(const n of e)if(Object.prototype.hasOwnProperty.call(n,t)&&(r.push(n[t]),r.length>1))return!1;return!0}const yf=x.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:a,stack:o=!1,colors:s=_o,valueFormatter:l=xo,startEndOnly:c=!1,showXAxis:u=!0,showYAxis:d=!0,yAxisWidth:f=56,intervalType:p="equidistantPreserveStart",showAnimation:h=!1,animationDuration:g=900,showTooltip:b=!0,showLegend:y=!0,showGridLines:v=!0,showGradient:k=!0,autoMinValue:N=!1,curveType:w="linear",minValue:E,maxValue:C,connectNulls:O=!1,allowDecimals:D=!0,noDataText:A,className:M,onValueChange:I,enableLegendSlider:T=!1,customTooltip:R,rotateLabelX:L,padding:F=!u&&!d||c&&!d?{left:0,right:0}:{left:20,right:20},tickGap:V=5,xAxisLabel:H,yAxisLabel:$}=e,z=Be(e,["data","categories","index","stack","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","showAnimation","animationDuration","showTooltip","showLegend","showGridLines","showGradient","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),W=R,[U,X]=m.useState(60),[Y,ae]=m.useState(void 0),[G,ee]=m.useState(void 0),re=vl(n,s),pe=ai(N,E,C),te=!!I;function se(ne){te&&(ne===G&&!Y||cc(r,ne)&&Y&&Y.dataKey===ne?(ee(void 0),I?.(null)):(ee(ne),I?.({eventType:"category",categoryClicked:ne})),ae(void 0))}return x.createElement("div",Object.assign({ref:t,className:J("w-full h-80",M)},z),x.createElement(mi,{className:"h-full w-full"},r?.length?x.createElement(jD,{data:r,onClick:te&&(G||Y)?()=>{ae(void 0),ee(void 0),I?.(null)}:void 0,margin:{bottom:H?30:void 0,left:$?20:void 0,right:$?5:void 0,top:5}},v?x.createElement(Uf,{className:J("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,x.createElement(Xn,{padding:F,hide:!u,dataKey:a,tick:{transform:"translate(0, 6)"},ticks:c?[r[0][a],r[r.length-1][a]]:void 0,fill:"",stroke:"",className:J("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),interval:c?"preserveStartEnd":p,tickLine:!1,axisLine:!1,minTickGap:V,angle:L?.angle,dy:L?.verticalShift,height:L?.xAxisHeight},H&&x.createElement(Nr,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},H)),x.createElement(Gn,{width:f,hide:!d,axisLine:!1,tickLine:!1,type:"number",domain:pe,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:J("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:l,allowDecimals:D},$&&x.createElement(Nr,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},$)),x.createElement(qn,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:b?({active:ne,payload:K,label:ge})=>W?x.createElement(W,{payload:K?.map(ye=>{var me;return Object.assign(Object.assign({},ye),{color:(me=re.get(ye.dataKey))!==null&&me!==void 0?me:Qe.Gray})}),active:ne,label:ge}):x.createElement(P1,{active:ne,payload:K,label:ge,valueFormatter:l,categoryColors:re}):x.createElement(x.Fragment,null),position:{y:0}}),y?x.createElement(go,{verticalAlign:"top",height:U,content:({payload:ne})=>lb({payload:ne},re,X,G,te?K=>se(K):void 0,T)}):null,n.map(ne=>{var K,ge,ye;const me=((K=re.get(ne))!==null&&K!==void 0?K:Qe.Gray).replace("#","");return x.createElement("defs",{key:ne},k?x.createElement("linearGradient",{className:He((ge=re.get(ne))!==null&&ge!==void 0?ge:Qe.Gray,We.text).textColor,id:me,x1:"0",y1:"0",x2:"0",y2:"1"},x.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:Y||G&&G!==ne?.15:.4}),x.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:0})):x.createElement("linearGradient",{className:He((ye=re.get(ne))!==null&&ye!==void 0?ye:Qe.Gray,We.text).textColor,id:me,x1:"0",y1:"0",x2:"0",y2:"1"},x.createElement("stop",{stopColor:"currentColor",stopOpacity:Y||G&&G!==ne?.1:.3})))}),n.map(ne=>{var K,ge;const ye=((K=re.get(ne))!==null&&K!==void 0?K:Qe.Gray).replace("#","");return x.createElement(ys,{className:He((ge=re.get(ne))!==null&&ge!==void 0?ge:Qe.Gray,We.text).strokeColor,strokeOpacity:Y||G&&G!==ne?.3:1,activeDot:me=>{var Se;const{cx:Re,cy:Te,stroke:Je,strokeLinecap:rt,strokeLinejoin:De,strokeWidth:ut,dataKey:ct}=me;return x.createElement(No,{className:J("stroke-tremor-background dark:stroke-dark-tremor-background",I?"cursor-pointer":"",He((Se=re.get(ct))!==null&&Se!==void 0?Se:Qe.Gray,We.text).fillColor),cx:Re,cy:Te,r:5,fill:"",stroke:Je,strokeLinecap:rt,strokeLinejoin:De,strokeWidth:ut,onClick:(Nt,yt)=>function(ft,Ct){Ct.stopPropagation(),te&&(ft.index===Y?.index&&ft.dataKey===Y?.dataKey||cc(r,ft.dataKey)&&G&&G===ft.dataKey?(ee(void 0),ae(void 0),I?.(null)):(ee(ft.dataKey),ae({index:ft.index,dataKey:ft.dataKey}),I?.(Object.assign({eventType:"dot",categoryClicked:ft.dataKey},ft.payload))))}(me,yt)})},dot:me=>{var Se;const{stroke:Re,strokeLinecap:Te,strokeLinejoin:Je,strokeWidth:rt,cx:De,cy:ut,dataKey:ct,index:Nt}=me;return cc(r,ne)&&!(Y||G&&G!==ne)||Y?.index===Nt&&Y?.dataKey===ne?x.createElement(No,{key:Nt,cx:De,cy:ut,r:5,stroke:Re,fill:"",strokeLinecap:Te,strokeLinejoin:Je,strokeWidth:rt,className:J("stroke-tremor-background dark:stroke-dark-tremor-background",I?"cursor-pointer":"",He((Se=re.get(ct))!==null&&Se!==void 0?Se:Qe.Gray,We.text).fillColor)}):x.createElement(m.Fragment,{key:Nt})},key:ne,name:ne,type:w,dataKey:ne,stroke:"",fill:`url(#${ye})`,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:h,animationDuration:g,stackId:o?"a":void 0,connectNulls:O})}),I?n.map(ne=>x.createElement(ni,{className:J("cursor-pointer"),strokeOpacity:0,key:ne,name:ne,type:w,dataKey:ne,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:O,onClick:(K,ge)=>{ge.stopPropagation();const{name:ye}=K;se(ye)}})):null):x.createElement(vs,{noDataText:A})))});yf.displayName="AreaChart";const _h=x.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:a,colors:o=_o,valueFormatter:s=xo,layout:l="horizontal",stack:c=!1,relative:u=!1,startEndOnly:d=!1,animationDuration:f=900,showAnimation:p=!1,showXAxis:h=!0,showYAxis:g=!0,yAxisWidth:b=56,intervalType:y="equidistantPreserveStart",showTooltip:v=!0,showLegend:k=!0,showGridLines:N=!0,autoMinValue:w=!1,minValue:E,maxValue:C,allowDecimals:O=!0,noDataText:D,onValueChange:A,enableLegendSlider:M=!1,customTooltip:I,rotateLabelX:T,barCategoryGap:R,tickGap:L=5,xAxisLabel:F,yAxisLabel:V,className:H,padding:$=h||g?{left:20,right:20}:{left:0,right:0}}=e,z=Be(e,["data","categories","index","colors","valueFormatter","layout","stack","relative","startEndOnly","animationDuration","showAnimation","showXAxis","showYAxis","yAxisWidth","intervalType","showTooltip","showLegend","showGridLines","autoMinValue","minValue","maxValue","allowDecimals","noDataText","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","barCategoryGap","tickGap","xAxisLabel","yAxisLabel","className","padding"]),W=I,[U,X]=m.useState(60),Y=vl(n,o),[ae,G]=x.useState(void 0),[ee,re]=m.useState(void 0),pe=!!A;function te(ne,K,ge){var ye,me,Se,Re;ge.stopPropagation(),A&&(bf(ae,Object.assign(Object.assign({},ne.payload),{value:ne.value}))?(re(void 0),G(void 0),A?.(null)):(re((me=(ye=ne.tooltipPayload)===null||ye===void 0?void 0:ye[0])===null||me===void 0?void 0:me.dataKey),G(Object.assign(Object.assign({},ne.payload),{value:ne.value})),A?.(Object.assign({eventType:"bar",categoryClicked:(Re=(Se=ne.tooltipPayload)===null||Se===void 0?void 0:Se[0])===null||Re===void 0?void 0:Re.dataKey},ne.payload))))}const se=ai(w,E,C);return x.createElement("div",Object.assign({ref:t,className:J("w-full h-80",H)},z),x.createElement(mi,{className:"h-full w-full"},r?.length?x.createElement(wD,{barCategoryGap:R,data:r,stackOffset:c?"sign":u?"expand":"none",layout:l==="vertical"?"vertical":"horizontal",onClick:pe&&(ee||ae)?()=>{G(void 0),re(void 0),A?.(null)}:void 0,margin:{bottom:F?30:void 0,left:V?20:void 0,right:V?5:void 0,top:5}},N?x.createElement(Uf,{className:J("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:l!=="vertical",vertical:l==="vertical"}):null,l!=="vertical"?x.createElement(Xn,{padding:$,hide:!h,dataKey:a,interval:d?"preserveStartEnd":y,tick:{transform:"translate(0, 6)"},ticks:d?[r[0][a],r[r.length-1][a]]:void 0,fill:"",stroke:"",className:J("mt-4 text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,angle:T?.angle,dy:T?.verticalShift,height:T?.xAxisHeight,minTickGap:L},F&&x.createElement(Nr,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},F)):x.createElement(Xn,{hide:!h,type:"number",tick:{transform:"translate(-3, 0)"},domain:se,fill:"",stroke:"",className:J("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,tickFormatter:s,minTickGap:L,allowDecimals:O,angle:T?.angle,dy:T?.verticalShift,height:T?.xAxisHeight},F&&x.createElement(Nr,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},F)),l!=="vertical"?x.createElement(Gn,{width:b,hide:!g,axisLine:!1,tickLine:!1,type:"number",domain:se,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:J("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:u?ne=>`${(100*ne).toString()} %`:s,allowDecimals:O},V&&x.createElement(Nr,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},V)):x.createElement(Gn,{width:b,hide:!g,dataKey:a,axisLine:!1,tickLine:!1,ticks:d?[r[0][a],r[r.length-1][a]]:void 0,type:"category",interval:"preserveStartEnd",tick:{transform:"translate(0, 6)"},fill:"",stroke:"",className:J("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content")},V&&x.createElement(Nr,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},V)),x.createElement(qn,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{fill:"#d1d5db",opacity:"0.15"},content:v?({active:ne,payload:K,label:ge})=>W?x.createElement(W,{payload:K?.map(ye=>{var me;return Object.assign(Object.assign({},ye),{color:(me=Y.get(ye.dataKey))!==null&&me!==void 0?me:Qe.Gray})}),active:ne,label:ge}):x.createElement(P1,{active:ne,payload:K,label:ge,valueFormatter:s,categoryColors:Y}):x.createElement(x.Fragment,null),position:{y:0}}),k?x.createElement(go,{verticalAlign:"top",height:U,content:({payload:ne})=>lb({payload:ne},Y,X,ee,pe?K=>{return ge=K,void(pe&&(ge!==ee||ae?(re(ge),A?.({eventType:"category",categoryClicked:ge})):(re(void 0),A?.(null)),G(void 0)));var ge}:void 0,M)}):null,n.map(ne=>{var K;return x.createElement(bi,{className:J(He((K=Y.get(ne))!==null&&K!==void 0?K:Qe.Gray,We.background).fillColor,A?"cursor-pointer":""),key:ne,name:ne,type:"linear",stackId:c||u?"a":void 0,dataKey:ne,fill:"",isAnimationActive:p,animationDuration:f,shape:ge=>((ye,me,Se,Re)=>{const{fillOpacity:Te,name:Je,payload:rt,value:De}=ye;let{x:ut,width:ct,y:Nt,height:yt}=ye;return Re==="horizontal"&&yt<0?(Nt+=yt,yt=Math.abs(yt)):Re==="vertical"&&ct<0&&(ut+=ct,ct=Math.abs(ct)),x.createElement("rect",{x:ut,y:Nt,width:ct,height:yt,opacity:me||Se&&Se!==Je?bf(me,Object.assign(Object.assign({},rt),{value:De}))?Te:.3:Te})})(ge,ae,ee,l),onClick:te})})):x.createElement(vs,{noDataText:D})))});_h.displayName="BarChart";const xfe=({active:e,payload:t,valueFormatter:r})=>{if(e&&t?.[0]){const n=t?.[0];return x.createElement(C1,null,x.createElement("div",{className:J("px-4 py-2")},x.createElement(O1,{value:r(n.value),name:n.name,color:n.payload.color})))}return null},vfe=(e,t)=>e.map((r,n)=>{const a=n<t.length?t[n]:Qe.Gray;return Object.assign(Object.assign({},r),{color:a,className:He(a??Qe.Gray,We.background).fillColor,fill:""})}),kfe=(e,t,r,n)=>e||t(((a,o)=>E1(a.map(s=>s[o])))(r,n)),wfe=e=>{const{cx:t,cy:r,innerRadius:n,outerRadius:a,startAngle:o,endAngle:s,className:l}=e;return x.createElement("g",null,x.createElement(m1,{cx:t,cy:r,innerRadius:n,outerRadius:a,startAngle:o,endAngle:s,className:l,fill:"",opacity:.3,style:{outline:"none"}}))},MD=x.forwardRef((e,t)=>{const{data:r=[],category:n="value",index:a="name",colors:o=_o,variant:s="donut",valueFormatter:l=xo,label:c,showLabel:u=!0,animationDuration:d=900,showAnimation:f=!1,showTooltip:p=!0,noDataText:h,onValueChange:g,customTooltip:b,className:y}=e,v=Be(e,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","noDataText","onValueChange","customTooltip","className"]),k=b,N=s=="donut",w=kfe(c,l,r,n),[E,C]=x.useState(void 0),O=!!g;return m.useEffect(()=>{const D=document.querySelectorAll(".recharts-pie-sector");D&&D.forEach(A=>{A.setAttribute("style","outline: none")})},[E]),x.createElement("div",Object.assign({ref:t,className:J("w-full h-40",y)},v),x.createElement(mi,{className:"h-full w-full"},r?.length?x.createElement(Ade,{onClick:O&&E?()=>{C(void 0),g?.(null)}:void 0,margin:{top:0,left:0,right:0,bottom:0}},u&&N?x.createElement("text",{className:J("fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis"),x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle"},w):null,x.createElement(bs,{className:J("stroke-tremor-background dark:stroke-dark-tremor-background",g?"cursor-pointer":"cursor-default"),data:vfe(r,o),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:N?"75%":"0%",outerRadius:"100%",stroke:"",strokeLinejoin:"round",dataKey:n,nameKey:a,isAnimationActive:f,animationDuration:d,onClick:function(D,A,M){M.stopPropagation(),O&&(E===A?(C(void 0),g?.(null)):(C(A),g?.(Object.assign({eventType:"slice"},D.payload.payload))))},activeIndex:E,inactiveShape:wfe,style:{outline:"none"}}),x.createElement(qn,{wrapperStyle:{outline:"none"},isAnimationActive:!1,content:p?({active:D,payload:A})=>{var M;return k?x.createElement(k,{payload:A?.map(I=>{var T,R,L;return Object.assign(Object.assign({},I),{color:(L=(R=(T=A?.[0])===null||T===void 0?void 0:T.payload)===null||R===void 0?void 0:R.color)!==null&&L!==void 0?L:Qe.Gray})}),active:D,label:(M=A?.[0])===null||M===void 0?void 0:M.name}):x.createElement(xfe,{active:D,payload:A,valueFormatter:l})}:x.createElement(x.Fragment,null)})):x.createElement(vs,{noDataText:h})))});MD.displayName="DonutChart";const TD=x.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:a,colors:o=_o,valueFormatter:s=xo,startEndOnly:l=!1,showXAxis:c=!0,showYAxis:u=!0,yAxisWidth:d=56,intervalType:f="equidistantPreserveStart",animationDuration:p=900,showAnimation:h=!1,showTooltip:g=!0,showLegend:b=!0,showGridLines:y=!0,autoMinValue:v=!1,curveType:k="linear",minValue:N,maxValue:w,connectNulls:E=!1,allowDecimals:C=!0,noDataText:O,className:D,onValueChange:A,enableLegendSlider:M=!1,customTooltip:I,rotateLabelX:T,padding:R=c||u?{left:20,right:20}:{left:0,right:0},tickGap:L=5,xAxisLabel:F,yAxisLabel:V}=e,H=Be(e,["data","categories","index","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","animationDuration","showAnimation","showTooltip","showLegend","showGridLines","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),$=I,[z,W]=m.useState(60),[U,X]=m.useState(void 0),[Y,ae]=m.useState(void 0),G=vl(n,o),ee=ai(v,N,w),re=!!A;function pe(te){re&&(te===Y&&!U||cc(r,te)&&U&&U.dataKey===te?(ae(void 0),A?.(null)):(ae(te),A?.({eventType:"category",categoryClicked:te})),X(void 0))}return x.createElement("div",Object.assign({ref:t,className:J("w-full h-80",D)},H),x.createElement(mi,{className:"h-full w-full"},r?.length?x.createElement(kD,{data:r,onClick:re&&(Y||U)?()=>{X(void 0),ae(void 0),A?.(null)}:void 0,margin:{bottom:F?30:void 0,left:V?20:void 0,right:V?5:void 0,top:5}},y?x.createElement(Uf,{className:J("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,x.createElement(Xn,{padding:R,hide:!c,dataKey:a,interval:l?"preserveStartEnd":f,tick:{transform:"translate(0, 6)"},ticks:l?[r[0][a],r[r.length-1][a]]:void 0,fill:"",stroke:"",className:J("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,minTickGap:L,angle:T?.angle,dy:T?.verticalShift,height:T?.xAxisHeight},F&&x.createElement(Nr,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},F)),x.createElement(Gn,{width:d,hide:!u,axisLine:!1,tickLine:!1,type:"number",domain:ee,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:J("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:s,allowDecimals:C},V&&x.createElement(Nr,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},V)),x.createElement(qn,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:g?({active:te,payload:se,label:ne})=>$?x.createElement($,{payload:se?.map(K=>{var ge;return Object.assign(Object.assign({},K),{color:(ge=G.get(K.dataKey))!==null&&ge!==void 0?ge:Qe.Gray})}),active:te,label:ne}):x.createElement(P1,{active:te,payload:se,label:ne,valueFormatter:s,categoryColors:G}):x.createElement(x.Fragment,null),position:{y:0}}),b?x.createElement(go,{verticalAlign:"top",height:z,content:({payload:te})=>lb({payload:te},G,W,Y,re?se=>pe(se):void 0,M)}):null,n.map(te=>{var se;return x.createElement(ni,{className:J(He((se=G.get(te))!==null&&se!==void 0?se:Qe.Gray,We.text).strokeColor),strokeOpacity:U||Y&&Y!==te?.3:1,activeDot:ne=>{var K;const{cx:ge,cy:ye,stroke:me,strokeLinecap:Se,strokeLinejoin:Re,strokeWidth:Te,dataKey:Je}=ne;return x.createElement(No,{className:J("stroke-tremor-background dark:stroke-dark-tremor-background",A?"cursor-pointer":"",He((K=G.get(Je))!==null&&K!==void 0?K:Qe.Gray,We.text).fillColor),cx:ge,cy:ye,r:5,fill:"",stroke:me,strokeLinecap:Se,strokeLinejoin:Re,strokeWidth:Te,onClick:(rt,De)=>function(ut,ct){ct.stopPropagation(),re&&(ut.index===U?.index&&ut.dataKey===U?.dataKey||cc(r,ut.dataKey)&&Y&&Y===ut.dataKey?(ae(void 0),X(void 0),A?.(null)):(ae(ut.dataKey),X({index:ut.index,dataKey:ut.dataKey}),A?.(Object.assign({eventType:"dot",categoryClicked:ut.dataKey},ut.payload))))}(ne,De)})},dot:ne=>{var K;const{stroke:ge,strokeLinecap:ye,strokeLinejoin:me,strokeWidth:Se,cx:Re,cy:Te,dataKey:Je,index:rt}=ne;return cc(r,te)&&!(U||Y&&Y!==te)||U?.index===rt&&U?.dataKey===te?x.createElement(No,{key:rt,cx:Re,cy:Te,r:5,stroke:ge,fill:"",strokeLinecap:ye,strokeLinejoin:me,strokeWidth:Se,className:J("stroke-tremor-background dark:stroke-dark-tremor-background",A?"cursor-pointer":"",He((K=G.get(Je))!==null&&K!==void 0?K:Qe.Gray,We.text).fillColor)}):x.createElement(m.Fragment,{key:rt})},key:te,name:te,type:k,dataKey:te,stroke:"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:h,animationDuration:p,connectNulls:E})}),A?n.map(te=>x.createElement(ni,{className:J("cursor-pointer"),strokeOpacity:0,key:te,name:te,type:k,dataKey:te,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:E,onClick:(se,ne)=>{ne.stopPropagation();const{name:K}=se;pe(K)}})):null):x.createElement(vs,{noDataText:O})))});TD.displayName="LineChart";const jfe=({children:e})=>x.createElement("div",{className:J("rounded-tremor-default text-tremor-default border","bg-tremor-background shadow-tremor-dropdown border-tremor-border","dark:bg-dark-tremor-background dark:shadow-dark-tremor-dropdown dark:border-dark-tremor-border")},e),Nfe=({value:e,name:t})=>x.createElement("div",{className:"flex items-center justify-between space-x-8"},x.createElement("div",{className:"flex items-center space-x-2"},x.createElement("p",{className:J("text-right whitespace-nowrap","text-tremor-content","dark:text-dark-tremor-content")},t)),x.createElement("p",{className:J("font-medium tabular-nums text-right whitespace-nowrap","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e)),Efe=({label:e,active:t,payload:r,valueFormatter:n,axis:a,category:o,categoryColors:s})=>{var l,c;return t&&r?x.createElement(jfe,null,x.createElement("div",{className:J("flex items-center space-x-2 border-b px-4 py-2","border-tremor-border","dark:border-dark-tremor-border")},x.createElement("span",{className:J("shrink-0 rounded-tremor-full border-2 h-3 w-3","border-tremor-background shadow-tremor-card","dark:border-dark-tremor-background dark:shadow-dark-tremor-card",He(o&&(c=s.get((l=r?.[0])===null||l===void 0?void 0:l.payload[o]))!==null&&c!==void 0?c:Qe.Blue,We.background).bgColor)}),x.createElement("p",{className:J("font-medium","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e)),x.createElement("div",{className:J("px-4 py-2 space-y-1")},r.map(({value:u,name:d},f)=>{var p,h;const g=(p=Object.keys(a).find(y=>a[y]===d))!==null&&p!==void 0?p:"",b=(h=n[g])!==null&&h!==void 0?h:xo;return x.createElement(Nfe,{key:`id-${f}`,value:n&&b?b(u):`${u}`,name:d})}))):null},Sfe=x.forwardRef((e,t)=>{const{data:r=[],x:n,y:a,size:o,category:s,colors:l=_o,showOpacity:c=!1,sizeRange:u=[1,1e3],valueFormatter:d={x:xo,y:xo,size:xo},startEndOnly:f=!1,showXAxis:p=!0,showYAxis:h=!0,yAxisWidth:g=56,intervalType:b="equidistantPreserveStart",animationDuration:y=900,showAnimation:v=!1,showTooltip:k=!0,showLegend:N=!0,showGridLines:w=!0,autoMinXValue:E=!1,minXValue:C,maxXValue:O,autoMinYValue:D=!1,minYValue:A,maxYValue:M,allowDecimals:I=!0,noDataText:T,onValueChange:R,customTooltip:L,rotateLabelX:F,className:V,enableLegendSlider:H=!1,tickGap:$=5,xAxisLabel:z,yAxisLabel:W}=e,U=Be(e,["data","x","y","size","category","colors","showOpacity","sizeRange","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","animationDuration","showAnimation","showTooltip","showLegend","showGridLines","autoMinXValue","minXValue","maxXValue","autoMinYValue","minYValue","maxYValue","allowDecimals","noDataText","onValueChange","customTooltip","rotateLabelX","className","enableLegendSlider","tickGap","xAxisLabel","yAxisLabel"]),X=L,[Y,ae]=m.useState(60),[G,ee]=x.useState(void 0),[re,pe]=m.useState(void 0),te=!!R;function se(me,Se,Re){Re.stopPropagation(),te&&(bf(G,me.node)?(pe(void 0),ee(void 0),R?.(null)):(ee(me.node),pe(me.payload[s]),R?.(Object.assign({eventType:"bubble",categoryClicked:me.payload[s]},me.payload))))}const ne=yfe(r,s),K=vl(ne,l),ge=ai(E,C,O),ye=ai(D,A,M);return x.createElement("div",Object.assign({ref:t,className:J("w-full h-80",V)},U),x.createElement(mi,{className:"h-full w-full"},r?.length?x.createElement(Mde,{onClick:te&&(re||G)?()=>{ee(void 0),pe(void 0),R?.(null)}:void 0,margin:{bottom:z?20:void 0,left:20,right:20,top:5}},w?x.createElement(Uf,{className:J("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!0}):null,n?x.createElement(Xn,{hide:!p,dataKey:n,interval:f?"preserveStartEnd":b,tick:{transform:"translate(0, 6)"},ticks:f?[r[0][n],r[r.length-1][n]]:void 0,type:"number",name:n,fill:"",stroke:"",className:J("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,tickFormatter:d.x,axisLine:!1,minTickGap:$,domain:ge,allowDataOverflow:!0,angle:F?.angle,dy:F?.verticalShift,height:F?.xAxisHeight},z&&x.createElement(Nr,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},z)):null,a?x.createElement(Gn,{width:g,hide:!h,axisLine:!1,tickLine:!1,dataKey:a,type:"number",name:a,domain:ye,tick:{transform:"translate(-3, 0)"},tickFormatter:d.y,fill:"",stroke:"",className:J("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),allowDecimals:I,allowDataOverflow:!0},W&&x.createElement(Nr,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},W)):null,x.createElement(qn,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:k?({active:me,payload:Se,label:Re})=>{var Te,Je;const rt=s?(Je=(Te=Se?.[0])===null||Te===void 0?void 0:Te.payload)===null||Je===void 0?void 0:Je[s]:Re;return X?x.createElement(X,{payload:Se?.map(De=>{var ut;return Object.assign(Object.assign({},De),{color:(ut=K.get(rt))!==null&&ut!==void 0?ut:Qe.Gray})}),active:me,label:rt}):x.createElement(Efe,{active:me,payload:Se,label:rt,valueFormatter:d,axis:{x:n,y:a,size:o},category:s,categoryColors:K})}:x.createElement(x.Fragment,null)}),o?x.createElement(qf,{dataKey:o,type:"number",range:u,name:o}):null,ne.map(me=>{var Se,Re;return x.createElement(Vf,{className:J(He((Se=K.get(me))!==null&&Se!==void 0?Se:Qe.Gray,We.text).fillColor,c?He((Re=K.get(me))!==null&&Re!==void 0?Re:Qe.Gray,We.text).strokeColor:"",R?"cursor-pointer":""),fill:`url(#${K.get(me)})`,fillOpacity:c?.7:1,key:me,name:me,data:s?r.filter(Te=>Te[s]===me):r,isAnimationActive:v,animationDuration:y,shape:Te=>((Je,rt,De)=>{const{cx:ut,cy:ct,width:Nt,node:yt,fillOpacity:ft,name:Ct}=Je;return x.createElement(No,{cx:ut,cy:ct,r:Nt/2,opacity:rt||De&&De!==Ct?bf(rt,yt)?ft:.3:ft})})(Te,G,re),onClick:se})}),N?x.createElement(go,{verticalAlign:"top",height:Y,content:({payload:me})=>lb({payload:me},K,ae,re,te?Se=>{return Re=Se,void(te&&(Re!==re||G?(pe(Re),R?.({eventType:"category",categoryClicked:Re})):(pe(void 0),R?.(null)),ee(void 0)));var Re}:void 0,H)}):null):x.createElement(vs,{noDataText:T})))});Sfe.displayName="ScatterChart";const _D=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M16.1716 10.9999L10.8076 5.63589L12.2218 4.22168L20 11.9999L12.2218 19.778L10.8076 18.3638L16.1716 12.9999H4V10.9999H16.1716Z"}))},Cfe=["100%","75%","50%","25%","0%"],Ofe=x.forwardRef((e,t)=>{var r,n;const{data:a,evolutionGradient:o=!1,gradient:s=!0,valueFormatter:l=xo,className:c,calculateFrom:u="first",color:d,variant:f="base",showGridLines:p=!0,showYAxis:h=u!=="previous",showXAxis:g=!0,showArrow:b=!0,xAxisLabel:y="",yAxisLabel:v="",yAxisPadding:k=h?v?70:45:0,showTooltip:N=!0,onValueChange:w,customTooltip:E,noDataText:C,rotateLabelX:O,barGap:D="20%"}=e,A=Be(e,["data","evolutionGradient","gradient","valueFormatter","className","calculateFrom","color","variant","showGridLines","showYAxis","showXAxis","showArrow","xAxisLabel","yAxisLabel","yAxisPadding","showTooltip","onValueChange","customTooltip","noDataText","rotateLabelX","barGap"]),M=g&&y?25:15,I=E,T=x.useRef(null),R=x.useRef(null),[L,F]=x.useState(0),[V,H]=x.useState(0),[$,z]=x.useState({x:0,y:0}),[W,U]=x.useState(void 0),X=!!w,Y=x.useMemo(()=>Math.max(...a.map(K=>K.value)),[a]),ae=L-10-k,G=x.useMemo(()=>{if(typeof D=="number")return D;if(typeof D=="string"&&D.endsWith("%")){const K=parseFloat(D.slice(0,-1));return ae*K/100/(a.length-1)}return console.error('Invalid barGap value. It must be a number or a percentage string (e.g., "10%").'),30},[ae,a.length,D]),ee=x.useMemo(()=>(ae-(a.length-1)*G-G)/a.length,[ae,G,a.length]),re=V-10-(g?(O?.xAxisHeight||M)+(g&&y?30:10):0),pe=u==="previous",te=f==="center";x.useLayoutEffect(()=>{const K=()=>{if(T.current){const ge=T.current.getBoundingClientRect();F(ge.width),H(ge.height)}};return K(),window.addEventListener("resize",K),()=>{window.removeEventListener("resize",K)}},[c]),x.useEffect(()=>{const K=()=>{if(R.current){const ge=R.current.getBoundingClientRect();ge.right>window.innerWidth&&(R.current.style.left=L-ge.width+"px")}};return K(),window.addEventListener("resize",K),()=>{window.removeEventListener("resize",K)}},[$,L]);const se=x.useMemo(()=>re<=0?[]:a.reduce((K,ge,ye)=>{var me,Se,Re,Te;const Je=K[ye-1],rt=ge.value,De=pe&&(me=Je?.value)!==null&&me!==void 0?me:Y,ut=pe&&(Se=Je?.barHeight)!==null&&Se!==void 0?Se:re,ct=rt/De,Nt=ct*ut,yt=ye*(ee+G)+.5*G,ft=ut-Nt+(pe?re-((Re=Je?.barHeight)!==null&&Re!==void 0?Re:re):0),Ct=(Te=a[ye+1])===null||Te===void 0?void 0:Te.value,Ae=Ct/De,ke=Ae*ut,Ie=(ye+1)*(ee+G)+.5*G;return K.push({value:rt,normalizedValue:ct,name:ge.name,startX:yt,startY:ft,barHeight:Nt,nextValue:Ct,nextNormalizedValue:Ae,nextBarHeight:ke,nextStartX:Ie}),K},[]),[a,re,pe,ee,G,Y]),ne=K=>{var ge;const ye=(ge=T.current)===null||ge===void 0?void 0:ge.getBoundingClientRect();if(!ye)return;const me=ye.x,Se=ye.y+window.scrollY,Re=me+window.scrollX+k+5,Te=Re+(ye.width-k-5),Je=Se+(ye.height-5-(g?M:0));if(K.pageX<Re||K.pageX>Te||K.pageY<Se||K.pageY>Je)return console.log("out of bounds"),z({x:0,y:0});const rt=K.pageX-me-ee/2-k-5,De=se.reduce((ct,Nt)=>Math.abs(Nt.startX-rt)<Math.abs(ct.startX-rt)?Nt:ct),ut=se.findIndex(ct=>ct===De);z({x:De.startX,y:De.startY,data:{dataKey:De.name,name:De.name,value:De.value,color:d??Qe.Blue,className:J(He(d??Qe.Blue,We.text).textColor,X?"cursor-pointer":"cursor-default"),fill:"",payload:De},index:ut})};return x.createElement("div",Object.assign({ref:t,className:J("tremor-wrapper relative w-full h-80",c)},A),a?.length?x.createElement(x.Fragment,null,x.createElement("svg",{ref:T,xmlns:"http://www.w3.org/2000/svg",className:J("w-full h-full"),onMouseMove:K=>{const ge={clientX:K.clientX,clientY:K.clientY,pageX:K.pageX,pageY:K.pageY};ne(ge)},onTouchMove:K=>{const ge=K.touches[0];ne(ge)},onMouseLeave:()=>z({x:0,y:0}),onTouchEnd:()=>z({x:0,y:0})},Cfe.map((K,ge)=>x.createElement(x.Fragment,{key:`y-axis-${ge}`},p?x.createElement("line",{x1:k+5,y1:ge*re/4+5,x2:L-5,y2:ge*re/4+5,stroke:"currentColor",className:J("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border")}):null,x.createElement("text",{x:k-10+5,y:ge*re/4+5+5,textAnchor:"end",fill:"",stroke:"",className:J("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content")},K))),se.map((K,ge)=>{var ye,me;return x.createElement("g",{key:`bar-${ge}`},x.createElement("rect",{x:K.startX-.5*G+5+k,y:5,width:ee+G,height:re,fill:"currentColor",className:J("z-0",$.index===ge?"text-[#d1d5db]/15":"text-transparent")}),s?x.createElement("rect",{x:K.startX+5+k,y:re-(pe&&((ye=se[ge-1])===null||ye===void 0?void 0:ye.barHeight)||re)+5,width:ee,height:(re-K.barHeight-(pe&&re-((me=se[ge-1])===null||me===void 0?void 0:me.barHeight)||0))/(te?2:1),fill:"url(#base-gradient)",className:J(W&&W.index!==ge?"opacity-30":"")}):null,x.createElement("rect",{x:K.startX+5+k,y:(te?re/2-K.barHeight/2:K.startY)+5,width:ee,height:K.barHeight,fill:"currentColor",className:J(He(d??Qe.Blue,We.text).textColor,W&&W.index!==ge?"opacity-30":"",X?"cursor-pointer":"cursor-default"),onClick:Se=>function(Re,Te,Je){Je.stopPropagation(),X&&(Te===W?.index?(U(void 0),w(void 0)):(U({data:Re,index:Te}),w({eventType:"bar",categoryClicked:Re.name,[Re.name]:Re.value,percentage:Re.normalizedValue})))}(K,ge,Se)}),s&&te?x.createElement("rect",{x:K.startX+5+k,y:re/2+K.barHeight/2+5,width:ee,height:(re-K.barHeight)/2,fill:"url(#base-gradient-revert)",className:J(W&&W.index!==ge?"opacity-30":"")}):null,g?x.createElement("foreignObject",{x:K.startX+5+k,y:re+5+10,width:ee,height:O?.xAxisHeight||M,transform:O?`rotate(${O?.angle}, ${K.startX+ee/2+5+k}, ${re+(O?.xAxisHeight||M)/2+5+(O?.verticalShift||0)})`:void 0},x.createElement("div",{className:J("truncate text-center !text-tremor-label","text-tremor-content","dark:text-dark-tremor-content"),title:K.name},K.name)):null)}),se.map((K,ge)=>x.createElement(x.Fragment,{key:`gradient-${ge}`},ge<a.length-1&&o?x.createElement(x.Fragment,null,te?x.createElement(x.Fragment,null,x.createElement("polygon",{points:`
97
- ${K.startX+ee+5+k}, ${re/2+K.nextBarHeight/4+5}
98
- ${K.nextStartX+5+k}, ${re/2+K.nextBarHeight/4+5}
99
- ${K.nextStartX+5+k}, ${re/2-K.nextBarHeight/2+5}
100
- ${K.startX+ee+5+k}, ${re/2-K.barHeight/2+5}
101
- `,fill:"url(#base-gradient)",className:J("z-10",W&&W.index!==ge?"opacity-30":"")}),x.createElement("polygon",{points:`
102
- ${K.startX+ee+5+k}, ${re/2+K.barHeight/2+5}
103
- ${K.nextStartX+5+k}, ${re/2+K.nextBarHeight/2+5}
104
- ${K.nextStartX+5+k}, ${re/2-K.nextBarHeight/4+5}
105
- ${K.startX+ee+5+k}, ${re/2-K.nextBarHeight/4+5}
106
- `,fill:"url(#base-gradient-revert)",className:J("z-10",W&&W.index!==ge?"opacity-30":"")})):x.createElement("polygon",{points:`
107
- ${K.startX+ee+5+k}, ${K.startY+5}
108
- ${K.nextStartX+5+k}, ${re-K.nextBarHeight+5}
109
- ${K.nextStartX+5+k}, ${re+5}
110
- ${K.startX+ee+5+k}, ${re+5}
111
- `,fill:"url(#base-gradient)",className:J("z-10",W&&W.index!==ge?"opacity-30":"")})):null,ge<a.length-1&&g&&b&&G>=14?x.createElement("foreignObject",{x:K.startX+ee+5+k-6+G/2,y:re+5+11,width:12,height:O?.xAxisHeight||M},x.createElement("div",{className:J("text-tremor-content","dark:text-dark-tremor-content")},x.createElement(_D,{className:"size-3.5 shrink-0"}))):null)),x.createElement("linearGradient",{id:"base-gradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",className:J(He(d??Qe.Blue,We.text).textColor)},x.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:.4}),x.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:0})),x.createElement("linearGradient",{id:"base-gradient-revert",x1:"0%",y1:"0%",x2:"0%",y2:"100%",className:J(He(d??Qe.Blue,We.text).textColor)},x.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:0}),x.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:.4})),g&&y?x.createElement("text",{x:L/2+k/2,y:re+5+50,style:{textAnchor:"middle"},fill:"",stroke:"",className:J("text-tremor-default cursor-default font-medium","fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis")},y):null,h&&v?x.createElement("text",{x:-5,y:re/2+10,textAnchor:"middle",style:{textAnchor:"middle"},transform:`rotate(-90, 0, ${re/2})`,fill:"",stroke:"",className:J("text-tremor-default cursor-default font-medium","fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis")},v):null),N?x.createElement("div",{ref:R,className:J("absolute top-0 pointer-events-none",$.data?"visible":"hidden"),tabIndex:-1,role:"dialog",style:{left:$.x+.66*ee}},I?x.createElement(I,{payload:$.data?[$.data]:[],active:!!$.data,label:(r=$.data)===null||r===void 0?void 0:r.name}):x.createElement(C1,null,x.createElement("div",{className:J("border-tremor-border border-b px-4 py-2","dark:border-dark-tremor-border")},x.createElement("p",{className:J("font-medium","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},(n=$?.data)===null||n===void 0?void 0:n.name)),x.createElement("div",{className:J("px-4 py-2 space-y-1")},$.data?x.createElement(O1,{value:l($.data.value),name:`${(100*$.data.payload.normalizedValue).toFixed(2)}%`,color:d??Qe.Blue}):null))):null):x.createElement(vs,{noDataText:C}))});Ofe.displayName="FunnelChart";var up=typeof document<"u"?m.useLayoutEffect:m.useEffect;function Ih(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!Ih(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[n]))return!1;for(n=r;n--!==0;){const o=a[n];if(!(o==="_owner"&&e.$$typeof)&&!Ih(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function RA(e){const t=m.useRef(e);return up(()=>{t.current=e}),t}function Pfe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,whileElementsMounted:o,open:s}=e,[l,c]=m.useState({x:null,y:null,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[u,d]=m.useState(n);Ih(u,n)||d(n);const f=m.useRef(null),p=m.useRef(null),h=m.useRef(l),g=RA(o),b=RA(a),[y,v]=m.useState(null),[k,N]=m.useState(null),w=m.useCallback(M=>{f.current!==M&&(f.current=M,v(M))},[]),E=m.useCallback(M=>{p.current!==M&&(p.current=M,N(M))},[]),C=m.useCallback(()=>{if(!f.current||!p.current)return;const M={placement:t,strategy:r,middleware:u};b.current&&(M.platform=b.current),Jj(f.current,p.current,M).then(I=>{const T={...I,isPositioned:!0};O.current&&!Ih(h.current,T)&&(h.current=T,Qt.flushSync(()=>{c(T)}))})},[u,t,r,b]);up(()=>{s===!1&&h.current.isPositioned&&(h.current.isPositioned=!1,c(M=>({...M,isPositioned:!1})))},[s]);const O=m.useRef(!1);up(()=>(O.current=!0,()=>{O.current=!1}),[]),up(()=>{if(y&&k){if(g.current)return g.current(y,k,C);C()}},[y,k,C,g]);const D=m.useMemo(()=>({reference:f,floating:p,setReference:w,setFloating:E}),[w,E]),A=m.useMemo(()=>({reference:y,floating:k}),[y,k]);return m.useMemo(()=>({...l,update:C,refs:D,elements:A,reference:w,floating:E}),[l,C,D,A,w,E])}var xf=typeof document<"u"?m.useLayoutEffect:m.useEffect;let Ok=!1,Afe=0;const FA=()=>"floating-ui-"+Afe++;function Mfe(){const[e,t]=m.useState(()=>Ok?FA():void 0);return xf(()=>{e==null&&t(FA())},[]),m.useEffect(()=>{Ok||(Ok=!0)},[]),e}const Tfe=m.useId,$A=Tfe||Mfe;function _fe(){const e=new Map;return{emit(t,r){var n;(n=e.get(t))==null||n.forEach(a=>a(r))},on(t,r){e.set(t,[...e.get(t)||[],r])},off(t,r){e.set(t,(e.get(t)||[]).filter(n=>n!==r))}}}const Ife=m.createContext(null),Dfe=m.createContext(null),ID=()=>{var e;return((e=m.useContext(Ife))==null?void 0:e.id)||null},A1=()=>m.useContext(Dfe);function Hs(e){return e?.ownerDocument||document}function Lfe(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Rfe(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:r,version:n}=t;return r+"/"+n}).join(" "):navigator.userAgent}function M1(e){return Hs(e).defaultView||window}function co(e){return e?e instanceof M1(e).Element:!1}function DD(e){return e?e instanceof M1(e).HTMLElement:!1}function Ffe(e){if(typeof ShadowRoot>"u")return!1;const t=M1(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function $fe(e){if(e.mozInputSource===0&&e.isTrusted)return!0;const t=/Android/i;return(t.test(Lfe())||t.test(Rfe()))&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Bfe(e){return e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType!=="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0}function LD(e,t){const r=["mouse","pen"];return r.push("",void 0),r.includes(e)}function BA(e){const t=m.useRef(e);return xf(()=>{t.current=e}),t}const HA="data-floating-ui-safe-polygon";function Pk(e,t,r){return r&&!LD(r)?0:typeof e=="number"?e:e?.[t]}const Hfe=function(e,t){let{enabled:r=!0,delay:n=0,handleClose:a=null,mouseOnly:o=!1,restMs:s=0,move:l=!0}=t===void 0?{}:t;const{open:c,onOpenChange:u,dataRef:d,events:f,elements:{domReference:p,floating:h},refs:g}=e,b=A1(),y=ID(),v=BA(a),k=BA(n),N=m.useRef(),w=m.useRef(),E=m.useRef(),C=m.useRef(),O=m.useRef(!0),D=m.useRef(!1),A=m.useRef(()=>{}),M=m.useCallback(()=>{var L;const F=(L=d.current.openEvent)==null?void 0:L.type;return F?.includes("mouse")&&F!=="mousedown"},[d]);m.useEffect(()=>{if(!r)return;function L(){clearTimeout(w.current),clearTimeout(C.current),O.current=!0}return f.on("dismiss",L),()=>{f.off("dismiss",L)}},[r,f]),m.useEffect(()=>{if(!r||!v.current||!c)return;function L(){M()&&u(!1)}const F=Hs(h).documentElement;return F.addEventListener("mouseleave",L),()=>{F.removeEventListener("mouseleave",L)}},[h,c,u,r,v,d,M]);const I=m.useCallback(function(L){L===void 0&&(L=!0);const F=Pk(k.current,"close",N.current);F&&!E.current?(clearTimeout(w.current),w.current=setTimeout(()=>u(!1),F)):L&&(clearTimeout(w.current),u(!1))},[k,u]),T=m.useCallback(()=>{A.current(),E.current=void 0},[]),R=m.useCallback(()=>{if(D.current){const L=Hs(g.floating.current).body;L.style.pointerEvents="",L.removeAttribute(HA),D.current=!1}},[g]);return m.useEffect(()=>{if(!r)return;function L(){return d.current.openEvent?["click","mousedown"].includes(d.current.openEvent.type):!1}function F($){if(clearTimeout(w.current),O.current=!1,o&&!LD(N.current)||s>0&&Pk(k.current,"open")===0)return;d.current.openEvent=$;const z=Pk(k.current,"open",N.current);z?w.current=setTimeout(()=>{u(!0)},z):u(!0)}function V($){if(L())return;A.current();const z=Hs(h);if(clearTimeout(C.current),v.current){c||clearTimeout(w.current),E.current=v.current({...e,tree:b,x:$.clientX,y:$.clientY,onClose(){R(),T(),I()}});const W=E.current;z.addEventListener("mousemove",W),A.current=()=>{z.removeEventListener("mousemove",W)};return}I()}function H($){L()||v.current==null||v.current({...e,tree:b,x:$.clientX,y:$.clientY,onClose(){R(),T(),I()}})($)}if(co(p)){const $=p;return c&&$.addEventListener("mouseleave",H),h?.addEventListener("mouseleave",H),l&&$.addEventListener("mousemove",F,{once:!0}),$.addEventListener("mouseenter",F),$.addEventListener("mouseleave",V),()=>{c&&$.removeEventListener("mouseleave",H),h?.removeEventListener("mouseleave",H),l&&$.removeEventListener("mousemove",F),$.removeEventListener("mouseenter",F),$.removeEventListener("mouseleave",V)}}},[p,h,r,e,o,s,l,I,T,R,u,c,b,k,v,d]),xf(()=>{var L;if(r&&c&&(L=v.current)!=null&&L.__options.blockPointerEvents&&M()){const H=Hs(h).body;if(H.setAttribute(HA,""),H.style.pointerEvents="none",D.current=!0,co(p)&&h){var F,V;const $=p,z=b==null||(F=b.nodesRef.current.find(W=>W.id===y))==null||(V=F.context)==null?void 0:V.elements.floating;return z&&(z.style.pointerEvents=""),$.style.pointerEvents="auto",h.style.pointerEvents="auto",()=>{$.style.pointerEvents="",h.style.pointerEvents=""}}}},[r,c,y,h,p,b,v,d,M]),xf(()=>{c||(N.current=void 0,T(),R())},[c,T,R]),m.useEffect(()=>()=>{T(),clearTimeout(w.current),clearTimeout(C.current),R()},[r,T,R]),m.useMemo(()=>{if(!r)return{};function L(F){N.current=F.pointerType}return{reference:{onPointerDown:L,onPointerEnter:L,onMouseMove(){c||s===0||(clearTimeout(C.current),C.current=setTimeout(()=>{O.current||u(!0)},s))}},floating:{onMouseEnter(){clearTimeout(w.current)},onMouseLeave(){f.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),I(!1)}}}},[f,r,s,c,u,I])};function zfe(e){let t=e.activeElement;for(;((r=t)==null||(n=r.shadowRoot)==null?void 0:n.activeElement)!=null;){var r,n;t=t.shadowRoot.activeElement}return t}function zA(e,t){if(!e||!t)return!1;const r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Ffe(r)){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}return!1}function Ak(e,t){let r=e.filter(a=>{var o;return a.parentId===t&&((o=a.context)==null?void 0:o.open)})||[],n=r;for(;n.length;)n=e.filter(a=>{var o;return(o=n)==null?void 0:o.some(s=>{var l;return a.parentId===s.id&&((l=a.context)==null?void 0:l.open)})})||[],r=r.concat(n);return r}function Ufe(e){return"composedPath"in e?e.composedPath()[0]:e.target}const qfe=m.useInsertionEffect,Vfe=qfe||(e=>e());function RD(e){const t=m.useRef(()=>{});return Vfe(()=>{t.current=e}),m.useCallback(function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.current==null?void 0:t.current(...n)},[])}function dp(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const r=e;return r.target!=null&&t.contains(r.target)}const Wfe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Kfe={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Yfe=function(e){var t,r;return e===void 0&&(e=!0),{escapeKeyBubbles:typeof e=="boolean"?e:(t=e.escapeKey)!=null?t:!0,outsidePressBubbles:typeof e=="boolean"?e:(r=e.outsidePress)!=null?r:!0}},Xfe=function(e,t){let{open:r,onOpenChange:n,events:a,nodeId:o,elements:{reference:s,domReference:l,floating:c},dataRef:u}=e,{enabled:d=!0,escapeKey:f=!0,outsidePress:p=!0,outsidePressEvent:h="pointerdown",referencePress:g=!1,referencePressEvent:b="pointerdown",ancestorScroll:y=!1,bubbles:v=!0}={};const k=A1(),N=ID()!=null,w=RD(typeof p=="function"?p:()=>!1),E=typeof p=="function"?w:p,C=m.useRef(!1),{escapeKeyBubbles:O,outsidePressBubbles:D}=Yfe(v);return m.useEffect(()=>{if(!r||!d)return;u.current.__escapeKeyBubbles=O,u.current.__outsidePressBubbles=D;function A(L){if(L.key==="Escape"){const F=k?Ak(k.nodesRef.current,o):[];if(F.length>0){let V=!0;if(F.forEach(H=>{var $;if(($=H.context)!=null&&$.open&&!H.context.dataRef.current.__escapeKeyBubbles){V=!1;return}}),!V)return}a.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),n(!1)}}function M(L){const F=C.current;if(C.current=!1,F||typeof E=="function"&&!E(L))return;const V=Ufe(L);if(DD(V)&&c){const z=c.ownerDocument.defaultView||window,W=V.scrollWidth>V.clientWidth,U=V.scrollHeight>V.clientHeight;let X=U&&L.offsetX>V.clientWidth;if(U&&z.getComputedStyle(V).direction==="rtl"&&(X=L.offsetX<=V.offsetWidth-V.clientWidth),X||W&&L.offsetY>V.clientHeight)return}const H=k&&Ak(k.nodesRef.current,o).some(z=>{var W;return dp(L,(W=z.context)==null?void 0:W.elements.floating)});if(dp(L,c)||dp(L,l)||H)return;const $=k?Ak(k.nodesRef.current,o):[];if($.length>0){let z=!0;if($.forEach(W=>{var U;if((U=W.context)!=null&&U.open&&!W.context.dataRef.current.__outsidePressBubbles){z=!1;return}}),!z)return}a.emit("dismiss",{type:"outsidePress",data:{returnFocus:N?{preventScroll:!0}:$fe(L)||Bfe(L)}}),n(!1)}function I(){n(!1)}const T=Hs(c);f&&T.addEventListener("keydown",A),E&&T.addEventListener(h,M);let R=[];return y&&(co(l)&&(R=Vs(l)),co(c)&&(R=R.concat(Vs(c))),!co(s)&&s&&s.contextElement&&(R=R.concat(Vs(s.contextElement)))),R=R.filter(L=>{var F;return L!==((F=T.defaultView)==null?void 0:F.visualViewport)}),R.forEach(L=>{L.addEventListener("scroll",I,{passive:!0})}),()=>{f&&T.removeEventListener("keydown",A),E&&T.removeEventListener(h,M),R.forEach(L=>{L.removeEventListener("scroll",I)})}},[u,c,l,s,f,E,h,a,k,o,r,n,y,d,O,D,N]),m.useEffect(()=>{C.current=!1},[E,h]),m.useMemo(()=>d?{reference:{[Wfe[b]]:()=>{g&&(a.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),n(!1))}},floating:{[Kfe[h]]:()=>{C.current=!0}}}:{},[d,a,g,h,b,n])},Gfe=function(e,t){let{open:r,onOpenChange:n,dataRef:a,events:o,refs:s,elements:{floating:l,domReference:c}}=e,{enabled:u=!0,keyboardOnly:d=!0}={};const f=m.useRef(""),p=m.useRef(!1),h=m.useRef();return m.useEffect(()=>{if(!u)return;const g=Hs(l).defaultView||window;function b(){!r&&DD(c)&&c===zfe(Hs(c))&&(p.current=!0)}return g.addEventListener("blur",b),()=>{g.removeEventListener("blur",b)}},[l,c,r,u]),m.useEffect(()=>{if(!u)return;function g(b){(b.type==="referencePress"||b.type==="escapeKey")&&(p.current=!0)}return o.on("dismiss",g),()=>{o.off("dismiss",g)}},[o,u]),m.useEffect(()=>()=>{clearTimeout(h.current)},[]),m.useMemo(()=>u?{reference:{onPointerDown(g){let{pointerType:b}=g;f.current=b,p.current=!!(b&&d)},onMouseLeave(){p.current=!1},onFocus(g){var b;p.current||g.type==="focus"&&((b=a.current.openEvent)==null?void 0:b.type)==="mousedown"&&a.current.openEvent&&dp(a.current.openEvent,c)||(a.current.openEvent=g.nativeEvent,n(!0))},onBlur(g){p.current=!1;const b=g.relatedTarget,y=co(b)&&b.hasAttribute("data-floating-ui-focus-guard")&&b.getAttribute("data-type")==="outside";h.current=setTimeout(()=>{zA(s.floating.current,b)||zA(c,b)||y||n(!1)})}}}:{},[u,d,c,s,a,n])},Zfe=function(e,t){let{open:r}=e,{enabled:n=!0,role:a="dialog"}=t===void 0?{}:t;const o=$A(),s=$A();return m.useMemo(()=>{const l={id:o,role:a};return n?a==="tooltip"?{reference:{"aria-describedby":r?o:void 0},floating:l}:{reference:{"aria-expanded":r?"true":"false","aria-haspopup":a==="alertdialog"?"dialog":a,"aria-controls":r?o:void 0,...a==="listbox"&&{role:"combobox"},...a==="menu"&&{id:s}},floating:{...l,...a==="menu"&&{"aria-labelledby":s}}}:{}},[n,a,r,o,s])};function Jfe(e){e===void 0&&(e={});const{open:t=!1,onOpenChange:r,nodeId:n}=e,a=Pfe(e),o=A1(),s=m.useRef(null),l=m.useRef({}),c=m.useState(()=>_fe())[0],[u,d]=m.useState(null),f=m.useCallback(v=>{const k=co(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),contextElement:v}:v;a.refs.setReference(k)},[a.refs]),p=m.useCallback(v=>{(co(v)||v===null)&&(s.current=v,d(v)),(co(a.refs.reference.current)||a.refs.reference.current===null||v!==null&&!co(v))&&a.refs.setReference(v)},[a.refs]),h=m.useMemo(()=>({...a.refs,setReference:p,setPositionReference:f,domReference:s}),[a.refs,p,f]),g=m.useMemo(()=>({...a.elements,domReference:u}),[a.elements,u]),b=RD(r),y=m.useMemo(()=>({...a,refs:h,elements:g,dataRef:l,nodeId:n,events:c,open:t,onOpenChange:b}),[a,n,c,t,b,h,g]);return xf(()=>{const v=o?.nodesRef.current.find(k=>k.id===n);v&&(v.context=y)}),m.useMemo(()=>({...a,context:y,refs:h,reference:p,positionReference:f}),[a,h,y,p,f])}function Mk(e,t,r){const n=new Map;return{...r==="floating"&&{tabIndex:-1},...e,...t.map(a=>a?a[r]:null).concat(e).reduce((a,o)=>(o&&Object.entries(o).forEach(s=>{let[l,c]=s;if(l.indexOf("on")===0){if(n.has(l)||n.set(l,[]),typeof c=="function"){var u;(u=n.get(l))==null||u.push(c),a[l]=function(){for(var d,f=arguments.length,p=new Array(f),h=0;h<f;h++)p[h]=arguments[h];(d=n.get(l))==null||d.forEach(g=>g(...p))}}}else a[l]=c}),a),{})}}const Qfe=function(e){e===void 0&&(e=[]);const t=e,r=m.useCallback(o=>Mk(o,e,"reference"),t),n=m.useCallback(o=>Mk(o,e,"floating"),t),a=m.useCallback(o=>Mk(o,e,"item"),e.map(o=>o?.item));return m.useMemo(()=>({getReferenceProps:r,getFloatingProps:n,getItemProps:a}),[r,n,a])},_a=e=>{const[t,r]=m.useState(!1),[n,a]=m.useState(),{x:o,y:s,refs:l,strategy:c,context:u}=Jfe({open:t,onOpenChange:y=>{if(y&&e){const v=setTimeout(()=>{r(y)},e);a(v)}else clearTimeout(n),r(y)},placement:"top",whileElementsMounted:lg,middleware:[Xj(5),Zj({fallbackAxisSideDirection:"start"}),Gj()]}),d=Hfe(u,{move:!1}),f=Gfe(u),p=Xfe(u),h=Zfe(u,{role:"tooltip"}),{getReferenceProps:g,getFloatingProps:b}=Qfe([d,f,p,h]);return{tooltipProps:{open:t,x:o,y:s,refs:l,strategy:c,getFloatingProps:b},getReferenceProps:g}},va=({text:e,open:t,x:r,y:n,refs:a,strategy:o,getFloatingProps:s})=>t&&e?x.createElement("div",Object.assign({className:J("max-w-xs text-sm z-20 rounded-tremor-default opacity-100 px-2.5 py-1","text-white bg-tremor-background-emphasis","dark:text-tremor-content-emphasis dark:bg-white"),ref:a.setFloating,style:{position:o,top:n??0,left:r??0}},s()),e):null;va.displayName="Tooltip";const Tk={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},UA={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},_k=kt("Badge"),Bt=x.forwardRef((e,t)=>{const{color:r,icon:n,size:a=ib.SM,tooltip:o,className:s,children:l}=e,c=Be(e,["color","icon","size","tooltip","className","children"]),u=n||null,{tooltipProps:d,getReferenceProps:f}=_a();return x.createElement("span",Object.assign({ref:xs([t,d.refs.setReference]),className:J(_k("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",r?J(He(r,We.background).bgColor,He(r,We.iconText).textColor,He(r,We.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):J("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),Tk[a].paddingX,Tk[a].paddingY,Tk[a].fontSize,s)},f,c),x.createElement(va,Object.assign({text:o},d)),u?x.createElement(u,{className:J(_k("icon"),"shrink-0 -ml-1 mr-1.5",UA[a].height,UA[a].width)}):null,x.createElement("span",{className:J(_k("text"),"whitespace-nowrap")},l))});Bt.displayName="Badge";const eme=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M13.0001 16.1716L18.3641 10.8076L19.7783 12.2218L12.0001 20L4.22192 12.2218L5.63614 10.8076L11.0001 16.1716V4H13.0001V16.1716Z"}))},tme=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M14.5895 16.0032L5.98291 7.39664L7.39712 5.98242L16.0037 14.589V7.00324H18.0037V18.0032H7.00373V16.0032H14.5895Z"}))},rme=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M13.0001 7.82843V20H11.0001V7.82843L5.63614 13.1924L4.22192 11.7782L12.0001 4L19.7783 11.7782L18.3641 13.1924L13.0001 7.82843Z"}))},nme=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M16.0037 9.41421L7.39712 18.0208L5.98291 16.6066L14.5895 8H7.00373V6H18.0037V17H16.0037V9.41421Z"}))},ame={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-1",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-1.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-1.5",fontSize:"text-lg"},xl:{paddingX:"px-3.5",paddingY:"py-1.5",fontSize:"text-xl"}},ome={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},qA={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},Ik={[Pr.Increase]:{bgColor:He(Qe.Emerald,We.background).bgColor,textColor:He(Qe.Emerald,We.iconText).textColor,ringColor:He(Qe.Emerald,We.iconRing).ringColor},[Pr.ModerateIncrease]:{bgColor:He(Qe.Emerald,We.background).bgColor,textColor:He(Qe.Emerald,We.iconText).textColor,ringColor:He(Qe.Emerald,We.iconRing).ringColor},[Pr.Decrease]:{bgColor:He(Qe.Red,We.background).bgColor,textColor:He(Qe.Red,We.iconText).textColor,ringColor:He(Qe.Red,We.iconRing).ringColor},[Pr.ModerateDecrease]:{bgColor:He(Qe.Red,We.background).bgColor,textColor:He(Qe.Red,We.iconText).textColor,ringColor:He(Qe.Red,We.iconRing).ringColor},[Pr.Unchanged]:{bgColor:He(Qe.Orange,We.background).bgColor,textColor:He(Qe.Orange,We.iconText).textColor,ringColor:He(Qe.Orange,We.iconRing).ringColor}},sme={[Pr.Increase]:rme,[Pr.ModerateIncrease]:nme,[Pr.Decrease]:eme,[Pr.ModerateDecrease]:tme,[Pr.Unchanged]:_D},Dk=kt("BadgeDelta"),ime=x.forwardRef((e,t)=>{const{deltaType:r=Pr.Increase,isIncreasePositive:n=!0,size:a=ib.SM,tooltip:o,children:s,className:l}=e,c=Be(e,["deltaType","isIncreasePositive","size","tooltip","children","className"]),u=sme[r],d=PD(r,n),f=s?ome:ame,{tooltipProps:p,getReferenceProps:h}=_a();return x.createElement("span",Object.assign({ref:xs([t,p.refs.setReference]),className:J(Dk("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",Ik[d].bgColor,Ik[d].textColor,Ik[d].ringColor,f[a].paddingX,f[a].paddingY,f[a].fontSize,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60",l)},h,c),x.createElement(va,Object.assign({text:o},p)),x.createElement(u,{className:J(Dk("icon"),"shrink-0",s?J("-ml-1 mr-1.5"):qA[a].height,qA[a].width)}),s?x.createElement("span",{className:J(Dk("text"),"whitespace-nowrap")},s):null)});ime.displayName="BadgeDelta";const VA={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},WA={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},Vm={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},lme=(e,t)=>{switch(e){case"simple":return{textColor:t?He(t,We.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?He(t,We.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?J(He(t,We.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?He(t,We.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?J(He(t,We.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?He(t,We.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?J(He(t,We.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?He(t,We.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?J(He(t,We.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?He(t,We.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?J(He(t,We.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},KA=kt("Icon"),cme={Simple:"simple"},FD=x.forwardRef((e,t)=>{const{icon:r,variant:n=cme.Simple,tooltip:a,size:o=ib.SM,color:s,className:l}=e,c=Be(e,["icon","variant","tooltip","size","color","className"]),u=r,d=lme(n,s),{tooltipProps:f,getReferenceProps:p}=_a();return x.createElement("span",Object.assign({ref:xs([t,f.refs.setReference]),className:J(KA("root"),"inline-flex shrink-0 items-center justify-center",d.bgColor,d.textColor,d.borderColor,d.ringColor,Vm[n].rounded,Vm[n].border,Vm[n].shadow,Vm[n].ring,VA[o].paddingX,VA[o].paddingY,l)},p,c),x.createElement(va,Object.assign({text:a},f)),x.createElement(u,{className:J(KA("icon"),"shrink-0",WA[o].height,WA[o].width)}))});FD.displayName="Icon";const lj=0,cj=1,Dh=2,Lh=3,Rh=4,ume=5,$D=6,dme=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],BD=e=>({_s:e,status:dme[e],isEnter:e<Lh,isMounted:e!==$D,isResolved:e===Dh||e>Rh}),uj=e=>e?$D:ume,fme=(e,t)=>{switch(e){case cj:case lj:return Dh;case Rh:case Lh:return uj(t)}},mme=e=>typeof e=="object"?[e.enter,e.exit]:[e,e],dj=(...e)=>setTimeout(...e),pme=(e,t)=>dj(()=>{isNaN(document.body.offsetTop)||e(t+1)},0),YA=(e,t,r,n,a)=>{clearTimeout(n.current);const o=BD(e);t(o),r.current=o,a&&a({current:o})},hme=({enter:e=!0,exit:t=!0,preEnter:r,preExit:n,timeout:a,initialEntered:o,mountOnEnter:s,unmountOnExit:l,onStateChange:c}={})=>{const[u,d]=m.useState(()=>BD(o?Dh:uj(s))),f=m.useRef(u),p=m.useRef(0),[h,g]=mme(a),b=m.useCallback(()=>{const y=fme(f.current._s,l);y&&YA(y,d,f,p,c)},[c,l]);return[u,m.useCallback(y=>{const v=N=>{switch(YA(N,d,f,p,c),N){case cj:h>=0&&(p.current=dj(b,h));break;case Rh:g>=0&&(p.current=dj(b,g));break;case lj:case Lh:p.current=pme(v,N);break}},k=f.current.isEnter;typeof y!="boolean"&&(y=!k),y?!k&&v(e?r?lj:cj:Dh):k&&v(t?n?Lh:Rh:uj(l))},[b,c,e,t,r,n,h,g,l]),b]},gme=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),x.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),x.createElement("path",{d:"M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z"}))},XA={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},bme=e=>e!=="light"?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}},Wm=(e,t)=>{switch(e){case"primary":return{textColor:t?He("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?He("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?He(t,We.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?He(t,We.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?He(t,We.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?He(t,We.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?He(t,We.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?He(t,We.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:He("transparent").bgColor,hoverBgColor:t?J(He(t,We.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:t?He(t,We.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?He(t,We.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?He(t,We.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:He("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},Fh=kt("Button"),GA=({loading:e,iconSize:t,iconPosition:r,Icon:n,needMargin:a,transitionStatus:o})=>{const s=a?r===ic.Left?J("-ml-1","mr-1.5"):J("-mr-1","ml-1.5"):"",l=J("w-0 h-0"),c={default:l,entering:l,entered:t,exiting:t,exited:l};return e?x.createElement(gme,{className:J(Fh("icon"),"animate-spin shrink-0",s,c.default,c[o]),style:{transition:"width 150ms"}}):x.createElement(n,{className:J(Fh("icon"),"shrink-0",t,s)})},uc=x.forwardRef((e,t)=>{const{icon:r,iconPosition:n=ic.Left,size:a=ib.SM,color:o,variant:s="primary",disabled:l,loading:c=!1,loadingText:u,children:d,tooltip:f,className:p}=e,h=Be(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),g=r,b=c||l,y=g!==void 0||c,v=c&&u,k=!(!d&&!v),N=J(XA[a].height,XA[a].width),w=s!=="light"?J("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",E=Wm(s,o),C=bme(s)[a],{tooltipProps:O,getReferenceProps:D}=_a(300),[A,M]=hme({timeout:50});return m.useEffect(()=>{M(c)},[c]),x.createElement("button",Object.assign({ref:xs([t,O.refs.setReference]),className:J(Fh("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",w,C.paddingX,C.paddingY,C.fontSize,E.textColor,E.bgColor,E.borderColor,E.hoverBorderColor,b?"opacity-50 cursor-not-allowed":J(Wm(s,o).hoverTextColor,Wm(s,o).hoverBgColor,Wm(s,o).hoverBorderColor),p),disabled:b},D,h),x.createElement(va,Object.assign({text:f},O)),y&&n!==ic.Right?x.createElement(GA,{loading:c,iconSize:N,iconPosition:n,Icon:g,transitionStatus:A.status,needMargin:k}):null,v||d?x.createElement("span",{className:J(Fh("text"),"text-tremor-default whitespace-nowrap")},v?u:d):null,y&&n===ic.Right?x.createElement(GA,{loading:c,iconSize:N,iconPosition:n,Icon:g,transitionStatus:A.status,needMargin:k}):null)});uc.displayName="Button";function Gt(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function Zn(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Ln(e,t){const r=Gt(e);return isNaN(t)?Zn(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function Ia(e,t){const r=Gt(e);if(isNaN(t))return Zn(e,NaN);if(!t)return r;const n=r.getDate(),a=Zn(e,r.getTime());a.setMonth(r.getMonth()+t+1,0);const o=a.getDate();return n>=o?a:(r.setFullYear(a.getFullYear(),a.getMonth(),n),r)}const T1=6048e5,yme=864e5;let xme={};function Kf(){return xme}function Eo(e,t){const r=Kf(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=Gt(e),o=a.getDay(),s=(o<n?7:0)+o-n;return a.setDate(a.getDate()-s),a.setHours(0,0,0,0),a}function fl(e){return Eo(e,{weekStartsOn:1})}function HD(e){const t=Gt(e),r=t.getFullYear(),n=Zn(e,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const a=fl(n),o=Zn(e,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);const s=fl(o);return t.getTime()>=a.getTime()?r+1:t.getTime()>=s.getTime()?r:r-1}function So(e){const t=Gt(e);return t.setHours(0,0,0,0),t}function $h(e){const t=Gt(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function uo(e,t){const r=So(e),n=So(t),a=+r-$h(r),o=+n-$h(n);return Math.round((a-o)/yme)}function vme(e){const t=HD(e),r=Zn(e,0);return r.setFullYear(t,0,4),r.setHours(0,0,0,0),fl(r)}function fj(e,t){const r=t*7;return Ln(e,r)}function mj(e,t){return Ia(e,t*12)}function zD(e){let t;return e.forEach(function(r){const n=Gt(r);(t===void 0||t<n||isNaN(Number(n)))&&(t=n)}),t||new Date(NaN)}function UD(e){let t;return e.forEach(r=>{const n=Gt(r);(!t||t>n||isNaN(+n))&&(t=n)}),t||new Date(NaN)}function Kn(e,t){const r=So(e),n=So(t);return+r==+n}function _1(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function kme(e){if(!_1(e)&&typeof e!="number")return!1;const t=Gt(e);return!isNaN(Number(t))}function vf(e,t){const r=Gt(e),n=Gt(t),a=r.getFullYear()-n.getFullYear(),o=r.getMonth()-n.getMonth();return a*12+o}function wme(e,t,r){const n=Eo(e,r),a=Eo(t,r),o=+n-$h(n),s=+a-$h(a);return Math.round((o-s)/T1)}function I1(e){const t=Gt(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function Cn(e){const t=Gt(e);return t.setDate(1),t.setHours(0,0,0,0),t}function D1(e){const t=Gt(e),r=Zn(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}function L1(e,t){const r=Kf(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=Gt(e),o=a.getDay(),s=(o<n?-7:0)+6-(o-n);return a.setDate(a.getDate()+s),a.setHours(23,59,59,999),a}function qD(e){return L1(e,{weekStartsOn:1})}const jme={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Nme=(e,t,r)=>{let n;const a=jme[e];return typeof a=="string"?n=a:t===1?n=a.one:n=a.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function Lk(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const Eme={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Sme={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Cme={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ome={date:Lk({formats:Eme,defaultWidth:"full"}),time:Lk({formats:Sme,defaultWidth:"full"}),dateTime:Lk({formats:Cme,defaultWidth:"full"})},Pme={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ame=(e,t,r,n)=>Pme[e];function Zu(e){return(t,r)=>{const n=r?.context?String(r.context):"standalone";let a;if(n==="formatting"&&e.formattingValues){const s=e.defaultFormattingWidth||e.defaultWidth,l=r?.width?String(r.width):s;a=e.formattingValues[l]||e.formattingValues[s]}else{const s=e.defaultWidth,l=r?.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[s]}const o=e.argumentCallback?e.argumentCallback(t):t;return a[o]}}const Mme={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Tme={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},_me={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Ime={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Dme={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Lme={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Rme=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Fme={ordinalNumber:Rme,era:Zu({values:Mme,defaultWidth:"wide"}),quarter:Zu({values:Tme,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Zu({values:_me,defaultWidth:"wide"}),day:Zu({values:Ime,defaultWidth:"wide"}),dayPeriod:Zu({values:Dme,defaultWidth:"wide",formattingValues:Lme,defaultFormattingWidth:"wide"})};function Ju(e){return(t,r={})=>{const n=r.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;const s=o[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?Bme(l,f=>f.test(s)):$me(l,f=>f.test(s));let u;u=e.valueCallback?e.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const d=t.slice(s.length);return{value:u,rest:d}}}function $me(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function Bme(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function Hme(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const a=n[0],o=t.match(e.parsePattern);if(!o)return null;let s=e.valueCallback?e.valueCallback(o[0]):o[0];s=r.valueCallback?r.valueCallback(s):s;const l=t.slice(a.length);return{value:s,rest:l}}}const zme=/^(\d+)(th|st|nd|rd)?/i,Ume=/\d+/i,qme={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Vme={any:[/^b/i,/^(a|c)/i]},Wme={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Kme={any:[/1/i,/2/i,/3/i,/4/i]},Yme={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Xme={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Gme={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Zme={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Jme={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Qme={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},epe={ordinalNumber:Hme({matchPattern:zme,parsePattern:Ume,valueCallback:e=>parseInt(e,10)}),era:Ju({matchPatterns:qme,defaultMatchWidth:"wide",parsePatterns:Vme,defaultParseWidth:"any"}),quarter:Ju({matchPatterns:Wme,defaultMatchWidth:"wide",parsePatterns:Kme,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ju({matchPatterns:Yme,defaultMatchWidth:"wide",parsePatterns:Xme,defaultParseWidth:"any"}),day:Ju({matchPatterns:Gme,defaultMatchWidth:"wide",parsePatterns:Zme,defaultParseWidth:"any"}),dayPeriod:Ju({matchPatterns:Jme,defaultMatchWidth:"any",parsePatterns:Qme,defaultParseWidth:"any"})},cb={code:"en-US",formatDistance:Nme,formatLong:Ome,formatRelative:Ame,localize:Fme,match:epe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function tpe(e){const t=Gt(e);return uo(t,D1(t))+1}function VD(e){const t=Gt(e),r=+fl(t)-+vme(t);return Math.round(r/T1)+1}function WD(e,t){const r=Gt(e),n=r.getFullYear(),a=Kf(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,s=Zn(e,0);s.setFullYear(n+1,0,o),s.setHours(0,0,0,0);const l=Eo(s,t),c=Zn(e,0);c.setFullYear(n,0,o),c.setHours(0,0,0,0);const u=Eo(c,t);return r.getTime()>=l.getTime()?n+1:r.getTime()>=u.getTime()?n:n-1}function rpe(e,t){const r=Kf(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=WD(e,t),o=Zn(e,0);return o.setFullYear(a,0,n),o.setHours(0,0,0,0),Eo(o,t)}function KD(e,t){const r=Gt(e),n=+Eo(r,t)-+rpe(r,t);return Math.round(n/T1)+1}function br(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const Cs={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return br(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):br(r+1,2)},d(e,t){return br(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return r==="am"?"a.m.":"p.m."}},h(e,t){return br(e.getHours()%12||12,t.length)},H(e,t){return br(e.getHours(),t.length)},m(e,t){return br(e.getMinutes(),t.length)},s(e,t){return br(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),a=Math.trunc(n*Math.pow(10,r-3));return br(a,t.length)}},Il={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ZA={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return Cs.y(e,t)},Y:function(e,t,r,n){const a=WD(e,n),o=a>0?a:1-a;if(t==="YY"){const s=o%100;return br(s,2)}return t==="Yo"?r.ordinalNumber(o,{unit:"year"}):br(o,t.length)},R:function(e,t){const r=HD(e);return br(r,t.length)},u:function(e,t){const r=e.getFullYear();return br(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return br(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return br(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return Cs.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return br(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const a=KD(e,n);return t==="wo"?r.ordinalNumber(a,{unit:"week"}):br(a,t.length)},I:function(e,t,r){const n=VD(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):br(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):Cs.d(e,t)},D:function(e,t,r){const n=tpe(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):br(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return br(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return br(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),a=n===0?7:n;switch(t){case"i":return String(a);case"ii":return br(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let a;switch(n===12?a=Il.noon:n===0?a=Il.midnight:a=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(a,{width:"narrow",context:"formatting"});default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let a;switch(n>=17?a=Il.evening:n>=12?a=Il.afternoon:n>=4?a=Il.morning:a=Il.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(a,{width:"narrow",context:"formatting"});default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return Cs.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):Cs.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):br(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):br(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):Cs.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):Cs.s(e,t)},S:function(e,t){return Cs.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return QA(n);case"XXXX":case"XX":return _i(n);default:return _i(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return QA(n);case"xxxx":case"xx":return _i(n);default:return _i(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+JA(n,":");default:return"GMT"+_i(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+JA(n,":");default:return"GMT"+_i(n,":")}},t:function(e,t,r){const n=Math.trunc(e.getTime()/1e3);return br(n,t.length)},T:function(e,t,r){const n=e.getTime();return br(n,t.length)}};function JA(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),o=n%60;return o===0?r+String(a):r+String(a)+t+br(o,2)}function QA(e,t){return e%60===0?(e>0?"-":"+")+br(Math.abs(e)/60,2):_i(e,t)}function _i(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=br(Math.trunc(n/60),2),o=br(n%60,2);return r+a+t+o}const e7=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},YD=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},npe=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],a=r[2];if(!a)return e7(e,t);let o;switch(n){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",e7(n,t)).replace("{{time}}",YD(a,t))},ape={p:YD,P:npe},ope=/^D+$/,spe=/^Y+$/,ipe=["D","DD","YY","YYYY"];function lpe(e){return ope.test(e)}function cpe(e){return spe.test(e)}function upe(e,t,r){const n=dpe(e,t,r);if(console.warn(n),ipe.includes(e))throw new RangeError(n)}function dpe(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const fpe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,mpe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ppe=/^'([^]*?)'?$/,hpe=/''/g,gpe=/[a-zA-Z]/;function Vn(e,t,r){const n=Kf(),a=r?.locale??n.locale??cb,o=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,l=Gt(e);if(!kme(l))throw new RangeError("Invalid time value");let c=t.match(mpe).map(d=>{const f=d[0];if(f==="p"||f==="P"){const p=ape[f];return p(d,a.formatLong)}return d}).join("").match(fpe).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const f=d[0];if(f==="'")return{isToken:!1,value:bpe(d)};if(ZA[f])return{isToken:!0,value:d};if(f.match(gpe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+f+"`");return{isToken:!1,value:d}});a.localize.preprocessor&&(c=a.localize.preprocessor(l,c));const u={firstWeekContainsDate:o,weekStartsOn:s,locale:a};return c.map(d=>{if(!d.isToken)return d.value;const f=d.value;(!r?.useAdditionalWeekYearTokens&&cpe(f)||!r?.useAdditionalDayOfYearTokens&&lpe(f))&&upe(f,t,String(e));const p=ZA[f[0]];return p(l,f,a.localize,u)}).join("")}function bpe(e){const t=e.match(ppe);return t?t[1].replace(hpe,"'"):e}function ype(e){const t=Gt(e),r=t.getFullYear(),n=t.getMonth(),a=Zn(e,0);return a.setFullYear(r,n+1,0),a.setHours(0,0,0,0),a.getDate()}function xpe(e){return Math.trunc(+Gt(e)/1e3)}function vpe(e){const t=Gt(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(0,0,0,0),t}function kpe(e,t){return wme(vpe(e),Cn(e),t)+1}function pj(e,t){const r=Gt(e),n=Gt(t);return r.getTime()>n.getTime()}function XD(e,t){const r=Gt(e),n=Gt(t);return+r<+n}function wpe(e,t){const r=Gt(e),n=Gt(t);return+r==+n}function R1(e,t){const r=Gt(e),n=Gt(t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function jpe(e,t){const r=Gt(e),n=Gt(t);return r.getFullYear()===n.getFullYear()}function fp(e,t){return Ln(e,-t)}function Rk(e,t){const r=Gt(e),n=r.getFullYear(),a=r.getDate(),o=Zn(e,0);o.setFullYear(n,t,15),o.setHours(0,0,0,0);const s=ype(o);return r.setMonth(t,Math.min(a,s)),r}function t7(e,t){const r=Gt(e);return isNaN(+r)?Zn(e,NaN):(r.setFullYear(t),r)}function Ls(){return So(Date.now())}function Npe(e,t){return Ia(e,-t)}function r7(e,t){const{years:r=0,months:n=0,weeks:a=0,days:o=0,hours:s=0,minutes:l=0,seconds:c=0}=t,u=Npe(e,n+r*12),d=fp(u,o+a*7),f=l+s*60,p=(c+f*60)*1e3;return Zn(e,d.getTime()-p)}var Epe=Object.defineProperty,Spe=(e,t,r)=>t in e?Epe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fk=(e,t,r)=>(Spe(e,typeof t!="symbol"?t+"":t,r),r);let Cpe=class{constructor(){Fk(this,"current",this.detect()),Fk(this,"handoffState","pending"),Fk(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},el=new Cpe;function Io(e){return el.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}function Yf(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Xa(){let e=[],t={addEventListener(r,n,a,o){return r.addEventListener(n,a,o),t.add(()=>r.removeEventListener(n,a,o))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return t.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return Yf(()=>{n.current&&r[0]()}),t.add(()=>{n.current=!1})},style(r,n,a){let o=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:a}),this.add(()=>{Object.assign(r.style,{[n]:o})})},group(r){let n=Xa();return r(n),this.add(()=>n.dispose())},add(r){return e.includes(r)||e.push(r),()=>{let n=e.indexOf(r);if(n>=0)for(let a of e.splice(n,1))a()}},dispose(){for(let r of e.splice(0))r()}};return t}function Do(){let[e]=m.useState(Xa);return m.useEffect(()=>()=>e.dispose(),[e]),e}let Ut=(e,t)=>{el.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function Hn(e){let t=m.useRef(e);return Ut(()=>{t.current=e},[e]),t}let Me=function(e){let t=Hn(e);return x.useCallback((...r)=>t.current(...r),[t])};function Ope(e){let t=e.width/2,r=e.height/2;return{top:e.clientY-r,right:e.clientX+t,bottom:e.clientY+r,left:e.clientX-t}}function Ppe(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function hu({disabled:e=!1}={}){let t=m.useRef(null),[r,n]=m.useState(!1),a=Do(),o=Me(()=>{t.current=null,n(!1),a.dispose()}),s=Me(l=>{if(a.dispose(),t.current===null){t.current=l.currentTarget,n(!0);{let c=Io(l.currentTarget);a.addEventListener(c,"pointerup",o,!1),a.addEventListener(c,"pointermove",u=>{if(t.current){let d=Ope(u);n(Ppe(d,t.current.getBoundingClientRect()))}},!1),a.addEventListener(c,"pointercancel",o,!1)}}});return{pressed:r,pressProps:e?{}:{onPointerDown:s,onPointerUp:o,onClick:o}}}let Ape=m.createContext(void 0);function Xf(){return m.useContext(Ape)}function hj(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function Xt(e,t,...r){if(e in t){let a=t[e];return typeof a=="function"?a(...r):a}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(a=>`"${a}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Xt),n}var In=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(In||{}),zs=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(zs||{});function Vt(){let e=Tpe();return m.useCallback(t=>Mpe({mergeRefs:e,...t}),[e])}function Mpe({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:a,visible:o=!0,name:s,mergeRefs:l}){l=l??_pe;let c=GD(t,e);if(o)return Km(c,r,n,s,l);let u=a??0;if(u&2){let{static:d=!1,...f}=c;if(d)return Km(f,r,n,s,l)}if(u&1){let{unmount:d=!0,...f}=c;return Xt(d?0:1,{0(){return null},1(){return Km({...f,hidden:!0,style:{display:"none"}},r,n,s,l)}})}return Km(c,r,n,s,l)}function Km(e,t={},r,n,a){let{as:o=r,children:s,refName:l="ref",...c}=$k(e,["unmount","static"]),u=e.ref!==void 0?{[l]:e.ref}:{},d=typeof s=="function"?s(t):s;"className"in c&&c.className&&typeof c.className=="function"&&(c.className=c.className(t)),c["aria-labelledby"]&&c["aria-labelledby"]===c.id&&(c["aria-labelledby"]=void 0);let f={};if(t){let p=!1,h=[];for(let[g,b]of Object.entries(t))typeof b=="boolean"&&(p=!0),b===!0&&h.push(g.replace(/([A-Z])/g,y=>`-${y.toLowerCase()}`));if(p){f["data-headlessui-state"]=h.join(" ");for(let g of h)f[`data-${g}`]=""}}if(o===m.Fragment&&(Object.keys(_s(c)).length>0||Object.keys(_s(f)).length>0))if(!m.isValidElement(d)||Array.isArray(d)&&d.length>1){if(Object.keys(_s(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(_s(c)).concat(Object.keys(_s(f))).map(p=>` - ${p}`).join(`
112
- `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(p=>` - ${p}`).join(`
113
- `)].join(`
114
- `))}else{let p=d.props,h=p?.className,g=typeof h=="function"?(...v)=>hj(h(...v),c.className):hj(h,c.className),b=g?{className:g}:{},y=GD(d.props,_s($k(c,["ref"])));for(let v in f)v in y&&delete f[v];return m.cloneElement(d,Object.assign({},y,f,u,{ref:a(Ipe(d),u.ref)},b))}return m.createElement(o,Object.assign({},$k(c,["ref"]),o!==m.Fragment&&u,o!==m.Fragment&&f),d)}function Tpe(){let e=m.useRef([]),t=m.useCallback(r=>{for(let n of e.current)n!=null&&(typeof n=="function"?n(r):n.current=r)},[]);return(...r)=>{if(!r.every(n=>n==null))return e.current=r,t}}function _pe(...e){return e.every(t=>t==null)?void 0:t=>{for(let r of e)r!=null&&(typeof r=="function"?r(t):r.current=t)}}function GD(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let a in n)a.startsWith("on")&&typeof n[a]=="function"?(r[a]!=null||(r[a]=[]),r[a].push(n[a])):t[a]=n[a];if(t.disabled||t["aria-disabled"])for(let n in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(n)&&(r[n]=[a=>{var o;return(o=a?.preventDefault)==null?void 0:o.call(a)}]);for(let n in r)Object.assign(t,{[n](a,...o){let s=r[n];for(let l of s){if((a instanceof Event||a?.nativeEvent instanceof Event)&&a.defaultPrevented)return;l(a,...o)}}});return t}function Qa(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let a in n)a.startsWith("on")&&typeof n[a]=="function"?(r[a]!=null||(r[a]=[]),r[a].push(n[a])):t[a]=n[a];for(let n in r)Object.assign(t,{[n](...a){let o=r[n];for(let s of o)s?.(...a)}});return t}function Ht(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function _s(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function $k(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}function Ipe(e){return x.version.split(".")[0]>="19"?e.props.ref:e.ref}function F1(e,t,r){let[n,a]=m.useState(r),o=e!==void 0,s=m.useRef(o),l=m.useRef(!1),c=m.useRef(!1);return o&&!s.current&&!l.current?(l.current=!0,s.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!o&&s.current&&!c.current&&(c.current=!0,s.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[o?e:n,Me(u=>(o||a(u),t?.(u)))]}function $1(e){let[t]=m.useState(e);return t}function ZD(e={},t=null,r=[]){for(let[n,a]of Object.entries(e))QD(r,JD(t,n),a);return r}function JD(e,t){return e?e+"["+t+"]":t}function QD(e,t,r){if(Array.isArray(r))for(let[n,a]of r.entries())QD(e,JD(t,n.toString()),a);else r instanceof Date?e.push([t,r.toISOString()]):typeof r=="boolean"?e.push([t,r?"1":"0"]):typeof r=="string"?e.push([t,r]):typeof r=="number"?e.push([t,`${r}`]):r==null?e.push([t,""]):ZD(r,t,e)}function eL(e){var t,r;let n=(t=e?.form)!=null?t:e.closest("form");if(n){for(let a of n.elements)if(a!==e&&(a.tagName==="INPUT"&&a.type==="submit"||a.tagName==="BUTTON"&&a.type==="submit"||a.nodeName==="INPUT"&&a.type==="image")){a.click();return}(r=n.requestSubmit)==null||r.call(n)}}let Dpe="span";var Co=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Co||{});function Lpe(e,t){var r;let{features:n=1,...a}=e,o={ref:t,"aria-hidden":(n&2)===2?!0:(r=a["aria-hidden"])!=null?r:void 0,hidden:(n&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return Vt()({ourProps:o,theirProps:a,slot:{},defaultTag:Dpe,name:"Hidden"})}let Oo=Ht(Lpe),Rpe=m.createContext(null);function Fpe({children:e}){let t=m.useContext(Rpe);if(!t)return x.createElement(x.Fragment,null,e);let{target:r}=t;return r?Qt.createPortal(x.createElement(x.Fragment,null,e),r):null}function B1({data:e,form:t,disabled:r,onReset:n,overrides:a}){let[o,s]=m.useState(null),l=Do();return m.useEffect(()=>{if(n&&o)return l.addEventListener(o,"reset",n)},[o,t,n]),x.createElement(Fpe,null,x.createElement($pe,{setForm:s,formId:t}),ZD(e).map(([c,u])=>x.createElement(Oo,{features:Co.Hidden,..._s({key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:r,name:c,value:u,...a})})))}function $pe({setForm:e,formId:t}){return m.useEffect(()=>{if(t){let r=document.getElementById(t);r&&e(r)}},[e,t]),t?null:x.createElement(Oo,{features:Co.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:r=>{if(!r)return;let n=r.closest("form");n&&e(n)}})}let Bpe=m.createContext(void 0);function ub(){return m.useContext(Bpe)}function gu(e){let t=e.parentElement,r=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(r=t),t=t.parentElement;let n=t?.getAttribute("disabled")==="";return n&&Hpe(r)?!1:n}function Hpe(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}let tL=Symbol();function H1(e,t=!0){return Object.assign(e,{[tL]:t})}function Zt(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let r=Me(n=>{for(let a of t.current)a!=null&&(typeof a=="function"?a(n):a.current=n)});return e.every(n=>n==null||n?.[tL])?void 0:r}let db=m.createContext(null);db.displayName="DescriptionContext";function rL(){let e=m.useContext(db);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,rL),t}return e}function z1(){var e,t;return(t=(e=m.useContext(db))==null?void 0:e.value)!=null?t:void 0}function nL(){let[e,t]=m.useState([]);return[e.length>0?e.join(" "):void 0,m.useMemo(()=>function(r){let n=Me(o=>(t(s=>[...s,o]),()=>t(s=>{let l=s.slice(),c=l.indexOf(o);return c!==-1&&l.splice(c,1),l}))),a=m.useMemo(()=>({register:n,slot:r.slot,name:r.name,props:r.props,value:r.value}),[n,r.slot,r.name,r.props,r.value]);return x.createElement(db.Provider,{value:a},r.children)},[t])]}let zpe="p";function Upe(e,t){let r=m.useId(),n=Xf(),{id:a=`headlessui-description-${r}`,...o}=e,s=rL(),l=Zt(t);Ut(()=>s.register(a),[a,s.register]);let c=n||!1,u=m.useMemo(()=>({...s.slot,disabled:c}),[s.slot,c]),d={ref:l,...s.props,id:a};return Vt()({ourProps:d,theirProps:o,slot:u,defaultTag:zpe,name:s.name||"Description"})}let qpe=Ht(Upe),aL=Object.assign(qpe,{});var bt=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(bt||{});let fb=m.createContext(null);fb.displayName="LabelContext";function oL(){let e=m.useContext(fb);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,oL),t}return e}function bu(e){var t,r,n;let a=(r=(t=m.useContext(fb))==null?void 0:t.value)!=null?r:void 0;return((n=e?.length)!=null?n:0)>0?[a,...e].filter(Boolean).join(" "):a}function U1({inherit:e=!1}={}){let t=bu(),[r,n]=m.useState([]),a=e?[t,...r].filter(Boolean):r;return[a.length>0?a.join(" "):void 0,m.useMemo(()=>function(o){let s=Me(c=>(n(u=>[...u,c]),()=>n(u=>{let d=u.slice(),f=d.indexOf(c);return f!==-1&&d.splice(f,1),d}))),l=m.useMemo(()=>({register:s,slot:o.slot,name:o.name,props:o.props,value:o.value}),[s,o.slot,o.name,o.props,o.value]);return x.createElement(fb.Provider,{value:l},o.children)},[n])]}let Vpe="label";function Wpe(e,t){var r;let n=m.useId(),a=oL(),o=ub(),s=Xf(),{id:l=`headlessui-label-${n}`,htmlFor:c=o??((r=a.props)==null?void 0:r.htmlFor),passive:u=!1,...d}=e,f=Zt(t);Ut(()=>a.register(l),[l,a.register]);let p=Me(y=>{let v=y.currentTarget;if(v instanceof HTMLLabelElement&&y.preventDefault(),a.props&&"onClick"in a.props&&typeof a.props.onClick=="function"&&a.props.onClick(y),v instanceof HTMLLabelElement){let k=document.getElementById(v.htmlFor);if(k){let N=k.getAttribute("disabled");if(N==="true"||N==="")return;let w=k.getAttribute("aria-disabled");if(w==="true"||w==="")return;(k instanceof HTMLInputElement&&(k.type==="radio"||k.type==="checkbox")||k.role==="radio"||k.role==="checkbox"||k.role==="switch")&&k.click(),k.focus({preventScroll:!0})}}}),h=s||!1,g=m.useMemo(()=>({...a.slot,disabled:h}),[a.slot,h]),b={ref:f,...a.props,id:l,htmlFor:c,onClick:p};return u&&("onClick"in b&&(delete b.htmlFor,delete b.onClick),"onClick"in d&&delete d.onClick),Vt()({ourProps:b,theirProps:d,slot:g,defaultTag:c?Vpe:"div",name:a.name||"Label"})}let Kpe=Ht(Wpe),q1=Object.assign(Kpe,{}),Ype=m.createContext(()=>{});function V1({value:e,children:t}){return x.createElement(Ype.Provider,{value:e},t)}function Xpe(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function sL(e=Xpe){return m.useCallback((t,r)=>{if(typeof e=="string"){let n=e;return t?.[n]===r?.[n]}return e(t,r)},[e])}function Gpe(e){if(e===null)return{width:0,height:0};let{width:t,height:r}=e.getBoundingClientRect();return{width:t,height:r}}function Bh(e,t=!1){let[r,n]=m.useReducer(()=>({}),{}),a=m.useMemo(()=>Gpe(e),[e,r]);return Ut(()=>{if(!e)return;let o=new ResizeObserver(n);return o.observe(e),()=>{o.disconnect()}},[e]),t?{width:`${a.width}px`,height:`${a.height}px`}:a}let Zpe=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e),this.set(e,t)),t}};function iL(e,t){let r=e(),n=new Set;return{getSnapshot(){return r},subscribe(a){return n.add(a),()=>n.delete(a)},dispatch(a,...o){let s=t[a].call(r,...o);s&&(r=s,n.forEach(l=>l()))}}}function lL(e){return m.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}let Jpe=new Zpe(()=>iL(()=>[],{ADD(e){return this.includes(e)?this:[...this,e]},REMOVE(e){let t=this.indexOf(e);if(t===-1)return this;let r=this.slice();return r.splice(t,1),r}}));function yu(e,t){let r=Jpe.get(t),n=m.useId(),a=lL(r);if(Ut(()=>{if(e)return r.dispatch("ADD",n),()=>r.dispatch("REMOVE",n)},[r,e]),!e)return!1;let o=a.indexOf(n),s=a.length;return o===-1&&(o=s,s+=1),o===s-1}let gj=new Map,Cd=new Map;function n7(e){var t;let r=(t=Cd.get(e))!=null?t:0;return Cd.set(e,r+1),r!==0?()=>a7(e):(gj.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>a7(e))}function a7(e){var t;let r=(t=Cd.get(e))!=null?t:1;if(r===1?Cd.delete(e):Cd.set(e,r-1),r!==1)return;let n=gj.get(e);n&&(n["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert,gj.delete(e))}function W1(e,{allowed:t,disallowed:r}={}){let n=yu(e,"inert-others");Ut(()=>{var a,o;if(!n)return;let s=Xa();for(let c of(a=r?.())!=null?a:[])c&&s.add(n7(c));let l=(o=t?.())!=null?o:[];for(let c of l){if(!c)continue;let u=Io(c);if(!u)continue;let d=c.parentElement;for(;d&&d!==u.body;){for(let f of d.children)l.some(p=>f.contains(p))||s.add(n7(f));d=d.parentElement}}return s.dispose},[n,t,r])}function mb(e,t,r){let n=Hn(a=>{let o=a.getBoundingClientRect();o.x===0&&o.y===0&&o.width===0&&o.height===0&&r()});m.useEffect(()=>{if(!e)return;let a=t===null?null:t instanceof HTMLElement?t:t.current;if(!a)return;let o=Xa();if(typeof ResizeObserver<"u"){let s=new ResizeObserver(()=>n.current(a));s.observe(a),o.add(()=>s.disconnect())}if(typeof IntersectionObserver<"u"){let s=new IntersectionObserver(()=>n.current(a));s.observe(a),o.add(()=>s.disconnect())}return()=>o.dispose()},[t,n,e])}let Hh=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),Qpe=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var yr=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(yr||{}),fo=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(fo||{}),ehe=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(ehe||{});function Gf(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Hh)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}function the(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Qpe)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}var pb=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(pb||{});function K1(e,t=0){var r;return e===((r=Io(e))==null?void 0:r.body)?!1:Xt(t,{0(){return e.matches(Hh)},1(){let n=e;for(;n!==null;){if(n.matches(Hh))return!0;n=n.parentElement}return!1}})}var rhe=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(rhe||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Jo(e){e?.focus({preventScroll:!0})}let nhe=["textarea","input"].join(",");function ahe(e){var t,r;return(r=(t=e?.matches)==null?void 0:t.call(e,nhe))!=null?r:!1}function Us(e,t=r=>r){return e.slice().sort((r,n)=>{let a=t(r),o=t(n);if(a===null||o===null)return 0;let s=a.compareDocumentPosition(o);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function ohe(e,t){return pn(Gf(),t,{relativeTo:e})}function pn(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:a=[]}={}){let o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,s=Array.isArray(e)?r?Us(e):e:t&64?the(e):Gf(e);a.length>0&&s.length>1&&(s=s.filter(h=>!a.some(g=>g!=null&&"current"in g?g?.current===h:g===h))),n=n??o.activeElement;let l=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,s.indexOf(n))-1;if(t&4)return Math.max(0,s.indexOf(n))+1;if(t&8)return s.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},d=0,f=s.length,p;do{if(d>=f||d+f<=0)return 0;let h=c+d;if(t&16)h=(h+f)%f;else{if(h<0)return 3;if(h>=f)return 1}p=s[h],p?.focus(u),d+=l}while(p!==o.activeElement);return t&6&&ahe(p)&&p.select(),2}function cL(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function she(){return/Android/gi.test(window.navigator.userAgent)}function uL(){return cL()||she()}function Qu(e,t,r,n){let a=Hn(r);m.useEffect(()=>{if(!e)return;function o(s){a.current(s)}return document.addEventListener(t,o,n),()=>document.removeEventListener(t,o,n)},[e,t,n])}function dL(e,t,r,n){let a=Hn(r);m.useEffect(()=>{if(!e)return;function o(s){a.current(s)}return window.addEventListener(t,o,n),()=>window.removeEventListener(t,o,n)},[e,t,n])}const o7=30;function hb(e,t,r){let n=yu(e,"outside-click"),a=Hn(r),o=m.useCallback(function(c,u){if(c.defaultPrevented)return;let d=u(c);if(d===null||!d.getRootNode().contains(d)||!d.isConnected)return;let f=function p(h){return typeof h=="function"?p(h()):Array.isArray(h)||h instanceof Set?h:[h]}(t);for(let p of f)if(p!==null&&(p.contains(d)||c.composed&&c.composedPath().includes(p)))return;return!K1(d,pb.Loose)&&d.tabIndex!==-1&&c.preventDefault(),a.current(c,d)},[a,t]),s=m.useRef(null);Qu(n,"pointerdown",c=>{var u,d;s.current=((d=(u=c.composedPath)==null?void 0:u.call(c))==null?void 0:d[0])||c.target},!0),Qu(n,"mousedown",c=>{var u,d;s.current=((d=(u=c.composedPath)==null?void 0:u.call(c))==null?void 0:d[0])||c.target},!0),Qu(n,"click",c=>{uL()||s.current&&(o(c,()=>s.current),s.current=null)},!0);let l=m.useRef({x:0,y:0});Qu(n,"touchstart",c=>{l.current.x=c.touches[0].clientX,l.current.y=c.touches[0].clientY},!0),Qu(n,"touchend",c=>{let u={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(u.x-l.current.x)>=o7||Math.abs(u.y-l.current.y)>=o7))return o(c,()=>c.target instanceof HTMLElement?c.target:null)},!0),dL(n,"blur",c=>o(c,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function eo(...e){return m.useMemo(()=>Io(...e),[...e])}function gb(e,t,r,n){let a=Hn(r);m.useEffect(()=>{e=e??window;function o(s){a.current(s)}return e.addEventListener(t,o,n),()=>e.removeEventListener(t,o,n)},[e,t,n])}function fL(e){let t=m.useRef({value:"",selectionStart:null,selectionEnd:null});return gb(e,"blur",r=>{let n=r.target;n instanceof HTMLInputElement&&(t.current={value:n.value,selectionStart:n.selectionStart,selectionEnd:n.selectionEnd})}),Me(()=>{if(document.activeElement!==e&&e instanceof HTMLInputElement&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==t.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:r,selectionEnd:n}=t.current;r!==null&&n!==null&&e.setSelectionRange(r,n)}t.current={value:"",selectionStart:null,selectionEnd:null}}})}function xu(e,t){return m.useMemo(()=>{var r;if(e.type)return e.type;let n=(r=e.as)!=null?r:"button";if(typeof n=="string"&&n.toLowerCase()==="button"||t?.tagName==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function ihe(){let e;return{before({doc:t}){var r;let n=t.documentElement,a=(r=t.defaultView)!=null?r:window;e=Math.max(0,a.innerWidth-n.clientWidth)},after({doc:t,d:r}){let n=t.documentElement,a=Math.max(0,n.clientWidth-n.offsetWidth),o=Math.max(0,e-a);r.style(n,"paddingRight",`${o}px`)}}}function lhe(){return cL()?{before({doc:e,d:t,meta:r}){function n(a){return r.containers.flatMap(o=>o()).some(o=>o.contains(a))}t.microTask(()=>{var a;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let l=Xa();l.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>l.dispose()))}let o=(a=window.scrollY)!=null?a:window.pageYOffset,s=null;t.addEventListener(e,"click",l=>{if(l.target instanceof HTMLElement)try{let c=l.target.closest("a");if(!c)return;let{hash:u}=new URL(c.href),d=e.querySelector(u);d&&!n(d)&&(s=d)}catch{}},!0),t.addEventListener(e,"touchstart",l=>{if(l.target instanceof HTMLElement)if(n(l.target)){let c=l.target;for(;c.parentElement&&n(c.parentElement);)c=c.parentElement;t.style(c,"overscrollBehavior","contain")}else t.style(l.target,"touchAction","none")}),t.addEventListener(e,"touchmove",l=>{if(l.target instanceof HTMLElement){if(l.target.tagName==="INPUT")return;if(n(l.target)){let c=l.target;for(;c.parentElement&&c.dataset.headlessuiPortal!==""&&!(c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth);)c=c.parentElement;c.dataset.headlessuiPortal===""&&l.preventDefault()}else l.preventDefault()}},{passive:!1}),t.add(()=>{var l;let c=(l=window.scrollY)!=null?l:window.pageYOffset;o!==c&&window.scrollTo(0,o),s&&s.isConnected&&(s.scrollIntoView({block:"nearest"}),s=null)})})}}:{}}function che(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function uhe(e){let t={};for(let r of e)Object.assign(t,r(t));return t}let Zi=iL(()=>new Map,{PUSH(e,t){var r;let n=(r=this.get(e))!=null?r:{doc:e,count:0,d:Xa(),meta:new Set};return n.count++,n.meta.add(t),this.set(e,n),this},POP(e,t){let r=this.get(e);return r&&(r.count--,r.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:r}){let n={doc:e,d:t,meta:uhe(r)},a=[lhe(),ihe(),che()];a.forEach(({before:o})=>o?.(n)),a.forEach(({after:o})=>o?.(n))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Zi.subscribe(()=>{let e=Zi.getSnapshot(),t=new Map;for(let[r]of e)t.set(r,r.documentElement.style.overflow);for(let r of e.values()){let n=t.get(r.doc)==="hidden",a=r.count!==0;(a&&!n||!a&&n)&&Zi.dispatch(r.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",r),r.count===0&&Zi.dispatch("TEARDOWN",r)}});function dhe(e,t,r=()=>({containers:[]})){let n=lL(Zi),a=t?n.get(t):void 0,o=a?a.count>0:!1;return Ut(()=>{if(!(!t||!e))return Zi.dispatch("PUSH",t,r),()=>Zi.dispatch("POP",t,r)},[e,t]),o}function bb(e,t,r=()=>[document.body]){let n=yu(e,"scroll-lock");dhe(n,t,a=>{var o;return{containers:[...(o=a.containers)!=null?o:[],r]}})}function s7(e){return[e.screenX,e.screenY]}function mL(){let e=m.useRef([-1,-1]);return{wasMoved(t){let r=s7(t);return e.current[0]===r[0]&&e.current[1]===r[1]?!1:(e.current=r,!0)},update(t){e.current=s7(t)}}}function fhe(e=0){let[t,r]=m.useState(e),n=m.useCallback(c=>r(c),[t]),a=m.useCallback(c=>r(u=>u|c),[t]),o=m.useCallback(c=>(t&c)===c,[t]),s=m.useCallback(c=>r(u=>u&~c),[r]),l=m.useCallback(c=>r(u=>u^c),[r]);return{flags:t,setFlag:n,addFlag:a,hasFlag:o,removeFlag:s,toggleFlag:l}}var i7,l7;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((i7=process==null?void 0:O9)==null?void 0:i7.NODE_ENV)==="test"&&typeof((l7=Element?.prototype)==null?void 0:l7.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
115
- `)),[]});var mhe=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(mhe||{});function vu(e){let t={};for(let r in e)e[r]===!0&&(t[`data-${r}`]="");return t}function ku(e,t,r,n){let[a,o]=m.useState(r),{hasFlag:s,addFlag:l,removeFlag:c}=fhe(e&&a?3:0),u=m.useRef(!1),d=m.useRef(!1),f=Do();return Ut(()=>{var p;if(e){if(r&&o(!0),!t){r&&l(3);return}return(p=n?.start)==null||p.call(n,r),phe(t,{inFlight:u,prepare(){d.current?d.current=!1:d.current=u.current,u.current=!0,!d.current&&(r?(l(3),c(4)):(l(4),c(2)))},run(){d.current?r?(c(3),l(4)):(c(4),l(3)):r?c(1):l(1)},done(){var h;d.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(u.current=!1,c(7),r||o(!1),(h=n?.end)==null||h.call(n,r))}})}},[e,r,t,f]),e?[a,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function phe(e,{prepare:t,run:r,done:n,inFlight:a}){let o=Xa();return ghe(e,{prepare:t,inFlight:a}),o.nextFrame(()=>{r(),o.requestAnimationFrame(()=>{o.add(hhe(e,n))})}),o.dispose}function hhe(e,t){var r,n;let a=Xa();if(!e)return a.dispose;let o=!1;a.add(()=>{o=!0});let s=(n=(r=e.getAnimations)==null?void 0:r.call(e).filter(l=>l instanceof CSSTransition))!=null?n:[];return s.length===0?(t(),a.dispose):(Promise.allSettled(s.map(l=>l.finished)).then(()=>{o||t()}),a.dispose)}function ghe(e,{inFlight:t,prepare:r}){if(t!=null&&t.current){r();return}let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}function bhe(e,{container:t,accept:r,walk:n}){let a=m.useRef(r),o=m.useRef(n);m.useEffect(()=>{a.current=r,o.current=n},[r,n]),Ut(()=>{if(!t||!e)return;let s=Io(t);if(!s)return;let l=a.current,c=o.current,u=Object.assign(f=>l(f),{acceptNode:l}),d=s.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)c(d.currentNode)},[t,e,a,o])}function kf(e,t){let r=m.useRef([]),n=Me(e);m.useEffect(()=>{let a=[...r.current];for(let[o,s]of t.entries())if(r.current[o]!==s){let l=n(t,a);return r.current=t,l}},[n,...t])}function yhe(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:r,version:n}=t;return r+"/"+n}).join(" "):navigator.userAgent}var xhe=typeof document<"u",vhe=function(){},mp=xhe?m.useLayoutEffect:vhe;function zh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!zh(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;n--!==0;){const o=a[n];if(!(o==="_owner"&&e.$$typeof)&&!zh(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function pL(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function c7(e,t){const r=pL(e);return Math.round(t*r)/r}function Bk(e){const t=m.useRef(e);return mp(()=>{t.current=e}),t}function khe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=m.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=m.useState(n);zh(p,n)||h(n);const[g,b]=m.useState(null),[y,v]=m.useState(null),k=m.useCallback($=>{$!==C.current&&(C.current=$,b($))},[]),N=m.useCallback($=>{$!==O.current&&(O.current=$,v($))},[]),w=o||g,E=s||y,C=m.useRef(null),O=m.useRef(null),D=m.useRef(d),A=c!=null,M=Bk(c),I=Bk(a),T=Bk(u),R=m.useCallback(()=>{if(!C.current||!O.current)return;const $={placement:t,strategy:r,middleware:p};I.current&&($.platform=I.current),Jj(C.current,O.current,$).then(z=>{const W={...z,isPositioned:T.current!==!1};L.current&&!zh(D.current,W)&&(D.current=W,Qt.flushSync(()=>{f(W)}))})},[p,t,r,I,T]);mp(()=>{u===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,f($=>({...$,isPositioned:!1})))},[u]);const L=m.useRef(!1);mp(()=>(L.current=!0,()=>{L.current=!1}),[]),mp(()=>{if(w&&(C.current=w),E&&(O.current=E),w&&E){if(M.current)return M.current(w,E,R);R()}},[w,E,R,M,A]);const F=m.useMemo(()=>({reference:C,floating:O,setReference:k,setFloating:N}),[k,N]),V=m.useMemo(()=>({reference:w,floating:E}),[w,E]),H=m.useMemo(()=>{const $={position:r,left:0,top:0};if(!V.floating)return $;const z=c7(V.floating,d.x),W=c7(V.floating,d.y);return l?{...$,transform:"translate("+z+"px, "+W+"px)",...pL(V.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:z,top:W}},[r,l,V.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:R,refs:F,elements:V,floatingStyles:H}),[d,R,F,V,H])}const hL=(e,t)=>({...Xj(e),options:[e,t]}),whe=(e,t)=>({...Gj(e),options:[e,t]}),jhe=(e,t)=>({...Zj(e),options:[e,t]}),Nhe=(e,t)=>({...SM(e),options:[e,t]}),gL={...Xs},Ehe=gL.useInsertionEffect,She=Ehe||(e=>e());function bL(e){const t=m.useRef(()=>{});return She(()=>{t.current=e}),m.useCallback(function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.current==null?void 0:t.current(...n)},[])}var bj=typeof document<"u"?m.useLayoutEffect:m.useEffect;let u7=!1,Che=0;const d7=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Che++;function Ohe(){const[e,t]=m.useState(()=>u7?d7():void 0);return bj(()=>{e==null&&t(d7())},[]),m.useEffect(()=>{u7=!0},[]),e}const Phe=gL.useId,Ahe=Phe||Ohe;function Mhe(){const e=new Map;return{emit(t,r){var n;(n=e.get(t))==null||n.forEach(a=>a(r))},on(t,r){e.set(t,[...e.get(t)||[],r])},off(t,r){var n;e.set(t,((n=e.get(t))==null?void 0:n.filter(a=>a!==r))||[])}}}const The=m.createContext(null),_he=m.createContext(null),Ihe=()=>{var e;return((e=m.useContext(The))==null?void 0:e.id)||null},Dhe=()=>m.useContext(_he),Lhe="data-floating-ui-focusable";function Rhe(e){const{open:t=!1,onOpenChange:r,elements:n}=e,a=Ahe(),o=m.useRef({}),[s]=m.useState(()=>Mhe()),l=Ihe()!=null,[c,u]=m.useState(n.reference),d=bL((h,g,b)=>{o.current.openEvent=h?g:void 0,s.emit("openchange",{open:h,event:g,reason:b,nested:l}),r?.(h,g,b)}),f=m.useMemo(()=>({setPositionReference:u}),[]),p=m.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return m.useMemo(()=>({dataRef:o,open:t,onOpenChange:d,elements:p,events:s,floatingId:a,refs:f}),[t,d,p,s,a,f])}function Fhe(e){e===void 0&&(e={});const{nodeId:t}=e,r=Rhe({...e,elements:{reference:null,floating:null,...e.elements}}),n=e.rootContext||r,a=n.elements,[o,s]=m.useState(null),[l,c]=m.useState(null),u=a?.domReference||o,d=m.useRef(null),f=Dhe();bj(()=>{u&&(d.current=u)},[u]);const p=khe({...e,elements:{...a,...l&&{reference:l}}}),h=m.useCallback(k=>{const N=gn(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),contextElement:k}:k;c(N),p.refs.setReference(N)},[p.refs]),g=m.useCallback(k=>{(gn(k)||k===null)&&(d.current=k,s(k)),(gn(p.refs.reference.current)||p.refs.reference.current===null||k!==null&&!gn(k))&&p.refs.setReference(k)},[p.refs]),b=m.useMemo(()=>({...p.refs,setReference:g,setPositionReference:h,domReference:d}),[p.refs,g,h]),y=m.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),v=m.useMemo(()=>({...p,...n,refs:b,elements:y,nodeId:t}),[p,b,y,t,n]);return bj(()=>{n.dataRef.current.floatingContext=v;const k=f?.nodesRef.current.find(N=>N.id===t);k&&(k.context=v)}),m.useMemo(()=>({...p,context:v,refs:b,elements:y}),[p,b,y,v])}const f7="active",m7="selected";function Hk(e,t,r){const n=new Map,a=r==="item";let o=e;if(a&&e){const{[f7]:s,[m7]:l,...c}=e;o=c}return{...r==="floating"&&{tabIndex:-1,[Lhe]:""},...o,...t.map(s=>{const l=s?s[r]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((s,l)=>(l&&Object.entries(l).forEach(c=>{let[u,d]=c;if(!(a&&[f7,m7].includes(u)))if(u.indexOf("on")===0){if(n.has(u)||n.set(u,[]),typeof d=="function"){var f;(f=n.get(u))==null||f.push(d),s[u]=function(){for(var p,h=arguments.length,g=new Array(h),b=0;b<h;b++)g[b]=arguments[b];return(p=n.get(u))==null?void 0:p.map(y=>y(...g)).find(y=>y!==void 0)}}}else s[u]=d}),s),{})}}function $he(e){e===void 0&&(e=[]);const t=e.map(l=>l?.reference),r=e.map(l=>l?.floating),n=e.map(l=>l?.item),a=m.useCallback(l=>Hk(l,e,"reference"),t),o=m.useCallback(l=>Hk(l,e,"floating"),r),s=m.useCallback(l=>Hk(l,e,"item"),n);return m.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s}),[a,o,s])}function p7(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Bhe=e=>({name:"inner",options:e,async fn(t){const{listRef:r,overflowRef:n,onFallbackChange:a,offset:o=0,index:s=0,minItemsVisible:l=4,referenceOverflowThreshold:c=0,scrollRef:u,...d}=Ya(e,t),{rects:f,elements:{floating:p}}=t,h=r.current[s],g=u?.current||p,b=p.clientTop||g.clientTop,y=p.clientTop!==0,v=g.clientTop!==0,k=p===g;if(!h)return{};const N={...t,...await hL(-h.offsetTop-p.clientTop-f.reference.height/2-h.offsetHeight/2-o).fn(t)},w=await nc(p7(N,g.scrollHeight+b+p.clientTop),d),E=await nc(N,{...d,elementContext:"reference"}),C=mn(0,w.top),O=N.y+C,D=(g.scrollHeight>g.clientHeight?A=>A:bc)(mn(0,g.scrollHeight+(y&&k||v?b*2:0)-C-mn(0,w.bottom)));if(g.style.maxHeight=D+"px",g.scrollTop=C,a){const A=g.offsetHeight<h.offsetHeight*wo(l,r.current.length)-1||E.top>=-c||E.bottom>=-c;Qt.flushSync(()=>a(A))}return n&&(n.current=await nc(p7({...N,y:O},g.offsetHeight+b+p.clientTop),d)),{y:O}}});function Hhe(e,t){const{open:r,elements:n}=e,{enabled:a=!0,overflowRef:o,scrollRef:s,onChange:l}=t,c=bL(l),u=m.useRef(!1),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(!a)return;function h(b){if(b.ctrlKey||!g||o.current==null)return;const y=b.deltaY,v=o.current.top>=-.5,k=o.current.bottom>=-.5,N=g.scrollHeight-g.clientHeight,w=y<0?-1:1,E=y<0?"max":"min";g.scrollHeight<=g.clientHeight||(!v&&y>0||!k&&y<0?(b.preventDefault(),Qt.flushSync(()=>{c(C=>C+Math[E](y,N*w))})):/firefox/i.test(yhe())&&(g.scrollTop+=y))}const g=s?.current||n.floating;if(r&&g)return g.addEventListener("wheel",h),requestAnimationFrame(()=>{d.current=g.scrollTop,o.current!=null&&(f.current={...o.current})}),()=>{d.current=null,f.current=null,g.removeEventListener("wheel",h)}},[a,r,n.floating,o,s,c]);const p=m.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const h=s?.current||n.floating;if(!(!o.current||!h||!u.current)){if(d.current!==null){const g=h.scrollTop-d.current;(o.current.bottom<-.5&&g<-1||o.current.top<-.5&&g>1)&&Qt.flushSync(()=>c(b=>b+g))}requestAnimationFrame(()=>{d.current=h.scrollTop})}}}),[n.floating,c,o,s]);return m.useMemo(()=>a?{floating:p}:{},[a,p])}let wu=m.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});wu.displayName="FloatingContext";let Y1=m.createContext(null);Y1.displayName="PlacementContext";function X1(e){return m.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function G1(){return m.useContext(wu).setReference}function zhe(){return m.useContext(wu).getReferenceProps}function Z1(){let{getFloatingProps:e,slot:t}=m.useContext(wu);return m.useCallback((...r)=>Object.assign({},e(...r),{"data-anchor":t.anchor}),[e,t])}function J1(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=m.useContext(Y1),r=m.useMemo(()=>e,[JSON.stringify(e,(a,o)=>{var s;return(s=o?.outerHTML)!=null?s:o})]);Ut(()=>{t?.(r??null)},[t,r]);let n=m.useContext(wu);return m.useMemo(()=>[n.setFloating,e?n.styles:{}],[n.setFloating,e,n.styles])}let h7=4;function Q1({children:e,enabled:t=!0}){let[r,n]=m.useState(null),[a,o]=m.useState(0),s=m.useRef(null),[l,c]=m.useState(null);Uhe(l);let u=t&&r!==null&&l!==null,{to:d="bottom",gap:f=0,offset:p=0,padding:h=0,inner:g}=qhe(r,l),[b,y="center"]=d.split(" ");Ut(()=>{u&&o(0)},[u]);let{refs:v,floatingStyles:k,context:N}=Fhe({open:u,placement:b==="selection"?y==="center"?"bottom":`bottom-${y}`:y==="center"?`${b}`:`${b}-${y}`,strategy:"absolute",transform:!1,middleware:[hL({mainAxis:b==="selection"?0:f,crossAxis:p}),whe({padding:h}),b!=="selection"&&jhe({padding:h}),b==="selection"&&g?Bhe({...g,padding:h,overflowRef:s,offset:a,minItemsVisible:h7,referenceOverflowThreshold:h,onFallbackChange(I){var T,R;if(!I)return;let L=N.elements.floating;if(!L)return;let F=parseFloat(getComputedStyle(L).scrollPaddingBottom)||0,V=Math.min(h7,L.childElementCount),H=0,$=0;for(let z of(R=(T=N.elements.floating)==null?void 0:T.childNodes)!=null?R:[])if(z instanceof HTMLElement){let W=z.offsetTop,U=W+z.clientHeight+F,X=L.scrollTop,Y=X+L.clientHeight;if(W>=X&&U<=Y)V--;else{$=Math.max(0,Math.min(U,Y)-Math.max(W,X)),H=z.clientHeight;break}}V>=1&&o(z=>{let W=H*V-$+F;return z>=W?z:W})}}):null,Nhe({padding:h,apply({availableWidth:I,availableHeight:T,elements:R}){Object.assign(R.floating.style,{overflow:"auto",maxWidth:`${I}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${T}px)`})}})].filter(Boolean),whileElementsMounted:lg}),[w=b,E=y]=N.placement.split("-");b==="selection"&&(w="selection");let C=m.useMemo(()=>({anchor:[w,E].filter(Boolean).join(" ")}),[w,E]),O=Hhe(N,{overflowRef:s,onChange:o}),{getReferenceProps:D,getFloatingProps:A}=$he([O]),M=Me(I=>{c(I),v.setFloating(I)});return m.createElement(Y1.Provider,{value:n},m.createElement(wu.Provider,{value:{setFloating:M,setReference:v.setReference,styles:k,getReferenceProps:D,getFloatingProps:A,slot:C}},e))}function Uhe(e){Ut(()=>{if(!e)return;let t=new MutationObserver(()=>{let r=window.getComputedStyle(e).maxHeight,n=parseFloat(r);if(isNaN(n))return;let a=parseInt(r);isNaN(a)||n!==a&&(e.style.maxHeight=`${Math.ceil(n)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function qhe(e,t){var r,n,a;let o=zk((r=e?.gap)!=null?r:"var(--anchor-gap, 0)",t),s=zk((n=e?.offset)!=null?n:"var(--anchor-offset, 0)",t),l=zk((a=e?.padding)!=null?a:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:s,padding:l}}function zk(e,t,r=void 0){let n=Do(),a=Me((c,u)=>{if(c==null)return[r,null];if(typeof c=="number")return[c,null];if(typeof c=="string"){if(!u)return[r,null];let d=g7(c,u);return[d,f=>{let p=yL(c);{let h=p.map(g=>window.getComputedStyle(u).getPropertyValue(g));n.requestAnimationFrame(function g(){n.nextFrame(g);let b=!1;for(let[v,k]of p.entries()){let N=window.getComputedStyle(u).getPropertyValue(k);if(h[v]!==N){h[v]=N,b=!0;break}}if(!b)return;let y=g7(c,u);d!==y&&(f(y),d=y)})}return n.dispose}]}return[r,null]}),o=m.useMemo(()=>a(e,t)[0],[e,t]),[s=o,l]=m.useState();return Ut(()=>{let[c,u]=a(e,t);if(l(c),!!u)return u(l)},[e,t]),s}function yL(e){let t=/var\((.*)\)/.exec(e);if(t){let r=t[1].indexOf(",");if(r===-1)return[t[1]];let n=t[1].slice(0,r).trim(),a=t[1].slice(r+1).trim();return a?[n,...yL(a)]:[n]}return[]}function g7(e,t){let r=document.createElement("div");t.appendChild(r),r.style.setProperty("margin-top","0px","important"),r.style.setProperty("margin-top",e,"important");let n=parseFloat(window.getComputedStyle(r).marginTop)||0;return t.removeChild(r),n}function Vhe({children:e,freeze:t}){let r=Uh(t,e);return x.createElement(x.Fragment,null,r)}function Uh(e,t){let[r,n]=m.useState(t);return!e&&r!==t&&n(t),e?r:t}let yb=m.createContext(null);yb.displayName="OpenClosedContext";var xr=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(xr||{});function ks(){return m.useContext(yb)}function Zf({value:e,children:t}){return x.createElement(yb.Provider,{value:e},t)}function eE({children:e}){return x.createElement(yb.Provider,{value:null},e)}function Whe(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let oo=[];Whe(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||oo[0]===t.target)return;let r=t.target;r=r.closest(Hh),oo.unshift(r??t.target),oo=oo.filter(n=>n!=null&&n.isConnected),oo.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function Khe(e){throw new Error("Unexpected object: "+e)}var qt=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(qt||{});function Od(e,t){let r=t.resolveItems();if(r.length<=0)return null;let n=t.resolveActiveIndex(),a=n??-1;switch(e.focus){case 0:{for(let o=0;o<r.length;++o)if(!t.resolveDisabled(r[o],o,r))return o;return n}case 1:{a===-1&&(a=r.length);for(let o=a-1;o>=0;--o)if(!t.resolveDisabled(r[o],o,r))return o;return n}case 2:{for(let o=a+1;o<r.length;++o)if(!t.resolveDisabled(r[o],o,r))return o;return n}case 3:{for(let o=r.length-1;o>=0;--o)if(!t.resolveDisabled(r[o],o,r))return o;return n}case 4:{for(let o=0;o<r.length;++o)if(t.resolveId(r[o],o,r)===e.id)return o;return n}case 5:return null;default:Khe(e)}}var tE=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(tE||{});function xL(e){let t=Me(e),r=m.useRef(!1);m.useEffect(()=>(r.current=!1,()=>{r.current=!0,Yf(()=>{r.current&&t()})}),[t])}function Yhe(){let e=typeof document>"u";return"useSyncExternalStore"in Xs?(t=>t.useSyncExternalStore)(Xs)(()=>()=>{},()=>!1,()=>!e):!1}function Jf(){let e=Yhe(),[t,r]=m.useState(el.isHandoffComplete);return t&&el.isHandoffComplete===!1&&r(!1),m.useEffect(()=>{t!==!0&&r(!0)},[t]),m.useEffect(()=>el.handoff(),[]),e?!1:t}let vL=m.createContext(!1);function Xhe(){return m.useContext(vL)}function b7(e){return x.createElement(vL.Provider,{value:e.force},e.children)}function Ghe(e){let t=Xhe(),r=m.useContext(wL),n=eo(e),[a,o]=m.useState(()=>{var s;if(!t&&r!==null)return(s=r.current)!=null?s:null;if(el.isServer)return null;let l=n?.getElementById("headlessui-portal-root");if(l)return l;if(n===null)return null;let c=n.createElement("div");return c.setAttribute("id","headlessui-portal-root"),n.body.appendChild(c)});return m.useEffect(()=>{a!==null&&(n!=null&&n.body.contains(a)||n==null||n.body.appendChild(a))},[a,n]),m.useEffect(()=>{t||r!==null&&o(r.current)},[r,o,t]),a}let kL=m.Fragment,Zhe=Ht(function(e,t){let r=e,n=m.useRef(null),a=Zt(H1(f=>{n.current=f}),t),o=eo(n),s=Ghe(n),[l]=m.useState(()=>{var f;return el.isServer?null:(f=o?.createElement("div"))!=null?f:null}),c=m.useContext(yj),u=Jf();Ut(()=>{!s||!l||s.contains(l)||(l.setAttribute("data-headlessui-portal",""),s.appendChild(l))},[s,l]),Ut(()=>{if(l&&c)return c.register(l)},[c,l]),xL(()=>{var f;!s||!l||(l instanceof Node&&s.contains(l)&&s.removeChild(l),s.childNodes.length<=0&&((f=s.parentElement)==null||f.removeChild(s)))});let d=Vt();return u?!s||!l?null:Qt.createPortal(d({ourProps:{ref:a},theirProps:r,slot:{},defaultTag:kL,name:"Portal"}),l):null});function Jhe(e,t){let r=Zt(t),{enabled:n=!0,...a}=e,o=Vt();return n?x.createElement(Zhe,{...a,ref:r}):o({ourProps:{ref:r},theirProps:a,slot:{},defaultTag:kL,name:"Portal"})}let Qhe=m.Fragment,wL=m.createContext(null);function ege(e,t){let{target:r,...n}=e,a={ref:Zt(t)},o=Vt();return x.createElement(wL.Provider,{value:r},o({ourProps:a,theirProps:n,defaultTag:Qhe,name:"Popover.Group"}))}let yj=m.createContext(null);function jL(){let e=m.useContext(yj),t=m.useRef([]),r=Me(o=>(t.current.push(o),e&&e.register(o),()=>n(o))),n=Me(o=>{let s=t.current.indexOf(o);s!==-1&&t.current.splice(s,1),e&&e.unregister(o)}),a=m.useMemo(()=>({register:r,unregister:n,portals:t}),[r,n,t]);return[t,m.useMemo(()=>function({children:o}){return x.createElement(yj.Provider,{value:a},o)},[a])]}let tge=Ht(Jhe),NL=Ht(ege),xb=Object.assign(tge,{Group:NL});var rge=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(rge||{}),nge=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(nge||{}),age=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(age||{}),oge=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=7]="UpdateVirtualConfiguration",e[e.SetInputElement=8]="SetInputElement",e[e.SetButtonElement=9]="SetButtonElement",e[e.SetOptionsElement=10]="SetOptionsElement",e))(oge||{});function Uk(e,t=r=>r){let r=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,n=t(e.options.slice()),a=n.length>0&&n[0].dataRef.current.order!==null?n.sort((s,l)=>s.dataRef.current.order-l.dataRef.current.order):Us(n,s=>s.dataRef.current.domRef.current),o=r?a.indexOf(r):null;return o===-1&&(o=null),{options:a,activeOptionIndex:o}}let sge={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!1}},0(e){var t,r;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((r=e.dataRef.current)!=null&&r.value){let n=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(n!==-1)return{...e,activeOptionIndex:n,comboboxState:0,__demoMode:!1}}return{...e,comboboxState:0,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var r,n,a,o;if((r=e.dataRef.current)!=null&&r.disabled||e.optionsElement&&!((n=e.dataRef.current)!=null&&n.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:u,disabled:d}=e.virtual,f=t.focus===qt.Specific?t.idx:Od(t,{resolveItems:()=>u,resolveActiveIndex:()=>{var h,g;return(g=(h=e.activeOptionIndex)!=null?h:u.findIndex(b=>!d(b)))!=null?g:null},resolveDisabled:d,resolveId(){throw new Error("Function not implemented.")}}),p=(a=t.trigger)!=null?a:2;return e.activeOptionIndex===f&&e.activationTrigger===p?e:{...e,activeOptionIndex:f,activationTrigger:p,isTyping:!1,__demoMode:!1}}let s=Uk(e);if(s.activeOptionIndex===null){let u=s.options.findIndex(d=>!d.dataRef.current.disabled);u!==-1&&(s.activeOptionIndex=u)}let l=t.focus===qt.Specific?t.idx:Od(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled}),c=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===l&&e.activationTrigger===c?e:{...e,...s,isTyping:!1,activeOptionIndex:l,activationTrigger:c,__demoMode:!1}},4:(e,t)=>{var r,n,a;if((r=e.dataRef.current)!=null&&r.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,s=Uk(e,c=>(c.push(o),c));e.activeOptionIndex===null&&(n=e.dataRef.current)!=null&&n.isSelected(t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(o));let l={...e,...s,activationTrigger:2};return(a=e.dataRef.current)!=null&&a.__demoMode&&e.dataRef.current.value===void 0&&(l.activeOptionIndex=0),l},5:(e,t)=>{var r;if((r=e.dataRef.current)!=null&&r.virtual)return{...e,options:e.options.filter(a=>a.id!==t.id)};let n=Uk(e,a=>{let o=a.findIndex(s=>s.id===t.id);return o!==-1&&a.splice(o,1),a});return{...e,...n,activationTrigger:2}},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var r,n;if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:(r=t.disabled)!=null?r:()=>!1}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let a=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?a=o:a=null}return{...e,activeOptionIndex:a,virtual:{options:t.options,disabled:(n=t.disabled)!=null?n:()=>!1}}},8:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},9:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},10:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},rE=m.createContext(null);rE.displayName="ComboboxActionsContext";function Qf(e){let t=m.useContext(rE);if(t===null){let r=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Qf),r}return t}let EL=m.createContext(null);function ige(e){let t=ju("VirtualProvider"),{options:r}=t.virtual,[n,a]=m.useMemo(()=>{let u=t.optionsElement;if(!u)return[0,0];let d=window.getComputedStyle(u);return[parseFloat(d.paddingBlockStart||d.paddingTop),parseFloat(d.paddingBlockEnd||d.paddingBottom)]},[t.optionsElement]),o=tB({enabled:r.length!==0,scrollPaddingStart:n,scrollPaddingEnd:a,count:r.length,estimateSize(){return 40},getScrollElement(){return t.optionsElement},overscan:12}),[s,l]=m.useState(0);Ut(()=>{l(u=>u+1)},[r]);let c=o.getVirtualItems();return c.length===0?null:x.createElement(EL.Provider,{value:o},x.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:u=>{u&&t.activationTrigger!==0&&t.activeOptionIndex!==null&&r.length>t.activeOptionIndex&&o.scrollToIndex(t.activeOptionIndex)}},c.map(u=>{var d;return x.createElement(m.Fragment,{key:u.key},x.cloneElement((d=e.children)==null?void 0:d.call(e,{...e.slot,option:r[u.index]}),{key:`${s}-${u.key}`,"data-index":u.index,"aria-setsize":r.length,"aria-posinset":u.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${u.start}px)`,overflowAnchor:"none"}}))})))}let wf=m.createContext(null);wf.displayName="ComboboxDataContext";function ju(e){let t=m.useContext(wf);if(t===null){let r=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,ju),r}return t}function lge(e,t){return Xt(t.type,sge,e,t)}let cge=m.Fragment;function uge(e,t){var r,n;let a=Xf(),{value:o,defaultValue:s,onChange:l,form:c,name:u,by:d,disabled:f=a||!1,onClose:p,__demoMode:h=!1,multiple:g=!1,immediate:b=!1,virtual:y=null,nullable:v,...k}=e,N=$1(s),[w=g?[]:void 0,E]=F1(o,l,N),[C,O]=m.useReducer(lge,{dataRef:m.createRef(),comboboxState:h?0:1,isTyping:!1,options:[],virtual:y?{options:y.options,disabled:(r=y.disabled)!=null?r:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:h}),D=m.useRef(!1),A=m.useRef({static:!1,hold:!1}),M=sL(d),I=Me(ye=>y?d===null?y.options.indexOf(ye):y.options.findIndex(me=>M(me,ye)):C.options.findIndex(me=>M(me.dataRef.current.value,ye))),T=m.useCallback(ye=>Xt(L.mode,{1:()=>w.some(me=>M(me,ye)),0:()=>M(w,ye)}),[w]),R=Me(ye=>C.activeOptionIndex===I(ye)),L=m.useMemo(()=>({...C,immediate:b,optionsPropsRef:A,value:w,defaultValue:N,disabled:f,mode:g?1:0,virtual:y?C.virtual:null,get activeOptionIndex(){if(D.current&&C.activeOptionIndex===null&&(y?y.options.length>0:C.options.length>0)){if(y){let me=y.options.findIndex(Se=>{var Re,Te;return!((Te=(Re=y.disabled)==null?void 0:Re.call(y,Se))!=null&&Te)});if(me!==-1)return me}let ye=C.options.findIndex(me=>!me.dataRef.current.disabled);if(ye!==-1)return ye}return C.activeOptionIndex},calculateIndex:I,compare:M,isSelected:T,isActive:R}),[w,N,f,g,h,C,y]);Ut(()=>{var ye;y&&O({type:7,options:y.options,disabled:(ye=y.disabled)!=null?ye:null})},[y,y?.options,y?.disabled]),Ut(()=>{C.dataRef.current=L},[L]);let F=L.comboboxState===0;hb(F,[L.buttonElement,L.inputElement,L.optionsElement],()=>pe.closeCombobox());let V=m.useMemo(()=>{var ye,me,Se;return{open:L.comboboxState===0,disabled:f,activeIndex:L.activeOptionIndex,activeOption:L.activeOptionIndex===null?null:L.virtual?L.virtual.options[(ye=L.activeOptionIndex)!=null?ye:0]:(Se=(me=L.options[L.activeOptionIndex])==null?void 0:me.dataRef.current.value)!=null?Se:null,value:w}},[L,f,w]),H=Me(()=>{if(L.activeOptionIndex!==null){if(pe.setIsTyping(!1),L.virtual)Y(L.virtual.options[L.activeOptionIndex]);else{let{dataRef:ye}=L.options[L.activeOptionIndex];Y(ye.current.value)}pe.goToOption(qt.Specific,L.activeOptionIndex)}}),$=Me(()=>{O({type:0}),D.current=!0}),z=Me(()=>{O({type:1}),D.current=!1,p?.()}),W=Me(ye=>{O({type:3,isTyping:ye})}),U=Me((ye,me,Se)=>(D.current=!1,ye===qt.Specific?O({type:2,focus:qt.Specific,idx:me,trigger:Se}):O({type:2,focus:ye,trigger:Se}))),X=Me((ye,me)=>(O({type:4,payload:{id:ye,dataRef:me}}),()=>{L.isActive(me.current.value)&&(D.current=!0),O({type:5,id:ye})})),Y=Me(ye=>Xt(L.mode,{0(){return E?.(ye)},1(){let me=L.value.slice(),Se=me.findIndex(Re=>M(Re,ye));return Se===-1?me.push(ye):me.splice(Se,1),E?.(me)}})),ae=Me(ye=>{O({type:6,trigger:ye})}),G=Me(ye=>{O({type:8,element:ye})}),ee=Me(ye=>{O({type:9,element:ye})}),re=Me(ye=>{O({type:10,element:ye})}),pe=m.useMemo(()=>({onChange:Y,registerOption:X,goToOption:U,setIsTyping:W,closeCombobox:z,openCombobox:$,setActivationTrigger:ae,selectActiveOption:H,setInputElement:G,setButtonElement:ee,setOptionsElement:re}),[]),[te,se]=U1(),ne=t===null?{}:{ref:t},K=m.useCallback(()=>{if(N!==void 0)return E?.(N)},[E,N]),ge=Vt();return x.createElement(se,{value:te,props:{htmlFor:(n=L.inputElement)==null?void 0:n.id},slot:{open:L.comboboxState===0,disabled:f}},x.createElement(Q1,null,x.createElement(rE.Provider,{value:pe},x.createElement(wf.Provider,{value:L},x.createElement(Zf,{value:Xt(L.comboboxState,{0:xr.Open,1:xr.Closed})},u!=null&&x.createElement(B1,{disabled:f,data:w!=null?{[u]:w}:{},form:c,onReset:K}),ge({ourProps:ne,theirProps:k,slot:V,defaultTag:cge,name:"Combobox"}))))))}let dge="input";function fge(e,t){var r,n,a,o,s;let l=ju("Combobox.Input"),c=Qf("Combobox.Input"),u=m.useId(),d=ub(),{id:f=d||`headlessui-combobox-input-${u}`,onChange:p,displayValue:h,disabled:g=l.disabled||!1,autoFocus:b=!1,type:y="text",...v}=e,k=m.useRef(null),N=Zt(k,t,G1(),c.setInputElement),w=eo(l.inputElement),E=Do(),C=Me(()=>{c.onChange(null),l.optionsElement&&(l.optionsElement.scrollTop=0),c.goToOption(qt.Nothing)}),O=m.useMemo(()=>{var Y;return typeof h=="function"&&l.value!==void 0?(Y=h(l.value))!=null?Y:"":typeof l.value=="string"?l.value:""},[l.value,h]);kf(([Y,ae],[G,ee])=>{if(l.isTyping)return;let re=k.current;re&&((ee===0&&ae===1||Y!==G)&&(re.value=Y),requestAnimationFrame(()=>{if(l.isTyping||!re||w?.activeElement!==re)return;let{selectionStart:pe,selectionEnd:te}=re;Math.abs((te??0)-(pe??0))===0&&pe===0&&re.setSelectionRange(re.value.length,re.value.length)}))},[O,l.comboboxState,w,l.isTyping]),kf(([Y],[ae])=>{if(Y===0&&ae===1){if(l.isTyping)return;let G=k.current;if(!G)return;let ee=G.value,{selectionStart:re,selectionEnd:pe,selectionDirection:te}=G;G.value="",G.value=ee,te!==null?G.setSelectionRange(re,pe,te):G.setSelectionRange(re,pe)}},[l.comboboxState]);let D=m.useRef(!1),A=Me(()=>{D.current=!0}),M=Me(()=>{E.nextFrame(()=>{D.current=!1})}),I=Me(Y=>{switch(c.setIsTyping(!0),Y.key){case bt.Enter:if(l.comboboxState!==0||D.current)return;if(Y.preventDefault(),Y.stopPropagation(),l.activeOptionIndex===null){c.closeCombobox();return}c.selectActiveOption(),l.mode===0&&c.closeCombobox();break;case bt.ArrowDown:return Y.preventDefault(),Y.stopPropagation(),Xt(l.comboboxState,{0:()=>c.goToOption(qt.Next),1:()=>c.openCombobox()});case bt.ArrowUp:return Y.preventDefault(),Y.stopPropagation(),Xt(l.comboboxState,{0:()=>c.goToOption(qt.Previous),1:()=>{Qt.flushSync(()=>c.openCombobox()),l.value||c.goToOption(qt.Last)}});case bt.Home:if(Y.shiftKey)break;return Y.preventDefault(),Y.stopPropagation(),c.goToOption(qt.First);case bt.PageUp:return Y.preventDefault(),Y.stopPropagation(),c.goToOption(qt.First);case bt.End:if(Y.shiftKey)break;return Y.preventDefault(),Y.stopPropagation(),c.goToOption(qt.Last);case bt.PageDown:return Y.preventDefault(),Y.stopPropagation(),c.goToOption(qt.Last);case bt.Escape:return l.comboboxState!==0?void 0:(Y.preventDefault(),l.optionsElement&&!l.optionsPropsRef.current.static&&Y.stopPropagation(),l.mode===0&&l.value===null&&C(),c.closeCombobox());case bt.Tab:if(l.comboboxState!==0)return;l.mode===0&&l.activationTrigger!==1&&c.selectActiveOption(),c.closeCombobox();break}}),T=Me(Y=>{p?.(Y),l.mode===0&&Y.target.value===""&&C(),c.openCombobox()}),R=Me(Y=>{var ae,G,ee;let re=(ae=Y.relatedTarget)!=null?ae:oo.find(pe=>pe!==Y.currentTarget);if(!((G=l.optionsElement)!=null&&G.contains(re))&&!((ee=l.buttonElement)!=null&&ee.contains(re))&&l.comboboxState===0)return Y.preventDefault(),l.mode===0&&l.value===null&&C(),c.closeCombobox()}),L=Me(Y=>{var ae,G,ee;let re=(ae=Y.relatedTarget)!=null?ae:oo.find(pe=>pe!==Y.currentTarget);(G=l.buttonElement)!=null&&G.contains(re)||(ee=l.optionsElement)!=null&&ee.contains(re)||l.disabled||l.immediate&&l.comboboxState!==0&&E.microTask(()=>{Qt.flushSync(()=>c.openCombobox()),c.setActivationTrigger(1)})}),F=bu(),V=z1(),{isFocused:H,focusProps:$}=Da({autoFocus:b}),{isHovered:z,hoverProps:W}=Za({isDisabled:g}),U=m.useMemo(()=>({open:l.comboboxState===0,disabled:g,hover:z,focus:H,autofocus:b}),[l,z,H,b,g]),X=Qa({ref:N,id:f,role:"combobox",type:y,"aria-controls":(r=l.optionsElement)==null?void 0:r.id,"aria-expanded":l.comboboxState===0,"aria-activedescendant":l.activeOptionIndex===null?void 0:l.virtual?(n=l.options.find(Y=>!Y.dataRef.current.disabled&&l.compare(Y.dataRef.current.value,l.virtual.options[l.activeOptionIndex])))==null?void 0:n.id:(a=l.options[l.activeOptionIndex])==null?void 0:a.id,"aria-labelledby":F,"aria-describedby":V,"aria-autocomplete":"list",defaultValue:(s=(o=e.defaultValue)!=null?o:l.defaultValue!==void 0?h?.(l.defaultValue):null)!=null?s:l.defaultValue,disabled:g||void 0,autoFocus:b,onCompositionStart:A,onCompositionEnd:M,onKeyDown:I,onChange:T,onFocus:L,onBlur:R},$,W);return Vt()({ourProps:X,theirProps:v,slot:U,defaultTag:dge,name:"Combobox.Input"})}let mge="button";function pge(e,t){var r;let n=ju("Combobox.Button"),a=Qf("Combobox.Button"),o=Zt(t,a.setButtonElement),s=m.useId(),{id:l=`headlessui-combobox-button-${s}`,disabled:c=n.disabled||!1,autoFocus:u=!1,...d}=e,f=fL(n.inputElement),p=Me(O=>{switch(O.key){case bt.Space:case bt.Enter:O.preventDefault(),O.stopPropagation(),n.comboboxState===1&&Qt.flushSync(()=>a.openCombobox()),f();return;case bt.ArrowDown:O.preventDefault(),O.stopPropagation(),n.comboboxState===1&&(Qt.flushSync(()=>a.openCombobox()),n.value||a.goToOption(qt.First)),f();return;case bt.ArrowUp:O.preventDefault(),O.stopPropagation(),n.comboboxState===1&&(Qt.flushSync(()=>a.openCombobox()),n.value||a.goToOption(qt.Last)),f();return;case bt.Escape:if(n.comboboxState!==0)return;O.preventDefault(),n.optionsElement&&!n.optionsPropsRef.current.static&&O.stopPropagation(),Qt.flushSync(()=>a.closeCombobox()),f();return;default:return}}),h=Me(O=>{O.preventDefault(),!gu(O.currentTarget)&&(O.button===tE.Left&&(n.comboboxState===0?a.closeCombobox():a.openCombobox()),f())}),g=bu([l]),{isFocusVisible:b,focusProps:y}=Da({autoFocus:u}),{isHovered:v,hoverProps:k}=Za({isDisabled:c}),{pressed:N,pressProps:w}=hu({disabled:c}),E=m.useMemo(()=>({open:n.comboboxState===0,active:N||n.comboboxState===0,disabled:c,value:n.value,hover:v,focus:b}),[n,v,b,N,c]),C=Qa({ref:o,id:l,type:xu(e,n.buttonElement),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(r=n.optionsElement)==null?void 0:r.id,"aria-expanded":n.comboboxState===0,"aria-labelledby":g,disabled:c||void 0,autoFocus:u,onMouseDown:h,onKeyDown:p},y,k,w);return Vt()({ourProps:C,theirProps:d,slot:E,defaultTag:mge,name:"Combobox.Button"})}let hge="div",gge=In.RenderStrategy|In.Static;function bge(e,t){var r,n,a;let o=m.useId(),{id:s=`headlessui-combobox-options-${o}`,hold:l=!1,anchor:c,portal:u=!1,modal:d=!0,transition:f=!1,...p}=e,h=ju("Combobox.Options"),g=Qf("Combobox.Options"),b=X1(c);b&&(u=!0);let[y,v]=J1(b),[k,N]=m.useState(null),w=Z1(),E=Zt(t,b?y:null,g.setOptionsElement,N),C=eo(h.optionsElement),O=ks(),[D,A]=ku(f,k,O!==null?(O&xr.Open)===xr.Open:h.comboboxState===0);mb(D,h.inputElement,g.closeCombobox);let M=h.__demoMode?!1:d&&h.comboboxState===0;bb(M,C);let I=h.__demoMode?!1:d&&h.comboboxState===0;W1(I,{allowed:m.useCallback(()=>[h.inputElement,h.buttonElement,h.optionsElement],[h.inputElement,h.buttonElement,h.optionsElement])}),Ut(()=>{var X;h.optionsPropsRef.current.static=(X=e.static)!=null?X:!1},[h.optionsPropsRef,e.static]),Ut(()=>{h.optionsPropsRef.current.hold=l},[h.optionsPropsRef,l]),bhe(h.comboboxState===0,{container:h.optionsElement,accept(X){return X.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:X.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(X){X.setAttribute("role","none")}});let T=bu([(r=h.buttonElement)==null?void 0:r.id]),R=m.useMemo(()=>({open:h.comboboxState===0,option:void 0}),[h.comboboxState]),L=Me(()=>{g.setActivationTrigger(0)}),F=Me(X=>{X.preventDefault(),g.setActivationTrigger(0)}),V=Qa(b?w():{},{"aria-labelledby":T,role:"listbox","aria-multiselectable":h.mode===1?!0:void 0,id:s,ref:E,style:{...p.style,...v,"--input-width":Bh(h.inputElement,!0).width,"--button-width":Bh(h.buttonElement,!0).width},onWheel:h.activationTrigger===0?void 0:L,onMouseDown:F,...vu(A)}),H=D&&h.comboboxState===1,$=Uh(H,(n=h.virtual)==null?void 0:n.options),z=Uh(H,h.value),W=Me(X=>h.compare(z,X));if(h.virtual){if($===void 0)throw new Error("Missing `options` in virtual mode");Object.assign(p,{children:x.createElement(wf.Provider,{value:$!==h.virtual.options?{...h,virtual:{...h.virtual,options:$}}:h},x.createElement(ige,{slot:R},p.children))})}let U=Vt();return x.createElement(xb,{enabled:u?e.static||D:!1},x.createElement(wf.Provider,{value:h.mode===1?h:{...h,isSelected:W}},U({ourProps:V,theirProps:{...p,children:x.createElement(Vhe,{freeze:H},typeof p.children=="function"?(a=p.children)==null?void 0:a.call(p,R):p.children)},slot:R,defaultTag:hge,features:gge,visible:D,name:"Combobox.Options"})))}let yge="div";function xge(e,t){var r,n,a,o;let s=ju("Combobox.Option"),l=Qf("Combobox.Option"),c=m.useId(),{id:u=`headlessui-combobox-option-${c}`,value:d,disabled:f=(a=(n=(r=s.virtual)==null?void 0:r.disabled)==null?void 0:n.call(r,d))!=null?a:!1,order:p=null,...h}=e,g=fL(s.inputElement),b=s.virtual?s.activeOptionIndex===s.calculateIndex(d):s.activeOptionIndex===null?!1:((o=s.options[s.activeOptionIndex])==null?void 0:o.id)===u,y=s.isSelected(d),v=m.useRef(null),k=Hn({disabled:f,value:d,domRef:v,order:p}),N=m.useContext(EL),w=Zt(t,v,N?N.measureElement:null),E=Me(()=>{l.setIsTyping(!1),l.onChange(d)});Ut(()=>l.registerOption(u,k),[k,u]);let C=m.useRef(!(s.virtual||s.__demoMode));Ut(()=>{if(!s.virtual&&!s.__demoMode)return Xa().requestAnimationFrame(()=>{C.current=!0})},[s.virtual,s.__demoMode]),Ut(()=>{if(C.current&&s.comboboxState===0&&b&&s.activationTrigger!==0)return Xa().requestAnimationFrame(()=>{var F,V;(V=(F=v.current)==null?void 0:F.scrollIntoView)==null||V.call(F,{block:"nearest"})})},[v,b,s.comboboxState,s.activationTrigger,s.activeOptionIndex]);let O=Me(F=>{F.preventDefault(),F.button===tE.Left&&(f||(E(),uL()||requestAnimationFrame(()=>g()),s.mode===0&&l.closeCombobox()))}),D=Me(()=>{if(f)return l.goToOption(qt.Nothing);let F=s.calculateIndex(d);l.goToOption(qt.Specific,F)}),A=mL(),M=Me(F=>A.update(F)),I=Me(F=>{if(!A.wasMoved(F)||f||b)return;let V=s.calculateIndex(d);l.goToOption(qt.Specific,V,0)}),T=Me(F=>{A.wasMoved(F)&&(f||b&&(s.optionsPropsRef.current.hold||l.goToOption(qt.Nothing)))}),R=m.useMemo(()=>({active:b,focus:b,selected:y,disabled:f}),[b,y,f]),L={id:u,ref:w,role:"option",tabIndex:f===!0?void 0:-1,"aria-disabled":f===!0?!0:void 0,"aria-selected":y,disabled:void 0,onMouseDown:O,onFocus:D,onPointerEnter:M,onMouseEnter:M,onPointerMove:I,onMouseMove:I,onPointerLeave:T,onMouseLeave:T};return Vt()({ourProps:L,theirProps:h,slot:R,defaultTag:yge,name:"Combobox.Option"})}let vge=Ht(uge),SL=Ht(pge),CL=Ht(fge),kge=q1,OL=Ht(bge),PL=Ht(xge),wge=Object.assign(vge,{Input:CL,Button:SL,Label:kge,Options:OL,Option:PL});function jge(e,t=typeof document<"u"?document.defaultView:null,r){let n=yu(e,"escape");gb(t,"keydown",a=>{n&&(a.defaultPrevented||a.key===bt.Escape&&r(a))})}function Nge(){var e;let[t]=m.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[r,n]=m.useState((e=t?.matches)!=null?e:!1);return Ut(()=>{if(!t)return;function a(o){n(o.matches)}return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[t]),r}function AL({defaultContainers:e=[],portals:t,mainTreeNode:r}={}){let n=eo(r),a=Me(()=>{var o,s;let l=[];for(let c of e)c!==null&&(c instanceof HTMLElement?l.push(c):"current"in c&&c.current instanceof HTMLElement&&l.push(c.current));if(t!=null&&t.current)for(let c of t.current)l.push(c);for(let c of(o=n?.querySelectorAll("html > *, body > *"))!=null?o:[])c!==document.body&&c!==document.head&&c instanceof HTMLElement&&c.id!=="headlessui-portal-root"&&(r&&(c.contains(r)||c.contains((s=r?.getRootNode())==null?void 0:s.host))||l.some(u=>c.contains(u))||l.push(c));return l});return{resolveContainers:a,contains:Me(o=>a().some(s=>s.contains(o)))}}let ML=m.createContext(null);function qh({children:e,node:t}){let[r,n]=m.useState(null),a=nE(t??r);return x.createElement(ML.Provider,{value:a},e,a===null&&x.createElement(Oo,{features:Co.Hidden,ref:o=>{var s,l;if(o){for(let c of(l=(s=Io(o))==null?void 0:s.querySelectorAll("html > *, body > *"))!=null?l:[])if(c!==document.body&&c!==document.head&&c instanceof HTMLElement&&c!=null&&c.contains(o)){n(c);break}}}}))}function nE(e=null){var t;return(t=m.useContext(ML))!=null?t:e}function vb(){let e=m.useRef(!1);return Ut(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var ga=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ga||{});function aE(){let e=m.useRef(0);return dL(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function TL(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let r of e.current)r.current instanceof HTMLElement&&t.add(r.current);return t}let Ege="div";var Fi=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(Fi||{});function Sge(e,t){let r=m.useRef(null),n=Zt(r,t),{initialFocus:a,initialFocusFallback:o,containers:s,features:l=15,...c}=e;Jf()||(l=0);let u=eo(r);Age(l,{ownerDocument:u});let d=Mge(l,{ownerDocument:u,container:r,initialFocus:a,initialFocusFallback:o});Tge(l,{ownerDocument:u,container:r,containers:s,previousActiveElement:d});let f=aE(),p=Me(k=>{let N=r.current;N&&(w=>w())(()=>{Xt(f.current,{[ga.Forwards]:()=>{pn(N,yr.First,{skipElements:[k.relatedTarget,o]})},[ga.Backwards]:()=>{pn(N,yr.Last,{skipElements:[k.relatedTarget,o]})}})})}),h=yu(!!(l&2),"focus-trap#tab-lock"),g=Do(),b=m.useRef(!1),y={ref:n,onKeyDown(k){k.key=="Tab"&&(b.current=!0,g.requestAnimationFrame(()=>{b.current=!1}))},onBlur(k){if(!(l&4))return;let N=TL(s);r.current instanceof HTMLElement&&N.add(r.current);let w=k.relatedTarget;w instanceof HTMLElement&&w.dataset.headlessuiFocusGuard!=="true"&&(_L(N,w)||(b.current?pn(r.current,Xt(f.current,{[ga.Forwards]:()=>yr.Next,[ga.Backwards]:()=>yr.Previous})|yr.WrapAround,{relativeTo:k.target}):k.target instanceof HTMLElement&&Jo(k.target)))}},v=Vt();return x.createElement(x.Fragment,null,h&&x.createElement(Oo,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:p,features:Co.Focusable}),v({ourProps:y,theirProps:c,defaultTag:Ege,name:"FocusTrap"}),h&&x.createElement(Oo,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:p,features:Co.Focusable}))}let Cge=Ht(Sge),Oge=Object.assign(Cge,{features:Fi});function Pge(e=!0){let t=m.useRef(oo.slice());return kf(([r],[n])=>{n===!0&&r===!1&&Yf(()=>{t.current.splice(0)}),n===!1&&r===!0&&(t.current=oo.slice())},[e,oo,t]),Me(()=>{var r;return(r=t.current.find(n=>n!=null&&n.isConnected))!=null?r:null})}function Age(e,{ownerDocument:t}){let r=!!(e&8),n=Pge(r);kf(()=>{r||t?.activeElement===t?.body&&Jo(n())},[r]),xL(()=>{r&&Jo(n())})}function Mge(e,{ownerDocument:t,container:r,initialFocus:n,initialFocusFallback:a}){let o=m.useRef(null),s=yu(!!(e&1),"focus-trap#initial-focus"),l=vb();return kf(()=>{if(e===0)return;if(!s){a!=null&&a.current&&Jo(a.current);return}let c=r.current;c&&Yf(()=>{if(!l.current)return;let u=t?.activeElement;if(n!=null&&n.current){if(n?.current===u){o.current=u;return}}else if(c.contains(u)){o.current=u;return}if(n!=null&&n.current)Jo(n.current);else{if(e&16){if(pn(c,yr.First|yr.AutoFocus)!==fo.Error)return}else if(pn(c,yr.First)!==fo.Error)return;if(a!=null&&a.current&&(Jo(a.current),t?.activeElement===a.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}o.current=t?.activeElement})},[a,s,e]),o}function Tge(e,{ownerDocument:t,container:r,containers:n,previousActiveElement:a}){let o=vb(),s=!!(e&4);gb(t?.defaultView,"focus",l=>{if(!s||!o.current)return;let c=TL(n);r.current instanceof HTMLElement&&c.add(r.current);let u=a.current;if(!u)return;let d=l.target;d&&d instanceof HTMLElement?_L(c,d)?(a.current=d,Jo(d)):(l.preventDefault(),l.stopPropagation(),Jo(u)):Jo(a.current)},!0)}function _L(e,t){for(let r of e)if(r.contains(t))return!0;return!1}function IL(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:LL)!==m.Fragment||x.Children.count(e.children)===1}let kb=m.createContext(null);kb.displayName="TransitionContext";var _ge=(e=>(e.Visible="visible",e.Hidden="hidden",e))(_ge||{});function Ige(){let e=m.useContext(kb);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Dge(){let e=m.useContext(wb);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let wb=m.createContext(null);wb.displayName="NestingContext";function jb(e){return"children"in e?jb(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function DL(e,t){let r=Hn(e),n=m.useRef([]),a=vb(),o=Do(),s=Me((h,g=zs.Hidden)=>{let b=n.current.findIndex(({el:y})=>y===h);b!==-1&&(Xt(g,{[zs.Unmount](){n.current.splice(b,1)},[zs.Hidden](){n.current[b].state="hidden"}}),o.microTask(()=>{var y;!jb(n)&&a.current&&((y=r.current)==null||y.call(r))}))}),l=Me(h=>{let g=n.current.find(({el:b})=>b===h);return g?g.state!=="visible"&&(g.state="visible"):n.current.push({el:h,state:"visible"}),()=>s(h,zs.Unmount)}),c=m.useRef([]),u=m.useRef(Promise.resolve()),d=m.useRef({enter:[],leave:[]}),f=Me((h,g,b)=>{c.current.splice(0),t&&(t.chains.current[g]=t.chains.current[g].filter(([y])=>y!==h)),t?.chains.current[g].push([h,new Promise(y=>{c.current.push(y)})]),t?.chains.current[g].push([h,new Promise(y=>{Promise.all(d.current[g].map(([v,k])=>k)).then(()=>y())})]),g==="enter"?u.current=u.current.then(()=>t?.wait.current).then(()=>b(g)):b(g)}),p=Me((h,g,b)=>{Promise.all(d.current[g].splice(0).map(([y,v])=>v)).then(()=>{var y;(y=c.current.shift())==null||y()}).then(()=>b(g))});return m.useMemo(()=>({children:n,register:l,unregister:s,onStart:f,onStop:p,wait:u,chains:d}),[l,s,n,f,p,d,u])}let LL=m.Fragment,RL=In.RenderStrategy;function Lge(e,t){var r,n;let{transition:a=!0,beforeEnter:o,afterEnter:s,beforeLeave:l,afterLeave:c,enter:u,enterFrom:d,enterTo:f,entered:p,leave:h,leaveFrom:g,leaveTo:b,...y}=e,[v,k]=m.useState(null),N=m.useRef(null),w=IL(e),E=Zt(...w?[N,t,k]:t===null?[]:[t]),C=(r=y.unmount)==null||r?zs.Unmount:zs.Hidden,{show:O,appear:D,initial:A}=Ige(),[M,I]=m.useState(O?"visible":"hidden"),T=Dge(),{register:R,unregister:L}=T;Ut(()=>R(N),[R,N]),Ut(()=>{if(C===zs.Hidden&&N.current){if(O&&M!=="visible"){I("visible");return}return Xt(M,{hidden:()=>L(N),visible:()=>R(N)})}},[M,N,R,L,O,C]);let F=Jf();Ut(()=>{if(w&&F&&M==="visible"&&N.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[N,M,F,w]);let V=A&&!D,H=D&&O&&A,$=m.useRef(!1),z=DL(()=>{$.current||(I("hidden"),L(N))},T),W=Me(re=>{$.current=!0;let pe=re?"enter":"leave";z.onStart(N,pe,te=>{te==="enter"?o?.():te==="leave"&&l?.()})}),U=Me(re=>{let pe=re?"enter":"leave";$.current=!1,z.onStop(N,pe,te=>{te==="enter"?s?.():te==="leave"&&c?.()}),pe==="leave"&&!jb(z)&&(I("hidden"),L(N))});m.useEffect(()=>{w&&a||(W(O),U(O))},[O,w,a]);let X=!(!a||!w||!F||V),[,Y]=ku(X,v,O,{start:W,end:U}),ae=_s({ref:E,className:((n=hj(y.className,H&&u,H&&d,Y.enter&&u,Y.enter&&Y.closed&&d,Y.enter&&!Y.closed&&f,Y.leave&&h,Y.leave&&!Y.closed&&g,Y.leave&&Y.closed&&b,!Y.transition&&O&&p))==null?void 0:n.trim())||void 0,...vu(Y)}),G=0;M==="visible"&&(G|=xr.Open),M==="hidden"&&(G|=xr.Closed),Y.enter&&(G|=xr.Opening),Y.leave&&(G|=xr.Closing);let ee=Vt();return x.createElement(wb.Provider,{value:z},x.createElement(Zf,{value:G},ee({ourProps:ae,theirProps:y,defaultTag:LL,features:RL,visible:M==="visible",name:"Transition.Child"})))}function Rge(e,t){let{show:r,appear:n=!1,unmount:a=!0,...o}=e,s=m.useRef(null),l=IL(e),c=Zt(...l?[s,t]:t===null?[]:[t]);Jf();let u=ks();if(r===void 0&&u!==null&&(r=(u&xr.Open)===xr.Open),r===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[d,f]=m.useState(r?"visible":"hidden"),p=DL(()=>{r||f("hidden")}),[h,g]=m.useState(!0),b=m.useRef([r]);Ut(()=>{h!==!1&&b.current[b.current.length-1]!==r&&(b.current.push(r),g(!1))},[b,r]);let y=m.useMemo(()=>({show:r,appear:n,initial:h}),[r,n,h]);Ut(()=>{r?f("visible"):!jb(p)&&s.current!==null&&f("hidden")},[r,p]);let v={unmount:a},k=Me(()=>{var E;h&&g(!1),(E=e.beforeEnter)==null||E.call(e)}),N=Me(()=>{var E;h&&g(!1),(E=e.beforeLeave)==null||E.call(e)}),w=Vt();return x.createElement(wb.Provider,{value:p},x.createElement(kb.Provider,{value:y},w({ourProps:{...v,as:m.Fragment,children:x.createElement(FL,{ref:c,...v,...o,beforeEnter:k,beforeLeave:N})},theirProps:{},defaultTag:m.Fragment,features:RL,visible:d==="visible",name:"Transition"})))}function Fge(e,t){let r=m.useContext(kb)!==null,n=ks()!==null;return x.createElement(x.Fragment,null,!r&&n?x.createElement(xj,{ref:t,...e}):x.createElement(FL,{ref:t,...e}))}let xj=Ht(Rge),FL=Ht(Lge),Nb=Ht(Fge),oi=Object.assign(xj,{Child:Nb,Root:xj});var $ge=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))($ge||{}),Bge=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Bge||{});let Hge={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},oE=m.createContext(null);oE.displayName="DialogContext";function Eb(e){let t=m.useContext(oE);if(t===null){let r=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Eb),r}return t}function zge(e,t){return Xt(t.type,Hge,e,t)}let y7=Ht(function(e,t){let r=m.useId(),{id:n=`headlessui-dialog-${r}`,open:a,onClose:o,initialFocus:s,role:l="dialog",autoFocus:c=!0,__demoMode:u=!1,unmount:d=!1,...f}=e,p=m.useRef(!1);l=function(){return l==="dialog"||l==="alertdialog"?l:(p.current||(p.current=!0,console.warn(`Invalid role [${l}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let h=ks();a===void 0&&h!==null&&(a=(h&xr.Open)===xr.Open);let g=m.useRef(null),b=Zt(g,t),y=eo(g),v=a?0:1,[k,N]=m.useReducer(zge,{titleId:null,descriptionId:null,panelRef:m.createRef()}),w=Me(()=>o(!1)),E=Me(U=>N({type:0,id:U})),C=Jf()?v===0:!1,[O,D]=jL(),A={get current(){var U;return(U=k.panelRef.current)!=null?U:g.current}},M=nE(),{resolveContainers:I}=AL({mainTreeNode:M,portals:O,defaultContainers:[A]}),T=h!==null?(h&xr.Closing)===xr.Closing:!1;W1(u||T?!1:C,{allowed:Me(()=>{var U,X;return[(X=(U=g.current)==null?void 0:U.closest("[data-headlessui-portal]"))!=null?X:null]}),disallowed:Me(()=>{var U;return[(U=M?.closest("body > *:not(#headlessui-portal-root)"))!=null?U:null]})}),hb(C,I,U=>{U.preventDefault(),w()}),jge(C,y?.defaultView,U=>{U.preventDefault(),U.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),w()}),bb(u||T?!1:C,y,I),mb(C,g,w);let[R,L]=nL(),F=m.useMemo(()=>[{dialogState:v,close:w,setTitleId:E,unmount:d},k],[v,k,w,E,d]),V=m.useMemo(()=>({open:v===0}),[v]),H={ref:b,id:n,role:l,tabIndex:-1,"aria-modal":u?void 0:v===0?!0:void 0,"aria-labelledby":k.titleId,"aria-describedby":R,unmount:d},$=!Nge(),z=Fi.None;C&&!u&&(z|=Fi.RestoreFocus,z|=Fi.TabLock,c&&(z|=Fi.AutoFocus),$&&(z|=Fi.InitialFocus));let W=Vt();return x.createElement(eE,null,x.createElement(b7,{force:!0},x.createElement(xb,null,x.createElement(oE.Provider,{value:F},x.createElement(NL,{target:g},x.createElement(b7,{force:!1},x.createElement(L,{slot:V},x.createElement(D,null,x.createElement(Oge,{initialFocus:s,initialFocusFallback:g,containers:I,features:z},x.createElement(V1,{value:w},W({ourProps:H,theirProps:f,slot:V,defaultTag:Uge,features:qge,visible:v===0,name:"Dialog"})))))))))))}),Uge="div",qge=In.RenderStrategy|In.Static;function Vge(e,t){let{transition:r=!1,open:n,...a}=e,o=ks(),s=e.hasOwnProperty("open")||o!==null,l=e.hasOwnProperty("onClose");if(!s&&!l)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!s)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!l)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!o&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(n!==void 0||r)&&!a.static?x.createElement(qh,null,x.createElement(oi,{show:n,transition:r,unmount:a.unmount},x.createElement(y7,{ref:t,...a}))):x.createElement(qh,null,x.createElement(y7,{ref:t,open:n,...a}))}let Wge="div";function Kge(e,t){let r=m.useId(),{id:n=`headlessui-dialog-panel-${r}`,transition:a=!1,...o}=e,[{dialogState:s,unmount:l},c]=Eb("Dialog.Panel"),u=Zt(t,c.panelRef),d=m.useMemo(()=>({open:s===0}),[s]),f=Me(y=>{y.stopPropagation()}),p={ref:u,id:n,onClick:f},h=a?Nb:m.Fragment,g=a?{unmount:l}:{},b=Vt();return x.createElement(h,{...g},b({ourProps:p,theirProps:o,slot:d,defaultTag:Wge,name:"Dialog.Panel"}))}let Yge="div";function Xge(e,t){let{transition:r=!1,...n}=e,[{dialogState:a,unmount:o}]=Eb("Dialog.Backdrop"),s=m.useMemo(()=>({open:a===0}),[a]),l={ref:t,"aria-hidden":!0},c=r?Nb:m.Fragment,u=r?{unmount:o}:{},d=Vt();return x.createElement(c,{...u},d({ourProps:l,theirProps:n,slot:s,defaultTag:Yge,name:"Dialog.Backdrop"}))}let Gge="h2";function Zge(e,t){let r=m.useId(),{id:n=`headlessui-dialog-title-${r}`,...a}=e,[{dialogState:o,setTitleId:s}]=Eb("Dialog.Title"),l=Zt(t);m.useEffect(()=>(s(n),()=>s(null)),[n,s]);let c=m.useMemo(()=>({open:o===0}),[o]),u={ref:l,id:n};return Vt()({ourProps:u,theirProps:a,slot:c,defaultTag:Gge,name:"Dialog.Title"})}let Jge=Ht(Vge),$L=Ht(Kge),Qge=Ht(Xge),ebe=Ht(Zge),tbe=Object.assign(Jge,{Panel:$L,Title:ebe,Description:aL});var x7;let rbe=(x7=x.startTransition)!=null?x7:function(e){e()};var nbe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(nbe||{}),abe=(e=>(e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.SetButtonElement=4]="SetButtonElement",e[e.SetPanelElement=5]="SetPanelElement",e))(abe||{});let obe={0:e=>({...e,disclosureState:Xt(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},2(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},3(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}},4(e,t){return e.buttonElement===t.element?e:{...e,buttonElement:t.element}},5(e,t){return e.panelElement===t.element?e:{...e,panelElement:t.element}}},sE=m.createContext(null);sE.displayName="DisclosureContext";function iE(e){let t=m.useContext(sE);if(t===null){let r=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,iE),r}return t}let lE=m.createContext(null);lE.displayName="DisclosureAPIContext";function BL(e){let t=m.useContext(lE);if(t===null){let r=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,BL),r}return t}let cE=m.createContext(null);cE.displayName="DisclosurePanelContext";function sbe(){return m.useContext(cE)}function ibe(e,t){return Xt(t.type,obe,e,t)}let lbe=m.Fragment;function cbe(e,t){let{defaultOpen:r=!1,...n}=e,a=m.useRef(null),o=Zt(t,H1(b=>{a.current=b},e.as===void 0||e.as===m.Fragment)),s=m.useReducer(ibe,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:l,buttonId:c},u]=s,d=Me(b=>{u({type:1});let y=Io(a);if(!y||!c)return;(b?b instanceof HTMLElement?b:b.current instanceof HTMLElement?b.current:y.getElementById(c):y.getElementById(c))?.focus()}),f=m.useMemo(()=>({close:d}),[d]),p=m.useMemo(()=>({open:l===0,close:d}),[l,d]),h={ref:o},g=Vt();return x.createElement(sE.Provider,{value:s},x.createElement(lE.Provider,{value:f},x.createElement(V1,{value:d},x.createElement(Zf,{value:Xt(l,{0:xr.Open,1:xr.Closed})},g({ourProps:h,theirProps:n,slot:p,defaultTag:lbe,name:"Disclosure"})))))}let ube="button";function dbe(e,t){let r=m.useId(),{id:n=`headlessui-disclosure-button-${r}`,disabled:a=!1,autoFocus:o=!1,...s}=e,[l,c]=iE("Disclosure.Button"),u=sbe(),d=u===null?!1:u===l.panelId,f=m.useRef(null),p=Zt(f,t,Me(A=>{if(!d)return c({type:4,element:A})}));m.useEffect(()=>{if(!d)return c({type:2,buttonId:n}),()=>{c({type:2,buttonId:null})}},[n,c,d]);let h=Me(A=>{var M;if(d){if(l.disclosureState===1)return;switch(A.key){case bt.Space:case bt.Enter:A.preventDefault(),A.stopPropagation(),c({type:0}),(M=l.buttonElement)==null||M.focus();break}}else switch(A.key){case bt.Space:case bt.Enter:A.preventDefault(),A.stopPropagation(),c({type:0});break}}),g=Me(A=>{A.key===bt.Space&&A.preventDefault()}),b=Me(A=>{var M;gu(A.currentTarget)||a||(d?(c({type:0}),(M=l.buttonElement)==null||M.focus()):c({type:0}))}),{isFocusVisible:y,focusProps:v}=Da({autoFocus:o}),{isHovered:k,hoverProps:N}=Za({isDisabled:a}),{pressed:w,pressProps:E}=hu({disabled:a}),C=m.useMemo(()=>({open:l.disclosureState===0,hover:k,active:w,disabled:a,focus:y,autofocus:o}),[l,k,w,y,a,o]),O=xu(e,l.buttonElement),D=Qa(d?{ref:p,type:O,disabled:a||void 0,autoFocus:o,onKeyDown:h,onClick:b}:{ref:p,id:n,type:O,"aria-expanded":l.disclosureState===0,"aria-controls":l.panelElement?l.panelId:void 0,disabled:a||void 0,autoFocus:o,onKeyDown:h,onKeyUp:g,onClick:b},v,N,E);return Vt()({ourProps:D,theirProps:s,slot:C,defaultTag:ube,name:"Disclosure.Button"})}let fbe="div",mbe=In.RenderStrategy|In.Static;function pbe(e,t){let r=m.useId(),{id:n=`headlessui-disclosure-panel-${r}`,transition:a=!1,...o}=e,[s,l]=iE("Disclosure.Panel"),{close:c}=BL("Disclosure.Panel"),[u,d]=m.useState(null),f=Zt(t,Me(k=>{rbe(()=>l({type:5,element:k}))}),d);m.useEffect(()=>(l({type:3,panelId:n}),()=>{l({type:3,panelId:null})}),[n,l]);let p=ks(),[h,g]=ku(a,u,p!==null?(p&xr.Open)===xr.Open:s.disclosureState===0),b=m.useMemo(()=>({open:s.disclosureState===0,close:c}),[s.disclosureState,c]),y={ref:f,id:n,...vu(g)},v=Vt();return x.createElement(eE,null,x.createElement(cE.Provider,{value:s.panelId},v({ourProps:y,theirProps:o,slot:b,defaultTag:fbe,features:mbe,visible:h,name:"Disclosure.Panel"})))}let hbe=Ht(cbe),gbe=Ht(dbe),bbe=Ht(pbe),uE=Object.assign(hbe,{Button:gbe,Panel:bbe});function ybe(e,t){let r=m.useRef({left:0,top:0});if(Ut(()=>{if(!t)return;let a=t.getBoundingClientRect();a&&(r.current=a)},[e,t]),t==null||!e||t===document.activeElement)return!1;let n=t.getBoundingClientRect();return n.top!==r.current.top||n.left!==r.current.left}let v7=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function k7(e){var t,r;let n=(t=e.innerText)!=null?t:"",a=e.cloneNode(!0);if(!(a instanceof HTMLElement))return n;let o=!1;for(let l of a.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))l.remove(),o=!0;let s=o?(r=a.innerText)!=null?r:"":n;return v7.test(s)&&(s=s.replace(v7,"")),s}function xbe(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let r=e.getAttribute("aria-labelledby");if(r){let n=r.split(" ").map(a=>{let o=document.getElementById(a);if(o){let s=o.getAttribute("aria-label");return typeof s=="string"?s.trim():k7(o).trim()}return null}).filter(Boolean);if(n.length>0)return n.join(", ")}return k7(e).trim()}function vbe(e){let t=m.useRef(""),r=m.useRef("");return Me(()=>{let n=e.current;if(!n)return"";let a=n.innerText;if(t.current===a)return r.current;let o=xbe(n).trim().toLowerCase();return t.current=a,r.current=o,o})}var kbe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(kbe||{}),wbe=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(wbe||{}),jbe=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(jbe||{}),Nbe=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e))(Nbe||{});function qk(e,t=r=>r){let r=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,n=Us(t(e.options.slice()),o=>o.dataRef.current.domRef.current),a=r?n.indexOf(r):null;return a===-1&&(a=null),{options:n,activeOptionIndex:a}}let Ebe={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1,__demoMode:!1}},0(e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,n=e.options.findIndex(a=>r(a.dataRef.current.value));return n!==-1&&(t=n),{...e,listboxState:0,activeOptionIndex:t,__demoMode:!1}},2(e,t){var r,n,a,o,s;if(e.dataRef.current.disabled||e.listboxState===1)return e;let l={...e,searchQuery:"",activationTrigger:(r=t.trigger)!=null?r:1,__demoMode:!1};if(t.focus===qt.Nothing)return{...l,activeOptionIndex:null};if(t.focus===qt.Specific)return{...l,activeOptionIndex:e.options.findIndex(d=>d.id===t.id)};if(t.focus===qt.Previous){let d=e.activeOptionIndex;if(d!==null){let f=e.options[d].dataRef.current.domRef,p=Od(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:h=>h.id,resolveDisabled:h=>h.dataRef.current.disabled});if(p!==null){let h=e.options[p].dataRef.current.domRef;if(((n=f.current)==null?void 0:n.previousElementSibling)===h.current||((a=h.current)==null?void 0:a.previousElementSibling)===null)return{...l,activeOptionIndex:p}}}}else if(t.focus===qt.Next){let d=e.activeOptionIndex;if(d!==null){let f=e.options[d].dataRef.current.domRef,p=Od(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:h=>h.id,resolveDisabled:h=>h.dataRef.current.disabled});if(p!==null){let h=e.options[p].dataRef.current.domRef;if(((o=f.current)==null?void 0:o.nextElementSibling)===h.current||((s=h.current)==null?void 0:s.nextElementSibling)===null)return{...l,activeOptionIndex:p}}}}let c=qk(e),u=Od(t,{resolveItems:()=>c.options,resolveActiveIndex:()=>c.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});return{...l,...c,activeOptionIndex:u}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let r=e.searchQuery!==""?0:1,n=e.searchQuery+t.value.toLowerCase(),a=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+r).concat(e.options.slice(0,e.activeOptionIndex+r)):e.options).find(s=>{var l;return!s.dataRef.current.disabled&&((l=s.dataRef.current.textValue)==null?void 0:l.startsWith(n))}),o=a?e.options.indexOf(a):-1;return o===-1||o===e.activeOptionIndex?{...e,searchQuery:n}:{...e,searchQuery:n,activeOptionIndex:o,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let r={id:t.id,dataRef:t.dataRef},n=qk(e,a=>[...a,r]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(n.activeOptionIndex=n.options.indexOf(r)),{...e,...n}},6:(e,t)=>{let r=qk(e,n=>{let a=n.findIndex(o=>o.id===t.id);return a!==-1&&n.splice(a,1),n});return{...e,...r,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},dE=m.createContext(null);dE.displayName="ListboxActionsContext";function Sb(e){let t=m.useContext(dE);if(t===null){let r=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Sb),r}return t}let Cb=m.createContext(null);Cb.displayName="ListboxDataContext";function em(e){let t=m.useContext(Cb);if(t===null){let r=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,em),r}return t}function Sbe(e,t){return Xt(t.type,Ebe,e,t)}let Cbe=m.Fragment;function Obe(e,t){var r;let n=Xf(),{value:a,defaultValue:o,form:s,name:l,onChange:c,by:u,invalid:d=!1,disabled:f=n||!1,horizontal:p=!1,multiple:h=!1,__demoMode:g=!1,...b}=e;const y=p?"horizontal":"vertical";let v=Zt(t),k=$1(o),[N=h?[]:void 0,w]=F1(a,c,k),[E,C]=m.useReducer(Sbe,{dataRef:m.createRef(),listboxState:g?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,optionsVisible:!1,buttonElement:null,optionsElement:null,__demoMode:g}),O=m.useRef({static:!1,hold:!1}),D=m.useRef(new Map),A=sL(u),M=m.useCallback(K=>Xt(I.mode,{1:()=>N.some(ge=>A(ge,K)),0:()=>A(N,K)}),[N]),I=m.useMemo(()=>({...E,value:N,disabled:f,invalid:d,mode:h?1:0,orientation:y,compare:A,isSelected:M,optionsPropsRef:O,listRef:D}),[N,f,d,h,E,D]);Ut(()=>{E.dataRef.current=I},[I]);let T=I.listboxState===0;hb(T,[I.buttonElement,I.optionsElement],(K,ge)=>{var ye;C({type:1}),K1(ge,pb.Loose)||(K.preventDefault(),(ye=I.buttonElement)==null||ye.focus())});let R=m.useMemo(()=>({open:I.listboxState===0,disabled:f,invalid:d,value:N}),[I,f,N,d]),L=Me(K=>{let ge=I.options.find(ye=>ye.id===K);ge&&U(ge.dataRef.current.value)}),F=Me(()=>{if(I.activeOptionIndex!==null){let{dataRef:K,id:ge}=I.options[I.activeOptionIndex];U(K.current.value),C({type:2,focus:qt.Specific,id:ge})}}),V=Me(()=>C({type:0})),H=Me(()=>C({type:1})),$=Do(),z=Me((K,ge,ye)=>{$.dispose(),$.microTask(()=>K===qt.Specific?C({type:2,focus:qt.Specific,id:ge,trigger:ye}):C({type:2,focus:K,trigger:ye}))}),W=Me((K,ge)=>(C({type:5,id:K,dataRef:ge}),()=>C({type:6,id:K}))),U=Me(K=>Xt(I.mode,{0(){return w?.(K)},1(){let ge=I.value.slice(),ye=ge.findIndex(me=>A(me,K));return ye===-1?ge.push(K):ge.splice(ye,1),w?.(ge)}})),X=Me(K=>C({type:3,value:K})),Y=Me(()=>C({type:4})),ae=Me(K=>{C({type:7,element:K})}),G=Me(K=>{C({type:8,element:K})}),ee=m.useMemo(()=>({onChange:U,registerOption:W,goToOption:z,closeListbox:H,openListbox:V,selectActiveOption:F,selectOption:L,search:X,clearSearch:Y,setButtonElement:ae,setOptionsElement:G}),[]),[re,pe]=U1({inherit:!0}),te={ref:v},se=m.useCallback(()=>{if(k!==void 0)return w?.(k)},[w,k]),ne=Vt();return x.createElement(pe,{value:re,props:{htmlFor:(r=I.buttonElement)==null?void 0:r.id},slot:{open:I.listboxState===0,disabled:f}},x.createElement(Q1,null,x.createElement(dE.Provider,{value:ee},x.createElement(Cb.Provider,{value:I},x.createElement(Zf,{value:Xt(I.listboxState,{0:xr.Open,1:xr.Closed})},l!=null&&N!=null&&x.createElement(B1,{disabled:f,data:{[l]:N},form:s,onReset:se}),ne({ourProps:te,theirProps:b,slot:R,defaultTag:Cbe,name:"Listbox"}))))))}let Pbe="button";function Abe(e,t){var r;let n=em("Listbox.Button"),a=Sb("Listbox.Button"),o=m.useId(),s=ub(),{id:l=s||`headlessui-listbox-button-${o}`,disabled:c=n.disabled||!1,autoFocus:u=!1,...d}=e,f=Zt(t,G1(),a.setButtonElement),p=zhe(),h=Me(I=>{switch(I.key){case bt.Enter:eL(I.currentTarget);break;case bt.Space:case bt.ArrowDown:I.preventDefault(),Qt.flushSync(()=>a.openListbox()),n.value||a.goToOption(qt.First);break;case bt.ArrowUp:I.preventDefault(),Qt.flushSync(()=>a.openListbox()),n.value||a.goToOption(qt.Last);break}}),g=Me(I=>{I.key===bt.Space&&I.preventDefault()}),b=Me(I=>{var T;if(gu(I.currentTarget))return I.preventDefault();n.listboxState===0?(Qt.flushSync(()=>a.closeListbox()),(T=n.buttonElement)==null||T.focus({preventScroll:!0})):(I.preventDefault(),a.openListbox())}),y=Me(I=>I.preventDefault()),v=bu([l]),k=z1(),{isFocusVisible:N,focusProps:w}=Da({autoFocus:u}),{isHovered:E,hoverProps:C}=Za({isDisabled:c}),{pressed:O,pressProps:D}=hu({disabled:c}),A=m.useMemo(()=>({open:n.listboxState===0,active:O||n.listboxState===0,disabled:c,invalid:n.invalid,value:n.value,hover:E,focus:N,autofocus:u}),[n.listboxState,n.value,c,E,N,O,n.invalid,u]),M=Qa(p(),{ref:f,id:l,type:xu(e,n.buttonElement),"aria-haspopup":"listbox","aria-controls":(r=n.optionsElement)==null?void 0:r.id,"aria-expanded":n.listboxState===0,"aria-labelledby":v,"aria-describedby":k,disabled:c||void 0,autoFocus:u,onKeyDown:h,onKeyUp:g,onKeyPress:y,onClick:b},w,C,D);return Vt()({ourProps:M,theirProps:d,slot:A,defaultTag:Pbe,name:"Listbox.Button"})}let HL=m.createContext(!1),Mbe="div",Tbe=In.RenderStrategy|In.Static;function _be(e,t){var r,n;let a=m.useId(),{id:o=`headlessui-listbox-options-${a}`,anchor:s,portal:l=!1,modal:c=!0,transition:u=!1,...d}=e,f=X1(s),[p,h]=m.useState(null);f&&(l=!0);let g=em("Listbox.Options"),b=Sb("Listbox.Options"),y=eo(g.optionsElement),v=ks(),[k,N]=ku(u,p,v!==null?(v&xr.Open)===xr.Open:g.listboxState===0);mb(k,g.buttonElement,b.closeListbox);let w=g.__demoMode?!1:c&&g.listboxState===0;bb(w,y);let E=g.__demoMode?!1:c&&g.listboxState===0;W1(E,{allowed:m.useCallback(()=>[g.buttonElement,g.optionsElement],[g.buttonElement,g.optionsElement])});let C=g.listboxState!==0,O=ybe(C,g.buttonElement)?!1:k,D=k&&g.listboxState===1,A=Uh(D,g.value),M=Me(Y=>g.compare(A,Y)),I=m.useMemo(()=>{var Y;if(f==null||!((Y=f?.to)!=null&&Y.includes("selection")))return null;let ae=g.options.findIndex(G=>M(G.dataRef.current.value));return ae===-1&&(ae=0),ae},[f,g.options]),T=(()=>{if(f==null)return;if(I===null)return{...f,inner:void 0};let Y=Array.from(g.listRef.current.values());return{...f,inner:{listRef:{current:Y},index:I}}})(),[R,L]=J1(T),F=Z1(),V=Zt(t,f?R:null,b.setOptionsElement,h),H=Do();m.useEffect(()=>{var Y;let ae=g.optionsElement;ae&&g.listboxState===0&&ae!==((Y=Io(ae))==null?void 0:Y.activeElement)&&ae?.focus({preventScroll:!0})},[g.listboxState,g.optionsElement]);let $=Me(Y=>{var ae,G;switch(H.dispose(),Y.key){case bt.Space:if(g.searchQuery!=="")return Y.preventDefault(),Y.stopPropagation(),b.search(Y.key);case bt.Enter:if(Y.preventDefault(),Y.stopPropagation(),g.activeOptionIndex!==null){let{dataRef:ee}=g.options[g.activeOptionIndex];b.onChange(ee.current.value)}g.mode===0&&(Qt.flushSync(()=>b.closeListbox()),(ae=g.buttonElement)==null||ae.focus({preventScroll:!0}));break;case Xt(g.orientation,{vertical:bt.ArrowDown,horizontal:bt.ArrowRight}):return Y.preventDefault(),Y.stopPropagation(),b.goToOption(qt.Next);case Xt(g.orientation,{vertical:bt.ArrowUp,horizontal:bt.ArrowLeft}):return Y.preventDefault(),Y.stopPropagation(),b.goToOption(qt.Previous);case bt.Home:case bt.PageUp:return Y.preventDefault(),Y.stopPropagation(),b.goToOption(qt.First);case bt.End:case bt.PageDown:return Y.preventDefault(),Y.stopPropagation(),b.goToOption(qt.Last);case bt.Escape:Y.preventDefault(),Y.stopPropagation(),Qt.flushSync(()=>b.closeListbox()),(G=g.buttonElement)==null||G.focus({preventScroll:!0});return;case bt.Tab:Y.preventDefault(),Y.stopPropagation(),Qt.flushSync(()=>b.closeListbox()),ohe(g.buttonElement,Y.shiftKey?yr.Previous:yr.Next);break;default:Y.key.length===1&&(b.search(Y.key),H.setTimeout(()=>b.clearSearch(),350));break}}),z=(r=g.buttonElement)==null?void 0:r.id,W=m.useMemo(()=>({open:g.listboxState===0}),[g.listboxState]),U=Qa(f?F():{},{id:o,ref:V,"aria-activedescendant":g.activeOptionIndex===null||(n=g.options[g.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":g.mode===1?!0:void 0,"aria-labelledby":z,"aria-orientation":g.orientation,onKeyDown:$,role:"listbox",tabIndex:g.listboxState===0?0:void 0,style:{...d.style,...L,"--button-width":Bh(g.buttonElement,!0).width},...vu(N)}),X=Vt();return x.createElement(xb,{enabled:l?e.static||k:!1},x.createElement(Cb.Provider,{value:g.mode===1?g:{...g,isSelected:M}},X({ourProps:U,theirProps:d,slot:W,defaultTag:Mbe,features:Tbe,visible:O,name:"Listbox.Options"})))}let Ibe="div";function Dbe(e,t){let r=m.useId(),{id:n=`headlessui-listbox-option-${r}`,disabled:a=!1,value:o,...s}=e,l=m.useContext(HL)===!0,c=em("Listbox.Option"),u=Sb("Listbox.Option"),d=c.activeOptionIndex!==null?c.options[c.activeOptionIndex].id===n:!1,f=c.isSelected(o),p=m.useRef(null),h=vbe(p),g=Hn({disabled:a,value:o,domRef:p,get textValue(){return h()}}),b=Zt(t,p,A=>{A?c.listRef.current.set(n,A):c.listRef.current.delete(n)});Ut(()=>{if(!c.__demoMode&&c.listboxState===0&&d&&c.activationTrigger!==0)return Xa().requestAnimationFrame(()=>{var A,M;(M=(A=p.current)==null?void 0:A.scrollIntoView)==null||M.call(A,{block:"nearest"})})},[p,d,c.__demoMode,c.listboxState,c.activationTrigger,c.activeOptionIndex]),Ut(()=>{if(!l)return u.registerOption(n,g)},[g,n,l]);let y=Me(A=>{var M;if(a)return A.preventDefault();u.onChange(o),c.mode===0&&(Qt.flushSync(()=>u.closeListbox()),(M=c.buttonElement)==null||M.focus({preventScroll:!0}))}),v=Me(()=>{if(a)return u.goToOption(qt.Nothing);u.goToOption(qt.Specific,n)}),k=mL(),N=Me(A=>{k.update(A),!a&&(d||u.goToOption(qt.Specific,n,0))}),w=Me(A=>{k.wasMoved(A)&&(a||d||u.goToOption(qt.Specific,n,0))}),E=Me(A=>{k.wasMoved(A)&&(a||d&&u.goToOption(qt.Nothing))}),C=m.useMemo(()=>({active:d,focus:d,selected:f,disabled:a,selectedOption:f&&l}),[d,f,a,l]),O=l?{}:{id:n,ref:b,role:"option",tabIndex:a===!0?void 0:-1,"aria-disabled":a===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:y,onFocus:v,onPointerEnter:N,onMouseEnter:N,onPointerMove:w,onMouseMove:w,onPointerLeave:E,onMouseLeave:E},D=Vt();return!f&&l?null:D({ourProps:O,theirProps:s,slot:C,defaultTag:Ibe,name:"Listbox.Option"})}let Lbe=m.Fragment;function Rbe(e,t){let{options:r,placeholder:n,...a}=e,o={ref:Zt(t)},s=em("ListboxSelectedOption"),l=m.useMemo(()=>({}),[]),c=s.value===void 0||s.value===null||s.mode===1&&Array.isArray(s.value)&&s.value.length===0,u=Vt();return x.createElement(HL.Provider,{value:!0},u({ourProps:o,theirProps:{...a,children:x.createElement(x.Fragment,null,n&&c?n:r)},slot:l,defaultTag:Lbe,name:"ListboxSelectedOption"}))}let Fbe=Ht(Obe),Ob=Ht(Abe),$be=q1,Pb=Ht(_be),fE=Ht(Dbe),Bbe=Ht(Rbe),mE=Object.assign(Fbe,{Button:Ob,Label:$be,Options:Pb,Option:fE,SelectedOption:Bbe});var Hbe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Hbe||{}),zbe=(e=>(e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(zbe||{});let Ube={0:e=>({...e,popoverState:Xt(e.popoverState,{0:1,1:0}),__demoMode:!1}),1(e){return e.popoverState===1?e:{...e,popoverState:1,__demoMode:!1}},2(e,t){return e.button===t.button?e:{...e,button:t.button}},3(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},4(e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},5(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},pE=m.createContext(null);pE.displayName="PopoverContext";function Ab(e){let t=m.useContext(pE);if(t===null){let r=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ab),r}return t}let Mb=m.createContext(null);Mb.displayName="PopoverAPIContext";function hE(e){let t=m.useContext(Mb);if(t===null){let r=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,hE),r}return t}let gE=m.createContext(null);gE.displayName="PopoverGroupContext";function zL(){return m.useContext(gE)}let Tb=m.createContext(null);Tb.displayName="PopoverPanelContext";function qbe(){return m.useContext(Tb)}function Vbe(e,t){return Xt(t.type,Ube,e,t)}let Wbe="div";function Kbe(e,t){var r;let{__demoMode:n=!1,...a}=e,o=m.useRef(null),s=Zt(t,H1(z=>{o.current=z})),l=m.useRef([]),c=m.useReducer(Vbe,{__demoMode:n,popoverState:n?0:1,buttons:l,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:m.createRef(),afterPanelSentinel:m.createRef(),afterButtonSentinel:m.createRef()}),[{popoverState:u,button:d,buttonId:f,panel:p,panelId:h,beforePanelSentinel:g,afterPanelSentinel:b,afterButtonSentinel:y},v]=c,k=eo((r=o.current)!=null?r:d),N=m.useMemo(()=>{if(!d||!p)return!1;for(let G of document.querySelectorAll("body > *"))if(Number(G?.contains(d))^Number(G?.contains(p)))return!0;let z=Gf(),W=z.indexOf(d),U=(W+z.length-1)%z.length,X=(W+1)%z.length,Y=z[U],ae=z[X];return!p.contains(Y)&&!p.contains(ae)},[d,p]),w=Hn(f),E=Hn(h),C=m.useMemo(()=>({buttonId:w,panelId:E,close:()=>v({type:1})}),[w,E,v]),O=zL(),D=O?.registerPopover,A=Me(()=>{var z;return(z=O?.isFocusWithinPopoverGroup())!=null?z:k?.activeElement&&(d?.contains(k.activeElement)||p?.contains(k.activeElement))});m.useEffect(()=>D?.(C),[D,C]);let[M,I]=jL(),T=nE(d),R=AL({mainTreeNode:T,portals:M,defaultContainers:[d,p]});gb(k?.defaultView,"focus",z=>{var W,U,X,Y,ae,G;z.target!==window&&z.target instanceof HTMLElement&&u===0&&(A()||d&&p&&(R.contains(z.target)||(U=(W=g.current)==null?void 0:W.contains)!=null&&U.call(W,z.target)||(Y=(X=b.current)==null?void 0:X.contains)!=null&&Y.call(X,z.target)||(G=(ae=y.current)==null?void 0:ae.contains)!=null&&G.call(ae,z.target)||v({type:1})))},!0),hb(u===0,R.resolveContainers,(z,W)=>{v({type:1}),K1(W,pb.Loose)||(z.preventDefault(),d?.focus())});let L=Me(z=>{v({type:1}),(z?z instanceof HTMLElement?z:"current"in z&&z.current instanceof HTMLElement?z.current:d:d)?.focus()}),F=m.useMemo(()=>({close:L,isPortalled:N}),[L,N]),V=m.useMemo(()=>({open:u===0,close:L}),[u,L]),H={ref:s},$=Vt();return x.createElement(qh,{node:T},x.createElement(Q1,null,x.createElement(Tb.Provider,{value:null},x.createElement(pE.Provider,{value:c},x.createElement(Mb.Provider,{value:F},x.createElement(V1,{value:L},x.createElement(Zf,{value:Xt(u,{0:xr.Open,1:xr.Closed})},x.createElement(I,null,$({ourProps:H,theirProps:a,slot:V,defaultTag:Wbe,name:"Popover"})))))))))}let Ybe="button";function Xbe(e,t){let r=m.useId(),{id:n=`headlessui-popover-button-${r}`,disabled:a=!1,autoFocus:o=!1,...s}=e,[l,c]=Ab("Popover.Button"),{isPortalled:u}=hE("Popover.Button"),d=m.useRef(null),f=`headlessui-focus-sentinel-${m.useId()}`,p=zL(),h=p?.closeOthers,g=qbe()!==null;m.useEffect(()=>{if(!g)return c({type:3,buttonId:n}),()=>{c({type:3,buttonId:null})}},[g,n,c]);let[b]=m.useState(()=>Symbol()),y=Zt(d,t,G1(),Me(W=>{if(!g){if(W)l.buttons.current.push(b);else{let U=l.buttons.current.indexOf(b);U!==-1&&l.buttons.current.splice(U,1)}l.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),W&&c({type:2,button:W})}})),v=Zt(d,t),k=eo(d),N=Me(W=>{var U,X,Y;if(g){if(l.popoverState===1)return;switch(W.key){case bt.Space:case bt.Enter:W.preventDefault(),(X=(U=W.target).click)==null||X.call(U),c({type:1}),(Y=l.button)==null||Y.focus();break}}else switch(W.key){case bt.Space:case bt.Enter:W.preventDefault(),W.stopPropagation(),l.popoverState===1&&h?.(l.buttonId),c({type:0});break;case bt.Escape:if(l.popoverState!==0)return h?.(l.buttonId);if(!d.current||k!=null&&k.activeElement&&!d.current.contains(k.activeElement))return;W.preventDefault(),W.stopPropagation(),c({type:1});break}}),w=Me(W=>{g||W.key===bt.Space&&W.preventDefault()}),E=Me(W=>{var U,X;gu(W.currentTarget)||a||(g?(c({type:1}),(U=l.button)==null||U.focus()):(W.preventDefault(),W.stopPropagation(),l.popoverState===1&&h?.(l.buttonId),c({type:0}),(X=l.button)==null||X.focus()))}),C=Me(W=>{W.preventDefault(),W.stopPropagation()}),{isFocusVisible:O,focusProps:D}=Da({autoFocus:o}),{isHovered:A,hoverProps:M}=Za({isDisabled:a}),{pressed:I,pressProps:T}=hu({disabled:a}),R=l.popoverState===0,L=m.useMemo(()=>({open:R,active:I||R,disabled:a,hover:A,focus:O,autofocus:o}),[R,A,O,I,a,o]),F=xu(e,l.button),V=Qa(g?{ref:v,type:F,onKeyDown:N,onClick:E,disabled:a||void 0,autoFocus:o}:{ref:y,id:l.buttonId,type:F,"aria-expanded":l.popoverState===0,"aria-controls":l.panel?l.panelId:void 0,disabled:a||void 0,autoFocus:o,onKeyDown:N,onKeyUp:w,onClick:E,onMouseDown:C},D,M,T),H=aE(),$=Me(()=>{let W=l.panel;if(!W)return;function U(){Xt(H.current,{[ga.Forwards]:()=>pn(W,yr.First),[ga.Backwards]:()=>pn(W,yr.Last)})===fo.Error&&pn(Gf().filter(X=>X.dataset.headlessuiFocusGuard!=="true"),Xt(H.current,{[ga.Forwards]:yr.Next,[ga.Backwards]:yr.Previous}),{relativeTo:l.button})}U()}),z=Vt();return x.createElement(x.Fragment,null,z({ourProps:V,theirProps:s,slot:L,defaultTag:Ybe,name:"Popover.Button"}),R&&!g&&u&&x.createElement(Oo,{id:f,ref:l.afterButtonSentinel,features:Co.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:$}))}let Gbe="div",Zbe=In.RenderStrategy|In.Static;function UL(e,t){let r=m.useId(),{id:n=`headlessui-popover-backdrop-${r}`,transition:a=!1,...o}=e,[{popoverState:s},l]=Ab("Popover.Backdrop"),[c,u]=m.useState(null),d=Zt(t,u),f=ks(),[p,h]=ku(a,c,f!==null?(f&xr.Open)===xr.Open:s===0),g=Me(v=>{if(gu(v.currentTarget))return v.preventDefault();l({type:1})}),b=m.useMemo(()=>({open:s===0}),[s]),y={ref:d,id:n,"aria-hidden":!0,onClick:g,...vu(h)};return Vt()({ourProps:y,theirProps:o,slot:b,defaultTag:Gbe,features:Zbe,visible:p,name:"Popover.Backdrop"})}let Jbe="div",Qbe=In.RenderStrategy|In.Static;function eye(e,t){let r=m.useId(),{id:n=`headlessui-popover-panel-${r}`,focus:a=!1,anchor:o,portal:s=!1,modal:l=!1,transition:c=!1,...u}=e,[d,f]=Ab("Popover.Panel"),{close:p,isPortalled:h}=hE("Popover.Panel"),g=`headlessui-focus-sentinel-before-${r}`,b=`headlessui-focus-sentinel-after-${r}`,y=m.useRef(null),v=X1(o),[k,N]=J1(v),w=Z1();v&&(s=!0);let[E,C]=m.useState(null),O=Zt(y,t,v?k:null,Me(W=>f({type:4,panel:W})),C),D=eo(y);Ut(()=>(f({type:5,panelId:n}),()=>{f({type:5,panelId:null})}),[n,f]);let A=ks(),[M,I]=ku(c,E,A!==null?(A&xr.Open)===xr.Open:d.popoverState===0);mb(M,d.button,()=>{f({type:1})});let T=d.__demoMode?!1:l&&M;bb(T,D);let R=Me(W=>{var U;switch(W.key){case bt.Escape:if(d.popoverState!==0||!y.current||D!=null&&D.activeElement&&!y.current.contains(D.activeElement))return;W.preventDefault(),W.stopPropagation(),f({type:1}),(U=d.button)==null||U.focus();break}});m.useEffect(()=>{var W;e.static||d.popoverState===1&&((W=e.unmount)==null||W)&&f({type:4,panel:null})},[d.popoverState,e.unmount,e.static,f]),m.useEffect(()=>{if(d.__demoMode||!a||d.popoverState!==0||!y.current)return;let W=D?.activeElement;y.current.contains(W)||pn(y.current,yr.First)},[d.__demoMode,a,y.current,d.popoverState]);let L=m.useMemo(()=>({open:d.popoverState===0,close:p}),[d.popoverState,p]),F=Qa(v?w():{},{ref:O,id:n,onKeyDown:R,onBlur:a&&d.popoverState===0?W=>{var U,X,Y,ae,G;let ee=W.relatedTarget;ee&&y.current&&((U=y.current)!=null&&U.contains(ee)||(f({type:1}),((Y=(X=d.beforePanelSentinel.current)==null?void 0:X.contains)!=null&&Y.call(X,ee)||(G=(ae=d.afterPanelSentinel.current)==null?void 0:ae.contains)!=null&&G.call(ae,ee))&&ee.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...u.style,...N,"--button-width":Bh(d.button,!0).width},...vu(I)}),V=aE(),H=Me(()=>{let W=y.current;if(!W)return;function U(){Xt(V.current,{[ga.Forwards]:()=>{var X;pn(W,yr.First)===fo.Error&&((X=d.afterPanelSentinel.current)==null||X.focus())},[ga.Backwards]:()=>{var X;(X=d.button)==null||X.focus({preventScroll:!0})}})}U()}),$=Me(()=>{let W=y.current;if(!W)return;function U(){Xt(V.current,{[ga.Forwards]:()=>{if(!d.button)return;let X=Gf(),Y=X.indexOf(d.button),ae=X.slice(0,Y+1),G=[...X.slice(Y+1),...ae];for(let ee of G.slice())if(ee.dataset.headlessuiFocusGuard==="true"||E!=null&&E.contains(ee)){let re=G.indexOf(ee);re!==-1&&G.splice(re,1)}pn(G,yr.First,{sorted:!1})},[ga.Backwards]:()=>{var X;pn(W,yr.Previous)===fo.Error&&((X=d.button)==null||X.focus())}})}U()}),z=Vt();return x.createElement(eE,null,x.createElement(Tb.Provider,{value:n},x.createElement(Mb.Provider,{value:{close:p,isPortalled:h}},x.createElement(xb,{enabled:s?e.static||M:!1},M&&h&&x.createElement(Oo,{id:g,ref:d.beforePanelSentinel,features:Co.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:H}),z({ourProps:F,theirProps:u,slot:L,defaultTag:Jbe,features:Qbe,visible:M,name:"Popover.Panel"}),M&&h&&x.createElement(Oo,{id:b,ref:d.afterPanelSentinel,features:Co.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:$})))))}let tye="div";function rye(e,t){let r=m.useRef(null),n=Zt(r,t),[a,o]=m.useState([]),s=Me(b=>{o(y=>{let v=y.indexOf(b);if(v!==-1){let k=y.slice();return k.splice(v,1),k}return y})}),l=Me(b=>(o(y=>[...y,b]),()=>s(b))),c=Me(()=>{var b;let y=Io(r);if(!y)return!1;let v=y.activeElement;return(b=r.current)!=null&&b.contains(v)?!0:a.some(k=>{var N,w;return((N=y.getElementById(k.buttonId.current))==null?void 0:N.contains(v))||((w=y.getElementById(k.panelId.current))==null?void 0:w.contains(v))})}),u=Me(b=>{for(let y of a)y.buttonId.current!==b&&y.close()}),d=m.useMemo(()=>({registerPopover:l,unregisterPopover:s,isFocusWithinPopoverGroup:c,closeOthers:u}),[l,s,c,u]),f=m.useMemo(()=>({}),[]),p=e,h={ref:n},g=Vt();return x.createElement(qh,null,x.createElement(gE.Provider,{value:d},g({ourProps:h,theirProps:p,slot:f,defaultTag:tye,name:"Popover.Group"})))}let nye=Ht(Kbe),bE=Ht(Xbe),aye=Ht(UL),oye=Ht(UL),yE=Ht(eye),sye=Ht(rye),qL=Object.assign(nye,{Button:bE,Backdrop:oye,Overlay:aye,Panel:yE,Group:sye}),xE=m.createContext(null);xE.displayName="GroupContext";let iye=m.Fragment;function lye(e){var t;let[r,n]=m.useState(null),[a,o]=U1(),[s,l]=nL(),c=m.useMemo(()=>({switch:r,setSwitch:n}),[r,n]),u={},d=e,f=Vt();return x.createElement(l,{name:"Switch.Description",value:s},x.createElement(o,{name:"Switch.Label",value:a,props:{htmlFor:(t=c.switch)==null?void 0:t.id,onClick(p){r&&(p.currentTarget instanceof HTMLLabelElement&&p.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},x.createElement(xE.Provider,{value:c},f({ourProps:u,theirProps:d,slot:{},defaultTag:iye,name:"Switch.Group"}))))}let cye="button";function uye(e,t){var r;let n=m.useId(),a=ub(),o=Xf(),{id:s=a||`headlessui-switch-${n}`,disabled:l=o||!1,checked:c,defaultChecked:u,onChange:d,name:f,value:p,form:h,autoFocus:g=!1,...b}=e,y=m.useContext(xE),[v,k]=m.useState(null),N=m.useRef(null),w=Zt(N,t,y===null?null:y.setSwitch,k),E=$1(u),[C,O]=F1(c,d,E??!1),D=Do(),[A,M]=m.useState(!1),I=Me(()=>{M(!0),O?.(!C),D.nextFrame(()=>{M(!1)})}),T=Me(re=>{if(gu(re.currentTarget))return re.preventDefault();re.preventDefault(),I()}),R=Me(re=>{re.key===bt.Space?(re.preventDefault(),I()):re.key===bt.Enter&&eL(re.currentTarget)}),L=Me(re=>re.preventDefault()),F=bu(),V=z1(),{isFocusVisible:H,focusProps:$}=Da({autoFocus:g}),{isHovered:z,hoverProps:W}=Za({isDisabled:l}),{pressed:U,pressProps:X}=hu({disabled:l}),Y=m.useMemo(()=>({checked:C,disabled:l,hover:z,focus:H,active:U,autofocus:g,changing:A}),[C,z,H,U,l,A,g]),ae=Qa({id:s,ref:w,role:"switch",type:xu(e,v),tabIndex:e.tabIndex===-1?0:(r=e.tabIndex)!=null?r:0,"aria-checked":C,"aria-labelledby":F,"aria-describedby":V,disabled:l||void 0,autoFocus:g,onClick:T,onKeyUp:R,onKeyPress:L},$,W,X),G=m.useCallback(()=>{if(E!==void 0)return O?.(E)},[O,E]),ee=Vt();return x.createElement(x.Fragment,null,f!=null&&x.createElement(B1,{disabled:l,data:{[f]:p||"on"},overrides:{type:"checkbox",checked:C},form:h,onReset:G}),ee({ourProps:ae,theirProps:b,slot:Y,defaultTag:cye,name:"Switch"}))}let dye=Ht(uye),fye=lye,mye=q1,pye=aL,hye=Object.assign(dye,{Group:fye,Label:mye,Description:pye});function gye({onFocus:e}){let[t,r]=m.useState(!0),n=vb();return t?x.createElement(Oo,{as:"button",type:"button",features:Co.Focusable,onFocus:a=>{a.preventDefault();let o,s=50;function l(){if(s--<=0){o&&cancelAnimationFrame(o);return}if(e()){if(cancelAnimationFrame(o),!n.current)return;r(!1);return}o=requestAnimationFrame(l)}o=requestAnimationFrame(l)}}):null}const VL=m.createContext(null);function bye(){return{groups:new Map,get(e,t){var r;let n=this.groups.get(e);n||(n=new Map,this.groups.set(e,n));let a=(r=n.get(t))!=null?r:0;n.set(t,a+1);let o=Array.from(n.keys()).indexOf(t);function s(){let l=n.get(t);l>1?n.set(t,l-1):n.delete(t)}return[o,s]}}}function yye({children:e}){let t=m.useRef(bye());return m.createElement(VL.Provider,{value:t},e)}function WL(e){let t=m.useContext(VL);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let r=m.useId(),[n,a]=t.current.get(e,r);return m.useEffect(()=>a,[]),n}var xye=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(xye||{}),vye=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(vye||{}),kye=(e=>(e[e.SetSelectedIndex=0]="SetSelectedIndex",e[e.RegisterTab=1]="RegisterTab",e[e.UnregisterTab=2]="UnregisterTab",e[e.RegisterPanel=3]="RegisterPanel",e[e.UnregisterPanel=4]="UnregisterPanel",e))(kye||{});let wye={0(e,t){var r;let n=Us(e.tabs,d=>d.current),a=Us(e.panels,d=>d.current),o=n.filter(d=>{var f;return!((f=d.current)!=null&&f.hasAttribute("disabled"))}),s={...e,tabs:n,panels:a};if(t.index<0||t.index>n.length-1){let d=Xt(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>Xt(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(o.length===0)return s;let f=Xt(d,{0:()=>n.indexOf(o[0]),1:()=>n.indexOf(o[o.length-1])});return{...s,selectedIndex:f===-1?e.selectedIndex:f}}let l=n.slice(0,t.index),c=[...n.slice(t.index),...l].find(d=>o.includes(d));if(!c)return s;let u=(r=n.indexOf(c))!=null?r:e.selectedIndex;return u===-1&&(u=e.selectedIndex),{...s,selectedIndex:u}},1(e,t){if(e.tabs.includes(t.tab))return e;let r=e.tabs[e.selectedIndex],n=Us([...e.tabs,t.tab],o=>o.current),a=e.selectedIndex;return e.info.current.isControlled||(a=n.indexOf(r),a===-1&&(a=e.selectedIndex)),{...e,tabs:n,selectedIndex:a}},2(e,t){return{...e,tabs:e.tabs.filter(r=>r!==t.tab)}},3(e,t){return e.panels.includes(t.panel)?e:{...e,panels:Us([...e.panels,t.panel],r=>r.current)}},4(e,t){return{...e,panels:e.panels.filter(r=>r!==t.panel)}}},vE=m.createContext(null);vE.displayName="TabsDataContext";function Xc(e){let t=m.useContext(vE);if(t===null){let r=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Xc),r}return t}let kE=m.createContext(null);kE.displayName="TabsActionsContext";function wE(e){let t=m.useContext(kE);if(t===null){let r=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,wE),r}return t}function jye(e,t){return Xt(t.type,wye,e,t)}let Nye="div";function Eye(e,t){let{defaultIndex:r=0,vertical:n=!1,manual:a=!1,onChange:o,selectedIndex:s=null,...l}=e;const c=n?"vertical":"horizontal",u=a?"manual":"auto";let d=s!==null,f=Hn({isControlled:d}),p=Zt(t),[h,g]=m.useReducer(jye,{info:f,selectedIndex:s??r,tabs:[],panels:[]}),b=m.useMemo(()=>({selectedIndex:h.selectedIndex}),[h.selectedIndex]),y=Hn(o||(()=>{})),v=Hn(h.tabs),k=m.useMemo(()=>({orientation:c,activation:u,...h}),[c,u,h]),N=Me(M=>(g({type:1,tab:M}),()=>g({type:2,tab:M}))),w=Me(M=>(g({type:3,panel:M}),()=>g({type:4,panel:M}))),E=Me(M=>{C.current!==M&&y.current(M),d||g({type:0,index:M})}),C=Hn(d?e.selectedIndex:h.selectedIndex),O=m.useMemo(()=>({registerTab:N,registerPanel:w,change:E}),[]);Ut(()=>{g({type:0,index:s??r})},[s]),Ut(()=>{if(C.current===void 0||h.tabs.length<=0)return;let M=Us(h.tabs,I=>I.current);M.some((I,T)=>h.tabs[T]!==I)&&E(M.indexOf(h.tabs[C.current]))});let D={ref:p},A=Vt();return x.createElement(yye,null,x.createElement(kE.Provider,{value:O},x.createElement(vE.Provider,{value:k},k.tabs.length<=0&&x.createElement(gye,{onFocus:()=>{var M,I;for(let T of v.current)if(((M=T.current)==null?void 0:M.tabIndex)===0)return(I=T.current)==null||I.focus(),!0;return!1}}),A({ourProps:D,theirProps:l,slot:b,defaultTag:Nye,name:"Tabs"}))))}let Sye="div";function Cye(e,t){let{orientation:r,selectedIndex:n}=Xc("Tab.List"),a=Zt(t),o=m.useMemo(()=>({selectedIndex:n}),[n]),s=e,l={ref:a,role:"tablist","aria-orientation":r};return Vt()({ourProps:l,theirProps:s,slot:o,defaultTag:Sye,name:"Tabs.List"})}let Oye="button";function Pye(e,t){var r,n;let a=m.useId(),{id:o=`headlessui-tabs-tab-${a}`,disabled:s=!1,autoFocus:l=!1,...c}=e,{orientation:u,activation:d,selectedIndex:f,tabs:p,panels:h}=Xc("Tab"),g=wE("Tab"),b=Xc("Tab"),[y,v]=m.useState(null),k=m.useRef(null),N=Zt(k,t,v);Ut(()=>g.registerTab(k),[g,k]);let w=WL("tabs"),E=p.indexOf(k);E===-1&&(E=w);let C=E===f,O=Me(W=>{var U;let X=W();if(X===fo.Success&&d==="auto"){let Y=(U=Io(k))==null?void 0:U.activeElement,ae=b.tabs.findIndex(G=>G.current===Y);ae!==-1&&g.change(ae)}return X}),D=Me(W=>{let U=p.map(X=>X.current).filter(Boolean);if(W.key===bt.Space||W.key===bt.Enter){W.preventDefault(),W.stopPropagation(),g.change(E);return}switch(W.key){case bt.Home:case bt.PageUp:return W.preventDefault(),W.stopPropagation(),O(()=>pn(U,yr.First));case bt.End:case bt.PageDown:return W.preventDefault(),W.stopPropagation(),O(()=>pn(U,yr.Last))}if(O(()=>Xt(u,{vertical(){return W.key===bt.ArrowUp?pn(U,yr.Previous|yr.WrapAround):W.key===bt.ArrowDown?pn(U,yr.Next|yr.WrapAround):fo.Error},horizontal(){return W.key===bt.ArrowLeft?pn(U,yr.Previous|yr.WrapAround):W.key===bt.ArrowRight?pn(U,yr.Next|yr.WrapAround):fo.Error}}))===fo.Success)return W.preventDefault()}),A=m.useRef(!1),M=Me(()=>{var W;A.current||(A.current=!0,(W=k.current)==null||W.focus({preventScroll:!0}),g.change(E),Yf(()=>{A.current=!1}))}),I=Me(W=>{W.preventDefault()}),{isFocusVisible:T,focusProps:R}=Da({autoFocus:l}),{isHovered:L,hoverProps:F}=Za({isDisabled:s}),{pressed:V,pressProps:H}=hu({disabled:s}),$=m.useMemo(()=>({selected:C,hover:L,active:V,focus:T,autofocus:l,disabled:s}),[C,L,T,V,l,s]),z=Qa({ref:N,onKeyDown:D,onMouseDown:I,onClick:M,id:o,role:"tab",type:xu(e,y),"aria-controls":(n=(r=h[E])==null?void 0:r.current)==null?void 0:n.id,"aria-selected":C,tabIndex:C?0:-1,disabled:s||void 0,autoFocus:l},R,F,H);return Vt()({ourProps:z,theirProps:c,slot:$,defaultTag:Oye,name:"Tabs.Tab"})}let Aye="div";function Mye(e,t){let{selectedIndex:r}=Xc("Tab.Panels"),n=Zt(t),a=m.useMemo(()=>({selectedIndex:r}),[r]),o=e,s={ref:n};return Vt()({ourProps:s,theirProps:o,slot:a,defaultTag:Aye,name:"Tabs.Panels"})}let Tye="div",_ye=In.RenderStrategy|In.Static;function Iye(e,t){var r,n,a,o;let s=m.useId(),{id:l=`headlessui-tabs-panel-${s}`,tabIndex:c=0,...u}=e,{selectedIndex:d,tabs:f,panels:p}=Xc("Tab.Panel"),h=wE("Tab.Panel"),g=m.useRef(null),b=Zt(g,t);Ut(()=>h.registerPanel(g),[h,g]);let y=WL("panels"),v=p.indexOf(g);v===-1&&(v=y);let k=v===d,{isFocusVisible:N,focusProps:w}=Da(),E=m.useMemo(()=>({selected:k,focus:N}),[k,N]),C=Qa({ref:b,id:l,role:"tabpanel","aria-labelledby":(n=(r=f[v])==null?void 0:r.current)==null?void 0:n.id,tabIndex:k?c:-1},w),O=Vt();return!k&&((a=u.unmount)==null||a)&&!((o=u.static)!=null&&o)?x.createElement(Oo,{"aria-hidden":"true",...C}):O({ourProps:C,theirProps:u,slot:E,defaultTag:Tye,features:_ye,visible:k,name:"Tabs.Panel"})}let Dye=Ht(Pye),Lye=Ht(Eye),Rye=Ht(Cye),Fye=Ht(Mye),$ye=Ht(Iye),_b=Object.assign(Dye,{Group:Lye,List:Rye,Panels:Fye,Panel:$ye});const KL=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}),x.createElement("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"}))},tm=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))};var Mt=function(){return Mt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Mt.apply(this,arguments)};function Bye(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function YL(e,t,r){for(var n=0,a=t.length,o;n<a;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function rm(e){return e.mode==="multiple"}function nm(e){return e.mode==="range"}function Ib(e){return e.mode==="single"}var Hye={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function zye(e,t){return Vn(e,"LLLL y",t)}function Uye(e,t){return Vn(e,"d",t)}function qye(e,t){return Vn(e,"LLLL",t)}function Vye(e){return"".concat(e)}function Wye(e,t){return Vn(e,"cccccc",t)}function Kye(e,t){return Vn(e,"yyyy",t)}var Yye=Object.freeze({__proto__:null,formatCaption:zye,formatDay:Uye,formatMonthCaption:qye,formatWeekNumber:Vye,formatWeekdayName:Wye,formatYearCaption:Kye}),Xye=function(e,t,r){return Vn(e,"do MMMM (EEEE)",r)},Gye=function(){return"Month: "},Zye=function(){return"Go to next month"},Jye=function(){return"Go to previous month"},Qye=function(e,t){return Vn(e,"cccc",t)},exe=function(e){return"Week n. ".concat(e)},txe=function(){return"Year: "},rxe=Object.freeze({__proto__:null,labelDay:Xye,labelMonthDropdown:Gye,labelNext:Zye,labelPrevious:Jye,labelWeekNumber:exe,labelWeekday:Qye,labelYearDropdown:txe});function nxe(){var e="buttons",t=Hye,r=cb,n={},a={},o=1,s={},l=new Date;return{captionLayout:e,classNames:t,formatters:Yye,labels:rxe,locale:r,modifiersClassNames:n,modifiers:a,numberOfMonths:o,styles:s,today:l,mode:"default"}}function axe(e){var t=e.fromYear,r=e.toYear,n=e.fromMonth,a=e.toMonth,o=e.fromDate,s=e.toDate;return n?o=Cn(n):t&&(o=new Date(t,0,1)),a?s=I1(a):r&&(s=new Date(r,11,31)),{fromDate:o?So(o):void 0,toDate:s?So(s):void 0}}var XL=m.createContext(void 0);function oxe(e){var t,r=e.initialProps,n=nxe(),a=axe(r),o=a.fromDate,s=a.toDate,l=(t=r.captionLayout)!==null&&t!==void 0?t:n.captionLayout;l!=="buttons"&&(!o||!s)&&(l="buttons");var c;(Ib(r)||rm(r)||nm(r))&&(c=r.onSelect);var u=Mt(Mt(Mt({},n),r),{captionLayout:l,classNames:Mt(Mt({},n.classNames),r.classNames),components:Mt({},r.components),formatters:Mt(Mt({},n.formatters),r.formatters),fromDate:o,labels:Mt(Mt({},n.labels),r.labels),mode:r.mode||n.mode,modifiers:Mt(Mt({},n.modifiers),r.modifiers),modifiersClassNames:Mt(Mt({},n.modifiersClassNames),r.modifiersClassNames),onSelect:c,styles:Mt(Mt({},n.styles),r.styles),toDate:s});return i.jsx(XL.Provider,{value:u,children:e.children})}function Dr(){var e=m.useContext(XL);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function GL(e){var t=Dr(),r=t.locale,n=t.classNames,a=t.styles,o=t.formatters.formatCaption;return i.jsx("div",{className:n.caption_label,style:a.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:o(e.displayMonth,{locale:r})})}function sxe(e){return i.jsx("svg",Mt({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:i.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function ZL(e){var t,r,n=e.onChange,a=e.value,o=e.children,s=e.caption,l=e.className,c=e.style,u=Dr(),d=(r=(t=u.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&r!==void 0?r:sxe;return i.jsxs("div",{className:l,style:c,children:[i.jsx("span",{className:u.classNames.vhidden,children:e["aria-label"]}),i.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:a,onChange:n,children:o}),i.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[s,i.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function ixe(e){var t,r=Dr(),n=r.fromDate,a=r.toDate,o=r.styles,s=r.locale,l=r.formatters.formatMonthCaption,c=r.classNames,u=r.components,d=r.labels.labelMonthDropdown;if(!n)return i.jsx(i.Fragment,{});if(!a)return i.jsx(i.Fragment,{});var f=[];if(jpe(n,a))for(var p=Cn(n),h=n.getMonth();h<=a.getMonth();h++)f.push(Rk(p,h));else for(var p=Cn(new Date),h=0;h<=11;h++)f.push(Rk(p,h));var g=function(y){var v=Number(y.target.value),k=Rk(Cn(e.displayMonth),v);e.onChange(k)},b=(t=u?.Dropdown)!==null&&t!==void 0?t:ZL;return i.jsx(b,{name:"months","aria-label":d(),className:c.dropdown_month,style:o.dropdown_month,onChange:g,value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:s}),children:f.map(function(y){return i.jsx("option",{value:y.getMonth(),children:l(y,{locale:s})},y.getMonth())})})}function lxe(e){var t,r=e.displayMonth,n=Dr(),a=n.fromDate,o=n.toDate,s=n.locale,l=n.styles,c=n.classNames,u=n.components,d=n.formatters.formatYearCaption,f=n.labels.labelYearDropdown,p=[];if(!a)return i.jsx(i.Fragment,{});if(!o)return i.jsx(i.Fragment,{});for(var h=a.getFullYear(),g=o.getFullYear(),b=h;b<=g;b++)p.push(t7(D1(new Date),b));var y=function(k){var N=t7(Cn(r),Number(k.target.value));e.onChange(N)},v=(t=u?.Dropdown)!==null&&t!==void 0?t:ZL;return i.jsx(v,{name:"years","aria-label":f(),className:c.dropdown_year,style:l.dropdown_year,onChange:y,value:r.getFullYear(),caption:d(r,{locale:s}),children:p.map(function(k){return i.jsx("option",{value:k.getFullYear(),children:d(k,{locale:s})},k.getFullYear())})})}function cxe(e,t){var r=m.useState(e),n=r[0],a=r[1],o=t===void 0?n:t;return[o,a]}function uxe(e){var t=e.month,r=e.defaultMonth,n=e.today,a=t||r||n||new Date,o=e.toDate,s=e.fromDate,l=e.numberOfMonths,c=l===void 0?1:l;if(o&&vf(o,a)<0){var u=-1*(c-1);a=Ia(o,u)}return s&&vf(a,s)<0&&(a=s),Cn(a)}function dxe(){var e=Dr(),t=uxe(e),r=cxe(t,e.month),n=r[0],a=r[1],o=function(s){var l;if(!e.disableNavigation){var c=Cn(s);a(c),(l=e.onMonthChange)===null||l===void 0||l.call(e,c)}};return[n,o]}function fxe(e,t){for(var r=t.reverseMonths,n=t.numberOfMonths,a=Cn(e),o=Cn(Ia(a,n)),s=vf(o,a),l=[],c=0;c<s;c++){var u=Ia(a,c);l.push(u)}return r&&(l=l.reverse()),l}function mxe(e,t){if(!t.disableNavigation){var r=t.toDate,n=t.pagedNavigation,a=t.numberOfMonths,o=a===void 0?1:a,s=n?o:1,l=Cn(e);if(!r)return Ia(l,s);var c=vf(r,e);if(!(c<o))return Ia(l,s)}}function pxe(e,t){if(!t.disableNavigation){var r=t.fromDate,n=t.pagedNavigation,a=t.numberOfMonths,o=a===void 0?1:a,s=n?o:1,l=Cn(e);if(!r)return Ia(l,-s);var c=vf(l,r);if(!(c<=0))return Ia(l,-s)}}var JL=m.createContext(void 0);function hxe(e){var t=Dr(),r=dxe(),n=r[0],a=r[1],o=fxe(n,t),s=mxe(n,t),l=pxe(n,t),c=function(f){return o.some(function(p){return R1(f,p)})},u=function(f,p){c(f)||(p&&XD(f,p)?a(Ia(f,1+t.numberOfMonths*-1)):a(f))},d={currentMonth:n,displayMonths:o,goToMonth:a,goToDate:u,previousMonth:l,nextMonth:s,isDateDisplayed:c};return i.jsx(JL.Provider,{value:d,children:e.children})}function Nu(){var e=m.useContext(JL);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function w7(e){var t,r=Dr(),n=r.classNames,a=r.styles,o=r.components,s=Nu().goToMonth,l=function(d){s(Ia(d,e.displayIndex?-e.displayIndex:0))},c=(t=o?.CaptionLabel)!==null&&t!==void 0?t:GL,u=i.jsx(c,{id:e.id,displayMonth:e.displayMonth});return i.jsxs("div",{className:n.caption_dropdowns,style:a.caption_dropdowns,children:[i.jsx("div",{className:n.vhidden,children:u}),i.jsx(ixe,{onChange:l,displayMonth:e.displayMonth}),i.jsx(lxe,{onChange:l,displayMonth:e.displayMonth})]})}function gxe(e){return i.jsx("svg",Mt({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:i.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function bxe(e){return i.jsx("svg",Mt({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:i.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Vh=m.forwardRef(function(e,t){var r=Dr(),n=r.classNames,a=r.styles,o=[n.button_reset,n.button];e.className&&o.push(e.className);var s=o.join(" "),l=Mt(Mt({},a.button_reset),a.button);return e.style&&Object.assign(l,e.style),i.jsx("button",Mt({},e,{ref:t,type:"button",className:s,style:l}))});function yxe(e){var t,r,n=Dr(),a=n.dir,o=n.locale,s=n.classNames,l=n.styles,c=n.labels,u=c.labelPrevious,d=c.labelNext,f=n.components;if(!e.nextMonth&&!e.previousMonth)return i.jsx(i.Fragment,{});var p=u(e.previousMonth,{locale:o}),h=[s.nav_button,s.nav_button_previous].join(" "),g=d(e.nextMonth,{locale:o}),b=[s.nav_button,s.nav_button_next].join(" "),y=(t=f?.IconRight)!==null&&t!==void 0?t:bxe,v=(r=f?.IconLeft)!==null&&r!==void 0?r:gxe;return i.jsxs("div",{className:s.nav,style:l.nav,children:[!e.hidePrevious&&i.jsx(Vh,{name:"previous-month","aria-label":p,className:h,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:a==="rtl"?i.jsx(y,{className:s.nav_icon,style:l.nav_icon}):i.jsx(v,{className:s.nav_icon,style:l.nav_icon})}),!e.hideNext&&i.jsx(Vh,{name:"next-month","aria-label":g,className:b,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:a==="rtl"?i.jsx(v,{className:s.nav_icon,style:l.nav_icon}):i.jsx(y,{className:s.nav_icon,style:l.nav_icon})})]})}function j7(e){var t=Dr().numberOfMonths,r=Nu(),n=r.previousMonth,a=r.nextMonth,o=r.goToMonth,s=r.displayMonths,l=s.findIndex(function(g){return R1(e.displayMonth,g)}),c=l===0,u=l===s.length-1,d=t>1&&(c||!u),f=t>1&&(u||!c),p=function(){n&&o(n)},h=function(){a&&o(a)};return i.jsx(yxe,{displayMonth:e.displayMonth,hideNext:d,hidePrevious:f,nextMonth:a,previousMonth:n,onPreviousClick:p,onNextClick:h})}function xxe(e){var t,r=Dr(),n=r.classNames,a=r.disableNavigation,o=r.styles,s=r.captionLayout,l=r.components,c=(t=l?.CaptionLabel)!==null&&t!==void 0?t:GL,u;return a?u=i.jsx(c,{id:e.id,displayMonth:e.displayMonth}):s==="dropdown"?u=i.jsx(w7,{displayMonth:e.displayMonth,id:e.id}):s==="dropdown-buttons"?u=i.jsxs(i.Fragment,{children:[i.jsx(w7,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),i.jsx(j7,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):u=i.jsxs(i.Fragment,{children:[i.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),i.jsx(j7,{displayMonth:e.displayMonth,id:e.id})]}),i.jsx("div",{className:n.caption,style:o.caption,children:u})}function vxe(e){var t=Dr(),r=t.footer,n=t.styles,a=t.classNames.tfoot;return r?i.jsx("tfoot",{className:a,style:n.tfoot,children:i.jsx("tr",{children:i.jsx("td",{colSpan:8,children:r})})}):i.jsx(i.Fragment,{})}function kxe(e,t,r){for(var n=r?fl(new Date):Eo(new Date,{locale:e,weekStartsOn:t}),a=[],o=0;o<7;o++){var s=Ln(n,o);a.push(s)}return a}function wxe(){var e=Dr(),t=e.classNames,r=e.styles,n=e.showWeekNumber,a=e.locale,o=e.weekStartsOn,s=e.ISOWeek,l=e.formatters.formatWeekdayName,c=e.labels.labelWeekday,u=kxe(a,o,s);return i.jsxs("tr",{style:r.head_row,className:t.head_row,children:[n&&i.jsx("td",{style:r.head_cell,className:t.head_cell}),u.map(function(d,f){return i.jsx("th",{scope:"col",className:t.head_cell,style:r.head_cell,"aria-label":c(d,{locale:a}),children:l(d,{locale:a})},f)})]})}function jxe(){var e,t=Dr(),r=t.classNames,n=t.styles,a=t.components,o=(e=a?.HeadRow)!==null&&e!==void 0?e:wxe;return i.jsx("thead",{style:n.head,className:r.head,children:i.jsx(o,{})})}function Nxe(e){var t=Dr(),r=t.locale,n=t.formatters.formatDay;return i.jsx(i.Fragment,{children:n(e.date,{locale:r})})}var jE=m.createContext(void 0);function Exe(e){if(!rm(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return i.jsx(jE.Provider,{value:t,children:e.children})}return i.jsx(Sxe,{initialProps:e.initialProps,children:e.children})}function Sxe(e){var t=e.initialProps,r=e.children,n=t.selected,a=t.min,o=t.max,s=function(u,d,f){var p,h;(p=t.onDayClick)===null||p===void 0||p.call(t,u,d,f);var g=!!(d.selected&&a&&n?.length===a);if(!g){var b=!!(!d.selected&&o&&n?.length===o);if(!b){var y=n?YL([],n):[];if(d.selected){var v=y.findIndex(function(k){return Kn(u,k)});y.splice(v,1)}else y.push(u);(h=t.onSelect)===null||h===void 0||h.call(t,y,u,d,f)}}},l={disabled:[]};n&&l.disabled.push(function(u){var d=o&&n.length>o-1,f=n.some(function(p){return Kn(p,u)});return!!(d&&!f)});var c={selected:n,onDayClick:s,modifiers:l};return i.jsx(jE.Provider,{value:c,children:r})}function NE(){var e=m.useContext(jE);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function Cxe(e,t){var r=t||{},n=r.from,a=r.to;return n&&a?Kn(a,e)&&Kn(n,e)?void 0:Kn(a,e)?{from:a,to:void 0}:Kn(n,e)?void 0:pj(n,e)?{from:e,to:a}:{from:n,to:e}:a?pj(e,a)?{from:a,to:e}:{from:e,to:a}:n?XD(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var EE=m.createContext(void 0);function Oxe(e){if(!nm(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return i.jsx(EE.Provider,{value:t,children:e.children})}return i.jsx(Pxe,{initialProps:e.initialProps,children:e.children})}function Pxe(e){var t=e.initialProps,r=e.children,n=t.selected,a=n||{},o=a.from,s=a.to,l=t.min,c=t.max,u=function(h,g,b){var y,v;(y=t.onDayClick)===null||y===void 0||y.call(t,h,g,b);var k=Cxe(h,n);(v=t.onSelect)===null||v===void 0||v.call(t,k,h,g,b)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(d.range_start=[o],s?(d.range_end=[s],Kn(o,s)||(d.range_middle=[{after:o,before:s}])):d.range_end=[o]):s&&(d.range_start=[s],d.range_end=[s]),l&&(o&&!s&&d.disabled.push({after:fp(o,l-1),before:Ln(o,l-1)}),o&&s&&d.disabled.push({after:o,before:Ln(o,l-1)}),!o&&s&&d.disabled.push({after:fp(s,l-1),before:Ln(s,l-1)})),c){if(o&&!s&&(d.disabled.push({before:Ln(o,-c+1)}),d.disabled.push({after:Ln(o,c-1)})),o&&s){var f=uo(s,o)+1,p=c-f;d.disabled.push({before:fp(o,p)}),d.disabled.push({after:Ln(s,p)})}!o&&s&&(d.disabled.push({before:Ln(s,-c+1)}),d.disabled.push({after:Ln(s,c-1)}))}return i.jsx(EE.Provider,{value:{selected:n,onDayClick:u,modifiers:d},children:r})}function SE(){var e=m.useContext(EE);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function pp(e){return Array.isArray(e)?YL([],e):e!==void 0?[e]:[]}function Axe(e){var t={};return Object.entries(e).forEach(function(r){var n=r[0],a=r[1];t[n]=pp(a)}),t}var Ga;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(Ga||(Ga={}));var Mxe=Ga.Selected,Bo=Ga.Disabled,Txe=Ga.Hidden,_xe=Ga.Today,Vk=Ga.RangeEnd,Wk=Ga.RangeMiddle,Kk=Ga.RangeStart,Ixe=Ga.Outside;function Dxe(e,t,r){var n,a=(n={},n[Mxe]=pp(e.selected),n[Bo]=pp(e.disabled),n[Txe]=pp(e.hidden),n[_xe]=[e.today],n[Vk]=[],n[Wk]=[],n[Kk]=[],n[Ixe]=[],n);return e.fromDate&&a[Bo].push({before:e.fromDate}),e.toDate&&a[Bo].push({after:e.toDate}),rm(e)?a[Bo]=a[Bo].concat(t.modifiers[Bo]):nm(e)&&(a[Bo]=a[Bo].concat(r.modifiers[Bo]),a[Kk]=r.modifiers[Kk],a[Wk]=r.modifiers[Wk],a[Vk]=r.modifiers[Vk]),a}var QL=m.createContext(void 0);function Lxe(e){var t=Dr(),r=NE(),n=SE(),a=Dxe(t,r,n),o=Axe(t.modifiers),s=Mt(Mt({},a),o);return i.jsx(QL.Provider,{value:s,children:e.children})}function eR(){var e=m.useContext(QL);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function Rxe(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Fxe(e){return!!(e&&typeof e=="object"&&"from"in e)}function $xe(e){return!!(e&&typeof e=="object"&&"after"in e)}function Bxe(e){return!!(e&&typeof e=="object"&&"before"in e)}function Hxe(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function zxe(e,t){var r,n=t.from,a=t.to;if(n&&a){var o=uo(a,n)<0;o&&(r=[a,n],n=r[0],a=r[1]);var s=uo(e,n)>=0&&uo(a,e)>=0;return s}return a?Kn(a,e):n?Kn(n,e):!1}function Uxe(e){return _1(e)}function qxe(e){return Array.isArray(e)&&e.every(_1)}function Vxe(e,t){return t.some(function(r){if(typeof r=="boolean")return r;if(Uxe(r))return Kn(e,r);if(qxe(r))return r.includes(e);if(Fxe(r))return zxe(e,r);if(Hxe(r))return r.dayOfWeek.includes(e.getDay());if(Rxe(r)){var n=uo(r.before,e),a=uo(r.after,e),o=n>0,s=a<0,l=pj(r.before,r.after);return l?s&&o:o||s}return $xe(r)?uo(e,r.after)>0:Bxe(r)?uo(r.before,e)>0:typeof r=="function"?r(e):!1})}function CE(e,t,r){var n=Object.keys(t).reduce(function(o,s){var l=t[s];return Vxe(e,l)&&o.push(s),o},[]),a={};return n.forEach(function(o){return a[o]=!0}),r&&!R1(e,r)&&(a.outside=!0),a}function Wxe(e,t){for(var r=Cn(e[0]),n=I1(e[e.length-1]),a,o,s=r;s<=n;){var l=CE(s,t),c=!l.disabled&&!l.hidden;if(!c){s=Ln(s,1);continue}if(l.selected)return s;l.today&&!o&&(o=s),a||(a=s),s=Ln(s,1)}return o||a}var Kxe=365;function tR(e,t){var r=t.moveBy,n=t.direction,a=t.context,o=t.modifiers,s=t.retry,l=s===void 0?{count:0,lastFocused:e}:s,c=a.weekStartsOn,u=a.fromDate,d=a.toDate,f=a.locale,p={day:Ln,week:fj,month:Ia,year:mj,startOfWeek:function(y){return a.ISOWeek?fl(y):Eo(y,{locale:f,weekStartsOn:c})},endOfWeek:function(y){return a.ISOWeek?qD(y):L1(y,{locale:f,weekStartsOn:c})}},h=p[r](e,n==="after"?1:-1);n==="before"&&u?h=zD([u,h]):n==="after"&&d&&(h=UD([d,h]));var g=!0;if(o){var b=CE(h,o);g=!b.disabled&&!b.hidden}return g?h:l.count>Kxe?l.lastFocused:tR(h,{moveBy:r,direction:n,context:a,modifiers:o,retry:Mt(Mt({},l),{count:l.count+1})})}var rR=m.createContext(void 0);function Yxe(e){var t=Nu(),r=eR(),n=m.useState(),a=n[0],o=n[1],s=m.useState(),l=s[0],c=s[1],u=Wxe(t.displayMonths,r),d=a??(l&&t.isDateDisplayed(l))?l:u,f=function(){c(a),o(void 0)},p=function(y){o(y)},h=Dr(),g=function(y,v){if(a){var k=tR(a,{moveBy:y,direction:v,context:h,modifiers:r});Kn(a,k)||(t.goToDate(k,a),p(k))}},b={focusedDay:a,focusTarget:d,blur:f,focus:p,focusDayAfter:function(){return g("day","after")},focusDayBefore:function(){return g("day","before")},focusWeekAfter:function(){return g("week","after")},focusWeekBefore:function(){return g("week","before")},focusMonthBefore:function(){return g("month","before")},focusMonthAfter:function(){return g("month","after")},focusYearBefore:function(){return g("year","before")},focusYearAfter:function(){return g("year","after")},focusStartOfWeek:function(){return g("startOfWeek","before")},focusEndOfWeek:function(){return g("endOfWeek","after")}};return i.jsx(rR.Provider,{value:b,children:e.children})}function OE(){var e=m.useContext(rR);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function Xxe(e,t){var r=eR(),n=CE(e,r,t);return n}var PE=m.createContext(void 0);function Gxe(e){if(!Ib(e.initialProps)){var t={selected:void 0};return i.jsx(PE.Provider,{value:t,children:e.children})}return i.jsx(Zxe,{initialProps:e.initialProps,children:e.children})}function Zxe(e){var t=e.initialProps,r=e.children,n=function(o,s,l){var c,u,d;if((c=t.onDayClick)===null||c===void 0||c.call(t,o,s,l),s.selected&&!t.required){(u=t.onSelect)===null||u===void 0||u.call(t,void 0,o,s,l);return}(d=t.onSelect)===null||d===void 0||d.call(t,o,o,s,l)},a={selected:t.selected,onDayClick:n};return i.jsx(PE.Provider,{value:a,children:r})}function nR(){var e=m.useContext(PE);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function Jxe(e,t){var r=Dr(),n=nR(),a=NE(),o=SE(),s=OE(),l=s.focusDayAfter,c=s.focusDayBefore,u=s.focusWeekAfter,d=s.focusWeekBefore,f=s.blur,p=s.focus,h=s.focusMonthBefore,g=s.focusMonthAfter,b=s.focusYearBefore,y=s.focusYearAfter,v=s.focusStartOfWeek,k=s.focusEndOfWeek,N=function(H){var $,z,W,U;Ib(r)?($=n.onDayClick)===null||$===void 0||$.call(n,e,t,H):rm(r)?(z=a.onDayClick)===null||z===void 0||z.call(a,e,t,H):nm(r)?(W=o.onDayClick)===null||W===void 0||W.call(o,e,t,H):(U=r.onDayClick)===null||U===void 0||U.call(r,e,t,H)},w=function(H){var $;p(e),($=r.onDayFocus)===null||$===void 0||$.call(r,e,t,H)},E=function(H){var $;f(),($=r.onDayBlur)===null||$===void 0||$.call(r,e,t,H)},C=function(H){var $;($=r.onDayMouseEnter)===null||$===void 0||$.call(r,e,t,H)},O=function(H){var $;($=r.onDayMouseLeave)===null||$===void 0||$.call(r,e,t,H)},D=function(H){var $;($=r.onDayPointerEnter)===null||$===void 0||$.call(r,e,t,H)},A=function(H){var $;($=r.onDayPointerLeave)===null||$===void 0||$.call(r,e,t,H)},M=function(H){var $;($=r.onDayTouchCancel)===null||$===void 0||$.call(r,e,t,H)},I=function(H){var $;($=r.onDayTouchEnd)===null||$===void 0||$.call(r,e,t,H)},T=function(H){var $;($=r.onDayTouchMove)===null||$===void 0||$.call(r,e,t,H)},R=function(H){var $;($=r.onDayTouchStart)===null||$===void 0||$.call(r,e,t,H)},L=function(H){var $;($=r.onDayKeyUp)===null||$===void 0||$.call(r,e,t,H)},F=function(H){var $;switch(H.key){case"ArrowLeft":H.preventDefault(),H.stopPropagation(),r.dir==="rtl"?l():c();break;case"ArrowRight":H.preventDefault(),H.stopPropagation(),r.dir==="rtl"?c():l();break;case"ArrowDown":H.preventDefault(),H.stopPropagation(),u();break;case"ArrowUp":H.preventDefault(),H.stopPropagation(),d();break;case"PageUp":H.preventDefault(),H.stopPropagation(),H.shiftKey?b():h();break;case"PageDown":H.preventDefault(),H.stopPropagation(),H.shiftKey?y():g();break;case"Home":H.preventDefault(),H.stopPropagation(),v();break;case"End":H.preventDefault(),H.stopPropagation(),k();break}($=r.onDayKeyDown)===null||$===void 0||$.call(r,e,t,H)},V={onClick:N,onFocus:w,onBlur:E,onKeyDown:F,onKeyUp:L,onMouseEnter:C,onMouseLeave:O,onPointerEnter:D,onPointerLeave:A,onTouchCancel:M,onTouchEnd:I,onTouchMove:T,onTouchStart:R};return V}function Qxe(){var e=Dr(),t=nR(),r=NE(),n=SE(),a=Ib(e)?t.selected:rm(e)?r.selected:nm(e)?n.selected:void 0;return a}function eve(e){return Object.values(Ga).includes(e)}function tve(e,t){var r=[e.classNames.day];return Object.keys(t).forEach(function(n){var a=e.modifiersClassNames[n];if(a)r.push(a);else if(eve(n)){var o=e.classNames["day_".concat(n)];o&&r.push(o)}}),r}function rve(e,t){var r=Mt({},e.styles.day);return Object.keys(t).forEach(function(n){var a;r=Mt(Mt({},r),(a=e.modifiersStyles)===null||a===void 0?void 0:a[n])}),r}function nve(e,t,r){var n,a,o,s=Dr(),l=OE(),c=Xxe(e,t),u=Jxe(e,c),d=Qxe(),f=!!(s.onDayClick||s.mode!=="default");m.useEffect(function(){var C;c.outside||l.focusedDay&&f&&Kn(l.focusedDay,e)&&((C=r.current)===null||C===void 0||C.focus())},[l.focusedDay,e,r,f,c.outside]);var p=tve(s,c).join(" "),h=rve(s,c),g=!!(c.outside&&!s.showOutsideDays||c.hidden),b=(o=(a=s.components)===null||a===void 0?void 0:a.DayContent)!==null&&o!==void 0?o:Nxe,y=i.jsx(b,{date:e,displayMonth:t,activeModifiers:c}),v={style:h,className:p,children:y,role:"gridcell"},k=l.focusTarget&&Kn(l.focusTarget,e)&&!c.outside,N=l.focusedDay&&Kn(l.focusedDay,e),w=Mt(Mt(Mt({},v),(n={disabled:c.disabled,role:"gridcell"},n["aria-selected"]=c.selected,n.tabIndex=N||k?0:-1,n)),u),E={isButton:f,isHidden:g,activeModifiers:c,selectedDays:d,buttonProps:w,divProps:v};return E}function ave(e){var t=m.useRef(null),r=nve(e.date,e.displayMonth,t);return r.isHidden?i.jsx("div",{role:"gridcell"}):r.isButton?i.jsx(Vh,Mt({name:"day",ref:t},r.buttonProps)):i.jsx("div",Mt({},r.divProps))}function ove(e){var t=e.number,r=e.dates,n=Dr(),a=n.onWeekNumberClick,o=n.styles,s=n.classNames,l=n.locale,c=n.labels.labelWeekNumber,u=n.formatters.formatWeekNumber,d=u(Number(t),{locale:l});if(!a)return i.jsx("span",{className:s.weeknumber,style:o.weeknumber,children:d});var f=c(Number(t),{locale:l}),p=function(h){a(t,r,h)};return i.jsx(Vh,{name:"week-number","aria-label":f,className:s.weeknumber,style:o.weeknumber,onClick:p,children:d})}function sve(e){var t,r,n=Dr(),a=n.styles,o=n.classNames,s=n.showWeekNumber,l=n.components,c=(t=l?.Day)!==null&&t!==void 0?t:ave,u=(r=l?.WeekNumber)!==null&&r!==void 0?r:ove,d;return s&&(d=i.jsx("td",{className:o.cell,style:a.cell,children:i.jsx(u,{number:e.weekNumber,dates:e.dates})})),i.jsxs("tr",{className:o.row,style:a.row,children:[d,e.dates.map(function(f){return i.jsx("td",{className:o.cell,style:a.cell,role:"presentation",children:i.jsx(c,{displayMonth:e.displayMonth,date:f})},xpe(f))})]})}function N7(e,t,r){for(var n=r?.ISOWeek?qD(t):L1(t,r),a=r?.ISOWeek?fl(e):Eo(e,r),o=uo(n,a),s=[],l=0;l<=o;l++)s.push(Ln(a,l));var c=s.reduce(function(u,d){var f=r?.ISOWeek?VD(d):KD(d,r),p=u.find(function(h){return h.weekNumber===f});return p?(p.dates.push(d),u):(u.push({weekNumber:f,dates:[d]}),u)},[]);return c}function ive(e,t){var r=N7(Cn(e),I1(e),t);if(t?.useFixedWeeks){var n=kpe(e,t);if(n<6){var a=r[r.length-1],o=a.dates[a.dates.length-1],s=fj(o,6-n),l=N7(fj(o,1),s,t);r.push.apply(r,l)}}return r}function lve(e){var t,r,n,a=Dr(),o=a.locale,s=a.classNames,l=a.styles,c=a.hideHead,u=a.fixedWeeks,d=a.components,f=a.weekStartsOn,p=a.firstWeekContainsDate,h=a.ISOWeek,g=ive(e.displayMonth,{useFixedWeeks:!!u,ISOWeek:h,locale:o,weekStartsOn:f,firstWeekContainsDate:p}),b=(t=d?.Head)!==null&&t!==void 0?t:jxe,y=(r=d?.Row)!==null&&r!==void 0?r:sve,v=(n=d?.Footer)!==null&&n!==void 0?n:vxe;return i.jsxs("table",{id:e.id,className:s.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&i.jsx(b,{}),i.jsx("tbody",{className:s.tbody,style:l.tbody,children:g.map(function(k){return i.jsx(y,{displayMonth:e.displayMonth,dates:k.dates,weekNumber:k.weekNumber},k.weekNumber)})}),i.jsx(v,{displayMonth:e.displayMonth})]})}function cve(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var uve=cve()?m.useLayoutEffect:m.useEffect,Yk=!1,dve=0;function E7(){return"react-day-picker-".concat(++dve)}function fve(e){var t,r=e??(Yk?E7():null),n=m.useState(r),a=n[0],o=n[1];return uve(function(){a===null&&o(E7())},[]),m.useEffect(function(){Yk===!1&&(Yk=!0)},[]),(t=e??a)!==null&&t!==void 0?t:void 0}function mve(e){var t,r,n=Dr(),a=n.dir,o=n.classNames,s=n.styles,l=n.components,c=Nu().displayMonths,u=fve(n.id?"".concat(n.id,"-").concat(e.displayIndex):void 0),d=n.id?"".concat(n.id,"-grid-").concat(e.displayIndex):void 0,f=[o.month],p=s.month,h=e.displayIndex===0,g=e.displayIndex===c.length-1,b=!h&&!g;a==="rtl"&&(t=[h,g],g=t[0],h=t[1]),h&&(f.push(o.caption_start),p=Mt(Mt({},p),s.caption_start)),g&&(f.push(o.caption_end),p=Mt(Mt({},p),s.caption_end)),b&&(f.push(o.caption_between),p=Mt(Mt({},p),s.caption_between));var y=(r=l?.Caption)!==null&&r!==void 0?r:xxe;return i.jsxs("div",{className:f.join(" "),style:p,children:[i.jsx(y,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),i.jsx(lve,{id:d,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function pve(e){var t=Dr(),r=t.classNames,n=t.styles;return i.jsx("div",{className:r.months,style:n.months,children:e.children})}function hve(e){var t,r,n=e.initialProps,a=Dr(),o=OE(),s=Nu(),l=m.useState(!1),c=l[0],u=l[1];m.useEffect(function(){a.initialFocus&&o.focusTarget&&(c||(o.focus(o.focusTarget),u(!0)))},[a.initialFocus,c,o.focus,o.focusTarget,o]);var d=[a.classNames.root,a.className];a.numberOfMonths>1&&d.push(a.classNames.multiple_months),a.showWeekNumber&&d.push(a.classNames.with_weeknumber);var f=Mt(Mt({},a.styles.root),a.style),p=Object.keys(n).filter(function(g){return g.startsWith("data-")}).reduce(function(g,b){var y;return Mt(Mt({},g),(y={},y[b]=n[b],y))},{}),h=(r=(t=n.components)===null||t===void 0?void 0:t.Months)!==null&&r!==void 0?r:pve;return i.jsx("div",Mt({className:d.join(" "),style:f,dir:a.dir,id:a.id,nonce:n.nonce,title:n.title,lang:n.lang},p,{children:i.jsx(h,{children:s.displayMonths.map(function(g,b){return i.jsx(mve,{displayIndex:b,displayMonth:g},b)})})}))}function gve(e){var t=e.children,r=Bye(e,["children"]);return i.jsx(oxe,{initialProps:r,children:i.jsx(hxe,{children:i.jsx(Gxe,{initialProps:r,children:i.jsx(Exe,{initialProps:r,children:i.jsx(Oxe,{initialProps:r,children:i.jsx(Lxe,{children:i.jsx(Yxe,{children:t})})})})})})})}function bve(e){return i.jsx(gve,Mt({},e,{children:i.jsx(hve,{initialProps:e})}))}const S7=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z"}))},C7=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z"}))},yve=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M4.83582 12L11.0429 18.2071L12.4571 16.7929L7.66424 12L12.4571 7.20712L11.0429 5.79291L4.83582 12ZM10.4857 12L16.6928 18.2071L18.107 16.7929L13.3141 12L18.107 7.20712L16.6928 5.79291L10.4857 12Z"}))},xve=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M19.1642 12L12.9571 5.79291L11.5429 7.20712L16.3358 12L11.5429 16.7929L12.9571 18.2071L19.1642 12ZM13.5143 12L7.30722 5.79291L5.89301 7.20712L10.6859 12L5.89301 16.7929L7.30722 18.2071L13.5143 12Z"}))},gt=x.forwardRef((e,t)=>{const{color:r,className:n,children:a}=e;return x.createElement("p",{ref:t,className:J("text-tremor-default",r?He(r,We.text).textColor:J("text-tremor-content","dark:text-dark-tremor-content"),n)},a)});gt.displayName="Text";const Ym=e=>{var{onClick:t,icon:r}=e,n=Be(e,["onClick","icon"]);const a=r;return x.createElement("button",Object.assign({type:"button",className:J("flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle select-none dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content")},n),x.createElement(FD,{onClick:t,icon:a,variant:"simple",color:"slate",size:"sm"}))};function AE(e){var{mode:t,defaultMonth:r,selected:n,onSelect:a,locale:o,disabled:s,enableYearNavigation:l,classNames:c,weekStartsOn:u=0}=e,d=Be(e,["mode","defaultMonth","selected","onSelect","locale","disabled","enableYearNavigation","classNames","weekStartsOn"]);return x.createElement(bve,Object.assign({showOutsideDays:!0,mode:t,defaultMonth:r,selected:n,onSelect:a,locale:o,disabled:s,weekStartsOn:u,classNames:Object.assign({months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-2 relative items-center",caption_label:"text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium",nav:"space-x-1 flex items-center",nav_button:"flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content",nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"w-9 font-normal text-center text-tremor-content-subtle dark:text-dark-tremor-content-subtle",row:"flex w-full mt-0.5",cell:"text-center p-0 relative focus-within:relative text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",day:"h-9 w-9 p-0 hover:bg-tremor-background-subtle dark:hover:bg-dark-tremor-background-subtle outline-tremor-brand dark:outline-dark-tremor-brand rounded-tremor-default",day_today:"font-bold",day_selected:"aria-selected:bg-tremor-background-emphasis aria-selected:text-tremor-content-inverted dark:aria-selected:bg-dark-tremor-background-emphasis dark:aria-selected:text-dark-tremor-content-inverted ",day_disabled:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle disabled:hover:bg-transparent",day_outside:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle"},c),components:{IconLeft:f=>{var p=Be(f,[]);return x.createElement(S7,Object.assign({className:"h-4 w-4"},p))},IconRight:f=>{var p=Be(f,[]);return x.createElement(C7,Object.assign({className:"h-4 w-4"},p))},Caption:f=>{var p=Be(f,[]);const{goToMonth:h,nextMonth:g,previousMonth:b,currentMonth:y}=Nu();return x.createElement("div",{className:"flex justify-between items-center"},x.createElement("div",{className:"flex items-center space-x-1"},l&&x.createElement(Ym,{onClick:()=>y&&h(mj(y,-1)),icon:yve}),x.createElement(Ym,{onClick:()=>b&&h(b),icon:S7})),x.createElement(gt,{className:"text-tremor-default tabular-nums capitalize text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium"},Vn(p.displayMonth,"LLLL yyy",{locale:o})),x.createElement("div",{className:"flex items-center space-x-1"},x.createElement(Ym,{onClick:()=>g&&h(g),icon:C7}),l&&x.createElement(Ym,{onClick:()=>y&&h(mj(y,1)),icon:xve})))}}},d))}AE.displayName="DateRangePicker";const vve=kt("DatePicker"),si=(e,t)=>{const r=t!==void 0,[n,a]=m.useState(e);return[r?t:n,o=>{r||a(o)}]},O7=kt("DateRangePicker"),kve=(e,t,r,n)=>{var a;if(r&&(e=(a=n.get(r))===null||a===void 0?void 0:a.from),e)return So(e&&!t?e:zD([e,t]))},wve=(e,t,r,n)=>{var a,o;if(r&&(e=So((o=(a=n.get(r))===null||a===void 0?void 0:a.to)!==null&&o!==void 0?o:Ls())),e)return So(e&&!t?e:UD([e,t]))},Xk=[{value:"tdy",text:"Today",from:Ls()},{value:"w",text:"Last 7 days",from:r7(Ls(),{days:7})},{value:"t",text:"Last 30 days",from:r7(Ls(),{days:30})},{value:"m",text:"Month to Date",from:Cn(Ls())},{value:"y",text:"Year to Date",from:D1(Ls())}],aR=(e,t,r,n)=>{const a=r?.code||"en-US";if(!e&&!t)return"";if(e&&!t){if(n)return Vn(e,n);const o={year:"numeric",month:"short",day:"numeric"};return e.toLocaleDateString(a,o)}if(e&&t){if(wpe(e,t)){if(n)return Vn(e,n);const o={year:"numeric",month:"short",day:"numeric"};return e.toLocaleDateString(a,o)}if(e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()){if(n)return`${Vn(e,n)} - ${Vn(t,n)}`;const o={month:"short",day:"numeric"};return`${e.toLocaleDateString(a,o)} -
116
- ${t.getDate()}, ${t.getFullYear()}`}{if(n)return`${Vn(e,n)} - ${Vn(t,n)}`;const o={year:"numeric",month:"short",day:"numeric"};return`${e.toLocaleDateString(a,o)} -
117
- ${t.toLocaleDateString(a,o)}`}}return""},jf=e=>["string","number"].includes(typeof e)?e:e instanceof Array?e.map(jf).join(""):typeof e=="object"&&e?jf(e.props.children):void 0;function ME(e){const t=new Map;return x.Children.map(e,r=>{var n;t.set(r.props.value,(n=jf(r))!==null&&n!==void 0?n:r.props.value)}),t}function vj(e,t){return x.Children.map(t,r=>{var n;if(((n=jf(r))!==null&&n!==void 0?n:r.props.value).toLowerCase().includes(e.toLowerCase()))return r})}const ii=(e,t,r=!1)=>J(t?"bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle":"bg-tremor-background dark:bg-dark-tremor-background",!t&&"hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted",e?"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis":"text-tremor-content dark:text-dark-tremor-content",t&&"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",r&&"text-red-500 placeholder:text-red-500 dark:text-red-500 dark:placeholder:text-red-500",r?"border-red-500 dark:border-red-500":"border-tremor-border dark:border-dark-tremor-border");function ml(e){return e!=null&&e!==""}const jve=Ls(),Nve=x.forwardRef((e,t)=>{var r;const{value:n,defaultValue:a,onValueChange:o,minDate:s,maxDate:l,placeholder:c="Select date",disabled:u=!1,locale:d=cb,enableClear:f=!0,displayFormat:p,className:h,enableYearNavigation:g=!1,weekStartsOn:b=0,disabledDates:y}=e,v=Be(e,["value","defaultValue","onValueChange","minDate","maxDate","placeholder","disabled","locale","enableClear","displayFormat","className","enableYearNavigation","weekStartsOn","disabledDates"]),[k,N]=si(a,n),w=m.useMemo(()=>{const D=[];return s&&D.push({before:s}),l&&D.push({after:l}),[...D,...y??[]]},[s,l,y]),E=k?aR(k,void 0,d,p):c,C=Cn((r=k??l)!==null&&r!==void 0?r:jve),O=f&&!u;return x.createElement(qL,Object.assign({ref:t,as:"div",className:J("relative w-full min-w-[10rem] text-tremor-default","focus:ring-2 focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted",h)},v),x.createElement(bE,{disabled:u,className:J("w-full outline-none text-left whitespace-nowrap truncate focus:ring-2 transition duration-100 rounded-tremor-default flex flex-nowrap border pl-3 py-2","border-tremor-border shadow-tremor-input text-tremor-content-emphasis focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",O?"pr-8":"pr-4",ii(ml(k),u))},x.createElement(KL,{className:J(vve("calendarIcon"),"flex-none shrink-0 h-5 w-5 mr-2 -ml-0.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle"),"aria-hidden":"true"}),x.createElement("p",{className:"truncate"},E)),O&&k?x.createElement("button",{type:"button",className:J("absolute outline-none inset-y-0 right-0 flex items-center transition duration-100 mr-4"),onClick:D=>{D.preventDefault(),o?.(void 0),N(void 0)}},x.createElement(tm,{className:J("flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,x.createElement(oi,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},x.createElement(yE,{anchor:"bottom start",className:J("z-10 min-w-min divide-y overflow-y-auto outline-none rounded-tremor-default p-3 border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},({close:D})=>x.createElement(AE,{showOutsideDays:!0,mode:"single",defaultMonth:C,selected:k,weekStartsOn:b,onSelect:A=>{o?.(A),N(A),D()},locale:d,disabled:w,enableYearNavigation:g}))))});Nve.displayName="DatePicker";const TE=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))},Gk=kt("Select"),_E=x.forwardRef((e,t)=>{const{defaultValue:r="",value:n,onValueChange:a,placeholder:o="Select...",disabled:s=!1,icon:l,enableClear:c=!1,required:u,children:d,name:f,error:p=!1,errorMessage:h,className:g,id:b}=e,y=Be(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),v=m.useRef(null),k=m.Children.toArray(d),[N,w]=si(r,n),E=l,C=m.useMemo(()=>{const O=x.Children.toArray(d).filter(m.isValidElement);return ME(O)},[d]);return x.createElement("div",{className:J("w-full min-w-[10rem] text-tremor-default",g)},x.createElement("div",{className:"relative"},x.createElement("select",{title:"select-hidden",required:u,className:J("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:N,onChange:O=>{O.preventDefault()},name:f,disabled:s,id:b,onFocus:()=>{const O=v.current;O&&O.focus()}},x.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},o),k.map(O=>{const D=O.props.value,A=O.props.children;return x.createElement("option",{className:"hidden",key:D,value:D},A)})),x.createElement(mE,Object.assign({as:"div",ref:t,defaultValue:N,value:N,onChange:O=>{a?.(O),w(O)},disabled:s,id:b},y),({value:O})=>{var D;return x.createElement(x.Fragment,null,x.createElement(Ob,{ref:v,className:J("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",E?"pl-10":"pl-3",ii(ml(O),s,p))},E&&x.createElement("span",{className:J("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},x.createElement(E,{className:J(Gk("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),x.createElement("span",{className:"w-[90%] block truncate"},O&&(D=C.get(O))!==null&&D!==void 0?D:o),x.createElement("span",{className:J("absolute inset-y-0 right-0 flex items-center mr-3")},x.createElement(TE,{className:J(Gk("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),c&&N?x.createElement("button",{type:"button",className:J("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:A=>{A.preventDefault(),w(""),a?.("")}},x.createElement(tm,{className:J(Gk("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,x.createElement(oi,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},x.createElement(Pb,{anchor:"bottom start",className:J("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},d)))})),p&&h?x.createElement("p",{className:J("errorMessage","text-sm text-rose-500 mt-1")},h):null)});_E.displayName="Select";const P7=kt("SelectItem"),qs=x.forwardRef((e,t)=>{const{value:r,icon:n,className:a,children:o}=e,s=Be(e,["value","icon","className","children"]),l=n;return x.createElement(fE,Object.assign({className:J(P7("root"),"flex justify-start items-center cursor-default text-tremor-default px-2.5 py-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[selected]:text-tremor-content-strong data-[selected]:bg-tremor-background-muted text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[selected]:text-dark-tremor-content-strong dark:data-[selected]:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",a),ref:t,key:r,value:r},s),l&&x.createElement(l,{className:J(P7("icon"),"flex-none w-5 h-5 mr-1.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}),x.createElement("span",{className:"whitespace-nowrap truncate"},o??r))});qs.displayName="SelectItem";const Zk=Ls(),Eve=x.forwardRef((e,t)=>{var r,n;const{value:a,defaultValue:o,onValueChange:s,enableSelect:l=!0,minDate:c,maxDate:u,placeholder:d="Select range",selectPlaceholder:f="Select range",disabled:p=!1,locale:h=cb,enableClear:g=!0,displayFormat:b,children:y,className:v,enableYearNavigation:k=!1,weekStartsOn:N=0,disabledDates:w}=e,E=Be(e,["value","defaultValue","onValueChange","enableSelect","minDate","maxDate","placeholder","selectPlaceholder","disabled","locale","enableClear","displayFormat","children","className","enableYearNavigation","weekStartsOn","disabledDates"]),[C,O]=si(o,a),[D,A]=m.useState(!1),[M,I]=m.useState(!1),T=m.useMemo(()=>{const U=[];return c&&U.push({before:c}),u&&U.push({after:u}),[...U,...w??[]]},[c,u,w]),R=m.useMemo(()=>{const U=new Map;return y?x.Children.forEach(y,X=>{var Y;U.set(X.props.value,{text:(Y=jf(X))!==null&&Y!==void 0?Y:X.props.value,from:X.props.from,to:X.props.to})}):Xk.forEach(X=>{U.set(X.value,{text:X.text,from:X.from,to:Zk})}),U},[y]),L=m.useMemo(()=>{if(y)return ME(y);const U=new Map;return Xk.forEach(X=>U.set(X.value,X.text)),U},[y]),F=C?.selectValue||"",V=kve(C?.from,c,F,R),H=wve(C?.to,u,F,R),$=V||H?aR(V,H,h,b):d,z=Cn((n=(r=H??V)!==null&&r!==void 0?r:u)!==null&&n!==void 0?n:Zk),W=g&&!p;return x.createElement("div",Object.assign({ref:t,className:J("w-full min-w-[10rem] relative flex justify-between text-tremor-default max-w-sm shadow-tremor-input dark:shadow-dark-tremor-input rounded-tremor-default",v)},E),x.createElement(qL,{as:"div",className:J("w-full",l?"rounded-l-tremor-default":"rounded-tremor-default",D&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10")},x.createElement("div",{className:"relative w-full"},x.createElement(bE,{onFocus:()=>A(!0),onBlur:()=>A(!1),disabled:p,className:J("w-full outline-none text-left whitespace-nowrap truncate focus:ring-2 transition duration-100 rounded-l-tremor-default flex flex-nowrap border pl-3 py-2","rounded-l-tremor-default border-tremor-border text-tremor-content-emphasis focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",l?"rounded-l-tremor-default":"rounded-tremor-default",W?"pr-8":"pr-4",ii(ml(V||H),p))},x.createElement(KL,{className:J(O7("calendarIcon"),"flex-none shrink-0 h-5 w-5 -ml-0.5 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle"),"aria-hidden":"true"}),x.createElement("p",{className:"truncate"},$)),W&&V?x.createElement("button",{type:"button",className:J("absolute outline-none inset-y-0 right-0 flex items-center transition duration-100 mr-4"),onClick:U=>{U.preventDefault(),s?.({}),O({})}},x.createElement(tm,{className:J(O7("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null),x.createElement(oi,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},x.createElement(yE,{anchor:"bottom start",focus:!0,className:J("min-w-min divide-y overflow-y-auto outline-none rounded-tremor-default p-3 border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},x.createElement(AE,Object.assign({mode:"range",showOutsideDays:!0,defaultMonth:z,selected:{from:V,to:H},onSelect:U=>{s?.({from:U?.from,to:U?.to}),O({from:U?.from,to:U?.to})},locale:h,disabled:T,enableYearNavigation:k,classNames:{day_range_middle:J("!rounded-none aria-selected:!bg-tremor-background-subtle aria-selected:dark:!bg-dark-tremor-background-subtle aria-selected:!text-tremor-content aria-selected:dark:!bg-dark-tremor-background-subtle"),day_range_start:"rounded-r-none rounded-l-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted",day_range_end:"rounded-l-none rounded-r-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted"},weekStartsOn:N},e))))),l&&x.createElement(mE,{as:"div",className:J("w-48 -ml-px rounded-r-tremor-default",M&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10"),value:F,onChange:U=>{const{from:X,to:Y}=R.get(U),ae=Y??Zk;s?.({from:X,to:ae,selectValue:U}),O({from:X,to:ae,selectValue:U})},disabled:p},({value:U})=>{var X;return x.createElement(x.Fragment,null,x.createElement(Ob,{onFocus:()=>I(!0),onBlur:()=>I(!1),className:J("w-full outline-none text-left whitespace-nowrap truncate rounded-r-tremor-default transition duration-100 border px-4 py-2","border-tremor-border text-tremor-content-emphasis focus:border-tremor-brand-subtle","dark:border-dark-tremor-border dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle",ii(ml(U),p))},U&&(X=L.get(U))!==null&&X!==void 0?X:f),x.createElement(oi,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},x.createElement(Pb,{anchor:"bottom end",className:J("[--anchor-gap:4px] divide-y overflow-y-auto outline-none border min-w-44","shadow-tremor-dropdown bg-tremor-background border-tremor-border divide-tremor-border rounded-tremor-default","dark:shadow-dark-tremor-dropdown dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border")},y??Xk.map(Y=>x.createElement(qs,{key:Y.value,value:Y.value},Y.text)))))}))});Eve.displayName="DateRangePicker";const Sve=x.forwardRef((e,t)=>{const{value:r,className:n,children:a}=e,o=Be(e,["value","className","children"]);return x.createElement(qs,Object.assign({ref:t,className:n,value:r},o),a??r)});Sve.displayName="DateRangePickerItem";const oR=m.createContext(Qe.Blue),sR=m.createContext(0),Pd=m.createContext(void 0),Db=m.createContext({selectedValue:void 0,handleValueChange:void 0}),Cve=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z"}))},Ove=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t),x.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),x.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))},Xm=kt("MultiSelect"),Pve=x.forwardRef((e,t)=>{const{defaultValue:r=[],value:n,onValueChange:a,placeholder:o="Select...",placeholderSearch:s="Search",disabled:l=!1,icon:c,children:u,className:d,required:f,name:p,error:h=!1,errorMessage:g,id:b}=e,y=Be(e,["defaultValue","value","onValueChange","placeholder","placeholderSearch","disabled","icon","children","className","required","name","error","errorMessage","id"]),v=m.useRef(null),k=c,[N,w]=si(r,n),{reactElementChildren:E,optionsAvailable:C}=m.useMemo(()=>{const T=x.Children.toArray(u).filter(m.isValidElement);return{reactElementChildren:T,optionsAvailable:vj("",T)}},[u]),[O,D]=m.useState(""),A=(N??[]).length>0,M=m.useMemo(()=>O?vj(O,E):C,[O,E,C]),I=()=>{D("")};return x.createElement("div",{className:J("w-full min-w-[10rem] text-tremor-default",d)},x.createElement("div",{className:"relative"},x.createElement("select",{title:"multi-select-hidden",required:f,className:J("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:N,onChange:T=>{T.preventDefault()},name:p,disabled:l,multiple:!0,id:b,onFocus:()=>{const T=v.current;T&&T.focus()}},x.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},o),M.map(T=>{const R=T.props.value,L=T.props.children;return x.createElement("option",{className:"hidden",key:R,value:R},L)})),x.createElement(mE,Object.assign({as:"div",ref:t,defaultValue:N,value:N,onChange:T=>{a?.(T),w(T)},disabled:l,id:b,multiple:!0},y),({value:T})=>x.createElement(x.Fragment,null,x.createElement(Ob,{className:J("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-1.5","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",k?"pl-11 -ml-0.5":"pl-3",ii(T.length>0,l,h)),ref:v},k&&x.createElement("span",{className:J("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},x.createElement(k,{className:J(Xm("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),x.createElement("div",{className:"h-6 flex items-center"},T.length>0?x.createElement("div",{className:"flex flex-nowrap overflow-x-scroll [&::-webkit-scrollbar]:hidden [scrollbar-width:none] gap-x-1 mr-5 -ml-1.5 relative"},C.filter(R=>T.includes(R.props.value)).map((R,L)=>{var F;return x.createElement("div",{key:L,className:J("max-w-[100px] lg:max-w-[200px] flex justify-center items-center pl-2 pr-1.5 py-1 font-medium","rounded-tremor-small","bg-tremor-background-muted dark:bg-dark-tremor-background-muted","bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle","text-tremor-content-default dark:text-dark-tremor-content-default","text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis")},x.createElement("div",{className:"text-xs truncate "},(F=R.props.children)!==null&&F!==void 0?F:R.props.value),x.createElement("div",{onClick:V=>{V.preventDefault();const H=T.filter($=>$!==R.props.value);a?.(H),w(H)}},x.createElement(Ove,{className:J(Xm("clearIconItem"),"cursor-pointer rounded-tremor-full w-3.5 h-3.5 ml-2","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle dark:hover:text-tremor-content")})))})):x.createElement("span",null,o)),x.createElement("span",{className:J("absolute inset-y-0 right-0 flex items-center mr-2.5")},x.createElement(TE,{className:J(Xm("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),A&&!l?x.createElement("button",{type:"button",className:J("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:R=>{R.preventDefault(),w([]),a?.([])}},x.createElement(tm,{className:J(Xm("clearIconAllItems"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,x.createElement(oi,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},x.createElement(Pb,{anchor:"bottom start",className:J("z-10 divide-y w-[var(--button-width)] overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},x.createElement("div",{className:J("flex items-center w-full px-2.5","bg-tremor-background-muted","dark:bg-dark-tremor-background-muted")},x.createElement("span",null,x.createElement(Cve,{className:J("flex-none w-4 h-4 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),x.createElement("input",{name:"search",type:"input",autoComplete:"off",placeholder:s,className:J("w-full focus:outline-none focus:ring-none bg-transparent text-tremor-default py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-subtle"),onKeyDown:R=>{R.code==="Space"&&R.target.value!==""&&R.stopPropagation()},onChange:R=>D(R.target.value),value:O})),x.createElement(Db.Provider,Object.assign({},{onBlur:{handleResetSearch:I}},{value:{selectedValue:T}}),M)))))),h&&g?x.createElement("p",{className:J("errorMessage","text-sm text-rose-500 mt-1")},g):null)});Pve.displayName="MultiSelect";const A7=kt("MultiSelectItem"),Ave=x.forwardRef((e,t)=>{const{value:r,className:n,children:a}=e,o=Be(e,["value","className","children"]),{selectedValue:s}=m.useContext(Db),l=pfe(r,s);return x.createElement(fE,Object.assign({className:J(A7("root"),"flex justify-start items-center cursor-default text-tremor-default p-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[select]ed:text-tremor-content-strong text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[select]ed:text-dark-tremor-content-strong dark:data-[select]ed:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",n),ref:t,key:r,value:r},o),x.createElement("input",{type:"checkbox",className:J(A7("checkbox"),"flex-none focus:ring-none focus:outline-none cursor-pointer mr-2.5","accent-tremor-brand","dark:accent-dark-tremor-brand"),checked:l,readOnly:!0}),x.createElement("span",{className:"whitespace-nowrap truncate"},a??r))});Ave.displayName="MultiSelectItem";const Mve=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),x.createElement("path",{d:"M12 4v16m8-8H4"}))},Tve=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),x.createElement("path",{d:"M20 12H4"}))},_ve=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM11 15V17H13V15H11ZM11 7V13H13V7H11Z"}))},Ive=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12ZM12.0003 17C14.7617 17 17.0003 14.7614 17.0003 12C17.0003 9.23858 14.7617 7 12.0003 7C9.23884 7 7.00026 9.23858 7.00026 12C7.00026 14.7614 9.23884 17 12.0003 17ZM12.0003 15C10.3434 15 9.00026 13.6569 9.00026 12C9.00026 10.3431 10.3434 9 12.0003 9C13.6571 9 15.0003 10.3431 15.0003 12C15.0003 13.6569 13.6571 15 12.0003 15Z"}))},Dve=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457ZM14.7577 16.1718L13.2937 14.7078C12.902 14.8952 12.4634 15.0002 12.0003 15.0002C10.3434 15.0002 9.00026 13.657 9.00026 12.0002C9.00026 11.537 9.10522 11.0984 9.29263 10.7067L7.82866 9.24277C7.30514 10.0332 7.00026 10.9811 7.00026 12.0002C7.00026 14.7616 9.23884 17.0002 12.0003 17.0002C13.0193 17.0002 13.9672 16.6953 14.7577 16.1718ZM7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925L16.947 12.7327C16.9821 12.4936 17.0003 12.249 17.0003 12.0002C17.0003 9.23873 14.7617 7.00016 12.0003 7.00016C11.7514 7.00016 11.5068 7.01833 11.2677 7.05343L7.97446 3.76015Z"}))},IE=x.forwardRef((e,t)=>{const{value:r,defaultValue:n,type:a,placeholder:o="Type...",icon:s,error:l=!1,errorMessage:c,disabled:u=!1,stepper:d,makeInputClassName:f,className:p,onChange:h,onValueChange:g,autoFocus:b,pattern:y}=e,v=Be(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus","pattern"]),[k,N]=m.useState(b||!1),[w,E]=m.useState(!1),C=m.useCallback(()=>E(!w),[w,E]),O=s,D=m.useRef(null),A=ml(r||n);return x.useEffect(()=>{const M=()=>N(!0),I=()=>N(!1),T=D.current;return T&&(T.addEventListener("focus",M),T.addEventListener("blur",I),b&&T.focus()),()=>{T&&(T.removeEventListener("focus",M),T.removeEventListener("blur",I))}},[b]),x.createElement(x.Fragment,null,x.createElement("div",{className:J(f("root"),"relative w-full flex items-center min-w-[10rem] outline-none rounded-tremor-default transition duration-100 border","shadow-tremor-input","dark:shadow-dark-tremor-input",ii(A,u,l),k&&J("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),p)},O?x.createElement(O,{className:J(f("icon"),"shrink-0 h-5 w-5 mx-2.5 absolute left-0 flex items-center","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,x.createElement("input",Object.assign({ref:xs([D,t]),defaultValue:n,value:r,type:w?"text":a,className:J(f("input"),"w-full bg-transparent focus:outline-none focus:ring-0 border-none text-tremor-default rounded-tremor-default transition duration-100 py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",a==="password"?l?"pr-16":"pr-12":l?"pr-8":"pr-3",O?"pl-10":"pl-3",u?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content"),placeholder:o,disabled:u,"data-testid":"base-input",onChange:M=>{h?.(M),g?.(M.target.value)},pattern:y},v)),a!=="password"||u?null:x.createElement("button",{className:J(f("toggleButton"),"absolute inset-y-0 right-0 flex items-center px-2.5 rounded-lg"),type:"button",onClick:()=>C(),"aria-label":w?"Hide password":"Show Password"},w?x.createElement(Dve,{className:J("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0}):x.createElement(Ive,{className:J("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0})),l?x.createElement(_ve,{className:J(f("errorIcon"),"text-red-500 shrink-0 h-5 w-5 absolute right-0 flex items-center",a==="password"?"mr-10":a==="number"?d?"mr-20":"mr-3":"mx-2.5")}):null,d??null),l&&c?x.createElement("p",{className:J(f("errorMessage"),"text-sm text-red-500 mt-1")},c):null)});IE.displayName="BaseInput";const M7="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",T7="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",Lve=x.forwardRef((e,t)=>{const{onSubmit:r,enableStepper:n=!0,disabled:a,onValueChange:o,onChange:s}=e,l=Be(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),c=m.useRef(null),[u,d]=x.useState(!1),f=x.useCallback(()=>{d(!0)},[]),p=x.useCallback(()=>{d(!1)},[]),[h,g]=x.useState(!1),b=x.useCallback(()=>{g(!0)},[]),y=x.useCallback(()=>{g(!1)},[]);return x.createElement(IE,Object.assign({type:"number",ref:xs([c,t]),disabled:a,makeInputClassName:kt("NumberInput"),onKeyDown:v=>{var k;if(v.key==="Enter"&&!v.ctrlKey&&!v.altKey&&!v.shiftKey){const N=(k=c.current)===null||k===void 0?void 0:k.value;r?.(parseFloat(N??""))}v.key==="ArrowDown"&&f(),v.key==="ArrowUp"&&b()},onKeyUp:v=>{v.key==="ArrowDown"&&p(),v.key==="ArrowUp"&&y()},onChange:v=>{a||(o?.(parseFloat(v.target.value)),s?.(v))},stepper:n?x.createElement("div",{className:J("flex justify-center align-middle")},x.createElement("div",{tabIndex:-1,onClick:v=>v.preventDefault(),onMouseDown:v=>v.preventDefault(),onTouchStart:v=>{v.cancelable&&v.preventDefault()},onMouseUp:()=>{var v,k;a||((v=c.current)===null||v===void 0||v.stepDown(),(k=c.current)===null||k===void 0||k.dispatchEvent(new Event("input",{bubbles:!0})))},className:J(!a&&T7,M7,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},x.createElement(Tve,{"data-testid":"step-down",className:(u?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),x.createElement("div",{tabIndex:-1,onClick:v=>v.preventDefault(),onMouseDown:v=>v.preventDefault(),onTouchStart:v=>{v.cancelable&&v.preventDefault()},onMouseUp:()=>{var v,k;a||((v=c.current)===null||v===void 0||v.stepUp(),(k=c.current)===null||k===void 0||k.dispatchEvent(new Event("input",{bubbles:!0})))},className:J(!a&&T7,M7,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},x.createElement(Mve,{"data-testid":"step-up",className:(h?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},l))});Lve.displayName="NumberInput";const _7=kt("SearchSelect"),Rve=kt("SearchSelect"),Fve=x.forwardRef((e,t)=>{const{defaultValue:r="",searchValue:n,onSearchValueChange:a,value:o,onValueChange:s,placeholder:l="Select...",disabled:c=!1,icon:u,enableClear:d=!0,name:f,required:p,error:h=!1,errorMessage:g,children:b,className:y,id:v,autoComplete:k="off"}=e,N=Be(e,["defaultValue","searchValue","onSearchValueChange","value","onValueChange","placeholder","disabled","icon","enableClear","name","required","error","errorMessage","children","className","id","autoComplete"]),w=m.useRef(null),[E,C]=si("",n),[O,D]=si(r,o),A=u,{reactElementChildren:M,valueToNameMapping:I}=m.useMemo(()=>{const R=x.Children.toArray(b).filter(m.isValidElement);return{reactElementChildren:R,valueToNameMapping:ME(R)}},[b]),T=m.useMemo(()=>vj(E??"",M),[E,M]);return x.createElement("div",{className:J("w-full min-w-[10rem] text-tremor-default",y)},x.createElement("div",{className:"relative"},x.createElement("select",{title:"search-select-hidden",required:p,className:J("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:O,onChange:R=>{R.preventDefault()},name:f,disabled:c,id:v,onFocus:()=>{const R=w.current;R&&R.focus()}},x.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},l),T.map(R=>{const L=R.props.value,F=R.props.children;return x.createElement("option",{className:"hidden",key:L,value:L},F)})),x.createElement(wge,Object.assign({as:"div",ref:t,defaultValue:O,value:O,onChange:R=>{s?.(R),D(R)},disabled:c,id:v},N),({value:R})=>x.createElement(x.Fragment,null,x.createElement(SL,{className:"w-full"},A&&x.createElement("span",{className:J("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},x.createElement(A,{className:J(_7("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),x.createElement(CL,{ref:w,className:J("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 text-tremor-default pr-14 border py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",A?"pl-10":"pl-3",c?"placeholder:text-tremor-content-subtle dark:placeholder:text-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-tremor-content",ii(ml(R),c,h)),placeholder:l,onChange:L=>{a?.(L.target.value),C(L.target.value)},displayValue:L=>{var F;return(F=I.get(L))!==null&&F!==void 0?F:""},autoComplete:k}),x.createElement("div",{className:J("absolute inset-y-0 right-0 flex items-center pr-2.5")},x.createElement(TE,{className:J(_7("arrowDownIcon"),"flex-none h-5 w-5","!text-tremor-content-subtle","!dark:text-dark-tremor-content-subtle")}))),d&&O?x.createElement("button",{type:"button",className:J("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:L=>{L.preventDefault(),D(""),C(""),s?.(""),a?.("")}},x.createElement(tm,{className:J(Rve("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,T.length>0&&x.createElement(oi,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},x.createElement(OL,{anchor:"bottom start",className:J("z-10 divide-y w-[var(--button-width)] overflow-y-auto outline-none rounded-tremor-default text-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},T))))),h&&g?x.createElement("p",{className:J("errorMessage","text-sm text-rose-500 mt-1")},g):null)});Fve.displayName="SearchSelect";const I7=kt("SearchSelectItem"),$ve=x.forwardRef((e,t)=>{const{value:r,icon:n,className:a,children:o}=e,s=Be(e,["value","icon","className","children"]),l=n;return x.createElement(PL,Object.assign({className:J(I7("root"),"flex justify-start items-center cursor-default text-tremor-default p-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[selected]:text-tremor-content-strong data-[selected]:bg-tremor-background-muted text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[selected]:text-dark-tremor-content-strong dark:data-[selected]:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",a),ref:t,key:r,value:r},s),l&&x.createElement(l,{className:J(I7("icon"),"flex-none h-5 w-5 mr-3","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}),x.createElement("span",{className:"whitespace-nowrap truncate"},o??r))});$ve.displayName="SearchSelectItem";const Pi=kt("Switch"),Bve=x.forwardRef((e,t)=>{const{checked:r,defaultChecked:n=!1,onChange:a,color:o,name:s,error:l,errorMessage:c,disabled:u,required:d,tooltip:f,id:p}=e,h=Be(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g=(E=>({bgColor:E?He(E,We.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:E?He(E,We.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}))(o),[b,y]=si(n,r),[v,k]=m.useState(!1),{tooltipProps:N,getReferenceProps:w}=_a(300);return x.createElement("div",{className:"flex flex-row items-center justify-start"},x.createElement(va,Object.assign({text:f},N)),x.createElement("div",Object.assign({ref:xs([t,N.refs.setReference]),className:J(Pi("root"),"flex flex-row relative h-5")},h,w),x.createElement("input",{type:"checkbox",className:J(Pi("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:s,required:d,checked:b,onChange:E=>{E.preventDefault()}}),x.createElement(hye,{checked:b,onChange:E=>{y(E),a?.(E)},disabled:u,className:J(Pi("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>k(!0),onBlur:()=>k(!1),id:p},x.createElement("span",{className:J(Pi("sr-only"),"sr-only")},"Switch ",b?"on":"off"),x.createElement("span",{"aria-hidden":"true",className:J(Pi("background"),b?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),x.createElement("span",{"aria-hidden":"true",className:J(Pi("round"),b?J(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",v?J("ring-2",g.ringColor):"")}))),l&&c?x.createElement("p",{className:J(Pi("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});Bve.displayName="Switch";const Hve=kt("TabList"),iR=m.createContext("line"),zve={line:J("flex border-b space-x-4","border-tremor-border","dark:border-dark-tremor-border"),solid:J("inline-flex p-0.5 rounded-tremor-default space-x-1.5","bg-tremor-background-subtle","dark:bg-dark-tremor-background-subtle")},Gc=x.forwardRef((e,t)=>{const{color:r,variant:n="line",children:a,className:o}=e,s=Be(e,["color","variant","children","className"]);return x.createElement(_b.List,Object.assign({ref:t,className:J(Hve("root"),"justify-start overflow-x-clip",zve[n],o)},s),x.createElement(iR.Provider,{value:n},x.createElement(oR.Provider,{value:r},a)))});Gc.displayName="TabList";const D7=kt("Tab");function Uve(e,t){switch(e){case"line":return J("data-[selected]:border-b-2 hover:border-b-2 border-transparent transition duration-100 -mb-px px-2 py-2","hover:border-tremor-content hover:text-tremor-content-emphasis text-tremor-content","[&:not([data-selected])]:dark:hover:border-dark-tremor-content-emphasis [&:not([data-selected])]:dark:hover:text-dark-tremor-content-emphasis [&:not([data-selected])]:dark:text-dark-tremor-content",t?He(t,We.border).selectBorderColor:["data-[selected]:border-tremor-brand data-[selected]:text-tremor-brand","data-[selected]:dark:border-dark-tremor-brand data-[selected]:dark:text-dark-tremor-brand"]);case"solid":return J("border-transparent border rounded-tremor-small px-2.5 py-1","data-[selected]:border-tremor-border data-[selected]:bg-tremor-background data-[selected]:shadow-tremor-input [&:not([data-selected])]:hover:text-tremor-content-emphasis data-[selected]:text-tremor-brand [&:not([data-selected])]:text-tremor-content","dark:data-[selected]:border-dark-tremor-border dark:data-[selected]:bg-dark-tremor-background dark:data-[selected]:shadow-dark-tremor-input dark:[&:not([data-selected])]:hover:text-dark-tremor-content-emphasis dark:data-[selected]:text-dark-tremor-brand dark:[&:not([data-selected])]:text-dark-tremor-content",t?He(t,We.text).selectTextColor:"text-tremor-content dark:text-dark-tremor-content")}}const ca=x.forwardRef((e,t)=>{const{icon:r,className:n,children:a}=e,o=Be(e,["icon","className","children"]),s=m.useContext(iR),l=m.useContext(oR),c=r;return x.createElement(_b,Object.assign({ref:t,className:J(D7("root"),"flex whitespace-nowrap truncate max-w-xs outline-none data-focus-visible:ring text-tremor-default transition duration-100",Uve(s,l),n,l&&He(l,We.text).selectTextColor)},o),c?x.createElement(c,{className:J(D7("icon"),"flex-none h-5 w-5",a?"mr-2":"")}):null,a?x.createElement("span",null,a):null)});ca.displayName="Tab";const qve=kt("TabGroup"),Zc=x.forwardRef((e,t)=>{const{defaultIndex:r,index:n,onIndexChange:a,children:o,className:s}=e,l=Be(e,["defaultIndex","index","onIndexChange","children","className"]);return x.createElement(_b.Group,Object.assign({as:"div",ref:t,defaultIndex:r,selectedIndex:n,onChange:a,className:J(qve("root"),"w-full",s)},l),o)});Zc.displayName="TabGroup";const Vve=kt("TabPanel"),ua=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]),{selectedValue:o}=m.useContext(Db),s=o===m.useContext(sR);return x.createElement("div",Object.assign({ref:t,className:J(Vve("root"),"w-full mt-2",s?"":"hidden",n),"aria-selected":s?"true":"false"},a),r)});ua.displayName="TabPanel";const Wve=kt("TabPanels"),Jc=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement(_b.Panels,Object.assign({as:"div",ref:t,className:J(Wve("root"),"w-full",n)},a),({selectedIndex:o})=>x.createElement(Db.Provider,{value:{selectedValue:o}},x.Children.map(r,(s,l)=>x.createElement(sR.Provider,{value:l},s))))});Jc.displayName="TabPanels";const L7=kt("Textarea"),Kve=x.forwardRef((e,t)=>{const{value:r,defaultValue:n="",placeholder:a="Type...",error:o=!1,errorMessage:s,disabled:l=!1,className:c,onChange:u,onValueChange:d,autoHeight:f=!1}=e,p=Be(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[h,g]=si(n,r),b=m.useRef(null),y=ml(h);return m.useEffect(()=>{const v=b.current;if(f&&v){v.style.height="60px";const k=v.scrollHeight;v.style.height=k+"px"}},[f,b,h]),x.createElement(x.Fragment,null,x.createElement("textarea",Object.assign({ref:xs([b,t]),value:h,placeholder:a,disabled:l,className:J(L7("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",ii(y,l,o),l?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",c),"data-testid":"text-area",onChange:v=>{u?.(v),g(v.target.value),d?.(v.target.value)}},p)),o&&s?x.createElement("p",{className:J(L7("errorMessage"),"text-sm text-red-500 mt-1")},s):null)});Kve.displayName="Textarea";const Yve=kt("TextInput"),lR=x.forwardRef((e,t)=>{const{type:r="text"}=e,n=Be(e,["type"]);return x.createElement(IE,Object.assign({ref:t,type:r,makeInputClassName:Yve},n))});lR.displayName="TextInput";const Xve=kt("Accordion"),cR=m.createContext({isOpen:!1}),Gve=x.forwardRef((e,t)=>{var r;const{defaultOpen:n=!1,children:a,className:o}=e,s=Be(e,["defaultOpen","children","className"]),l=(r=m.useContext(Pd))!==null&&r!==void 0?r:J("rounded-tremor-default border");return x.createElement(uE,Object.assign({as:"div",ref:t,className:J(Xve("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",l,o),defaultOpen:n},s),({open:c})=>x.createElement(cR.Provider,{value:{isOpen:c}},a))});Gve.displayName="Accordion";const Zve=kt("AccordionBody"),Jve=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement(uE.Panel,Object.assign({ref:t,className:J(Zve("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",n)},a),r)});Jve.displayName="AccordionBody";const Qve=e=>{var t=Be(e,[]);return x.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),x.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))},Jk=kt("AccordionHeader"),e0e=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]),{isOpen:o}=m.useContext(cR);return x.createElement(uE.Button,Object.assign({ref:t,className:J(Jk("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",n)},a),x.createElement("div",{className:J(Jk("children"),"flex flex-1 text-inherit mr-4")},r),x.createElement("div",null,x.createElement(Qve,{className:J(Jk("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",o?"transition-all":"transition-all -rotate-180")})))});e0e.displayName="AccordionHeader";const t0e=kt("AccordionList"),r0e=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]),o=x.Children.count(r);return x.createElement("div",Object.assign({ref:t,className:J(t0e("root"),"rounded-tremor-default","shadow-tremor-card","dark:shadow-dark-tremor-card",n)},a),x.Children.map(r,(s,l)=>l===0?x.createElement(Pd.Provider,{value:J("rounded-t-tremor-default border")},x.cloneElement(s)):l===o-1?x.createElement(Pd.Provider,{value:J("rounded-b-tremor-default border-l border-r border-b")},x.cloneElement(s)):x.createElement(Pd.Provider,{value:J("border-l border-r border-b")},x.cloneElement(s))))});r0e.displayName="AccordionList";const n0e=kt("Card"),a0e=e=>{if(!e)return"";switch(e){case ic.Left:return"border-l-4";case MA.Top:return"border-t-4";case ic.Right:return"border-r-4";case MA.Bottom:return"border-b-4";default:return""}},Dt=x.forwardRef((e,t)=>{const{decoration:r="",decorationColor:n,children:a,className:o}=e,s=Be(e,["decoration","decorationColor","children","className"]);return x.createElement("div",Object.assign({ref:t,className:J(n0e("root"),"relative w-full text-left ring-1 rounded-tremor-default p-6","bg-tremor-background ring-tremor-ring shadow-tremor-card","dark:bg-dark-tremor-background dark:ring-dark-tremor-ring dark:shadow-dark-tremor-card",n?He(n,We.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",a0e(r),o)},s),a)});Dt.displayName="Card";const o0e=kt("Divider"),Po=x.forwardRef((e,t)=>{const{className:r,children:n}=e,a=Be(e,["className","children"]);return x.createElement("div",Object.assign({ref:t,className:J(o0e("root"),"w-full mx-auto my-6 flex justify-between gap-3 items-center text-tremor-default","text-tremor-content","dark:text-dark-tremor-content",r)},a),n?x.createElement(x.Fragment,null,x.createElement("div",{className:J("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}),x.createElement("div",{className:J("text-inherit whitespace-nowrap")},n),x.createElement("div",{className:J("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")})):x.createElement("div",{className:J("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}))});Po.displayName="Divider";const s0e=kt("Flex"),i0e={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"},l0e={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"},c0e={row:"flex-row",col:"flex-col","row-reverse":"flex-row-reverse","col-reverse":"flex-col-reverse"},Lb=x.forwardRef((e,t)=>{const{flexDirection:r="row",justifyContent:n="between",alignItems:a="center",children:o,className:s}=e,l=Be(e,["flexDirection","justifyContent","alignItems","children","className"]);return x.createElement("div",Object.assign({ref:t,className:J(s0e("root"),"flex w-full",c0e[r],i0e[n],l0e[a],s)},l),o)});Lb.displayName="Flex";const u0e={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},d0e={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},f0e={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},m0e={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},p0e={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},h0e={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},g0e={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},b0e={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"},y0e=kt("Col"),x0e=x.forwardRef((e,t)=>{const{numColSpan:r=1,numColSpanSm:n,numColSpanMd:a,numColSpanLg:o,children:s,className:l}=e,c=Be(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),u=(d,f)=>d&&Object.keys(f).includes(String(d))?f[d]:"";return x.createElement("div",Object.assign({ref:t,className:J(y0e("root"),(()=>{const d=u(r,p0e),f=u(n,h0e),p=u(a,g0e),h=u(o,b0e);return J(d,f,p,h)})(),l)},c),s)});x0e.displayName="Col";const v0e=kt("Grid"),Gm=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",Rb=x.forwardRef((e,t)=>{const{numItems:r=1,numItemsSm:n,numItemsMd:a,numItemsLg:o,children:s,className:l}=e,c=Be(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),u=Gm(r,u0e),d=Gm(n,d0e),f=Gm(a,f0e),p=Gm(o,m0e),h=J(u,d,f,p);return x.createElement("div",Object.assign({ref:t,className:J(v0e("root"),"grid",h,l)},c),s)});Rb.displayName="Grid";const k0e=kt("dialog"),w0e=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement(oi,{appear:!0,show:e.open},x.createElement(tbe,Object.assign({ref:t},a,{className:J(k0e("root"),"relative z-50",n)}),x.createElement(Qge,{transition:!0,className:"fixed bg-slate-950/30 dark:bg-slate-950/50 inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),x.createElement("div",{className:"fixed inset-0 overflow-y-auto w-screen"},x.createElement("div",{className:"flex min-h-full items-center justify-center p-4"},r))))});w0e.displayName="Dialog";const j0e=kt("dialog"),N0e=x.forwardRef((e,t)=>{var r;const{children:n,className:a}=e,o=Be(e,["children","className"]),s=(r=x.useContext(Pd))!==null&&r!==void 0?r:J("rounded-tremor-default p-6");return x.createElement(Nb,{enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95"},x.createElement($L,Object.assign({ref:t,className:J(j0e("panel"),"w-full max-w-lg overflow-visible text-left ring-1 shadow-tremor transition-all transform","bg-tremor-background text-tremor-content ring-tremor-ring","dark:bg-dark-tremor-background dark:text-dark-tremor-content dark:ring-dark-tremor-ring",s,a)},o),n))});N0e.displayName="DialogPanel";const E0e=kt("List"),Eu=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement("ul",Object.assign({ref:t,className:J(E0e("root"),"w-full divide-y","divide-tremor-border text-tremor-content","dark:divide-dark-tremor-border dark:text-dark-tremor-content",n)},a),r)});Eu.displayName="List";const S0e=kt("ListItem"),Tr=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement(x.Fragment,null,x.createElement("li",Object.assign({ref:t,className:J(S0e("root"),"w-full flex justify-between items-center text-tremor-default py-2",n)},a),r))});Tr.displayName="ListItem";const R7=kt("Table"),uR=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement("div",{className:J(R7("root"),"overflow-auto",n)},x.createElement("table",Object.assign({ref:t,className:J(R7("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},a),r))});uR.displayName="Table";const C0e=kt("TableBody"),dR=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement(x.Fragment,null,x.createElement("tbody",Object.assign({ref:t,className:J(C0e("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",n)},a),r))});dR.displayName="TableBody";const O0e=kt("TableCell"),Ba=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement(x.Fragment,null,x.createElement("td",Object.assign({ref:t,className:J(O0e("root"),"align-middle whitespace-nowrap text-left p-4",n)},a),r))});Ba.displayName="TableCell";const P0e=kt("TableFoot"),A0e=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement("tfoot",Object.assign({ref:t,className:J(P0e("root"),"text-left font-medium border-t-[1px] ","text-tremor-content border-tremor-border","dark:text-dark-tremor-content dark:border-dark-tremor-border",n)},a),r)});A0e.displayName="TableFoot";const M0e=kt("TableFooterCell"),T0e=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement(x.Fragment,null,x.createElement("th",Object.assign({ref:t,className:J(M0e("root"),"top-0 px-4 py-3.5","text-tremor-content font-medium","dark:text-dark-tremor-content",n)},a),r))});T0e.displayName="TableFooterCell";const _0e=kt("TableHead"),fR=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement(x.Fragment,null,x.createElement("thead",Object.assign({ref:t,className:J(_0e("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",n)},a),r))});fR.displayName="TableHead";const I0e=kt("TableHeaderCell"),Ii=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement(x.Fragment,null,x.createElement("th",Object.assign({ref:t,className:J(I0e("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",n)},a),r))});Ii.displayName="TableHeaderCell";const D0e=kt("TableRow"),Di=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement(x.Fragment,null,x.createElement("tr",Object.assign({ref:t,className:J(D0e("row"),n)},a),r))});Di.displayName="TableRow";const L0e=x.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:a,colors:o=_o,stack:s=!1,relative:l=!1,animationDuration:c=900,showAnimation:u=!1,noDataText:d,autoMinValue:f=!1,minValue:p,maxValue:h,className:g}=e,b=Be(e,["data","categories","index","colors","stack","relative","animationDuration","showAnimation","noDataText","autoMinValue","minValue","maxValue","className"]),y=vl(n,o),v=ai(f,p,h);return x.createElement("div",Object.assign({ref:t,className:J("w-28 h-12",g)},b),x.createElement(mi,{className:"h-full w-full"},r?.length?x.createElement(wD,{data:r,stackOffset:l?"expand":"none",margin:{top:0,left:-1.5,right:-1.5,bottom:0}},x.createElement(Gn,{hide:!0,domain:v}),x.createElement(Xn,{hide:!0,dataKey:a}),n.map(k=>{var N;return x.createElement(bi,{className:J(He((N=y.get(k))!==null&&N!==void 0?N:Qe.Gray,We.background).fillColor),key:k,name:k,type:"linear",stackId:s||l?"a":void 0,dataKey:k,fill:"",isAnimationActive:u,animationDuration:c})})):x.createElement(vs,{noDataText:d})))});L0e.displayName="SparkBarChart";const R0e=x.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:a,colors:o=_o,animationDuration:s=900,showAnimation:l=!1,curveType:c="linear",connectNulls:u=!1,noDataText:d,autoMinValue:f=!1,minValue:p,maxValue:h,className:g}=e,b=Be(e,["data","categories","index","colors","animationDuration","showAnimation","curveType","connectNulls","noDataText","autoMinValue","minValue","maxValue","className"]),y=vl(n,o),v=ai(f,p,h);return x.createElement("div",Object.assign({ref:t,className:J("w-28 h-12",g)},b),x.createElement(mi,{className:"h-full w-full"},r?.length?x.createElement(kD,{data:r,margin:{top:1,left:1,right:1,bottom:1}},x.createElement(Gn,{hide:!0,domain:v}),x.createElement(Xn,{hide:!0,dataKey:a}),n.map(k=>{var N;return x.createElement(ni,{className:J(He((N=y.get(k))!==null&&N!==void 0?N:Qe.Gray,We.text).strokeColor),strokeOpacity:1,dot:!1,key:k,name:k,type:c,dataKey:k,stroke:"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:l,animationDuration:s,connectNulls:u})})):x.createElement(vs,{noDataText:d})))});R0e.displayName="SparkLineChart";const F0e=x.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:a,stack:o=!1,colors:s=_o,showAnimation:l=!1,animationDuration:c=900,showGradient:u=!0,curveType:d="linear",connectNulls:f=!1,noDataText:p,autoMinValue:h=!1,minValue:g,maxValue:b,className:y}=e,v=Be(e,["data","categories","index","stack","colors","showAnimation","animationDuration","showGradient","curveType","connectNulls","noDataText","autoMinValue","minValue","maxValue","className"]),k=vl(n,s),N=ai(h,g,b);return x.createElement("div",Object.assign({ref:t,className:J("w-28 h-12",y)},v),x.createElement(mi,{className:"h-full w-full"},r?.length?x.createElement(jD,{data:r,margin:{top:1,left:1,right:1,bottom:1}},x.createElement(Gn,{hide:!0,domain:N}),x.createElement(Xn,{hide:!0,dataKey:a}),n.map(w=>{var E,C;return x.createElement("defs",{key:w},u?x.createElement("linearGradient",{className:He((E=k.get(w))!==null&&E!==void 0?E:Qe.Gray,We.text).textColor,id:k.get(w),x1:"0",y1:"0",x2:"0",y2:"1"},x.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:.4}),x.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:0})):x.createElement("linearGradient",{className:He((C=k.get(w))!==null&&C!==void 0?C:Qe.Gray,We.text).textColor,id:k.get(w),x1:"0",y1:"0",x2:"0",y2:"1"},x.createElement("stop",{stopColor:"currentColor",stopOpacity:.3})))}),n.map(w=>{var E;return x.createElement(ys,{className:He((E=k.get(w))!==null&&E!==void 0?E:Qe.Gray,We.text).strokeColor,strokeOpacity:1,dot:!1,key:w,name:w,type:d,dataKey:w,stroke:"",fill:`url(#${k.get(w)})`,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:l,animationDuration:c,stackId:o?"a":void 0,connectNulls:f})})):x.createElement(vs,{noDataText:p})))});F0e.displayName="AreaChart";const $0e=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement("b",Object.assign({ref:t,className:J("text-inherit font-bold",n)},a),r)});$0e.displayName="Bold";const ed=kt("Callout"),B0e=x.forwardRef((e,t)=>{const{title:r,icon:n,color:a,className:o,children:s}=e,l=Be(e,["title","icon","color","className","children"]),c=n;return x.createElement("div",Object.assign({ref:t,className:J(ed("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",a?J(He(a,We.background).bgColor,He(a,We.darkBorder).borderColor,He(a,We.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):J("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),o)},l),x.createElement("div",{className:J(ed("header"),"flex items-start")},c?x.createElement(c,{className:J(ed("icon"),"flex-none h-5 w-5 mr-1.5")}):null,x.createElement("h4",{className:J(ed("title"),"font-semibold")},r)),x.createElement("p",{className:J(ed("body"),"overflow-y-auto",s?"mt-2":"")},s))});B0e.displayName="Callout";const H0e=x.forwardRef((e,t)=>{const{children:r,className:n}=e,a=Be(e,["children","className"]);return x.createElement("i",Object.assign({ref:t,className:J("italic text-inherit",n)},a),r)});H0e.displayName="Italic";const Qo=x.forwardRef((e,t)=>{const{color:r,children:n,className:a}=e,o=Be(e,["color","children","className"]);return x.createElement("p",Object.assign({ref:t,className:J("font-semibold text-tremor-metric",r?He(r,We.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",a)},o),n)});Qo.displayName="Metric";const z0e=x.forwardRef((e,t)=>{const{color:r,children:n,className:a}=e,o=Be(e,["color","children","className"]);return x.createElement("p",Object.assign({ref:t,className:J(r?He(r,We.lightText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",a)},o),n)});z0e.displayName="Subtitle";const Rn=x.forwardRef((e,t)=>{const{color:r,children:n,className:a}=e,o=Be(e,["color","children","className"]);return x.createElement("p",Object.assign({ref:t,className:J("font-medium text-tremor-title",r?He(r,We.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",a)},o),n)});Rn.displayName="Title";const Ho=kt("BarList");function mR(e,t){const{data:r=[],color:n,valueFormatter:a=xo,showAnimation:o=!1,onValueChange:s,sortOrder:l="descending",className:c}=e,u=Be(e,["data","color","valueFormatter","showAnimation","onValueChange","sortOrder","className"]),d=s?"button":"div",f=x.useMemo(()=>l==="none"?r:[...r].sort((h,g)=>l==="ascending"?h.value-g.value:g.value-h.value),[r,l]),p=x.useMemo(()=>{const h=Math.max(...f.map(g=>g.value),0);return f.map(g=>g.value===0?0:Math.max(g.value/h*100,2))},[f]);return x.createElement("div",Object.assign({ref:t,className:J(Ho("root"),"flex justify-between space-x-6",c),"aria-sort":l},u),x.createElement("div",{className:J(Ho("bars"),"relative w-full space-y-1.5")},f.map((h,g)=>{var b,y,v;const k=h.icon;return x.createElement(d,{key:(b=h.key)!==null&&b!==void 0?b:g,onClick:()=>{s?.(h)},className:J(Ho("bar"),"group w-full flex items-center rounded-tremor-small",s?["cursor-pointer","hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-subtle/40"]:"")},x.createElement("div",{className:J("flex items-center rounded transition-all bg-opacity-40","h-8",h.color||n?[He((y=h.color)!==null&&y!==void 0?y:n,We.background).bgColor,s?"group-hover:bg-opacity-30":""]:"bg-tremor-brand-subtle dark:bg-dark-tremor-brand-subtle/60",!s||h.color||n?"":"group-hover:bg-tremor-brand-subtle/30 group-hover:dark:bg-dark-tremor-brand-subtle/70",g===f.length-1?"mb-0":"",o?"duration-500":""),style:{width:`${p[g]}%`,transition:o?"all 1s":""}},x.createElement("div",{className:J("absolute left-2 pr-4 flex max-w-full")},k?x.createElement(k,{className:J(Ho("barIcon"),"flex-none h-5 w-5 mr-2","text-tremor-content","dark:text-dark-tremor-content")}):null,h.href?x.createElement("a",{href:h.href,target:(v=h.target)!==null&&v!==void 0?v:"_blank",rel:"noreferrer",className:J(Ho("barLink"),"whitespace-nowrap hover:underline truncate text-tremor-default",s?"cursor-pointer":"","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis"),onClick:N=>N.stopPropagation()},h.name):x.createElement("p",{className:J(Ho("barText"),"whitespace-nowrap truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},h.name))))})),x.createElement("div",{className:Ho("labels")},f.map((h,g)=>{var b;return x.createElement("div",{key:(b=h.key)!==null&&b!==void 0?b:g,className:J(Ho("labelWrapper"),"flex justify-end items-center","h-8",g===f.length-1?"mb-0":"mb-1.5")},x.createElement("p",{className:J(Ho("labelText"),"whitespace-nowrap leading-none truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},a(h.value)))})))}mR.displayName="BarList";const Gl=x.forwardRef(mR),Hl=kt("CategoryBar"),pR=(e,t)=>e?e/t*100:0,U0e=({values:e})=>{const t=m.useMemo(()=>E1(e),[e]);let r=0,n=0;return x.createElement("div",{className:J(Hl("labels"),"relative flex w-full text-tremor-default h-5 mb-2","text-tremor-content","dark:text-dark-tremor-content")},e.slice(0,e.length).map((a,o)=>{r+=a;const s=(a>=.1*t||n>=.09*t)&&t-r>=.15*t&&r>=.1*t;n=s?0:n+=a;const l=pR(a,t);return x.createElement("div",{key:`item-${o}`,className:"flex items-center justify-end",style:{width:`${l}%`}},x.createElement("span",{className:J(s?"block":"hidden","left-1/2 translate-x-1/2")},r))}),x.createElement("div",{className:J("absolute bottom-0 flex items-center left-0")},"0"),x.createElement("div",{className:J("absolute bottom-0 flex items-center right-0")},t))},q0e=x.forwardRef((e,t)=>{const{values:r=[],colors:n=_o,markerValue:a,showLabels:o=!0,tooltip:s,showAnimation:l=!1,className:c}=e,u=Be(e,["values","colors","markerValue","showLabels","tooltip","showAnimation","className"]),d=m.useMemo(()=>((b,y,v)=>{if(b===void 0)return"";let k=0;for(let N=0;N<y.length;N++){const w=y[N],E=He(v[N],We.background).bgColor;if(k+=w,k>=b)return E}return""})(a,r,n),[a,r,n]),{tooltipProps:f,getReferenceProps:p}=_a(),h=m.useMemo(()=>E1(r),[r]),g=m.useMemo(()=>pR(a,h),[a,h]);return x.createElement(x.Fragment,null,x.createElement(va,Object.assign({text:s},f)),x.createElement("div",Object.assign({ref:t,className:J(Hl("root"),c)},u),o?x.createElement(U0e,{values:r}):null,x.createElement("div",{className:J(Hl("barWrapper"),"relative w-full flex items-center h-2")},x.createElement("div",{className:J("flex-1 flex items-center h-full overflow-hidden rounded-tremor-full")},r.map((b,y)=>{var v;const k=(v=n[y])!==null&&v!==void 0?v:"gray",N=b/h*100;return x.createElement("div",{key:`item-${y}`,className:J(Hl("categoryBar"),"h-full",He(k,We.background).bgColor),style:{width:`${N}%`}})})),a!==void 0?x.createElement("div",Object.assign({ref:f.refs.setReference,className:J(Hl("markerWrapper"),"absolute right-1/2 -translate-x-1/2 w-5"),style:{left:`${g}%`,transition:l?"all 1s":""}},p),x.createElement("div",{className:J(Hl("marker"),"ring-2 mx-auto rounded-tremor-full h-4 w-1","ring-tremor-brand-inverted","dark:ring-dark-tremor-brand-inverted",d)})):null)))});q0e.displayName="CategoryBar";const F7={[Pr.Increase]:{bgColor:He(Qe.Emerald,We.background).bgColor},[Pr.ModerateIncrease]:{bgColor:He(Qe.Emerald,We.background).bgColor},[Pr.Decrease]:{bgColor:He(Qe.Rose,We.background).bgColor},[Pr.ModerateDecrease]:{bgColor:He(Qe.Rose,We.background).bgColor},[Pr.Unchanged]:{bgColor:He(Qe.Orange,We.background).bgColor}},td=kt("DeltaBar"),V0e=x.forwardRef((e,t)=>{const{value:r,isIncreasePositive:n=!0,showAnimation:a=!1,className:o,tooltip:s}=e,l=Be(e,["value","isIncreasePositive","showAnimation","className","tooltip"]),c=PD((f=>f>=0?Pr.Increase:Pr.Decrease)(r),n),{tooltipProps:u,getReferenceProps:d}=_a();return x.createElement(x.Fragment,null,x.createElement(va,Object.assign({text:s},u)),x.createElement("div",Object.assign({ref:t,className:J(td("root"),"relative flex items-center w-full rounded-tremor-full h-2","bg-tremor-background-subtle","dark:bg-dark-tremor-background-subtle",o)},l),x.createElement("div",{className:"flex justify-end h-full w-1/2"},r<0?x.createElement("div",Object.assign({ref:u.refs.setReference,className:J(td("negativeDeltaBar"),"rounded-l-tremor-full",F7[c].bgColor),style:{width:`${Math.abs(r)}%`,transition:a?"all duration-300":""}},d)):null),x.createElement("div",{className:J(td("separator"),"ring-2 z-10 rounded-tremor-full h-4 w-1","ring-tremor-brand-inverted bg-tremor-background-emphasis","dark:ring-dark-tremor-brand-inverted dark:bg-dark-tremor-background-emphasis")}),x.createElement("div",{className:J(td("positiveDeltaBarWrapper"),"flex justify-start h-full w-1/2")},r>=0?x.createElement("div",Object.assign({ref:u.refs.setReference,className:J(td("positiveDeltaBar"),"rounded-r-tremor-full",F7[c].bgColor),style:{width:`${Math.abs(r)}%`,transition:a?"all 1s":""}},d)):null)))});V0e.displayName="DeltaBar";const Zm=kt("MarkerBar"),W0e=x.forwardRef((e,t)=>{const{value:r,minValue:n,maxValue:a,markerTooltip:o,rangeTooltip:s,showAnimation:l=!1,color:c,className:u}=e,d=Be(e,["value","minValue","maxValue","markerTooltip","rangeTooltip","showAnimation","color","className"]),{tooltipProps:f,getReferenceProps:p}=_a(),{tooltipProps:h,getReferenceProps:g}=_a();return x.createElement("div",Object.assign({ref:t,className:J(Zm("root"),"relative flex items-center w-full rounded-tremor-full h-2","bg-tremor-background-subtle","dark:bg-dark-tremor-background-subtle",u)},d),n!==void 0&&a!==void 0?x.createElement(x.Fragment,null,x.createElement(va,Object.assign({text:s},h)),x.createElement("div",Object.assign({ref:h.refs.setReference,className:J(Zm("rangeBar"),"absolute h-full rounded-tremor-full","bg-tremor-content-subtle","dark:bg-dark-tremor-content-subtle"),style:{left:`${n}%`,width:a-n+"%",transition:l?"all duration-300":""}},g))):null,x.createElement(va,Object.assign({text:o},f)),x.createElement("div",Object.assign({ref:f.refs.setReference,className:J(Zm("markerWrapper"),"absolute right-1/2 -translate-x-1/2 w-5"),style:{left:`${r}%`,transition:l?"all 1s":""}},p),x.createElement("div",{className:J(Zm("marker"),"ring-2 mx-auto rounded-tremor-full h-4 w-1","ring-tremor-brand-inverted","dark:ring-dark-tremor-brand-inverted",c?He(c,We.background).bgColor:"dark:bg-dark-tremor-brand bg-tremor-brand")})))});W0e.displayName="MarkerBar";const rd=kt("ProgressBar"),kj=x.forwardRef((e,t)=>{const{value:r,label:n,color:a,tooltip:o,showAnimation:s=!1,className:l}=e,c=Be(e,["value","label","color","tooltip","showAnimation","className"]),{tooltipProps:u,getReferenceProps:d}=_a();return x.createElement(x.Fragment,null,x.createElement(va,Object.assign({text:o},u)),x.createElement("div",Object.assign({ref:t,className:J(rd("root"),"flex items-center w-full",l)},c),x.createElement("div",Object.assign({ref:u.refs.setReference,className:J(rd("progressBarWrapper"),"relative flex items-center w-full rounded-tremor-full bg-opacity-20 h-2",a?He(a,We.background).bgColor:"bg-tremor-brand-muted/50 dark:bg-dark-tremor-brand-muted")},d),x.createElement("div",{className:J(rd("progressBar"),"flex-col h-full rounded-tremor-full",a?He(a,We.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",s?"transition-all duration-300 ease-in-out":""),style:{width:`${r}%`}})),n?x.createElement("div",{className:J(rd("labelWrapper"),"w-16 truncate text-right ml-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},x.createElement("p",{className:J(rd("label"),"shrink-0 whitespace-nowrap truncate text-tremor-default")},n)):null))});kj.displayName="ProgressBar";const K0e=kt("ProgressBar"),$7={xs:{radius:15,strokeWidth:3},sm:{radius:19,strokeWidth:4},md:{radius:32,strokeWidth:6},lg:{radius:52,strokeWidth:8},xl:{radius:80,strokeWidth:10}},Y0e=x.forwardRef((e,t)=>{const{value:r,size:n="md",className:a,showAnimation:o=!0,color:s,tooltip:l,radius:c,strokeWidth:u,children:d}=e,f=Be(e,["value","size","className","showAnimation","color","tooltip","radius","strokeWidth","children"]),p=(h=r)===void 0?0:h>100?100:h;var h;const g=c??$7[n].radius,b=u??$7[n].strokeWidth,y=g-b/2,v=2*y*Math.PI,k=v-p/100*v,{tooltipProps:N,getReferenceProps:w}=_a();return x.createElement(x.Fragment,null,x.createElement(va,Object.assign({text:l},N)),x.createElement("div",Object.assign({ref:t,className:J(K0e("root"),"flex flex-col items-center justify-center",a)},f),x.createElement("svg",Object.assign({ref:N.refs.setReference,width:2*g,height:2*g,viewBox:`0 0 ${2*g} ${2*g}`,className:"transform -rotate-90"},w),x.createElement("circle",{r:y,cx:g,cy:g,strokeWidth:b,fill:"transparent",stroke:"",strokeLinecap:"round",className:J("transition-colors ease-linear",s?`${He(s,We.background).strokeColor} opacity-20 dark:opacity-25`:"stroke-tremor-brand-muted/50 dark:stroke-dark-tremor-brand-muted")}),p>=0?x.createElement("circle",{r:y,cx:g,cy:g,strokeWidth:b,strokeDasharray:v+" "+v,strokeDashoffset:k,fill:"transparent",stroke:"",strokeLinecap:"round",className:J("transition-colors ease-linear",s?He(s,We.background).strokeColor:"stroke-tremor-brand dark:stroke-dark-tremor-brand",o?"transition-all duration-300 ease-in-out":"")}):null),x.createElement("div",{className:J("absolute flex")},d)))});Y0e.displayName="ProgressCircle";const hR=kt("Tracker"),gR=x.forwardRef((e,t)=>{const{color:r,tooltip:n}=e,a=Be(e,["color","tooltip"]),{tooltipProps:o,getReferenceProps:s}=_a();return x.createElement("div",Object.assign({ref:xs([t,o.refs.setReference]),className:J(hR("trackingBlock"),"w-full h-full rounded-[1px] first:rounded-l-[4px] last:rounded-r-[4px]",He(r??"gray",We.background).bgColor)},a,s),x.createElement(va,Object.assign({text:n},o)))});gR.displayName="TrackerBlock";const X0e=x.forwardRef((e,t)=>{const{data:r=[],className:n}=e,a=Be(e,["data","className"]);return x.createElement("div",Object.assign({ref:t,className:J(hR("root"),"h-10 flex items-center space-x-0.5",n)},a),r.map((o,s)=>{var l;return x.createElement(gR,{key:(l=o.key)!==null&&l!==void 0?l:s,color:o.color,tooltip:o.tooltip})}))});X0e.displayName="Tracker";const bR=({args:e})=>{const t=Object.entries(e||{});return t.length?i.jsx("div",{className:"space-y-1",children:t.map(([r,n])=>i.jsxs("div",{className:"flex items-start gap-2 rounded-tremor-small bg-tremor-background-subtle px-2 py-1 text-xs dark:bg-dark-tremor-background-subtle",children:[i.jsx("span",{className:"font-mono text-tremor-content-strong dark:text-dark-tremor-content-strong",children:r}),i.jsx("span",{className:"flex-1 text-tremor-content dark:text-dark-tremor-content",children:typeof n=="object"?JSON.stringify(n,null,2):String(n)})]},r))}):i.jsx(gt,{className:"text-sm text-tremor-content-subtle dark:text-dark-tremor-content",children:"No arguments provided."})},G0e=({open:e,className:t=""})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`h-4 w-4 text-tremor-content transition-transform dark:text-dark-tremor-content ${e?"rotate-180":"rotate-0"} ${t}`,"aria-hidden":"true",children:i.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.084l3.71-3.854a.75.75 0 0 1 1.08 1.04l-4.25 4.417a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z",clipRule:"evenodd"})}),la=({title:e,children:t,defaultOpen:r=!1,resetKey:n,contentClassName:a="",headerRight:o,className:s="",withBorderTop:l=!0,onToggle:c,copyText:u})=>{const[d,f]=m.useState(r);m.useEffect(()=>{f(r)},[n,r]);const p=()=>{f(h=>{const g=!h;return c?.(g),g})};return i.jsxs("div",{className:`rounded-tremor-small border border-slate-200 dark:border-dark-tremor-border ${s}`,children:[i.jsxs("div",{role:"button",tabIndex:0,onClick:p,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),p())},className:"flex w-full cursor-pointer items-center justify-between px-3 py-2 text-left text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[i.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:e}),i.jsxs("span",{className:"flex items-center gap-2",children:[u?i.jsx(on,{textToCopy:u,showLabel:!0}):null,o,i.jsx(G0e,{open:d})]})]}),d?l?i.jsx("div",{className:`border-t border-tremor-border ${a}`,children:t}):t:null]})},hp=({title:e="Input",validation:t,children:r})=>{const[n,a]=m.useState(!0);return i.jsx(la,{title:e,defaultOpen:!0,onToggle:a,headerRight:t&&(t.missing?.length||t.extra?.length)?i.jsxs("div",{className:"text-[11px] text-amber-700 dark:text-amber-200",children:[t.missing?.length?i.jsxs("span",{className:"mr-2",children:["Missing: ",t.missing.join(", ")]}):null,t.extra?.length?i.jsxs("span",{children:["Extra: ",t.extra.join(", ")]}):null]}):null,className:"rounded-tremor-small border border-tremor-border bg-white shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",withBorderTop:!1,children:n?i.jsx("div",{className:"space-y-2 px-3 pt-0 pb-3",children:r}):null})},gp=({title:e="Output",children:t})=>{const[r,n]=m.useState(!0);return i.jsx(la,{title:e,defaultOpen:!0,onToggle:n,className:"rounded-tremor-small border border-tremor-border bg-white shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",withBorderTop:!1,children:r?i.jsx("div",{className:"space-y-2 px-3 pt-0 pb-3",children:t}):null})},Ko=({data:e,title:t,copyText:r,children:n})=>{const a=r||JSON.stringify(e,null,2);return i.jsxs("div",{className:"rounded-tremor-small border border-slate-200 dark:border-dark-tremor-border",children:[t?i.jsxs("div",{className:"flex items-center justify-between border-b border-tremor-border px-3 py-2",children:[i.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:t}),i.jsx(on,{textToCopy:a,showLabel:!0})]}):i.jsx("div",{className:"flex justify-end border-b border-tremor-border px-3 py-2",children:i.jsx(on,{textToCopy:a,showLabel:!0})}),n?i.jsx("div",{className:"max-h-100 overflow-auto px-3 py-2",children:n}):i.jsx("pre",{className:"max-h-100 overflow-auto whitespace-pre-wrap px-3 py-2 text-xs text-tremor-content dark:text-dark-tremor-content",children:a})]})},Z0e=`<svg
118
- xmlns="http://www.w3.org/2000/svg"
119
- width="24"
120
- height="24"
121
- viewBox="0 0 24 24"
122
- fill="none"
123
- stroke="currentColor"
124
- stroke-width="2"
125
- stroke-linecap="round"
126
- stroke-linejoin="round"
127
- >
128
- <path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" />
129
- <path d="M14 2v4a2 2 0 0 0 2 2h4" />
130
- </svg>
131
- `,J0e=`<svg
132
- xmlns="http://www.w3.org/2000/svg"
133
- width="24"
134
- height="24"
135
- viewBox="0 0 24 24"
136
- fill="none"
137
- stroke="currentColor"
138
- stroke-width="2"
139
- stroke-linecap="round"
140
- stroke-linejoin="round"
141
- >
142
- <path d="m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9" />
143
- <path d="m18 15 4-4" />
144
- <path d="m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5" />
145
- </svg>
146
- `,Q0e=`<svg
147
- xmlns="http://www.w3.org/2000/svg"
148
- width="24"
149
- height="24"
150
- viewBox="0 0 24 24"
151
- fill="none"
152
- stroke="currentColor"
153
- stroke-width="2"
154
- stroke-linecap="round"
155
- stroke-linejoin="round"
156
- >
157
- <path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" />
158
- </svg>
159
- `,eke=`<svg
160
- xmlns="http://www.w3.org/2000/svg"
161
- width="24"
162
- height="24"
163
- viewBox="0 0 24 24"
164
- fill="none"
165
- stroke="currentColor"
166
- stroke-width="2"
167
- stroke-linecap="round"
168
- stroke-linejoin="round"
169
- >
170
- <rect width="20" height="8" x="2" y="2" rx="2" ry="2" />
171
- <rect width="20" height="8" x="2" y="14" rx="2" ry="2" />
172
- <line x1="6" x2="6.01" y1="6" y2="6" />
173
- <line x1="6" x2="6.01" y1="18" y2="18" />
174
- </svg>
175
- `,tke={resource:Z0e,tool:J0e,prompt:Q0e,system:eke},rke=(e="")=>{const t=e.toLowerCase();return t.includes("resource")?"resource":t.includes("tool")?"tool":t.includes("prompt")?"prompt":t.includes("system")?"system":null},yR={slate:{root:"bg-slate-500/10 text-slate-700 ring-slate-500/20 dark:bg-slate-500/5 dark:text-slate-200 dark:ring-slate-500/60"},gray:{root:"bg-gray-500/10 text-gray-700 ring-gray-500/20 dark:bg-gray-500/5 dark:text-gray-200 dark:ring-gray-500/60"},zinc:{root:"bg-zinc-500/10 text-zinc-700 ring-zinc-500/20 dark:bg-zinc-500/5 dark:text-zinc-200 dark:ring-zinc-500/60"},neutral:{root:"bg-neutral-500/10 text-neutral-700 ring-neutral-500/20 dark:bg-neutral-500/5 dark:text-neutral-200 dark:ring-neutral-500/60"},stone:{root:"bg-stone-500/10 text-stone-700 ring-stone-500/20 dark:bg-stone-500/5 dark:text-stone-200 dark:ring-stone-500/60"},red:{root:"bg-red-500/10 text-red-700 ring-red-500/20 dark:bg-red-500/5 dark:text-red-200 dark:ring-red-500/60"},orange:{root:"bg-orange-500/10 text-orange-700 ring-orange-500/20 dark:bg-orange-500/5 dark:text-orange-200 dark:ring-orange-500/60"},amber:{root:"bg-amber-500/10 text-amber-700 ring-amber-500/20 dark:bg-amber-500/5 dark:text-amber-200 dark:ring-amber-500/60"},yellow:{root:"bg-yellow-500/10 text-yellow-700 ring-yellow-500/20 dark:bg-yellow-500/5 dark:text-yellow-200 dark:ring-yellow-500/60"},lime:{root:"bg-lime-500/10 text-lime-700 ring-lime-500/20 dark:bg-lime-500/5 dark:text-lime-200 dark:ring-lime-500/60"},green:{root:"bg-green-500/10 text-green-700 ring-green-500/20 dark:bg-green-500/5 dark:text-green-200 dark:ring-green-500/60"},emerald:{root:"bg-emerald-500/10 text-emerald-700 ring-emerald-500/20 dark:bg-emerald-500/5 dark:text-emerald-200 dark:ring-emerald-500/60"},teal:{root:"bg-teal-500/10 text-teal-700 ring-teal-500/20 dark:bg-teal-500/5 dark:text-teal-200 dark:ring-teal-500/60"},cyan:{root:"bg-cyan-500/10 text-cyan-700 ring-cyan-500/20 dark:bg-cyan-500/5 dark:text-cyan-200 dark:ring-cyan-500/60"},sky:{root:"bg-sky-500/10 text-sky-700 ring-sky-500/20 dark:bg-sky-500/5 dark:text-sky-200 dark:ring-sky-500/60"},blue:{root:"bg-blue-500/10 text-blue-700 ring-blue-500/20 dark:bg-blue-500/5 dark:text-blue-200 dark:ring-blue-500/60"},indigo:{root:"bg-indigo-500/10 text-indigo-700 ring-indigo-500/20 dark:bg-indigo-500/5 dark:text-indigo-200 dark:ring-indigo-500/60"},violet:{root:"bg-violet-500/10 text-violet-700 ring-violet-500/20 dark:bg-violet-500/5 dark:text-violet-200 dark:ring-violet-500/60"},purple:{root:"bg-purple-500/10 text-purple-700 ring-purple-500/20 dark:bg-purple-500/5 dark:text-purple-200 dark:ring-purple-500/60"},fuchsia:{root:"bg-fuchsia-500/10 text-fuchsia-700 ring-fuchsia-500/20 dark:bg-fuchsia-500/5 dark:text-fuchsia-200 dark:ring-fuchsia-500/60"},pink:{root:"bg-pink-500/10 text-pink-700 ring-pink-500/20 dark:bg-pink-500/5 dark:text-pink-200 dark:ring-pink-500/60"},rose:{root:"bg-rose-500/10 text-rose-700 ring-rose-500/20 dark:bg-rose-500/5 dark:text-rose-200 dark:ring-rose-500/60"}},B7={xs:"h-[22px] px-2 py-0.5 text-xs",sm:"h-6 px-2.5 py-0.5 text-sm"},nke=e=>{if(!e)return"blue";const t=String(e).toLowerCase();return yR[t]?t:"blue"},dc=({method:e,children:t,color:r,size:n="xs",showIcon:a=!0,copyText:o})=>{const s=r||Yh(e),l=rke(e),c=a?tke[l]:null,u=c?c.replace("<svg",'<svg class="h-full w-full block"'):null,d=nke(s),f=yR[d].root,p=B7[n]||B7.xs,h=o??(typeof t=="string"||typeof t=="number"?String(t):typeof e=="string"?e:""),g=b=>{b.stopPropagation(),h&&navigator?.clipboard?.writeText&&navigator.clipboard.writeText(h).catch(()=>{})};return i.jsx("span",{className:`w-max shrink-0 inline-flex items-center justify-center cursor-pointer rounded-tremor-small ring-1 ring-inset ${p} ${f}`,onClick:g,children:i.jsxs("span",{className:"inline-flex items-center gap-1 leading-none",children:[u?i.jsx("span",{className:"flex h-3.5 w-3.5 items-center justify-center leading-none","aria-hidden":"true",dangerouslySetInnerHTML:{__html:u}}):null,i.jsx("span",{className:"leading-none",children:t})]})})},Jm=(e,t,r="slate")=>e?i.jsx(Bt,{color:r,size:"xs",children:t}):null,xR=({tool:e})=>{const{total:t,required:r}=PF(e.inputSchema),n=Object.entries(e.inputSchema?.properties||{}),a=new Set(e.inputSchema?.required||[]);return i.jsxs(Dt,{className:"space-y-2 rounded-tremor-small border border-tremor-border p-3 shadow-sm dark:border-dark-tremor-border",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx(gt,{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e.title||e.annotations?.title||e.name}),e.description?i.jsx(gt,{className:"mt-0.5 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:e.description}):null]}),i.jsxs("div",{className:"flex flex-wrap gap-1 text-[11px]",children:[Jm(e.annotations?.readOnlyHint,"Read-only","blue"),Jm(e.annotations?.destructiveHint&&!e.annotations?.readOnlyHint,"Destructive","rose"),Jm(e.annotations?.idempotentHint,"Idempotent","emerald"),Jm(e.annotations?.openWorldHint,"Open world","amber"),t?i.jsxs(Bt,{color:"slate",size:"xs",children:[t," params",r?` (${r} required)`:""]}):i.jsx(Bt,{color:"slate",size:"xs",children:"No params"})]})]}),n.length?i.jsx("div",{className:"space-y-1",children:n.map(([o,s])=>i.jsxs("div",{className:"flex items-start gap-2 rounded-tremor-small bg-tremor-background-subtle px-2 py-1 dark:bg-dark-tremor-background-subtle",children:[i.jsx("div",{className:"font-mono text-xs text-tremor-content-strong dark:text-dark-tremor-content-strong",children:o}),i.jsxs("div",{className:"flex-1 text-[11px] text-tremor-content dark:text-dark-tremor-content",children:[s?.type?`${s.type}`:"any",s?.description?` — ${s.description}`:""]}),a.has(o)?i.jsx(Bt,{color:"rose",size:"xs",children:"required"}):null]},o))}):null]})},ake=e=>{if(!e)return null;const t=e.split(`
176
- `),r=[];let n=[];const a=()=>{n.length&&(r.push(i.jsx("ul",{className:"list-disc space-y-1 pl-5 text-sm",children:n.map((o,s)=>i.jsx("li",{children:o},s))},`list-${r.length}`)),n=[])};return t.forEach(o=>{const s=o.trim();if(!s){a();return}if(s.startsWith("#")){a();const l=Math.min(s.match(/^#+/)?.[0]?.length||1,6),c=s.replace(/^#+\s*/,"")||s;r.push(i.jsx("div",{className:`font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong ${l<=2?"text-base":"text-sm"}`,children:c},`h-${r.length}`));return}if(s.startsWith("- ")||s.startsWith("* ")){n.push(s.slice(2));return}a(),r.push(i.jsx("p",{className:"text-sm",children:s},`p-${r.length}`))}),a(),i.jsx("div",{className:"space-y-1 text-tremor-content dark:text-dark-tremor-content",children:r})},oke=e=>{if(typeof window>"u"||typeof DOMParser>"u")return e||"";try{return new DOMParser().parseFromString(e||"","text/html").body.textContent||e||""}catch{return e||""}},vR=({resource:e,mimeType:t,editorOptions:r})=>typeof e?.text=="string"?i.jsxs(i.Fragment,{children:[(t||"").includes("markdown")?i.jsx("div",{className:"rounded-tremor-small border border-slate-200 bg-tremor-background-subtle p-3 text-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:ake(e.text)||i.jsx("div",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Unable to render markdown preview."})}):null,(t||"").includes("html")?i.jsxs("div",{className:"rounded-tremor-small border border-slate-200 bg-tremor-background-subtle p-3 text-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"HTML (text-only preview)"}),i.jsx("p",{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:oke(e.text)})]}):null,i.jsx(ns,{value:e.text,language:AF(t),theme:os(),beforeMount:as,options:r,height:"240px"})]}):i.jsx(Ko,{data:e}),nd=({annotations:e})=>{if(!e||typeof e!="object")return null;const{audience:t,priority:r,lastModified:n}=e,a=[];return Array.isArray(t)&&t.length&&a.push(i.jsxs(Bt,{color:"slate",size:"xs",children:["audience: ",t.join(", ")]},"audience")),r!==void 0&&a.push(i.jsxs(Bt,{color:"slate",size:"xs",children:["priority: ",r]},"priority")),n&&a.push(i.jsxs(Bt,{color:"slate",size:"xs",children:["modified: ",n]},"lastModified")),a.length?i.jsx("div",{className:"flex flex-wrap gap-2",children:a}):null},H7=(e,t)=>t?`data:${e||"application/octet-stream"};base64,${t}`:"",ske=({item:e,index:t})=>{const r=`Item ${t+1}`;switch(e?.type){case"text":return i.jsxs("div",{className:"space-y-1 rounded-tremor-small border border-slate-200 bg-white p-3 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:[r," · Text"]}),i.jsx(nd,{annotations:e.annotations})]}),i.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs text-slate-700 dark:text-dark-tremor-content",children:e.text||"[empty text]"})]});case"image":return i.jsxs("div",{className:"space-y-2 rounded-tremor-small border border-slate-200 bg-white p-3 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:[r," · Image"]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.mimeType?i.jsx(Bt,{color:"slate",size:"xs",children:e.mimeType}):null,i.jsx(nd,{annotations:e.annotations})]})]}),e.data?i.jsx("img",{src:H7(e.mimeType,e.data),alt:e.description||"MCP image content",className:"max-h-64 w-auto rounded"}):i.jsx("div",{className:"text-sm text-slate-600 dark:text-dark-tremor-content",children:"No image data provided."})]});case"audio":return i.jsxs("div",{className:"space-y-1 rounded-tremor-small border border-slate-200 bg-white p-3 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:[r," · Audio"]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.mimeType?i.jsx(Bt,{color:"slate",size:"xs",children:e.mimeType}):null,i.jsx(nd,{annotations:e.annotations})]})]}),e.data?i.jsxs("audio",{controls:!0,className:"w-full",children:[i.jsx("source",{src:H7(e.mimeType,e.data),type:e.mimeType||"audio/wav"}),"Your browser does not support the audio element."]}):i.jsx("div",{className:"text-sm text-slate-600 dark:text-dark-tremor-content",children:"No audio data provided."})]});case"resource_link":return i.jsxs("div",{className:"space-y-1 rounded-tremor-small border border-slate-200 bg-white p-3 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:[r," · Resource link"]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.mimeType?i.jsx(Bt,{color:"slate",size:"xs",children:e.mimeType}):null,i.jsx(nd,{annotations:e.annotations})]})]}),i.jsxs("div",{className:"space-y-1 text-sm text-slate-800 dark:text-dark-tremor-content",children:[i.jsx("div",{className:"font-semibold",children:e.name||e.title||"Unnamed resource"}),i.jsx("div",{className:"break-all text-xs text-slate-600 dark:text-dark-tremor-content",children:e.uri||"No URI"}),e.description?i.jsx("div",{className:"text-sm text-slate-700 dark:text-dark-tremor-content",children:e.description}):null]})]});case"resource":{const n=e.resource||e;return i.jsxs("div",{className:"space-y-2 rounded-tremor-small border border-slate-200 bg-white p-3 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:[r," · Resource"]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.mimeType?i.jsx(Bt,{color:"slate",size:"xs",children:n.mimeType}):null,i.jsx(nd,{annotations:n.annotations||e.annotations})]})]}),i.jsx(vR,{resource:n,mimeType:n.mimeType})]})}default:return i.jsx(Ko,{data:e,title:`${r} · ${e?.type||"Unknown type"}`,copyText:JSON.stringify(e,null,2)})}},kR=({items:e=[]})=>!Array.isArray(e)||!e.length?i.jsx("div",{className:"text-sm text-slate-500 dark:text-dark-tremor-content",children:"No content items returned."}):i.jsx("div",{className:"space-y-2",children:e.map((t,r)=>i.jsx(ske,{item:t,index:r},r))}),ike=({label:e,value:t})=>i.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-sm font-medium text-slate-800 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong",children:[i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:e}),i.jsx("span",{className:"font-mono text-sm",children:t??"—"})]}),lke=({tokens:e,title:t="MCP Tokens",defaultOpen:r=!0})=>{const[n,a]=m.useState(r),o=m.useMemo(()=>[{label:"Request",value:e?.request},{label:"Response",value:e?.response},{label:"Total",value:e?.total}].filter(s=>s.value!==void 0),[e]);return e?i.jsx(la,{title:t,defaultOpen:r,onToggle:a,className:"rounded-lg border border-slate-200 bg-white shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",withBorderTop:!1,children:n?i.jsx("div",{className:"grid grid-cols-2 gap-3 p-2 sm:grid-cols-3",children:o.length>0?o.map(s=>i.jsx(ike,{label:s.label,value:s.value},s.label)):i.jsx("div",{className:"text-sm text-slate-500 dark:text-dark-tremor-content",children:"No token counts"})}):null}):null},cke=({open:e,className:t=""})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`h-4 w-4 text-tremor-content transition-transform dark:text-dark-tremor-content ${e?"rotate-180":"rotate-0"} ${t}`,"aria-hidden":"true",children:i.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.084l3.71-3.854a.75.75 0 0 1 1.08 1.04l-4.25 4.417a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z",clipRule:"evenodd"})}),uke=({operation:e})=>{const t=e?.meta?.mcp||e?.raw?.meta?.mcp||e?.meta?.trace?.mcp||e?.raw?.meta?.trace?.mcp;if(!(t&&typeof t=="object"&&Object.keys(t).filter(E=>t[E]!==void 0).length))return i.jsx("div",{className:"text-sm text-gray-500 dark:text-dark-tremor-content",children:"No MCP metadata"});const r=t.tokens,n=Number(e?.status)>=400;Yh(t?.method);const a=typeof e?.request?.body=="string"?e.request.body:e?.request?.body?JSON.stringify(e.request.body):"",o=typeof e?.response?.body=="string"?e.response.body:e?.response?.body?JSON.stringify(e.response.body):"",s=T9(e?.response?.event_frames),l=o||s||"",c=vp(a),u=vp(l),d=!!(c?.params?.arguments&&Object.keys(c.params.arguments).length),[f,p]=m.useState("structured"),h=t?.method||c?.method,g=m.useMemo(()=>M9(h,u),[h,u]),b=m.useMemo(()=>!!g.structuredContent,[g.structuredContent]),y=m.useMemo(()=>Array.isArray(g.content)&&g.content.length,[g.content]),[v,k]=m.useState({mcp:!0}),N=E=>{k(C=>({...C,[E]:!C[E]}))},w=m.useMemo(()=>{const E=[];return b&&E.push({key:"structured",label:"Structured content"}),y&&E.push({key:"content",label:"Content items"}),E.push({key:"raw",label:"Raw content"}),E},[b,y]);return i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-2 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("h3",{className:"text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:"MCP"}),i.jsx(Bt,{color:n?"rose":"emerald",size:"xs",children:n?"Error":"Success"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx($8,{mcp:t}),i.jsx("button",{type:"button",onClick:()=>N("mcp"),"aria-label":v.mcp?"Collapse MCP section":"Expand MCP section",children:i.jsx(cke,{open:v.mcp})})]})]}),v.mcp?i.jsxs("div",{className:"mt-1 grid grid-cols-1 gap-3 sm:grid-cols-3",children:[i.jsxs("div",{className:"rounded border border-slate-200 bg-white px-3 py-2 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:t.category??"Name"}),i.jsx("div",{className:"mt-1 text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong break-all",children:i.jsx(dc,{method:t.method??"",children:t.name??"—"})})]}),i.jsxs("div",{className:"rounded border border-slate-200 bg-white px-3 py-2 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:"Method"}),i.jsx("div",{className:"mt-1 text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong break-all",children:i.jsx(dc,{method:t.method??"",children:t.method??"—"})})]}),i.jsxs("div",{className:"rounded border border-slate-200 bg-white px-3 py-2 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsx("div",{className:"text-[11px] uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:"Category"}),i.jsx("div",{className:"mt-1 text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong break-all",children:i.jsx(dc,{color:"slate",children:t.category??"—"})})]})]}):null]}),r?i.jsx(lke,{tokens:r}):null,c||u?i.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[d?i.jsx(hp,{children:i.jsx(bR,{args:c.params.arguments})}):null,i.jsx(gp,{children:u?g.type==="toolsList"&&g.tools?.length?i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsxs("h4",{className:"text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:["Tools (",g.tools.length,")"]})}),i.jsx("div",{className:"space-y-2",children:g.tools.map(E=>i.jsx(xR,{tool:E},E.name))})]}):g.type==="promptsList"&&g.prompts?i.jsxs("div",{className:"space-y-2",children:[i.jsxs("h4",{className:"text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:["Prompts (",g.prompts.length,")"]}),i.jsx("div",{className:"space-y-2",children:g.prompts.map(E=>{const C=E.arguments||[],O=C.filter(D=>D.required).length;return i.jsxs("div",{className:"space-y-1 rounded border border-slate-200 bg-white p-3 text-sm shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:E.title||E.name}),E.description?i.jsx("div",{className:"text-xs text-slate-600 dark:text-dark-tremor-content",children:E.description}):null]}),i.jsxs(Bt,{color:"slate",size:"xs",children:[C.length," args",O?` (${O} required)`:""]})]}),C.length?i.jsx("div",{className:"space-y-1",children:C.map(D=>i.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[i.jsx("span",{className:"font-mono text-slate-700 dark:text-dark-tremor-content-strong",children:D.name}),i.jsx("span",{className:"flex-1 text-slate-700 dark:text-dark-tremor-content",children:D.description||"No description"}),D.required?i.jsx(Bt,{color:"rose",size:"xs",children:"required"}):null]},D.name))}):null]},E.name)})})]}):g.type==="resourcesList"&&g.resources?i.jsxs("div",{className:"space-y-2",children:[i.jsxs("h4",{className:"text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:["Resources (",g.resources.length,")"]}),i.jsx("div",{className:"divide-y divide-slate-200 text-sm dark:divide-dark-tremor-border",children:g.resources.map(E=>i.jsxs("div",{className:"flex flex-wrap items-center gap-2 py-2",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:E.title||E.name||E.uri}),i.jsx("div",{className:"text-xs text-slate-600 dark:text-dark-tremor-content",children:E.uri}),E.description?i.jsx("div",{className:"text-xs text-slate-700 dark:text-dark-tremor-content",children:E.description}):null]}),E.mimeType?i.jsx(Bt,{color:"slate",size:"xs",children:E.mimeType}):null,E.size?i.jsx(Bt,{color:"slate",size:"xs",children:`${(E.size/1024).toFixed(1)} KB`}):null]},E.uri))})]}):g.type==="structured"||g.type==="content"||y?(()=>{const E=w.find(O=>O.key===f)?.key||w[0].key,C=w.findIndex(O=>O.key===E);return i.jsxs(Zc,{index:C,onIndexChange:O=>p(w[O]?.key||"raw"),children:[i.jsx(Gc,{children:w.map(O=>i.jsx(ca,{children:O.label},O.key))}),i.jsx(Jc,{children:w.map(O=>i.jsxs(ua,{children:[O.key==="structured"?i.jsx(Ko,{data:g.structuredContent,title:"Structured content"}):null,O.key==="content"?i.jsx(Ko,{data:g.content,title:"Content items",copyText:JSON.stringify(g.content,null,2),children:i.jsx(kR,{items:g.content})}):null,O.key==="raw"?i.jsx(Ko,{data:g.raw,title:"Raw Output"}):null]},O.key))})]})})():i.jsx(Ko,{data:g.raw}):i.jsx("div",{className:"text-sm text-slate-500 dark:text-dark-tremor-content",children:"No MCP output"})})]}):null]})},dke=({endpoint:e,command:t,prompt:r="computer:~$",showCopyButton:n=!1,showCopyLabel:a=!1,copyLabelText:o="Copy",copiedText:s="Copied"})=>{const l=t||`curl -X GET ${e||"http://localhost:8080"}`;return i.jsx("div",{className:"w-full mt-6 max-w-xl mx-auto",children:i.jsxs("div",{className:`coding inverse-toggle px-5 pt-4 shadow-lg text-gray-100 text-sm font-mono subpixel-antialiased
177
- bg-gray-800 pb-6 pt-4 rounded-lg leading-normal overflow-hidden`,children:[i.jsxs("div",{className:"top mb-2 flex justify-between",children:[i.jsxs("div",{className:"flex",children:[i.jsx("div",{className:"h-3 w-3 bg-red-500 rounded-full"}),i.jsx("div",{className:"ml-2 h-3 w-3 bg-orange-300 rounded-full"}),i.jsx("div",{className:"ml-2 h-3 w-3 bg-green-500 rounded-full"})]}),n&&i.jsx(on,{textToCopy:l})]}),i.jsxs("div",{className:"mt-4 flex",children:[i.jsx("span",{className:"text-green-400",children:r}),i.jsxs("p",{className:"flex-1 typing items-start pl-2",children:[l,i.jsx("br",{})]})]})]})})},fke=25;function wR(e){const{client:t,setToast:r}=fr(),[n,a]=m.useState(null),[o,s]=m.useState(!1),l=m.useRef(0),c=m.useRef(new Map),u=m.useRef([]),d=h=>{if(!h)return null;const g=c.current;if(!g.has(h))return null;const b=u.current,y=b.indexOf(h);return y>=0&&b.splice(y,1),b.unshift(h),g.get(h)},f=(h,g)=>{if(!h)return;const b=c.current,y=u.current,v=b.has(h);if(b.set(h,g),v){const k=y.indexOf(h);k>=0&&y.splice(k,1)}for(y.unshift(h);y.length>fke;){const k=y.pop();b.delete(k)}},p=m.useCallback(async(h,{force:g}={})=>{if(!h||!t?.operations?.getOperation){a(null);return}const b=g?null:d(h);if(b){a(b),s(!1);return}const y=++l.current;s(!0);try{const v=await t.operations.getOperation(h);if(l.current!==y)return;a(v),f(h,v),s(!1)}catch(v){if(l.current!==y)return;s(!1),r({message:"Failed to load request",subMessage:v?.message||"Unable to fetch the operation details.",type:"error"})}},[t,r]);return m.useEffect(()=>{if(!e){a(null);return}p(e)},[e,p]),{detailOperation:n,fetchDetail:p,isFetching:o}}const Qk={opacity:1,visibility:"visible",transition:"opacity 0.3s ease-in-out, visibility 0.3s ease-in-out"},ew={opacity:0,visibility:"hidden",transition:"opacity 0.3s ease-in-out, visibility 0.3s ease-in-out"},mke=({operation:e,currentTab:t,setCurrentTab:r})=>{const[n]=dr("ingressEndpoint",""),[a]=dr("proxyEndpoint",""),[o]=dr("expose","false"),s=o==="true",[l,c]=m.useState(!1),{detailOperation:u,fetchDetail:d,isFetching:f}=wR(e?.id),[p,h]=m.useState(!1),g=E=>E?Array.isArray(E)?E:Object.entries(E).map(([C,O])=>({name:C,value:O})):[],b=g(u?.meta?.inspectr?.guard),y=g(u?.meta?.inspectr?.directives),v=b.length>0||y.length>0,k=u?.meta?.mcp||null,N=!!(k&&typeof k=="object"&&Object.keys(k).some(E=>k[E]!==void 0)),w=Array.isArray(u?.meta?.tags)&&u.meta.tags.length>0?"calc(100vh - 270px - 64px - 48px)":"calc(100vh - 270px - 64px)";return m.useEffect(()=>{u&&!v&&t==="meta"&&r("request")},[v,t,r]),m.useEffect(()=>{u&&!N&&t==="mcp"&&r("request")},[N,t,r]),m.useEffect(()=>{const E=setTimeout(()=>{c(!0)},100);return()=>clearTimeout(E)},[]),m.useEffect(()=>{f||h(!1)},[f]),m.useEffect(()=>{h(!1)},[e?.id]),e?u?i.jsxs("div",{className:"relative flex flex-col h-full min-h-0",style:l?Qk:ew,children:[i.jsx(ZV,{operation:u,setCurrentTab:r,onRefresh:()=>{e?.id&&(h(!0),d(e.id,{force:!0}))},isRefreshing:f&&p}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("button",{className:`px-4 py-1 text-base rounded-t ${t==="request"?"bg-blue-600 dark:bg-blue-700 text-white":"bg-gray-200 dark:bg-dark-tremor-background-subtle text-gray-700 dark:text-dark-tremor-content"}`,onClick:()=>r("request"),children:"Request"}),i.jsx("button",{className:`px-4 py-1 text-base rounded-t ${t==="response"?"bg-blue-600 dark:bg-blue-700 text-white":"bg-gray-200 dark:bg-dark-tremor-background-subtle text-gray-700 dark:text-dark-tremor-content"}`,onClick:()=>r("response"),children:"Response"}),v&&i.jsx("button",{className:`px-4 py-1 text-base rounded-t ${t==="meta"?"bg-teal-600 dark:bg-teal-700 text-white":"bg-gray-200 dark:bg-dark-tremor-background-subtle text-gray-700 dark:text-dark-tremor-content"}`,onClick:()=>r("meta"),children:"Info"}),N&&i.jsx("button",{className:`px-4 py-1 text-base rounded-t ${t==="mcp"?"bg-sky-500 dark:bg-sky-800 text-white":"bg-gray-200 dark:bg-dark-tremor-background-subtle text-gray-700 dark:text-dark-tremor-content"}`,onClick:()=>r("mcp"),children:"MCP"})]}),i.jsx("div",{className:"p-4 bg-white dark:bg-dark-tremor-background border border-gray-300 dark:border-dark-tremor-border rounded-b shadow dark:shadow-dark-tremor-shadow flex-1 min-h-0 overflow-y-auto",style:{...l?Qk:ew,maxHeight:w},children:t==="request"?i.jsx(cK,{operation:u}):t==="response"?i.jsx(gK,{operation:u}):t==="meta"&&v?i.jsx(bK,{operation:u}):t==="mcp"?i.jsx(uke,{operation:u}):null})]}):null:i.jsx("div",{className:"h-96 min-h-full mb-20 flex flex-1 flex-col justify-center rounded-tremor-default border border-tremor-border bg-tremor-background-muted px-6 py-10 dark:border-dark-tremor-border dark:bg-dark-tremor-background-muted",style:l?Qk:ew,children:i.jsxs("div",{className:"mx-auto text-center",children:[i.jsx("h4",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong font-[Inter] font-sans",children:"Request Inspectr"}),i.jsx("p",{className:"mt-3 max-w-xl text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content sm:text-base",children:"Select a request from the list to view its details"}),i.jsxs("p",{className:"max-w-xl text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content sm:text-base",children:["or get started by making a request to"," ",s?n?`"${n}"`:"the ingress endpoint":a?`"${a}"`:"the proxy endpoint","."]}),i.jsx(dke,{endpoint:s?n:a,showCopyButton:!0}),i.jsxs("div",{className:"mt-8 sm:flex sm:items-center sm:justify-center sm:gap-x-3",children:[i.jsx("a",{href:"https://inspectr.dev/docs",target:"_blank",className:"w-full whitespace-nowrap rounded-tremor-small bg-tremor-brand px-4 py-2 text-tremor-default font-medium text-tremor-brand-inverted shadow-tremor-input hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:shadow-dark-tremor-input dark:hover:bg-dark-tremor-brand-emphasis sm:w-fit",children:"View Documentation"}),i.jsxs("a",{href:"https://inspectr.dev",target:"_blank",className:"mt-2 inline-flex w-full items-center justify-center gap-1.5 whitespace-nowrap rounded-tremor-small border border-tremor-border bg-tremor-background px-3 py-2 text-tremor-default font-medium text-tremor-brand shadow-tremor-input hover:text-tremor-brand-emphasis dark:border-dark-tremor-border dark:bg-dark-tremor-background dark:text-dark-tremor-brand dark:shadow-dark-tremor-input hover:dark:text-dark-tremor-brand-emphasis sm:mt-0 sm:w-fit",children:["Visit Website",i.jsx(_F,{className:"size-5 shrink-0","aria-hidden":!0})]})]})]})})},pke="data:image/svg+xml,%3csvg%20class='inline-block'%20width='24'%20height='24'%20viewBox='0%200%201648%201648'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3clinearGradient%20id='grad-r4R0»'%20x1='0%25'%20y1='0%25'%20x2='100%25'%20y2='0%25'%3e%3cstop%20offset='0%25'%20style='stop-color:%23ff8c00'%3e%3c/stop%3e%3cstop%20offset='100%25'%20style='stop-color:%23ffd700'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20d='m610%20216.654c-66.158%204.092-126.119%2035.849-164.917%2087.346-8.408%2011.16-13.344%2019.191-19.983%2032.513-12.431%2024.946-19.521%2050.434-22.11%2079.487-1.665%2018.687-.854%20826.238.841%20837.939%207.867%2054.284%2032.465%20101.134%2070.706%20134.667%2016.297%2014.291%2032.283%2024.657%2053.963%2034.991%2016.889%208.05%2034.568%2013.468%2060.5%2018.541%209.019%201.764%2052.201%201.795%2061.5.044%2026.487-4.989%2043.97-10.341%2061-18.675%2015.131-7.406%2021.53-11.135%2060.5-35.267%2020.813-12.887%2023.095-14.298%2029.5-18.24l13-8%2013-8c6.901-4.247%2012.593-7.767%2029.54-18.271%205.796-3.593%2012.771-7.863%2015.5-9.49%202.728-1.626%208.56-5.19%2012.96-7.921%204.4-2.73%2072.575-44.711%20151.5-93.29s150.925-92.918%20160-98.531c9.075-5.612%2024.15-14.936%2033.5-20.719s23.075-14.234%2030.5-18.78c85.169-52.142%20120.029-73.942%20130.014-81.304%2040.974-30.211%2068.344-69.764%2081.788-118.194%2013.864-49.94%208.549-104.847-14.809-153-16.836-34.708-41.252-62.432-74.993-85.154-4.125-2.778-17.625-11.26-30-18.849s-27-16.594-32.5-20.009c-5.5-3.416-109.45-67.427-231-142.246-306.386-188.593-335.221-206.352-350-215.553-30.562-19.028-59.301-29.911-90-34.083-11.697-1.59-30.408-2.514-39.5-1.952m-10.5%2077.269c-39.541%206.402-76.013%2029.73-97.661%2062.467-13.001%2019.66-19.718%2038.39-22.802%2063.584-1.472%2012.028-1.434%20802.191.04%20818.026%201.861%2019.998%206.142%2035.48%2014.415%2052.133%2017.942%2036.114%2053.025%2064.18%2091.508%2073.203%203.575.839%208.975%202.118%2012%202.844%208.221%201.973%2040.343%201.613%2049.971-.56%2032.301-7.289%2065.233-26.686%2094.817-55.849%2015.26-15.042%2022.884-24.803%2033.571-42.979%2013.939-23.706%2020.949-43.36%2027.745-77.792%201.004-5.086%201.428-50%201.949-206.5.465-139.686%201.001-201.809%201.777-206%20.611-3.3%201.608-9.15%202.217-13%201.672-10.583%204.039-21.117%207.191-32%208.179-28.247%2020.714-55.13%2037.188-79.751%2024.262-36.262%2053.189-63.572%2093.074-87.872%204.95-3.016%2012.825-7.435%2017.5-9.82s8.95-4.668%209.5-5.074c3.565-2.63%2034.688-13.266%2052.465-17.93%206.2-1.627%2011.49-3.174%2011.754-3.439%201.003-1.002-1.016-2.602-10.967-8.689-5.639-3.449-16.552-10.172-24.252-14.94-13.435-8.319-31.76-19.604-58.5-36.029-6.875-4.222-16.1-9.911-20.5-12.641-7.667-4.758-73.088-45.103-122.5-75.546-75.227-46.348-108.509-66.591-116.5-70.86-9.422-5.033-25.23-10.76-37.043-13.419-7.967-1.794-40.076-2.843-47.957-1.567m473.5%20305.564c-5.775.685-11.625%201.491-13%201.792-1.375.3-5.2%201.088-8.5%201.749-7.914%201.587-27.103%207.461-36.5%2011.174-38.797%2015.33-75.171%2044.925-98.829%2080.41-11.24%2016.86-21.329%2038.407-26.167%2055.888-2.443%208.825-3.85%2014.608-4.866%2020-.621%203.3-1.653%208.475-2.292%2011.5-.846%204.008-1.345%2059.624-1.837%20205-.618%20182.331-.824%20200.361-2.399%20209.5-1.629%209.459-4.196%2022.506-6.744%2034.279-.628%202.903-.881%205.54-.561%205.859.596.596%20455.986-279.084%20472.195-290.001%2017.547-11.819%2036.335-33.412%2046.291-53.203%203.956-7.863%209.527-23.924%2011.597-33.434%204.848-22.272%203.572-48.26-3.506-71.387-6.907-22.572-18.055-40.93-35.316-58.158-12.705-12.681-16.829-15.485-79.066-53.756-7.15-4.397-15.7-9.654-19-11.684-3.3-2.029-8.925-5.504-12.5-7.722-53.826-33.397-67.199-40.611-88.616-47.8-29.343-9.85-61.599-13.421-90.384-10.006m-1066.25%201048.256c3.988.189%2010.513.189%2014.5%200%203.988-.19.725-.346-7.25-.346s-11.238.156-7.25.346'%20fill='url(%23grad-r4R0»)'%20fill-rule='evenodd'%3e%3c/path%3e%3c/svg%3e";function hke({status:e,onReconnect:t}){const r={connected:"bg-green-500 text-white",reconnecting:"bg-yellow-500 text-black",disconnected:"bg-red-500 text-white"}[e],n={connected:"bg-green-800 animate-pulse",reconnecting:"bg-yellow-800 animate-pulse",disconnected:"bg-red-800"}[e],a=e.charAt(0).toUpperCase()+e.slice(1);return i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("span",{className:`px-2 py-1 rounded-full text-xs font-semibold flex items-center ${r}`,children:[i.jsx("span",{className:`w-2 h-2 rounded-full mr-1 ${n}`}),a]}),e==="disconnected"&&i.jsx("button",{onClick:t,className:"ml-2 text-sm font-medium text-blue-600 hover:underline",children:"Reconnect"})]})}const gke=()=>{const{apiEndpoint:e,setApiEndpoint:t,connectionStatus:r,channelCode:n,setChannelCode:a,channel:o,setChannel:s,client:l,userInitiatedRegistrationRef:c,handleRegister:u,attemptReRegistration:d,resetReRegistration:f}=fr(),[p,h]=m.useState(!1),[g,b]=m.useState(e),[y,v]=m.useState(n),[k,N]=m.useState(o);m.useEffect(()=>{p||(b(e),v(n),N(o))},[e,n,o,p]);const w=()=>{const C=g.replace(/\/+$/,"");t(C),l.configure({apiEndpoint:C}),c.current=!1,u(n,o,"",!0)},E=()=>{c.current=!0,a(y),s(k),u(y,k,"",!0)};return i.jsxs("div",{className:"fixed bottom-0 left-0 w-full",children:[i.jsxs("div",{className:"flex items-center justify-between bg-gray-200 dark:bg-dark-tremor-background-subtle px-4 py-2 w-full cursor-pointer select-none",onClick:()=>h(C=>!C),children:[i.jsx(hke,{status:r,onReconnect:C=>{C.stopPropagation(),f(),d()}}),i.jsxs("a",{href:"https://github.com/inspectr-hq/inspectr",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2",onClick:C=>C.stopPropagation(),children:[i.jsx("img",{src:pke,alt:"Inspectr Logo",className:"h-6"}),i.jsx("span",{className:"text-gray-700 dark:text-dark-tremor-content font-semibold text-sm",children:"Inspectr"})]})]}),i.jsx("div",{className:`bg-gray-100 dark:bg-dark-tremor-background border-t border-gray-300 dark:border-dark-tremor-border transition-all duration-300 overflow-hidden ${p?"max-h-96 opacity-100 py-4":"max-h-0 opacity-0 py-0"}`,children:i.jsxs("div",{className:"px-6",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-dark-tremor-content-strong mb-4",children:"Configuration"}),i.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Inspectr API Endpoint"}),i.jsx("input",{type:"text",placeholder:"Enter API Endpoint...",value:g,onChange:C=>b(C.target.value),className:"w-full border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content border-gray-300 dark:border-dark-tremor-border rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("button",{onClick:w,className:"mt-2 bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800 text-white px-3 py-1.5 rounded-md text-sm",children:"Save"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Channel"}),i.jsx("input",{type:"text",placeholder:"Enter Channel...",value:k,onChange:C=>N(C.target.value),className:"w-full bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content border border-gray-300 dark:border-dark-tremor-border rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("button",{onClick:E,className:"mt-2 bg-green-600 hover:bg-green-700 dark:bg-green-700 dark:hover:bg-green-800 text-white px-3 py-1.5 rounded-md text-sm",children:"Register"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Access Code"}),i.jsx("input",{type:"text",placeholder:"Enter Access Code...",value:y,onChange:C=>v(C.target.value),className:"w-full border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content border-gray-300 dark:border-dark-tremor-border rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]})]})})]})};function cs(){const e=window.location.hash.slice(1),[t,r]=e.split("?"),n=u=>{if(u==null)return u;try{return decodeURIComponent(u)}catch{return u}},[a,o,...s]=t.split("/"),l=s.length?s.join("/"):void 0,c=Object.fromEntries(new URLSearchParams(r||""));return{slug:n(a),operationId:n(o),subTab:n(l),params:c}}function bke(e,t=e[0].slug){const r=()=>{const{slug:l,operationId:c,subTab:u,params:d}=cs();return e.some(f=>f.slug===l)?{slug:l,operationId:c,subTab:u,params:d}:{slug:t,operationId:null,subTab:null,params:{}}},[n,a]=m.useState(()=>typeof window>"u"?{slug:t,operationId:null,subTab:null,params:{}}:r());m.useEffect(()=>{const l=()=>a(r());return window.addEventListener("hashchange",l),()=>window.removeEventListener("hashchange",l)},[]);const o=l=>{window.history.pushState(null,"",`#${l.slug}`),a({slug:l.slug,operationId:null,subTab:null,params:{}})},s=e.find(l=>l.slug===n.slug)||e[0];return{route:n,currentNav:s,handleTabClick:o}}const yke=e=>e==null?null:String(e);function xke(e,t="request"){const[r,n]=m.useState(null),[a,o]=m.useState(t);return m.useEffect(()=>{const s=()=>{const{slug:l,operationId:c,subTab:u}=cs();if(l==="inspectr"){if(c&&e.length){const d=e.find(f=>yke(f.id)===c);d&&n(d)}u&&o(u)}};return s(),window.addEventListener("hashchange",s),()=>window.removeEventListener("hashchange",s)},[e]),{selectedOperation:r,currentTab:a,handleSelect:s=>{n(s);const l=s.id?encodeURIComponent(s.id):"";window.history.pushState(null,"",`#inspectr/${l}/${a}`)},handleTabChange:s=>{o(s);const l=r?.id?encodeURIComponent(r.id):null,c=l?`#inspectr/${l}`:"#inspectr";window.history.replaceState(null,"",`${c}/${s}`)},clearSelection:()=>{n(null),window.history.pushState(null,"","#inspectr")}}}function z7(e,t){if(e===null)return t;try{return JSON.parse(e)}catch{return e}}function U7(e){if(e==null)return null;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function tw(e,t,r={}){const{resetOnReload:n=!1}=r,a=m.useRef(),o=()=>{if(typeof window>"u")return t;const c=sessionStorage.getItem(e);return z7(c,t)},[s,l]=m.useState(o);return m.useEffect(()=>{a.current=s},[s]),m.useEffect(()=>{if(!n||typeof window>"u")return;const c=()=>{sessionStorage.removeItem(e)};return window.addEventListener("beforeunload",c),()=>window.removeEventListener("beforeunload",c)},[e,n]),m.useEffect(()=>{if(typeof window>"u")return;const c=u=>{if(u.key&&u.key!==e)return;const d=sessionStorage.getItem(e),f=z7(d,t),p=U7(a.current);d!==p&&l(f)};return window.addEventListener("storage",c),window.addEventListener("session-storage",c),()=>{window.removeEventListener("storage",c),window.removeEventListener("session-storage",c)}},[e,t]),m.useEffect(()=>{if(typeof window>"u")return;const c=U7(s),u=sessionStorage.getItem(e);if(c===null){if(u===null)return;sessionStorage.removeItem(e)}else{if(u===c)return;sessionStorage.setItem(e,c)}window.dispatchEvent(new CustomEvent("session-storage",{detail:{key:e,value:s}}))},[e,s]),[s,l]}const vke=e=>{if(e==null)return null;if(typeof e=="string")return e;if(e instanceof Date)return e.toISOString();if(typeof e=="number"){const r=new Date(e);if(!Number.isNaN(r.valueOf()))return r.toISOString()}const t=new Date(e);return Number.isNaN(t.valueOf())?String(e):t.toISOString()},$i=e=>vke(e),wj=(e,t)=>{if(!e)return!1;if(!t)return!0;const r=Date.parse(e),n=Date.parse(t);return!Number.isNaN(r)&&!Number.isNaN(n)?r>n:e>t},Ai=e=>e==null?null:String(e),kke="requestFilters",q7=Object.freeze({}),jR=({route:e={slug:"inspectr"}})=>{const{toast:t,setToast:r,client:n}=fr(),{syncOperations:a,setLastEventId:o}=fr(),s=100,l=33,[c,u]=m.useState(1),[d,f]=m.useState(!1),[p,h]=dr("leftPanelWidth",l),[,g]=dr("inspectrLastSeenAt",null),b=parseFloat(p||l),y=m.useRef(!1),[v,k]=dr("persistSortOnReload","false"),N=v==="true",[w,E]=tw("requestSortField","time",{resetOnReload:!N}),[C,O]=tw("requestSortDirection","desc",{resetOnReload:!N}),[D,A]=dr("persistFiltersOnReload","false"),M=D==="true",[I,T]=tw(kke,q7,{resetOnReload:!M}),R=m.useRef(!1),L=Te=>String(Te).split(",").map(Je=>Je.trim()).filter(Boolean);m.useEffect(()=>{const Te=e?.params||{},{status:Je,method:rt,path:De,host:ut,tags:ct,tag:Nt,durationMin:yt,durationMax:ft,from:Ct,to:Ae,start:ke,end:Ie,range:qe,timestampRange:nt,sortField:dt,sortDirection:wt,page:pt}=Te;if(Je!==void 0||rt!==void 0||De!==void 0||ut!==void 0||ct!==void 0||Nt!==void 0||yt!==void 0||ft!==void 0||Ct!==void 0||Ae!==void 0||ke!==void 0||Ie!==void 0||qe!==void 0||nt!==void 0){const Le={};Je!==void 0&&(Le.status=L(Je)),rt!==void 0&&(Le.method=L(rt)),De&&(Le.path=De),ut&&(Le.host=ut),yt!==void 0&&(Le.durationMin=yt),ft!==void 0&&(Le.durationMax=ft);const Tt=qe||nt;Tt?Le.timestampRange=Tt:(Ct||Ae||ke||Ie)&&(Le.timestampRange={start:Ct||ke,end:Ae||Ie});const er=ct??Nt;er!==void 0&&(Le.tags=L(er)),T(Le),R.current=!0}else R.current&&(T(q7),R.current=!1);if(dt&&E(dt),(wt==="asc"||wt==="desc")&&O(wt),pt){const Le=Number.parseInt(pt,10);Number.isFinite(Le)&&Le>0&&u(Le)}},[e?.params,T]);const{results:F=[],totalCount:V=0}=Dn(()=>Fr.queryEvents({filters:I,sort:{field:w,order:C},page:c,pageSize:s}),[I,w,C,c],{results:[],totalCount:0})||{},H=Dn(()=>Fr.getAllTagOptions(),[],[])||[],$=Dn(()=>Fr.getAllMcpToolOptions(),[],[])||[],z=Dn(()=>Fr.getAllMcpResourceOptions(),[],[])||[],W=Dn(()=>Fr.getAllMcpPromptOptions(),[],[])||[],U=Dn(()=>Fr.getAllMcpCategoryOptions(),[],[])||[],X=Dn(()=>Fr.getAllMcpMethodOptions(),[],[])||[],Y=Dn(async()=>{try{return(await Fr.db.events.orderBy("time").last())?.time||null}catch{return null}},[])||null,ae=(e?.slug||null)==="inspectr";m.useEffect(()=>{if(!ae)return;const Te=$i(Y);Te&&g(Je=>{const rt=$i(Je);return!rt||wj(Te,rt)?Te:rt})},[ae,Y,g]);const G=V?Math.ceil(V/s):1,{selectedOperation:ee,currentTab:re,handleSelect:pe,handleTabChange:te,clearSelection:se}=xke(F),ne=()=>{f(!0),a(),setTimeout(()=>f(!1),2500)};m.useEffect(()=>{if(!F||ee&&F.some(rt=>Ai(rt.id)===Ai(ee.id)))return;const{slug:Te,operationId:Je}=cs();if(Te==="inspectr"&&Je){const rt=F.find(De=>Ai(De.id)===Je);rt&&pe(rt);return}F.length>0?pe(F[0]):se()},[F,ee]);const K=async()=>{se();try{await Fr.clearEvents(),await me(),o("")}catch(Te){console.error("Error clearing all operations:",Te)}},ge=async()=>{try{const Te=await Fr.queryEvents({filters:I,sort:{field:"time",order:"desc"},page:1,pageSize:Number.MAX_SAFE_INTEGER});await Promise.all(Te.map(async Je=>{await Fr.deleteEvent(Je.id),await Se(Je.operation_id)})),ee&&Te.some(Je=>Ai(Je.id)===Ai(ee.id))&&se()}catch(Te){console.error("Error clearing filtered operations:",Te)}},ye=async Te=>{const Je=ee&&Ai(ee.id)===Ai(Te),rt=await Fr.getEvent(Te);try{if(await Fr.deleteEvent(Te),await Se(rt.operation_id),Je){se();const De=await Fr.queryEvents({sort:{field:w,order:C},filters:I,page:c,pageSize:s});De&&De.length>0&&pe(De[0])}}catch(De){console.error("Error during operation removal:",De)}},me=async()=>{try{await n.operations.deleteAll()}catch(Te){console.error("Error deleting all operations:",Te),r({message:"Error deleting all operations",subMessage:Te.message,type:"error"})}},Se=async Te=>{try{await n.operations.delete(Te)}catch(Je){console.error(`Error deleting operation ${Te}:`,Je),r({message:"Error deleting operation",subMessage:Je.message,type:"error"})}};m.useEffect(()=>{const Te=rt=>{if(!y.current)return;const De=rt.clientX/window.innerWidth*100;De>10&&De<90&&h(String(De))},Je=()=>{y.current=!1};return window.addEventListener("mousemove",Te),window.addEventListener("mouseup",Je),()=>{window.removeEventListener("mousemove",Te),window.removeEventListener("mouseup",Je)}},[h]);const Re=()=>{y.current=!0};return i.jsxs("div",{className:"flex flex-col h-screen bg-white dark:bg-dark-tremor-background",style:{maxHeight:"calc(100vh - 64px)"},children:[i.jsxs("div",{className:"flex flex-grow",children:[i.jsx("div",{className:"overflow-y-auto",style:{width:`${b}%`},children:i.jsx(FF,{operations:F||[],onSelect:pe,onRemove:ye,clearOperations:K,clearFilteredOperations:ge,selectedOperation:ee,currentPage:c,totalPages:G,totalCount:V||0,onPageChange:u,sortField:w,sortDirection:C,filters:I,setSortField:E,setSortDirection:O,setFilters:T,syncOperations:ne,isSyncing:d,tagOptions:H,mcpToolOptions:$,mcpResourceOptions:z,mcpPromptOptions:W,mcpCategoryOptions:U,mcpMethodOptions:X,persistFilters:M,onPersistFiltersChange:A,persistSort:N,onPersistSortChange:k})}),i.jsx("div",{className:"relative w-px bg-gray-300 dark:bg-dark-tremor-border cursor-col-resize",onMouseDown:Re,children:i.jsx("button",{type:"button",className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-10 flex items-center justify-center px-0 py-2 rounded-md border border-gray-300 bg-white/80 backdrop-blur-sm shadow-sm cursor-col-resize dark:border-dark-tremor-border dark:bg-dark-tremor-background/80",title:"Drag to resize. Double-click to reset.","aria-label":"Resize panels",onMouseDown:Te=>{Te.preventDefault(),Re()},onDoubleClick:Te=>{Te.preventDefault(),h(l)},children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4 text-gray-600 dark:text-gray-400","aria-hidden":!0,children:i.jsx("path",{d:"M8.5 7C9.32843 7 10 6.32843 10 5.5C10 4.67157 9.32843 4 8.5 4C7.67157 4 7 4.67157 7 5.5C7 6.32843 7.67157 7 8.5 7ZM8.5 13.5C9.32843 13.5 10 12.8284 10 12C10 11.1716 9.32843 10.5 8.5 10.5C7.67157 10.5 7 11.1716 7 12C7 12.8284 7.67157 13.5 8.5 13.5ZM10 18.5C10 19.3284 9.32843 20 8.5 20C7.67157 20 7 19.3284 7 18.5C7 17.6716 7.67157 17 8.5 17C9.32843 17 10 17.6716 10 18.5ZM15.5 7C16.3284 7 17 6.32843 17 5.5C17 4.67157 16.3284 4 15.5 4C14.6716 4 14 4.67157 14 5.5C14 6.32843 14.6716 7 15.5 7ZM17 12C17 12.8284 16.3284 13.5 15.5 13.5C14.6716 13.5 14 12.8284 14 12C14 11.1716 14.6716 10.5 15.5 10.5C16.3284 10.5 17 11.1716 17 12ZM15.5 20C16.3284 20 17 19.3284 17 18.5C17 17.6716 16.3284 17 15.5 17C14.6716 17 14 17.6716 14 18.5C14 19.3284 14.6716 20 15.5 20Z"})})})}),i.jsx("div",{className:"p-4 h-full overflow-y-auto bg-white dark:bg-dark-tremor-background text-tremor-content-strong dark:text-dark-tremor-content-strong",style:{width:`${100-b}%`},children:i.jsx("div",{className:"flex flex-col h-full",children:i.jsx(mke,{operation:ee,currentTab:re,setCurrentTab:te})})})]}),i.jsx(gke,{})]})},V7="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%201648%201648'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3clinearGradient%20id='grad-ops'%20x1='0%25'%20y1='0%25'%20x2='100%25'%20y2='0%25'%3e%3cstop%20offset='0%25'%20stop-color='%2353afba'%3e%3c/stop%3e%3cstop%20offset='100%25'%20stop-color='%2376fffb'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20d='m610%20216.654c-66.158%204.092-126.119%2035.849-164.917%2087.346-8.408%2011.16-13.344%2019.191-19.983%2032.513-12.431%2024.946-19.521%2050.434-22.11%2079.487-1.665%2018.687-.854%20826.238.841%20837.939%207.867%2054.284%2032.465%20101.134%2070.706%20134.667%2016.297%2014.291%2032.283%2024.657%2053.963%2034.991%2016.889%208.05%2034.568%2013.468%2060.5%2018.541%209.019%201.764%2052.201%201.795%2061.5.044%2026.487-4.989%2043.97-10.341%2061-18.675%2015.131-7.406%2021.53-11.135%2060.5-35.267%2020.813-12.887%2023.095-14.298%2029.5-18.24l13-8%2013-8c6.901-4.247%2012.593-7.767%2029.54-18.271%205.796-3.593%2012.771-7.863%2015.5-9.49%202.728-1.626%208.56-5.19%2012.96-7.921%204.4-2.73%2072.575-44.711%20151.5-93.29s150.925-92.918%20160-98.531c9.075-5.612%2024.15-14.936%2033.5-20.719s23.075-14.234%2030.5-18.78c85.169-52.142%20120.029-73.942%20130.014-81.304%2040.974-30.211%2068.344-69.764%2081.788-118.194%2013.864-49.94%208.549-104.847-14.809-153-16.836-34.708-41.252-62.432-74.993-85.154-4.125-2.778-17.625-11.26-30-18.849s-27-16.594-32.5-20.009c-5.5-3.416-109.45-67.427-231-142.246-306.386-188.593-335.221-206.352-350-215.553-30.562-19.028-59.301-29.911-90-34.083-11.697-1.59-30.408-2.514-39.5-1.952m-10.5%2077.269c-39.541%206.402-76.013%2029.73-97.661%2062.467-13.001%2019.66-19.718%2038.39-22.802%2063.584-1.472%2012.028-1.434%20802.191.04%20818.026%201.861%2019.998%206.142%2035.48%2014.415%2052.133%2017.942%2036.114%2053.025%2064.18%2091.508%2073.203%203.575.839%208.975%202.118%2012%202.844%208.221%201.973%2040.343%201.613%2049.971-.56%2032.301-7.289%2065.233-26.686%2094.817-55.849%2015.26-15.042%2022.884-24.803%2033.571-42.979%2013.939-23.706%2020.949-43.36%2027.745-77.792%201.004-5.086%201.428-50%201.949-206.5.465-139.686%201.001-201.809%201.777-206%20.611-3.3%201.608-9.15%202.217-13%201.672-10.583%204.039-21.117%207.191-32%208.179-28.247%2020.714-55.13%2037.188-79.751%2024.262-36.262%2053.189-63.572%2093.074-87.872%204.95-3.016%2012.825-7.435%2017.5-9.82s8.95-4.668%209.5-5.074c3.565-2.63%2034.688-13.266%2052.465-17.93%206.2-1.627%2011.49-3.174%2011.754-3.439%201.003-1.002-1.016-2.602-10.967-8.689-5.639-3.449-16.552-10.172-24.252-14.94-13.435-8.319-31.76-19.604-58.5-36.029-6.875-4.222-16.1-9.911-20.5-12.641-7.667-4.758-73.088-45.103-122.5-75.546-75.227-46.348-108.509-66.591-116.5-70.86-9.422-5.033-25.23-10.76-37.043-13.419-7.967-1.794-40.076-2.843-47.957-1.567m473.5%20305.564c-5.775.685-11.625%201.491-13%201.792-1.375.3-5.2%201.088-8.5%201.749-7.914%201.587-27.103%207.461-36.5%2011.174-38.797%2015.33-75.171%2044.925-98.829%2080.41-11.24%2016.86-21.329%2038.407-26.167%2055.888-2.443%208.825-3.85%2014.608-4.866%2020-.621%203.3-1.653%208.475-2.292%2011.5-.846%204.008-1.345%2059.624-1.837%20205-.618%20182.331-.824%20200.361-2.399%20209.5-1.629%209.459-4.196%2022.506-6.744%2034.279-.628%202.903-.881%205.54-.561%205.859.596.596%20455.986-279.084%20472.195-290.001%2017.547-11.819%2036.335-33.412%2046.291-53.203%203.956-7.863%209.527-23.924%2011.597-33.434%204.848-22.272%203.572-48.26-3.506-71.387-6.907-22.572-18.055-40.93-35.316-58.158-12.705-12.681-16.829-15.485-79.066-53.756-7.15-4.397-15.7-9.654-19-11.684-3.3-2.029-8.925-5.504-12.5-7.722-53.826-33.397-67.199-40.611-88.616-47.8-29.343-9.85-61.599-13.421-90.384-10.006m-1066.25%201048.256c3.988.189%2010.513.189%2014.5%200%203.988-.19.725-.346-7.25-.346s-11.238.156-7.25.346'%20fill='url(%23grad-ops)'%20fill-rule='evenodd'%3e%3c/path%3e%3c/svg%3e",wke="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%201648%201648'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3clinearGradient%20id='grad-connections'%20x1='0%25'%20y1='0%25'%20x2='100%25'%20y2='0%25'%3e%3cstop%20offset='0%25'%20stop-color='%23ff8c00'%3e%3c/stop%3e%3cstop%20offset='100%25'%20stop-color='%23ffd700'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20d='m610%20216.654c-66.158%204.092-126.119%2035.849-164.917%2087.346-8.408%2011.16-13.344%2019.191-19.983%2032.513-12.431%2024.946-19.521%2050.434-22.11%2079.487-1.665%2018.687-.854%20826.238.841%20837.939%207.867%2054.284%2032.465%20101.134%2070.706%20134.667%2016.297%2014.291%2032.283%2024.657%2053.963%2034.991%2016.889%208.05%2034.568%2013.468%2060.5%2018.541%209.019%201.764%2052.201%201.795%2061.5.044%2026.487-4.989%2043.97-10.341%2061-18.675%2015.131-7.406%2021.53-11.135%2060.5-35.267%2020.813-12.887%2023.095-14.298%2029.5-18.24l13-8%2013-8c6.901-4.247%2012.593-7.767%2029.54-18.271%205.796-3.593%2012.771-7.863%2015.5-9.49%202.728-1.626%208.56-5.19%2012.96-7.921%204.4-2.73%2072.575-44.711%20151.5-93.29s150.925-92.918%20160-98.531c9.075-5.612%2024.15-14.936%2033.5-20.719s23.075-14.234%2030.5-18.78c85.169-52.142%20120.029-73.942%20130.014-81.304%2040.974-30.211%2068.344-69.764%2081.788-118.194%2013.864-49.94%208.549-104.847-14.809-153-16.836-34.708-41.252-62.432-74.993-85.154-4.125-2.778-17.625-11.26-30-18.849s-27-16.594-32.5-20.009c-5.5-3.416-109.45-67.427-231-142.246-306.386-188.593-335.221-206.352-350-215.553-30.562-19.028-59.301-29.911-90-34.083-11.697-1.59-30.408-2.514-39.5-1.952m-10.5%2077.269c-39.541%206.402-76.013%2029.73-97.661%2062.467-13.001%2019.66-19.718%2038.39-22.802%2063.584-1.472%2012.028-1.434%20802.191.04%20818.026%201.861%2019.998%206.142%2035.48%2014.415%2052.133%2017.942%2036.114%2053.025%2064.18%2091.508%2073.203%203.575.839%208.975%202.118%2012%202.844%208.221%201.973%2040.343%201.613%2049.971-.56%2032.301-7.289%2065.233-26.686%2094.817-55.849%2015.26-15.042%2022.884-24.803%2033.571-42.979%2013.939-23.706%2020.949-43.36%2027.745-77.792%201.004-5.086%201.428-50%201.949-206.5.465-139.686%201.001-201.809%201.777-206%20.611-3.3%201.608-9.15%202.217-13%201.672-10.583%204.039-21.117%207.191-32%208.179-28.247%2020.714-55.13%2037.188-79.751%2024.262-36.262%2053.189-63.572%2093.074-87.872%204.95-3.016%2012.825-7.435%2017.5-9.82s8.95-4.668%209.5-5.074c3.565-2.63%2034.688-13.266%2052.465-17.93%206.2-1.627%2011.49-3.174%2011.754-3.439%201.003-1.002-1.016-2.602-10.967-8.689-5.639-3.449-16.552-10.172-24.252-14.94-13.435-8.319-31.76-19.604-58.5-36.029-6.875-4.222-16.1-9.911-20.5-12.641-7.667-4.758-73.088-45.103-122.5-75.546-75.227-46.348-108.509-66.591-116.5-70.86-9.422-5.033-25.23-10.76-37.043-13.419-7.967-1.794-40.076-2.843-47.957-1.567m473.5%20305.564c-5.775.685-11.625%201.491-13%201.792-1.375.3-5.2%201.088-8.5%201.749-7.914%201.587-27.103%207.461-36.5%2011.174-38.797%2015.33-75.171%2044.925-98.829%2080.41-11.24%2016.86-21.329%2038.407-26.167%2055.888-2.443%208.825-3.85%2014.608-4.866%2020-.621%203.3-1.653%208.475-2.292%2011.5-.846%204.008-1.345%2059.624-1.837%20205-.618%20182.331-.824%20200.361-2.399%20209.5-1.629%209.459-4.196%2022.506-6.744%2034.279-.628%202.903-.881%205.54-.561%205.859.596.596%20455.986-279.084%20472.195-290.001%2017.547-11.819%2036.335-33.412%2046.291-53.203%203.956-7.863%209.527-23.924%2011.597-33.434%204.848-22.272%203.572-48.26-3.506-71.387-6.907-22.572-18.055-40.93-35.316-58.158-12.705-12.681-16.829-15.485-79.066-53.756-7.15-4.397-15.7-9.654-19-11.684-3.3-2.029-8.925-5.504-12.5-7.722-53.826-33.397-67.199-40.611-88.616-47.8-29.343-9.85-61.599-13.421-90.384-10.006m-1066.25%201048.256c3.988.189%2010.513.189%2014.5%200%203.988-.19.725-.346-7.25-.346s-11.238.156-7.25.346'%20fill='url(%23grad-connections)'%20fill-rule='evenodd'%3e%3c/path%3e%3c/svg%3e",NR="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2024%2024'%20stroke-width='1.5'%20stroke='currentColor'%20class='size-6'%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='m3.75%2013.5%2010.5-11.25L12%2010.5h8.25L9.75%2021.75%2012%2013.5H3.75Z'%20/%3e%3c/svg%3e",jke="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20d='M3.49994%2011.7501L11.6717%203.57855C12.7762%202.47398%2014.5672%202.47398%2015.6717%203.57855C16.7762%204.68312%2016.7762%206.47398%2015.6717%207.57855M15.6717%207.57855L9.49994%2013.7501M15.6717%207.57855C16.7762%206.47398%2018.5672%206.47398%2019.6717%207.57855C20.7762%208.68312%2020.7762%2010.474%2019.6717%2011.5785L12.7072%2018.543C12.3167%2018.9335%2012.3167%2019.5667%2012.7072%2019.9572L13.9999%2021.2499'%20stroke='%236b7280'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3c/path%3e%3cpath%20d='M17.4999%209.74921L11.3282%2015.921C10.2237%2017.0255%208.43272%2017.0255%207.32823%2015.921C6.22373%2014.8164%206.22373%2013.0255%207.32823%2011.921L13.4999%205.74939'%20stroke='%236b7280'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3c/path%3e%3c/svg%3e",Nke="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%236b7280'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%3e%3cpath%20d='m15%2012-8.373%208.373a1%201%200%201%201-3-3L12%209'%3e%3c/path%3e%3cpath%20d='m18%2015%204-4'%3e%3c/path%3e%3cpath%20d='m21.5%2011.5-1.914-1.914A2%202%200%200%201%2019%208.172V7l-2.26-2.26a6%206%200%200%200-4.202-1.756L9%202.96l.92.82A6.18%206.18%200%200%201%2012%208.4V10l2%202h1.172a2%202%200%200%201%201.414.586L18.5%2014.5'%3e%3c/path%3e%3c/svg%3e",Eke="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%236b7280'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%3e%3cpath%20d='M20%207h-3a2%202%200%200%201-2-2V2'%3e%3c/path%3e%3cpath%20d='M9%2018a2%202%200%200%201-2-2V4a2%202%200%200%201%202-2h7l4%204v10a2%202%200%200%201-2%202Z'%3e%3c/path%3e%3cpath%20d='M3%207.6v12.8A1.6%201.6%200%200%200%204.6%2022h9.8'%3e%3c/path%3e%3c/svg%3e",Ske="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%236b7280'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%3e%3cpath%20d='M21%2015a2%202%200%200%201-2%202H7l-4%204V5a2%202%200%200%201%202-2h14a2%202%200%200%201%202%202z'%3e%3c/path%3e%3c/svg%3e";function vo(e,t=!1,r=!0){const[n,a]=dr(`feature_preview_${e}`,t?"true":void 0);return m.useEffect(()=>{r&&n==="false"&&a(void 0)},[r,n,a]),[n==="true",o=>{a(o?"true":r?void 0:"false")}]}function ER(e){const t=e&&e.reason||"",r=e&&e.status;switch(t){case"invalid_request":return'Invalid request. Submit as {"license_key": "..."}.';case"invalid_format":return"Invalid format. Did you paste JSON or a file? Paste only the license key string.";case"ingress_unreachable":return"Activation service unreachable. Check network/ingress connectivity and try again.";case"activation_error":return`Activation failed. ${e?.details||"Please try again or contact support."}`;case"invalid_key":return"Invalid license key. Is this the exact key? Check for typos or request a new key.";case"revoked":return"License revoked. Contact support to resolve or obtain a new license.";case"expired":return"License expired. Renew your license or enter a valid key.";case"storage_error":return"Failed to store the license locally. Ensure write permissions and retry.";case"internal_error":return"Server error during activation. Please try again shortly.";default:return r===401?"Unauthorized: Invalid license key.":r===403?"Forbidden: License revoked.":r===410?"Expired license. Please renew or use a new key.":e?.message||"Failed to update license"}}function Cke({open:e,onClose:t,onSubmit:r}){const[n,a]=m.useState(""),[o,s]=m.useState(""),[l,c]=m.useState(!1),u="license-file-input";if(m.useEffect(()=>{e&&(a(""),s(""),c(!1))},[e]),!e)return null;const d=async()=>{s("");const p=(n||"").trim();if(!p){s("Please paste a license key.");return}try{c(!0),await r(p),t()}catch(h){const g=ER(h);s(g),c(!1)}},f=async p=>{const h=p.target.files&&p.target.files[0];if(h)try{const g=await h.text();a(g.trim()),s("")}catch{s("Failed to read license file.")}finally{p.target.value=""}};return i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),i.jsxs("div",{className:"relative bg-white dark:bg-gray-950 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-50",children:"Update License"}),i.jsx("button",{onClick:t,className:"text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-gray-100","aria-label":"Close",disabled:l,children:"×"})]}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:"Paste your license key below or upload a key file."}),i.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[i.jsx("input",{id:u,type:"file",accept:".txt,.key,.license,application/octet-stream,text/plain,application/json",onChange:f,className:"hidden",disabled:l}),i.jsx("button",{type:"button",onClick:()=>document.getElementById(u)?.click(),className:"px-3 py-1.5 text-sm rounded bg-gray-200 dark:bg-gray-800 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-700",disabled:l,children:"Upload Key File"}),i.jsx("span",{className:"text-xs text-gray-500",children:"Accepted: .txt, .key, .license"})]}),i.jsx("textarea",{className:`w-full h-48 p-3 rounded border text-sm font-mono ${o?"border-red-500 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-800 focus:border-blue-500 focus:ring-blue-500"}`,placeholder:"Paste your license key here",value:n,onChange:p=>{a(p.target.value),o&&s("")},disabled:l}),o&&i.jsx("p",{className:"mt-2 text-sm text-red-600",children:o}),i.jsxs("div",{className:"mt-4 flex justify-end gap-3",children:[i.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded hover:bg-gray-300 dark:hover:bg-gray-700",disabled:l,children:"Cancel"}),i.jsx("button",{onClick:d,className:`px-4 py-2 text-white rounded ${l?"bg-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}`,disabled:l,children:l?"Updating…":"Update License"})]})]})]})}function Oke({open:e,onClose:t,license:r,onRefresh:n}){const[a,o]=m.useState(""),[s,l]=m.useState(!1),[c,u]=m.useState("");if(m.useEffect(()=>{e&&(o(""),l(!1),u(""))},[e]),!e)return null;const d=r?.license?.plan||"unknown",f=r?.license||{},p=r?.features||{},h=r?.usage?.features||{},g=f?.expires_at||null,b=f?.starts_at||null,y=f?.updated_at||null,v=f?.grace_until||null,k=f?.in_grace===!0,N=f?.issuer||null,w=f?.subject||null,E=Object.entries(p||{}),C=$=>{if(!$)return null;const z=new Date($);return isNaN(z)?$:z.toISOString().slice(0,19).replace("T"," ")},O=async()=>{u("");const $=(a||"").trim();if(!$){u("Please enter a license key.");return}try{l(!0),await n($),o("")}catch(z){u(ER(z))}finally{l(!1)}},D=new Date,A=g?new Date(g):null,M=v?new Date(v):null,I=A?D>A:!1,T=I&&M?D>M:!1,R=k||I&&M&&D<=M,L=A?D<=A:!1;let F="Unknown",V="",H="bg-gray-400";return T?(F="Expired",V=M?`(grace ended ${C(v)})`:"(grace ended)",H="bg-red-600"):R?(F="In Grace",V=M?`(until ${C(v)})`:"",H="bg-yellow-500"):L&&(F="Active",V=A?`(until ${C(g)})`:"",H="bg-green-600"),i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),i.jsxs("div",{className:"relative bg-white dark:bg-gray-950 rounded-lg shadow-xl max-w-3xl w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-50",children:"License Overview"}),i.jsx("button",{onClick:t,className:"text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-gray-100","aria-label":"Close",disabled:s,children:"×"})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[i.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[i.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Status"}),i.jsxs("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50 flex items-center",children:[i.jsx("span",{className:`inline-block w-2 h-2 rounded-full mr-2 ${H}`}),F,V&&i.jsx("span",{className:"ml-2 text-xs font-normal text-gray-500",children:V})]})]}),i.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[i.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Plan"}),i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:d})]}),i.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[i.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Issued By"}),i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:N||"—"})]}),i.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[i.jsx("p",{className:"text-xs uppercase text-gray-500",children:"License Key"}),i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:w||"—"})]}),i.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[i.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Last Updated"}),i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:C(y)||"—"})]}),i.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[i.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Starts"}),i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:C(b)||"—"})]}),i.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[i.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Expires"}),i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:C(g)||"—"})]}),v&&i.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[i.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Grace Until"}),i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:C(v)})]})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50 mb-2",children:"Features"}),E.length===0&&i.jsx("p",{className:"text-sm text-gray-500",children:"No features available."}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:E.map(([$,z])=>{const W=$.toUpperCase(),U=h?.[$]||{};return i.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[i.jsx("p",{className:"text-xs uppercase text-gray-500 mb-1",children:W}),i.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300 space-y-1",children:["effective_enabled"in z&&i.jsxs("p",{children:["Effective enabled: ",String(z.effective_enabled)]}),"effective_limit"in z&&i.jsxs("p",{children:["Effective limit: ",z.effective_limit??"—"]}),"licensed_enabled"in z&&i.jsxs("p",{children:["Licensed enabled: ",String(z.licensed_enabled)]}),"licensed_limit"in z&&i.jsxs("p",{children:["Licensed limit: ",z.licensed_limit??"—"]}),"default_limit"in z&&i.jsxs("p",{children:["Default limit: ",z.default_limit??"—"]}),"unlimited"in z&&i.jsxs("p",{children:["Unlimited: ",String(z.unlimited)]}),("used"in U||"used"in z)&&i.jsxs("p",{children:["Used: ",U.used??z.used??0]}),("remaining"in U||"remaining"in z)&&i.jsxs("p",{children:["Remaining: ",U.remaining??z.remaining??0]}),("window"in U||"window"in z)&&i.jsxs("p",{children:["Window: ",U.window??z.window??"—"]}),("period_start"in U||"period_start"in z)&&i.jsxs("p",{children:["Period start: ",C(U.period_start??z.period_start)]})]})]},$)})})]}),i.jsxs("div",{className:"mt-2 rounded border border-gray-200 dark:border-gray-800 p-3",children:[i.jsx("p",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Refresh License"}),i.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Enter a license key to update the license details."}),i.jsxs("div",{className:"mt-2 flex gap-2",children:[i.jsx("input",{type:"text",value:a,onChange:$=>o($.target.value),placeholder:"INSPECTR-...",className:"flex-1 rounded border border-gray-300 dark:border-gray-800 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:s}),i.jsx("button",{type:"button",onClick:O,className:`px-4 py-2 text-white rounded ${s?"bg-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}`,disabled:s,children:s?"Refreshing…":"Refresh License"})]}),c&&i.jsx("p",{className:"mt-2 text-sm text-red-600",children:c})]})]})]})}const Pke=()=>{const{client:e,setToast:t}=fr(),[r,n]=m.useState(null),[a,o]=m.useState(null),[s,l]=m.useState(!0),[c,u]=m.useState(!1),[d,f]=m.useState(""),[p,h]=m.useState(!1),[g,b]=m.useState(!1),[y,v]=m.useState(!1),[k,N]=m.useState(!1),w=x.useCallback(async(me=!1)=>{try{me?l(!0):u(!0);let Se=null,Re=null;e?.service?.getLicense?[Se,Re]=await Promise.all([e.service.getMetrics(),e.service.getLicense().catch(()=>null)]):Se=await e.service.getMetrics(),n(Se),Re&&o(Re),f("")}catch(Se){console.error("Error fetching metrics:",Se),f(Se.message||"Failed to load metrics")}finally{me?l(!1):u(!1)}},[e]);m.useEffect(()=>{w(!0)},[w]);const E=async me=>{await e.service.putLicense(me),t?.({message:"License updated",subMessage:"License applied successfully."}),await w(!1)},C=async me=>{await e.service.putLicense(me),t?.({message:"License refreshed",subMessage:"License updated successfully."}),await w(!1)},O=r?.operations||{},D=r?.generic?.totals?.sse||{},A=r?.generic?.totals?.mcp||{},M=r?.generic?.totals?.features||{},I=r?.features||{},T=r?.mcp||{},R=(()=>{const me=a?.features?.mcp;if(me)return me.unlimited===!0?!0:typeof me.effective_limit=="number"?!1:me.effective_enabled===!0&&typeof me.default_limit!="number"})(),L=(()=>{const me=a?.features?.mcp;return!me||me.unlimited===!0?null:typeof me.effective_limit=="number"?me.effective_limit:typeof me.default_limit=="number"?me.default_limit:null})(),F=a?.features?.mcp,V=a?.usage?.features?.mcp,H=(()=>{const me=V?.window||F?.window;return me?me.charAt(0).toUpperCase()+me.slice(1):null})(),$=(()=>{const me=V?.period_start||F?.period_start;if(!me)return null;const Se=new Date(me);return isNaN(Se)?null:Se.toISOString().slice(0,10)})(),z=(()=>{const me=V?.period_end||F?.period_end;if(!me)return null;const Se=new Date(me);return isNaN(Se)?null:Se.toISOString().slice(0,10)})(),W=typeof V?.used=="number"?V.used:typeof A.requests=="number"?A.requests:0,U=L?Math.min(100,W/L*100):0,X=a?.features?.rules,Y=a?.usage?.features?.rules,ae=(()=>{const me=X;return!me||me.unlimited===!0?null:typeof me.effective_limit=="number"?me.effective_limit:typeof me.default_limit=="number"?me.default_limit:null})();(()=>{const me=Y?.window||X?.window;return me?me.charAt(0).toUpperCase()+me.slice(1):null})(),(()=>{const me=Y?.period_start||X?.period_start;if(!me)return null;const Se=new Date(me);return isNaN(Se)?null:Se.toISOString().slice(0,10)})(),(()=>{const me=Y?.period_end||X?.period_end;if(!me)return null;const Se=new Date(me);return isNaN(Se)?null:Se.toISOString().slice(0,10)})();const G=r?.generic?.totals?.rules||{},ee=r?.rules||{},re=typeof G.definitions=="number"?G.definitions:typeof ee.definitions_total=="number"?ee.definitions_total:0,pe=ae?Math.min(100,re/ae*100):0,te=(()=>{const me=(a?.license?.plan||"").toString().toLowerCase(),Se=(T?.plan||"").toString().toLowerCase(),Re=me||Se;return Re==="pro"||Re==="professional"||Re==="paid"?"pro":["open_source","open-source","opensource","oss","open source"].includes(Re)?"open_source":R?"pro":"open_source"})(),se=te==="pro"?"Pro":"Open Source",ne=te==="pro"?"bg-brand-primary text-gray-900 ":"bg-white dark:bg-gray-800/10 border border-brand-primary text-brand-primary",K=(()=>{const me=r?.meta?.installed_at;if(!me)return null;const Se=new Date(me);return isNaN(Se)?null:Se.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})})(),ge=te==="open_source"&&W>0||typeof L=="number"&&U>=90,ye=te==="open_source"&&re>0||typeof ae=="number"&&pe>=90;return m.useEffect(()=>{r&&h(ge)},[ge,r]),m.useEffect(()=>{r&&b(ye)},[ye,r]),s?i.jsxs(Dt,{className:"p-6",children:[i.jsx(Rn,{children:"Usage Overview"}),i.jsx(gt,{className:"mt-2",children:"Loading usage…"})]}):d?i.jsxs(Dt,{className:"p-6",children:[i.jsx(Rn,{children:"Usage Overview"}),i.jsxs(gt,{className:"mt-2 text-red-600 dark:text-red-400",children:["Error loading metrics: ",d]})]}):i.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[i.jsx("header",{children:i.jsxs("div",{className:"sm:flex sm:items-center sm:justify-between",children:[i.jsx("h3",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Usage Overview"}),i.jsx("div",{className:"mt-2 sm:mt-0",children:i.jsxs("div",{className:"flex gap-2",children:[i.jsx(uc,{onClick:()=>N(!0),children:"License Details"}),i.jsx(uc,{onClick:()=>v(!0),children:"Update License"}),i.jsx(uc,{onClick:()=>w(!1),children:c?"Loading":"Refresh"})]})})]})}),i.jsxs("div",{className:"rounded-lg bg-gray-200 p-6 ring-1 ring-inset ring-gray-200 dark:bg-gray-400/10 dark:ring-gray-800",children:[i.jsxs("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:["This workspace is currently on"," ",i.jsx("span",{className:`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium ${ne}`,children:se})]}),i.jsxs("p",{className:"mt-1 max-w-2xl text-sm leading-6 text-gray-500",children:[te==="pro"?"You're on Pro — enjoy premium features and priority support.":"Boost your analytics and unlock advanced features with our premium plans.",i.jsxs("a",{href:"https://inspectr.dev/pricing",target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-1 text-indigo-600 dark:text-indigo-500",children:[te==="pro"?"Explore features":"Compare plans",i.jsx("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor","aria-hidden":"true",className:"remixicon size-4 shrink-0",children:i.jsx("path",{d:"M16.0037 9.41421L7.39712 18.0208L5.98291 16.6066L14.5895 8H7.00373V6H18.0037V17H16.0037V9.41421Z"})})]})]})]}),K&&i.jsxs(gt,{className:"-mt-2 text-sm text-gray-500",children:["Usage metrics since ",K]}),i.jsx(Cke,{open:y,onClose:()=>v(!1),onSubmit:E}),i.jsx(Oke,{open:k,onClose:()=>N(!1),license:a,onRefresh:C}),i.jsxs(Dt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:V7,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),i.jsx(Rn,{className:"!mb-0",children:"Operations"})]}),i.jsx(gt,{className:"mt-1 text-gray-500",children:"Metrics on requests, responses, and events handled by Inspectr."}),i.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-4",children:[i.jsxs("div",{children:[i.jsx(gt,{children:"Total requests"}),i.jsx(Qo,{children:O.total_requests??(O.requests_local??0)+(O.requests_ingress??0)}),i.jsx("div",{className:"mt-3",children:i.jsx(Gl,{data:[{name:"proxy",value:O.requests_local??0,color:"cyan"},{name:"ingress",value:O.requests_ingress??0,color:"yellow"}]})})]}),i.jsxs("div",{children:[i.jsx(gt,{children:"Total responses"}),i.jsx(Qo,{children:O.total_responses??(O.responses_local??0)+(O.responses_ingress??0)}),i.jsx("div",{className:"mt-3",children:i.jsx(Gl,{data:[{name:"proxy",value:O.responses_local??0,color:"cyan"},{name:"ingress",value:O.responses_ingress??0,color:"yellow"}]})})]}),i.jsxs("div",{children:[i.jsx(gt,{children:"Event frames"}),i.jsx(Qo,{children:O.total_event_frames??(O.event_frames_local??0)+(O.event_frames_ingress??0)}),i.jsx("div",{className:"mt-3",children:i.jsx(Gl,{data:[{name:"proxy",value:O.event_frames_local??0,color:"cyan"},{name:"ingress",value:O.event_frames_ingress??0,color:"yellow"}]})})]})]})]}),i.jsxs(Dt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:V7,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),i.jsx(Rn,{className:"!mb-0",children:"Features"})]}),i.jsx(gt,{className:"mt-1 text-gray-500",children:"Usage metrics for core Inspectr features."}),i.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Registrations"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:M.registrations??I.registration_requests??0})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Token refresh"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:M.token_refresh??I.token_refresh_requests??0})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Launches"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:M.launches??0})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Ingress registrations"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:M.ingress_registrations??0})]})]})]}),i.jsxs(Dt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:wke,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),i.jsx(Rn,{className:"!mb-0",children:"Inspectr Connections"})]}),i.jsx(gt,{className:"mt-1 text-gray-500",children:"Overview of metrics related to the Inspectr App SSE connections to Inspectr."}),i.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Active connections"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:D.active??0})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Reconnect attempts"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:D.reconnect_attempts??0})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total connections"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:D.total_connections??0})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total disconnections"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:D.total_disconnections??0})]})]})]}),i.jsxs(Dt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:NR,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),i.jsx(Rn,{className:"!mb-0",children:"Rules"})]}),i.jsx(gt,{className:"mt-1 text-gray-500",children:"Overview of Rules definitions and actions usage."}),g&&ye&&i.jsxs("div",{className:"mt-4 rounded-md bg-gray-50 p-6 ring-1 ring-inset ring-gray-200 dark:bg-gray-900 dark:ring-gray-800",children:[i.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Want more rules?"}),i.jsx("p",{className:"mt-2 text-sm/6 text-gray-500 dark:text-gray-500",children:"Elevate your workspace and boost productivity with premium features. See our pro plans and upgrade today."}),i.jsxs("div",{className:"mt-6 flex items-center space-x-2",children:[i.jsx("a",{href:"https://inspectr.dev/pricing",target:"_blank",rel:"noreferrer noopener",className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border px-3 py-2 text-center text-sm font-medium shadow-sm transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-yellow-500 dark:outline-blue-500 border-transparent text-white dark:text-white bg-yellow-500 dark:bg-yellow-500 hover:bg-yellow-600 dark:hover:bg-yellow-600 disabled:bg-blue-300 disabled:text-white disabled:dark:bg-blue-800 disabled:dark:text-blue-400",children:"Discover Plans"}),i.jsx("button",{type:"button",className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border px-3 py-2 text-center text-sm font-medium shadow-sm transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 disabled:dark:text-gray-600",onClick:()=>b(!1),children:"Dismiss"})]})]}),ae!==null&&i.jsxs("div",{className:"mt-6",children:[i.jsx(gt,{className:"mb-2",children:"Definitions usage"}),i.jsx(kj,{value:pe,color:"indigo"}),i.jsxs(gt,{className:"mt-2",children:[re," of ",ae," rules defined"]})]}),i.jsxs("div",{className:"mt-6 grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Rules executed"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:G.actions_executed??ee.actions_executed??0})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Actions triggered"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:G.actions_triggered??0})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Historically operations processed"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:G.apply_processed??0})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Historically operations updated"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:G.apply_updated??0})]})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong mb-2",children:"Actions by type"}),i.jsx(Gl,{data:Object.entries(ee.actions_by_type||{}).map(([me,Se])=>({name:me,value:Se}))})]})]})]}),i.jsxs(Dt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:jke,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),i.jsx(Rn,{className:"!mb-0",children:"Inspectr MCP Server"})]}),i.jsx(gt,{className:"mt-1 text-gray-500",children:"Overview of Model Context Protocol (MCP) activity on the Inspectr MCP server, including usage across tools, resources, and prompts."}),p&&ge&&i.jsxs("div",{className:"mt-4 rounded-md bg-gray-50 p-6 ring-1 ring-inset ring-gray-200 dark:bg-gray-900 dark:ring-gray-800",children:[i.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Want to upgrade?"}),i.jsx("p",{className:"mt-2 text-sm/6 text-gray-500 dark:text-gray-500",children:"Elevate your workspace and boost productivity with premium features. See our pro plans and upgrade today."}),i.jsxs("div",{className:"mt-6 flex items-center space-x-2",children:[i.jsx("a",{href:"https://inspectr.dev/pricing",target:"_blank",rel:"noreferrer noopener",className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border px-3 py-2 text-center text-sm font-medium shadow-sm transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-yellow-500 dark:outline-yellow-500 border-transparent text-white dark:text-white bg-yellow-500 dark:bg-yellow-500 hover:bg-yellow-600 dark:hover:bg-yellow-600 disabled:bg-blue-300 disabled:text-white disabled:dark:bg-blue-800 disabled:dark:text-blue-400",children:"Explore Plans"}),i.jsx("button",{type:"button",className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border px-3 py-2 text-center text-sm font-medium shadow-sm transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 disabled:dark:text-gray-600",onClick:()=>h(!1),children:"Dismiss"})]})]}),L&&i.jsxs("div",{className:"mt-6",children:[i.jsx(gt,{className:"mb-2",children:"Remaining usage"}),i.jsx(kj,{value:U,color:"blue"}),i.jsxs(gt,{className:"mt-2",children:[W," of ",L," uses"]}),(H||$||z)&&i.jsxs(gt,{className:"mt-1 text-gray-500",children:[H?`${H} window`:"Usage window",$?` since ${$}`:"",z?` — resets on ${z}`:""]})]}),i.jsxs("div",{className:"mt-6 grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[i.jsx("h4",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Usage"}),i.jsxs("div",{children:[i.jsxs("p",{className:"flex items-center text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:[i.jsx("img",{src:Nke,width:16,height:16,alt:"","aria-hidden":"true",className:"w-4 h-4 mr-2"}),"Total tools"]}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:A.tools??0})]}),i.jsxs("div",{children:[i.jsxs("p",{className:"flex items-center text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:[i.jsx("img",{src:Eke,width:16,height:16,alt:"","aria-hidden":"true",className:"w-4 h-4 mr-2"}),"Total resources"]}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:A.resources??0})]}),i.jsxs("div",{children:[i.jsxs("p",{className:"flex items-center text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:[i.jsx("img",{src:Ske,width:16,height:16,alt:"","aria-hidden":"true",className:"w-4 h-4 mr-2"}),"Total prompts"]}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:A.prompts??0})]})]}),i.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[i.jsx("h4",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Traffic"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total requests"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:A.requests??0})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total responses"}),i.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:A.responses??0})]})]})]})]})]})};function Ake(...e){return e.filter(Boolean).join(" ")}function Mke({overall:e}){if(!e)return i.jsx("div",{children:"Loading KPI..."});const t=[{name:"Total Requests",stat:e.total_requests,change:"",changeType:"neutral"},{name:"Average Response Time",stat:`${e.average_response_time} ms`,change:"",changeType:"neutral"},{name:"Success Rate",stat:`${(e.success_rate*100).toFixed(1)}%`,change:"",changeType:"neutral"},{name:"Error Rate",stat:`${(e.error_rate*100).toFixed(1)}%`,change:"",changeType:"neutral"}],r=t.length;return i.jsx("dl",{className:`grid grid-cols-1 gap-${r} sm:grid-cols-2 lg:grid-cols-${r}`,children:t.map(n=>i.jsxs(Dt,{children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("dt",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:n.name}),n.change&&i.jsx("span",{className:Ake(n.changeType==="positive"?"bg-emerald-100 text-emerald-800 ring-emerald-600/10 dark:bg-emerald-400/10 dark:text-emerald-500 dark:ring-emerald-400/20":"bg-red-100 text-red-800 ring-red-600/10 dark:bg-red-400/10 dark:text-red-500 dark:ring-red-400/20","inline-flex items-center rounded-tremor-small px-2 py-1 text-tremor-label font-medium ring-1 ring-inset"),children:n.change})]}),i.jsx("dd",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:n.stat})]},n.name))})}function Tke(...e){return e.filter(Boolean).join(" ")}function _ke({title:e="Traffic Volume",data:t,valueFormatter:r}){const n=Array.isArray(t)?t:[],a=n.reduce((l,c)=>(l["2xx"]+=c["2xx"]||0,l["3xx"]+=c["3xx"]||0,l["4xx"]+=c["4xx"]||0,l["5xx"]+=c["5xx"]||0,l),{"2xx":0,"3xx":0,"4xx":0,"5xx":0}),o=r||(l=>Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(l)),s=[{name:"2xx",value:a["2xx"],color:"bg-blue-500"},{name:"3xx",value:a["3xx"],color:"bg-orange-500"},{name:"4xx",value:a["4xx"],color:"bg-cyan-500"},{name:"5xx",value:a["5xx"],color:"bg-red-500"}];return i.jsxs(Dt,{className:"mt-4 h-120 rounded-tremor-small p-2",children:[i.jsx("h3",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),i.jsx("ul",{role:"list",className:"mt-6 grid gap-3 sm:grid-cols-4 md:grid-cols-4",children:s.map(l=>i.jsxs("li",{className:"rounded-tremor-small border border-tremor-border px-3 py-2 text-left dark:border-dark-tremor-border",children:[i.jsxs("div",{className:"flex items-center space-x-1.5",children:[i.jsx("span",{className:Tke(l.color,"size-2.5 rounded-sm"),"aria-hidden":"true"}),i.jsx("p",{className:"text-tremor-label text-tremor-content dark:text-dark-tremor-content",children:l.name})]}),i.jsx("p",{className:"mt-0.5 font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:o(l.value)})]},l.name))}),i.jsx(_h,{data:n,index:"date",categories:["2xx","3xx","4xx","5xx"],colors:["blue","orange","cyan","red"],showLegend:!1,valueFormatter:o,yAxisWidth:50,stack:!0,className:"mt-6 hidden h-80 w-full sm:block"}),i.jsx(_h,{data:n,index:"date",categories:["2xx","3xx","4xx","5xx"],colors:["blue","orange","cyan","red"],showLegend:!1,valueFormatter:o,showYAxis:!1,stack:!0,className:"mt-6 h-48 w-full sm:hidden"})]})}function Ike(e,t){return t==="ms"?`${Math.round(e)}`:new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}function bp({title:e="Response Times",data:t,metricKey:r=[],metricUnit:n="",highlightValue:a="",highlightLabel:o=""}){const s=Array.isArray(r)?r:[r],l=c=>Ike(c,n);return i.jsxs(Dt,{className:"mt-4 h-120 rounded-tremor-small p-2",children:[i.jsx("h3",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),i.jsxs("div",{className:"p-6",children:[i.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:o}),i.jsxs("p",{className:"text-2xl font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[a,n?` ${n}`:""]}),i.jsx(yf,{data:t,index:"date",categories:s,showGradient:!1,valueFormatter:l,className:"mt-8 hidden h-80 w-full sm:block"}),i.jsx(yf,{data:t,index:"date",categories:s,showGradient:!1,valueFormatter:l,className:"mt-8 h-48 w-full sm:hidden"})]})]})}function Dke(...e){return e.filter(Boolean).join(" ")}function Fb({className:e=""}){return i.jsx("div",{className:Dke("flex items-center justify-center w-full h-full border border-dashed rounded-tremor-default border-tremor-border dark:border-dark-tremor-border",e),children:i.jsx("p",{className:"text-tremor-content text-tremor-default dark:text-dark-tremor-content",children:"No data"})})}const Lke=e=>`${Intl.NumberFormat("us").format(e).toString()}`;function Os({title:e,data:t,toggleable:r=!0}){const[n,a]=m.useState(!0),o=r?n:!0,s=t?t.map(c=>({name:c.p95_response_time!=null?`${c.path} (P95: ${c.p95_response_time} ms)`:c.path,value:c.count})):[],l=s.length>0;return i.jsxs(Dt,{className:"mt-4 rounded-tremor-small p-2",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-tremor-border p-3 dark:border-dark-tremor-border",children:[i.jsx("p",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),i.jsx("p",{className:"text-tremor-label font-medium uppercase text-tremor-content dark:text-dark-tremor-content",children:"Totals"})]}),i.jsx("div",{className:`overflow-hidden p-6 ${o?"":"max-h-[260px]"}`,children:l?i.jsx(Gl,{data:s,valueFormatter:Lke}):i.jsx(Fb,{className:"min-h-[150px]"})}),r&&l&&i.jsx("div",{className:`flex justify-center ${n?"px-6 pb-6":"absolute inset-x-0 bottom-0 rounded-b-tremor-default bg-gradient-to-t from-tremor-background to-transparent py-7 dark:from-dark-tremor-background"}`,children:i.jsx("button",{className:"flex items-center justify-center rounded-tremor-small border border-tremor-border bg-tremor-background px-2.5 py-2 text-tremor-default font-medium text-tremor-content-strong shadow-tremor-input hover:bg-tremor-background-muted dark:border-dark-tremor-border dark:bg-dark-tremor-background dark:text-dark-tremor-content-strong dark:shadow-dark-tremor-input hover:dark:bg-dark-tremor-background-muted",onClick:()=>a(!n),children:n?"Show less":"Show more"})})]})}function Rke(...e){return e.filter(Boolean).join(" ")}function Dl({title:e="Donut Chart",description:t="",data:r,valueFormatter:n,colors:a}){const o=["bg-blue-500","bg-violet-500","bg-fuchsia-500","bg-emerald-500","bg-sky-500"],s=a||["blue","violet","fuchsia","emerald","sky"],l=n||(u=>`${u}`);let c=[];if(Array.isArray(r))c=r;else if(r&&typeof r=="object"){const u=Object.entries(r),d=u.reduce((f,[,p])=>f+p,0);c=u.map(([f,p],h)=>({name:f,amount:p,share:d>0?`${(p/d*100).toFixed(1)}%`:"0%",borderColor:o[h%o.length]}))}return i.jsxs(Dt,{className:"mt-4 h-120 rounded-tremor-small p-2",children:[i.jsx("h3",{className:"text-tremor-default font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),t&&i.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:t}),i.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-0 sm:grid-cols-2 sm:gap-8",children:[i.jsx(MD,{data:c,category:"amount",index:"name",valueFormatter:l,showTooltip:!0,className:"h-40 w-full",colors:s}),i.jsx("div",{className:"mt-6 flex items-center sm:mt-0",children:i.jsx("ul",{role:"list",className:"space-y-3",children:c.map(u=>i.jsxs("li",{className:"flex space-x-3",children:[i.jsx("span",{className:Rke(u.borderColor,"w-1 shrink-0 rounded")}),i.jsxs("div",{children:[i.jsxs("p",{className:"text-tremor-default font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[l(u.amount)," ",i.jsxs("span",{className:"font-normal",children:["(",u.share,")"]})]}),i.jsx("p",{className:"mt-0.5 whitespace-nowrap text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:u.name})]})]},u.name))})})]})]})}const Fke=({open:e,onClose:t,onConfirm:r,title:n="Clear All",message:a="Are you sure you want to clear all? This action cannot be undone.",confirmButtonText:o="Clear All"})=>e?i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("div",{className:"flex-shrink-0 bg-red-100 rounded-full p-2",children:i.jsx("svg",{className:"size-6 text-red-600",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}),i.jsxs("div",{className:"ml-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:n}),i.jsx("p",{className:"mt-2 text-sm text-gray-500",children:a})]})]}),i.jsxs("div",{className:"mt-6 flex justify-end space-x-3",children:[i.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Cancel"}),i.jsx("button",{onClick:()=>{r(),t()},className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 text-sm",children:o})]})]})]}):null;function W7(e){return e==null||Number.isNaN(e)?"":`${Math.round(e)}`}function $ke({active:e,label:t,onClick:r}){return i.jsx("button",{type:"button",onClick:r,className:["px-2 py-1 text-xs rounded border",e?"bg-tremor-brand text-tremor-brand-inverted dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted border-transparent":"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-200 border-gray-300 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-600"].join(" "),children:t})}function Bke({title:e="HTTP Request duration: p50, p90, p95, p99",data:t=[]}){const r=["p50","p90","p95","p99"],n=m.useMemo(()=>{if(!Array.isArray(t))return[];const f=new Set;for(const p of t)for(const h of r)p&&typeof p[h]=="number"&&f.add(h);return r.filter(p=>f.has(p))},[t]),[a,o]=m.useState(new Set(r));m.useEffect(()=>{o(f=>{const p=new Set([...f].filter(h=>n.includes(h)));return p.size===0?new Set(n):(n.forEach(h=>p.add(h)),p)})},[n]);const s=f=>{o(p=>{const h=new Set(p);return h.has(f)?h.delete(f):h.add(f),h})},l={p50:"blue",p90:"violet",p95:"cyan",p99:"rose"},c=m.useMemo(()=>n.filter(f=>a.has(f)),[n,a]),u=m.useMemo(()=>c.map(f=>l[f]),[c]),d=Array.isArray(t)&&t.length>0&&n.length>0;return i.jsxs(Dt,{className:"mt-4 rounded-tremor-small p-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),i.jsx("div",{className:"flex gap-2",children:r.map(f=>i.jsx($ke,{label:f.toUpperCase(),active:a.has(f),onClick:()=>s(f)},f))})]}),i.jsxs("div",{className:"p-6",children:[d?c.length===0?i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"No percentile selected. Toggle one or more options above."}):i.jsxs(i.Fragment,{children:[i.jsx(yf,{data:t,index:"date",categories:c,colors:u,showGradient:!1,valueFormatter:W7,className:"mt-4 hidden h-80 w-full sm:block"}),i.jsx(yf,{data:t,index:"date",categories:c,colors:u,showGradient:!1,valueFormatter:W7,className:"mt-4 h-48 w-full sm:hidden"})]}):i.jsx(Fb,{className:"h-40"}),d?i.jsx("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400",children:"Values in milliseconds"}):null]})]})}function ad(...e){return e.filter(Boolean).join(" ")}function yp({tags:e=[],selectedTag:t,onSelect:r,disabled:n=!1,loading:a=!1,error:o,fullWidth:s=!1}){const[l,c]=m.useState(!1),u=m.useRef(null),d=m.useRef(null),f=!!t;m.useEffect(()=>{if(!l)return;const y=k=>{!d.current||!u.current||d.current.contains(k.target)||u.current.contains(k.target)||c(!1)},v=k=>{k.key==="Escape"&&(c(!1),u.current?.focus())};return document.addEventListener("mousedown",y),document.addEventListener("touchstart",y),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("touchstart",y),document.removeEventListener("keydown",v)}},[l]);const p=()=>{n||c(y=>!y)},h=()=>c(!1),g=y=>{n||(r?.(y),h())},b="tag-filter-dropdown-label";return i.jsxs("div",{className:ad("relative inline-block text-left",s?"w-full":""),children:[i.jsxs("button",{type:"button",ref:u,onClick:p,onKeyDown:y=>{y.key==="ArrowDown"&&!l&&(y.preventDefault(),c(!0))},disabled:n,"aria-haspopup":"menu","aria-expanded":l,"aria-labelledby":b,className:ad("inline-flex items-center gap-2 rounded-tremor-small border border-tremor-border bg-tremor-background px-3 py-2 text-sm font-medium text-tremor-content-strong shadow-tremor-input transition focus:z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand/60 min-h-[42px]",s?"w-full justify-start":"","hover:bg-tremor-background-subtle disabled:cursor-not-allowed disabled:opacity-70","dark:border-dark-tremor-border dark:bg-gray-950 dark:text-dark-tremor-content-strong dark:shadow-dark-tremor-input dark:hover:bg-gray-950/60"),children:[i.jsx("span",{id:b,className:"sr-only",children:"Filter statistics by tag"}),i.jsx(IF,{className:"h-4 w-4","aria-hidden":!0}),f?i.jsx(sl,{tag:t}):i.jsx("span",{className:"text-xs uppercase tracking-wide",children:"All tags"})]}),l?i.jsxs("div",{ref:d,role:"menu","aria-orientation":"vertical","aria-labelledby":b,className:ad("absolute z-50 mt-2 w-64 rounded-md border border-tremor-border bg-tremor-background p-2 shadow-xl shadow-black/[2.5%] focus:outline-none dark:border-dark-tremor-border dark:bg-gray-950",s?"left-0 right-auto origin-top-left":"right-0 origin-top-right"),children:[i.jsx("div",{className:"px-2 pb-2 text-xs font-semibold uppercase tracking-wide text-tremor-content dark:text-dark-tremor-content",children:"Select a tag"}),i.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":!f,onClick:()=>g(null),className:ad("flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm transition","text-gray-500 hover:bg-tremor-background-subtle focus:outline-none focus-visible:bg-tremor-background-subtle dark:text-gray-400 dark:hover:bg-dark-tremor-background dark:focus-visible:bg-dark-tremor-background",f?"":"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong"),children:[i.jsx("span",{className:"text-xs font-medium uppercase tracking-wide",children:"All tags"}),f?null:i.jsx(uS,{className:"ml-auto h-4 w-4 text-tremor-brand dark:text-dark-tremor-brand","aria-hidden":!0})]}),i.jsx("div",{className:"my-2 h-px bg-tremor-border dark:bg-dark-tremor-border"}),a?i.jsx("div",{className:"px-2 py-4 text-center text-xs text-gray-500 dark:text-gray-400",children:"Loading tags…"}):e.length===0?i.jsx("div",{className:"px-2 py-4 text-center text-xs text-gray-500 dark:text-gray-400",children:o||"No tags available"}):e.map(y=>{const v=t===y;return i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":v,onClick:()=>g(y),className:ad("flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm transition","text-tremor-content-strong hover:bg-tremor-background-subtle focus:outline-none focus-visible:bg-tremor-background-subtle dark:text-dark-tremor-content-strong dark:hover:bg-dark-tremor-background dark:focus-visible:bg-dark-tremor-background",v?"font-semibold":""),children:[i.jsx(sl,{tag:y}),v?i.jsx(uS,{className:"ml-auto h-4 w-4 text-tremor-brand dark:text-dark-tremor-brand","aria-hidden":!0}):null]},y)})]})]}):null]})}const SR=(e,t=0,r=0,n=0,a=0)=>new Date(e.getFullYear(),e.getMonth(),e.getDate(),t,r,n,a),$b=e=>!(e instanceof Date)||Number.isNaN(e.getTime())?new Date(0).toISOString():SR(e).toISOString(),Bb=e=>!(e instanceof Date)||Number.isNaN(e.getTime())?new Date(0).toISOString():SR(e,23,59,59,999).toISOString(),od=(e,t,r)=>{const n=$b(t),a=Bb(r);return{label:e,start:n,end:a,tooltip:`${n} – ${a}`}},CR=(e=new Date)=>{const t=e instanceof Date?new Date(e):new Date,r=t;return new Date(r.getTime()-3600*1e3),[od("Today",t,t),od("7D",new Date(t.getTime()-10080*60*1e3),t),od("30D",new Date(t.getTime()-720*60*60*1e3),t),od("3M",new Date(t.getUTCFullYear(),t.getUTCMonth()-3,t.getUTCDate()),t),od("6M",new Date(t.getUTCFullYear(),t.getUTCMonth()-6,t.getUTCDate()),t)]},DE=(e,t=new Date)=>e&&CR(t).find(r=>r.label===e)||null,K7=(...e)=>e.filter(Boolean).join(" ");function LE({selectedRange:e,onSelect:t,onCustomClick:r,referenceDate:n}){const a=m.useMemo(()=>CR(n),[n]);return i.jsxs("div",{className:"inline-flex items-center rounded shadow",children:[a.map((o,s)=>i.jsx("button",{onClick:()=>t?.(o),title:o.tooltip,type:"button",className:K7(s===0?"rounded-l":s===a.length-1?"-ml-px rounded-r":"-ml-px","border px-3 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand/60",e===o.label?"bg-tremor-brand text-tremor-brand-inverted dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted":"bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"),children:o.label},o.label)),i.jsx("button",{onClick:r,title:"Set custom date range",type:"button",className:K7("-ml-px rounded-r","border px-3 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand/60",e==="Custom"?"bg-tremor-brand text-tremor-brand-inverted dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted":"bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"),children:"Custom"})]})}const Qm=e=>{const t=Number(e);return Number.isNaN(t)?"0":Intl.NumberFormat("us").format(t)};function Hke({total:e}){const t=[{name:"Total MCP Requests",stat:Qm(e?.count)},{name:"Request Tokens",stat:Qm(e?.request_tokens)},{name:"Response Tokens",stat:Qm(e?.response_tokens)},{name:"Total Tokens",stat:Qm(e?.total_tokens)}];return i.jsx("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:t.map(r=>i.jsxs(Dt,{children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("dt",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:r.name})}),i.jsx("dd",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:r.stat})]},r.name))})}const OR=e=>{const t=Number(e);return Number.isNaN(t)?"0":Intl.NumberFormat("us").format(t)},zke=e=>`${OR(e)}`;function Ll({title:e,items:t}){const r=Array.isArray(t)?t.map(a=>{const o=a.totalTokens!=null?` (${OR(a.totalTokens)} tokens)`:"";return{name:`${a.name}${o}`,value:a.count??0}}):[],n=r.length>0;return i.jsxs(Dt,{className:"mt-4 rounded-tremor-small p-2",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-tremor-border p-3 dark:border-dark-tremor-border",children:[i.jsx("p",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),i.jsx("p",{className:"text-tremor-label font-medium uppercase text-tremor-content dark:text-dark-tremor-content",children:"Count"})]}),i.jsx("div",{className:"overflow-hidden p-6",children:n?i.jsx(Gl,{data:r,valueFormatter:zke}):i.jsx(Fb,{className:"min-h-[150px]"})})]})}function Y7(e){return new Date(e).toLocaleString("en-GB",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function RE(e){return new Date(e).toLocaleString("en-GB",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function rw(e){return Array.isArray(e)?e.map(t=>{const r={...t,date:RE(t.date)};return t.median_response_time!=null&&(r.p50=t.median_response_time),t.p90_response_time!=null&&(r.p90=t.p90_response_time),t.p95_response_time!=null&&(r.p95=t.p95_response_time),t.p99_response_time!=null&&(r.p99=t.p99_response_time),r}):[]}function Uke(e){const t={};return Array.isArray(e)&&e.forEach(r=>{const n=r?.series;!n||typeof n!="object"||Object.entries(n).forEach(([a,o])=>{const s=typeof o=="number"?o:o?.count;if(s==null)return;const l=Number(s);Number.isNaN(l)||(t[a]=(t[a]??0)+l)})}),t}const PR=e=>{const t=Number(e);return Number.isNaN(t)?"0":Intl.NumberFormat("us").format(t)};function qke({tag:e}){return e?i.jsx(sl,{tag:e}):i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:"All operations"})}function AR(e,t,{includeTopMargin:r=!0,layout:n="overview"}={}){const a=n==="compare",o="mt-6 grid grid-cols-1 gap-4";return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:r?"mt-6":"",children:i.jsx(Mke,{overall:e?.overall})}),i.jsxs("div",{className:a?o:"mt-6 grid grid-cols-2 gap-4 md:grid-cols-2 lg:grid-cols-2",children:[i.jsx(_ke,{title:"Traffic Volume",data:t}),i.jsx(bp,{title:"Average Response Times",data:t,metricKey:["min_response_time","average_response_time","max_response_time"],metricUnit:"ms",highlightValue:e?.overall?.average_response_time,highlightLabel:"Average Response Time"})]}),i.jsx("div",{className:"mt-6 grid grid-cols-1",children:i.jsx(Bke,{title:"HTTP Request duration: p50, p90, p95, p99",data:t})}),a?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:o,children:[i.jsx(bp,{title:"Success / Error Rate",data:t,metricKey:["success","errors"],metricUnit:"",highlightValue:e?.overall?.average_errors,highlightLabel:"Average Errors"}),i.jsx(Os,{title:"Top Endpoints",data:e?.top_endpoints?.all,toggleable:!1})]}),i.jsxs("div",{className:o,children:[i.jsx(Dl,{title:"Method Ratio",description:"Distribution of HTTP methods",data:e?.totals?.method}),i.jsx(Dl,{title:"Protocol Ratio",description:"Distribution of protocols",data:e?.totals?.protocol}),i.jsx(Dl,{title:"Status Ratio",description:"Distribution of HTTP status codes",data:e?.totals?.status}),i.jsx(Os,{title:"Top Failed Endpoints",data:e?.top_endpoints?.error,toggleable:!1})]}),i.jsxs("div",{className:o,children:[i.jsx(Os,{title:"Top Fastest Endpoints (P95)",data:e?.top_endpoints?.fastest,toggleable:!1}),i.jsx(Os,{title:"Top Slowest Endpoints (P95)",data:e?.top_endpoints?.slowest,toggleable:!1})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mt-6 grid grid-cols-3 gap-4 items-stretch",children:[i.jsx("div",{className:"col-span-2",children:i.jsx(bp,{title:"Success / Error Rate",data:t,metricKey:["success","errors"],metricUnit:"",highlightValue:e?.overall?.average_errors,highlightLabel:"Average Errors"})}),i.jsx("div",{className:"col-span-1",children:i.jsx(Os,{title:"Top Endpoints",data:e?.top_endpoints?.all,toggleable:!1})})]}),i.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-4 lg:grid-cols-4",children:[i.jsx(Dl,{title:"Method Ratio",description:"Distribution of HTTP methods",data:e?.totals?.method}),i.jsx(Dl,{title:"Protocol Ratio",description:"Distribution of protocols",data:e?.totals?.protocol}),i.jsx(Dl,{title:"Status Ratio",description:"Distribution of HTTP status codes",data:e?.totals?.status}),i.jsx(Os,{title:"Top Failed Endpoints",data:e?.top_endpoints?.error,toggleable:!1})]}),i.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-4 md:grid-cols-2 lg:grid-cols-2",children:[i.jsx(Os,{title:"Top Fastest Endpoints (P95)",data:e?.top_endpoints?.fastest,toggleable:!1}),i.jsx(Os,{title:"Top Slowest Endpoints (P95)",data:e?.top_endpoints?.slowest,toggleable:!1})]})]})]})}function Rl(e,t=10){return!e||typeof e!="object"?[]:Object.entries(e).map(([r,n])=>{const a=Number(n?.count??0),o=Number(n?.request_tokens??0),s=Number(n?.response_tokens??0),l=n?.total_tokens!=null?Number(n.total_tokens):o+s;return{name:r,count:a,totalTokens:l}}).sort((r,n)=>n.count-r.count).slice(0,t)}function nw(e,t=5){const r=Array.isArray(e)?e:[];if(!r.length)return{data:[],keys:[],topLabel:""};const n=new Map;r.forEach(c=>{const u=c?.series;!u||typeof u!="object"||Object.entries(u).forEach(([d,f])=>{const p=Number(f?.count??0);n.set(d,(n.get(d)??0)+p)})});const a=[...n.entries()].sort((c,u)=>u[1]-c[1]).slice(0,t),o=a.map(([c])=>c),s=a[0],l=s?`${s[0]} (${PR(s[1])})`:"";return{data:r.map(c=>{const u={date:RE(c.timestamp)};return o.forEach(d=>{u[d]=Number(c?.series?.[d]?.count??0)}),u}),keys:o,topLabel:l}}function ep({title:e,data:t,keys:r,highlightLabel:n,highlightValue:a}){return!Array.isArray(t)||t.length===0||!Array.isArray(r)||r.length===0?i.jsxs(Dt,{className:"mt-4 rounded-tremor-small p-2",children:[i.jsx("h3",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),i.jsx("div",{className:"p-6",children:i.jsx(Fb,{className:"min-h-[180px]"})})]}):i.jsx(bp,{title:e,data:t,metricKey:r,metricUnit:"",highlightLabel:n,highlightValue:a})}function X7({label:e,tag:t,stats:r,intervalData:n,loading:a}){const o=!!r;return i.jsxs("div",{className:"rounded-tremor-small border border-tremor-border bg-tremor-background p-4 shadow-sm dark:border-dark-tremor-border dark:bg-gray-950",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),i.jsx("div",{className:"mt-1",children:i.jsx(qke,{tag:t})})]}),a?i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Loading…"}):null]}),o?i.jsx("div",{className:"mt-4",children:AR(r,n,{includeTopMargin:!1,layout:"compare"})}):i.jsx("p",{className:"mt-4 text-sm text-gray-500 dark:text-gray-400",children:a?"Loading statistics…":"No data available for this selection."})]})}function Vke({route:e}){const{client:t}=fr();vo("feat_statistics_compare",!1,!0);const[r,n]=m.useState(null),[a,o]=m.useState(!1),[s,l]=m.useState(null),[c,u]=m.useState("hour"),[d,f]=m.useState([]),[p,h]=m.useState(!1),[g,b]=m.useState(""),[y,v]=m.useState(null),[k,N]=m.useState("overview"),[w,E]=m.useState(null),[C,O]=m.useState(void 0),[D,A]=m.useState(null),[M,I]=m.useState(null),[T,R]=m.useState(!1),[L,F]=m.useState(null),[V,H]=m.useState(null),[$,z]=m.useState(null),[W,U]=m.useState({tool:null,prompt:null,resource:null}),[X,Y]=m.useState(!1),[ae,G]=m.useState(null),ee=new Date,re=$b(ee),pe=Bb(ee),[te,se]=m.useState("Today"),[ne,K]=m.useState(re),[ge,ye]=m.useState(pe),[me,Se]=m.useState(!1),[Re,Te]=m.useState(new Date(ee.getTime()-10080*60*1e3).toISOString().split("T")[0]),[Je,rt]=m.useState("00:00"),[De,ut]=m.useState(ee.toISOString().split("T")[0]),[ct,Nt]=m.useState("23:59"),[yt,ft]=m.useState(!1);m.useEffect(()=>{const st=e?.params||{},Ft=st.interval||st.group||"",Er={hourly:"hour",daily:"day",weekly:"week",monthly:"month"}[String(Ft).toLowerCase()]||Ft;["hour","day","week","month"].includes(Er)&&u(Er);const _t=st.from||st.start,Yt=st.to||st.end;if(_t&&Yt){const Qr=new Date(_t),je=new Date(Yt);if(!Number.isNaN(Qr.getTime())&&!Number.isNaN(je.getTime())){K(Qr.toISOString()),ye(je.toISOString()),se("Custom"),Te(Qr.toISOString().split("T")[0]),ut(je.toISOString().split("T")[0]),rt(Qr.toISOString().slice(11,16)),Nt(je.toISOString().slice(11,16)),Se(!1);return}}const Wr=st.range||st.preset,Jr=DE(Wr);Jr&&(se(Jr.label),K(Jr.start),ye(Jr.end),Se(!1))},[e?.params]);const Ct=async st=>{const Ft={from:ne,to:ge,interval:c,tag:st||void 0},[Er,_t,Yt,Wr,Jr,Qr,je,Pe,Ye]=await Promise.all([t.stats.getOverview(Ft),t.stats.getBuckets(Ft),t.stats.aggregateBy("method",{...Ft,order:"-count",metrics:["count"]}),t.stats.aggregateBy("status",{...Ft,order:"-count",metrics:["count"]}),t.stats.getBucketsGroup("protocol",{...Ft}),t.stats.aggregateBy("path",{...Ft,order:"-count",metrics:["count"],limit:10}),t.stats.aggregateBy("path",{...Ft,statusClass:["4xx","5xx"],order:"-count",metrics:["count"],limit:10}),t.stats.aggregateBy("path",{...Ft,order:"+p95_ms",metrics:["count","p95_ms"],limit:10}),t.stats.aggregateBy("path",{...Ft,order:"-p95_ms",metrics:["count","p95_ms"],limit:10})]),Pt=Er?.data??Er?.overall??Er??null,Kt=(_t?.data??[]).map(It=>{const tr=It?.series??{},vn=Number(tr["2xx"]??0),En=Number(tr["3xx"]??0),Sr=Number(tr["4xx"]??0),ra=Number(tr["5xx"]??0),na=(typeof It.requests=="number"?It.requests:It.total_requests)??vn+En+Sr+ra,wl=(typeof It.success=="number"?It.success:void 0)??vn+En,to=(typeof It.errors=="number"?It.errors:void 0)??Sr+ra;return{date:It.timestamp||It.date,total_requests:na,success:wl,errors:to,"2xx":vn,"4xx":Sr,"5xx":ra,average_response_time:It.avg_ms??It.average_response_time,min_response_time:It.min_ms??It.min_response_time,max_response_time:It.max_ms??It.max_response_time,median_response_time:It.p50_ms??It.median_response_time,p90_response_time:It.p90_ms??It.p90_response_time,p95_response_time:It.p95_ms??It.p95_response_time,p99_response_time:It.p99_ms??It.p99_response_time}}),vr={method:Object.fromEntries((Yt?.data?.rows??[]).map(It=>[It.method,It.count])),status:Object.fromEntries((Wr?.data?.rows??[]).map(It=>[String(It.status),It.count])),protocol:Uke(Jr?.data??Jr?.buckets??[])},Lr=It=>(It??[]).map(tr=>({path:tr.path,count:tr.count,p95_response_time:tr.p95_ms??tr.p95_response_time})),Kr={all:Lr(Qr?.data?.rows),error:Lr(je?.data?.rows),fastest:Lr(Pe?.data?.rows),slowest:Lr(Ye?.data?.rows)};return{overall:Pt,by_interval:Kt,totals:vr,top_endpoints:Kr}},Ae=async()=>{if(!t?.stats?.getOverview)return;const st=!!t?.stats?.getMcpOperations,Ft=!!t?.stats?.getMcpBuckets,Er=st||Ft;o(!0),l(null),Er&&(Y(!0),G(null),H(null),z(null),U({tool:null,prompt:null,resource:null}));try{const _t=Ct(y);if(Er){const Wr=[];st&&Wr.push({key:"ops",promise:t.stats.getMcpOperations({from:ne,to:ge})}),Ft&&(Wr.push({key:"buckets",promise:t.stats.getMcpBuckets({from:ne,to:ge,interval:c})}),Wr.push({key:"tool",promise:t.stats.getMcpBuckets({from:ne,to:ge,interval:c,group:"tool"})}),Wr.push({key:"prompt",promise:t.stats.getMcpBuckets({from:ne,to:ge,interval:c,group:"prompt"})}),Wr.push({key:"resource",promise:t.stats.getMcpBuckets({from:ne,to:ge,interval:c,group:"resource"})})),(async()=>{const Jr=await Promise.allSettled(Wr.map(Pe=>Pe.promise)),Qr={tool:null,prompt:null,resource:null};let je=!1;Jr.forEach((Pe,Ye)=>{const Pt=Wr[Ye]?.key;Pe.status==="fulfilled"?(Pt==="ops"&&H(Pe.value),Pt==="buckets"&&z(Pe.value),Pt==="tool"&&(Qr.tool=Pe.value,je=!0),Pt==="prompt"&&(Qr.prompt=Pe.value,je=!0),Pt==="resource"&&(Qr.resource=Pe.value,je=!0)):Pe.reason&&(console.error(Pe.reason),G(Kt=>Kt||Pe.reason?.message||"Failed to load MCP statistics"))}),je&&U(Qr),Y(!1)})()}const Yt=await _t;n(Yt)}catch(_t){console.error(_t),l(_t?.message||"Failed to load statistics")}finally{o(!1)}},ke=async()=>{if(t?.stats?.getOverview&&C!==void 0){R(!0),F(null);try{const st=Ct(w).then(Wr=>(A(Wr),Wr)),Ft=Ct(C).then(Wr=>(I(Wr),Wr)),[Er,_t]=await Promise.allSettled([st,Ft]),Yt=Er.status==="rejected"?Er.reason:_t.status==="rejected"?_t.reason:null;Yt&&(console.error(Yt),F(Yt?.message||"Failed to load comparison data"))}finally{R(!1)}}},Ie=()=>k==="compare"?ke():Ae(),qe=async()=>{try{await t.stats.deleteOperations(),await Ae(),k==="compare"&&await ke()}catch(st){console.error("Error clearing all operation stats:",st)}};m.useEffect(()=>{Ae()},[t,c,ne,ge,y]),m.useEffect(()=>{k==="compare"&&ke()},[t,k,c,ne,ge,w,C]),m.useEffect(()=>{if(!t?.operations?.listTags)return;let st=!1;return(async()=>{try{h(!0),b("");const Ft=await t.operations.listTags();if(st)return;const Er=Array.isArray(Ft?.tags)?[...Ft.tags]:[];Er.sort((_t,Yt)=>_t.localeCompare(Yt)),f(Er)}catch(Ft){if(st)return;console.error("Failed to load tags",Ft),f([]),b(Ft?.message||"Failed to load tags")}finally{st||h(!1)}})(),()=>{st=!0}},[t]),m.useEffect(()=>{y&&(d.includes(y)||v(null))},[d,y]),m.useEffect(()=>{w&&(d.includes(w)||E(null))},[d,w]),m.useEffect(()=>{if(C!=null&&!d.includes(C)){const st=d.find(Ft=>Ft!==w)??null;O(st)}},[d,w,C]),m.useEffect(()=>{if(C!==void 0)return;if(d.length===0){O(null);return}const st=d.find(Ft=>Ft!==w)??d[0];O(st??null)},[d,w,C]);const nt=m.useMemo(()=>rw(r?.by_interval),[r?.by_interval]),dt=V?.data??null,wt=m.useMemo(()=>(Array.isArray($?.data)?$.data:[]).map(st=>({date:RE(st.timestamp),mcp_count:st.count??0,mcp_request_tokens:st.request_tokens??0,mcp_response_tokens:st.response_tokens??0,mcp_total_tokens:st.total_tokens!=null?st.total_tokens:(st.request_tokens??0)+(st.response_tokens??0)})),[$]),pt=m.useMemo(()=>nw(W.tool?.data),[W.tool]),Le=m.useMemo(()=>nw(W.prompt?.data),[W.prompt]),Tt=m.useMemo(()=>nw(W.resource?.data),[W.resource]),er=m.useMemo(()=>{const st=Number(dt?.total?.count??0),Ft=pt.keys.length||Le.keys.length||Tt.keys.length,Er=wt.length>0;return st>0||Ft||Er},[dt,pt,Le,Tt,wt]),qr=m.useMemo(()=>({byTool:Rl(dt?.by_tool),byResource:Rl(dt?.by_resource),byPrompt:Rl(dt?.by_prompt),byMethod:Rl(dt?.by_method),byCategory:Rl(dt?.by_category),bySession:Rl(dt?.by_session)}),[dt]),Ve=m.useMemo(()=>rw(D?.by_interval),[D?.by_interval]),hr=m.useMemo(()=>rw(M?.by_interval),[M?.by_interval]),ir=k==="compare"?1:0,ea=k==="compare"?T:a,cn=C===void 0?null:C,ka=st=>{N(st===1?"compare":"overview")},yi=st=>{se(st.label),K(st.start),ye(st.end),Se(!1)},ta=()=>{Se(!me),me||se("Custom")},Un=()=>{const st=new Date(`${Re}T${Je}:00`),Ft=new Date(`${De}T${ct}:00`);K(st.toISOString()),ye(Ft.toISOString()),se("Custom"),Se(!1)};return i.jsxs(i.Fragment,{children:[i.jsx("header",{children:i.jsxs("div",{className:"sm:flex sm:items-center sm:justify-between",children:[i.jsx("h3",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Inspectr Statistics"}),i.jsxs("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400 sm:mt-0",children:[i.jsx("span",{className:"font-medium",children:"Range:"})," ",Y7(ne)," -"," ",Y7(ge)]})]})}),i.jsxs(Zc,{index:ir,onIndexChange:ka,children:[i.jsxs("div",{className:"relative mt-4",children:[i.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-start md:justify-between",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs(Gc,{className:"w-auto",children:[i.jsx(ca,{children:"Overview"}),i.jsx(ca,{children:"Compare"})]}),k==="overview"?i.jsx(yp,{tags:d,selectedTag:y,onSelect:v,disabled:ea,loading:p,error:g}):i.jsx("div",{className:"flex flex-wrap items-end gap-3",children:i.jsxs("div",{className:"flex flex-row gap-1 items-center",children:[i.jsx(yp,{tags:d,selectedTag:w,onSelect:E,disabled:ea,loading:p,error:g}),i.jsx(yp,{tags:d,selectedTag:cn,onSelect:O,disabled:ea,loading:p,error:g})]})})]}),i.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[i.jsx(LE,{selectedRange:te,onSelect:yi,onCustomClick:ta}),i.jsxs(_E,{className:"w-full sm:w-fit [&>button]:rounded-tremor-small",enableClear:!1,value:c,onValueChange:st=>u(st),children:[i.jsx(qs,{value:"hour",children:"Hourly"}),i.jsx(qs,{value:"day",children:"Daily"}),i.jsx(qs,{value:"week",children:"Weekly"}),i.jsx(qs,{value:"month",children:"Monthly"})]}),i.jsx(uc,{onClick:Ie,disabled:ea,children:ea?"Loading":"Refresh"}),i.jsxs("button",{type:"button",className:"rounded bg-red-500 px-2 py-2 text-xs text-white",onClick:()=>ft(!0),children:[i.jsx("span",{className:"sr-only",children:"Clear all operation stats"}),i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"h-4 w-4","aria-hidden":!0,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"})})]})]})]}),g&&!p?i.jsxs("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:["Tag filter unavailable: ",g]}):null,me&&i.jsxs("div",{className:"absolute top-full right-0 z-10 mt-2 flex flex-wrap items-center gap-2 rounded bg-gray-50 p-3 shadow dark:bg-gray-800",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Start Date"}),i.jsx("input",{type:"date",value:Re,onChange:st=>Te(st.target.value),className:"rounded border px-2 py-1 focus:outline-none focus:ring-2 focus:ring-tremor-brand dark:border-gray-600 dark:bg-gray-700"})]}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Start Time"}),i.jsx("input",{type:"time",value:Je,onChange:st=>rt(st.target.value),className:"rounded border px-2 py-1 focus:outline-none focus:ring-2 focus:ring-tremor-brand dark:border-gray-600 dark:bg-gray-700"})]}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"End Date"}),i.jsx("input",{type:"date",value:De,onChange:st=>ut(st.target.value),className:"rounded border px-2 py-1 focus:outline-none focus:ring-2 focus:ring-tremor-brand dark:border-gray-600 dark:bg-gray-700"})]}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"End Time"}),i.jsx("input",{type:"time",value:ct,onChange:st=>Nt(st.target.value),className:"rounded border px-2 py-1 focus:outline-none focus:ring-2 focus:ring-tremor-brand dark:border-gray-600 dark:bg-gray-700"})]}),i.jsx("div",{className:"flex items-end",children:i.jsx(uc,{onClick:Un,className:"ml-2",children:"Apply"})})]})]}),i.jsxs(Jc,{children:[i.jsxs(ua,{children:[s?i.jsxs("p",{className:"mt-4 text-red-600 dark:text-red-400",children:["Error: ",s]}):null,i.jsx("main",{className:"mt-6",children:AR(r,nt)}),X||ae||er?i.jsxs("section",{className:"mt-10",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("h4",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"MCP Usage"}),X?i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Loading MCP stats…"}):null]}),ae?i.jsxs("p",{className:"mt-2 text-sm text-red-600 dark:text-red-400",children:["MCP stats error: ",ae]}):null,!X&&!ae&&er?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mt-4",children:i.jsx(Hke,{total:dt.total})}),i.jsx("div",{className:"mt-6",children:i.jsx(ep,{title:"MCP Usage Trend",data:wt,keys:["mcp_count","mcp_total_tokens"],highlightValue:PR(dt?.total?.count),highlightLabel:"Total MCP Requests"})}),i.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-4 xl:grid-cols-3",children:[i.jsx(ep,{title:"Tools Usage Over Time",data:pt.data,keys:pt.keys,highlightLabel:"Top Tool",highlightValue:pt.topLabel}),i.jsx(ep,{title:"Prompts Usage Over Time",data:Le.data,keys:Le.keys,highlightLabel:"Top Prompt",highlightValue:Le.topLabel}),i.jsx(ep,{title:"Resources Usage Over Time",data:Tt.data,keys:Tt.keys,highlightLabel:"Top Resource",highlightValue:Tt.topLabel})]}),i.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-4 xl:grid-cols-2",children:[i.jsx(Ll,{title:"By Tool",items:qr.byTool}),i.jsx(Ll,{title:"By Resource",items:qr.byResource}),i.jsx(Ll,{title:"By Prompt",items:qr.byPrompt}),i.jsx(Ll,{title:"By Method",items:qr.byMethod}),i.jsx(Ll,{title:"By Category",items:qr.byCategory}),i.jsx(Ll,{title:"By Session",items:qr.bySession})]})]}):null]}):null]}),i.jsxs(ua,{children:[L?i.jsxs("p",{className:"mt-4 text-red-600 dark:text-red-400",children:["Comparison error: ",L]}):null,i.jsx("main",{className:"mt-6",children:i.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-2",children:[i.jsx(X7,{label:"Input A",tag:w,stats:D,intervalData:Ve,loading:T}),i.jsx(X7,{label:"Input B",tag:cn,stats:M,intervalData:hr,loading:T})]})})]})]})]}),i.jsx(Fke,{open:yt,onClose:()=>ft(!1),title:"Clear All Operation Stats?",message:"Are you sure you want to clear all operation stats? This action cannot be undone.",onConfirm:qe})]})}const Wke=[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"boolean",label:"Boolean"}],Kke=e=>{if(!Array.isArray(e)||e.length===0)return[];const t=new Set;return e.map(r=>{if(!r||typeof r!="object")return null;const n=r.operator||r.value||r.op;if(!n||typeof n!="string")return null;const a=n.trim();if(!a||t.has(a))return null;t.add(a);const o=Array.isArray(r.aliases)?r.aliases.filter(s=>typeof s=="string"&&s.trim()):[];return{operator:a,label:r.label||r.name||a,description:r.description||"",aliases:o,valueRequired:!!(r.value_required??r.valueRequired??r.requiresValue),multiValue:!!(r.multi_value??r.multiValue)}}).filter(Boolean)},Yke=(e=[])=>e.map(t=>({value:t.operator,label:t.label||t.operator,description:t.description||"",valueRequired:t.valueRequired!==!1,multiValue:t.multiValue===!0})),Xke=(e=[])=>e.reduce((t,r)=>{const n=r.label||r.operator;return t[r.operator]=n,(r.aliases||[]).forEach(a=>{t[a]=n}),t},{}),Gke=(e=[])=>e.reduce((t,r)=>(t[r.operator]=r,(r.aliases||[]).forEach(n=>{t[n]=r}),t),{}),MR=(e=[])=>e[0]?.operator||"",Zke=[{value:"and",label:"All conditions match"},{value:"or",label:"Any condition matches"}],Jke={and:"All conditions must match before actions run.",or:"Any condition may match before actions run."},G7={tag:"Apply static tags",tag_dynamic:"Apply dynamic tags"},jj=e=>typeof e=="boolean"?e:typeof e=="string"?e==="true"||e==="1":!!e,Nj=e=>e?.input==="single_select"&&Array.isArray(e?.choices)&&e.choices.length?e.default!=null?e.default:e.choices[0]?.value??"":typeof e?.type=="string"&&e.type.startsWith("array")?"":e?.type==="object"?{}:e?.type==="boolean"?jj(e.default??!0):e?.default!=null?e.default:"",xp=()=>Math.random().toString(36).slice(2,10),Ej=(e=MR())=>({path:"",operator:e,value:"",valueType:"string"}),pd=e=>({id:xp(),type:e?.type||"",params:(e?.params||[]).reduce((t,r)=>(t[r.name]=Nj(r),t),{})}),hd=e=>Array.isArray(e)?e:typeof e=="string"?e.split(",").map(t=>t.trim()).filter(Boolean):[],Wh=e=>e?Array.isArray(e)?e.flatMap(Wh):e.left&&e.op?[e]:e.args?e.args.flatMap(Wh):[]:[],Qke=e=>typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string",ewe=e=>e==null||e===""?"empty":Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):typeof e=="string"?`"${e}"`:typeof e=="boolean"?e?"true":"false":String(e),twe=e=>G7[e]?G7[e]:e.toString().replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase()),rwe=(e={})=>{const t=Object.entries(e);return t.length===0?"No parameters configured":t.map(([r,n])=>Array.isArray(n)?`${r}: ${n.join(", ")}`:typeof n=="object"&&n!==null?`${r}: ${JSON.stringify(n)}`:typeof n=="boolean"?`${r}: ${n?"true":"false"}`:`${r}: ${n}`).join(" · ")},nwe=e=>{if(!e)return null;const t=new Date(e);if(Number.isNaN(t.getTime()))return null;const r=Date.now()-t.getTime();if(r<0)return t.toLocaleString();const n=Math.round(r/6e4);if(n<1)return"Just now";if(n<60)return`${n}m ago`;const a=Math.round(n/60);if(a<24)return`${a}h ago`;const o=Math.round(a/24);return o<30?`${o}d ago`:t.toLocaleDateString()},Z7=(e,t,r)=>{if(!Array.isArray(e))return e;const n=e.length;if(n===0)return e;const a=(t%n+n)%n,o=(r%n+n)%n;if(a===o)return e;const s=[...e],[l]=s.splice(a,1);return s.splice(o,0,l),s},awe=({variant:e})=>e==="event"?i.jsx("span",{className:"relative flex aspect-square h-9 items-center justify-center rounded-lg bg-orange-600 dark:bg-orange-500","aria-hidden":"true",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-5 shrink-0 text-white","aria-hidden":"true",children:[i.jsx("path",{d:"M12 2v14"}),i.jsx("path",{d:"m19 9-7 7-7-7"}),i.jsx("circle",{cx:"12",cy:"21",r:"1"})]})}):e==="condition"?i.jsx("span",{className:"relative flex aspect-square h-9 items-center justify-center rounded-lg bg-sky-500 dark:bg-sky-500","aria-hidden":"true",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-5 shrink-0 text-white","aria-hidden":"true",children:[i.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),i.jsx("path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3"}),i.jsx("path",{d:"M9 11.2h5.7"})]})}):i.jsx("span",{className:"relative flex aspect-square h-9 items-center justify-center rounded-lg bg-emerald-500 dark:bg-emerald-500","aria-hidden":"true",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-5 shrink-0 text-white","aria-hidden":"true",children:[i.jsx("path",{d:"M22 12A10 10 0 1 1 12 2"}),i.jsx("path",{d:"M22 2 12 12"}),i.jsx("path",{d:"M16 2h6v6"})]})}),owe=(e,t,r)=>{const n=String(e.expression?.op||"and").toLowerCase(),a=Jke[n],o=t[e.event]||{},s=o.name||e.event,l=[e.description,o.description,a].filter(Boolean),c=[{variant:"event",title:s,description:l.join(" · ")}];return Wh(e.expression).forEach((u,d)=>{const f=r?.[u.op]||u.op,p=ewe(u.right),h=[];u.left?.path&&h.push(u.left.path),u.right?.path&&h.push(`Compare to ${u.right.path}`),c.push({variant:"condition",title:`Condition ${d+1}: ${f} ${p}`,description:h.join(" · ")})}),(e.actions||[]).forEach((u,d)=>{c.push({variant:"action",title:`Action ${d+1}: ${twe(u.type)}`,description:rwe(u.params)})}),c},swe=e=>{if(!e||typeof e!="object")return null;const{id:t,updated_at:r,created_at:n,...a}=e,o=`Copy of ${e.name||"Untitled rule"}`;return{...a,name:o,active:!1}},iwe=({rules:e,events:t,loading:r,error:n,isRefreshing:a,openRuleId:o,onToggleRule:s,onRefresh:l,onEditRule:c,onDeleteRule:u,onCreateRule:d,onStartFromTemplate:f,onApplyHistory:p,actionsDisabled:h=!1,onDuplicateRule:g,onPauseRule:b,onExportRule:y,onImportRule:v,meta:k,licenseUsage:N=null,onPageChange:w,paginationAlwaysShow:E=!1,operatorLabelMap:C={}})=>{const O=m.useMemo(()=>t.reduce((L,F)=>(L[F.type]=F,L),{}),[t]),D=typeof k?.total=="number"?k.total:e.length,A=typeof N?.limit=="number"&&!Number.isNaN(N.limit)?N.limit:null,M=typeof N?.used=="number"&&!Number.isNaN(N.used)?N.used:null,I=Number.isFinite(M)?M:D,T=A!==null?`${I}/${A}`:`${I}`,R=A!==null&&Number.isFinite(I)&&I>=A;return i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:NR,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),i.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-50",children:"Rules"}),i.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-100 px-2 py-0.5 text-xs font-semibold text-gray-700 dark:bg-gray-800 dark:text-gray-200",children:T})]}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Overview of automation rules currently available on your workspace."})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("button",{type:"button",onClick:v,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:"Import rule"}),i.jsx("button",{type:"button",onClick:f,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:"Start from template"}),i.jsx("button",{type:"button",onClick:d,className:"inline-flex items-center rounded-md border border-transparent bg-blue-500 px-3 py-1.5 text-sm font-medium text-white shadow-sm transition hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-blue-600 dark:hover:bg-blue-500",children:"Add rule"}),i.jsx("button",{type:"button",onClick:()=>l&&l(),title:"Refresh rules",disabled:a||r,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:a?"Refreshing…":"Refresh"})]})]}),i.jsxs("div",{className:"px-4 py-4",children:[R?i.jsxs("div",{className:"my-2 flex items-center justify-between gap-3 rounded-md bg-gray-50 px-3 py-2 text-sm text-gray-700 ring-1 ring-inset ring-gray-200 dark:bg-gray-900 dark:text-gray-300 dark:ring-gray-800",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-gray-400 dark:bg-gray-400",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"white",className:"size-6",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})})}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("p",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Rules limit reached"}),i.jsx("p",{className:"mt-1 text-xs text-gray-600 dark:text-gray-400",children:"You have used all available rules within your plan. View available plans to unlock more capacity."})]})]}),i.jsx("a",{href:"https://inspectr.dev/pricing",target:"_blank",rel:"noreferrer noopener",className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border px-3 py-2 text-center text-sm font-medium shadow-sm transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-transparent text-white dark:text-white bg-yellow-500 dark:bg-yellow-500 hover:bg-yellow-600 dark:hover:bg-blue-600 disabled:bg-blue-300 disabled:text-white disabled:dark:bg-blue-800 disabled:dark:text-blue-400",children:"Discover Plans"})]}):null,r?i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Loading rules…"}):n?i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:n}):e.length===0?i.jsxs("div",{className:"mt-8 flex h-96 min-h-full flex-1 flex-col justify-center rounded-lg border border-gray-200 bg-gray-50 px-6 py-10 text-center dark:border-gray-700 dark:bg-gray-800",children:[i.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-gray-50",children:"Get started with rules"}),i.jsx("p",{className:"mt-3 mx-auto max-w-xl text-sm text-gray-500 dark:text-gray-400 sm:text-base",children:"Automate how Inspectr responds to captured operations. Add your first rule or choose a template to jump-start your automation flow."}),i.jsxs("div",{className:"mt-8 flex flex-col items-center justify-center gap-3 sm:flex-row",children:[i.jsx("button",{type:"button",onClick:d,disabled:h||r,className:"inline-flex w-full items-center justify-center rounded-md border border-transparent bg-blue-500 px-3 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-blue-600 dark:hover:bg-blue-500 sm:w-auto",children:"Add rule"}),i.jsx("button",{type:"button",onClick:f,disabled:h||r,className:"inline-flex w-full items-center justify-center gap-1 rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-900 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-50 dark:hover:bg-gray-800/60 sm:w-auto",children:"Start from template"})]})]}):i.jsx("div",{className:"space-y-3",children:e.map(L=>{const F=o===L.id,V=owe(L,O,C),H=nwe(L.updated_at||L.created_at);return i.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 dark:border-gray-800",children:[i.jsx("button",{type:"button",onClick:()=>s(F?null:L.id),className:"flex w-full items-center justify-between gap-4 px-4 py-3 text-left text-sm font-medium text-gray-900 transition hover:bg-gray-50 dark:text-gray-100 dark:hover:bg-gray-900/40",children:i.jsxs("div",{className:"flex w-full items-center justify-between gap-4",children:[i.jsxs("div",{className:"truncate",children:[i.jsx("p",{className:"truncate text-sm font-medium text-gray-900 dark:text-gray-50",children:L.name}),i.jsx("p",{className:"mt-0.5 truncate text-xs text-gray-500 dark:text-gray-400",children:L.description||"No description provided"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs font-medium ${L.active?"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300":"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400"}`,children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-3.5","aria-hidden":"true",children:L.active?i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"m9 11 3 3L22 4"}),i.jsx("path",{d:"M21.801 10A10 10 0 1 1 17 3.335"})]}):i.jsx("circle",{cx:"12",cy:"12",r:"10"})}),L.active?"Live":"Inactive"]}),i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`size-5 shrink-0 transition-transform duration-150 text-gray-400 dark:text-gray-600 ${F?"rotate-180":""}`,"aria-hidden":"true",children:i.jsx("path",{d:"m6 9 6 6 6-6"})})]})]})}),F&&i.jsx("div",{className:"border-t border-gray-200 bg-gray-50 px-4 py-5 text-sm dark:border-gray-800 dark:bg-gray-900/40",children:i.jsxs("div",{className:"overflow-hidden pb-4 text-sm text-gray-700 dark:text-gray-200",children:[i.jsx("div",{className:"mx-auto flex w-full items-center justify-between gap-3 text-sm text-gray-500 dark:text-gray-500",children:i.jsx("div",{className:"h-[1px] w-full bg-gray-200 dark:bg-gray-800"})}),i.jsx("ul",{role:"list",className:"mt-6 space-y-6","aria-label":"Rule steps",children:V.map(($,z)=>{const W=z===V.length-1;return i.jsxs("li",{className:"relative flex gap-x-4",children:[!W&&i.jsx("div",{className:"-bottom-6 absolute left-0 top-0 flex w-9 justify-center",children:i.jsx("div",{className:"w-px bg-gray-200 dark:bg-gray-800"})}),i.jsx(awe,{variant:$.variant}),i.jsxs("div",{children:[i.jsxs("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:[z+1,". ",$.title]}),$.description&&i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:$.description})]})]},`${L.id}-step-${z}`)})}),i.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-between gap-3",children:[i.jsx("time",{className:"flex-none text-xs leading-5 text-gray-500 dark:text-gray-500",children:H?`Updated ${H}`:"Updated recently"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>p&&p(L),className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border border-blue-500 px-3 py-1.5 text-sm font-medium text-blue-600 shadow-sm transition hover:bg-blue-50 dark:border-blue-400 dark:text-blue-400 dark:hover:bg-blue-900/20",children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4 -ml-0.5 mr-1.5","aria-hidden":"true",children:i.jsx("path",{d:"M19.3788 15.1057C20.9258 11.4421 19.5373 7.11431 16.0042 5.0745C13.4511 3.60046 10.4232 3.69365 8.03452 5.0556L7.04216 3.31879C10.028 1.61639 13.8128 1.4999 17.0042 3.34245C21.4949 5.93513 23.2139 11.4848 21.1217 16.112L22.4635 16.8867L18.2984 19.1008L18.1334 14.3867L19.3788 15.1057ZM4.62961 8.89968C3.08263 12.5633 4.47116 16.8911 8.00421 18.9309C10.5573 20.4049 13.5851 20.3118 15.9737 18.9499L16.9661 20.6867C13.9803 22.389 10.1956 22.5055 7.00421 20.663C2.51357 18.0703 0.794565 12.5206 2.88672 7.89342L1.54492 7.11873L5.70999 4.90463L5.87505 9.61873L4.62961 8.89968ZM13.4184 14.8311L10.59 12.0027L7.76157 14.8311L6.34736 13.4169L10.59 9.17428L13.4184 12.0027L16.2469 9.17428L17.6611 10.5885L13.4184 14.8311Z"})}),"Apply to history"]}),i.jsxs("button",{type:"button",onClick:()=>c(L),className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-900 shadow-sm transition hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-50 dark:hover:bg-gray-800/30",children:[i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-settings -ml-0.5 mr-1.5 size-4 shrink-0","aria-hidden":"true",children:[i.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),i.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"Edit"]}),i.jsxs("button",{type:"button",onClick:()=>{const $=swe(L);$&&(g?g($):d&&d($))},className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-900 shadow-sm transition hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-50 dark:hover:bg-gray-800/30",title:"Duplicate rule","aria-label":"Duplicate rule",children:[i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4 -ml-0.5 mr-1.5",children:[i.jsx("path",{d:"M9 7a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M5 9a2 2 0 0 1 2-2h1v7a4 4 0 0 0 4 4h7v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V9z"})]}),"Duplicate"]}),i.jsxs("button",{type:"button",onClick:()=>y&&y(L),className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-900 shadow-sm transition hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-50 dark:hover:bg-gray-800/30",title:"Export rule","aria-label":"Export rule",children:[i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"-ml-0.5 mr-1.5 size-4",children:[i.jsx("path",{d:"M5 7v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7"}),i.jsx("path",{d:"M12 3v12"}),i.jsx("path",{d:"m8 11 4 4 4-4"})]}),"Export"]}),i.jsxs("button",{type:"button",onClick:()=>u(L),className:"inline-flex items-center gap-1 rounded-md border border-grey-300 px-2.5 py-1.5 text-xs font-medium text-red-700 transition hover:bg-red-50 dark:border-red-900/40 dark:text-red-300 dark:hover:bg-red-950",children:[i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"-ms-0.5",children:[i.jsx("path",{d:"M3 6h18"}),i.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),i.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),i.jsx("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),i.jsx("line",{x1:"14",x2:"14",y1:"11",y2:"17"})]}),"Delete"]}),i.jsxs("button",{type:"button",onClick:()=>b&&b(L),disabled:h||r,className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-900 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-50 dark:hover:bg-gray-800/30",title:L.active?"Pause rule":"Activate rule",children:[L.active?i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-circle-pause -ml-0.5 mr-1.5 size-4 shrink-0","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("line",{x1:"10",x2:"10",y1:"15",y2:"9"}),i.jsx("line",{x1:"14",x2:"14",y1:"15",y2:"9"})]}):i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-circle-play -ml-0.5 mr-1.5 size-4 shrink-0","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("polygon",{points:"10 8 16 12 10 16"})]}),L.active?"Pause":"Play"]})]})]})]})})]},L.id||L.name)})}),k&&i.jsx(Aj,{meta:k,onPageChange:w,alwaysShow:E})]})]})};function lwe({id:e,descriptor:t,value:r,onChange:n,readOnly:a}){if(!t||t.hidden)return null;const o=t.label||t.name,s=a??!!t.readonly,l=t.help||(t.description?"":t.description);return i.jsxs("div",{className:"space-y-1",children:[i.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[o,t.required&&i.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("input",{id:e,type:"checkbox",disabled:s,checked:!!r,onChange:c=>n(c.target.checked),className:"size-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-900"}),t.description&&i.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:t.description})]}),l&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l})]})}function cwe({id:e,descriptor:t,value:r,onChange:n,provider:a,readOnly:o}){if(!t||t.hidden)return null;const s=t.label||t.name,l=o??!!t.readonly,c=t.help||t.description,u="block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",d=(t.choices||[]).filter(f=>!f.group||!a||f.group===a);return i.jsxs("div",{className:"space-y-1",children:[i.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[s,t.required&&i.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),i.jsx("select",{id:e,disabled:l,value:typeof r=="string"?r:r??"",onChange:f=>n(f.target.value),className:u,children:d.map(f=>i.jsx("option",{value:f.value,title:f.description||"",children:f.label||f.value},f.value))}),c&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:c})]})}function uwe({id:e,descriptor:t,value:r,onChange:n,provider:a,readOnly:o}){if(!t||t.hidden)return null;const s=t.label||t.name,l=o??!!t.readonly,c=t.help||t.description,u="block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",d=r&&typeof r=="object"&&r!==null?r:{},f=(g,b)=>{const y={...d};b?g in y||(y[g]=""):delete y[g],n(y)},p=(g,b)=>{const y={...d};y[g]=b,n(y)},h=(t.choices||[]).filter(g=>!g.group||!a||g.group===a);return i.jsxs("div",{className:"space-y-1",children:[i.jsxs("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[s,t.required&&i.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),i.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:h.map(g=>{const b=g.meta?.key||g.value,y=Object.prototype.hasOwnProperty.call(d,b),v=g.meta?.type||"string",k=(()=>{const N=d[b];if(v==="object"&&typeof N=="object"&&N!==null)try{return JSON.stringify(N)}catch{return String(N)}return N??""})();return i.jsxs("div",{className:"rounded-md border border-gray-200 p-2 dark:border-gray-800",children:[i.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[i.jsx("input",{type:"checkbox",disabled:l,checked:y,onChange:N=>f(b,N.target.checked),className:"mt-1 size-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-900"}),i.jsxs("span",{className:"flex-1",children:[i.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200",children:g.label||g.value}),g.description&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:g.description})]})]}),y&&i.jsx("div",{className:"mt-2",children:v==="object"?i.jsx("textarea",{rows:3,disabled:l,value:k,onChange:N=>p(b,N.target.value),placeholder:g.label,className:u}):i.jsx("input",{type:v==="integer"||v==="number"?"number":"text",disabled:l,value:k,onChange:N=>p(b,N.target.value),placeholder:g.label,className:u})})]},g.value)})}),c&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:c})]})}function dwe({id:e,descriptor:t,value:r,onChange:n,readOnly:a}){if(!t||t.hidden)return null;const o=t.label||t.name,s=a??!!t.readonly,l=t.placeholder||"",c=t.help||t.description;return i.jsxs("div",{className:"space-y-1",children:[i.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[o,t.required&&i.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),i.jsx("input",{id:e,type:"number",step:t.type==="integer"?1:"any",disabled:s,value:r??"",onChange:u=>n(u.target.value),placeholder:l,className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),c&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:c})]})}function fwe({id:e,descriptor:t,value:r,onChange:n,readOnly:a}){if(!t||t.hidden)return null;const o=t.label||t.name,s=a??!!t.readonly,l=t.placeholder||"",c=t.help||t.description;return i.jsxs("div",{className:"space-y-1",children:[i.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[o,t.required&&i.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),i.jsx("input",{id:e,type:"text",disabled:s,value:Array.isArray(r)?r.join(", "):r??"",onChange:u=>n(u.target.value),placeholder:l,className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),c&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:c})]})}function mwe({id:e,descriptor:t,value:r,onChange:n,readOnly:a}){if(!t||t.hidden)return null;const o=t.label||t.name,s=a??!!t.readonly,l=t.placeholder||"",c=t.help||t.description,u="block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",d=typeof r=="string"?r:r?JSON.stringify(r,null,2):"";return i.jsxs("div",{className:"space-y-1",children:[i.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[o,t.required&&i.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),i.jsx("textarea",{id:e,rows:4,disabled:s,value:d,onChange:f=>n(f.target.value),placeholder:l,className:u}),c&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:c})]})}function pwe({id:e,descriptor:t,value:r,onChange:n,readOnly:a}){if(!t||t.hidden)return null;const o=t.label||t.name,s=a??!!t.readonly,l=t.placeholder||"",c=t.help||t.description;return i.jsxs("div",{className:"space-y-1",children:[i.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[o,t.required&&i.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),i.jsx("input",{id:e,type:"text",disabled:s,value:typeof r=="string"?r:r??"",onChange:u=>n(u.target.value),placeholder:l,className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),c&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:c})]})}function hwe({id:e,descriptor:t,value:r,onChange:n,readOnly:a}){if(!t||t.hidden)return null;const o=t.label||t.name,s=a??!!t.readonly,l=t.placeholder||"",c=t.help||t.description;return i.jsxs("div",{className:"space-y-1",children:[i.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[o,t.required&&i.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),i.jsx("input",{id:e,type:"password",disabled:s,value:typeof r=="string"?r:r??"",onChange:u=>n(u.target.value),placeholder:l,className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),c&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:c})]})}class gwe{add(t,r,n){if(typeof arguments[0]!="string")for(let a in arguments[0])this.add(a,arguments[0][a],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(a){this[a]=this[a]||[],r&&this[a][n?"unshift":"push"](r)},this)}run(t,r){this[t]=this[t]||[],this[t].forEach(function(n){n.call(r&&r.context?r.context:r,r)})}}class bwe{constructor(t){this.jsep=t,this.registered={}}register(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach(a=>{if(typeof a!="object"||!a.name||!a.init)throw new Error("Invalid JSEP plugin format");this.registered[a.name]||(a.init(this.jsep),this.registered[a.name]=a)})}}class Ee{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+Ee.version}static addUnaryOp(t){return Ee.max_unop_len=Math.max(t.length,Ee.max_unop_len),Ee.unary_ops[t]=1,Ee}static addBinaryOp(t,r,n){return Ee.max_binop_len=Math.max(t.length,Ee.max_binop_len),Ee.binary_ops[t]=r,n?Ee.right_associative.add(t):Ee.right_associative.delete(t),Ee}static addIdentifierChar(t){return Ee.additional_identifier_chars.add(t),Ee}static addLiteral(t,r){return Ee.literals[t]=r,Ee}static removeUnaryOp(t){return delete Ee.unary_ops[t],t.length===Ee.max_unop_len&&(Ee.max_unop_len=Ee.getMaxKeyLen(Ee.unary_ops)),Ee}static removeAllUnaryOps(){return Ee.unary_ops={},Ee.max_unop_len=0,Ee}static removeIdentifierChar(t){return Ee.additional_identifier_chars.delete(t),Ee}static removeBinaryOp(t){return delete Ee.binary_ops[t],t.length===Ee.max_binop_len&&(Ee.max_binop_len=Ee.getMaxKeyLen(Ee.binary_ops)),Ee.right_associative.delete(t),Ee}static removeAllBinaryOps(){return Ee.binary_ops={},Ee.max_binop_len=0,Ee}static removeLiteral(t){return delete Ee.literals[t],Ee}static removeAllLiterals(){return Ee.literals={},Ee}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new Ee(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(r=>r.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return Ee.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!Ee.binary_ops[String.fromCharCode(t)]||Ee.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return Ee.isIdentifierStart(t)||Ee.isDecimalDigit(t)}throwError(t){const r=new Error(t+" at character "+this.index);throw r.index=this.index,r.description=t,r}runHook(t,r){if(Ee.hooks[t]){const n={context:this,node:r};return Ee.hooks.run(t,n),n.node}return r}searchHook(t){if(Ee.hooks[t]){const r={context:this};return Ee.hooks[t].find(function(n){return n.call(r.context,r),r.node}),r.node}}gobbleSpaces(){let t=this.code;for(;t===Ee.SPACE_CODE||t===Ee.TAB_CODE||t===Ee.LF_CODE||t===Ee.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),r=t.length===1?t[0]:{type:Ee.COMPOUND,body:t};return this.runHook("after-all",r)}gobbleExpressions(t){let r=[],n,a;for(;this.index<this.expr.length;)if(n=this.code,n===Ee.SEMCOL_CODE||n===Ee.COMMA_CODE)this.index++;else if(a=this.gobbleExpression())r.push(a);else if(this.index<this.expr.length){if(n===t)break;this.throwError('Unexpected "'+this.char+'"')}return r}gobbleExpression(){const t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,Ee.max_binop_len),r=t.length;for(;r>0;){if(Ee.binary_ops.hasOwnProperty(t)&&(!Ee.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!Ee.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=r,t;t=t.substr(0,--r)}return!1}gobbleBinaryExpression(){let t,r,n,a,o,s,l,c,u;if(s=this.gobbleToken(),!s||(r=this.gobbleBinaryOp(),!r))return s;for(o={value:r,prec:Ee.binaryPrecedence(r),right_a:Ee.right_associative.has(r)},l=this.gobbleToken(),l||this.throwError("Expected expression after "+r),a=[s,o,l];r=this.gobbleBinaryOp();){if(n=Ee.binaryPrecedence(r),n===0){this.index-=r.length;break}o={value:r,prec:n,right_a:Ee.right_associative.has(r)},u=r;const d=f=>o.right_a&&f.right_a?n>f.prec:n<=f.prec;for(;a.length>2&&d(a[a.length-2]);)l=a.pop(),r=a.pop().value,s=a.pop(),t={type:Ee.BINARY_EXP,operator:r,left:s,right:l},a.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+u),a.push(o,t)}for(c=a.length-1,t=a[c];c>1;)t={type:Ee.BINARY_EXP,operator:a[c-1].value,left:a[c-2],right:t},c-=2;return t}gobbleToken(){let t,r,n,a;if(this.gobbleSpaces(),a=this.searchHook("gobble-token"),a)return this.runHook("after-token",a);if(t=this.code,Ee.isDecimalDigit(t)||t===Ee.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===Ee.SQUOTE_CODE||t===Ee.DQUOTE_CODE)a=this.gobbleStringLiteral();else if(t===Ee.OBRACK_CODE)a=this.gobbleArray();else{for(r=this.expr.substr(this.index,Ee.max_unop_len),n=r.length;n>0;){if(Ee.unary_ops.hasOwnProperty(r)&&(!Ee.isIdentifierStart(this.code)||this.index+r.length<this.expr.length&&!Ee.isIdentifierPart(this.expr.charCodeAt(this.index+r.length)))){this.index+=n;const o=this.gobbleToken();return o||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:Ee.UNARY_EXP,operator:r,argument:o,prefix:!0})}r=r.substr(0,--n)}Ee.isIdentifierStart(t)?(a=this.gobbleIdentifier(),Ee.literals.hasOwnProperty(a.name)?a={type:Ee.LITERAL,value:Ee.literals[a.name],raw:a.name}:a.name===Ee.this_str&&(a={type:Ee.THIS_EXP})):t===Ee.OPAREN_CODE&&(a=this.gobbleGroup())}return a?(a=this.gobbleTokenProperty(a),this.runHook("after-token",a)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let r=this.code;for(;r===Ee.PERIOD_CODE||r===Ee.OBRACK_CODE||r===Ee.OPAREN_CODE||r===Ee.QUMARK_CODE;){let n;if(r===Ee.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==Ee.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),r=this.code}this.index++,r===Ee.OBRACK_CODE?(t={type:Ee.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),r=this.code,r!==Ee.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):r===Ee.OPAREN_CODE?t={type:Ee.CALL_EXP,arguments:this.gobbleArguments(Ee.CPAREN_CODE),callee:t}:(r===Ee.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),t={type:Ee.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),n&&(t.optional=!0),this.gobbleSpaces(),r=this.code}return t}gobbleNumericLiteral(){let t="",r,n;for(;Ee.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===Ee.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);Ee.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(r=this.char,r==="e"||r==="E"){for(t+=this.expr.charAt(this.index++),r=this.char,(r==="+"||r==="-")&&(t+=this.expr.charAt(this.index++));Ee.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);Ee.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return n=this.code,Ee.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(n===Ee.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===Ee.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:Ee.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="";const r=this.index,n=this.expr.charAt(this.index++);let a=!1;for(;this.index<this.expr.length;){let o=this.expr.charAt(this.index++);if(o===n){a=!0;break}else if(o==="\\")switch(o=this.expr.charAt(this.index++),o){case"n":t+=`
178
- `;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=o}else t+=o}return a||this.throwError('Unclosed quote after "'+t+'"'),{type:Ee.LITERAL,value:t,raw:this.expr.substring(r,this.index)}}gobbleIdentifier(){let t=this.code,r=this.index;for(Ee.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,Ee.isIdentifierPart(t));)this.index++;return{type:Ee.IDENTIFIER,name:this.expr.slice(r,this.index)}}gobbleArguments(t){const r=[];let n=!1,a=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===t){n=!0,this.index++,t===Ee.CPAREN_CODE&&a&&a>=r.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(o===Ee.COMMA_CODE){if(this.index++,a++,a!==r.length){if(t===Ee.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===Ee.CBRACK_CODE)for(let s=r.length;s<a;s++)r.push(null)}}else if(r.length!==a&&a!==0)this.throwError("Expected comma");else{const s=this.gobbleExpression();(!s||s.type===Ee.COMPOUND)&&this.throwError("Expected comma"),r.push(s)}}return n||this.throwError("Expected "+String.fromCharCode(t)),r}gobbleGroup(){this.index++;let t=this.gobbleExpressions(Ee.CPAREN_CODE);if(this.code===Ee.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:Ee.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:Ee.ARRAY_EXP,elements:this.gobbleArguments(Ee.CBRACK_CODE)}}}const ywe=new gwe;Object.assign(Ee,{hooks:ywe,plugins:new bwe(Ee),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});Ee.max_unop_len=Ee.getMaxKeyLen(Ee.unary_ops);Ee.max_binop_len=Ee.getMaxKeyLen(Ee.binary_ops);const us=e=>new Ee(e).parse(),xwe=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(Ee).filter(e=>!xwe.includes(e)&&us[e]===void 0).forEach(e=>{us[e]=Ee[e]});us.Jsep=Ee;const vwe="ConditionalExpression";var kwe={name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:vwe,test:r,consequent:n,alternate:a},r.operator&&e.binary_ops[r.operator]<=.9){let o=r;for(;o.right.operator&&e.binary_ops[o.right.operator]<=.9;)o=o.right;t.node.test=o.right,o.right=t.node,t.node=r}}else this.throwError("Expected :")}})}};us.plugins.register(kwe);const J7=47,wwe=92;var jwe={name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(this.code===J7){const r=++this.index;let n=!1;for(;this.index<this.expr.length;){if(this.code===J7&&!n){const a=this.expr.slice(r,this.index);let o="";for(;++this.index<this.expr.length;){const l=this.code;if(l>=97&&l<=122||l>=65&&l<=90||l>=48&&l<=57)o+=this.char;else break}let s;try{s=new RegExp(a,o)}catch(l){this.throwError(l.message)}return t.node={type:e.LITERAL,value:s,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=this.code===wwe?2:1}this.throwError("Unclosed Regex")}})}};const aw=43,Nwe=45,zl={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[aw,Nwe],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];zl.assignmentOperators.forEach(n=>e.addBinaryOp(n,zl.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(n){const a=this.code;zl.updateOperators.some(o=>o===a&&o===this.expr.charCodeAt(this.index+1))&&(this.index+=2,n.node={type:"UpdateExpression",operator:a===aw?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!n.node.argument||!t.includes(n.node.argument.type))&&this.throwError(`Unexpected ${n.node.operator}`))}),e.hooks.add("after-token",function(n){if(n.node){const a=this.code;zl.updateOperators.some(o=>o===a&&o===this.expr.charCodeAt(this.index+1))&&(t.includes(n.node.type)||this.throwError(`Unexpected ${n.node.operator}`),this.index+=2,n.node={type:"UpdateExpression",operator:a===aw?"++":"--",argument:n.node,prefix:!1})}}),e.hooks.add("after-expression",function(n){n.node&&r(n.node)});function r(n){zl.assignmentOperators.has(n.operator)?(n.type="AssignmentExpression",r(n.left),r(n.right)):n.operator||Object.values(n).forEach(a=>{a&&typeof a=="object"&&r(a)})}}};us.plugins.register(jwe,zl);us.addUnaryOp("typeof");us.addLiteral("null",null);us.addLiteral("undefined",void 0);const Ewe=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),wr={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return wr.evalBinaryExpression(e,t);case"Compound":return wr.evalCompound(e,t);case"ConditionalExpression":return wr.evalConditionalExpression(e,t);case"Identifier":return wr.evalIdentifier(e,t);case"Literal":return wr.evalLiteral(e,t);case"MemberExpression":return wr.evalMemberExpression(e,t);case"UnaryExpression":return wr.evalUnaryExpression(e,t);case"ArrayExpression":return wr.evalArrayExpression(e,t);case"CallExpression":return wr.evalCallExpression(e,t);case"AssignmentExpression":return wr.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression(e,t){return{"||":(r,n)=>r||n(),"&&":(r,n)=>r&&n(),"|":(r,n)=>r|n(),"^":(r,n)=>r^n(),"&":(r,n)=>r&n(),"==":(r,n)=>r==n(),"!=":(r,n)=>r!=n(),"===":(r,n)=>r===n(),"!==":(r,n)=>r!==n(),"<":(r,n)=>r<n(),">":(r,n)=>r>n(),"<=":(r,n)=>r<=n(),">=":(r,n)=>r>=n(),"<<":(r,n)=>r<<n(),">>":(r,n)=>r>>n(),">>>":(r,n)=>r>>>n(),"+":(r,n)=>r+n(),"-":(r,n)=>r-n(),"*":(r,n)=>r*n(),"/":(r,n)=>r/n(),"%":(r,n)=>r%n()}[e.operator](wr.evalAst(e.left,t),()=>wr.evalAst(e.right,t))},evalCompound(e,t){let r;for(let n=0;n<e.body.length;n++){e.body[n].type==="Identifier"&&["var","let","const"].includes(e.body[n].name)&&e.body[n+1]&&e.body[n+1].type==="AssignmentExpression"&&(n+=1);const a=e.body[n];r=wr.evalAst(a,t)}return r},evalConditionalExpression(e,t){return wr.evalAst(e.test,t)?wr.evalAst(e.consequent,t):wr.evalAst(e.alternate,t)},evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral(e){return e.value},evalMemberExpression(e,t){const r=String(e.computed?wr.evalAst(e.property):e.property.name),n=wr.evalAst(e.object,t);if(n==null)throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);if(!Object.hasOwn(n,r)&&Ewe.has(r))throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);const a=n[r];return typeof a=="function"?a.bind(n):a},evalUnaryExpression(e,t){return{"-":r=>-wr.evalAst(r,t),"!":r=>!wr.evalAst(r,t),"~":r=>~wr.evalAst(r,t),"+":r=>+wr.evalAst(r,t),typeof:r=>typeof wr.evalAst(r,t)}[e.operator](e.argument)},evalArrayExpression(e,t){return e.elements.map(r=>wr.evalAst(r,t))},evalCallExpression(e,t){const r=e.arguments.map(n=>wr.evalAst(n,t));return wr.evalAst(e.callee,t)(...r)},evalAssignmentExpression(e,t){if(e.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const r=e.left.name,n=wr.evalAst(e.right,t);return t[r]=n,t[r]}};class Swe{constructor(t){this.code=t,this.ast=us(this.code)}runInNewContext(t){const r=Object.assign(Object.create(null),t);return wr.evalAst(this.ast,r)}}function Ps(e,t){return e=e.slice(),e.push(t),e}function Sj(e,t){return t=t.slice(),t.unshift(e),t}class Cwe extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}}function ar(e,t,r,n,a){if(!(this instanceof ar))try{return new ar(e,t,r,n,a)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof e=="string"&&(a=n,n=r,r=t,t=e,e=null);const o=e&&typeof e=="object";if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=Object.hasOwn(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.eval=e.eval===void 0?"safe":e.eval,this.ignoreEvalErrors=typeof e.ignoreEvalErrors>"u"?!1:e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||a||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){const s={path:o?e.path:t};o?"json"in e&&(s.json=e.json):s.json=r;const l=this.evaluate(s);if(!l||typeof l!="object")throw new Cwe(l);return l}}ar.prototype.evaluate=function(e,t,r,n){let a=this.parent,o=this.parentProperty,{flatten:s,wrap:l}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof e=="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),s=Object.hasOwn(e,"flatten")?e.flatten:s,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,l=Object.hasOwn(e,"wrap")?e.wrap:l,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,r=Object.hasOwn(e,"callback")?e.callback:r,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,a=Object.hasOwn(e,"parent")?e.parent:a,o=Object.hasOwn(e,"parentProperty")?e.parentProperty:o,e=e.path}if(a=a||null,o=o||null,Array.isArray(e)&&(e=ar.toPathString(e)),!e&&e!==""||!t)return;const c=ar.toPathArray(e);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;const u=this._trace(c,t,["$"],a,o,r).filter(function(d){return d&&!d.isParentSelector});return u.length?!l&&u.length===1&&!u[0].hasArrExpr?this._getPreferredOutput(u[0]):u.reduce((d,f)=>{const p=this._getPreferredOutput(f);return s&&Array.isArray(p)?d=d.concat(p):d.push(p),d},[]):l?[]:void 0};ar.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const r=Array.isArray(e.path)?e.path:ar.toPathArray(e.path);return e.pointer=ar.toPointer(r),e.path=typeof e.path=="string"?e.path:ar.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return ar.toPathString(e[t]);case"pointer":return ar.toPointer(e.path);default:throw new TypeError("Unknown result type")}};ar.prototype._handleCallback=function(e,t,r){if(t){const n=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:ar.toPathString(e.path),t(n,r,e)}};ar.prototype._trace=function(e,t,r,n,a,o,s,l){let c;if(!e.length)return c={path:r,value:t,parent:n,parentProperty:a,hasArrExpr:s},this._handleCallback(c,o,"value"),c;const u=e[0],d=e.slice(1),f=[];function p(h){Array.isArray(h)?h.forEach(g=>{f.push(g)}):f.push(h)}if((typeof u!="string"||l)&&t&&Object.hasOwn(t,u))p(this._trace(d,t[u],Ps(r,u),t,u,o,s));else if(u==="*")this._walk(t,h=>{p(this._trace(d,t[h],Ps(r,h),t,h,o,!0,!0))});else if(u==="..")p(this._trace(d,t,r,n,a,o,s)),this._walk(t,h=>{typeof t[h]=="object"&&p(this._trace(e.slice(),t[h],Ps(r,h),t,h,o,!0))});else{if(u==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:d,isParentSelector:!0};if(u==="~")return c={path:Ps(r,u),value:a,parent:n,parentProperty:null},this._handleCallback(c,o,"property"),c;if(u==="$")p(this._trace(d,t,r,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(u))p(this._slice(u,d,t,r,n,a,o));else if(u.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const h=u.replace(/^\?\((.*?)\)$/u,"$1"),g=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(h);g?this._walk(t,b=>{const y=[g[2]],v=g[1]?t[b][g[1]]:t[b];this._trace(y,v,r,n,a,o,!0).length>0&&p(this._trace(d,t[b],Ps(r,b),t,b,o,!0))}):this._walk(t,b=>{this._eval(h,t[b],b,r,n,a)&&p(this._trace(d,t[b],Ps(r,b),t,b,o,!0))})}else if(u[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(Sj(this._eval(u,t,r.at(-1),r.slice(0,-1),n,a),d),t,r,n,a,o,s))}else if(u[0]==="@"){let h=!1;const g=u.slice(1,-2);switch(g){case"scalar":(!t||!["object","function"].includes(typeof t))&&(h=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===g&&(h=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(h=!0);break;case"number":Number.isFinite(t)&&(h=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(h=!0);break;case"object":t&&typeof t===g&&(h=!0);break;case"array":Array.isArray(t)&&(h=!0);break;case"other":h=this.currOtherTypeCallback(t,r,n,a);break;case"null":t===null&&(h=!0);break;default:throw new TypeError("Unknown value type "+g)}if(h)return c={path:r,value:t,parent:n,parentProperty:a},this._handleCallback(c,o,"value"),c}else if(u[0]==="`"&&t&&Object.hasOwn(t,u.slice(1))){const h=u.slice(1);p(this._trace(d,t[h],Ps(r,h),t,h,o,s,!0))}else if(u.includes(",")){const h=u.split(",");for(const g of h)p(this._trace(Sj(g,d),t,r,n,a,o,!0))}else!l&&t&&Object.hasOwn(t,u)&&p(this._trace(d,t[u],Ps(r,u),t,u,o,s,!0))}if(this._hasParentSelector)for(let h=0;h<f.length;h++){const g=f[h];if(g&&g.isParentSelector){const b=this._trace(g.expr,t,g.path,n,a,o,s);if(Array.isArray(b)){f[h]=b[0];const y=b.length;for(let v=1;v<y;v++)h++,f.splice(h,0,b[v])}else f[h]=b}}return f};ar.prototype._walk=function(e,t){if(Array.isArray(e)){const r=e.length;for(let n=0;n<r;n++)t(n)}else e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t(r)})};ar.prototype._slice=function(e,t,r,n,a,o,s){if(!Array.isArray(r))return;const l=r.length,c=e.split(":"),u=c[2]&&Number.parseInt(c[2])||1;let d=c[0]&&Number.parseInt(c[0])||0,f=c[1]&&Number.parseInt(c[1])||l;d=d<0?Math.max(0,d+l):Math.min(l,d),f=f<0?Math.max(0,f+l):Math.min(l,f);const p=[];for(let h=d;h<f;h+=u)this._trace(Sj(h,t),r,n,a,o,s,!0).forEach(g=>{p.push(g)});return p};ar.prototype._eval=function(e,t,r,n,a,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=a,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;const s=e.includes("@path");s&&(this.currSandbox._$_path=ar.toPathString(n.concat([r])));const l=this.currEval+"Script:"+e;if(!ar.cache[l]){let c=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(s&&(c=c.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)ar.cache[l]=new this.safeVm.Script(c);else if(this.currEval==="native")ar.cache[l]=new this.vm.Script(c);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const u=this.currEval;ar.cache[l]=new u(c)}else if(typeof this.currEval=="function")ar.cache[l]={runInNewContext:u=>this.currEval(c,u)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return ar.cache[l].runInNewContext(this.currSandbox)}catch(c){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+c.message+": "+e)}};ar.cache={};ar.toPathString=function(e){const t=e,r=t.length;let n="$";for(let a=1;a<r;a++)/^(~|\^|@.*?\(\))$/u.test(t[a])||(n+=/^[0-9*]+$/u.test(t[a])?"["+t[a]+"]":"['"+t[a]+"']");return n};ar.toPointer=function(e){const t=e,r=t.length;let n="";for(let a=1;a<r;a++)/^(~|\^|@.*?\(\))$/u.test(t[a])||(n+="/"+t[a].toString().replaceAll("~","~0").replaceAll("/","~1"));return n};ar.toPathArray=function(e){const{cache:t}=ar;if(t[e])return t[e].concat();const r=[],n=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(a,o){return"[#"+(r.push(o)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(a,o){return"['"+o.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(a,o){return";"+o.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(a){const o=a.match(/#(\d+)/u);return!o||!o[1]?a:r[o[1]]});return t[e]=n,t[e].concat()};ar.prototype.safeVm={Script:Swe};const Owe=function(e,t,r){const n=e.length;for(let a=0;a<n;a++){const o=e[a];r(o)&&t.push(e.splice(a--,1)[0])}};class Pwe{constructor(t){this.code=t}runInNewContext(t){let r=this.code;const n=Object.keys(t),a=[];Owe(n,a,c=>typeof t[c]=="function");const o=n.map(c=>t[c]);r=a.reduce((c,u)=>{let d=t[u].toString();return/function/u.test(d)||(d="function "+d),"var "+u+"="+d+";"+c},"")+r,!/(['"])use strict\1/u.test(r)&&!n.includes("arguments")&&(r="var arguments = undefined;"+r),r=r.replace(/;\s*$/u,"");const s=r.lastIndexOf(";"),l=s!==-1?r.slice(0,s+1)+" return "+r.slice(s+1):" return "+r;return new Function(...n,l)(...o)}}ar.prototype.vm={Script:Pwe};const Q7={label:"Inspectr Operation",value:"$",description:"Root object containing the captured request, response, and metadata.",children:[{label:"Version",value:"$.version",description:"Inspectr payload version string."},{label:"Operation ID",value:"$.operation_id",description:"Unique identifier assigned to the captured operation."},{label:"Correlation ID",value:"$.correlation_id",description:"Correlation identifier propagated between services."},{label:"Request",value:"$.request",description:"Incoming HTTP request information.",children:[{label:"Method",value:"$.request.method"},{label:"URL",value:"$.request.url"},{label:"Path",value:"$.request.path"},{label:"Server",value:"$.request.server"},{label:"Client IP",value:"$.request.client_ip"},{label:"HTTP Version",value:"$.request.http_version"},{label:"Headers Size",value:"$.request.headers_size"},{label:"Headers",value:"$.request.headers",description:"Array of request headers as name/value pairs.",children:[{label:"Header Name",value:"$.request.headers[*].name"},{label:"Header Value",value:"$.request.headers[*].value"}]},{label:"Query Parameters",value:"$.request.query_params",description:"Array of query parameters as name/value pairs.",children:[{label:"Query Param Name",value:"$.request.query_params[*].name"},{label:"Query Param Value",value:"$.request.query_params[*].value"}]},{label:"Cookies",value:"$.request.cookies",description:"Array of request cookies.",children:[{label:"Cookie Name",value:"$.request.cookies[*].name"},{label:"Cookie Value",value:"$.request.cookies[*].value"}]},{label:"Body",value:"$.request.body"},{label:"Body Size",value:"$.request.body_size"},{label:"Timestamp",value:"$.request.timestamp"}]},{label:"Response",value:"$.response",description:"Outgoing HTTP response information.",children:[{label:"Status Code",value:"$.response.status"},{label:"Status Text",value:"$.response.status_text"},{label:"HTTP Version",value:"$.response.http_version"},{label:"Headers Size",value:"$.response.headers_size"},{label:"Headers",value:"$.response.headers",description:"Array of response headers as name/value pairs.",children:[{label:"Header Name",value:"$.response.headers[*].name"},{label:"Header Value",value:"$.response.headers[*].value"}]},{label:"Cookies",value:"$.response.cookies",description:"Array of response cookies.",children:[{label:"Cookie Name",value:"$.response.cookies[*].name"},{label:"Cookie Value",value:"$.response.cookies[*].value"}]},{label:"Body",value:"$.response.body"},{label:"Body Size",value:"$.response.body_size"},{label:"Timestamp",value:"$.response.timestamp"},{label:"Event Frames",value:"$.response.event_frames",description:"Server-sent events captured during the operation.",children:[{label:"Frame ID",value:"$.response.event_frames[*].id"},{label:"Frame Event",value:"$.response.event_frames[*].event"},{label:"Frame Data",value:"$.response.event_frames[*].data"},{label:"Frame Timestamp",value:"$.response.event_frames[*].timestamp"}]}]},{label:"Timing",value:"$.timing",description:"Timing metrics for the operation lifecycle.",children:[{label:"Request Timestamp",value:"$.timing.request"},{label:"Response Timestamp",value:"$.timing.response"},{label:"Duration (ms)",value:"$.timing.duration"}]},{label:"Meta",value:"$.meta",description:"Additional metadata captured alongside the operation.",children:[{label:"Proxy",value:"$.meta.proxy",children:[{label:"Instance",value:"$.meta.proxy.instance"},{label:"URL",value:"$.meta.proxy.url"}]},{label:"Ingress",value:"$.meta.ingress",children:[{label:"Headers",value:"$.meta.ingress.headers",description:"Map of ingress headers preserved by Inspectr.",children:[{label:"Header Value by Name",value:'$.meta.ingress.headers["Header-Name"]',description:"Replace Header-Name with the ingress header key."}]}]},{label:"Inspectr",value:"$.meta.inspectr",children:[{label:"Directives",value:"$.meta.inspectr.directives",description:"Map of Inspectr directive headers.",children:[{label:"Directive by Name",value:'$.meta.inspectr.directives["directive-name"]',description:"Replace directive-name with the directive key."}]},{label:"Guard",value:"$.meta.inspectr.guard",description:"Map of Inspectr Guard headers.",children:[{label:"Guard Header by Name",value:'$.meta.inspectr.guard["guard-name"]',description:"Replace guard-name with the guard header key."}]}]},{label:"Tags",value:"$.meta.tags",description:"Array of user-defined tags applied to the operation.",children:[{label:"Tag Value",value:"$.meta.tags[*]"}]}]}]};function Awe(e){const t=[],r=n=>{n&&(n.value&&t.push({value:n.value,label:n.label,description:n.description||""}),n.children&&n.children.length>0&&n.children.forEach(a=>r(a)))};return r(e),t}const e9=Object.freeze({results:[],totalCount:0});function Mwe(e=10){const t=typeof e=="number"&&e>0?e:10,r=Dn(()=>Fr.queryEvents({sort:{field:"time",order:"desc"},page:1,pageSize:t}),[t],e9)||e9,n=Array.isArray(r.results)?r.results:[],a=typeof r.totalCount=="number"?r.totalCount:0;return{results:n,totalCount:a}}const t9=e=>{if(typeof e!="string")return e;const t=e.trim();if(t===""||!(t.startsWith("{")||t.startsWith("[")))return e;try{return JSON.parse(t)}catch{return e}},Twe=e=>{if(!e||typeof e!="object")return e;const t={...e};if(e.request&&typeof e.request=="object"&&(t.request={...e.request},"body"in e.request)){const r=t9(e.request.body);r!==e.request.body&&(t.request.body=r,t.request.__rawBody=e.request.body)}if(e.response&&typeof e.response=="object"&&(t.response={...e.response},"body"in e.response)){const r=t9(e.response.body);r!==e.response.body&&(t.response.body=r,t.response.__rawBody=e.response.body)}return t};function TR(e,t,r=0){return e?e.map(n=>{const a=`${n.value||n.label}-${r}`,o=n.children&&n.children.length>0,s=`${r*12}px`;return i.jsxs("div",{className:"space-y-1",style:{paddingLeft:s},children:[i.jsxs("button",{type:"button",onClick:()=>n.value&&t(n.value),className:`flex w-full flex-col items-start rounded-md px-2 py-1 text-left text-sm transition hover:bg-blue-50 hover:text-blue-600 focus:bg-blue-100 focus:text-blue-700 focus:outline-none dark:hover:bg-blue-500/10 dark:hover:text-blue-300 dark:focus:bg-blue-500/20 dark:focus:text-blue-200 ${n.value?"":"cursor-default text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400"}`,disabled:!n.value,children:[i.jsx("span",{children:n.label}),n.description&&n.value&&i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:n.description})]}),o&&TR(n.children,t,r+1)]},a)}):null}function _R({id:e,value:t,onChange:r,placeholder:n="$.request.path",inputClassName:a="",browseButtonLabel:o="Browse paths",className:s="",disabled:l=!1,enablePreview:c=!1}){const u=m.useId(),d=e||`json-path-input-${u}`,f=`${d}-options`,[p,h]=m.useState(!1),[g,b]=m.useState(""),[y,v]=m.useState(!1),[k,N]=m.useState(""),[w,E]=m.useState(null),[C,O]=m.useState(0),[D,A]=m.useState(""),[M,I]=m.useState(!1),[T,R]=m.useState({}),L=m.useRef(0),F=typeof t=="string"?t.trim():"",{results:V}=Mwe(8),{client:H}=fr(),{detailOperation:$,isFetching:z}=wR(k),W=m.useMemo(()=>Awe(Q7),[]),U=m.useMemo(()=>{const G=g.trim().toLowerCase();return G?W.filter(ee=>ee.value.toLowerCase().includes(G)||ee.label&&ee.label.toLowerCase().includes(G)||ee.description&&ee.description.toLowerCase().includes(G)):W},[W,g]),X=G=>{G&&(r&&r(G),h(!1))};m.useEffect(()=>{if(!c||!y||!V.length)return;const G=V[0]?.id;G&&N(ee=>ee||G)},[c,y,V]),m.useEffect(()=>{if(!c||!y||!H?.operations?.getOperation||!V.length)return;const G=V.map(pe=>pe?.id).filter(Boolean);if(!G.length)return;const ee=G.filter(pe=>!T[pe]);if(!ee.length)return;const re=++L.current;(async()=>{const pe=await Promise.allSettled(ee.map(te=>H.operations.getOperation(te)));L.current===re&&R(te=>{const se={...te};return pe.forEach((ne,K)=>{if(ne.status==="fulfilled"){const ge=ne.value,ye=ee[K];se[ye]=ge}}),se})})().catch(()=>{})},[c,y,V,H,T]),m.useEffect(()=>{if(!c||!y)return;if(!F){E(null),O(0),A(""),I(!1);return}if(!k){E(null),O(0),A("Select an operation to preview"),I(!1);return}const G=$||V.find(ee=>ee.id===k);if(!G){E(null),O(0),A("Selected operation is no longer available"),I(!1);return}I(!0);try{const ee=Twe(G),re=ar({path:F,json:ee}),pe=Array.isArray(re)?re:[re],te=pe.length;O(te),E(te===0?null:te===1?pe[0]:pe),A("")}catch(ee){E(null),O(0),A(ee?.message||"Failed to evaluate JSON path")}finally{I(!1)}},[c,y,F,k,V,$]),m.useEffect(()=>{c||v(!1)},[c]);const Y=()=>{if(!F)return i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Enter a JSON path to preview the matching values."});if(!V.length)return i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"No recent operations available. Capture traffic to preview JSON path results."});if(D)return i.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-600 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300",children:D});if(M||z)return i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Evaluating JSON path…"});if(C===0||w===null||typeof w>"u")return i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"No results found for this JSON path in the selected operation."});const G=(()=>{if(typeof w=="string")return w;if(typeof w=="number"||typeof w=="boolean")return String(w);try{return JSON.stringify(w,null,2)}catch{return String(w)}})();return i.jsxs("div",{className:"min-w-0 space-y-2",children:[C>1&&i.jsxs("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:["Found ",C," matches."]}),i.jsx("div",{className:"w-full min-w-0 max-w-full",children:i.jsx("pre",{className:"max-h-64 w-full max-w-full overflow-y-auto whitespace-pre-wrap break-all rounded-md border border-gray-200 bg-gray-50 p-3 text-xs text-gray-800 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100",children:G})})]})},ae=V.map(G=>{const ee=T[G?.id]||G,re=ee?.request?.method||ee?.method||"GET",pe=ee?.request?.path||ee?.request?.url||ee?.path||ee?.url||"Unknown path",te=ee?.response?.status??ee?.status_code,se=ee?.request?.timestamp||ee?.time,ne=se?new Date(se).toLocaleString():"Unknown time",K=te?`${te}`:"N/A";return{id:G.id,label:`${re} ${pe} • ${K} • ${ne}`}});return i.jsxs("div",{className:`space-y-2 ${s}`,children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx("input",{id:d,list:f,value:t,onChange:G=>r&&r(G.target.value),placeholder:n,className:`block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30 ${a}`,onFocus:()=>!l&&b(""),autoComplete:"off",disabled:l}),i.jsx("datalist",{id:f,children:W.map(G=>i.jsx("option",{value:G.value,children:G.label},G.value))})]}),c&&i.jsx("button",{type:"button",onClick:()=>{l||v(G=>!G)},className:"inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800 dark:focus:border-blue-700 dark:focus:ring-blue-700/30 disabled:cursor-not-allowed disabled:opacity-60",disabled:l,children:y?"Hide preview":"Preview"}),i.jsx("button",{type:"button",onClick:()=>{l||(h(G=>!G),b(""))},className:"inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800 dark:focus:border-blue-700 dark:focus:ring-blue-700/30 disabled:cursor-not-allowed disabled:opacity-60",disabled:l,children:o})]}),p&&!l&&i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white p-3 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:[i.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[i.jsx("input",{type:"text",value:g,onChange:G=>b(G.target.value),placeholder:"Search JSON paths...",className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),i.jsx("button",{type:"button",onClick:()=>h(!1),className:"inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-sm font-medium text-gray-600 transition hover:bg-gray-100 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:"Close"})]}),i.jsx("div",{className:"max-h-64 space-y-1 overflow-y-auto pr-1 text-gray-800 dark:text-gray-100",children:g.trim()?U.length>0?U.map(G=>i.jsxs("button",{type:"button",onClick:()=>X(G.value),className:"flex w-full flex-col items-start rounded-md px-2 py-1 text-left text-sm transition hover:bg-blue-50 hover:text-blue-600 focus:bg-blue-100 focus:text-blue-700 focus:outline-none dark:hover:bg-blue-500/10 dark:hover:text-blue-300 dark:focus:bg-blue-500/20 dark:focus:text-blue-200",children:[i.jsx("span",{children:G.value}),G.label&&i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:G.label}),G.description&&i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500",children:G.description})]},G.value)):i.jsx("p",{className:"px-2 py-4 text-sm text-gray-500 dark:text-gray-400",children:"No matches found."}):TR([Q7],X)})]}),c&&y&&!l&&i.jsxs("div",{className:"space-y-3 rounded-lg border border-gray-200 bg-white p-3 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:`${d}-preview-operation`,className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:"Preview with operation"}),i.jsxs("select",{id:`${d}-preview-operation`,value:k,onChange:G=>N(G.target.value),className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:[i.jsx("option",{value:"",children:"Select an operation…"}),ae.map(G=>i.jsx("option",{value:G.id,children:G.label},G.id))]})]}),i.jsx("div",{children:Y()})]})]})}function _we({id:e,descriptor:t,value:r,onChange:n,readOnly:a}){if(!t||t.hidden)return null;const o=t.label||t.name,s=t.help||t.description,l=t.placeholder||"$.request.path",c=t.meta?.browseLabel||t.meta?.browse_label||"Browse paths",u=a??!!t.readonly,d=typeof r=="string"?r:r??"";return i.jsxs("div",{className:"space-y-1",children:[i.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[o,t.required&&i.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),i.jsx(_R,{id:e,value:d,onChange:n,placeholder:l,browseButtonLabel:c,disabled:u,enablePreview:!0}),s&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s})]})}function ow({id:e,descriptor:t,value:r,onChange:n,provider:a,className:o="",readOnly:s}){if(!t||t.hidden)return null;const l=t.type==="boolean"||t.input==="boolean",c=typeof t.type=="string"&&t.type.startsWith("array"),u=t.input==="single_select"&&Array.isArray(t.choices),d=t.input==="multi_select"&&Array.isArray(t.choices),f=t.type==="integer"||t.type==="number"||t.input==="number",p=t.type==="object"||t.input==="object",h=t.input==="password",g=t.input==="json_path";let b=pwe;return l?b=lwe:u?b=cwe:d?b=uwe:f?b=dwe:c?b=fwe:p?b=mwe:h?b=hwe:g&&(b=_we),i.jsx("div",{className:o,children:i.jsx(b,{id:e,descriptor:t,value:r,onChange:n,provider:a,readOnly:s})})}function Iwe({value:e,options:t=[],onChange:r,disabled:n=!1,className:a=""}){const o=Array.isArray(t)?t:[],s=o.length>0,l=e??"",c=u=>{r?.(u.target.value)};return i.jsx("select",{value:s?l:"",onChange:c,disabled:n||!s,className:a||"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:s?o.map(u=>i.jsx("option",{value:u.value,children:u.label},u.value)):i.jsx("option",{value:"",disabled:!0,children:"No operators available"})})}const r9="block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",Dwe="rounded-md border border-dashed border-gray-300 px-3 py-2 text-sm text-gray-500 dark:border-gray-700 dark:text-gray-400",Lwe=e=>e===!0?"true":e===!1?"false":e===""||e===null||e===void 0?"true":String(e),Rwe=(e,t)=>e?t==="number"?"e.g. 100, 200":"Enter comma-separated values":t==="number"?"e.g. 200":"e.g. /api/payments";function Fwe({value:e,valueType:t="string",valueRequired:r=!0,multiValue:n=!1,onChange:a,className:o,hintClassName:s}){return r?t==="boolean"?i.jsxs("select",{value:Lwe(e),onChange:l=>a?.(l.target.value),className:o||r9,children:[i.jsx("option",{value:"true",children:"true"}),i.jsx("option",{value:"false",children:"false"})]}):i.jsx("input",{type:"text",value:e??"",onChange:l=>a?.(l.target.value),placeholder:Rwe(n,t),className:o||r9}):i.jsx("div",{className:s||Dwe,children:"This operator does not require a comparison value."})}const n9=({onMoveUp:e,onMoveDown:t,disableUp:r,disableDown:n})=>i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:e,disabled:r,"aria-label":"Move up",className:"inline-flex items-center justify-center rounded-md border border-gray-200 p-1 text-gray-500 transition hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:i.jsx("path",{d:"m18 15-6-6-6 6"})})}),i.jsx("button",{type:"button",onClick:t,disabled:n,"aria-label":"Move down",className:"inline-flex items-center justify-center rounded-md border border-gray-200 p-1 text-gray-500 transition hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:i.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),$we=({form:e,events:t,selectedEventDescription:r,actionsCatalog:n,isEditing:a,saving:o,formErrors:s,onSubmit:l,onReset:c,onFieldChange:u,onConditionChange:d,onAddCondition:f,onRemoveCondition:p,onMoveCondition:h,onActionTypeChange:g,onActionParamChange:b,onAddAction:y,onRemoveAction:v,onMoveAction:k,operatorOptions:N,formId:w,hideFooter:E=!1})=>{const C=e.conditions.length>1,O=e.actions.length>1,D=Array.isArray(N)?N:[];return i.jsxs("form",{id:w,className:"space-y-6 rounded-lg border border-gray-200 bg-gray-50 p-4 shadow-sm dark:border-gray-800 dark:bg-[#090E1A]/60 sm:p-6",onSubmit:l,children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"rule-name",className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:a?"Edit Rule":"Rule Name"}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:a?"Update the selected rule and save your changes.":"Define a descriptive name for your rule."})]}),a&&i.jsx("span",{className:"inline-flex items-center rounded-full bg-blue-500/10 px-3 py-1 text-xs font-medium text-blue-600 dark:text-blue-400",children:"Editing"})]}),i.jsx("input",{id:"rule-name",type:"text",value:e.name,onChange:A=>u("name",A.target.value),placeholder:"E.g. Min. Transaction Amount USD",className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#090E1A] dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"rule-description",className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:"Description"}),i.jsx("textarea",{id:"rule-description",rows:3,value:e.description,onChange:A=>u("description",A.target.value),placeholder:"Optional summary for this automation rule",className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#090E1A] dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)]",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"rule-event",className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:"Event Trigger"}),i.jsxs("select",{id:"rule-event",value:e.event,onChange:A=>u("event",A.target.value),className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#090E1A] dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:[t.length===0&&i.jsx("option",{value:"",children:"No events available"}),t.map(A=>i.jsx("option",{value:A.type,children:A.label||A.name||A.type},A.type))]}),t.length>0&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:r||"Select the event to monitor."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"rule-priority",className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:"Priority"}),i.jsx("input",{id:"rule-priority",type:"number",value:e.priority,onChange:A=>u("priority",A.target.value),className:"block w-full max-w-[7rem] rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#090E1A] dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"})]}),i.jsxs("div",{className:"space-y-2 sm:justify-self-end",children:[i.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:"Activation"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("input",{id:"rule-active",type:"checkbox",checked:e.active,onChange:A=>u("active",A.target.checked),className:"size-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-700 dark:bg-gray-900"}),i.jsx("label",{htmlFor:"rule-active",className:"text-sm text-gray-700 dark:text-gray-200",children:"Rule is active"})]})]})]}),i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-[#090E1A]",children:[i.jsxs("div",{className:"border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[i.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Rule Flow"}),i.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:"Configure the event, matching conditions, and resulting actions."})]}),i.jsxs("div",{className:"space-y-6 px-4 py-5",children:[i.jsxs("div",{className:"rounded-lg border-l-4 border-orange-600 bg-orange-50/60 p-4 dark:border-orange-500 dark:bg-orange-500/10",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("span",{className:"flex aspect-square h-10 items-center justify-center rounded-lg bg-orange-600 dark:bg-orange-500","aria-hidden":"true",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-6 text-white",children:[i.jsx("path",{d:"M12 2v14"}),i.jsx("path",{d:"m19 9-7 7-7-7"}),i.jsx("circle",{cx:"12",cy:"21",r:"1"})]})}),i.jsxs("div",{className:"truncate",children:[i.jsx("h5",{className:"text-sm font-medium capitalize text-gray-900 dark:text-gray-50",children:"Event"}),i.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Select the operation event you want to monitor."})]})]}),i.jsxs("div",{className:"mt-4",children:[i.jsx("label",{className:"text-xs font-medium text-gray-900 dark:text-gray-200",htmlFor:"builder-event",children:"Event"}),i.jsx("select",{id:"builder-event",value:e.event,onChange:A=>u("event",A.target.value),className:"mt-2 block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#090E1A] dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:t.map(A=>i.jsx("option",{value:A.type,children:A.name||A.type},A.type))})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsx("h5",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Conditions"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",htmlFor:"expression-type",children:"Condition Logic"}),i.jsx("select",{id:"expression-type",value:e.expressionType,onChange:A=>u("expressionType",A.target.value),className:"rounded-md border border-gray-300 bg-white px-3 py-2 text-xs text-gray-700 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:Zke.map(A=>i.jsx("option",{value:A.value,children:A.label},A.value))})]})]}),e.conditions.map((A,M)=>{const I=D.find(L=>L.value===A.operator)||D[0],T=I?.valueRequired!==!1,R=I?.multiValue===!0;return i.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900",children:i.jsxs("div",{className:"flex items-start gap-4 px-4 py-4",children:[i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx("span",{className:"flex aspect-square h-10 items-center justify-center rounded-lg bg-sky-500","aria-hidden":"true",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-6 text-white",children:[i.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),i.jsx("path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3"}),i.jsx("path",{d:"M9 11.2h5.7"})]})}),i.jsx(n9,{onMoveUp:()=>h(M,M-1),onMoveDown:()=>h(M,M+1),disableUp:!C||M===0,disableDown:!C||M===e.conditions.length-1})]}),i.jsxs("div",{className:"flex-1 space-y-3",children:[i.jsxs("div",{className:"grid gap-3 sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"JSON path"}),i.jsx(_R,{value:A.path,onChange:L=>d(M,"path",L),placeholder:"$.request.path",className:"!space-y-1",browseButtonLabel:"Browse",enablePreview:!0})]}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Operator"}),i.jsx(Iwe,{value:A.operator,options:D,onChange:L=>d(M,"operator",L),disabled:o||D.length===0})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Value Type"}),i.jsx("select",{value:A.valueType,onChange:L=>d(M,"valueType",L.target.value),disabled:!T,className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:Wke.map(L=>i.jsx("option",{value:L.value,children:L.label},L.value))})]})]})]}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Compare value"}),i.jsx(Fwe,{value:A.value,valueType:A.valueType,valueRequired:T,multiValue:R,onChange:L=>d(M,"value",L)})]}),i.jsx("div",{className:"flex flex-wrap items-end justify-end gap-2",children:i.jsx("button",{type:"button",onClick:()=>p(M),className:"inline-flex items-center gap-2 rounded-md border border-transparent px-3 py-2 text-xs font-medium text-red-600 transition hover:border-red-200 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60 dark:text-red-400 dark:hover:border-red-800 dark:hover:bg-red-900/30",disabled:e.conditions.length===1,children:"Remove"})})]})]})]})},M)}),i.jsxs("button",{type:"button",onClick:f,className:"inline-flex items-center gap-2 rounded-md border border-dashed border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:border-gray-400 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:border-gray-500 dark:hover:bg-gray-900",children:[i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4","aria-hidden":"true",children:[i.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add Condition"]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h5",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Actions"}),i.jsxs("button",{type:"button",onClick:y,className:"inline-flex items-center gap-2 rounded-md border border-transparent bg-blue-500 px-3 py-2 text-xs font-medium text-white transition hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-500",children:[i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4","aria-hidden":"true",children:[i.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add Action"]})]}),e.actions.map((A,M)=>{const I=n.find(F=>F.type===A.type),T=I||{params:[]},R=!I&&!!A.type,L=["overflow-hidden rounded-lg border bg-white shadow-sm dark:bg-gray-900",R?"border-amber-300 dark:border-amber-500/40":"border-gray-200 dark:border-gray-800"].join(" ");return i.jsx("div",{className:L,children:i.jsxs("div",{className:"flex items-start gap-4 px-4 py-4",children:[i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx("span",{className:"flex aspect-square h-10 items-center justify-center rounded-lg bg-emerald-500","aria-hidden":"true",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-6 text-white",children:[i.jsx("path",{d:"M22 12A10 10 0 1 1 12 2"}),i.jsx("path",{d:"M22 2 12 12"}),i.jsx("path",{d:"M16 2h6v6"})]})}),i.jsx(n9,{onMoveUp:()=>k(A.id,M-1),onMoveDown:()=>k(A.id,M+1),disableUp:!O||M===0,disableDown:!O||M===e.actions.length-1})]}),i.jsxs("div",{className:"flex-1 space-y-3",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i.jsxs("div",{className:"flex-1 min-w-[180px] space-y-1",children:[i.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Action Type"}),i.jsxs("select",{value:A.type,onChange:F=>g(A.id,F.target.value),className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:[n.length===0&&i.jsx("option",{value:"",children:"No actions available"}),R&&A.type&&i.jsx("option",{value:A.type,children:A.type}),n.map(F=>{const V=F.label||F.name,H=V&&V!==F.type?`${V} (${F.type})`:F.type;return i.jsx("option",{value:F.type,children:H},F.type)})]})]}),R&&i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("span",{className:"inline-flex items-center rounded-full bg-amber-100 px-2.5 py-1 text-xs font-medium text-amber-800 dark:bg-amber-500/10 dark:text-amber-200",children:"Connector disabled"})}),i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("button",{type:"button",onClick:()=>v(A.id),className:"inline-flex items-center gap-2 rounded-md border border-transparent px-3 py-2 text-xs font-medium text-red-600 transition hover:border-red-200 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60 dark:text-red-400 dark:hover:border-red-800 dark:hover:bg-red-900/30",disabled:e.actions.length===1,children:"Remove"})})]}),T?.description&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:T.description}),R&&i.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:border-amber-500/30 dark:bg-amber-950/40 dark:text-amber-100",children:[i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mt-0.5 size-4 flex-shrink-0","aria-hidden":"true",children:[i.jsx("path",{d:"M10.29 3.86 1.82 18a1 1 0 0 0 .86 1.5h18.64a1 1 0 0 0 .86-1.5L13.71 3.86a1 1 0 0 0-1.72 0Z"}),i.jsx("path",{d:"M12 9v4"}),i.jsx("path",{d:"M12 17h.01"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"font-semibold",children:"Action unavailable"}),i.jsx("p",{className:"mt-1 text-amber-700 dark:text-amber-200/80",children:"This action is unavailable because its connector is disabled. The existing configuration is kept when you save, but the action will be skipped until the connector is enabled again."})]})]}),i.jsx("div",{className:"space-y-4",children:(T.params||[]).map(F=>{if(F.hidden)return null;const V=`${A.id}-${F.name}`,H=A.params?.[F.name];F.type==="boolean"||F.input,typeof F.type=="string"&&F.type.startsWith("array"),F.input==="single_select"&&Array.isArray(F.choices),F.input==="multi_select"&&Array.isArray(F.choices),F.type==="integer"||F.type==="number"||F.input;const $=F.type==="object"||F.input==="object";F.input,F.readonly;const z=i.jsxs("label",{htmlFor:V,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[F.label||F.name,F.required&&i.jsx("span",{className:"ml-1 text-red-500",children:"*"})]});if($&&Array.isArray(F.variants)&&F.variants.length){const W=A.params?.provider,U=F.variants.find(Y=>Y.value===W),X=H&&typeof H=="object"?H:{};return i.jsxs("div",{className:"space-y-2",children:[z,W?U?i.jsxs("div",{className:"space-y-3 rounded-md border border-gray-200 p-3 dark:border-gray-800",children:[U.description&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:U.description}),(U.params||[]).map(Y=>{if(Y.hidden)return null;const ae=`${V}-${Y.name}`;Y.type==="boolean"||Y.input,Y.type==="integer"||Y.type==="number"||Y.input,typeof Y.type=="string"&&Y.type.startsWith("array"),Y.type==="object"||Y.input,Y.input==="single_select"&&Array.isArray(Y.choices),Y.input,Y.readonly;const G=X?.[Y.name],ee=re=>{b(A.id,F.name,{...X,[Y.name]:re})};return i.jsx(ow,{id:ae,descriptor:Y,provider:A.params?.provider,value:G,onChange:re=>ee(re)},Y.name)})]}):i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:['No options available for provider "',W,'".']}):i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:"Select a provider to configure options."}),(F.description||F.help)&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:F.description||F.help})]},F.name)}return $?i.jsx(ow,{id:V,descriptor:F,provider:A.params?.provider,value:H,onChange:W=>b(A.id,F.name,W)},F.name):i.jsx(ow,{id:V,descriptor:F,provider:A.params?.provider,value:H,onChange:W=>b(A.id,F.name,W)},F.name)})})]})]})},A.id)}),i.jsxs("button",{type:"button",onClick:y,className:"inline-flex items-center gap-2 rounded-md border border-dashed border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:border-gray-400 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:border-gray-500 dark:hover:bg-gray-900",children:[i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4","aria-hidden":"true",children:[i.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add Action"]})]})]})]}),s.length>0&&i.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-900/30 dark:text-red-300",children:i.jsx("ul",{className:"list-disc space-y-1 pl-4",children:s.map((A,M)=>i.jsx("li",{children:A},M))})}),!E&&i.jsxs("div",{className:"sticky bottom-0 z-10 -mx-4 -mb-4 flex items-center justify-end gap-3 border-t border-gray-200 bg-gray-50/95 px-4 py-3 backdrop-blur supports-[backdrop-filter]:backdrop-blur dark:border-gray-800 dark:bg-[#090E1A]/95 sm:-mx-6 sm:px-6",children:[i.jsx("button",{type:"button",onClick:c,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:a?"Cancel edit":"Reset"}),i.jsx("button",{type:"submit",disabled:o,className:"inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-300 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-blue-500 dark:hover:bg-blue-400",children:o?"Saving…":a?"Update Rule":"Save Rule"})]})]})};function Bwe({open:e,title:t,description:r,onClose:n,children:a,footer:o=null,showFooter:s=!0,onReset:l,onSave:c,saving:u=!1,isEditing:d=!1,formId:f}){return e?i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:i.jsxs("div",{className:"flex max-h-[94vh] w-full max-w-[70%] flex-col overflow-hidden rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800 sm:px-6",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:t}),r&&i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r})]}),i.jsx("button",{type:"button",onClick:n,className:"inline-flex items-center rounded-md border border-gray-300 p-2 text-gray-500 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800","aria-label":"Close builder dialog",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:[i.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),i.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]})})]}),i.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4 sm:px-6",children:a}),(o||s)&&i.jsx("div",{className:"border-t border-gray-200 bg-gray-50 px-4 py-3 dark:border-gray-800 dark:bg-gray-900 sm:px-6",children:o||i.jsxs("div",{className:"flex items-center justify-end gap-3",children:[l?i.jsx("button",{type:"button",onClick:l,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:d?"Cancel edit":"Reset"}):null,i.jsx("button",{type:f?"submit":"button",form:f,onClick:f?void 0:c,disabled:u,className:"inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-300 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-blue-500 dark:hover:bg-blue-400",children:u?"Saving…":d?"Update Rule":"Save Rule"})]})})]})}):null}function Hwe({open:e,groupedTemplates:t,loading:r,error:n,onClose:a,onRetry:o,onSelect:s}){const[l,c]=x.useState(null),[u,d]=x.useState("");x.useEffect(()=>{if(!e){c(null),d("");return}if(t.length===0){c(null);return}t.some(h=>h.id===l)||c(t[0]?.id??null)},[e,t,l]);const f=x.useMemo(()=>t.find(h=>h.id===l)??null,[t,l]),p=x.useMemo(()=>{if(!f)return[];if(!u.trim())return f.items;const h=u.toLowerCase();return f.items.filter(g=>{const b=g.name?.toLowerCase()??"",y=g.description?.toLowerCase()??"";return b.includes(h)||y.includes(h)})},[f,u]);return e?i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:i.jsxs("div",{className:"w-full max-w-5xl overflow-hidden rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800 sm:px-6",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"Start from a template"}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Choose a starter rule and customise it to fit your automation workflow."})]}),i.jsx("button",{type:"button",onClick:a,className:"inline-flex items-center rounded-md border border-gray-300 p-2 text-gray-500 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800","aria-label":"Close template dialog",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:[i.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),i.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]})})]}),i.jsx("div",{className:"max-h-[80vh] overflow-y-auto px-4 py-6 sm:px-6",children:r?i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Loading templates…"}):n?i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:n}),i.jsx("button",{type:"button",onClick:o,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",children:"Try again"})]}):t.length===0?i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"No templates available right now."}):i.jsxs("div",{className:"grid gap-6 lg:grid-cols-[260px,1fr]",children:[i.jsxs("aside",{className:"space-y-4",children:[i.jsx("h4",{className:"text-sm font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:"Template groups"}),i.jsx("div",{className:"space-y-2",children:t.map(h=>{const g=h.id===l;return i.jsx("button",{type:"button",onClick:()=>{c(h.id),d("")},className:`w-full rounded-md border px-4 py-3 text-left transition ${g?"border-blue-500 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-900/30 dark:text-blue-100":"border-gray-200 bg-white text-gray-900 hover:border-blue-300 hover:bg-blue-50/60 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-100 dark:hover:border-blue-500/70 dark:hover:bg-blue-900/20"}`,children:i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-semibold",children:h.label}),h.description&&i.jsx("p",{className:"mt-1 text-xs text-gray-600 dark:text-gray-400",children:h.description})]}),i.jsx("span",{className:"rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-600 dark:bg-gray-800 dark:text-gray-300",children:h.items.length})]})},h.id)})})]}),i.jsxs("section",{className:"space-y-4",children:[i.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"text-base font-semibold text-gray-900 dark:text-gray-50",children:f?.label??"Select a group"}),f?.description&&i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:f.description})]}),f&&i.jsxs("div",{className:"relative w-full sm:w-64",children:[i.jsx("label",{htmlFor:"template-search",className:"sr-only",children:"Search templates"}),i.jsx("input",{id:"template-search",type:"search",value:u,onChange:h=>d(h.target.value),placeholder:"Search templates",className:"w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm outline-none transition focus:border-blue-500 focus:ring-2 focus:ring-blue-500/40 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100"}),i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-gray-400 dark:text-gray-500","aria-hidden":"true",children:[i.jsx("circle",{cx:"11",cy:"11",r:"8"}),i.jsx("path",{d:"m21 21-3.6-3.6"})]})]})]}),f?p.length===0?i.jsx("div",{className:"rounded-md border border-dashed border-gray-300 p-6 text-center text-sm text-gray-600 dark:border-gray-700 dark:text-gray-400",children:"No templates match your search in this group."}):i.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:p.map(h=>i.jsxs("div",{className:"flex h-full flex-col justify-between rounded-lg border border-gray-200 bg-white p-4 shadow-sm transition hover:border-blue-400 hover:shadow-md dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("h5",{className:"text-base font-semibold text-gray-900 dark:text-gray-50",children:h.name}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:h.description}),i.jsxs("div",{className:"mt-3 space-y-1 text-xs text-gray-500 dark:text-gray-500",children:[i.jsxs("p",{children:[i.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:"Event:"})," ",h.event]}),i.jsxs("p",{children:[i.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:"Actions:"})," ",h.actions?.length||0]})]})]}),i.jsx("button",{type:"button",onClick:()=>s(h),className:"mt-4 inline-flex items-center justify-center rounded-md border border-transparent bg-blue-500 px-3 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-blue-600 dark:bg-blue-600 dark:hover:bg-blue-500",children:"Use template"})]},h.id))}):i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Select a group to view its templates."})]})]})})]})}):null}function zwe({open:e,rule:t,onClose:r,onPreview:n,onApply:a,loading:o,applying:s,error:l,preview:c,previewType:u="preview",tagOptions:d=[]}){const f=()=>({since:"",until:"",methods:[],path:"",host:"",tagsAll:[],tagsAny:[],statuses:[]}),[p,h]=m.useState(f),[g,b]=m.useState(!1),y=m.useMemo(()=>{if(!Array.isArray(d))return[];const H=Array.from(new Set(d.filter($=>typeof $=="string")));return H.sort(($,z)=>$.localeCompare(z)),H},[d]);m.useEffect(()=>{e&&(h(f()),b(!1))},[e,t?.id]);const v=H=>Array.isArray(H)?H.map($=>$.trim()).filter(Boolean):[],k=H=>{const{name:$,value:z}=H.target;h(W=>({...W,[$]:z}))},N=H=>{const $=v(H).slice(0,1);h(z=>({...z,methods:$}))},w=H=>{h($=>({...$,statuses:v(H)}))},E=H=>{h($=>({...$,tagsAll:v(H)}))},C=H=>{h($=>({...$,tagsAny:v(H)}))},O=()=>{h(f()),b(!1)},D=m.useMemo(()=>{const H=[];return p.since&&H.push("Since"),p.until&&H.push("Until"),p.methods?.length&&H.push("Method"),p.statuses?.length&&H.push("Status codes"),p.path?.trim()&&H.push("Path"),p.host?.trim()&&H.push("Host"),p.tagsAll?.length&&H.push("Tags (all)"),p.tagsAny?.length&&H.push("Tags (any)"),H},[p]);m.useEffect(()=>{D.length>0&&b(!0)},[D.length]);const A=()=>{const H=Y=>{if(!Y)return;const ae=new Date(Y);return Number.isNaN(ae.getTime())?void 0:ae},$=(Array.isArray(p.statuses)?p.statuses:[]).map(Y=>Number(Y)).filter(Y=>Number.isFinite(Y)),z=v(p.methods).map(Y=>Y.toUpperCase()),W=v(p.tagsAll),U=v(p.tagsAny),X=z[0];return{since:H(p.since),until:H(p.until),method:X,path:p.path?.trim()||void 0,host:p.host?.trim()||void 0,tagsAll:W.length?W:void 0,tagsAny:U.length?U:void 0,statuses:$.length?$:void 0}},M=m.useMemo(()=>{if(!c)return[];const H=c.matches||c.operations||c.items||c.sample||c.sampled||c.preview||[];return Array.isArray(H)?H:[]},[c]),I=m.useMemo(()=>!c||typeof c!="object"?[]:[{key:"processed",label:"Processed",value:c.processed},{key:"matched",label:"Matched",value:c.matched},{key:"updated",label:"Updated",value:c.updated},{key:"duration_ms",label:"Duration (ms)",value:c.duration_ms}].filter(H=>H.value!==void 0&&H.value!==null),[c]),T=u==="apply",R=m.useMemo(()=>c?typeof c?.matched=="number"?c.matched>0:M.length>0:!1,[c,M]),L=T?"Apply results":"Preview summary",F=T?"Affected operations":"Preview matches",V=(H,$)=>{const z=H.method||H.req_method||H.http_method,W=H.path||H.req_path||H.url||H.request_path,U=H.status||H.res_status||H.http_status,X=H.time||H.ts||H.timestamp||H.at;return i.jsxs("li",{className:"rounded border border-gray-200 bg-white p-3 text-xs dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[z&&i.jsx("span",{className:"inline-flex items-center rounded bg-gray-100 px-2 py-0.5 font-medium text-gray-700 dark:bg-gray-800 dark:text-gray-300",children:z}),W&&i.jsx("span",{className:"truncate text-gray-800 dark:text-gray-200",children:W}),U!=null&&i.jsx("span",{className:"ml-auto inline-flex items-center rounded bg-gray-100 px-2 py-0.5 font-medium text-gray-700 dark:bg-gray-800 dark:text-gray-300",children:String(U)})]}),X&&i.jsx("div",{className:"mt-1 text-gray-500 dark:text-gray-400",children:String(X)}),!z&&!W&&!U&&i.jsx("pre",{className:"mt-2 overflow-auto text-[10px] leading-tight text-gray-600 dark:text-gray-400",children:JSON.stringify(H,null,2)})]},$)};return e?i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:i.jsxs("div",{className:"w-full max-w-3xl overflow-hidden rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800 sm:px-6",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:["Apply “",t?.name,"” to history"]}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Optionally set filters, review the results, then apply."})]}),i.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center rounded-md border border-gray-300 p-2 text-gray-500 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800","aria-label":"Close",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:[i.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),i.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]})})]}),i.jsxs("div",{className:"max-h-[80vh] overflow-auto p-4 sm:p-6",children:[i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Filters (optional)"}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:D.length===0?"No filters applied. Inspectr will search across all stored operations.":`Active filters: ${D.join(", ")}`})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[D.length>0&&i.jsx("button",{type:"button",onClick:O,className:"rounded border border-gray-300 px-2 py-1 text-xs font-medium text-gray-600 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800",children:"Clear filters"}),i.jsx("button",{type:"button",onClick:()=>b(H=>!H),className:"rounded border border-transparent bg-gray-100 px-2 py-1 text-xs font-medium text-gray-700 transition hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:g?"Hide filters":"Show filters"})]})]}),g&&i.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2",children:[i.jsxs("label",{className:"text-xs text-gray-700 dark:text-gray-300",children:["Since",i.jsx("input",{type:"datetime-local",name:"since",value:p.since,onChange:k,className:"mt-1 w-full rounded border border-gray-300 bg-white p-2 text-sm dark:border-gray-700 dark:bg-gray-900"})]}),i.jsxs("label",{className:"text-xs text-gray-700 dark:text-gray-300",children:["Until",i.jsx("input",{type:"datetime-local",name:"until",value:p.until,onChange:k,className:"mt-1 w-full rounded border border-gray-300 bg-white p-2 text-sm dark:border-gray-700 dark:bg-gray-900"})]}),i.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300",children:[i.jsx("span",{children:"Method"}),i.jsx("div",{className:"mt-1",children:i.jsx(tn,{options:P9,selected:p.methods,onChange:N,placeholder:"Select method",colorFn:Kh})})]}),i.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300",children:[i.jsx("span",{children:"Status codes"}),i.jsx("div",{className:"mt-1",children:i.jsx(tn,{options:A9,selected:p.statuses,onChange:w,placeholder:"Add status code...",colorFn:Qc})})]}),i.jsxs("label",{className:"text-xs text-gray-700 dark:text-gray-300",children:["Path contains",i.jsx("input",{type:"text",name:"path",placeholder:"/api/users",value:p.path,onChange:k,className:"mt-1 w-full rounded border border-gray-300 bg-white p-2 text-sm dark:border-gray-700 dark:bg-gray-900"})]}),i.jsxs("label",{className:"text-xs text-gray-700 dark:text-gray-300",children:["Host",i.jsx("input",{type:"text",name:"host",placeholder:"api.example.com",value:p.host,onChange:k,className:"mt-1 w-full rounded border border-gray-300 bg-white p-2 text-sm dark:border-gray-700 dark:bg-gray-900"})]}),i.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300",children:[i.jsx("span",{children:"Tags (all)"}),i.jsx("div",{className:"mt-1",children:i.jsx(tn,{options:y,selected:p.tagsAll,onChange:E,placeholder:"Add tag..."})})]}),i.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300",children:[i.jsx("span",{children:"Tags (any)"}),i.jsx("div",{className:"mt-1",children:i.jsx(tn,{options:y,selected:p.tagsAny,onChange:C,placeholder:"Add tag..."})})]})]})]}),T&&!s&&!l&&i.jsx("div",{className:"mt-3 rounded border border-green-200 bg-green-50 px-3 py-2 text-xs text-green-700 dark:border-green-900 dark:bg-green-950/40 dark:text-green-300",children:"Rule applied to historical operations. Review the results below."}),l&&i.jsx("p",{className:"mt-3 text-sm text-red-600 dark:text-red-400",children:l}),i.jsxs("div",{className:"mt-4 flex w-full items-center justify-end gap-3",children:[i.jsx("button",{type:"button",onClick:()=>n(A()),disabled:o,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-900 transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700 dark:text-gray-50 dark:hover:bg-gray-800",children:o?"Previewing…":"Preview matches"}),i.jsx("button",{type:"button",onClick:()=>a(A()),disabled:s,className:"inline-flex items-center rounded-md border border-transparent bg-blue-500 px-3 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-blue-600 dark:hover:bg-blue-500",children:s?"Applying…":"Apply now"}),i.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:bg-gray-50 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",children:"Cancel"})]}),I.length>0&&i.jsxs("div",{className:"mt-6 space-y-2",children:[i.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:L}),i.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:I.map(H=>i.jsxs("div",{className:"flex items-center justify-between rounded border border-gray-200 bg-gray-50 px-4 py-3 dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:H.label}),i.jsx("span",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:H.value})]},H.key))})]}),M.length>0&&i.jsxs("div",{className:"mt-6",children:[i.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:F}),i.jsx("ul",{className:"mt-2 space-y-2",children:M.map(V)})]}),!o&&c&&!R&&i.jsx("p",{className:"mt-4 text-sm text-gray-500 dark:text-gray-400",children:"No matching operations found for the selected filters."})]})]})}):null}function Uwe({onTagsUpdate:e}){const{client:t,setToast:r}=fr(),[n,a]=m.useState([]),[o,s]=m.useState(!0),[l,c]=m.useState(""),[u,d]=m.useState(!1),[f,p]=m.useState(null),[h,g]=m.useState(!1),[b,y]=m.useState(""),v=!!t?.operations,k=O=>{a(O),e?.(O)},N=async()=>{if(v)try{d(!0),c("");const O=await t.operations.listTags(),D=Array.isArray(O?.tags)?O.tags:[];D.sort((A,M)=>A.localeCompare(M)),k(D)}catch(O){console.error("Failed to refresh tags",O),c(O?.message||"Failed to refresh tags")}finally{d(!1)}};m.useEffect(()=>{if(!v)return;let O=!1;return(async()=>{try{s(!0);const D=await t.operations.listTags();if(O)return;const A=Array.isArray(D?.tags)?D.tags:[];A.sort((M,I)=>M.localeCompare(I)),k(A)}catch(D){if(O)return;console.error("Failed to load tags",D),c(D?.message||"Failed to load tags")}finally{O||s(!1)}})(),()=>{O=!0}},[v,t]);const w=O=>{p(O),y("")},E=()=>{p(null),y("")},C=async()=>{if(!(!f||!t?.operations))try{g(!0),y("");const O=await t.operations.bulkDeleteTag({tag:f,dryRun:!1});r?.({type:"success",message:`Tag "${f}" removed from matching operations`}),p(null),N()}catch(O){console.error("Bulk delete tag failed",O),y(O?.message||"Failed to delete tag"),r?.({type:"error",message:O?.message||"Failed to delete tag"})}finally{g(!1)}};return i.jsxs("section",{className:"rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-50",children:"Operation Tags"}),i.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"View and remove tags across operations."})]}),i.jsx("div",{className:"flex items-center gap-3",children:i.jsx("button",{type:"button",onClick:N,title:"Refresh tags",disabled:u||o,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:u?"Refreshing…":"Refresh"})})]}),i.jsxs("div",{className:"px-4 pt-2 pb-4",children:[l&&i.jsx("div",{className:"mb-3 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950 dark:text-red-300",children:l}),o?i.jsx("div",{className:"py-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"Loading tags…"}):n.length===0?i.jsx("div",{className:"py-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"No tags found."}):i.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-800",children:n.map(O=>i.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[i.jsx("div",{className:"inline-flex items-center gap-2",children:i.jsx(sl,{tag:O})}),i.jsxs("button",{type:"button",onClick:()=>w(O),className:"inline-flex items-center gap-1 rounded-md border border-red-200 px-2.5 py-1.5 text-xs font-medium text-red-700 transition hover:bg-red-50 dark:border-red-900/40 dark:text-red-300 dark:hover:bg-red-950",title:`Remove tag "${O}" from operations`,children:[i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"-ms-0.5",children:[i.jsx("path",{d:"M3 6h18"}),i.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),i.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),i.jsx("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),i.jsx("line",{x1:"14",x2:"14",y1:"11",y2:"17"})]}),"Remove"]})]},O))})]}),i.jsx(wg,{open:!!f,isDeleting:h,error:b,onCancel:E,onConfirm:C,title:"Remove tag from operations?",description:f?i.jsxs(i.Fragment,{children:["This will remove the tag ",i.jsx("span",{className:"font-semibold",children:f})," from all matching operations. This action cannot be undone."]}):"",confirmLabel:"Delete Tag"})]})}function qwe({open:e,rule:t,onClose:r}){const{client:n,setToast:a}=fr(),[o,s]=m.useState(!1),[l,c]=m.useState(""),u=m.useMemo(()=>t?.name||"All rules",[t]);if(!e)return null;const d=async()=>{if(n?.rules?.export){s(!0),c("");try{const{blob:f,filename:p}=await n.rules.export({id:t?.id}),h=URL.createObjectURL(f),g=document.createElement("a");g.href=h,g.download=p||"rules.yaml",document.body.appendChild(g),g.click(),g.remove(),URL.revokeObjectURL(h),a?.({type:"success",message:`Downloaded ${p||"rules.yaml"}`}),r?.()}catch(f){console.error("Export download failed",f),c(f?.message||"Failed to export rules")}finally{s(!1)}}};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:i.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800 sm:px-6",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"Export rules"}),i.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Download YAML export",t?.name?` for "${u}"`:"","."]}),t?.name&&i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:["Rule: ",u]})]}),i.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center rounded-md border border-gray-300 p-2 text-gray-500 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800","aria-label":"Close export dialog",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:[i.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),i.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]})})]}),i.jsxs("div",{className:"space-y-4 px-4 py-4 sm:px-6",children:[l&&i.jsx("div",{className:"rounded-md border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-800 dark:bg-red-950/50 dark:text-red-300",children:l}),i.jsx("div",{className:"flex items-center justify-end",children:i.jsx("button",{type:"button",onClick:d,disabled:o,className:"inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:opacity-60 focus:outline-none focus:ring-2 focus:ring-blue-300 dark:bg-blue-500 dark:hover:bg-blue-400",children:o?"Preparing…":"Download rules.yaml"})})]})]})})}function Vwe({open:e,onCancel:t,onImport:r,onImported:n}){const{client:a,setToast:o}=fr(),[s,l]=m.useState(""),[c,u]=m.useState(null),[d,f]=m.useState(""),[p,h]=m.useState(!1),[g,b]=m.useState(!1);if(m.useEffect(()=>{e||(l(""),u(null),f(""),h(!1),b(!1))},[e]),!e)return null;const y=k=>{const N=k.target.files?.[0]||null;u(N),f("")},v=async()=>{if(a?.rules?.import){if(!c&&!s.trim()){f("Select a YAML file or paste YAML content.");return}h(!0),f("");try{let k=s;if(c)try{k=await new Response(c).text()}catch(E){console.error("Failed to read file",E),f("Could not read the selected file. Please reselect it or paste the YAML."),h(!1);return}const N=await a.rules.import(k,{overwrite:g}),w=N?.rule||(Array.isArray(N?.rules)?N.rules[0]:null);if(o?.({type:"success",message:"Import completed"}),n)try{await n()}catch{}w&&r&&r(w),t?.()}catch(k){console.error("Import failed",k),f(k?.message||"Failed to import rules")}finally{h(!1)}}};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:i.jsxs("div",{className:"w-full max-w-xl overflow-hidden rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800 sm:px-6",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"Import rules"}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Upload a .yaml export or paste YAML content."})]}),i.jsx("button",{type:"button",onClick:t,className:"inline-flex items-center rounded-md border border-gray-300 p-2 text-gray-500 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800","aria-label":"Close import dialog",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:[i.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),i.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]})})]}),i.jsxs("div",{className:"space-y-4 px-4 py-4 sm:px-6",children:[d&&i.jsx("div",{className:"rounded-md border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-800 dark:bg-red-950/50 dark:text-red-300",children:d}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("label",{htmlFor:"rule-import-file",className:"shrink-0 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:"YAML file"}),i.jsx("input",{id:"rule-import-file",type:"file",accept:".yaml,.yml,text/yaml,application/x-yaml,application/yaml",onChange:y,onClick:k=>{k.currentTarget.value=null},className:"block w-full text-sm text-gray-700 file:mr-3 file:rounded-md file:border file:border-gray-300 file:bg-white file:px-3 file:py-2 file:text-sm file:font-medium file:text-gray-700 hover:file:bg-gray-50 dark:text-gray-200 dark:file:border-gray-700 dark:file:bg-gray-900"})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"rule-import-yaml",className:"text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:"Or paste YAML"}),i.jsx("textarea",{id:"rule-import-yaml",value:s,onChange:k=>l(k.target.value),rows:12,placeholder:`# name: Example rule
179
- # event: ...
180
- # expression:
181
- # op: and
182
- # args: ...`,className:"mt-2 block w-full rounded-md border border-gray-300 bg-white px-3 py-2 font-mono text-xs text-gray-800 shadow-inner focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#0B101F] dark:text-gray-100 dark:focus:border-blue-700 dark:focus:ring-blue-800/50"})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[i.jsx("input",{type:"checkbox",checked:g,onChange:k=>b(k.target.checked),className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-700 dark:bg-gray-900"}),"Overwrite existing rules"]}),i.jsxs("div",{className:"flex justify-end gap-3",children:[i.jsx("button",{type:"button",onClick:t,disabled:p,className:"inline-flex items-center rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 transition hover:bg-gray-100 disabled:opacity-60 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",children:"Cancel"}),i.jsx("button",{type:"button",onClick:v,disabled:p,className:"inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:opacity-60 focus:outline-none focus:ring-2 focus:ring-blue-300 dark:bg-blue-500 dark:hover:bg-blue-400",children:p?"Importing…":"Import"})]})]})]})]})})}const sw=(e,t,r)=>({name:"",description:"",event:e?.[0]?.type||"",priority:10,active:!0,expressionType:"and",conditions:[Ej(r)],actions:t?.length?[pd(t[0])]:[]}),Wwe=(e,t,r=!1)=>{const n=a=>{if(t==="number"){const o=Number(a);return Number.isNaN(o)?a:o}return t==="boolean"?typeof a=="boolean"?a:typeof a=="string"?a==="true":!!a:a};return r?(Array.isArray(e)?e:hd(e)).map(a=>n(a)):n(e)};function Kwe({route:e}){const{client:t,setToast:r}=fr(),[n,a]=m.useState([]),[o,s]=m.useState(null),[l,c]=m.useState([]),[u,d]=m.useState([]),[f,p]=m.useState(!0),[h,g]=m.useState(!1),[b,y]=m.useState(""),[v,k]=m.useState(null),[N,w]=m.useState(!1),[E,C]=m.useState(null),O=m.useRef(!1),[D,A]=m.useState(!1),[M,I]=m.useState(null),[T,R]=m.useState(""),[L,F]=m.useState(!1),[V,H]=m.useState(!1),[$,z]=m.useState([]),[W,U]=m.useState([]),[X,Y]=m.useState(!1),[ae,G]=m.useState(""),[ee,re]=m.useState(!1),[pe,te]=m.useState(null),[se,ne]=m.useState(!1),[K,ge]=m.useState(!1),[ye,me]=m.useState(""),[Se,Re]=m.useState(null),[Te,Je]=m.useState(null),[rt,De]=m.useState(!1),[ut,ct]=m.useState(null),[Nt,yt]=m.useState(!1),[ft,Ct]=m.useState([]),[Ae,ke]=m.useState(null),Ie=m.useRef(null),qe=m.useRef(null),nt=(xe,Ne=1)=>{const Ue=Array.isArray(xe?.rules)?xe.rules:[];a(Ue);const _e=xe?.meta;if(_e&&typeof _e=="object"){const Ze={..._e},ot=Number(Ze.page??Ne);Ze.page=Number.isFinite(ot)&&ot>0?ot:1,s(Ze)}else s(null)},dt=m.useRef(!0);m.useEffect(()=>()=>{dt.current=!1},[]);const wt=async(xe=1)=>{if(!t?.rules)return null;const Ne=Number(xe),Ue=Number.isFinite(Ne)&&Ne>0?Ne:1;try{return await t.rules.list({page:Ue})}catch(_e){if(Ue===1)return await t.rules.list();throw _e}},[pt,Le]=m.useState([]),Tt=m.useMemo(()=>Yke(pt),[pt]),er=m.useMemo(()=>Xke(pt),[pt]),qr=m.useMemo(()=>Gke(pt),[pt]),Ve=m.useMemo(()=>MR(pt),[pt]),[hr,ir]=m.useState(()=>sw([],[],Ve)),[ea,cn]=m.useState([]),ka=m.useCallback(async()=>{if(!t?.service?.getLicense)return dt.current&&ke(null),null;try{const xe=await t.service.getLicense();if(!dt.current)return xe;const Ne=xe?.features?.rules,Ue=xe?.usage?.features?.rules,_e=typeof Ne?.effective_limit=="number"?Ne.effective_limit:null,Ze=typeof Ue?.used=="number"?Ue.used:null;return ke({limit:_e,used:Ze}),xe}catch(xe){return console.error("Failed to load license info",xe),dt.current&&ke(null),null}},[t]);m.useEffect(()=>{ka()},[ka]),m.useEffect(()=>{if(!t?.rules)return;let xe=!1;return(async()=>{try{p(!0);const[Ne,Ue,_e,Ze]=await Promise.all([wt(1),t.rules.getEvents(),t.rules.getActions(),t.rules.getOperators()]);if(xe)return;nt(Ne,Ne?.meta?.page??1),c(Ue.events||[]),d(_e.actions||[]);const ot=Array.isArray(Ze)?Ze:Array.isArray(Ze?.operators)?Ze.operators:[];Le(Kke(ot)),y("")}catch(Ne){if(xe)return;console.error("Failed to load rules",Ne),y(Ne?.message||"Failed to load rules")}finally{xe||p(!1)}})(),()=>{xe=!0}},[t]),m.useEffect(()=>{f||O.current||(ir(sw(l,u,Ve)),O.current=!0)},[f,l,u,Ve]),m.useEffect(()=>{if(!Array.isArray(Tt)||Tt.length===0)return;const xe=new Set(Tt.map(Ne=>Ne.value));ir(Ne=>{if(!Ne?.conditions?.length)return Ne;let Ue=!1;const _e=Ne.conditions.map(Ze=>xe.has(Ze.operator)?Ze:(Ue=!0,{...Ze,operator:Ve}));return Ue?{...Ne,conditions:_e}:Ne})},[Tt,Ve]),m.useEffect(()=>{const xe=typeof window<"u"?cs():{},Ne=e?.operationId||xe.operationId,Ue=e?.subTab||xe.subTab;if(!Ne||Ue!=="edit"){qe.current=null;return}if(f)return;const _e=`${Ne}:edit`;if(qe.current===_e&&!D||Ie.current===_e&&D)return;let Ze=!1;return(async()=>{let ot=n.find(ht=>String(ht.id)===String(Ne));if(!ot&&t?.rules?.get)try{ot=await t.rules.get(Ne)}catch(ht){console.error("Failed to load rule for edit route",ht)}Ze||!ot||(ir(vn(ot)),C(ot.id||Ne),cn([]),A(!0),k(ot.id||Ne),Ie.current=_e)})(),()=>{Ze=!0}},[e?.operationId,e?.subTab,f,n,t,D]);const yi=m.useMemo(()=>l.reduce((xe,Ne)=>(xe[Ne.type]=Ne,xe),{}),[l]),ta=async(xe=o?.page||1)=>{if(!t?.rules)return null;const Ne=Number(xe),Ue=Number.isFinite(Ne)&&Ne>0?Ne:1;let _e=null;try{g(!0),_e=await wt(Ue),nt(_e,Ue),y("")}catch(Ze){console.error("Failed to refresh rules",Ze),y(Ze?.message||"Failed to refresh rules")}finally{g(!1)}return _e},Un=async(xe=o?.page||1)=>{await Promise.all([ta(xe),ka()])},st=async xe=>{const Ne=Number(xe)||1;Ne!==(o?.page||1)&&await ta(Ne)},Ft=async xe=>{if(!t?.rules||!xe?.id)return;const Ne=!xe.active;try{await t.rules.update(xe.id,{...xe,active:Ne}),r?.({type:"success",message:`Rule "${xe.name||"Untitled"}" ${Ne?"activated":"paused"}`}),await ta()}catch(Ue){console.error("Toggle rule active failed",Ue),r?.({type:"error",message:Ue?.message||"Failed to update rule status"})}},Er=async()=>{try{Y(!0),G("");const[xe,Ne]=await Promise.all([fetch("https://templates.inspectr.dev/api/rules/templates"),fetch("https://templates.inspectr.dev/api/rules/templates/group-types")]);if(!xe.ok)throw new Error(`Template fetch failed (${xe.status})`);if(!Ne.ok)throw new Error(`Group types fetch failed (${Ne.status})`);const Ue=await xe.json(),_e=await Ne.json();z(Array.isArray(Ue)?Ue:[]),U(Array.isArray(_e)?_e:[])}catch(xe){console.error("Failed to load templates",xe),xe?.name==="TypeError"||xe?.message?.includes("Failed to fetch")?(G(""),H(!1),_t(),C(null),cn([]),A(!0),z([]),U([])):G(xe?.message||"Failed to load templates")}finally{Y(!1)}},_t=()=>{ir(sw(l,u,Ve)),cn([]),C(null)},Yt=xe=>{if(typeof window>"u")return;const Ne=e?.slug||"rules",Ue=encodeURIComponent(String(xe));window.history.pushState(null,"",`#${Ne}/${Ue}/edit`)},Wr=()=>{if(typeof window>"u")return;const xe=e?.slug||"rules";window.history.pushState(null,"",`#${xe}`)},Jr=()=>{const xe=typeof window<"u"?cs():{},Ne=e?.operationId||xe.operationId,Ue=e?.subTab||xe.subTab;Ne&&Ue==="edit"&&(qe.current=`${Ne}:edit`),A(!1),Ue==="edit"&&Wr(),_t()},Qr=(xe,Ne)=>{ir(Ue=>({...Ue,[xe]:Ne}))},je=(xe,Ne,Ue)=>{ir(_e=>{const Ze=_e.conditions.map((ot,ht)=>{if(ht!==xe)return ot;if(Ne==="valueType"){if(Ue==="boolean"){const lr=ot.value==="false"?"false":"true";return{...ot,valueType:Ue,value:lr}}if(ot.valueType==="boolean")return{...ot,valueType:Ue,value:""}}if(Ne==="operator"){const lr=(qr[Ue]||{}).valueRequired!==!1,Et=lr?ot.valueType:"string";let Ot=ot.value;return lr?Et==="boolean"&&Ot===""&&(Ot="true"):Ot="",{...ot,operator:Ue,valueType:Et,value:Ot}}return{...ot,[Ne]:Ue}});return{..._e,conditions:Ze}})},Pe=(xe,Ne)=>{ir(Ue=>({...Ue,conditions:Z7(Ue.conditions,xe,Ne)}))},Ye=()=>{ir(xe=>({...xe,conditions:[...xe.conditions,Ej(Ve)]}))},Pt=xe=>{ir(Ne=>{if(Ne.conditions.length===1)return Ne;const Ue=Ne.conditions.filter((_e,Ze)=>Ze!==xe);return{...Ne,conditions:Ue}})},Kt=xe=>u.find(Ne=>Ne.type===xe),vr=()=>{ir(xe=>{const Ne=u[0],Ue=Ne?pd(Ne):{id:xp(),type:"",params:{}};return{...xe,actions:[...xe.actions,Ue]}})},Lr=xe=>{ir(Ne=>Ne.actions.length===1?Ne:{...Ne,actions:Ne.actions.filter(Ue=>Ue.id!==xe)})},Kr=(xe,Ne)=>{ir(Ue=>({...Ue,actions:Ue.actions.map(_e=>{if(_e.id!==xe)return _e;const Ze=Kt(Ne);if(!Ze)return{..._e,type:Ne,definitionMissing:!!Ne,originalParams:_e.originalParams??_e.params??{}};const ot=pd(Ze);try{const ht=(Ze.params||[]).find(Ot=>Ot.name==="provider"),lr=(Ze.params||[]).find(Ot=>Ot.name==="provider_options"),Et=ot.params?.provider;if(ht&&lr&&Array.isArray(lr.variants)){const Ot=lr.variants.find(At=>At.value===Et);if(Ot){const At=(Ot.params||[]).reduce((Cr,gr)=>(Cr[gr.name]=Nj(gr),Cr),{});ot.params.provider_options=At}}}catch{}return{...ot,id:xe,type:Ne}})}))},It=(xe,Ne,Ue)=>{ir(_e=>({..._e,actions:_e.actions.map(Ze=>{if(Ze.id!==xe)return Ze;const ot={...Ze.params,[Ne]:Ue};if(Ne==="provider"){const ht=Kt(Ze.type)?.params?.find(lr=>lr.name==="provider_options");if(ht&&Array.isArray(ht.variants)){const lr=ht.variants.find(Et=>Et.value===Ue);lr?ot.provider_options=(lr.params||[]).reduce((Et,Ot)=>(Et[Ot.name]=Nj(Ot),Et),{}):ot.provider_options={}}else ot.provider_options={}}return{...Ze,params:ot}})}))},tr=(xe,Ne)=>{ir(Ue=>{const _e=Ue.actions.findIndex(Ze=>Ze.id===xe);return _e===-1?Ue:{...Ue,actions:Z7(Ue.actions,_e,Ne)}})},vn=xe=>{const Ne=String(xe?.expression?.op||"and").toLowerCase(),Ue=Wh(xe?.expression),_e=Ue.length?Ue.map(Et=>{const Ot=Et.right;let At;Array.isArray(Ot)?Ot.every(gr=>typeof gr=="number")?At="number":Ot.every(gr=>typeof gr=="boolean")?At="boolean":At="string":At=Qke(Ot);let Cr;return Array.isArray(Ot)?Cr=Ot.join(", "):At==="boolean"?Cr=Ot?"true":"false":Ot==null?Cr="":Cr=String(Ot),{path:Et.left?.path||"",operator:Et.op||"==",valueType:At,value:Cr}}):[Ej(Ve)],Ze=xe?.actions?.length?xe.actions.map(Et=>{const Ot=Kt(Et.type);if(!Ot){let gr={};if(Et?.params&&typeof Et.params=="object")try{gr=JSON.parse(JSON.stringify(Et.params))}catch{gr={...Et.params}}return{id:xp(),type:Et.type||"",params:gr,definitionMissing:!!Et.type,originalParams:gr}}const At=pd(Ot),Cr={...At.params};return(Ot.params||[]).forEach(gr=>{const un=Et.params?.[gr.name];gr.type==="boolean"?Cr[gr.name]=un===void 0?Cr[gr.name]:jj(un):typeof gr.type=="string"&&gr.type.startsWith("array")?Array.isArray(un)?Cr[gr.name]=un.join(", "):Cr[gr.name]=un||"":gr.type==="object"?un&&typeof un=="object"?Cr[gr.name]=un:Cr[gr.name]={}:Cr[gr.name]=un==null?"":String(un)}),{...At,id:xp(),type:Et.type||"",params:Cr}}):u.length?[pd(u[0])]:[],ot=xe?.event,ht=l[0]?.type||"",lr=l.some(Et=>Et.type===ot)?ot:ht;return{name:xe?.name||"",description:xe?.description||"",event:lr,priority:xe?.priority??10,active:xe?.active!==!1,expressionType:Ne,conditions:_e,actions:Ze}},En=()=>{const xe=[];return hr.name.trim()||xe.push("Rule name is required."),hr.event||xe.push("Select an event for the rule."),hr.conditions.forEach((Ne,Ue)=>{Ne.path.trim()||xe.push(`Condition ${Ue+1} is missing a data path.`);const _e=qr[Ne.operator]||{};_e.valueRequired!==!1&&(_e.multiValue?(Array.isArray(Ne.value)?Ne.value:hd(Ne.value)).length||xe.push(`Condition ${Ue+1} is missing a value.`):`${Ne.value}`.trim()===""&&xe.push(`Condition ${Ue+1} is missing a value.`))}),hr.conditions.length||xe.push("Add at least one condition."),hr.actions.length||xe.push("Add at least one action."),hr.actions.forEach(Ne=>{const Ue=Kt(Ne.type);if(!Ue){Ne.type||xe.push("Every action must have a type.");return}(Ue.params||[]).forEach(_e=>{const Ze=Ne.params?.[_e.name];if(typeof _e.type=="string"&&_e.type.startsWith("array")){const ot=hd(Ze);!_e.readonly&&_e.required&&ot.length===0&&xe.push(`${_e.name} is required for the ${Ne.type} action.`)}else if(_e.type==="string")!_e.readonly&&_e.required&&!`${Ze??""}`.trim()&&xe.push(`${_e.name} is required for the ${Ne.type} action.`);else if(_e.type==="boolean")!_e.readonly&&_e.required&&typeof Ze!="boolean"&&xe.push(`${_e.name} must be toggled for the ${Ne.type} action.`);else if(_e.type==="integer"||_e.type==="number"){const ot=Number(Ze);!_e.readonly&&_e.required&&!Number.isFinite(ot)&&xe.push(`${_e.name} must be a valid ${_e.type} for the ${Ne.type} action.`)}else if(_e.type==="object"&&_e.required&&!_e.readonly){if(Ze==null||typeof Ze=="object"&&Object.keys(Ze).length===0)xe.push(`${_e.name} is required for the ${Ne.type} action.`);else if(typeof Ze=="string")try{const ot=JSON.parse(Ze);(!ot||typeof ot!="object")&&xe.push(`${_e.name} must be a valid JSON object for the ${Ne.type} action.`)}catch{xe.push(`${_e.name} must be valid JSON for the ${Ne.type} action.`)}}})}),xe},Sr=()=>({name:hr.name.trim(),description:hr.description.trim()||void 0,event:hr.event,priority:Number(hr.priority)||0,active:!!hr.active,expression:{op:hr.expressionType,args:hr.conditions.map(xe=>{const Ne=qr[xe.operator]||{},Ue=Ne.valueRequired!==!1,_e={op:xe.operator,left:{path:xe.path.trim()}};if(Ue){const Ze=Wwe(xe.value,xe.valueType,Ne.multiValue===!0);_e.right=Ze}return _e})},actions:hr.actions.map(xe=>{const Ne=Kt(xe.type);if(!Ne){const _e=xe.originalParams&&Object.keys(xe.originalParams).length?xe.originalParams:xe.params||{};return{type:xe.type,params:_e}}const Ue={};return(Ne.params||[]).forEach(_e=>{const Ze=xe.params?.[_e.name];if(typeof _e.type=="string"&&_e.type.startsWith("array")){const ot=hd(Ze);(_e.required||ot.length)&&(Ue[_e.name]=ot)}else if(_e.type==="boolean")Ze!==void 0&&(Ue[_e.name]=jj(Ze));else if(_e.type==="integer"||_e.type==="number"){if(Ze!==void 0&&Ze!==""){const ot=Number(Ze);Number.isFinite(ot)&&(Ue[_e.name]=ot)}}else if(_e.type==="object"){if(Ze){if(typeof Ze=="object"){let ot=Ze;if(_e.input==="multi_select"&&Array.isArray(_e.choices)){const ht={};Object.entries(Ze).forEach(([lr,Et])=>{const Ot=_e.choices.find(At=>(At.meta?.key||At.value)===lr)?.meta?.type;if(Ot==="integer"||Ot==="number"){const At=Number(Et);ht[lr]=Number.isFinite(At)?At:Et}else if(Ot==="boolean")ht[lr]=Et===!0||Et==="true"||Et==="1";else if(Ot==="object")try{ht[lr]=typeof Et=="string"?JSON.parse(Et):Et}catch{ht[lr]=Et}else ht[lr]=Et}),ot=ht}else if(Array.isArray(_e.variants)&&_e.name==="provider_options"){const ht=xe.params?.provider,lr=_e.variants.find(Et=>Et.value===ht);if(lr){const Et={};(lr.params||[]).forEach(Ot=>{const At=Ze[Ot.name];if(At!==void 0)if(Ot.type==="integer"||Ot.type==="number"){const Cr=Number(At);Et[Ot.name]=Number.isFinite(Cr)?Cr:At}else if(Ot.type==="boolean")Et[Ot.name]=At===!0||At==="true"||At==="1";else if(typeof Ot.type=="string"&&Ot.type.startsWith("array"))Et[Ot.name]=Array.isArray(At)?At:hd(At);else if(Ot.type==="object")try{Et[Ot.name]=typeof At=="string"?JSON.parse(At):At}catch{Et[Ot.name]=At}else Et[Ot.name]=At}),ot=Et}}(_e.required||Object.keys(ot).length)&&(Ue[_e.name]=ot)}else if(typeof Ze=="string")try{const ot=JSON.parse(Ze);ot&&typeof ot=="object"&&(_e.required||Object.keys(ot).length)&&(Ue[_e.name]=ot)}catch{}}}else{const ot=typeof Ze=="string"?Ze.trim():Ze;(_e.required||ot!=null&&ot!=="")&&(Ue[_e.name]=ot)}}),{type:xe.type,params:Ue}})}),ra=async xe=>{if(xe.preventDefault(),!t?.rules)return;const Ne=En();if(Ne.length){cn(Ne);return}cn([]),w(!0);const Ue=Sr(),_e=!!E;try{const Ze=_e?await t.rules.replace(E,Ue):await t.rules.create(Ue);r?.({message:_e?"Rule updated":"Rule saved",subMessage:`${Ue.name} applied successfully.`}),Ze?.id&&a(ot=>{const ht=ot.findIndex(Et=>Et.id===Ze.id);if(ht===-1)return[Ze,...ot];const lr=[...ot];return lr[ht]=Ze,lr}),await ta(),Jr()}catch(Ze){console.error("Failed to save rule",Ze),cn([Ze?.message||"Failed to save rule"])}finally{w(!1)}},na=xe=>{u.length&&(ir(vn(xe)),C(xe.id||null),cn([]),A(!0),k(xe.id||null),xe?.id&&Yt(xe.id))},wl=xe=>{I(xe),R("")},to=async()=>{if(!(!t?.rules||!M)){F(!0),R("");try{await t.rules.delete(M.id),a(xe=>xe.filter(Ne=>Ne.id!==M.id)),E&&M.id===E&&Jr(),v===M.id&&k(null),r?.({message:"Rule deleted",subMessage:`${M.name||"Rule"} removed successfully.`}),await ta(),I(null)}catch(xe){console.error("Failed to delete rule",xe),R(xe?.message||"Failed to delete rule")}finally{F(!1)}}},jl=()=>{L||(I(null),R(""))},Nl=()=>{E?Jr():_t()},Cu=()=>{_t(),A(!0)},Lo=()=>{H(!0),!X&&$.length===0&&Er()},am=xe=>{u.length&&(ir(vn(xe)),C(null),cn([]),H(!1),A(!0))},El=xe=>{const Ne=vn(xe);ir(Ne),C(null),cn([]),A(!0)},om=xe=>{xe&&(ct(xe),De(!0))},Wt=()=>{De(!1),ct(null)},sm=()=>{yt(!0)},im=()=>{yt(!1)},Sl=xe=>{xe&&(ir(vn(xe)),C(null),cn([]),yt(!1),A(!0),k(null))},xi=yi[hr.event]?.description,lm=E?"Edit rule":"Create rule",cm=E?"Update the event, conditions, and actions for this automation rule.":"Define the event trigger, matching conditions, and resulting actions for your new rule.",Ou=m.useMemo(()=>W.reduce((xe,Ne)=>(xe[Ne.id]=Ne,xe),{}),[W]),kr=m.useMemo(()=>{if(!$.length)return[];const xe=[];W.forEach(Ue=>{const _e=$.filter(Ze=>Ze.group_type===Ue.id);_e.length&&xe.push({id:Ue.id,label:Ue.label,description:Ue.description,items:_e})});const Ne=$.filter(Ue=>!Ue.group_type||!Ou[Ue.group_type]);return Ne.length&&xe.push({id:"uncategorized",label:"Other Templates",description:"General-purpose rules without a defined category.",items:Ne}),xe},[$,W,Ou]),vi=xe=>{te(xe),re(!0),me(""),Re(null),Je(null)},ki=()=>{re(!1),te(null),me(""),Re(null),ne(!1),ge(!1),Je(null)},ws=async xe=>{if(!(!t?.rules||!pe?.id))try{ne(!0),me("");const Ne=await t.rules.applyToHistory(pe.id,{...xe,dryRun:!0});Re(Ne||{}),Je("preview")}catch(Ne){console.error("Preview apply failed",Ne),me(Ne?.message||"Failed to preview")}finally{ne(!1)}},Pu=async xe=>{if(!(!t?.rules||!pe?.id))try{ge(!0),me("");const Ne=await t.rules.applyToHistory(pe.id,{...xe,dryRun:!1});Re(Ne||{}),Je("apply"),r?.({type:"success",message:"Rule applied to matching historical operations"})}catch(Ne){console.error("Apply to history failed",Ne),me(Ne?.message||"Failed to apply"),r?.({type:"error",message:Ne?.message||"Failed to apply rule"})}finally{ge(!1)}};return i.jsxs("div",{className:"min-h-screen flex flex-col space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3 flex-1 min-h-0",children:[i.jsx("div",{className:"lg:col-span-2 min-h-0 flex flex-col",children:i.jsx(iwe,{rules:n,events:l,loading:f,error:b,isRefreshing:h,openRuleId:v,onToggleRule:k,onRefresh:Un,onEditRule:na,onDeleteRule:wl,onCreateRule:Cu,onStartFromTemplate:Lo,onApplyHistory:vi,onDuplicateRule:El,onPauseRule:Ft,onExportRule:om,onImportRule:sm,meta:o,licenseUsage:Ae,onPageChange:st,paginationAlwaysShow:!1,operatorLabelMap:er})}),i.jsx("div",{className:"lg:col-span-1",children:i.jsx(Uwe,{onTagsUpdate:Ct})})]}),i.jsx(wg,{open:!!M,rule:M,isDeleting:L,error:T,onCancel:jl,onConfirm:to}),i.jsx(Bwe,{open:D,title:lm,description:cm,onClose:Jr,showFooter:!0,onReset:Nl,formId:"rules-builder-form",saving:N,isEditing:!!E,children:i.jsx($we,{form:hr,events:l,selectedEventDescription:xi,actionsCatalog:u,isEditing:!!E,saving:N,formErrors:ea,onSubmit:ra,onReset:Nl,formId:"rules-builder-form",hideFooter:!0,onFieldChange:Qr,onConditionChange:je,onAddCondition:Ye,onRemoveCondition:Pt,onMoveCondition:Pe,onActionTypeChange:Kr,onActionParamChange:It,onAddAction:vr,onRemoveAction:Lr,onMoveAction:tr,operatorOptions:Tt})}),i.jsx(Hwe,{open:V,groupedTemplates:kr,loading:X,error:ae,onClose:()=>H(!1),onRetry:Er,onSelect:am}),i.jsx(zwe,{open:ee,rule:pe,onClose:ki,onPreview:ws,onApply:Pu,loading:se,applying:K,error:ye,preview:Se,previewType:Te,tagOptions:ft}),i.jsx(qwe,{open:rt,rule:ut,onClose:Wt}),i.jsx(Vwe,{open:Nt,onCancel:im,onImport:Sl,onImported:ta})]})}function IR({count:e,color:t="red",className:r=""}){if(!e||e<=0)return null;const n=t==="green"?"bg-green-600":t==="orange"?"bg-orange-500":"bg-red-600";return i.jsx("span",{className:`inline-flex items-center justify-center px-1.5 py-0.5 text-xs font-semibold leading-none text-white ${n} rounded-full ${r}`,children:e})}function qa({variant:e="auto",filled:t=!1,backgroundClass:r="",children:n}){const a="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",o={success:"border-green-500 text-green-500",error:"border-red-500 text-red-500",neutral:"border-gray-300 text-gray-800 dark:border-gray-600 dark:text-gray-200"},s={success:"bg-green-500 text-white border-green-500",error:"bg-red-500 text-white border-red-500",neutral:"bg-gray-300 text-gray-800 border-gray-300 dark:bg-gray-600 dark:text-gray-200"},l=["ok","active","running","on","yes"],c=["nok","inactive","stopped","off","no"],u=String(n).trim().toLowerCase();let d;e==="auto"?l.includes(u.toLowerCase())?d="success":c.includes(u.toLowerCase())?d="error":d="neutral":d=e;const f=t?s[d]:o[d];return i.jsx("span",{className:`${a} ${f} ${r}`,children:n})}function Ywe(){const{apiEndpoint:e,setApiEndpoint:t,client:r}=fr(),[n,a]=m.useState(e),[o,s]=m.useState(null),l=async c=>{c.preventDefault();const u=n.replace(/\/+$/,"");t(u),r.configure({apiEndpoint:u});try{s(null),await r.service.getHealth()}catch(d){s(d.message)}};return i.jsxs(i.Fragment,{children:[i.jsxs("form",{className:"grid grid-cols-1 gap-10 md:grid-cols-3 items-end",onSubmit:l,children:[i.jsxs("div",{className:"self-start",children:[i.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"API Endpoint"}),i.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Set the base URL for the Inspectr API."})]}),i.jsxs("div",{className:"sm:max-w-3xl md:col-span-2",children:[i.jsx(lR,{id:"api-endpoint",name:"api-endpoint",placeholder:"https://localhost:4004/api",value:n,onValueChange:c=>a(c),className:`mt-2 focus:ring-2 focus:ring-offset-0 ${o?"border-red-500 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500":""}`}),o&&i.jsxs("p",{className:"mt-2 text-sm text-red-600",children:["Cannot connect to ",n]}),i.jsx("div",{className:"flex items-center justify-end space-x-4 pt-4",children:i.jsx("button",{type:"submit",className:"whitespace-nowrap rounded-tremor-default bg-tremor-brand px-4 py-2.5 text-tremor-default font-medium text-tremor-brand-inverted shadow-tremor-input hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:shadow-dark-tremor-input dark:hover:bg-dark-tremor-brand-emphasis",children:"Save API Endpoint"})})]})]}),i.jsx(Po,{className:"my-10"})]})}function iw({component:e}){const{client:t}=fr(),[r,n]=m.useState("loading"),[a,o]=m.useState(null),s=m.useRef(()=>{}),l=500;m.useEffect(()=>{let d=!1;async function f(){d||(n("loading"),o(null));const p=Date.now();try{const h=await t.service.ping(e),g=Date.now()-p,b=()=>{d||(n(h.status),o(h.error||null))};g<l?setTimeout(b,l-g):b()}catch(h){const g=Date.now()-p,b=()=>{d||(n("down"),o(h.message))};g<l?setTimeout(b,l-g):b()}}return s.current=f,f(),()=>{d=!0}},[t.service,e]);const c=r==="up"?"fill-green-500":r==="down"?"fill-red-500":"fill-gray-400 animate-pulse",u=a?`${a}`:`${e}: ${r}`;return i.jsx(Df,{content:u,sideOffset:4,side:"left",onClick:()=>s.current(),children:i.jsx("svg",{viewBox:"0 0 6 6","aria-hidden":"true",className:ya("w-3 h-3 cursor-pointer",c),children:i.jsx("circle",{r:"3",cx:"3",cy:"3"})})})}function Xwe(){const{apiEndpoint:e,proxyEndpoint:t,ingressEndpoint:r,client:n}=fr(),[a,o]=m.useState(null),[s,l]=m.useState(null),c=async()=>{try{l(null),o(null);const u=await n.service.getHealth();o(u)}catch(u){console.error("Health error",u),l(u.message)}};return m.useEffect(()=>{c()},[e]),i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Inspectr"}),i.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Information about the connected Inspectr service itself."})]}),i.jsxs("div",{className:"sm:max-w-3xl md:col-span-2",children:[!a&&!s&&i.jsx("p",{className:"mt-2 text-tremor-default",children:"Loading…"}),i.jsxs(Eu,{className:"mt-4 divide-y divide-tremor-border dark:divide-dark-tremor-border",children:[i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Status"}),i.jsx(qa,{filled:"true",children:a?.message??"NOK"})]}),i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Version"}),i.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content",children:a?.version??"-"})]}),a&&i.jsxs(i.Fragment,{children:[i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Running since"}),i.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content",children:new Date(a.start_time).toLocaleString()})]}),i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Mode"}),i.jsx(qa,{variant:"neutral",children:a.mode})]}),i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Proxy URL"}),t?i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:t}),i.jsx(on,{textToCopy:t,showLabel:!1})]}):i.jsx("span",{className:"text-tremor-default dark:text-dark-tremor-content",children:"Not set"})]}),a?.backend&&i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Backend URL"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(iw,{component:"backend"}),i.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:a.backend}),i.jsx(on,{textToCopy:a.backend,showLabel:!1})]})]}),a?.mode==="mock"&&i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Mock URL"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(iw,{component:"mock"}),i.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:t}),i.jsx(on,{textToCopy:t,showLabel:!1})]})]}),a?.mode==="catch"&&i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Catch URL"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(iw,{component:"catch"}),i.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:t}),i.jsx(on,{textToCopy:t,showLabel:!1})]})]}),i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Expose"}),i.jsx(qa,{children:a?.expose?"Yes":"No"})]}),a.expose&&r&&i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Expose URL"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:r}),i.jsx(on,{textToCopy:r,showLabel:!1})]})]}),i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"App"}),i.jsx(qa,{children:a?.app?"Yes":"No"})]})]})]})]})]}),i.jsx(Po,{className:"my-10"})]})}function Gwe({open:e,onClose:t,initialUrl:r="",onSubmit:n}){const[a,o]=m.useState(r),[s,l]=m.useState(null),[c,u]=m.useState(!1);if(m.useEffect(()=>{e&&(o(r),l(null),+u(!1))},[e,r]),!e)return null;const d=async()=>{u(!0),l(null);try{await n(a),t()}catch(f){console.error("Mock launch error",f),l(f.message||"Failed to launch mock"),u(!1)}};return i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Set OpenAPI URL"}),i.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",disabled:c,children:"×"})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{htmlFor:"openapi-url",className:"block text-sm font-medium text-gray-700",children:"OpenAPI Spec URL"}),i.jsx("input",{id:"openapi-url",type:"url",value:a,onChange:f=>{o(f.target.value),s&&l(null)},placeholder:"https://example.com/openapi.yaml",disabled:c,className:"mt-1 block w-full rounded-md shadow-sm sm:text-sm "+(s?"border-red-500 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300 focus:ring-blue-500 focus:border-blue-500")}),s&&i.jsx("p",{className:"mt-2 text-sm text-red-600",children:s})]}),i.jsxs("div",{className:"flex justify-end space-x-3",children:[i.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",disabled:c,children:"Cancel"}),i.jsx("button",{onClick:d,className:`px-4 py-2 text-white rounded ${c?"bg-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}`,disabled:c,children:c?"Loading…":"Launch Mock"})]})]})]})}function Zwe(){const{client:e}=fr(),[t,r]=m.useState(null),[n,a]=m.useState(!1),o=async()=>{try{const l=await e.mock.getConfig();r(l)}catch(l){console.error("Mock info error",l),r(null)}},s=async l=>{try{await e.mock.launch(l),o()}catch(c){throw console.error("Mock launch error",c),c}};return m.useEffect(()=>{o()},[]),i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Mock Details"}),i.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Information about your mock configuration."}),i.jsx("div",{className:"mt-4",children:i.jsx("button",{onClick:()=>a(!0),className:"whitespace-nowrap rounded-tremor-default bg-tremor-brand px-4 py-2.5 text-tremor-default font-medium text-tremor-brand-inverted shadow-tremor-input hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:shadow-dark-tremor-input dark:hover:bg-dark-tremor-brand-emphasis",children:"Set OpenAPI"})})]}),i.jsxs("div",{className:"sm:max-w-3xl md:col-span-2",children:[!t&&i.jsx("p",{className:"mt-2 text-tremor-default",children:"Loading mock info…"}),t&&i.jsxs(Eu,{className:"mt-4 divide-y divide-tremor-border dark:divide-dark-tremor-border",children:[i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Status"}),i.jsx(qa,{filled:"true",children:t?.status?"Active":"Inactive"})]}),i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"OpenAPI Spec"}),i.jsx("a",{href:t.openapi,target:"_blank",rel:"noopener noreferrer",className:"underline text-tremor-content dark:text-dark-tremor-content",children:t.openapi})]}),i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Examples"}),i.jsx(qa,{variant:"neutral",children:t?.examples})]})]})]})]}),i.jsx(Gwe,{open:n,onClose:()=>a(!1),initialUrl:t?.openapi,onSubmit:s}),i.jsx(Po,{className:"my-10"})]})}function Jwe({open:e,onClose:t,initialSecret:r="",initialTtl:n="",onSubmit:a}){const[o,s]=m.useState(r),[l,c]=m.useState(n),[u,d]=m.useState(null),[f,p]=m.useState(!1);if(m.useEffect(()=>{e&&(s(r),c(n),d(null),p(!1))},[e,r,n]),!e)return null;const h=async()=>{p(!0),d(null);try{await a(o,l),t()}catch(g){console.error("Authentication save error",g),d(g.message||"Failed to save"),p(!1)}};return i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Authentication Guard Settings"}),i.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",disabled:f,children:"×"})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{htmlFor:"auth-secret",className:"block text-sm font-medium text-gray-700",children:"Secret"}),i.jsx("input",{id:"auth-secret",type:"text",value:o,onChange:g=>{s(g.target.value),u&&d(null)},disabled:f,className:"mt-1 block w-full rounded-md shadow-sm border-gray-300 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{htmlFor:"auth-ttl",className:"block text-sm font-medium text-gray-700",children:"TTL (hours, optional)"}),i.jsx("input",{id:"auth-ttl",type:"number",value:l,onChange:g=>{c(g.target.value),u&&d(null)},placeholder:"24",disabled:f,className:"mt-1 block w-full rounded-md shadow-sm border-gray-300 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]}),u&&i.jsx("p",{className:"mt-2 text-sm text-red-600",children:u}),i.jsxs("div",{className:"flex justify-end space-x-3",children:[i.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",disabled:f,children:"Cancel"}),i.jsx("button",{onClick:h,className:`px-4 py-2 text-white rounded ${f?"bg-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}`,disabled:f,children:f?"Saving…":"Save"})]})]})]})}const Qwe=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"h-4 w-4","aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})}),fc=({label:e,tooltip:t})=>{if(!t)return null;const r=`${e} details`;return i.jsx(Df,{content:t,sideOffset:6,side:"top",children:i.jsx("button",{type:"button","aria-label":r,className:"rounded-full p-1 text-gray-400 transition hover:text-gray-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-tremor-brand dark:text-gray-500 dark:hover:text-gray-300",children:i.jsx(Qwe,{})})})};function e2e(){const{apiEndpoint:e,client:t}=fr(),[r,n]=m.useState(null),[a,o]=m.useState(""),[s,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(null),[p,h]=m.useState(!1),[g,b]=m.useState(!1),y=r===null&&!d,v=async()=>{try{f(null);const w=await t.auth.getAuthenticationSettings();n(w),o(w.secret||""),l(String(w.token_ttl||"")),u(!!w.enabled)}catch(w){console.error("Authentication info error",w),f(w.message)}},k=async(w=a,E=s,C=c)=>{try{b(!0);const O={enabled:C,secret:w,token_ttl:E?parseInt(E,10):void 0},D=await t.auth.updateAuthenticationSettings(O);n(D),o(D.secret||""),l(String(D.token_ttl||"")),u(!!D.enabled),f(null)}catch(O){console.error("Security save error",O),f(O.message)}finally{b(!1)}},N=async()=>{await k(a,s,c)};return m.useEffect(()=>{v()},[e]),i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3 items-start",children:[i.jsxs("div",{className:"self-start",children:[i.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Backend Authentication Guard"}),i.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Use one of the following API Keys to authenticate requests to your backend."}),i.jsx("div",{className:"mt-4",children:i.jsx("button",{type:"button",onClick:()=>h(!0),className:"whitespace-nowrap rounded-tremor-default bg-tremor-brand px-4 py-2.5 text-tremor-default font-medium text-tremor-brand-inverted shadow-tremor-input hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:shadow-dark-tremor-input dark:hover:bg-dark-tremor-brand-emphasis",children:"Configure Authentication"})})]}),i.jsxs("div",{className:"sm:max-w-3xl md:col-span-2 space-y-4",children:[r&&i.jsxs(Eu,{className:"mt-4 divide-y divide-tremor-border dark:divide-dark-tremor-border",children:[i.jsxs(Tr,{className:"py-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Guard Protection"}),i.jsx(fc,{label:"Authentication Guard",tooltip:"Enable API key authentication on all requests."})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs(Tf,{checked:c,onChange:async w=>{u(w),await k(a,s,w)},disabled:g||y,className:ya("relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand focus-visible:ring-offset-2",c?"bg-tremor-brand dark:bg-dark-tremor-brand":"bg-gray-200 dark:bg-gray-700",g||y?"opacity-60 cursor-not-allowed":""),children:[i.jsx("span",{className:"sr-only",children:"Toggle Authentication Guard"}),i.jsx("span",{"aria-hidden":"true",className:ya("pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out",c?"translate-x-4":"translate-x-0")})]}),i.jsx("span",{className:"text-sm font-medium text-tremor-content dark:text-dark-tremor-content",children:c?"Enabled":"Disabled"}),g&&i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Saving…"})]})]}),i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong min-w-10",children:"inspectr-auth-key"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:r.auth_key||"-"}),i.jsx(on,{textToCopy:r.auth_key||"",showLabel:!1})]})]}),i.jsxs(Tr,{className:"py-3 flex justify-between items-start",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong w-40 flex-shrink-0",children:"inspectr-auth-token"}),i.jsxs("div",{className:"flex flex-col items-end space-y-1",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:r.auth_token||"-"}),i.jsx(on,{textToCopy:r.auth_token||"",showLabel:!1})]}),i.jsx("div",{className:"flex items-center space-x-2",children:i.jsx("button",{type:"button",onClick:N,className:"px-2 py-0.5 rounded bg-tremor-brand text-white hover:bg-tremor-brand-emphasis text-xs",children:"Renew"})})]})]}),i.jsxs(Tr,{className:"py-3 flex justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"inspectr-auth-token Expiration"}),i.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content",children:r.auth_token_expiration?new Date(r.auth_token_expiration).toLocaleString():"-"})]})]}),d&&i.jsx("p",{className:"text-sm text-red-600",children:d})]})]}),i.jsx(Jwe,{open:p,onClose:()=>h(!1),initialSecret:a,initialTtl:s,onSubmit:async(w,E)=>{o(w),l(E),await k(w,E,c)}}),i.jsx(Po,{className:"my-10"})]})}const a9=[{slug:"feat_export_openapi",title:"Export as OpenAPI Document",description:"Export your API operations as an OpenAPI document. This document can be used as a starting point for building a custom OpenAPI document.",image:"https://inspectr.dev/preview/export-openapi.png"},{slug:"feat_export_postman",title:"Export as Postman Collection",description:"Export your API operations as a Postman collection. The Postman collection contains all requests based on the Inspectr Operations history.",image:"https://inspectr.dev/preview/export-postman.png"}],t2e=[{slug:"feat_connectors",title:"Inspectr Connectors",description:"Forward Inspectr events to other services by configuring outbound connectors.",image:void 0,defaultEnabled:!1,removeWhenFalse:!0},{slug:"feat_insights_display",title:"Insights Display",description:"Show the insights explorer navigation with Endpoint, List, Table, and Timeline modes.",image:void 0,defaultEnabled:!1,removeWhenFalse:!0}];function r2e(){const[e]=dr("future","false"),t=e==="true",r=x.useMemo(()=>t?[...a9,...t2e]:a9,[t]).map(n=>{const[a,o]=vo(n.slug,n.defaultEnabled,n.removeWhenFalse);return{...n,enabled:a,setEnabled:o}});return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3 items-start",children:[i.jsxs("div",{className:"self-start",children:[i.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Feature Previews"}),i.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Enable or disable experimental features."})]}),i.jsx("div",{className:"sm:max-w-3xl md:col-span-2 space-y-6",children:r.map(n=>i.jsxs("div",{className:"flex items-start space-x-4",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("h3",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:n.title}),i.jsx("p",{className:"mt-1 text-tremor-content dark:text-dark-tremor-content",children:n.description})]}),n.image&&i.jsx("img",{src:n.image,alt:n.slug,className:"w-32 border border-tremor-border dark:border-dark-tremor-border rounded"}),i.jsxs("div",{className:"flex items-center pt-1 space-x-3",children:[i.jsxs(Tf,{checked:!!n.enabled,onChange:()=>n.setEnabled(!n.enabled),className:ya("relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60",n.enabled?"bg-tremor-brand dark:bg-dark-tremor-brand":"bg-gray-200 dark:bg-gray-700"),children:[i.jsx("span",{className:"sr-only",children:n.enabled?"Disable feature preview":"Enable feature preview"}),i.jsx("span",{"aria-hidden":"true",className:ya("pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out",n.enabled?"translate-x-4":"translate-x-0")})]}),i.jsx("span",{className:"text-sm font-medium text-tremor-content dark:text-dark-tremor-content",children:n.enabled?"Enabled":"Disabled"})]})]},n.slug))})]}),i.jsx(Po,{className:"my-10"})]})}function n2e(){const{client:e}=fr(),[t,r]=m.useState(null),[n,a]=m.useState(!0),[o,s]=m.useState(!1),[l,c]=m.useState(""),[u,d]=m.useState(!1),f=m.useCallback(async()=>{if(!e?.mcp?.getMCPServerSettings){r(null),a(!1);return}try{c(""),a(!0);const E=await e.mcp.getMCPServerSettings();r(E),d(!!E?.public)}catch(E){console.error("Failed to load MCP server settings",E),r(null),c(E.message||"Failed to load MCP server info")}finally{a(!1)}},[e]);m.useEffect(()=>{f()},[f]);const p=async E=>{if(!e?.mcp?.updateMCPServerSettings)return;const C=u;d(E),s(!0),c("");try{const O=await e.mcp.updateMCPServerSettings({public:E});r(O),d(!!O?.public)}catch(O){console.error("Failed to update MCP public exposure",O),d(C),c(O.message||"Failed to update MCP server visibility")}finally{s(!1)}},h=t||{},g=h?.local_url||h?.url||"",b=h?.public_url||"",y=h?.enabled??!!g,v=y?"Active":"Inactive",k=b||(u?"Activating public MCP access…":"-"),N="text-tremor-content dark:text-dark-tremor-content break-all text-sm",w=!!b;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"MCP Server (Preview)"}),i.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Connection details for the built-in MCP server for Inspectr."})]}),i.jsxs("div",{className:"sm:max-w-3xl md:col-span-2",children:[n&&i.jsx("p",{className:"mt-2 text-tremor-default",children:"Loading MCP server info…"}),l&&i.jsx("p",{className:"mt-2 text-tremor-default text-red-600 dark:text-red-400",children:l}),t?i.jsxs(Eu,{className:"mt-4 divide-y divide-tremor-border dark:divide-dark-tremor-border",children:[i.jsxs(Tr,{className:"py-3 flex items-center justify-between",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Status"}),i.jsx(qa,{filled:!0,variant:y?"success":"neutral",children:v})]}),i.jsxs(Tr,{className:"py-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Public access"}),i.jsx(fc,{label:"Public access",tooltip:"Allow external agents to connect through the public Inspectr MCP endpoint."})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs(Tf,{checked:u,onChange:p,disabled:o||n,className:ya("relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand focus-visible:ring-offset-2",u?"bg-tremor-brand dark:bg-dark-tremor-brand":"bg-gray-200 dark:bg-gray-700",o||n?"opacity-60 cursor-not-allowed":""),children:[i.jsx("span",{className:"sr-only",children:"Toggle public MCP access"}),i.jsx("span",{"aria-hidden":"true",className:ya("pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out",u?"translate-x-4":"translate-x-0")})]}),i.jsx("span",{className:"text-sm font-medium text-tremor-content dark:text-dark-tremor-content",children:u?"Enabled":"Local only"}),o&&i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Saving…"})]})]}),i.jsxs(Tr,{className:"py-3 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Local URL"}),i.jsx(fc,{label:"Local URL",tooltip:"Use this endpoint when connecting from the same network as your Inspectr instance."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:N,children:g||"-"}),g&&i.jsx(on,{textToCopy:g,showLabel:!1})]})]}),i.jsxs(Tr,{className:"py-3 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Public URL"}),i.jsx(fc,{label:"Public URL",tooltip:"Share this endpoint with external MCP clients after enabling public access."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:ya(N,w?"":"text-gray-500 dark:text-gray-400"),children:k}),w&&i.jsx(on,{textToCopy:b,showLabel:!1})]})]})]}):!n&&!l&&i.jsx("p",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"MCP server settings are unavailable."})]})]}),i.jsx(Po,{className:"my-10"})]})}function a2e(){const{client:e}=fr(),[t,r]=m.useState(null),[n,a]=m.useState(!0),[o,s]=m.useState(!1),[l,c]=m.useState(""),[u,d]=m.useState({enabled:!1,channel:"",channel_code:""}),f=m.useCallback(async()=>{if(!e?.expose?.getExposeSettings){r(null),a(!1);return}try{c(""),a(!0);const N=await e.expose.getExposeSettings();r(N),d({enabled:!!N?.enabled,channel:N?.channel||"",channel_code:N?.channel_code||""})}catch(N){console.error("Failed to load expose settings",N),c(N.message||"Failed to load expose settings"),r(null)}finally{a(!1)}},[e]);m.useEffect(()=>{f()},[f]);const p=async()=>{if(e?.expose?.putExposeSettings){s(!0),c("");try{const N={enabled:!!u.enabled,channel:u.channel||void 0,channel_code:u.channel_code||void 0},w=await e.expose.putExposeSettings(N);r(w),d({enabled:!!w?.enabled,channel:w?.channel||"",channel_code:w?.channel_code||""})}catch(N){console.error("Failed to save expose settings",N),c(N.message||"Failed to save expose settings")}finally{s(!1)}}},h=t?.local_url||"-",g=t?.public_url||"",b=!!t?.enabled,y=m.useMemo(()=>t!==null,[t]),v=m.useMemo(()=>t?!!u.enabled!=!!t?.enabled||u.channel!==(t?.channel||"")||u.channel_code!==(t?.channel_code||""):!1,[u.channel,u.channel_code,u.enabled,t]),k=b;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Expose settings"}),i.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Control whether Inspectr exposes the proxy endpoint publicly and configure the channel credentials."})]}),i.jsxs("div",{className:"sm:max-w-3xl md:col-span-2",children:[n&&i.jsx("p",{className:"text-sm text-tremor-default",children:"Loading expose settings…"}),l&&i.jsx("div",{className:"mt-1 space-y-2 text-sm text-red-600 dark:text-red-400",children:i.jsx("p",{children:l})}),!n&&t&&i.jsxs(Eu,{className:"mt-2 divide-y divide-tremor-border dark:divide-dark-tremor-border",children:[i.jsxs(Tr,{className:"py-3 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Status"}),i.jsx(fc,{label:"Expose status",tooltip:"Expose forwards the local proxy through a public channel controlled by Inspectr."})]}),i.jsx(qa,{filled:!0,variant:k?"success":"neutral",children:k?"Enabled":"Disabled"})]}),i.jsxs(Tr,{className:"py-3 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Local URL"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm text-tremor-content break-all",children:h}),h!=="-"&&i.jsx(on,{textToCopy:h,showLabel:!1})]})]}),i.jsxs(Tr,{className:"py-3 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Public URL"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm text-tremor-content break-all",children:g||"Not available"}),g&&i.jsx(on,{textToCopy:g,showLabel:!1})]})]})]}),i.jsx(Po,{className:"my-8"}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-[220px_minmax(0,1fr)] md:items-center md:gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content",children:"Enable expose toggle"}),i.jsx(fc,{label:"Expose",tooltip:"Enable to share the viewport through a public channel and expose operations externally."})]}),i.jsxs(Tf,{checked:u.enabled,onChange:N=>d(w=>({...w,enabled:N})),disabled:o||n||!y,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-all duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 ${u.enabled?"bg-tremor-brand dark:bg-dark-tremor-brand":"bg-gray-200 dark:bg-gray-700"}`,children:[i.jsx("span",{className:"sr-only",children:"Toggle expose"}),i.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow transition duration-200 ease-in-out ${u.enabled?"translate-x-4":"translate-x-0"}`})]})]}),i.jsxs("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-[220px_minmax(0,1fr)] md:items-center md:gap-4",children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Channel"}),i.jsx("input",{type:"text",value:u.channel,onChange:N=>d(w=>({...w,channel:N.target.value})),disabled:o||n||!y,placeholder:"hello-world",className:"w-full border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content border-gray-300 dark:border-dark-tremor-border rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]}),i.jsxs("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-[220px_minmax(0,1fr)] md:items-center md:gap-4",children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Channel code"}),i.jsx("input",{type:"text",value:u.channel_code,onChange:N=>d(w=>({...w,channel_code:N.target.value})),disabled:o||n||!y,placeholder:"12345ABC",className:"w-full border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content border-gray-300 dark:border-dark-tremor-border rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]}),i.jsxs("div",{className:"mt-6 md:ml-[220px] flex items-center gap-3 justify-end",children:[i.jsx("button",{type:"button",onClick:()=>d({enabled:!!t?.enabled,channel:t?.channel||"",channel_code:t?.channel_code||""}),disabled:!y||o||!v,className:"px-4 py-2 rounded border border-gray-300 text-gray-700 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-subtle",children:"Cancel"}),i.jsx("button",{type:"button",onClick:p,disabled:!y||o||!v,className:`px-4 py-2 rounded text-white ${o?"bg-gray-400":b?"bg-red-600 hover:bg-red-700 dark:bg-red-700 dark:hover:bg-red-800":"bg-green-600 hover:bg-green-700 dark:bg-green-700 dark:hover:bg-green-800"}`,children:o?"Saving…":b?"Disable expose":"Enable expose"}),!y&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Expose settings are unavailable for this installation."})]})]})]}),i.jsx(Po,{className:"my-10"})]})}const o2e={name:"",server_url:"",description:"",enabled:!0,headers:{}},o9=(e={})=>{if(!e||typeof e!="object")return[{key:"",value:""}];const t=Object.entries(e);return t.length===0?[{key:"",value:""}]:t.map(([r,n])=>({key:r,value:String(n??"")}))},s2e=e=>e.reduce((t,{key:r,value:n})=>{const a=r.trim();return a&&(t[a]=n??""),t},{}),i2e=(e={})=>{const t=Object.entries(e||{});if(t.length===0)return{authName:"Authorization",authToken:"",restHeaders:{}};const r=t.map(([c,u])=>[c,u,c.toLowerCase()]);let n=r.find(([,,c])=>c==="authorization");if(n||(n=r.find(([,c])=>typeof c=="string"&&/^\s*Bearer\s+/i.test(c))),!n)return{authName:"Authorization",authToken:"",restHeaders:e};const[a,o]=n,s=typeof o=="string"?o.replace(/^\s*Bearer\s+/i,""):String(o??""),l=t.filter(([c])=>c!==a).reduce((c,[u,d])=>(c[u]=d,c),{});return{authName:a,authToken:s,restHeaders:l}};function l2e({open:e,mode:t="create",initialData:r=o2e,onClose:n,onSubmit:a}){const[o,s]=m.useState(r.name||""),[l,c]=m.useState(r.server_url||""),[u,d]=m.useState(r.description||""),[f,p]=m.useState(typeof r.enabled=="boolean"?r.enabled:!0),[h,g]=m.useState(o9(r.headers)),[b,y]=m.useState("Authorization"),[v,k]=m.useState(""),[N,w]=m.useState(!1),[E,C]=m.useState(null),[O,D]=m.useState(!1);m.useEffect(()=>{if(e){s(r.name||""),c(r.server_url||""),d(r.description||""),p(typeof r.enabled=="boolean"?r.enabled:!0);const{authName:F,authToken:V,restHeaders:H}=i2e(r.headers);y(F||"Authorization"),k(V||""),g(o9(H));const $=Object.keys(H||{}).length>0;w(!!V||$),C(null),D(!1)}},[e,r]);const A=m.useMemo(()=>O||!o.trim()||!l.trim(),[O,o,l]);if(!e)return null;const M=(F,V,H)=>{g($=>{const z=[...$];return z[F]={...z[F],[V]:H},z})},I=()=>{g(F=>[...F,{key:"",value:""}])},T=F=>{g(V=>V.length===1?[{key:"",value:""}]:V.filter((H,$)=>$!==F))},R=async()=>{if(!A){D(!0),C(null);try{const F={name:o.trim(),server_url:l.trim(),description:u.trim(),enabled:!!f},V=s2e(h),H=b.trim(),$=v.trim();H&&$&&(V[H]=/^Bearer\s+/i.test($)?$:`Bearer ${$}`),F.headers=V,await a(F),n()}catch(F){console.error("Connector save error",F),C(F?.message||"Failed to save connector"),D(!1)}}},L=()=>w(F=>!F);return i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-40",onClick:()=>O?null:n()}),i.jsxs("div",{className:"relative z-10 w-full max-w-2xl mx-4 rounded-lg bg-white p-6 shadow-xl",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:t==="edit"?"Edit Connector":"Create Connector"}),i.jsx("button",{type:"button",onClick:n,className:"text-gray-500 hover:text-gray-700","aria-label":"Close",disabled:O,children:"×"})]}),i.jsxs("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto pr-1",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"connector-name",className:"block text-sm font-medium text-gray-700",children:"Name"}),i.jsx("input",{id:"connector-name",type:"text",value:o,onChange:F=>s(F.target.value),disabled:O,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand",placeholder:"Custom Connector"})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"connector-server-url",className:"block text-sm font-medium text-gray-700",children:"Server URL"}),i.jsx("input",{id:"connector-server-url",type:"url",value:l,onChange:F=>c(F.target.value),disabled:O,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand",placeholder:"http://localhost:3100"})]}),i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"connector-description",className:"block text-sm font-medium text-gray-700",children:["Description ",i.jsx("span",{className:"text-xs text-gray-300",children:"(optional)"})]}),i.jsx("input",{id:"connector-description",value:u,onChange:F=>d(F.target.value),disabled:O,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand",placeholder:"A custom connector for integrating with Inspectr Rules."})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("input",{id:"connector-enabled",type:"checkbox",checked:!!f,onChange:F=>p(F.target.checked),disabled:O,className:"h-5 w-5 rounded border-gray-300 text-tremor-brand focus:ring-tremor-brand"}),i.jsx("label",{htmlFor:"connector-enabled",className:"text-sm font-medium text-gray-700",children:"Enabled"})]}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:L,className:"text-sm font-medium text-tremor-brand hover:text-tremor-brand-emphasis",disabled:O,children:"Configure authentication & headers"}),N&&i.jsxs("div",{className:"mt-3 space-y-4 rounded-lg border border-tremor-border bg-tremor-background-muted p-4 dark:border-dark-tremor-border dark:bg-dark-tremor-background",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"API Token Authentication"}),i.jsxs("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"connector-auth-header",className:"block text-sm font-medium text-gray-700",children:"Header Name"}),i.jsx("input",{id:"connector-auth-header",type:"text",value:b,onChange:F=>y(F.target.value),disabled:O,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand",placeholder:"Authorization"})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"connector-auth-token",className:"block text-sm font-medium text-gray-700",children:"Bearer Token"}),i.jsx("input",{id:"connector-auth-token",type:"text",value:v,onChange:F=>k(F.target.value),disabled:O,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand",placeholder:"Bearer Token"})]})]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700",children:"Additional Headers"}),i.jsx("button",{type:"button",onClick:I,disabled:O,className:"text-sm font-medium text-tremor-brand hover:text-tremor-brand-emphasis",children:"Add header"})]}),i.jsx("div",{className:"mt-2 space-y-2",children:h.map((F,V)=>i.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_1fr_auto]",children:[i.jsx("input",{type:"text",value:F.key,onChange:H=>M(V,"key",H.target.value),placeholder:"Header name",disabled:O,className:"rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand"}),i.jsx("input",{type:"text",value:F.value,onChange:H=>M(V,"value",H.target.value),placeholder:"Header value",disabled:O,className:"rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand"}),i.jsx("button",{type:"button",onClick:()=>T(V),disabled:O,className:"text-sm text-red-600 hover:text-red-700",children:"Remove"})]},V))})]})]})]}),E&&i.jsx("p",{className:"text-sm text-red-600",children:E})]}),i.jsxs("div",{className:"mt-6 flex justify-end space-x-3",children:[i.jsx("button",{type:"button",onClick:n,disabled:O,className:"rounded-md bg-gray-200 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-300",children:"Cancel"}),i.jsx("button",{type:"button",onClick:R,disabled:A,className:`rounded-md px-4 py-2 text-sm font-medium text-white ${A?"bg-gray-400 cursor-not-allowed":"bg-tremor-brand hover:bg-tremor-brand-emphasis"}`,children:O?"Saving…":t==="edit"?"Save changes":"Create connector"})]})]})]})}const s9={pending:{label:"Pending",description:"Inspectr is still discovering the connector metadata.",dotClass:"fill-amber-500 dark:fill-amber-400 animate-pulse",badgeProps:{variant:"neutral",filled:!0,backgroundClass:"border-amber-300 bg-amber-100 text-amber-700 dark:border-amber-500 dark:bg-amber-900/40 dark:text-amber-200"}},ready:{label:"Ready",description:"The connector is healthy and routable.",dotClass:"fill-emerald-500 dark:fill-emerald-400",badgeProps:{variant:"success",filled:!0}},disabled:{label:"Disabled",description:"The connector is disabled and will never receive traffic.",dotClass:"fill-gray-300 dark:fill-gray-500",badgeProps:{variant:"neutral",filled:!0,backgroundClass:"border-gray-300 bg-gray-200 text-gray-600 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300"}},disconnected:{label:"Disconnected",description:"The connector is temporarily unreachable and will be retried with backoff.",dotClass:"fill-rose-500 dark:fill-rose-400",badgeProps:{variant:"error",filled:!0}},unknown:{label:"Unknown",description:"The connector status is unknown.",dotClass:"fill-gray-300 dark:fill-gray-600 animate-pulse",badgeProps:{variant:"neutral",filled:!0,backgroundClass:"border-gray-300 bg-gray-200 text-gray-600 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300"}}},DR=e=>{const t=e?.status||e?.record?.status;return t?String(t).toLowerCase():e?.record?.enabled===!1?"disabled":e?.ready===!0?"ready":e?.ready===!1?"disconnected":"pending"},FE=e=>s9[e]||s9.unknown,c2e=e=>e?Array.isArray(e)?e:Array.isArray(e.connectors)?e.connectors:[]:[],Ad=e=>{if(!e)return"-";try{return new Date(e).toLocaleString()}catch{return e}},u2e=({headers:e})=>{const t=m.useMemo(()=>!e||typeof e!="object"?[]:Object.entries(e),[e]);return t.length===0?i.jsx("p",{className:"text-sm text-tremor-content",children:"No headers configured."}):i.jsx("dl",{className:"mt-1 space-y-1",children:t.map(([r,n])=>i.jsxs("div",{className:"grid grid-cols-[120px_1fr] gap-2 text-sm",children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:r}),i.jsx("dd",{className:"break-all text-tremor-content dark:text-dark-tremor-content",children:String(n??"")})]},r))})},d2e=({actions:e})=>!Array.isArray(e)||e.length===0?i.jsx("p",{className:"text-sm text-tremor-content",children:"No actions exposed."}):i.jsx("div",{className:"space-y-2",children:e.map(t=>i.jsxs("div",{className:"rounded border border-tremor-border p-3",children:[i.jsx("p",{className:"text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:t?.label||t?.type||"Action"}),i.jsx("p",{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:t?.description||"No description provided."}),Array.isArray(t?.params)&&t.params.length>0&&i.jsxs("div",{className:"mt-2 text-xs text-tremor-content dark:text-dark-tremor-content",children:[i.jsx("p",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Parameters"}),i.jsx("ul",{className:"mt-1 space-y-1 list-disc pl-5",children:t.params.map(r=>i.jsxs("li",{children:[i.jsx("span",{className:"font-medium",children:r?.name}),r?.required?" (required)":""," - ",r?.description||r?.type]},r?.name||r?.type))})]})]},t?.type||t?.label))}),LR=({status:e,lastSync:t,error:r})=>{const n=e?String(e).toLowerCase():"unknown",a=FE(n),o=[a.description];t&&o.push(`Last sync: ${Ad(t)}`),r&&o.push(`Last error: ${r}`);const s=i.jsx("span",{className:"block whitespace-pre-line",children:o.filter(Boolean).join(`
183
- `)});return i.jsx(Df,{content:s,sideOffset:4,side:"left",children:i.jsx("svg",{viewBox:"0 0 6 6","aria-hidden":"true",className:ya("h-3 w-3",a.dotClass),children:i.jsx("circle",{r:"3",cx:"3",cy:"3"})})})},f2e=({open:e})=>i.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:ya("h-4 w-4 text-tremor-content-subtle transition-transform duration-200 dark:text-dark-tremor-content-subtle",e?"-rotate-180":"rotate-0"),children:i.jsx("path",{fill:"currentColor",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 10.94l3.71-3.71a.75.75 0 0 1 1.06 1.06l-4.24 4.25a.75.75 0 0 1-1.06 0L5.21 8.29a.75.75 0 0 1 .02-1.08Z"})}),lw=({title:e,defaultOpen:t=!1,children:r})=>i.jsx(xy,{defaultOpen:t,children:({open:n})=>i.jsxs("div",{className:"rounded-lg border border-tremor-border bg-white dark:border-dark-tremor-border dark:bg-dark-tremor-background",children:[i.jsxs(xy.Button,{className:"flex w-full items-center justify-between gap-3 px-4 py-3 text-sm font-semibold bg-gray-100 text-tremor-content-strong transition hover:bg-gray-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:text-dark-tremor-content-strong dark:hover:bg-dark-tremor-background-muted",children:[i.jsx("span",{children:e}),i.jsx(f2e,{open:n})]}),i.jsx(xy.Panel,{className:"mt-4 px-4 pb-4 text-sm text-tremor-content dark:text-dark-tremor-content",children:r})]})}),m2e=({connector:e})=>{const t=e?.record||{},r=e?.info||{},n=e?.actions,a=DR(e),o=FE(a);return i.jsxs("div",{className:"mt-4 space-y-3",children:[i.jsxs(lw,{title:"Connector Details",defaultOpen:!0,children:[i.jsxs("dl",{className:"grid gap-y-2 sm:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Status"}),i.jsxs("dd",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(LR,{status:a,lastSync:e?.last_sync,error:e?.last_error}),i.jsx(qa,{...o.badgeProps||{},children:o.label})]}),i.jsx("p",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:o.description})]})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Source"}),i.jsx("dd",{children:t.source||"-"})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Created"}),i.jsx("dd",{children:Ad(t.created_at)})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Updated"}),i.jsx("dd",{children:Ad(t.updated_at)})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Last sync"}),i.jsx("dd",{children:Ad(e?.last_sync)})]}),e?.last_error&&i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong text-red-600 dark:text-red-400",children:"Last error"}),i.jsx("dd",{className:"text-red-600 dark:text-red-400",children:e.last_error})]})]}),i.jsxs("div",{className:"mt-4",children:[i.jsx("p",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Headers"}),i.jsx(u2e,{headers:t.headers})]})]}),i.jsx(lw,{title:"Service Info",children:r&&Object.keys(r).length>0?i.jsxs("dl",{className:"space-y-2",children:[i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Name"}),i.jsx("dd",{children:r.name||"-"})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Version"}),i.jsx("dd",{children:r.version||"-"})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Protocol version"}),i.jsx("dd",{children:r.protocol_version??"-"})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Maintainer"}),i.jsx("dd",{children:r.maintainer||"-"})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Description"}),i.jsx("dd",{children:r.description||"-"})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Supported events"}),i.jsx("dd",{children:Array.isArray(r.supported_events)&&r.supported_events.length>0?r.supported_events.join(", "):"—"})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Supported models"}),i.jsx("dd",{children:Array.isArray(r.supported_models)&&r.supported_models.length>0?r.supported_models.map(s=>`${s?.kind||"-"} ${s?.version?`(${s.version})`:""}`).join(", "):"—"})]})]}):i.jsx("p",{children:"No metadata available."})}),i.jsx(lw,{title:"Actions",children:i.jsx(d2e,{actions:n})})]})};function p2e(){const{client:e,setToast:t}=fr(),[r,n]=m.useState([]),[a,o]=m.useState(!0),[s,l]=m.useState(null),[c,u]=m.useState(null),[d,f]=m.useState(!1),[p,h]=m.useState("create"),[g,b]=m.useState(null),[y,v]=m.useState(null),[k,N]=m.useState(null),[w,E]=m.useState(!1),[C,O]=m.useState(""),D=m.useCallback(async()=>{try{o(!0),l(null);const H=await e.connectors.list(),$=c2e(H);n($),u(z=>z&&($.some(W=>W?.record?.id===z)?z:null))}catch(H){console.error("Connectors load error",H),l(H?.message||"Failed to load connectors"),n([])}finally{o(!1)}},[e]);m.useEffect(()=>{D()},[D]);const A=()=>{h("create"),b(null),f(!0)},M=H=>{h("edit"),b(H?.record||null),f(!0)},I=H=>{const $=H?.record;$?.id&&(N($),O(""))},T=async()=>{if(k?.id){E(!0),O(""),v(k.id);try{await e.connectors.delete(k.id),t?.({message:"Connector deleted",type:"success"}),c===k.id&&u(null),N(null),D()}catch(H){console.error("Connector delete error",H),t?.({type:"error",message:H?.message||"Failed to delete connector"}),O(H?.message||"Failed to delete connector")}finally{E(!1),v(null)}}},R=()=>{w||(N(null),O(""))},L=async H=>{if(p==="edit"&&g?.id){const z=await e.connectors.update(g.id,H);return t?.({message:"Connector updated",type:"success"}),D(),z}const $=await e.connectors.create(H);return t?.({message:"Connector created",type:"success"}),D(),$},F=async H=>{const $=H?.record;if($?.id){v($.id);try{const z={name:$.name,server_url:$.server_url,description:$.description,enabled:!$.enabled,headers:$.headers||{}};await e.connectors.update($.id,z),t?.({message:`Connector ${$.enabled?"disabled":"enabled"}`,type:"success"}),D()}catch(z){console.error("Connector toggle error",z),t?.({type:"error",message:z?.message||"Failed to update connector status"})}finally{v(null)}}},V=r.length>0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3 items-start",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Connectors (Preview)"}),i.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Manage outbound connectors to forward Inspectr events to other services."}),i.jsxs("div",{className:"mt-4 flex flex-wrap gap-3",children:[i.jsx("button",{type:"button",onClick:A,className:"rounded-tremor-default bg-tremor-brand px-4 py-2.5 text-tremor-default font-medium text-tremor-brand-inverted shadow-tremor-input hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:shadow-dark-tremor-input dark:hover:bg-dark-tremor-brand-emphasis",children:"Create connector"}),i.jsx("button",{type:"button",onClick:D,className:"rounded-tremor-default border border-tremor-border px-4 py-2.5 text-tremor-default font-medium text-tremor-content hover:bg-tremor-background-muted dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted",children:"Refresh"})]})]}),i.jsxs("div",{className:"sm:max-w-4xl md:col-span-2",children:[a&&i.jsx("p",{className:"text-tremor-default",children:"Loading connectors…"}),!a&&s&&i.jsx("p",{className:"text-sm text-red-600",children:s}),!a&&!s&&!V&&i.jsx("div",{className:"rounded-lg border border-dashed border-tremor-border p-6 text-center text-sm text-tremor-content dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"No connectors yet. Create one to start forwarding events."}),!a&&!s&&V&&i.jsx("div",{className:"space-y-4",children:r.map((H,$)=>{const z=H?.record||{},W=z.id||z.name||`connector-${$}`,U=y===z.id,X=DR(H),Y=FE(X);return i.jsxs("div",{className:"rounded-lg border border-tremor-border bg-white p-4 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background",children:[i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("p",{className:"text-base font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:z.name||"Unnamed connector"}),i.jsx("p",{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:z.description||"No description provided."})]}),i.jsxs("div",{className:"flex gap-2 sm:justify-end self-start",children:[i.jsx("button",{type:"button",onClick:()=>u(ae=>ae===z.id?null:z.id),className:"rounded-md border border-tremor-border px-3 py-2 text-sm font-medium text-tremor-content hover:bg-tremor-background-muted dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted disabled:cursor-not-allowed disabled:opacity-70",disabled:U,children:(z.id,"Details")}),i.jsx("button",{type:"button",onClick:()=>M(H),className:"rounded-md border border-tremor-border px-3 py-2 text-sm font-medium text-tremor-content hover:bg-tremor-background-muted dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted disabled:cursor-not-allowed disabled:opacity-70",disabled:U,children:"Edit"}),i.jsx("button",{type:"button",onClick:()=>I(H),className:"rounded-md border border-red-200 px-3 py-2 text-sm font-medium text-red-600 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-70",disabled:U,children:"Delete"})]}),i.jsx("div",{className:"sm:col-span-2",children:i.jsxs("div",{className:"flex items-center justify-between text-xs",children:[i.jsx("p",{className:"uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:z.server_url||"—"}),H?.last_sync&&i.jsxs("p",{className:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:["Last sync: ",Ad(H.last_sync)]})]})}),X!=="ready"&&H?.last_error&&i.jsx("div",{className:"sm:col-span-2",children:i.jsxs("div",{className:"rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:border-amber-600 dark:bg-amber-950/40 dark:text-amber-200",children:[i.jsx("span",{className:"font-medium",children:"Connection warning:"})," ",H.last_error]})}),i.jsx("div",{className:"sm:col-span-2",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-xs text-tremor-content dark:text-dark-tremor-content",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:"Connection"}),i.jsx(LR,{status:X,lastSync:H?.last_sync,error:H?.last_error}),i.jsx(qa,{...Y.badgeProps||{},children:Y.label})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:"Status"}),i.jsx(qa,{variant:z.enabled?"success":"neutral",filled:!0,children:z.enabled?"Enabled":"Disabled"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(Tf,{checked:!!z.enabled,onChange:()=>F(H),disabled:U,className:ya("relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60",z.enabled?"bg-tremor-brand dark:bg-dark-tremor-brand":"bg-gray-200 dark:bg-gray-700"),children:[i.jsx("span",{className:"sr-only",children:z.enabled?"Disable connector":"Enable connector"}),i.jsx("span",{"aria-hidden":"true",className:ya("pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out",z.enabled?"translate-x-4":"translate-x-0")})]}),i.jsx("span",{className:"font-medium",children:z.enabled?"Disable":"Enable"})]})]})})]}),c===z.id&&i.jsx(m2e,{connector:H})]},W)})})]})]}),i.jsx(wg,{open:!!k,rule:k,title:"Delete connector?",description:i.jsxs(i.Fragment,{children:["This will permanently remove"," ",i.jsx("span",{className:"font-medium",children:k?.name||k?.id||"this connector"})," ","and its configuration."]}),confirmLabel:"Delete Connector",isDeleting:w,error:C,onCancel:R,onConfirm:T}),i.jsx(l2e,{open:d,mode:p,initialData:g||void 0,onClose:()=>f(!1),onSubmit:L}),i.jsx(Po,{className:"my-10"})]})}const i9=[{slug:"general",label:"General"},{slug:"mock",label:"Mock"},{slug:"guard",label:"Authentication Guard"},{slug:"connectors",label:"Connectors"},{slug:"expose",label:"Expose"},{slug:"mcp-server",label:"MCP Server"},{slug:"previews",label:"Feature Previews"}],l9=()=>{const{slug:e,operationId:t}=cs();return e==="settings"&&t?t:"general"};function h2e(){const[e,t]=m.useState(l9),[r]=vo("feat_connectors");m.useEffect(()=>{const o=()=>t(l9());return window.addEventListener("hashchange",o),()=>window.removeEventListener("hashchange",o)},[]),m.useEffect(()=>{e==="connectors"&&!r&&(window.history.replaceState(null,"","#settings/general"),t("general"))},[r,e]);const n=o=>{window.history.pushState(null,"",`#settings/${o}`),t(o)},a=r?i9:i9.filter(o=>o.slug!=="connectors");return i.jsxs("div",{className:"flex flex-col md:flex-row min-h-[calc(100vh-100px)] bg-white dark:bg-gray-950",children:[i.jsx("aside",{className:"md:w-56 border-b md:border-b-0 md:border-r border-tremor-border dark:border-dark-tremor-border md:min-h-full",children:i.jsx("nav",{className:"flex md:flex-col",children:a.map(o=>i.jsx("button",{onClick:()=>n(o.slug),className:`px-4 py-2 text-left text-tremor-default border-b md:border-b-0 md:border-l-4 md:py-3 ${e===o.slug?"md:border-tremor-brand md:text-tremor-brand text-tremor-brand font-medium bg-tremor-brand/5 dark:bg-dark-tremor-brand/10":"border-transparent text-tremor-content hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted"}`,children:o.label},o.slug))})}),i.jsxs("div",{className:"flex-1 h-full overflow-y-auto p-4 sm:px-6 sm:pb-10 sm:pt-10 lg:px-10 lg:pt-7 max-w-5xl mx-auto",children:[e==="general"&&i.jsxs(i.Fragment,{children:[i.jsx(Ywe,{}),i.jsx(Xwe,{})]}),e==="connectors"&&r&&i.jsx(p2e,{}),e==="mock"&&i.jsx(Zwe,{}),e==="guard"&&i.jsx(e2e,{}),e==="expose"&&i.jsx(a2e,{}),e==="mcp-server"&&i.jsx(n2e,{}),e==="previews"&&i.jsx(r2e,{})]})]})}function pl({message:e="No operations captured yet."}){return i.jsx("div",{className:"flex items-center justify-center rounded-tremor-small border border-dashed border-tremor-border py-16 text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:e})}function Su({method:e}){return i.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-1 text-xs font-semibold ${Kh(e)}`,children:e||"N/A"})}function kl({status:e}){const t=typeof e=="number"?e:Number(e);return i.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-1 text-xs font-semibold ${Qc(t)}`,children:e??"—"})}const g2e=e=>{const t=Number(e)||0;return t>=95?{label:"Healthy",color:"bg-emerald-500"}:t>=80?{label:"Warning",color:"bg-amber-500"}:{label:"Critical",color:"bg-rose-500"}};function b2e({endpoint:e}){const{method:t,path:r,host:n,count:a,successRate:o,averageDuration:s,p95Duration:l,chartData:c,latestStatus:u,seriesLoading:d,seriesError:f}=e,p=m.useMemo(()=>new Intl.NumberFormat,[]),h=g2e(o),g=d&&!c.length,b=f&&!c.length;return i.jsx(Dt,{className:"h-full rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",children:i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Su,{method:t}),i.jsx(Rn,{className:"text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:r})]}),n?i.jsx(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:n}):null]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(Bt,{color:"slate",children:["Requests ",p.format(a)]}),i.jsx(kl,{status:u})]})]}),i.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-4",children:[i.jsx("div",{className:"lg:col-span-3",children:g?i.jsx("div",{className:"flex h-36 items-center justify-center rounded-md border border-dashed border-tremor-border text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Loading series…"}):b?i.jsx("div",{className:"flex h-36 items-center justify-center rounded-md border border-rose-200 bg-rose-50 px-3 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:"Failed to load series"}):c.length?i.jsx(TD,{data:c,index:"time",categories:["duration","baseline"],colors:["cyan","gray"],showYAxis:!1,showLegend:!1,className:"h-36"}):i.jsx("div",{className:"flex h-36 items-center justify-center rounded-md border border-dashed border-tremor-border text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"No recent series data"})}),i.jsxs("div",{className:"flex flex-col justify-between gap-4 rounded-tremor-small bg-gray-50 p-4 dark:bg-dark-tremor-background",children:[i.jsxs("div",{children:[i.jsx(gt,{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:"Success rate"}),i.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[i.jsxs(Qo,{className:"!text-xl",children:[o,"%"]}),i.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium text-white ${h.color}`,children:h.label})]})]}),i.jsxs("div",{children:[i.jsx(gt,{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:"Avg duration"}),i.jsx(Qo,{className:"!text-xl",children:s?`${s}ms`:"N/A"}),i.jsxs(gt,{className:"mt-1 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:["p95 ",l?`${l}ms`:"N/A"]})]})]})]})]})})}function y2e({endpoints:e,loading:t,error:r}){return t?i.jsx(Dt,{className:"rounded-tremor-small border border-dashed border-tremor-border py-12 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Loading endpoint summary…"}):r?i.jsxs(Dt,{className:"rounded-tremor-small border border-rose-200 bg-rose-50 p-6 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:["Failed to load endpoint summary: ",r.message||"Unexpected error"]}):e.length?i.jsx(Rb,{numItemsSm:1,numItemsMd:1,numItemsLg:1,className:"gap-4",children:e.map(n=>i.jsx(b2e,{endpoint:n},n.key))}):i.jsx(pl,{message:"No endpoint activity to display yet."})}function x2e({operation:e}){return i.jsx(Dt,{className:"h-full rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Su,{method:e.method}),i.jsx(gt,{className:`text-xs font-semibold ${Nf(e.method)}`,children:e.method})]}),i.jsx(Rn,{className:"text-base text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e.path}),i.jsx(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:Tn(e.timestamp)}),e.host?i.jsxs(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:["Host ",e.host]}):null]}),i.jsxs("div",{className:"flex flex-col items-end gap-2",children:[i.jsx(kl,{status:e.status}),i.jsx(Bt,{color:"blue",children:Yn(e.duration)})]})]}),e.tags.length>0?i.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.tags.slice(0,6).map(t=>i.jsx(sl,{tag:t},t.token)),e.tags.length>6?i.jsxs("span",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:["+",e.tags.length-6," more"]}):null]}):null]})})}const v2e=100,k2e=40;function w2e({operations:e}){return e.length?i.jsx(Rb,{numItemsSm:1,numItemsLg:2,className:"gap-4",children:e.slice(0,v2e).map(t=>i.jsx(x2e,{operation:t},t.id))}):i.jsx(pl,{message:"Operations will appear here once traffic flows."})}const c9=["emerald","blue","violet","amber","rose","cyan","slate","stone"],Cj=1440*60*1e3,u9=480,cw=50,j2e=e=>e||e===0?String(e):"Unknown",N2e=e=>e?e.toUpperCase():"UNKNOWN",E2e=e=>e&&e.trim()?e:"Unknown",S2e=e=>e&&e.trim()?e:"Unknown",C2e=e=>{if(Number.isFinite(e?.timestampMs))return e.timestampMs;const t=Date.parse(e?.timestamp);return Number.isNaN(t)?null:t},RR=16,FR=18,O2e=50,uw=[{key:"status",dimension:"status",limit:O2e},{key:"method",dimension:"method",limit:12},{key:"host",dimension:"host",limit:12},{key:"path",dimension:"path",limit:FR},{key:"tags",dimension:"tag",limit:RR}],$R=e=>[...e].sort((t,r)=>r.count!==t.count?r.count-t.count:t.label.localeCompare(r.label)),sd=(e,t,r)=>{if(!t.length)return e;const n=new Map(e.map(a=>[a.value,a]));return t.forEach(a=>{n.has(a)||n.set(a,r(a))}),$R(Array.from(n.values()))},P2e={hour:3600*1e3,day:Cj,week:7*Cj},A2e=(e,t="day")=>{if(!e)return{label:"Unknown",sortValue:Number.POSITIVE_INFINITY,startMs:null,endMs:null};const r=new Date(e);if(Number.isNaN(r.getTime()))return{label:"Unknown",sortValue:Number.POSITIVE_INFINITY,startMs:null,endMs:null};const n=P2e[t]??Cj,a=r.getTime(),o=a+n-1;let s;return t==="hour"?s=r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):t==="week"?s=r.toLocaleDateString([],{month:"short",day:"numeric"}):s=r.toLocaleDateString([],{month:"short",day:"numeric"}),{label:s,sortValue:a,startMs:a,endMs:o}},BR=e=>Number(e?.requests??e?.total_requests??e?.count??0),M2e={status:e=>e?.status??e?.key??e?.value,method:e=>e?.method??e?.key??e?.value,host:e=>e?.host??e?.key??e?.value,path:e=>e?.path??e?.key??e?.value,tags:e=>e?.tag??e?.key??e?.value},HR={status:j2e,method:N2e,host:E2e,path:S2e,tags:e=>e&&typeof e=="string"?e:"Unknown"},T2e=(e,t)=>{const r=M2e[t],n=HR[t]||(o=>o??"Unknown");if(!r)return[];const a=e.map(o=>{const s=r(o),l=n(s);if(!l)return null;const c=Number(o?.count??o?.total??0);return{value:l,label:l,count:Number.isFinite(c)?c:0}}).filter(Boolean);return $R(a)},id=(e,t)=>{const r=(HR[e]||(n=>n??"Unknown"))(t);return{value:r,label:r,count:0}},_2e=(e,t,r,n)=>{if(!Array.isArray(e)||e.length===0)return[];const a=t.filter(s=>s!=="Other"),o=t.includes("Other");return e.map(s=>{const l=s?.timestamp??s?.date??s?.bucket??null,{label:c,sortValue:u,startMs:d,endMs:f}=A2e(l,n),p={day:c,dayKey:l||u,startMs:d,endMs:f,sortValue:u,...r};let h=0;if(a.forEach(g=>{const b=Number(s?.series?.[g]??s?.[g]??0);Number.isFinite(b)&&(p[g]=b,h+=b)}),o){const g=BR(s),b=Number.isFinite(g)?Math.max(0,g-h):0;p.Other=b}return p}).sort((s,l)=>s.sortValue-l.sortValue).map(({sortValue:s,...l})=>l)},$E=[{key:"lt-10",label:"< 10 ms",min:0,max:10},{key:"10-20",label:"10 - 20 ms",min:10,max:20},{key:"20-50",label:"20 - 50 ms",min:20,max:50},{key:"50-100",label:"50 - 100 ms",min:50,max:100},{key:"100-250",label:"100 – 250 ms",min:100,max:250},{key:"250-500",label:"250 – 500 ms",min:250,max:500},{key:"500-1000",label:"0.5 – 1 s",min:500,max:1e3},{key:"1000-3000",label:"1 – 3 s",min:1e3,max:3e3},{key:"gte-3000",label:"> 3 s",min:3e3,max:null}],Yo={key:"unknown",label:"Unknown duration"},I2e=e=>{const t=Number(e);if(!Number.isFinite(t)||t<0)return Yo.key;const r=$E.find(n=>{const a=n.min==null||t>=n.min,o=n.max==null||t<n.max;return a&&o});return r?r.key:Yo.key},D2e=e=>{const t=new Map;return[...$E,Yo].forEach(r=>{t.set(r.key,{value:r.key,label:r.label,count:0})}),e.forEach(r=>{const n=I2e(r.duration),a=t.get(n);a&&(a.count+=1)}),Array.from(t.values()).filter(r=>r.count>0).sort((r,n)=>{if(r.value===Yo.key)return 1;if(n.value===Yo.key)return-1;const a=["lt-100","100-250","250-500","500-1000","1000-3000","gte-3000"];return a.indexOf(r.value)-a.indexOf(n.value)})};function L2e({operations:e}){if(!e.length)return i.jsx(pl,{message:"No operations available for tabular view."});const{client:t}=fr(),[r,n]=m.useState(1),[a,o]=m.useState([]),[s,l]=m.useState(null),[c,u]=m.useState(!1),[d,f]=m.useState(null),[p,h]=m.useState({data:[],interval:"day",loading:!1,error:null,total:0}),[g,b]=m.useState(()=>({status:{items:[],total:0,loading:!1,error:null},method:{items:[],total:0,loading:!1,error:null},host:{items:[],total:0,loading:!1,error:null},path:{items:[],total:0,loading:!1,error:null},tags:{items:[],total:0,loading:!1,error:null}})),y=m.useMemo(()=>new Date,[]),v=m.useMemo(()=>DE("30D",y),[y]),k=v?.start??$b(y),N=v?.end??Bb(y),[w,E]=m.useState(v?.label??"Custom"),[C,O]=m.useState(k),[D,A]=m.useState(N),[M,I]=m.useState(!1),[T,R]=m.useState(new Date(y.getTime()-720*60*60*1e3).toISOString().split("T")[0]),[L,F]=m.useState("00:00"),[V,H]=m.useState(y.toISOString().split("T")[0]),[$,z]=m.useState("23:59"),[W,U]=m.useState(""),[X,Y]=m.useState(()=>({status:new Set,method:new Set,host:new Set,tags:new Set,path:new Set,duration:new Set})),ae=m.useMemo(()=>Array.from(X.status),[X.status]),G=m.useMemo(()=>Array.from(X.method),[X.method]),ee=m.useMemo(()=>Array.from(X.host),[X.host]),re=m.useMemo(()=>Array.from(X.tags),[X.tags]),pe=m.useMemo(()=>Array.from(X.path),[X.path]),te=m.useMemo(()=>Array.from(X.duration),[X.duration]),se=m.useMemo(()=>te.map(je=>je===Yo.key?Yo:$E.find(Pe=>Pe.key===je)).filter(Boolean),[te]),ne=m.useMemo(()=>JSON.stringify({status:[...ae].sort(),method:[...G].sort(),host:[...ee].sort(),tags:[...re].sort(),path:[...pe].sort(),duration:[...te].sort()}),[ae,G,ee,re,pe,te]),K=m.useMemo(()=>({get(je){const Pe={},Ye=(Pt,Kt)=>{Kt.length&&(Pe[Pt]=Kt.length===1?Kt[0]:Kt)};return je!=="status"&&Ye("status",ae),je!=="method"&&Ye("method",G),je!=="host"&&Ye("host",ee),je!=="path"&&Ye("path",pe),je!=="tags"&&Ye("tag",re),Pe}}),[ee,G,pe,ae,re]),ge=m.useRef(null),[ye,me]=m.useState(null);m.useLayoutEffect(()=>{const je=ge.current;if(!je)return;const Pe=()=>{me(je.offsetHeight||null)};if(Pe(),typeof ResizeObserver<"u"){const Ye=new ResizeObserver(()=>Pe());return Ye.observe(je),()=>Ye.disconnect()}return window.addEventListener("resize",Pe),()=>window.removeEventListener("resize",Pe)},[]),m.useEffect(()=>{n(1)},[ne,C,D]),m.useEffect(()=>{if(!M)return;const je=new Date(C),Pe=new Date(D);Number.isNaN(je.getTime())||(R(je.toISOString().split("T")[0]),F(je.toISOString().split("T")[1]?.slice(0,5)||"00:00")),Number.isNaN(Pe.getTime())||(H(Pe.toISOString().split("T")[0]),z(Pe.toISOString().split("T")[1]?.slice(0,5)||"23:59"))},[M,C,D]);const Se=m.useMemo(()=>Date.parse(C),[C]),Re=m.useMemo(()=>Date.parse(D),[D]),Te=Number.isFinite(Se)&&Number.isFinite(Re)&&Re>=Se,Je=m.useMemo(()=>Te?e.filter(je=>{const Pe=C2e(je);return Number.isFinite(Pe)?Pe>=Se&&Pe<=Re:!1}):[],[e,Te,Se,Re]),rt=m.useMemo(()=>a.map(je=>{let Pe=je.path||"";if(!Pe&&je.url)try{const Ye=new URL(je.url);Pe=Ye.pathname||Ye.href}catch{Pe=je.url}return{id:je.operation_id||je.id||je.uuid||(je.timestamp?`ts-${je.timestamp}`:null)||(je.url?`url-${je.url}`:null)||(Pe?`path-${Pe}`:null)||void 0,status:je.status??je.status_code??null,method:(je.method||je.http_method||"unknown").toUpperCase(),path:Pe||"/",duration:je.duration??null,timestamp:je.timestamp??null,host:je.server||je.host||""}}),[a]),De=s?.page??r,ut=Number.isFinite(Number(De))?Number(De):r,ct=ut>=1?ut:1,Nt=s?.limit??s?.per_page??cw,yt=Number.isFinite(Number(Nt))?Number(Nt):cw,ft=s?.total??s?.total_count??null,Ct=ft==null?null:Number.isFinite(Number(ft))?Number(ft):null,Ae=s?.total_pages??(Ct!==null&&yt?Math.max(1,Math.ceil(Ct/yt)):Math.max(1,ct)),ke=Number.isFinite(Number(Ae))?Number(Ae):Math.max(1,ct),Ie=ct>1,qe=ct<ke;m.useEffect(()=>{if(!Te){o([]),l(null),f(null),u(!1);return}if(!t?.operations?.listCompact)return;let je=!1;return(async()=>{u(!0),f(null);try{const Pe={page:r,limit:cw,since:C,until:D,sortField:"timestamp",sortDirection:"desc"},Ye=K.get(void 0);Ye.status&&(Array.isArray(Ye.status)?Ye.status.length===1?Pe.status=Ye.status[0]:Pe.statuses=Ye.status:Pe.status=Ye.status),Ye.method&&(Array.isArray(Ye.method)?Ye.method.length===1?Pe.method=Ye.method[0]:Pe.methods=Ye.method:Pe.method=Ye.method),Ye.host&&(Array.isArray(Ye.host)?Ye.host.length===1?Pe.host=Ye.host[0]:Pe.hosts=Ye.host:Pe.host=Ye.host),Ye.path&&(Array.isArray(Ye.path)?Ye.path.length===1?Pe.path=Ye.path[0]:Pe.paths=Ye.path:Pe.path=Ye.path),Ye.tag&&(Array.isArray(Ye.tag)?Ye.tag.length===1?Pe.tag=Ye.tag[0]:Pe.tagsAny=Ye.tag:Pe.tag=Ye.tag);const Pt=se.some(tr=>tr.key===Yo.key),Kt=se.filter(tr=>tr.key!==Yo.key);if(!Pt&&Kt.length>0){let tr=null,vn=null;Kt.forEach(En=>{En.min!==void 0&&En.min!==null&&(tr=tr===null?En.min:Math.min(tr,En.min)),En.max!==void 0&&En.max!==null&&(vn=vn===null?En.max:Math.max(vn,En.max))}),tr!==null&&(Pe.minDuration=tr),vn!==null&&(Pe.maxDuration=vn)}const vr=await t.operations.listCompact(Pe);if(je)return;const Lr=Array.isArray(vr?.operations)?vr.operations:[];o(Lr),l(vr?.meta||null);const Kr=Number(vr?.meta?.page),It=Number(vr?.meta?.total_pages);Number.isFinite(Kr)&&Kr>=1&&Kr!==r?n(Kr):Number.isFinite(It)&&It>=1&&r>It&&n(It)}catch(Pe){if(je)return;f(Pe instanceof Error?Pe.message:"Failed to load operations"),o([]),l(null)}finally{je||u(!1)}})(),()=>{je=!0}},[t,r,C,D,Te,ne,ae,G,ee,re,pe,se]),m.useEffect(()=>{if(!Te){h({data:[],interval:"day",loading:!1,error:null,total:0});return}if(!t?.stats?.getBuckets)return;let je=!1;return h(Pe=>({...Pe,loading:!0,error:null})),(async()=>{const Pe=K.get(void 0);try{const Ye=await t.stats.getBuckets({from:C,to:D,interval:"day",group:"status",...Pe});if(je)return;const Pt=Array.isArray(Ye?.data)?Ye.data:[],Kt=Ye?.meta?.interval||"day",vr=Pt.reduce((Lr,Kr)=>Lr+BR(Kr),0);h({data:Pt,interval:Kt,loading:!1,error:null,total:vr})}catch(Ye){if(je)return;const Pt=Ye instanceof Error?Ye.message:"Failed to load chart data";h({data:[],interval:"day",loading:!1,error:Pt,total:0})}})(),()=>{je=!0}},[K,t,D,Te,C]),m.useEffect(()=>{if(!Te){b(Pe=>{const Ye={...Pe};return uw.forEach(({key:Pt})=>{Ye[Pt]={items:[],total:0,loading:!1,error:null}}),Ye});return}if(!t?.stats?.aggregateBy)return;let je=!1;return b(Pe=>{const Ye={...Pe};return uw.forEach(({key:Pt})=>{Ye[Pt]={...Pe[Pt],loading:!0,error:null}}),Ye}),(async()=>{const Pe={from:C,to:D,metrics:["count"],order:"-count"},Ye=await Promise.all(uw.map(async Pt=>{const Kt=K.get(Pt.key);try{const vr=(await t.stats.aggregateBy(Pt.dimension,{...Pe,...Kt,limit:Pt.limit}))?.data?.rows??[],Lr=T2e(vr,Pt.key),Kr=Lr.reduce((It,tr)=>It+(Number.isFinite(tr.count)?tr.count:0),0);return{key:Pt.key,items:Lr,total:Kr,error:null}}catch(vr){const Lr=vr instanceof Error?vr.message:"Failed to load facet data";return{key:Pt.key,items:[],total:0,error:Lr}}}));je||b(Pt=>{const Kt={...Pt};return Ye.forEach(({key:vr,items:Lr,total:Kr,error:It})=>{Kt[vr]={items:Lr,total:Kr,error:It,loading:!1}}),Kt})})(),()=>{je=!0}},[K,t,D,Te,C]);const nt=m.useMemo(()=>{const je=g.status.items;return sd(je,ae,Pe=>id("status",Pe))},[g.status.items,ae]),dt=m.useMemo(()=>{const je=g.method.items;return sd(je,G,Pe=>id("method",Pe))},[g.method.items,G]),wt=m.useMemo(()=>{const je=g.host.items;return sd(je,ee,Pe=>id("host",Pe)).slice(0,12)},[g.host.items,ee]),pt=m.useMemo(()=>{const je=g.tags.items;return sd(je,re,Pe=>id("tags",Pe)).slice(0,RR)},[g.tags.items,re]),Le=m.useMemo(()=>{const je=g.path.items;return sd(je,pe,Pe=>id("path",Pe)).slice(0,FR)},[g.path.items,pe]),Tt=m.useMemo(()=>D2e(Je),[Je]),er=m.useMemo(()=>[{key:"status",label:"Status code",items:nt},{key:"method",label:"Method",items:dt},{key:"path",label:"Path",items:Le},{key:"duration",label:"Duration",items:Tt},{key:"tags",label:"Tags",items:pt},{key:"host",label:"Host",items:wt}],[Tt,wt,dt,Le,nt,pt]),qr=m.useMemo(()=>nt.slice(0,5).map(je=>je.value),[nt]),Ve=m.useMemo(()=>{const je=[...qr];return ae.forEach(Pe=>{je.includes(Pe)||je.push(Pe)}),je},[ae,qr]),hr=m.useMemo(()=>{const je=new Set(Ve);return nt.map(Pe=>Pe.value).filter(Pe=>!je.has(Pe))},[Ve,nt]),ir=m.useMemo(()=>{const je=[...Ve];return hr.length>0&&je.push("Other"),je},[Ve,hr]),ea=m.useMemo(()=>ir.map((je,Pe)=>c9[Pe%c9.length]),[ir]),cn=m.useMemo(()=>{const je={};return ir.forEach(Pe=>{je[Pe]=0}),je},[ir]),ka=(je,Pe)=>{Y(Ye=>{const Pt=new Set(Ye[je]);return Pt.has(Pe)?Pt.delete(Pe):Pt.add(Pe),{...Ye,[je]:Pt}})},yi=()=>{Y({status:new Set,method:new Set,host:new Set,tags:new Set,path:new Set,duration:new Set})},ta=m.useMemo(()=>Te?p.data.length?_2e(p.data,ir,cn,p.interval):[]:[],[ir,p.data,p.interval,cn,Te]),Un=m.useMemo(()=>Te&&Number.isFinite(p.total)?p.total:0,[p.total,Te]),st=m.useMemo(()=>Te?p.data.length>0?p.total:ae.length>0?nt.reduce((je,Pe)=>{if(ae.includes(Pe.value)){const Ye=Number(Pe.count)||0;return je+Ye}return je},0):Un:0,[p.data,p.total,Te,Un,ae,nt]),Ft=X.status.size+X.method.size+X.host.size+X.tags.size+X.path.size+X.duration.size,Er=Te?`${Tn(C)} – ${Tn(D)}`:"Invalid range selected",_t=je=>{E(je.label),O(je.start),A(je.end),I(!1),U("")},Yt=()=>{I(je=>!je),M||(E("Custom"),U(""))},Wr=()=>{if(!T||!V){U("Select both start and end dates.");return}const je=new Date(`${T}T${L||"00:00"}:00`),Pe=new Date(`${V}T${$||"00:00"}:00`);if(Number.isNaN(je.getTime())||Number.isNaN(Pe.getTime())){U("Unable to parse custom range.");return}if(je>Pe){U("Start must be before end.");return}O(je.toISOString()),A(Pe.toISOString()),E("Custom"),I(!1),U("")},Jr=je=>{if(!je||je.eventType!=="bar"&&je.eventType!=="category")return;const{startMs:Pe,endMs:Ye,categoryClicked:Pt}=je;je.eventType==="bar"&&Number.isFinite(Pe)&&Number.isFinite(Ye)&&Ye>=Pe&&(O(new Date(Pe).toISOString()),A(new Date(Ye).toISOString()),E("Custom")),Pt&&(Pt==="Other"?hr.length>0&&Y(Kt=>{const vr=new Set(Kt.status);return hr.every(Lr=>vr.has(Lr))?hr.forEach(Lr=>vr.delete(Lr)):hr.forEach(Lr=>vr.add(Lr)),{...Kt,status:vr}}):ka("status",Pt)),I(!1),U("")},Qr=ye??u9;return i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Dt,{className:"rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",children:[i.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("h3",{className:"text-base font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Requests by status code"}),i.jsx("p",{className:"mt-1 text-sm text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:"Daily request volume stacked per HTTP response code."}),i.jsxs("p",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:["Range: ",Er]})]}),i.jsxs("div",{className:"flex flex-col items-start gap-3 lg:items-end",children:[i.jsxs("div",{className:"relative",children:[i.jsx(LE,{selectedRange:w,onSelect:_t,onCustomClick:Yt}),M?i.jsx("div",{className:"absolute right-0 top-full z-20 mt-2 w-72 rounded-md border border-tremor-border bg-tremor-background p-3 shadow-xl dark:border-dark-tremor-border dark:bg-gray-950",children:i.jsxs("div",{className:"flex flex-col gap-3 text-xs text-tremor-content dark:text-dark-tremor-content",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide",children:"Start"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"date",value:T,onChange:je=>{R(je.target.value),U("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"}),i.jsx("input",{type:"time",value:L,onChange:je=>{F(je.target.value),U("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"})]})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide",children:"End"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"date",value:V,onChange:je=>{H(je.target.value),U("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"}),i.jsx("input",{type:"time",value:$,onChange:je=>{z(je.target.value),U("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"})]})]}),W&&i.jsx("p",{className:"text-[11px] text-rose-600 dark:text-rose-500",children:W}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx("button",{type:"button",onClick:()=>{I(!1),U("")},className:"rounded border border-tremor-border px-2 py-1 text-xs text-tremor-content hover:bg-gray-100 dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted",children:"Cancel"}),i.jsx("button",{type:"button",onClick:Wr,className:"rounded bg-tremor-brand px-3 py-1 text-xs font-semibold text-tremor-brand-inverted hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:hover:bg-dark-tremor-brand-emphasis",children:"Apply"})]})]})}):null]}),i.jsxs("div",{className:"text-sm text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:[st.toLocaleString()," of ",Un.toLocaleString()," requests in range visible"]}),Je.length!==e.length?i.jsxs("div",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:[e.length.toLocaleString()," total requests loaded"]}):null]})]}),Te?p.loading?i.jsx("div",{className:"mt-8 rounded border border-dashed border-tremor-border bg-white py-12 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:bg-dark-tremor-background",children:"Loading chart data…"}):p.error?i.jsx("div",{className:"mt-8 rounded border border-dashed border-rose-500/60 bg-rose-50 py-12 text-center text-sm text-rose-700 dark:border-rose-500/70 dark:bg-rose-900/20 dark:text-rose-200",children:p.error}):ta.length>0?i.jsx(_h,{className:"mt-6",data:ta,index:"day",categories:ir,colors:ea,stack:!0,onValueChange:Jr,valueFormatter:je=>je.toLocaleString()}):i.jsx("div",{className:"mt-8 rounded border border-dashed border-tremor-border bg-white py-12 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:bg-dark-tremor-background",children:"No data to visualize for the selected filters."}):i.jsx("div",{className:"mt-6 rounded border border-dashed border-rose-500/60 bg-rose-50 py-6 text-center text-sm text-rose-700 dark:border-rose-500/70 dark:bg-rose-900/20 dark:text-rose-200",children:"Adjust the date range to view request trends."})]}),i.jsxs("div",{className:"grid gap-6 lg:grid-cols-[260px_minmax(0,1fr)] lg:items-start",children:[i.jsxs(Dt,{ref:ge,className:"flex h-full flex-col rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",style:{minHeight:u9},children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Filters"}),Ft>0&&i.jsxs("button",{type:"button",onClick:yi,className:"text-xs font-medium text-emerald-600 hover:underline dark:text-emerald-400",children:["Clear all (",Ft,")"]})]}),i.jsx("div",{className:"mt-4 space-y-6",children:er.map(je=>i.jsxs("div",{children:[i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:je.label}),i.jsxs("div",{className:"mt-2 space-y-1",children:[je.items.map(Pe=>{const Ye=X[je.key].has(Pe.value);return i.jsxs("button",{type:"button",onClick:()=>ka(je.key,Pe.value),className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-sm transition ${Ye?"bg-emerald-100 text-emerald-900 dark:bg-emerald-900/30 dark:text-emerald-100":"text-tremor-content hover:bg-gray-100 dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted"}`,title:Pe.label,children:[i.jsx("span",{className:"truncate",children:Pe.label}),i.jsx("span",{className:"ml-3 text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:Pe.count.toLocaleString()})]},Pe.value)}),je.items.length===0&&i.jsx("div",{className:"px-2 py-2 text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:"No data available"})]})]},je.key))})]}),i.jsxs(Dt,{className:"flex h-full flex-col rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",style:{minHeight:Qr,maxHeight:Qr},children:[i.jsxs("div",{className:"flex flex-col gap-2 border-b border-tremor-border px-4 py-3 dark:border-dark-tremor-border lg:flex-row lg:items-center lg:justify-between",children:[i.jsx("p",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Request details"}),i.jsxs("p",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:[c?"Loading…":`${rt.length.toLocaleString()} results${Ct!==null?` • ${Ct.toLocaleString()} total`:""}`,Ft>0&&i.jsx("span",{children:" • Filters active"}),d&&!c&&i.jsx("span",{className:"ml-2 text-rose-500 dark:text-rose-400",children:d})]})]}),i.jsx("div",{className:"flex-1 overflow-hidden",children:i.jsx("div",{className:"h-full min-h-0 overflow-x-auto",children:i.jsx("div",{className:"h-full min-h-0 overflow-y-auto",children:i.jsxs(uR,{className:"min-w-full",children:[i.jsx(fR,{className:"sticky top-0 z-10 bg-white shadow-sm dark:bg-dark-tremor-background",children:i.jsxs(Di,{children:[i.jsx(Ii,{children:"Timestamp"}),i.jsx(Ii,{children:"Status"}),i.jsx(Ii,{children:"Method"}),i.jsx(Ii,{children:"Path"}),i.jsx(Ii,{children:"Duration"}),i.jsx(Ii,{children:"Host"})]})}),i.jsx(dR,{children:Te?c?i.jsx(Di,{children:i.jsx(Ba,{colSpan:6,className:"py-10 text-center text-sm text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:"Loading operations…"})}):d?i.jsx(Di,{children:i.jsx(Ba,{colSpan:6,className:"py-10 text-center text-sm text-rose-500 dark:text-rose-400",children:d})}):rt.length===0?i.jsx(Di,{children:i.jsx(Ba,{colSpan:6,className:"py-10 text-center text-sm text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:"No operations match the selected filters."})}):rt.map((je,Pe)=>i.jsxs(Di,{children:[i.jsx(Ba,{className:"min-w-[160px]",children:Tn(je.timestamp)}),i.jsx(Ba,{children:i.jsx(kl,{status:je.status})}),i.jsx(Ba,{children:i.jsx("span",{className:`font-semibold ${Nf(je.method)}`,children:je.method})}),i.jsx(Ba,{className:"max-w-md truncate",children:je.path}),i.jsx(Ba,{children:Yn(je.duration)}),i.jsx(Ba,{children:je.host||"—"})]},je.id??Pe)):i.jsx(Di,{children:i.jsx(Ba,{colSpan:6,className:"py-10 text-center text-sm text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:"Select a valid date range to view operations."})})})]})})})}),i.jsx("div",{className:"border-t border-tremor-border px-4 py-3 text-xs text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content-subtle",children:i.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("span",{children:["Page ",ct.toLocaleString()," of ",ke.toLocaleString(),Ct!==null?i.jsxs("span",{children:[" • ",Ct.toLocaleString()," records"]}):null]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>n(je=>Math.max(1,je-1)),disabled:!Ie||c,className:"rounded border border-tremor-border px-3 py-1 text-xs font-medium text-tremor-content hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted",children:"Previous"}),i.jsx("button",{type:"button",onClick:()=>n(je=>qe?je+1:je),disabled:!qe||c,className:"rounded border border-tremor-border px-3 py-1 text-xs font-medium text-tremor-content hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted",children:"Next"})]})]})})]})]})]})}const Zl=e=>{if(!Number.isFinite(e))return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})},R2e=e=>e>=500?"bg-rose-500/80":e>=400&&e<500?"bg-amber-500/80":e>=300&&e<400?"bg-blue-500/70":e>=200&&e<300?"bg-emerald-500/80":"bg-slate-400/70",Jl=e=>Math.min(Math.max(e,0),100),F2e=1e3,Ql=60*F2e,Bi=60*Ql,Ca=24*Bi,$2e=7,dw=[1e3,2e3,5e3,15e3,3e4,Ql,5*Ql,15*Ql,30*Ql,Bi,2*Bi,3*Bi,6*Bi,12*Bi,Ca,2*Ca,7*Ca,14*Ca,30*Ca,90*Ca],d9=new Intl.DateTimeFormat([],{hour:"2-digit",minute:"2-digit",hour12:!1}),B2e=new Intl.DateTimeFormat([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),zR=new Intl.DateTimeFormat([],{month:"short",day:"numeric"}),H2e=new Intl.DateTimeFormat([],{weekday:"short",month:"short",day:"numeric"}),UR=new Intl.DateTimeFormat([],{month:"short",day:"numeric",year:"numeric"}),f9=new Intl.DateTimeFormat([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}),z2e=(e,t,r)=>{const n=new Date(e);return t>=Ca?r>180*Ca?UR.format(n):zR.format(n):t>=Bi?r>2*Ca?f9.format(n):d9.format(n):t>=Ql?r>Ca?f9.format(n):d9.format(n):B2e.format(n)},U2e=(e,t)=>{const r=new Date(e);return t>180*Ca?UR.format(r):t>14*Ca?zR.format(r):H2e.format(r)},q2e=(e,t)=>{const r=t-e;if(!Number.isFinite(r)||r<=0)return{interval:null,ticks:[],daySegments:[],startLabel:Zl(e),endLabel:Zl(t)};const n=dw.find(u=>r/u<=$2e)??dw[dw.length-1],a=[],o=Math.ceil(e/n)*n;for(let u=o;u<t;u+=n){if(u<=e||u>=t)continue;const d=Jl((u-e)/r*100);a.push({key:`tick-${u}`,value:u,percent:d,label:z2e(u,n,r)})}const s=[];let l=e,c=0;for(;l<t&&c<730;){const u=new Date(l);u.setHours(24,0,0,0);const d=u.getTime(),f=Math.min(t,d),p=Jl((l-e)/r*100),h=(f-l)/r*100,g=Math.min(Math.max(h,0),100-p),b=h>0&&g<.3?Math.min(.3,100-p):g;if(s.push({key:`segment-${l}`,start:l,end:f,leftPercent:p,widthPercent:b,label:U2e(l,r)}),f===l)break;l=f,c+=1}return{interval:n,ticks:a,daySegments:s,startLabel:Zl(e),endLabel:Zl(t)}};function V2e({operations:e}){const t=m.useMemo(()=>new Date,[]),r=m.useMemo(()=>DE("Today",t),[t]),n=r?.start??$b(t),a=r?.end??Bb(t),[o,s]=m.useState(r?.label??"Custom"),[l,c]=m.useState(n),[u,d]=m.useState(a),[f,p]=m.useState(!1),[h,g]=m.useState(new Date(t.getTime()-10080*60*1e3).toISOString().split("T")[0]),[b,y]=m.useState("00:00"),[v,k]=m.useState(t.toISOString().split("T")[0]),[N,w]=m.useState("23:59"),[E,C]=m.useState(null),[O,D]=m.useState(!1),[A,M]=m.useState(""),I=m.useMemo(()=>{const pe=new Map;return e.forEach(te=>{te.tags.forEach(se=>{pe.has(se.raw)||pe.set(se.raw,se)})}),Array.from(pe.keys()).sort((te,se)=>te.localeCompare(se))},[e]);m.useEffect(()=>{E&&(I.includes(E)||C(null))},[I,E]),m.useEffect(()=>{I.length||O&&D(!1)},[I,O]),m.useEffect(()=>{if(!f)return;const pe=new Date(l),te=new Date(u);Number.isNaN(pe.getTime())||(g(pe.toISOString().split("T")[0]),y(pe.toISOString().split("T")[1]?.slice(0,5)||"00:00")),Number.isNaN(te.getTime())||(k(te.toISOString().split("T")[0]),w(te.toISOString().split("T")[1]?.slice(0,5)||"00:00"))},[f,l,u]);const T=m.useMemo(()=>E&&yc(E)?.token||null,[E]),R=m.useMemo(()=>Date.parse(l),[l]),L=m.useMemo(()=>Date.parse(u),[u]),F=Number.isFinite(R)&&Number.isFinite(L)&&L>R,V=F?L-R:1,H=m.useMemo(()=>F?e.filter(pe=>!pe.timestampMs||pe.timestampMs<R||pe.timestampMs>L?!1:T?pe.tags.some(te=>te.token===T):!0).sort((pe,te)=>(pe.timestampMs||0)-(te.timestampMs||0)):[],[e,F,R,L,T]),$=m.useMemo(()=>{if(!H.length)return[];if(!O)return[{key:"all",label:null,operations:H.map(te=>({operation:te}))}];const pe=new Map;return H.forEach(te=>{if(!te.tags.length){const se=pe.get("__untagged__")||{key:"__untagged__",label:null,operations:[]};se.operations.push({operation:te}),pe.set("__untagged__",se);return}te.tags.forEach(se=>{const ne=se.token;pe.has(ne)||pe.set(ne,{key:ne,label:se,operations:[]}),pe.get(ne).operations.push({operation:te,tag:se})})}),Array.from(pe.values()).sort((te,se)=>{const ne=te.label?.display||"Untagged",K=se.label?.display||"Untagged";return ne.localeCompare(K)})},[H,O]),{ticks:z,daySegments:W,startLabel:U,endLabel:X}=m.useMemo(()=>F?q2e(R,L):{ticks:[],daySegments:[],startLabel:"",endLabel:""},[F,R,L]),Y=pe=>{s(pe.label),c(pe.start),d(pe.end),p(!1),M("")},ae=()=>{p(pe=>!pe),f||s("Custom")},G=()=>{if(!h||!v){M("Select start and end dates.");return}const pe=new Date(`${h}T${b||"00:00"}:00`),te=new Date(`${v}T${N||"00:00"}:00`);if(Number.isNaN(pe.getTime())||Number.isNaN(te.getTime())){M("Unable to parse custom range.");return}if(pe>te){M("Start must be before end.");return}c(pe.toISOString()),d(te.toISOString()),s("Custom"),p(!1),M("")},ee=`${Tn(l)} – ${Tn(u)}`,re=I.length>0;return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[i.jsxs("div",{className:"relative flex flex-wrap items-center gap-3",children:[i.jsx(LE,{selectedRange:o,onSelect:Y,onCustomClick:ae}),f?i.jsx("div",{className:"absolute left-0 top-full z-20 mt-2 w-72 rounded-md border border-tremor-border bg-tremor-background p-3 shadow-xl dark:border-dark-tremor-border dark:bg-gray-950",children:i.jsxs("div",{className:"flex flex-col gap-3 text-xs text-tremor-content dark:text-dark-tremor-content",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide",children:"Start"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"date",value:h,onChange:pe=>{g(pe.target.value),M("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"}),i.jsx("input",{type:"time",value:b,onChange:pe=>{y(pe.target.value),M("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"})]})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide",children:"End"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"date",value:v,onChange:pe=>{k(pe.target.value),M("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"}),i.jsx("input",{type:"time",value:N,onChange:pe=>{w(pe.target.value),M("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"})]})]}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx("button",{type:"button",className:"rounded border border-tremor-border px-2 py-1 text-xs font-medium text-tremor-content hover:bg-tremor-background-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-subtle",onClick:()=>p(!1),children:"Cancel"}),i.jsx("button",{type:"button",className:"rounded bg-tremor-brand px-3 py-1 text-xs font-medium text-white hover:bg-tremor-brand-emphasis",onClick:G,children:"Apply range"})]}),A?i.jsx("p",{className:"text-[11px] text-rose-600 dark:text-rose-400",children:A}):null]})}):null,i.jsx(yp,{options:I,selected:E,onSelect:C,placeholder:"Filter by tag"})]}),i.jsx("div",{className:"flex items-center gap-3",children:i.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-tremor-content dark:text-dark-tremor-content",children:[i.jsx("input",{type:"checkbox",className:"size-4 rounded border-tremor-border text-tremor-brand focus:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900",checked:O,disabled:!re,onChange:pe=>D(pe.target.checked)}),"Group by tags"]})})]}),i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[i.jsx("span",{children:ee}),i.jsxs("span",{children:[H.length," operations"]})]}),A?i.jsx("p",{className:"text-xs text-rose-600 dark:text-rose-400",children:A}):null,i.jsx(Dt,{className:"rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",children:F?$.length===0?i.jsx(pl,{message:"No operations captured in the selected range."}):i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:gap-4",children:[i.jsx("div",{className:"hidden md:block md:w-1/3 lg:w-1/5"}),i.jsx("div",{className:"w-full md:w-2/3 lg:w-4/5",children:i.jsxs("div",{className:"relative h-20",children:[i.jsx("div",{className:"absolute inset-x-0 top-0 h-7",children:i.jsx("div",{className:"relative h-full overflow-hidden rounded-tremor-small border border-tremor-border bg-tremor-background-subtle dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:W.map((pe,te)=>{const se=Jl(pe.leftPercent),ne=Math.min(Math.max(pe.widthPercent,0),100-se),K=pe.widthPercent>0&&ne<.3?Math.min(.3,100-se):ne;return i.jsx("div",{className:`absolute flex h-full items-center justify-center px-2 text-[10px] font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content-subtle ${te>0?"border-l border-tremor-border dark:border-dark-tremor-border":""}`,style:{left:`${se}%`,width:`${K}%`},children:i.jsx("span",{className:"pointer-events-none truncate",children:pe.label})},pe.key)})})}),i.jsx("div",{className:"absolute inset-x-0 bottom-6",children:i.jsxs("div",{className:"relative h-8",children:[i.jsx("div",{className:"absolute inset-x-0 bottom-0 border-t border-dashed border-tremor-border dark:border-dark-tremor-border"}),z.map(pe=>i.jsxs("div",{className:"absolute bottom-0 flex -translate-x-1/2 flex-col items-center text-[11px] font-medium text-tremor-content-subtle dark:text-dark-tremor-content",style:{left:`${Jl(pe.percent)}%`},children:[i.jsx("span",{className:"mb-1 whitespace-nowrap",children:pe.label}),i.jsx("span",{className:"block h-2 border-l border-tremor-border dark:border-dark-tremor-border"})]},pe.key))]})}),i.jsxs("div",{className:"absolute inset-x-0 bottom-0 flex justify-between text-[10px] text-tremor-content-subtle dark:text-dark-tremor-content",children:[i.jsx("span",{children:U||Zl(R)}),i.jsx("span",{children:X||Zl(L)})]})]})})]}),i.jsx("div",{className:"space-y-4",children:$.map(pe=>i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[i.jsx("div",{className:"flex items-center gap-2",children:O?pe.label?i.jsx(sl,{tag:pe.label}):i.jsx("span",{className:"rounded-full bg-slate-100 px-3 py-1 text-[11px] font-medium text-slate-600 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content",children:"Untagged"}):i.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"All operations"})}),i.jsxs("span",{className:"text-[11px] text-tremor-content-subtle dark:text-dark-tremor-content",children:[pe.operations.length," ops"]})]}),i.jsx("div",{className:"space-y-3",children:pe.operations.map(({operation:te,tag:se},ne)=>{const K=te.timestampMs??0,ge=Number.isFinite(te.duration)?te.duration:0,ye=ge>0?K+ge:K,me=Math.max(K,R),Se=Math.max(me,Math.min(ye,L)),Re=(me-R)/V*100,Te=(Se-me)/V*100,Je=Jl(Re),rt=Te>0?`${Math.max(Te,.8)}%`:"6px",De=Te>0?void 0:"translateX(-50%)",ut=`${te.method} ${te.path}
184
- ${Tn(te.timestamp)}
185
- Duration ${Yn(te.duration)}`,ct=R2e(te.status),Nt=`${te.id||te.operationId||te.timestampMs||"op"}-${se?.token||"all"}-${ne}`;return i.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-stretch md:gap-4",children:[i.jsxs("div",{className:"w-full min-w-0 md:w-1/3 lg:w-1/5",children:[i.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[i.jsx("span",{className:`font-semibold uppercase ${Nf(te.method)}`,children:te.method}),i.jsx("span",{className:"max-w-md truncate text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:te.path||"/"}),i.jsxs("span",{className:"max-w-md truncate text-[11px] text-tremor-content-subtle dark:text-dark-tremor-content",children:["(",Yn(te.duration),")"]})]}),i.jsx("div",{className:"text-[11px] text-tremor-content-subtle dark:text-dark-tremor-content",children:Tn(te.timestamp)})]}),i.jsx("div",{className:"w-full md:w-2/3 lg:w-4/5",children:i.jsxs("div",{className:"relative h-10 overflow-hidden rounded-tremor-small border border-dashed border-tremor-border bg-tremor-background-subtle dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[i.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[W.slice(1).map(yt=>i.jsx("div",{className:"absolute top-0 bottom-0 border-l border-tremor-border dark:border-dark-tremor-border",style:{left:`${yt.leftPercent}%`}},`day-boundary-${yt.key}`)),z.filter(yt=>yt.percent>0&&yt.percent<100).map(yt=>i.jsx("div",{className:"absolute top-1 bottom-1 border-l border-tremor-border opacity-40 dark:border-dark-tremor-border dark:opacity-50",style:{left:`${Jl(yt.percent)}%`}},`grid-${yt.key}`))]}),i.jsxs("div",{className:`absolute inset-y-1 z-10 flex items-center overflow-hidden rounded ${ct} text-[10px] font-semibold uppercase tracking-wide text-white shadow-sm`,style:{left:`${Je}%`,width:rt,transform:De},title:ut,children:[i.jsx("span",{className:"px-2 truncate",children:te.method}),i.jsxs("span",{className:"px-2 truncate",children:["Duration ",Yn(te.duration)]})]})]})})]},Nt)})})]},pe.key))})]}):i.jsx(pl,{message:"Select a valid time range to view the timeline."})})]})}const fa=(...e)=>e.filter(Boolean).join(" "),W2e=e=>{if(!e)return null;try{return new URL(e)}catch{return null}},K2e=(e,t)=>{if(!e)return t??null;const r=Date.parse(e);return Number.isFinite(r)?r:t??null},qR=e=>{if(e==null)return"N/A";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}},Oj=e=>e?e.trace_id||e.traceId||"Trace":"Unknown trace",Y2e=(e,t=0)=>{if(!e)return null;const r=e.request||{},n=e.response||{},a=e.timing||{},o=e.meta||{},s=r.url||"",l=W2e(s),c=r.timestamp||n.timestamp||o.timestamp||e.timestamp||null,u=K2e(c,t),d=Number.isFinite(Number(a.duration))?Number(a.duration):Number.isFinite(Number(e.duration))?Number(e.duration):null,f=Array.isArray(o.tags)?o.tags:Array.isArray(e.tags)?e.tags:[],p=e.operation_id||e.operationId||e.id||null;return{id:p!=null?String(p):`operation-${t}`,method:(r.method||e.method||"GET").toUpperCase(),status:n.status??e.status??null,duration:d,timestamp:c,timestampMs:u,path:r.path||l?.pathname||s||"/",host:r.server||l?.host||"",url:s,request:r,response:n,timing:a,tags:_f(f),correlationId:e.correlation_id||null,traceInfo:o.trace||null,raw:e}},X2e=(e,t)=>{if(e?.first_seen&&e?.last_seen){const a=Date.parse(e.first_seen),o=Date.parse(e.last_seen);if(Number.isFinite(a)&&Number.isFinite(o)&&o>=a)return o-a}if(!t?.length)return null;let r=null,n=null;return t.forEach((a,o)=>{const{start:s,end:l}=Hb(a,o);r=r===null?s:Math.min(r,s),n=n===null?l:Math.max(n,l)}),r===null||n===null||n<r?null:n-r},Hb=(e,t=0)=>{const r=Number.isFinite(e.timestampMs)?e.timestampMs:t,n=Number.isFinite(e.duration)?e.duration:0,a=r+n;return{start:r,duration:n,end:a}},G2e=e=>{if(!e?.length)return{start:0,end:1,duration:1};let t=null,r=null;if(e.forEach((a,o)=>{const{start:s,end:l}=Hb(a,o);t=t===null?s:Math.min(t,s),r=r===null?l:Math.max(r,l)}),t===null||r===null)return{start:0,end:1,duration:1};const n=Math.max(r-t,1);return{start:t,end:r,duration:n}},VR=e=>e>=500?"bg-rose-500/80":e>=400?"bg-amber-500/80":e>=300?"bg-blue-500/70":e>=200?"bg-emerald-500/80":"bg-slate-400/70",WR=e=>e>=500?"bg-rose-500":e>=400?"bg-amber-500":e>=300?"bg-blue-500":e>=200?"bg-emerald-500":"bg-slate-400",Z2e=e=>e?.raw?.meta?Object.entries(e.raw.meta).filter(([t])=>t!=="tags"&&t!=="trace").map(([t,r])=>({key:t,value:qR(r)})):[],J2e=e=>{const t=e?.traceInfo?.generic;return!t||typeof t!="object"?[]:Object.entries(t).map(([r,n])=>({key:r,value:qR(n)}))},Q2e=e=>{if(!e?.tags?.length)return null;const t=e.tags.find(r=>r.keyToken==="agent")||e.tags.find(r=>r.key==="agent");return t&&(t.value||t.display)||null},KR=({operation:e,mcpMeta:t})=>i.jsxs("dl",{className:"divide-y divide-tremor-border text-sm dark:divide-dark-tremor-border",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[i.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Request time"}),i.jsx("dd",{className:"text-right text-tremor-content dark:text-dark-tremor-content",children:Tn(e.timestamp)})]}),t?.session_id?i.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[i.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"MCP Session ID"}),i.jsx("dd",{className:"text-right text-sm font-mono text-tremor-content dark:text-dark-tremor-content",children:t?.session_id})]}):null,i.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[i.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Operation ID"}),i.jsx("dd",{className:"text-right text-sm font-mono text-tremor-content dark:text-dark-tremor-content",children:e.id})]}),e?.correlationId?i.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[i.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Correlation ID"}),i.jsx("dd",{className:"text-right text-sm font-mono text-tremor-content dark:text-dark-tremor-content",children:e.correlationId||"—"})]}):null,i.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[i.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Trace ID"}),i.jsx("dd",{className:"text-right text-sm font-mono text-tremor-content dark:text-dark-tremor-content",children:e.traceInfo?.trace_id||"—"})]}),i.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[i.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Trace source"}),i.jsx("dd",{className:"text-right text-tremor-content dark:text-dark-tremor-content",children:e.traceInfo?.source||"—"})]}),t?.tokens?i.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[i.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Tokens"}),i.jsxs("dd",{className:"flex items-center gap-2 text-right text-tremor-content dark:text-dark-tremor-content",children:[i.jsxs(Bt,{color:"indigo",size:"xs",children:["Request ",t.tokens.request??"—"]}),i.jsxs(Bt,{color:"indigo",size:"xs",children:["Response ",t.tokens.response??"—"]}),i.jsxs(Bt,{color:"indigo",size:"xs",children:["Total ",t.tokens.total??"—"]})]})]}):null]}),m9=({headers:e=[]})=>e.length?i.jsx("div",{className:"max-h-60 overflow-auto",children:i.jsx("dl",{className:"divide-y divide-tremor-border dark:divide-dark-tremor-border",children:e.map((t,r)=>i.jsxs("div",{className:"flex items-start gap-3 px-3 py-1",children:[i.jsx("dt",{className:"w-40 shrink-0 text-[10px] font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:t.name}),i.jsx("dd",{className:"flex-1 text-[10px] text-tremor-content dark:text-dark-tremor-content",children:t.value||"—"})]},`${t.name}-${r}`))})}):i.jsx(gt,{className:"px-3 py-2 text-sm text-tremor-content-subtle dark:text-dark-tremor-content",children:"No headers"}),Pj=e=>e?Array.isArray(e)?e.map(t=>({name:t.name??t.key??"",value:t.value})):typeof e=="object"?"name"in e&&"value"in e?[{name:e.name,value:e.value}]:Object.entries(e).map(([t,r])=>({name:t,value:r})):[]:[],p9=e=>{const t=Pj(e).find(r=>r.name?.toLowerCase()==="content-type")?.value;return!t||typeof t!="string"?null:t.split(";")[0].trim().toLowerCase()},h9=e=>!e||e.includes("json")?"json":e.includes("html")?"html":e.includes("xml")?"xml":e.includes("javascript")?"javascript":e.includes("css")?"css":e.includes("yaml")||e.includes("yml")?"yaml":e.includes("sql")?"sql":(e.startsWith("text/"),"plaintext"),g9=(e,t)=>{if(e==null)return"";if(typeof e=="string"){if(t?.includes("json"))try{const r=JSON.parse(e);return JSON.stringify(r,null,2)}catch{return e}if(t?.includes("xml"))try{return Y8(e)}catch{return e}return e}if(typeof e=="object")try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)};function YR({operation:e,isLoading:t}){typeof window<"u"&&localStorage.getItem("debug")==="true"&&console.log("OP",e);const r=Z2e(e),n=m.useMemo(()=>new Set(["proxy","ingress","inspectr"]),[]),a=r.filter(k=>!n.has(k.key)),o=r.filter(k=>n.has(k.key)),s=J2e(e),l=Array.isArray(e?.tags)?e.tags:[],c=Pj(e?.request?.headers),u=Pj(e?.response?.headers),d=e?.meta?.mcp||e?.raw?.meta?.mcp||e?.meta?.trace?.mcp||e?.raw?.meta?.trace?.mcp||{},f=p9(e?.request?.headers),p=p9(e?.response?.headers),h=g9(e?.request?.body,f),g=g9(e?.response?.body,p),b=h9(f),y=h9(p),v=m.useMemo(()=>({readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",fontSize:12,lineNumbers:"off",folding:!1}),[]);return e?i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Su,{method:e.method}),i.jsx(Rn,{className:"text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:`${e.path||e.url||"Operation"}`})]}),i.jsx(gt,{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:e.host||e.request?.server||"Unspecified host"})]}),i.jsxs("div",{className:"flex flex-col items-end gap-2",children:[i.jsx(kl,{status:e.status}),i.jsx(Bt,{color:"blue",children:Yn(e.duration)})]})]}),i.jsxs("div",{className:"mt-6 space-y-5",children:[i.jsx(la,{title:"Properties",resetKey:e?.id,defaultOpen:!0,children:i.jsx(KR,{operation:e,mcpMeta:d})}),i.jsx(la,{title:`Request headers (${c.length})`,resetKey:e?.id,defaultOpen:!1,children:i.jsx(m9,{headers:c})}),i.jsx(la,{title:"Request body",resetKey:e?.id,defaultOpen:!1,copyText:h,children:i.jsx("div",{className:"h-60 overflow-hidden",children:i.jsx(ns,{value:h||"No request body",language:b,theme:os(),beforeMount:as,options:v,height:"100%"})})}),i.jsx(la,{title:"Response body",resetKey:e?.id,defaultOpen:!1,copyText:g,children:i.jsx("div",{className:"h-[320px] overflow-hidden",children:i.jsx(ns,{value:g||"No response body",language:y,theme:os(),beforeMount:as,options:v,height:"100%"})})}),i.jsx(la,{title:`Response headers (${u.length})`,resetKey:e?.id,defaultOpen:!1,children:i.jsx(m9,{headers:u})}),l.length?i.jsxs("div",{children:[i.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"Tags"}),i.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:l.map(k=>i.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-100 px-2.5 py-1 text-xs font-medium text-gray-700 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content",children:k.display},k.token))})]}):null,a.length?i.jsx(la,{title:"Metadata",resetKey:e?.id,defaultOpen:!1,children:i.jsx("div",{className:"px-3 py-2",children:i.jsx("div",{className:"mt-2 space-y-3",children:a.map(k=>i.jsxs("div",{children:[i.jsx(gt,{className:"text-xs font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:k.key}),i.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded-tremor-small bg-gray-900 px-3 py-2 text-xs text-gray-100 dark:bg-gray-800 dark:text-gray-100",children:k.value})]},k.key))})})}):null,o.length||s.length?i.jsx(la,{title:"Advanced metadata",resetKey:e?.id,defaultOpen:!1,children:i.jsxs("div",{className:"divide-y divide-tremor-border text-sm dark:divide-dark-tremor-border",children:[e.traceInfo?.generic&&s.length?i.jsxs("div",{className:"px-3 py-2",children:[i.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"Trace metadata"}),i.jsx("div",{className:"mt-2 space-y-3",children:s.map(k=>i.jsxs("div",{children:[i.jsx(gt,{className:"text-xs font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:k.key}),i.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded-tremor-small bg-gray-900 px-3 py-2 text-xs text-gray-100 dark:bg-gray-800 dark:text-gray-100",children:k.value})]},k.key))})]}):null,o.map(k=>i.jsxs("div",{className:"px-3 py-2",children:[i.jsx(gt,{className:"text-xs font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:k.key}),i.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded-tremor-small bg-gray-900 px-3 py-2 text-xs text-gray-100 dark:bg-gray-800 dark:text-gray-100",children:k.value})]},k.key))]})}):null]})]}):i.jsx("div",{className:"flex h-full items-center justify-center text-sm text-tremor-content-subtle dark:text-dark-tremor-content",children:t?"Loading trace details…":"Select an Operation span to inspect its details."})}const b9=200,$a=e=>e==null?null:String(e),XR=({initialTraceId:e=null,initialOperationId:t=null,onTraceChange:r,onOperationChange:n,isActive:a=!0,listLimit:o=b9,detailLimit:s=b9}={})=>{const{client:l}=fr(),c=!!(l?.traces?.list&&l?.traces?.get),[u,d]=m.useState([]),[f,p]=m.useState(null),[h,g]=m.useState(!1),[b,y]=m.useState(null),[v,k]=m.useState($a(e)),[N,w]=m.useState(null),[E,C]=m.useState(null),[O,D]=m.useState([]),[A,M]=m.useState(!1),[I,T]=m.useState(null),[R,L]=m.useState(0),[F,V]=m.useState(1),[H,$]=m.useState(0),[z,W]=m.useState($a(t)),U=m.useRef(r),X=m.useRef(n),Y=m.useRef(void 0),ae=m.useRef(void 0);m.useEffect(()=>{U.current=r},[r]),m.useEffect(()=>{X.current=n},[n]),m.useEffect(()=>{const ne=$a(e);ne&&ne!==v&&k(ne)},[e]),m.useEffect(()=>{const ne=$a(t);ne&&ne!==z&&W(ne)},[t]),m.useEffect(()=>{if(!c||!a)return;let ne=!0;return g(!0),y(null),l.traces.list({limit:o}).then(K=>{ne&&(d(Array.isArray(K?.traces)?K.traces:[]),p(K?.meta||null))}).catch(K=>{ne&&(y(K),d([]),p(null))}).finally(()=>{ne&&g(!1)}),()=>{ne=!1}},[c,l,o,a,H]),m.useEffect(()=>{if(!u.length||v)return;const ne=e&&u.some(K=>K.trace_id===e)?e:u[0]?.trace_id??null;ne&&ne!==v&&k(ne)},[u,v,e]),m.useEffect(()=>{V(1)},[v]),m.useEffect(()=>{if(!c||!a||!v){w(null),C(null),D([]),T(null);return}let ne=!0;return M(!0),T(null),l.traces.get(v,{page:F,limit:s}).then(K=>{ne&&(w(K?.trace||null),C(K?.meta||null),D(Array.isArray(K?.operations)?K.operations:[]))}).catch(K=>{ne&&(T(K),w(null),C(null),D([]))}).finally(()=>{ne&&M(!1)}),()=>{ne=!1}},[c,l,v,s,a,R,F]);const G=m.useMemo(()=>Array.isArray(O)?O.map((ne,K)=>Y2e(ne,K)).filter(Boolean).sort((ne,K)=>{const ge=Number.isFinite(ne.timestampMs)?ne.timestampMs:0,ye=Number.isFinite(K.timestampMs)?K.timestampMs:0;return ge-ye}):[],[O]);m.useEffect(()=>{if(!G.length||z&&G.some(ge=>$a(ge.id)===z))return;const ne=t&&G.some(ge=>$a(ge.id)===$a(t)),K=$a(ne?t:G[0].id);K!==z&&W(K)},[G,z,t]);const ee=m.useMemo(()=>z&&G.find(ne=>$a(ne.id)===z)||null,[G,z]),re=m.useMemo(()=>N||u.find(ne=>ne.trace_id===v)||null,[N,u,v]),pe=re?.sources||N?.sources||[],te=m.useMemo(()=>X2e(re,G),[re,G]),se=m.useMemo(()=>G2e(G),[G]);return m.useEffect(()=>{!a||typeof U.current!="function"||Y.current!==v&&(Y.current=v,U.current(v||null))},[v,a]),m.useEffect(()=>{!a||typeof X.current!="function"||ae.current!==z&&(ae.current=z,X.current(z||null))},[z,a]),m.useEffect(()=>{a||(g(!1),M(!1))},[a]),{supportsTraces:c,traceList:u,traceListMeta:f,isTraceListLoading:h,traceListError:b,traceDetail:N,traceDetailMeta:E,traceDetailError:I,isTraceDetailLoading:A,selectedTraceId:v,setSelectedTraceId:ne=>{const K=$a(ne);if(!K){k(null),W(null);return}K!==v&&W(null),k(K)},traceSummary:re,traceSources:pe,traceDurationMs:te,normalizedOperations:G,timeline:se,selectedOperationId:z,setSelectedOperationId:ne=>{W($a(ne))},selectedOperation:ee,refreshTraceList:()=>$(ne=>ne+1),refreshTraceDetail:()=>L(ne=>ne+1),traceDetailPage:F,setTraceDetailPage:V}},eje=e=>e==null?null:String(e),y9=2;function tje({operations:e=[],initialTraceId:t=null,initialOperationId:r=null,onTraceChange:n,onOperationChange:a,isActive:o=!0}){const{supportsTraces:s,traceList:l,traceListMeta:c,isTraceListLoading:u,traceListError:d,traceDetailError:f,traceDetailMeta:p,isTraceDetailLoading:h,selectedTraceId:g,setSelectedTraceId:b,traceSummary:y,traceSources:v,traceDurationMs:k,normalizedOperations:N,timeline:w,selectedOperationId:E,setSelectedOperationId:C,selectedOperation:O}=XR({initialTraceId:t,initialOperationId:r,onTraceChange:n,onOperationChange:a,isActive:o}),D=w.start,A=w.duration;if(!s)return i.jsx(Dt,{className:"rounded-tremor-small border border-dashed border-tremor-border p-6 text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Trace exploration requires an Inspectr API version that exposes the /api/traces endpoints."});if(u&&!l.length)return i.jsx(Dt,{className:"rounded-tremor-small border border-tremor-border p-6 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Loading traces…"});if(d&&!l.length)return i.jsxs(Dt,{className:"rounded-tremor-small border border-rose-200 bg-rose-50 p-6 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:["Failed to load traces: ",d.message||"Unexpected error"]});if(!l.length)return i.jsx(pl,{message:"No traces recorded yet. Start sending traffic to populate this view."});const M=y?.operation_count||N.length,I=T=>{const R=Number.isFinite(T.timestampMs)?T.timestampMs:D,L=Number.isFinite(T.duration)?T.duration:0,F=(R-D)/A*100,V=Math.min(Math.max(F,0),100),H=L/A*100,$=Math.min(Math.max(Number.isFinite(H)?H:y9,y9),100-V),z=E===eje(T.id),W=`${T.method} ${T.path}`;return i.jsxs("button",{type:"button",onClick:()=>C(T.id),className:fa("w-full rounded-tremor-small border px-3 py-3 text-left transition focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:border-dark-tremor-border",z?"border-tremor-brand bg-tremor-brand-faint ring-0 dark:border-tremor-brand":"border-transparent hover:border-slate-200 hover:bg-slate-50 dark:hover:border-slate-600 dark:hover:bg-dark-tremor-background-subtle"),children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:fa("h-2.5 w-2.5 rounded-full",WR(T.status??null))}),i.jsx("span",{className:"truncate text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:W})]}),i.jsxs("div",{className:"flex flex-col items-end gap-1 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[i.jsx("span",{children:Yn(T.duration)}),i.jsx("span",{children:Tn(T.timestamp)})]})]}),i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[i.jsx(Su,{method:T.method}),i.jsx(kl,{status:T.status}),T.traceInfo?.source?i.jsx(Bt,{color:"blue",children:T.traceInfo.source}):null,T.host?i.jsx("span",{className:"truncate",children:T.host}):null]}),i.jsx("div",{className:"relative mt-3 h-2 rounded-full bg-slate-100 dark:bg-dark-tremor-background-subtle",children:i.jsx("span",{className:fa("absolute top-0 h-2 rounded-full transition-all",VR(T.status??null)),style:{left:`${V}%`,width:`${$}%`}})})]},T.id)};return i.jsxs("div",{className:"grid gap-6 lg:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)]",children:[i.jsxs(Dt,{className:"rounded-tremor-small border border-tremor-border p-6 dark:border-dark-tremor-border",children:[i.jsxs(Lb,{justifyContent:"between",alignItems:"start",children:[i.jsxs("div",{children:[i.jsx(Rn,{className:"text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Trace explorer"}),i.jsx(gt,{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:"Inspect spans collected for a trace and explore downstream requests."})]}),i.jsx(Bt,{color:f?"rose":"slate",children:`${M} ${M===1?"step":"steps"}`})]}),i.jsxs("div",{className:"mt-6 flex flex-col gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{children:[i.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"Trace"}),i.jsx(gt,{className:"text-sm text-tremor-content-strong dark:text-dark-tremor-content-strong",children:Oj(y)})]}),v?.length?i.jsx("div",{className:"flex flex-wrap gap-2",children:v.map(T=>i.jsx(Bt,{color:"blue",children:T},T))}):null,i.jsxs("div",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[y?.first_seen?i.jsxs("div",{children:["First seen: ",Tn(y.first_seen)]}):null,y?.last_seen?i.jsxs("div",{children:["Last seen: ",Tn(y.last_seen)]}):null,k!=null?i.jsxs("div",{children:["Observed duration: ",Yn(k)]}):null]})]}),i.jsx(_E,{className:"w-full sm:w-72 [&>button]:rounded-tremor-small",enableClear:!1,value:g??y?.trace_id??"",onValueChange:b,children:l.map(T=>i.jsx(qs,{value:T.trace_id,children:Oj(T)},T.trace_id))})]}),i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[i.jsxs("span",{children:["Page ",p?.page||c?.page||1," of"," ",c?.total_pages||p?.total_pages||1]}),i.jsx("span",{children:h?"Refreshing trace…":`Total operations: ${M}`})]}),f?i.jsxs(Dt,{className:"rounded-tremor-small border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:["Failed to load trace details: ",f.message||"Unexpected error"]}):null,i.jsx("div",{className:"space-y-4",children:N.length?N.map(T=>I(T)):i.jsx(Dt,{className:"rounded-tremor-small border border-dashed border-tremor-border p-6 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"No operations recorded for this trace."})})]})]}),i.jsx(Dt,{className:"rounded-tremor-small border border-tremor-border p-6 dark:border-dark-tremor-border",children:i.jsx(YR,{operation:O,isLoading:h})})]})}const x9=({items:e=[]})=>e.length?i.jsx("div",{className:"space-y-1 text-xs text-tremor-content dark:text-dark-tremor-content",children:e.map((t,r)=>{if(!t)return null;const{label:n,value:a}=t;return a==null||a===""?null:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"font-mono text-tremor-content-strong dark:text-dark-tremor-content-strong",children:n}),i.jsx("span",{className:"flex-1 break-words",children:typeof a=="string"?a:JSON.stringify(a)})]},`${n}-${r}`)})}):null;function rje({operation:e,isLoading:t}){typeof window<"u"&&localStorage.getItem("debug")==="true"&&console.log("OP",e);const[r,n]=m.useState(!1),[a,o]=m.useState("structured"),s=m.useRef([]),l=e?.meta?.mcp||e?.raw?.meta?.mcp||e?.meta?.trace?.mcp||e?.raw?.meta?.trace?.mcp||{},c=typeof e?.request?.body=="string"?e.request.body:e?.request?.body?JSON.stringify(e.request.body):"",u=typeof e?.response?.body=="string"?e.response.body:e?.response?.body?JSON.stringify(e.response.body):"",d=T9(e?.response?.event_frames),f=u||d||"",p=vp(c),h=vp(f),g=l.method||p?.method||"",b=l.category||"";h?.result?.tools||h?.tools;const y=Array.isArray(e?.meta?.tags)&&e.meta.tags.some(z=>typeof z=="string"&&z.startsWith("mcp.tool.")),v=m.useMemo(()=>M9(g,h),[g,h]),k=v.type==="toolsList"&&Array.isArray(v.tools),N=g==="tools/call"||g==="tool/call"||y,w=v.type==="promptsList",E=g==="prompts/get",C=v.type==="resourcesList",O=g==="resources/read",D=m.useMemo(()=>Array.isArray(v.content)&&v.content.length,[v.content]),A=m.useMemo(()=>{const z=[];return v.structuredContent&&z.push({key:"structured",label:"Structured content"}),D&&z.push({key:"content",label:"Content items"}),z.push({key:"raw",label:"Raw content"}),z},[v.structuredContent,D]);m.useEffect(()=>{n(!1),v.structuredContent?o("structured"):o(D?"content":"raw")},[e?.id]),k&&v.tools.length&&(s.current=v.tools);const M=(s.current||[]).find(z=>z.name===p?.params?.name),I=h?.result?.tool?.inputSchema||M?.inputSchema||Array.isArray(v.tools)&&v.tools.find(z=>z.name===p?.params?.name)?.inputSchema||null,T=N?MF(p?.params?.arguments||{},I):{missing:[],extra:[]},R=h?.result,L=R?.mimeType||R?.resource?.mimeType||"",F=p?JSON.stringify(p,null,2):c||"No request body",V=h?JSON.stringify(h,null,2):u||"No response body",H=m.useMemo(()=>({readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",fontSize:12,lineNumbers:"off",folding:!1}),[]),$=()=>N?"Tool call":k?"Tools list":w?"Prompts list":E?"Prompt":C?"Resources list":O?"Resource":"Typed view";return e?i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Su,{method:e.method}),i.jsx(Rn,{className:"text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:`${e.path||e.url||"Operation"}`})]}),i.jsx(gt,{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:e.host||e.request?.server||"Unspecified host"})]}),i.jsxs("div",{className:"flex flex-col items-end gap-2",children:[i.jsx(kl,{status:e.status}),i.jsx(Bt,{color:"blue",children:Yn(e.duration)})]})]}),i.jsxs("div",{className:"mt-6 flex-1 space-y-5 pr-1",children:[i.jsx(la,{title:"Properties",resetKey:e?.id,defaultOpen:!0,children:i.jsx(KR,{operation:e,mcpMeta:l})}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"MCP"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(dc,{method:g||"",children:g||"Unknown method"}),b?i.jsx(Bt,{color:"slate",size:"xs",children:b}):null]})]}),i.jsxs(Zc,{index:r?1:0,onIndexChange:z=>n(z===1),children:[i.jsxs(Gc,{children:[i.jsx(ca,{children:$()}),i.jsx(ca,{children:"Raw"})]}),i.jsxs(Jc,{children:[i.jsx(ua,{children:i.jsxs("div",{className:"space-y-3",children:[k&&v.tools?.length?i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsxs(gt,{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:["Tools (",v.tools.length,")"]})}),i.jsx("div",{className:"space-y-2",children:v.tools.map(z=>i.jsx(xR,{tool:z},z.name))})]}):null,N?i.jsx("div",{className:"space-y-2",children:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:"Tool:"}),i.jsx(dc,{method:g||"",children:p?.params?.name||"-"}),i.jsx("span",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:"Result:"}),h?.error?i.jsx(Bt,{color:"rose",size:"xs",children:"Error"}):i.jsx(Bt,{color:"emerald",size:"xs",children:"Success"})]}),i.jsxs("div",{className:"grid gap-3 md:grid-cols-1",children:[i.jsx(hp,{validation:I?T:void 0,children:i.jsx(bR,{args:p?.params?.arguments})}),i.jsx(gp,{children:h?(()=>{const z=A.find(X=>X.key===a)?.key||A[0].key,W=A.findIndex(X=>X.key===z),U=h?.result??h??{};return i.jsxs(Zc,{index:W,onIndexChange:X=>o(A[X]?.key||A[0].key),children:[i.jsx(Gc,{children:A.map(X=>i.jsx(ca,{children:X.label},X.key))}),i.jsx(Jc,{children:A.map(X=>i.jsxs(ua,{children:[X.key==="structured"?i.jsx(Ko,{data:v.structuredContent,title:"Structured content",copyText:JSON.stringify(v.structuredContent,null,2)}):null,X.key==="content"?i.jsx(Ko,{data:v.content,title:"Content items",copyText:JSON.stringify(v.content,null,2),children:i.jsx(kR,{items:v.content})}):null,X.key==="raw"?i.jsx(Ko,{data:U,title:"Raw Output",copyText:JSON.stringify(U,null,2)}):null]},X.key))})]})})():i.jsx(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:"No result returned."})})]})]})}):null,w&&Array.isArray(v.prompts)?i.jsxs("div",{className:"space-y-2",children:[i.jsxs(gt,{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:["Prompts (",v.prompts.length,")"]}),i.jsx("div",{className:"space-y-2",children:v.prompts.map(z=>{const W=z.arguments||[],U=W.filter(X=>X.required).length;return i.jsxs(Dt,{className:"space-y-1 rounded-tremor-small border border-tremor-border p-3 shadow-sm dark:border-dark-tremor-border",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx(gt,{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:z.title||z.name}),z.description?i.jsx(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:z.description}):null]}),i.jsxs(Bt,{color:"slate",size:"xs",children:[W.length," args",U?` (${U} required)`:""]})]}),W.length?i.jsx("div",{className:"space-y-1",children:W.map(X=>i.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[i.jsx("span",{className:"font-mono text-tremor-content-strong dark:text-dark-tremor-content-strong",children:X.name}),i.jsx("span",{className:"flex-1 text-tremor-content dark:text-dark-tremor-content",children:X.description||"No description"}),X.required?i.jsx(Bt,{color:"rose",size:"xs",children:"required"}):null]},X.name))}):null]},z.name)})})]}):null,E&&Array.isArray(h?.result?.messages)?i.jsx("div",{className:"space-y-2",children:i.jsxs("div",{className:"grid gap-3",children:[i.jsx(hp,{children:i.jsx(x9,{items:[{label:"name",value:p?.params?.name||h?.result?.name||"—"},...Array.isArray(p?.params?.arguments)?p.params.arguments.map((z,W)=>({label:`arg ${W+1}`,value:z})):[]]})}),i.jsx(gp,{children:i.jsx("div",{className:"space-y-2",children:h.result.messages.map((z,W)=>i.jsx("div",{className:`flex ${z.role==="assistant"?"justify-end":"justify-start"}`,children:i.jsx("div",{className:`max-w-xl rounded-tremor-small px-3 py-2 text-sm ${z.role==="assistant"?"bg-tremor-brand-faint text-tremor-content-strong":"bg-tremor-background-subtle text-tremor-content dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content"}`,children:Array.isArray(z.content)?z.content.map((U,X)=>i.jsx("div",{children:U.text||"[content]"},X)):z.content?.text||"[content]"})},W))})})]})}):null,C&&Array.isArray(v.resources)?i.jsxs("div",{className:"space-y-2",children:[i.jsxs(gt,{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:["Resources (",v.resources.length,")"]}),i.jsx("div",{className:"divide-y divide-tremor-border text-sm dark:divide-dark-tremor-border",children:v.resources.map(z=>i.jsxs("div",{className:"flex flex-wrap items-center gap-2 py-2",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:z.title||z.name||z.uri}),i.jsx("div",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:z.uri}),z.description?i.jsx("div",{className:"text-xs text-tremor-content dark:text-dark-tremor-content",children:z.description}):null]}),z.mimeType?i.jsx(Bt,{color:"slate",size:"xs",children:z.mimeType}):null,z.size?i.jsx(Bt,{color:"slate",size:"xs",children:`${(z.size/1024).toFixed(1)} KB`}):null]},z.uri))})]}):null,O&&h?.result?i.jsx("div",{className:"space-y-2",children:i.jsxs("div",{className:"grid gap-3",children:[i.jsx(hp,{children:i.jsx(x9,{items:[{label:"uri",value:p?.params?.uri||R?.uri},L?{label:"mime",value:L}:null]})}),i.jsx(gp,{children:i.jsx(vR,{resource:R,mimeType:L,editorOptions:H})})]})}):null,!k&&!N&&!w&&!E&&!C&&!O?i.jsx(gt,{className:"text-sm text-tremor-content-subtle dark:text-dark-tremor-content",children:"No typed MCP view available for this method. Switch to Raw JSON to inspect."}):null]})}),i.jsx(ua,{children:i.jsxs("div",{className:"space-y-3",children:[i.jsx(la,{title:"HTTP Request",resetKey:e?.id,defaultOpen:!1,copyText:F,children:i.jsx("div",{className:"h-60 overflow-hidden",children:i.jsx(ns,{value:F||"No request body",language:"json",theme:os(),beforeMount:as,options:H,height:"100%"})})}),i.jsx(la,{title:"HTTP Response",resetKey:e?.id,defaultOpen:!1,copyText:V,children:i.jsx("div",{className:"h-[320px] overflow-hidden",children:i.jsx(ns,{value:V||"No response body",language:"json",theme:os(),beforeMount:as,options:H,height:"100%"})})})]})})]})]})]})]})]}):i.jsx("div",{className:"flex h-full items-center justify-center text-sm text-tremor-content-subtle dark:text-dark-tremor-content",children:t?"Loading trace details…":"Select an Operation span to inspect its details."})}const Fl=3;function GR({start:e,duration:t,status:r,total:n,baseStart:a,baseDuration:o,variant:s="status"}){if(!Number.isFinite(n)||n<=0)return i.jsx("div",{className:"h-2 w-full rounded-full bg-slate-200 dark:bg-dark-tremor-background-subtle"});const l=Number.isFinite(n)&&n>0?n:o,c=(e-a)/l*100,u=t/l*100,d=(h,g=0,b=100)=>Math.min(Math.max(h,g),b);let f=d(c),p=d(f+u)-f;return!Number.isFinite(p)||p<=0?(p=Fl,f>=100&&(f=100-p)):p<Fl&&(p=Math.min(100,f+Fl)-f,p<Fl&&(f=Math.max(0,100-Fl),p=Fl)),i.jsx("div",{className:"relative h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-slate-200 dark:bg-dark-tremor-background-subtle",children:i.jsx("span",{className:fa("absolute top-0 h-2 rounded-full transition-all",s==="brand"?"bg-tremor-brand/80 dark:bg-tremor-brand/60":VR(r??null)),style:{left:`${f}%`,width:`${p}%`}})})}function nje({operation:e,index:t,isSelected:r,onSelect:n,timelineWidth:a,baseStart:o,baseDuration:s,selectedOperationRef:l}){const{start:c,duration:u}=Hb(e,t),d=e?.meta?.mcp||e?.raw?.meta?.mcp||e?.meta?.trace?.mcp||e?.raw?.meta?.trace?.mcp,f=d?.name||d?.method||null;return i.jsx("button",{ref:r?l:null,type:"button",onClick:n,className:fa("flex w-full items-center gap-3 rounded-tremor-small px-0 py-1.5 text-left transition focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",r?"bg-tremor-brand-faint text-tremor-content-strong ring-0 dark:bg-tremor-brand-faint/40":"hover:bg-slate-100 dark:hover:bg-dark-tremor-background-subtle"),children:i.jsxs("div",{className:fa("grid w-full items-center gap-2 pl-0",a<45?"sm:grid-cols-[1.5rem_minmax(0,1fr)]":"sm:grid-cols-[1.5rem_minmax(0,1fr)_65%]"),children:[i.jsx("div",{className:"flex justify-center",children:i.jsx("span",{className:fa("h-2 w-2 rounded-full",WR(e.status??null))})}),i.jsxs("div",{className:"min-w-0 flex flex-col",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[i.jsx(Su,{method:e.method}),i.jsx("span",{className:"truncate",children:e.path}),f?i.jsx(dc,{method:d?.method||"",children:f}):null]}),i.jsx(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:Tn(e.timestamp,{includeMilliseconds:!0})})]}),i.jsxs("div",{className:fa("min-w-0 items-center gap-3",a<45?"hidden":"flex"),children:[i.jsx(gt,{className:"w-20 shrink-0 text-right text-xs font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:Yn(e.duration)}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(GR,{start:c,duration:u,status:e.status,total:s,baseStart:o,baseDuration:s})}),i.jsx("div",{className:"w-10 shrink-0 flex justify-center",children:i.jsx(kl,{status:e.status})})]})]})},e.id)}const v9=e=>e==null?null:String(e);function aje({group:e,isExpanded:t,onToggle:r,selectedOperationId:n,onOperationSelect:a,timelineWidth:o,baseStart:s,baseDuration:l,selectedOperationRef:c}){const u=e.operations.some(p=>v9(p.id)===n),{startMs:d,durationMs:f}=e;return i.jsxs("div",{className:fa("rounded-tremor-small border border-transparent bg-white/60 shadow-sm transition dark:bg-dark-tremor-background",u?"border-tremor-brand shadow-tremor-card dark:border-tremor-brand":"hover:border-slate-200 hover:shadow-tremor-card dark:hover:border-slate-700"),children:[i.jsx("button",{type:"button",onClick:()=>r(e.id),className:"flex w-full items-center gap-3 px-3 py-2 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",children:i.jsxs("div",{className:fa("grid w-full items-center gap-2 pl-0",o<45?"sm:grid-cols-[1.5rem_minmax(0,1fr)]":"sm:grid-cols-[1.5rem_minmax(0,1fr)_65%]"),children:[i.jsx("div",{className:"flex justify-center",children:i.jsx("span",{className:fa("flex h-6 w-6 shrink-0 items-center justify-center rounded-full border",t?"border-tremor-brand text-tremor-brand":"border-slate-300 text-slate-500 dark:border-slate-600 dark:text-slate-400"),"aria-hidden":!0,children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:fa("h-3.5 w-3.5 transition-transform",t?"rotate-180":"rotate-0"),children:i.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.084l3.71-3.854a.75.75 0 0 1 1.08 1.04l-4.25 4.417a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z",clipRule:"evenodd"})})})}),i.jsxs("div",{className:"min-w-0 flex flex-col",children:[i.jsx("div",{className:"flex items-center gap-2 truncate",children:i.jsx(gt,{className:"truncate text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e.label})}),e.subtitle?i.jsx(gt,{className:"truncate text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:e.subtitle}):null]}),i.jsxs("div",{className:fa("min-w-0 items-center gap-3",o<45?"hidden":"flex"),children:[i.jsx(gt,{className:"w-20 shrink-0 text-right text-xs font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:Yn(f)}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(GR,{start:d??s,duration:f,total:l,baseStart:s,baseDuration:l,variant:"brand"})}),i.jsx("div",{className:"w-10 shrink-0 flex justify-center",children:i.jsx(Bt,{color:"slate",children:e.operations.length})})]})]})}),t?i.jsx("div",{className:"border-t border-tremor-border px-3 py-2 dark:border-dark-tremor-border",children:i.jsx("div",{className:"space-y-1",children:e.operations.map((p,h)=>i.jsx(nje,{operation:p,index:h,isSelected:n===v9(p.id),onSelect:()=>a(p.id),timelineWidth:o,baseStart:s,baseDuration:l,selectedOperationRef:c},p.id))})}):null]},e.id)}function oje({onMouseDown:e,onDoubleClick:t}){return i.jsx("div",{className:"relative w-px cursor-col-resize bg-gray-300 dark:bg-dark-tremor-border",onMouseDown:e,children:i.jsx("button",{type:"button",className:"absolute left-1/2 top-1/2 z-10 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center rounded-md border border-gray-300 bg-white/80 px-0 py-2 text-gray-600 shadow-sm backdrop-blur-sm transition hover:bg-white dark:border-dark-tremor-border dark:bg-dark-tremor-background/80 dark:text-dark-tremor-content",title:"Drag to resize. Double-click to reset.","aria-label":"Resize panels",onMouseDown:r=>{r.preventDefault(),e?.(r)},onDoubleClick:r=>{r.preventDefault(),t?.(r)},children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4","aria-hidden":!0,children:i.jsx("path",{d:"M8.5 7C9.32843 7 10 6.32843 10 5.5C10 4.67157 9.32843 4 8.5 4C7.67157 4 7 4.67157 7 5.5C7 6.32843 7.67157 7 8.5 7ZM8.5 13.5C9.32843 13.5 10 12.8284 10 12C10 11.1716 9.32843 10.5 8.5 10.5C7.67157 10.5 7 11.1716 7 12C7 12.8284 7.67157 13.5 8.5 13.5ZM10 18.5C10 19.3284 9.32843 20 8.5 20C7.67157 20 7 19.3284 7 18.5C7 17.6716 7.67157 17 8.5 17C9.32843 17 10 17.6716 10 18.5ZM15.5 7C16.3284 7 17 6.32843 17 5.5C17 4.67157 16.3284 4 15.5 4C14.6716 4 14 4.67157 14 5.5C14 6.32843 14.6716 7 15.5 7ZM17 12C17 12.8284 16.3284 13.5 15.5 13.5C14.6716 13.5 14 12.8284 14 12C14 11.1716 14.6716 10.5 15.5 10.5C16.3284 10.5 17 11.1716 17 12ZM15.5 20C16.3284 20 17 19.3284 17 18.5C17 17.6716 16.3284 17 15.5 17C14.6716 17 14 17.6716 14 18.5C14 19.3284 14.6716 20 15.5 20Z"})})})})}const sje=({className:e="",...t})=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:`lucide lucide-chart-gantt-icon lucide-chart-gantt ${e}`,"aria-hidden":"true",...t,children:[i.jsx("path",{d:"M10 6h8"}),i.jsx("path",{d:"M12 16h6"}),i.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),i.jsx("path",{d:"M8 11h7"})]}),ije=({className:e="",...t})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:` text-white ${e}`,"aria-hidden":"true",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"})});function lje({operationCount:e,onRefresh:t,isRefreshing:r,hasError:n,traceSources:a,onOpenFilters:o,activeFiltersCount:s=0}){const l=s>0?"bg-green-500 text-white":"bg-blue-500 text-white",c=s>0?"bg-green-700":"bg-blue-700";return i.jsxs(Lb,{justifyContent:"between",alignItems:"start",children:[i.jsx("div",{children:i.jsxs(Rn,{className:"flex items-center gap-2 text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[i.jsx(sje,{className:"h-4 w-4"}),i.jsx("span",{children:"Trace timeline"})]})}),i.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[o?i.jsxs("button",{type:"button",onClick:o,className:`relative inline-flex items-center gap-1 rounded px-3 py-1.5 text-xs font-medium shadow-sm cursor-pointer ${l}`,children:[i.jsx(ije,{className:"h-4 w-4"}),"Filters",s>0?i.jsx("span",{className:`absolute -top-1 -right-1 text-white text-[10px] font-bold w-4 h-4 flex items-center justify-center rounded-full ${c}`,children:s}):null]}):null,i.jsx("button",{type:"button",onClick:t,disabled:r,title:"Refresh trace",className:"inline-flex items-center gap-2 rounded border border-tremor-border px-3 py-1.5 text-xs font-medium text-tremor-content-strong shadow-sm transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-dark-tremor-border dark:text-dark-tremor-content-strong dark:hover:bg-dark-tremor-background-subtle",children:r?"Refreshing…":"Refresh"}),a?.length?i.jsx("div",{className:"flex flex-wrap gap-2",children:a.map(u=>i.jsx(Bt,{color:"blue",children:u},u))}):null,i.jsx(Bt,{color:n?"rose":"slate",children:`${e} ${e===1?"step":"steps"}`})]})]})}function cje({traceSummary:e,traceDurationMs:t,traceDetailMeta:r,traceListMeta:n,isTraceDetailLoading:a,operationCount:o,tokenTotals:s}){const l=c=>c==null?"—":c.toLocaleString();return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[i.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"Trace"}),i.jsx("span",{className:"text-sm text-tremor-content-strong dark:text-dark-tremor-content-strong",children:Oj(e)})]}),s?i.jsxs("div",{className:"w-full flex flex-wrap items-center justify-between gap-4 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[i.jsxs("div",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:["Estimated total tokens for ",o," operations:"]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-right text-tremor-content dark:text-dark-tremor-content",children:[i.jsxs(Bt,{color:"indigo",size:"xs",children:["Request ",l(s.request)]}),i.jsxs(Bt,{color:"indigo",size:"xs",children:["Response ",l(s.response)]}),i.jsxs(Bt,{color:"indigo",size:"xs",children:["Total ",l(s.total)]})]})]}):null,i.jsxs("div",{className:"w-full flex flex-wrap items-center justify-between gap-4 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[e?.first_seen?i.jsxs("div",{children:["First step: ",Tn(e.first_seen)]}):null,e?.last_seen?i.jsxs("div",{children:["Last step: ",Tn(e.last_seen)]}):null,t!=null?i.jsxs("div",{children:["Observed duration: ",Yn(t)]}):null]})]}),i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[i.jsxs("span",{children:["Page ",r?.page||n?.page||1," of"," ",n?.total_pages||r?.total_pages||1]}),i.jsx("span",{children:a?"Refreshing trace…":`Total operations: ${o}`})]})]})}function uje({supportsTraces:e,isTraceListLoading:t,traceList:r,traceListError:n}){return e?t&&!r.length?i.jsx(Dt,{className:"rounded-tremor-small border border-tremor-border p-6 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Loading traces…"}):n&&!r.length?i.jsxs(Dt,{className:"rounded-tremor-small border border-rose-200 bg-rose-50 p-6 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:["Failed to load traces: ",n.message||"Unexpected error"]}):r.length?null:i.jsx(pl,{message:"No traces recorded yet. Start sending traffic to populate this view."}):i.jsx(Dt,{className:"rounded-tremor-small border border-dashed border-tremor-border p-6 text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Trace exploration requires an Inspectr API version that exposes the /api/traces endpoints."})}const dje=({isOpen:e,onClose:t,filters:r,setFilters:n,statusOptions:a=[],methodOptions:o=[],tagOptions:s=[],mcpToolOptions:l=[],mcpResourceOptions:c=[],mcpPromptOptions:u=[],mcpCategoryOptions:d=[],mcpMethodOptions:f=[],hostOptions:p=[],hasMcpOperations:h=!1,persistFilters:g=!1,onPersistFiltersChange:b=()=>{}})=>{const y={blue:"bg-blue-500/10 text-blue-700 dark:bg-blue-500/5 dark:text-blue-200",indigo:"bg-indigo-500/10 text-indigo-700 dark:bg-indigo-500/5 dark:text-indigo-200",emerald:"bg-emerald-500/10 text-emerald-700 dark:bg-emerald-500/5 dark:text-emerald-200",amber:"bg-amber-500/10 text-amber-700 dark:bg-amber-500/5 dark:text-amber-200",slate:"bg-slate-500/10 text-slate-700 dark:bg-slate-500/5 dark:text-slate-200"},v=T=>{const R=Yh(T);return y[R]||y.slate},k=T=>()=>y[T]||y.slate,N=l.length>0||(r.mcpTool||[]).length>0,w=c.length>0||(r.mcpResource||[]).length>0,E=u.length>0||(r.mcpPrompt||[]).length>0,C=d.length>0||(r.mcpCategory||[]).length>0,O=f.length>0||(r.mcpMethod||[]).length>0,D=[...r.mcpTool||[],...r.mcpResource||[],...r.mcpPrompt||[],...r.mcpCategory||[],...r.mcpMethod||[]].length?!0:!!(r.tokenMin||r.tokenMax),A=h||D||N||w||E||C||O,M=()=>{n({})},I=T=>{n(R=>{const L={...R};return T.forEach(F=>{delete L[F]}),L})};return i.jsxs(i.Fragment,{children:[e&&i.jsx("div",{className:"fixed inset-0 bg-black opacity-50",style:{zIndex:9998},onClick:t}),i.jsxs("div",{className:`fixed top-0 left-0 h-full w-[420px] max-w-full bg-white dark:bg-dark-tremor-background shadow-xl dark:shadow-dark-tremor-shadow transform transition-transform duration-300 flex flex-col
186
- ${e?"translate-x-0":"-translate-x-full"}
187
- `,style:{zIndex:9999},children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-4 border-b border-gray-300 dark:border-dark-tremor-border bg-gray-50 dark:bg-dark-tremor-background-subtle",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-dark-tremor-content-strong",children:"Filters"}),i.jsx("button",{onClick:t,className:"text-gray-600 dark:text-dark-tremor-content hover:text-gray-800 dark:hover:text-dark-tremor-content-strong focus:outline-none cursor-pointer border rounded px-1","aria-label":"Close",children:"×"})]}),i.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",children:i.jsxs("section",{className:"mb-6",children:[i.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-gray-200 dark:border-dark-tremor-border",children:[i.jsx("h3",{className:"text-xs font-bold text-gray-600 dark:text-dark-tremor-content uppercase tracking-wide",children:"Filters"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("label",{className:"flex items-center gap-1 text-[11px] font-medium text-gray-600 dark:text-dark-tremor-content-subtle",children:[i.jsx("input",{type:"checkbox",className:"h-3 w-3",checked:g,onChange:T=>b(T.target.checked)}),"Keep on reload"]}),i.jsx("button",{onClick:M,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]})]}),i.jsxs("div",{className:"space-y-6 pt-4",children:[A?i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-tremor-content-subtle",children:"MCP"}),i.jsx("button",{onClick:()=>I(["mcpTool","mcpResource","mcpPrompt","mcpMethod","mcpCategory","tokenMin","tokenMax"]),className:"text-xs text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]}),N&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"MCP Tool"}),i.jsx(tn,{options:l,selected:r.mcpTool||[],onChange:T=>n(R=>({...R,mcpTool:T})),placeholder:"Add MCP tool...",colorFn:k("blue")})]}),w&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"MCP Resource"}),i.jsx(tn,{options:c,selected:r.mcpResource||[],onChange:T=>n(R=>({...R,mcpResource:T})),placeholder:"Add MCP resource...",colorFn:k("emerald")})]}),E&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"MCP Prompt"}),i.jsx(tn,{options:u,selected:r.mcpPrompt||[],onChange:T=>n(R=>({...R,mcpPrompt:T})),placeholder:"Add MCP prompt...",colorFn:k("indigo")})]}),O&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"MCP Method"}),i.jsx(tn,{options:f,selected:r.mcpMethod||[],onChange:T=>n(R=>({...R,mcpMethod:T})),placeholder:"Add MCP method...",colorFn:v})]}),C&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"MCP Category"}),i.jsx(tn,{options:d,selected:r.mcpCategory||[],onChange:T=>n(R=>({...R,mcpCategory:T})),placeholder:"Add MCP category...",colorFn:v})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Total Tokens"}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("input",{type:"number",placeholder:"Min",value:r.tokenMin||"",onChange:T=>n(R=>({...R,tokenMin:T.target.value})),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("input",{type:"number",placeholder:"Max",value:r.tokenMax||"",onChange:T=>n(R=>({...R,tokenMax:T.target.value})),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]})]}):null,i.jsxs("div",{className:`space-y-4 ${A?"pt-4 border-t border-gray-200 dark:border-dark-tremor-border":""}`,children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-tremor-content-subtle",children:"HTTP"}),i.jsx("button",{onClick:()=>I(["status","method","path"]),className:"text-xs text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Status"}),i.jsx(tn,{options:a,selected:r.status||[],onChange:T=>n(R=>({...R,status:T})),placeholder:"Add status...",colorFn:Qc})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Method"}),i.jsx(tn,{options:o,selected:r.method||[],onChange:T=>n(R=>({...R,method:T})),placeholder:"Add method...",colorFn:Kh})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Path"}),i.jsx("input",{type:"text",placeholder:"e.g. /mcp",value:r.path||"",onChange:T=>n(R=>({...R,path:T.target.value})),className:"block w-full border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]}),i.jsxs("div",{className:"space-y-4 pt-4 border-t border-gray-200 dark:border-dark-tremor-border",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-tremor-content-subtle",children:"Tags"}),i.jsx("button",{onClick:()=>I(["tags"]),className:"text-xs text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Tags"}),i.jsx(tn,{options:s,selected:r.tags||[],onChange:T=>n(R=>({...R,tags:T})),placeholder:"Add tag..."})]})]}),i.jsxs("div",{className:"space-y-4 pt-4 border-t border-gray-200 dark:border-dark-tremor-border",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-tremor-content-subtle",children:"Timing & Host"}),i.jsx("button",{onClick:()=>I(["durationMin","durationMax","host"]),className:"text-xs text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Duration (ms)"}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("input",{type:"number",placeholder:"Min",value:r.durationMin||"",onChange:T=>n(R=>({...R,durationMin:T.target.value})),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),i.jsx("input",{type:"number",placeholder:"Max",value:r.durationMax||"",onChange:T=>n(R=>({...R,durationMax:T.target.value})),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Host"}),i.jsx(tn,{options:p,selected:r.host||[],onChange:T=>n(R=>({...R,host:T})),placeholder:"Add host..."})]})]})]})]})})]})]})},tp=e=>e==null?null:String(e),fw=56,k9=30,w9=75,fje="traceTimelineWidth",mw="calc(100vh - 64px)",mje="traceTimelineFilters",pje="traceTimelinePersistFilters",hje=e=>{if(!e.length)return"Trace group";const t=e[0];return Q2e(t)||t.traceInfo?.source||(t.correlationId?`Correlation ${t.correlationId}`:null)||`${t.method} ${t.path}`},gje=e=>{if(!e.length)return"";const t=e[0];return t.path||t.url||""},bje=e=>e.length?e.reduce((t,r)=>Math.max(t,r.status??0),0):null,$l=e=>{const t=Number(e);return Number.isFinite(t)?t:null};function ZR({operations:e=[],initialTraceId:t=null,initialOperationId:r=null,onTraceChange:n,onOperationChange:a,isActive:o=!0}){const{supportsTraces:s,traceList:l,traceListMeta:c,isTraceListLoading:u,traceListError:d,traceDetailError:f,traceDetailMeta:p,isTraceDetailLoading:h,selectedTraceId:g,traceSummary:b,traceSources:y,traceDurationMs:v,normalizedOperations:k,timeline:N,selectedOperationId:w,setSelectedOperationId:E,refreshTraceList:C,refreshTraceDetail:O,traceDetailPage:D,setTraceDetailPage:A}=XR({initialTraceId:t,initialOperationId:r,onTraceChange:n,onOperationChange:a,isActive:o}),[M,I]=m.useState(()=>new Set),[T,R]=dr(fje,String(fw)),[L,F]=dr(pje,"false"),[V,H]=dr(mje,""),$=m.useMemo(()=>{const Ae=Number(T);return Number.isFinite(Ae)&&Ae>=k9&&Ae<=w9?Ae:fw},[T]),z=m.useRef(!1),W=m.useRef(null),U=m.useRef(null),X=m.useRef(null),[Y,ae]=m.useState(!1),G=L==="true",[ee,re]=m.useState({}),pe=N.start,te=N.duration,se=m.useMemo(()=>{if(!k.length)return[];const Ae=(qe,nt)=>{if(!Array.isArray(nt)||nt.length===0)return!0;if(!qe)return!1;const dt=Array.isArray(qe)?qe:[qe],wt=new Set(dt.map(pt=>String(pt).toLowerCase()));return nt.some(pt=>wt.has(String(pt).toLowerCase()))},ke=(qe,nt)=>{if(!Array.isArray(nt)||nt.length===0)return!0;const dt=c8(nt);if(!dt.length)return!0;const wt=Array.isArray(qe)?qe.map(pt=>pt.token):[];return dt.every(pt=>wt.includes(pt))},Ie=qe=>{const nt=(qe?.meta?.mcp||qe?.raw?.meta?.mcp||qe?.meta?.trace?.mcp||qe?.raw?.meta?.trace?.mcp)?.tokens;if(!nt)return null;const dt=$l(nt.total);if(dt!==null)return dt;const wt=$l(nt.request),pt=$l(nt.response);return wt!==null||pt!==null?(wt??0)+(pt??0):null};return k.filter(qe=>{if(!qe)return!1;if(ee.status&&Array.isArray(ee.status)&&ee.status.length>0){const er=qe.status!=null?String(qe.status):"";if(!ee.status.includes(er))return!1}if(ee.method&&Array.isArray(ee.method)&&ee.method.length>0){const er=(qe.method||"").toLowerCase();if(!ee.method.map(qr=>String(qr).toLowerCase()).includes(er))return!1}if(ee.path&&!(qe.path||qe.url||"").toLowerCase().includes(String(ee.path).toLowerCase())||ee.durationMin&&(!Number.isFinite(qe.duration)||Number(qe.duration)<Number(ee.durationMin))||ee.durationMax&&(!Number.isFinite(qe.duration)||Number(qe.duration)>Number(ee.durationMax)))return!1;if(ee.tokenMin){const er=Ie(qe);if(er===null||er<Number(ee.tokenMin))return!1}if(ee.tokenMax){const er=Ie(qe);if(er===null||er>Number(ee.tokenMax))return!1}if(ee.host&&Array.isArray(ee.host)&&ee.host.length>0){const er=(qe.host||"").toLowerCase();if(!ee.host.map(qr=>String(qr).toLowerCase()).some(qr=>er.includes(qr)))return!1}if(ee.tags&&!ke(qe.tags,ee.tags))return!1;const nt=qe.raw?.meta||{},dt=nt.trace||{},wt=nt.mcp||dt.mcp||qe.meta?.mcp||null,pt=wt?.category||"",Le=wt?.method||"",Tt=wt?.name||"";return!(ee.mcpCategory&&!Ae(pt,ee.mcpCategory)||ee.mcpMethod&&!Ae(Le,ee.mcpMethod)||ee.mcpTool&&ee.mcpTool.length>0&&!Ae(pt==="tool"?Tt:"",ee.mcpTool)||ee.mcpResource&&ee.mcpResource.length>0&&!Ae(pt==="resource"?Tt:"",ee.mcpResource)||ee.mcpPrompt&&ee.mcpPrompt.length>0&&!Ae(pt==="prompt"?Tt:"",ee.mcpPrompt))})},[k,ee]),ne=m.useMemo(()=>{if(!se.length)return[];const Ae=new Map;return se.forEach((ke,Ie)=>{const qe=ke.correlationId||`__group-${Ie}`;Ae.has(qe)||Ae.set(qe,{id:qe,operations:[],startMs:null,endMs:null,order:Ie});const nt=Ae.get(qe);nt.operations.push(ke);const{start:dt,end:wt}=Hb(ke,Ie);nt.startMs=nt.startMs===null?dt:Math.min(nt.startMs,dt),nt.endMs=nt.endMs===null?wt:Math.max(nt.endMs,wt)}),Array.from(Ae.values()).map(ke=>({...ke,label:hje(ke.operations),subtitle:gje(ke.operations),durationMs:ke.startMs!=null&&ke.endMs!=null?Math.max(ke.endMs-ke.startMs,0):0,maxStatus:bje(ke.operations)})).sort((ke,Ie)=>(ke.startMs??0)-(Ie.startMs??0))},[se]),K=h||u,ge=()=>{C(),O()};m.useEffect(()=>{if(!ne.length){I(new Set);return}I(new Set(ne.map(Ae=>Ae.id)))},[g,ne]),m.useEffect(()=>{if(!se.length||w&&se.some(ke=>tp(ke.id)===w))return;const Ae=tp(se[0]?.id);Ae&&Ae!==w&&E(Ae)},[se,w,E]);const ye=m.useMemo(()=>w&&se.find(Ae=>tp(Ae.id)===w)||null,[se,w]);m.useEffect(()=>{if(!w||!ne.length)return;const Ae=ne.find(ke=>ke.operations.some(Ie=>tp(Ie.id)===w));Ae&&!M.has(Ae.id)&&I(ke=>{const Ie=new Set(ke);return Ie.add(Ae.id),Ie})},[w,ne,M]),m.useEffect(()=>{if(!ye)return;const Ae=setTimeout(()=>{U.current&&X.current!==w&&(U.current.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),X.current=w)},150);return()=>clearTimeout(Ae)},[w,ye,M]);const me=m.useCallback(()=>{z.current=!1},[]),Se=m.useCallback(Ae=>{if(!z.current||!W.current)return;const ke=W.current.getBoundingClientRect();if(!ke.width)return;const Ie=(Ae.clientX-ke.left)/ke.width*100,qe=Math.min(Math.max(Ie,k9),w9);R(String(qe))},[R]);m.useEffect(()=>(window.addEventListener("mousemove",Se),window.addEventListener("mouseup",me),()=>{window.removeEventListener("mousemove",Se),window.removeEventListener("mouseup",me)}),[Se,me]),m.useEffect(()=>{if(!G){H(null);return}if(V&&!Object.keys(ee||{}).length)try{const Ae=JSON.parse(V);if(!Ae||typeof Ae!="object")return;re(Ae)}catch{}},[G,V,ee,H]),m.useEffect(()=>{if(G){if(!Object.entries(ee||{}).some(([,Ae])=>Array.isArray(Ae)?Ae.length>0:Ae!==""&&Ae!==null&&Ae!==void 0)){H(null);return}H(JSON.stringify(ee))}},[ee,G,H]);const Re=m.useMemo(()=>{let Ae=0,ke=0,Ie=0,qe=!1,nt=!1,dt=!1;return se.forEach(wt=>{if(!wt)return;const pt=(wt?.meta?.mcp||wt?.raw?.meta?.mcp||wt?.meta?.trace?.mcp||wt?.raw?.meta?.trace?.mcp)?.tokens;if(!pt)return;const Le=$l(pt.request),Tt=$l(pt.response),er=$l(pt.total);Le!==null&&(qe=!0,Ae+=Le),Tt!==null&&(nt=!0,ke+=Tt),er!==null?(dt=!0,Ie+=er):(Le!==null||Tt!==null)&&(dt=!0,Ie+=(Le??0)+(Tt??0))}),qe||nt||dt?{request:qe?Ae:null,response:nt?ke:null,total:dt?Ie:null}:null},[se]),Te=se.length,Je=Object.entries(ee||{}).reduce((Ae,[ke,Ie])=>Array.isArray(Ie)?Ie.length>0?Ae+1:Ae:Ie?Ae+1:Ae,0),rt=m.useMemo(()=>{const Ae=new Set;return k.forEach(ke=>{ke?.status!=null&&Ae.add(String(ke.status))}),Array.from(Ae).sort((ke,Ie)=>ke.localeCompare(Ie))},[k]),De=m.useMemo(()=>{const Ae=new Set;return k.forEach(ke=>{ke?.method&&Ae.add(ke.method.toUpperCase())}),Array.from(Ae).sort((ke,Ie)=>ke.localeCompare(Ie))},[k]),ut=m.useMemo(()=>{const Ae=new Set;return k.forEach(ke=>{Array.isArray(ke.tags)&&ke.tags.forEach(Ie=>Ae.add(Ie.display))}),Array.from(Ae).sort((ke,Ie)=>ke.localeCompare(Ie))},[k]),ct=m.useMemo(()=>{const Ae=new Set;return k.forEach(ke=>{ke?.host&&Ae.add(ke.host)}),Array.from(Ae).sort((ke,Ie)=>ke.localeCompare(Ie))},[k]),Nt=m.useMemo(()=>{const Ae=new Set,ke=new Set,Ie=new Set,qe=new Set,nt=new Set;k.forEach(wt=>{const pt=wt?.raw?.meta||{},Le=pt.trace||{},Tt=pt.mcp||Le.mcp||wt?.meta?.mcp;Tt&&(Tt.category&&qe.add(Tt.category),Tt.method&&nt.add(Tt.method),Tt.name&&Tt.category==="tool"&&Ae.add(Tt.name),Tt.name&&Tt.category==="resource"&&ke.add(Tt.name),Tt.name&&Tt.category==="prompt"&&Ie.add(Tt.name))});const dt=wt=>Array.from(wt).sort((pt,Le)=>pt.localeCompare(Le));return{tool:dt(Ae),resource:dt(ke),prompt:dt(Ie),category:dt(qe),method:dt(nt)}},[k]),yt=m.useMemo(()=>k.some(Ae=>{if(!Ae)return!1;const ke=Ae.meta||{},Ie=Ae.raw?.meta||{},qe=ke.trace||Ie.trace||{},nt=ke.mcp||Ie.mcp||qe.mcp,dt=ke.protocol==="mcp"||Ie.protocol==="mcp";return!!(nt&&Object.keys(nt).length||dt)}),[k]);if(!s||u&&!l.length||d&&!l.length||!l.length)return i.jsx(uje,{supportsTraces:s,isTraceListLoading:u,traceList:l,traceListError:d});const ft=Ae=>{I(ke=>{const Ie=new Set(ke);return Ie.has(Ae)?Ie.delete(Ae):Ie.add(Ae),Ie})},Ct=Ae=>{if(!Ae)return!1;const ke=Ae.meta||{},Ie=Ae.raw?.meta||{},qe=ke.trace||Ie.trace||{},nt=ke.mcp||Ie.mcp||qe.mcp,dt=ke.protocol==="mcp"||Ie.protocol==="mcp";return!!(nt&&Object.keys(nt).length||dt)};return i.jsxs("div",{ref:W,className:"flex flex-col gap-4 lg:flex-row",style:{maxHeight:mw},children:[i.jsxs(Dt,{id:"trace-timeline",className:"w-full overflow-y-auto rounded-tremor-small border border-tremor-border p-6 dark:border-dark-tremor-border",style:{width:`${$}%`,maxHeight:mw},children:[i.jsx(lje,{operationCount:Te,onRefresh:ge,isRefreshing:K,hasError:!!f,traceSources:y,onOpenFilters:()=>ae(!0),activeFiltersCount:Je}),i.jsxs("div",{className:"mt-6 flex flex-col gap-4 min-w-0",children:[i.jsx(cje,{traceSummary:b,traceDurationMs:v,traceDetailMeta:p,traceListMeta:c,isTraceDetailLoading:h,operationCount:Te,tokenTotals:Re}),f?i.jsxs(Dt,{className:"rounded-tremor-small border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:["Failed to load trace details: ",f.message||"Unexpected error"]}):null,i.jsx("div",{className:"space-y-3",children:ne.length?ne.map(Ae=>i.jsx(aje,{group:Ae,isExpanded:M.has(Ae.id),onToggle:ft,selectedOperationId:w,onOperationSelect:E,timelineWidth:$,baseStart:pe,baseDuration:te,selectedOperationRef:U},Ae.id)):i.jsx(Dt,{className:"rounded-tremor-small border border-dashed border-tremor-border p-6 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"No operations recorded for this trace."})})]}),i.jsx(Aj,{meta:p,currentPage:D,onPageChange:A,alwaysShow:!1})]}),i.jsx(oje,{onMouseDown:()=>{z.current=!0},onDoubleClick:()=>{R(String(fw))}}),i.jsx(Dt,{id:"trace-details",className:"w-full overflow-y-auto rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",style:{width:`${100-$}%`,maxHeight:mw},children:Ct(ye)?i.jsx(rje,{operation:ye,isLoading:h}):i.jsx(YR,{operation:ye,isLoading:h})}),i.jsx(dje,{isOpen:Y,onClose:()=>ae(!1),filters:ee,setFilters:re,statusOptions:rt,methodOptions:De,tagOptions:ut,mcpToolOptions:Nt.tool,mcpResourceOptions:Nt.resource,mcpPromptOptions:Nt.prompt,mcpCategoryOptions:Nt.category,mcpMethodOptions:Nt.method,hostOptions:ct,hasMcpOperations:yt,persistFilters:G,onPersistFiltersChange:Ae=>F(Ae?"true":"false")})]})}const yje=e=>{if(!e)return null;try{return new URL(e)}catch{return null}},xje=e=>{if(!e)return null;const t=e.raw?.data||{},r=t.request||{},n=t.response||{},a=t.timing||{},o=(e.method||r.method||"GET").toUpperCase(),s=e.status_code??n.status??null,l=e.duration??a.duration,c=Number.isFinite(Number(l))?Number(l):null,u=e.time||r.timestamp||null,d=yje(r.url||e.url||""),f=r.path||e.path||d?.pathname||r.url||e.url||"/",p=r.server||d?.host||"",h=Array.isArray(t.meta?.tags)?t.meta.tags:Array.isArray(e.tags)?e.tags:[],g=_f(h);return{id:e.id,operationId:e.operation_id,method:o,status:s,duration:c,timestamp:u,timestampMs:u?Date.parse(u):null,path:f,host:p,url:r.url||e.url||"",request:r,response:n,timing:a,tags:g,raw:t}},vje=e=>{if(!e)return"Unknown";const t=new Date(e);return Number.isNaN(t.getTime())?"Unknown":t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})},j9=(e,t)=>`${e} ${t}`,Md="trace",Hi="trace-timeline",tl=["endpoint","list","table","timeline",Md,Hi],kje=tl.indexOf(Md),zi=tl.indexOf(Hi),JR=(e,t)=>e&&tl.includes(e)?tl.indexOf(e):t&&zi>=0?zi:0,wje=()=>{if(typeof window>"u")return{tabIndex:0,traceId:null,traceOperationId:null};const{slug:e,params:t}=cs();if(e!=="insights")return{tabIndex:0,traceId:null,traceOperationId:null};const r=t.trace||null,n=t.traceOp||t.operation||null,a=t.view;return{tabIndex:JR(a,r),traceId:r,traceOperationId:n}};function jje(){const{client:e}=fr(),t=m.useMemo(()=>wje(),[]),[r,n]=m.useState(null),[a,o]=m.useState(null),[s,l]=m.useState(!1),[c,u]=m.useState({}),[d,f]=m.useState(t.tabIndex),[p,h]=m.useState({traceId:t.traceId,operationId:t.traceOperationId}),g=Dn(()=>Fr.db.events.orderBy("time").last(),[],null)||null,b=Dn(()=>Fr.db.events.orderBy("time").reverse().toArray(),[],[])||[],y=m.useMemo(()=>b.map(M=>xje(M)).filter(Boolean).sort((M,I)=>(I.timestampMs||0)-(M.timestampMs||0)),[b]);m.useEffect(()=>{if(typeof window>"u")return;const M=()=>{const{slug:I,params:T}=cs();if(I!=="insights")return;const R=T.trace||null,L=T.traceOp||T.operation||null,F=T.view,V=JR(F,R);f(V),h(H=>H.traceId===R&&H.operationId===L?H:{traceId:R,operationId:L})};return M(),window.addEventListener("hashchange",M),()=>window.removeEventListener("hashchange",M)},[]);const v=(M={})=>{if(typeof window>"u")return;const{slug:I,params:T}=cs(),R=I==="insights"?{...T}:{};Object.entries(M).forEach(([H,$])=>{$==null||$===""?delete R[H]:R[H]=String($)});const L=new URLSearchParams;Object.entries(R).forEach(([H,$])=>{$!=null&&L.set(H,$)});const F=L.toString(),V=`#insights${F?`?${F}`:""}`;typeof window<"u"&&window.location.hash!==V&&window.history.replaceState(null,"",V)},k=M=>{f(M);const I=tl[M]||"endpoint",T=I===Md||I===Hi;v({view:I,trace:T?p.traceId??null:null,traceOp:T?p.operationId??null:null})},N=M=>{const I=p.traceId===M,T={traceId:M||null,operationId:I?p.operationId:null};if(p.traceId===T.traceId&&p.operationId===T.operationId)return;h(T);const R=tl[d],L=R===Md||R===Hi;v({view:L?R:Hi,trace:T.traceId??null,traceOp:T.operationId??null}),!L&&zi>=0&&f(zi)},w=M=>{const I={traceId:p.traceId,operationId:M||null};if(p.traceId===I.traceId&&p.operationId===I.operationId)return;h(I);const T=tl[d],R=T===Md||T===Hi;v({view:R?T:Hi,trace:I.traceId??null,traceOp:I.operationId??null}),!R&&zi>=0&&f(zi)};m.useEffect(()=>{if(!e?.operations?.summarize)return;let M=!0;return(async()=>{l(!0),o(null);try{const I=await e.operations.summarize();M&&(n(I),u({}))}catch(I){M&&o(I)}finally{M&&l(!1)}})(),()=>{M=!1}},[e,g?.id]),m.useEffect(()=>{if(!e?.operations?.getSeries||!r?.summaries?.length)return;let M=!0;return(async()=>{const I=r.summaries;await Promise.all(I.map(async T=>{const R=j9(T.method,T.path);u(L=>({...L,[R]:{...L[R]||{},loading:!0,error:null}}));try{const L=await e.operations.getSeries({method:T.method,path:T.path,seriesLimit:k2e});if(!M)return;u(F=>({...F,[R]:{...F[R]||{},loading:!1,data:L,error:null}}))}catch(L){if(!M)return;u(F=>({...F,[R]:{...F[R]||{},loading:!1,error:L}}))}}))})(),()=>{M=!1}},[e,r?.summaries]);const E=m.useMemo(()=>r?.summaries?.length?r.summaries.map(M=>{const I=j9(M.method,M.path),T=c[I]||{},R=(T.data?.series||[]).slice(-40).map(L=>({time:vje(L.ts),duration:L.duration??0,baseline:L.baseline??M.averageDuration??0}));return{...M,key:I,chartData:R,seriesLoading:T.loading??!1,seriesError:T.error||null}}):[],[r,c]),C=r?.totals?.totalOperations??y.length,O=r?.totals?.totalEndpoints,D=r?.totals?.errorCount,A=r?.totals?.averageDuration;return i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Dt,{className:"rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",children:[i.jsxs(Lb,{justifyContent:"between",alignItems:"start",children:[i.jsxs("div",{children:[i.jsx(Rn,{className:"text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Insights Explorer"}),i.jsx(gt,{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:"Get more insights into the operations by grouping them by endpoint, as time line view, as rich cards, or in a compact table"})]}),i.jsx(Bt,{color:a?"rose":"slate",children:s?"Loading…":`Total ${C}`})]}),i.jsxs(Rb,{numItemsSm:1,numItemsLg:3,className:"mt-6 gap-4",children:[i.jsxs(Dt,{className:"bg-gray-50 shadow-none dark:bg-dark-tremor-background",children:[i.jsx(gt,{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:"Unique endpoints"}),i.jsx(Qo,{className:"mt-2",children:O})]}),i.jsxs(Dt,{className:"bg-gray-50 shadow-none dark:bg-dark-tremor-background",children:[i.jsx(gt,{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:"Errors"}),i.jsxs(Qo,{className:"mt-2",children:[D," ",i.jsxs("span",{className:"text-base font-normal text-tremor-content-subtle dark:text-dark-tremor-content",children:["(",C?Math.round(D/C*100):0,"%)"]})]})]}),i.jsxs(Dt,{className:"bg-gray-50 shadow-none dark:bg-dark-tremor-background",children:[i.jsx(gt,{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:"Avg duration"}),i.jsx(Qo,{className:"mt-2",children:A?`${A}ms`:"N/A"})]})]})]}),i.jsxs(Zc,{index:d,onIndexChange:k,children:[i.jsxs(Gc,{children:[i.jsx(ca,{children:"Endpoint mode"}),i.jsx(ca,{children:"List mode"}),i.jsx(ca,{children:"Table mode"}),i.jsx(ca,{children:"Timeline mode"}),i.jsx(ca,{children:"Trace explorer"}),i.jsx(ca,{children:"Trace timeline"})]}),i.jsxs(Jc,{className:"mt-6 space-y-6",children:[i.jsx(ua,{children:i.jsx(y2e,{endpoints:E,loading:s,error:a})}),i.jsx(ua,{children:i.jsx(w2e,{operations:y})}),i.jsx(ua,{children:i.jsx(L2e,{operations:y})}),i.jsx(ua,{children:i.jsx(V2e,{operations:y})}),i.jsx(ua,{children:i.jsx(tje,{operations:y,initialTraceId:p.traceId,initialOperationId:p.operationId,onTraceChange:N,onOperationChange:w,isActive:d===kje})}),i.jsx(ua,{children:i.jsx(ZR,{operations:y,initialTraceId:p.traceId,initialOperationId:p.operationId,onTraceChange:N,onOperationChange:w,isActive:d===zi})})]})]})]})}const N9=(e,t)=>{let r="#traces";return e&&(r+=`/${encodeURIComponent(e)}`,t&&(r+=`/${encodeURIComponent(t)}`)),r},E9=e=>{e&&(window.location.hash===e?window.dispatchEvent(new HashChangeEvent("hashchange")):window.location.hash=e)};function Nje({route:e}){const t=e?.operationId||e?.params?.trace||null,r=e?.subTab||e?.params?.operation||null,[n,a]=m.useState(t),[o,s]=m.useState(r),[l,c]=m.useState(r||null),u=m.useRef(n),d=m.useRef(o),f=m.useRef(l),p=m.useRef({traceId:t,operationId:r});m.useEffect(()=>{u.current=n},[n]),m.useEffect(()=>{d.current=o},[o]),m.useEffect(()=>{f.current=l},[l]),m.useEffect(()=>{const k=p.current;if(t!==k.traceId||r!==k.operationId){p.current={traceId:t,operationId:r},a(t||null),s(r||null),c(r||null);return}t!==n&&a(t||null),r!==o&&s(r||null),!f.current&&r&&c(r)},[t,r,n,o]);const h=m.useCallback(k=>{if(!k)return;a(k),k!==u.current&&(c(null),s(null),d.current=null);const N=N9(k,k===u.current?d.current:null);E9(N)},[]),g=m.useCallback(k=>{if(!k)return;s(k);const N=u.current;if(!N)return;f.current||c(k);const w=N9(N,k);E9(w)},[]),b=m.useMemo(()=>n||"—",[n]),y=f.current||r||d.current||"",v=y?`#inspectr/${y}/request`:"#inspectr";return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("a",{href:v,className:"inline-flex items-center gap-2 rounded-md border border-slate-300 px-3 py-1.5 text-sm font-medium text-slate-700 transition hover:border-slate-400 hover:bg-slate-100 dark:border-slate-700 dark:text-slate-200 dark:hover:border-slate-600 dark:hover:bg-dark-tremor-background-subtle",children:[i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4","aria-hidden":!0,children:i.jsx("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06l4-4a.75.75 0 0 1 1.06 1.06L4.56 9H16a.75.75 0 0 1 0 1.5H4.56l2.65 2.65a.75.75 0 0 1 0 1.06Z",clipRule:"evenodd"})}),"Back to request"]}),i.jsxs("div",{className:"text-xs font-medium uppercase tracking-wide text-slate-600 dark:text-slate-300",children:["Trace ",b]})]}),i.jsx(ZR,{initialTraceId:t,initialOperationId:r,onTraceChange:h,onOperationChange:g,isActive:!0})]})}function Eje(){const{client:e,setToast:t}=fr(),[r,n]=m.useState(!1),[a,o]=m.useState(""),[s,l]=m.useState(null),[c,u]=m.useState(!1),[d,f]=m.useState(null);m.useEffect(()=>{const b=new URLSearchParams(window.location.search).get("openapi");b&&(o(b),n(!0),p())},[]);const p=async()=>{try{const b=await e.service.getHealth();f(b.mode)}catch{}},h=()=>{c||n(!1)},g=async()=>{u(!0),l(null);try{await e.mock.launch(a),t({message:"Mock launched",subMessage:"Serving mock from OpenAPI spec",type:"success"}),n(!1)}catch(b){console.error("Mock launch error",b),l(b.message||"Failed to launch mock"),u(!1)}};return r?i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:h}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-3xl w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Configure Inspectr Mock"}),i.jsx("button",{onClick:h,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",disabled:c,children:"×"})]}),d==="proxy"?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"mb-2 text-sm text-gray-700",children:"Inspectr lets you serve a mock API based on an OpenAPI spec."}),i.jsxs("div",{className:"mb-6 p-4 bg-yellow-50 border border-yellow-200 rounded",children:[i.jsxs("p",{className:"text-sm font-medium text-yellow-800",children:["Inspectr is currently running in ",i.jsx("strong",{children:"proxy"})," mode."]}),i.jsx("p",{className:"mt-2 text-sm text-yellow-800",children:"To switch to mock mode, restart Inspectr with:"}),i.jsxs("pre",{className:"mt-2 p-2 bg-gray-100 text-xs rounded overflow-auto",children:['npx @inspectr/inspectr --mock-backend="',a,'"']}),i.jsx(on,{textToCopy:`npx @inspectr/inspectr --mock-backend=${a}`})]}),i.jsx("p",{className:"mb-4 text-sm text-gray-700",children:"Follow the instructions above to start Inspectr as Mock server from the OpenAPI spec."}),i.jsx("div",{className:"flex justify-end",children:i.jsx("button",{onClick:h,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Cancel"})})]}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"mb-2 text-sm text-gray-700",children:"Inspectr lets you serve a mock API based on an OpenAPI spec."}),i.jsxs("p",{className:"mb-4 text-sm text-gray-700",children:["You’re about to use ",i.jsx("b",{children:a})," for mock responses. This will replace any existing mock configuration or catch-mode settings."]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{htmlFor:"openapi-url",className:"block text-sm font-medium text-gray-700",children:"OpenAPI Spec URL"}),i.jsx("input",{id:"openapi-url",type:"url",value:a,onChange:b=>{o(b.target.value),l(null)},placeholder:"https://example.com/openapi.yaml",disabled:c,className:"mt-1 block w-full rounded-md shadow-sm sm:text-sm "+(s?"border-red-500 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300 focus:ring-blue-500 focus:border-blue-500")}),s&&i.jsx("p",{className:"mt-2 text-sm text-red-600",children:s})]}),i.jsxs("div",{className:"flex justify-end space-x-3",children:[i.jsx("button",{onClick:h,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",disabled:c,children:"Cancel"}),i.jsx("button",{onClick:g,className:`px-4 py-2 text-white rounded ${c?"bg-gray-400 cursor-not-allowed":"bg-red-600 hover:bg-red-700"}`,disabled:c,children:c?"Loading…":"Confirm"})]})]})]})]}):null}function Sje({open:e,onClose:t}){const{client:r,setToast:n}=fr(),[a,o]=m.useState("json"),[s,l]=m.useState(!1),[c,u]=m.useState("preset"),[d,f]=m.useState(""),[p,h]=m.useState(""),[g,b]=m.useState(""),[y,v]=dr("exportJsonIndent","false"),[k]=vo("feat_export_openapi"),[N]=vo("feat_export_postman"),[w,E]=m.useState("");m.useEffect(()=>{e||E("")},[e]);const C=async()=>{l(!0),E("");try{const O={format:a};a==="json"&&(O.indent=y==="true"),c==="preset"?d&&(O.preset=d):(p&&(O.since=new Date(p).toISOString()),g&&(O.until=new Date(g).toISOString()));const D=await r.operations.export(O),A=new Date,M=V=>V.toString().padStart(2,"0"),I=`${A.getFullYear()}-${M(A.getMonth()+1)}-${M(A.getDate())}-${M(A.getHours())}${M(A.getMinutes())}`,T=URL.createObjectURL(D),R=document.createElement("a");R.href=T;const L=a==="phar"?"phar":"json",F=a==="json"?"":`_${a}`;R.download=`inspectr_operations_${I}${F}.${L}`,R.click(),URL.revokeObjectURL(T),t&&t()}catch(O){console.error("Export failed",O);const D=O?.message||"Export failed";E(D),n({message:"Export failed",subMessage:D,type:"error"})}finally{l(!1)}};return e?i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Export Operations"}),i.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",children:"×"})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Time Range"}),i.jsxs("div",{className:"mt-1 flex items-center space-x-4",children:[i.jsxs("label",{className:"inline-flex items-center",children:[i.jsx("input",{type:"radio",name:"timeOption",value:"preset",checked:c==="preset",onChange:()=>u("preset"),className:"form-radio"}),i.jsx("span",{className:"ml-2",children:"Preset"})]}),i.jsxs("label",{className:"inline-flex items-center",children:[i.jsx("input",{type:"radio",name:"timeOption",value:"custom",checked:c==="custom",onChange:()=>u("custom"),className:"form-radio"}),i.jsx("span",{className:"ml-2",children:"Custom"})]})]}),c==="preset"&&i.jsxs("select",{value:d,onChange:O=>f(O.target.value),className:"mt-2 block w-full rounded-md border-gray-300 shadow-sm sm:text-sm",children:[i.jsx("option",{value:"",children:"-- Select preset --"}),i.jsx("option",{value:"1h",children:"Last hour"}),i.jsx("option",{value:"24h",children:"Last 24 hours"}),i.jsx("option",{value:"7d",children:"Last 7 days"}),i.jsx("option",{value:"30d",children:"Last 30 days"}),i.jsx("option",{value:"start",children:"Since start Inspectr"}),i.jsx("option",{value:"first",children:"Since first operation"})]}),c==="custom"&&i.jsxs("div",{className:"mt-2 space-y-2",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm",children:"Since"}),i.jsx("input",{type:"datetime-local",value:p,onChange:O=>h(O.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm sm:text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm",children:"Until (optional)"}),i.jsx("input",{type:"datetime-local",value:g,onChange:O=>b(O.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm sm:text-sm"})]})]})]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Format"}),i.jsxs("select",{value:a,onChange:O=>o(O.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm",children:[i.jsx("option",{value:"json",children:"JSON"}),k&&i.jsx("option",{value:"openapi",children:"OpenAPI (preview)"}),N&&i.jsx("option",{value:"postman",children:"Postman (preview)"})]})]}),a==="json"&&i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"JSON formatting"}),i.jsxs("div",{className:"mt-1 flex items-center space-x-4",children:[i.jsxs("label",{className:"inline-flex items-center",children:[i.jsx("input",{type:"radio",name:"jsonIndentOperations",value:"false",checked:y==="false",onChange:()=>v("false"),className:"form-radio"}),i.jsx("span",{className:"ml-2",children:"Minified"})]}),i.jsxs("label",{className:"inline-flex items-center",children:[i.jsx("input",{type:"radio",name:"jsonIndentOperations",value:"true",checked:y==="true",onChange:()=>v("true"),className:"form-radio"}),i.jsx("span",{className:"ml-2",children:"Pretty-printed"})]})]}),i.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Minified is the default but you can export as a pretty-printed JSON."})]}),w&&i.jsx("p",{className:"mb-4 text-sm text-red-600",role:"alert",children:w}),i.jsxs("div",{className:"flex justify-end space-x-3",children:[i.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Cancel"}),i.jsx("button",{onClick:C,disabled:s,className:`px-4 py-2 text-white rounded ${s?"bg-gray-400":"bg-blue-600 hover:bg-blue-700"}`,children:s?"Exporting…":"Export"})]})]})]}):null}function Cje({open:e,onClose:t,onContinue:r,onCancelRecording:n,startTime:a}){const{client:o,setToast:s}=fr(),[l,c]=m.useState("json"),[u,d]=m.useState(!1),[f,p]=dr("exportJsonIndent","false"),[h]=vo("feat_export_openapi"),[g]=vo("feat_export_postman"),[b,y]=m.useState(""),v=Dn(async()=>a?await Fr.db.events.where("time").above(a).count():0,[a]);m.useEffect(()=>{e||y("")},[e]);const k=async()=>{d(!0),y("");try{const N={since:a,format:l};l==="json"&&(N.indent=f==="true");const w=await o.operations.export(N),E=new Date,C=T=>T.toString().padStart(2,"0"),O=`${E.getFullYear()}-${C(E.getMonth()+1)}-${C(E.getDate())}-${C(E.getHours())}${C(E.getMinutes())}`,D=URL.createObjectURL(w),A=document.createElement("a");A.href=D;const M=l==="phar"?"phar":"json",I=l==="json"?"":`_${l}`;A.download=`inspectr_operations_${O}${I}.${M}`,A.click(),URL.revokeObjectURL(D),t&&t()}catch(N){console.error("Export failed",N);const w=N?.message||"Export failed";y(w),s({message:"Export failed",subMessage:w,type:"error"})}finally{d(!1)}};return e?i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Export Recording"}),i.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",children:"×"})]}),i.jsxs("p",{className:"text-sm mb-4",children:[v," operations recorded since ",new Date(a).toLocaleString()]}),i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Format"}),i.jsxs("select",{value:l,onChange:N=>c(N.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm",children:[i.jsx("option",{value:"json",children:"JSON"}),h&&i.jsx("option",{value:"openapi",children:"OpenAPI (preview)"}),g&&i.jsx("option",{value:"postman",children:"Postman (preview)"})]})]}),l==="json"&&i.jsxs("div",{className:"mb-4",children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"JSON formatting"}),i.jsxs("div",{className:"mt-1 flex items-center space-x-4",children:[i.jsxs("label",{className:"inline-flex items-center",children:[i.jsx("input",{type:"radio",name:"jsonIndentRecords",value:"false",checked:f==="false",onChange:()=>p("false"),className:"form-radio"}),i.jsx("span",{className:"ml-2",children:"Minified"})]}),i.jsxs("label",{className:"inline-flex items-center",children:[i.jsx("input",{type:"radio",name:"jsonIndentRecords",value:"true",checked:f==="true",onChange:()=>p("true"),className:"form-radio"}),i.jsx("span",{className:"ml-2",children:"Pretty-printed"})]})]}),i.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Minified is the default but you can export as a pretty-printed JSON."})]}),b&&i.jsx("p",{className:"-mt-2 mb-4 text-sm text-red-600",role:"alert",children:b}),i.jsxs("div",{className:"flex justify-end space-x-3",children:[i.jsx("button",{onClick:r,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Continue Recording"}),i.jsx("button",{onClick:n,className:"px-4 py-2 bg-orange-200 text-gray-700 rounded hover:bg-orange-300",children:"Cancel Recording"}),i.jsx("button",{onClick:k,disabled:u,className:`px-4 py-2 text-white rounded ${u?"bg-gray-400":"bg-blue-600 hover:bg-blue-700"}`,children:u?"Exporting…":"Export"})]})]})]}):null}function Oje({open:e,onClose:t}){const{client:r,setToast:n}=fr(),[a,o]=m.useState(null),[s,l]=m.useState(!1),c=async()=>{if(a){l(!0);try{await r.operations.import(a),n({message:"Import completed",type:"success"}),t&&t()}catch(u){console.error("Import failed",u),n({message:"Import failed",subMessage:u.message,type:"error"})}finally{l(!1)}}};return e?i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),i.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6 z-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Import Operations"}),i.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",children:"×"})]}),i.jsx("div",{className:"mb-4",children:i.jsx("input",{type:"file",accept:".json",onChange:u=>o(u.target.files[0]),className:"mt-1 block w-full text-sm"})}),i.jsxs("div",{className:"flex justify-end space-x-3",children:[i.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Cancel"}),i.jsx("button",{onClick:c,disabled:!a||s,className:`px-4 py-2 text-white rounded ${!a||s?"bg-gray-400":"bg-blue-600 hover:bg-blue-700"}`,children:s?"Importing…":"Import"})]})]})]}):null}const Pje="inspectrVersionMuteUntil",S9=4320*60*1e3;function Aje(){const{client:e}=fr(),[t,r]=dr(Pje,""),[n,a]=m.useState(!1),[o,s]=m.useState(!1),[l,c]=m.useState(null);m.useEffect(()=>{if(!e?.service?.getVersion)return;const g=t?Date.parse(t):0;if(g&&g>Date.now()){s(!1),a(!1);return}let b=!1;return e.service.getVersion().then(y=>{if(!b)if(c(y),y?.update_available)s(!0);else{s(!1),a(!1);const v=new Date(Date.now()+S9).toISOString();r(v)}}).catch(y=>{console.error("Version check failed",y)}),()=>{b=!0}},[e,t]);const u=()=>{a(!1)},d=()=>{const g=new Date(Date.now()+S9).toISOString();r(g),s(!1),u()},f=()=>{d()},p=()=>{window.open("https://inspectr.dev/docs/getting-started/upgrade","_blank","noopener,noreferrer")},h=()=>{l?.update_available&&a(!0)};return o?i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",onClick:h,className:"inline-flex max-[1040px]:hidden items-center gap-2 rounded-md border border-amber-400 bg-amber-500 px-1 py-1 text-xs font-semibold text-white shadow-sm transition hover:bg-amber-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 focus-visible:ring-offset-2",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-white/90 shadow-sm"}),i.jsx("span",{className:"uppercase tracking-wide",children:"Update available"})]}),i.jsx(Mw,{show:n,as:m.Fragment,children:i.jsx(Cm,{as:"div",className:"pointer-events-none fixed inset-x-0 top-6 z-40 flex justify-center px-4 sm:top-8",onClose:u,children:i.jsx(Mw.Child,{as:m.Fragment,enter:"ease-out duration-200",enterFrom:"opacity-0 -translate-y-2",enterTo:"opacity-100 translate-y-0",leave:"ease-in duration-150",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-2",children:i.jsx(Cm.Panel,{className:"pointer-events-auto relative w-full max-w-4xl overflow-hidden rounded-2xl border border-gray-200 bg-white p-6 shadow-xl dark:border-gray-800 dark:bg-gray-900",children:i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:gap-6",children:[i.jsxs("div",{className:"flex items-start gap-3 sm:min-w-[220px]",children:[i.jsx("span",{className:"mt-1 flex h-12 w-12 items-center justify-center rounded-full bg-emerald-100 text-emerald-700 shadow-sm dark:bg-emerald-900/30 dark:text-emerald-200",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M19.4668 8.69379L19.7134 8.12811C20.1529 7.11947 20.9445 6.31641 21.9323 5.87708L22.6919 5.53922C23.1027 5.35653 23.1027 4.75881 22.6919 4.57612L21.9748 4.25714C20.9616 3.80651 20.1558 2.97373 19.7238 1.93083L19.4706 1.31953C19.2942 0.893489 18.7058 0.893489 18.5293 1.31953L18.2761 1.93083C17.8442 2.97373 17.0384 3.80651 16.0252 4.25714L15.3081 4.57612C14.8973 4.75881 14.8973 5.35653 15.3081 5.53922L16.0677 5.87708C17.0555 6.31641 17.8471 7.11947 18.2866 8.12811L18.5331 8.69379C18.7136 9.10792 19.2864 9.10792 19.4668 8.69379ZM5 6C4.68525 6 4.38886 6.14819 4.2 6.4L1.2 10.4C0.913337 10.7822 0.937093 11.3138 1.25671 11.669L10.2567 21.669C10.4464 21.8797 10.7165 22 11 22C11.2835 22 11.5537 21.8797 11.7433 21.669L20.7433 11.669L19.2567 10.331L11 19.5052L3.29335 10.9422L5.5 8H14V6H5Z"})})}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(Cm.Title,{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"New Inspectr version available"}),i.jsx(Cm.Description,{className:"text-sm text-gray-700 dark:text-gray-200",children:l?.latest_version?`Update to ${l.latest_version} to get the latest improvements.`:"A new build is ready for you. Grab the latest to get new features."}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Current: ",l?.current_version||"Unknown"," • Latest:"," ",l?.latest_version||"—"]})]})]}),i.jsxs("div",{className:"flex flex-1 flex-wrap items-center justify-end gap-3",children:[i.jsx("button",{type:"button",onClick:f,className:"inline-flex items-center justify-center rounded-full px-4 py-2 text-sm font-semibold text-gray-700 transition hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:text-gray-200 dark:hover:bg-gray-800",children:"Skip"}),i.jsx("button",{type:"button",onClick:p,className:"inline-flex items-center justify-center rounded-full bg-emerald-600 px-4 py-2 text-sm font-semibold text-white shadow-sm transition hover:bg-emerald-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:bg-emerald-500 dark:hover:bg-emerald-400",children:"Update"})]})]})})})})})]}):null}function C9({children:e,onClick:t,disabled:r=!1,className:n=""}){return i.jsx("button",{type:"button",disabled:r,onClick:t,className:`px-2 py-1 text-cyan-500 hover:text-white border border-cyan-500 hover:bg-cyan-500 rounded text-xs ${n}`,children:e})}function Mje({isRecording:e,recordCount:t,disabled:r=!1,onClick:n}){const a=`px-2 py-1 rounded text-xs flex items-center border border-green-500 ${e?"text-white bg-green-500":"text-green-500 hover:text-white hover:bg-green-500"}`;return i.jsxs("div",{className:"relative",children:[i.jsxs("button",{disabled:r,className:a,onClick:n,children:[i.jsx("span",{className:`mr-1 block w-2 h-2 ${e?"bg-red-600 animate-pulse":"bg-red-600 rounded-full"}`}),i.jsx("span",{className:"max-[880px]:inline hidden",children:e?"Stop":"Start"}),i.jsx("span",{className:"max-[880px]:hidden",children:e?"Stop Recording":"Start Recording"})]}),e&&t>0&&i.jsx("span",{className:"absolute -top-3 -right-2",children:i.jsx(IR,{count:t})})]})}function QR(...e){return e.filter(Boolean).join(" ")}const Tje=[{name:"Request History",slug:"inspectr",component:jR},{name:"Trace Explorer",slug:"traces",component:Nje,hidden:!0},{name:"Insights",slug:"insights",component:jje},{name:"Statistics",slug:"statistics",component:Vke},{name:"Usage",slug:"usage",component:Pke},{name:"Rules",slug:"rules",component:Kwe},{name:"Settings",slug:"settings",component:h2e}],_je=e=>i.jsx("svg",{fill:"currentColor",height:"24",width:"24",viewBox:"0 0 1648 1648",xmlns:"http://www.w3.org/2000/svg",...e,children:i.jsx("path",{d:"m610 216.654c-66.158 4.092-126.119 35.849-164.917 87.346-8.408 11.16-13.344 19.191-19.983 32.513-12.431 24.946-19.521 50.434-22.11 79.487-1.665 18.687-.854 826.238.841 837.939 7.867 54.284 32.465 101.134 70.706 134.667 16.297 14.291 32.283 24.657 53.963 34.991 16.889 8.05 34.568 13.468 60.5 18.541 9.019 1.764 52.201 1.795 61.5.044 26.487-4.989 43.97-10.341 61-18.675 15.131-7.406 21.53-11.135 60.5-35.267 20.813-12.887 23.095-14.298 29.5-18.24l13-8 13-8c6.901-4.247 12.593-7.767 29.54-18.271 5.796-3.593 12.771-7.863 15.5-9.49 2.728-1.626 8.56-5.19 12.96-7.921 4.4-2.73 72.575-44.711 151.5-93.29s150.925-92.918 160-98.531c9.075-5.612 24.15-14.936 33.5-20.719s23.075-14.234 30.5-18.78c85.169-52.142 120.029-73.942 130.014-81.304 40.974-30.211 68.344-69.764 81.788-118.194 13.864-49.94 8.549-104.847-14.809-153-16.836-34.708-41.252-62.432-74.993-85.154-4.125-2.778-17.625-11.26-30-18.849s-27-16.594-32.5-20.009c-5.5-3.416-109.45-67.427-231-142.246-306.386-188.593-335.221-206.352-350-215.553-30.562-19.028-59.301-29.911-90-34.083-11.697-1.59-30.408-2.514-39.5-1.952m-10.5 77.269c-39.541 6.402-76.013 29.73-97.661 62.467-13.001 19.66-19.718 38.39-22.802 63.584-1.472 12.028-1.434 802.191.04 818.026 1.861 19.998 6.142 35.48 14.415 52.133 17.942 36.114 53.025 64.18 91.508 73.203 3.575.839 8.975 2.118 12 2.844 8.221 1.973 40.343 1.613 49.971-.56 32.301-7.289 65.233-26.686 94.817-55.849 15.26-15.042 22.884-24.803 33.571-42.979 13.939-23.706 20.949-43.36 27.745-77.792 1.004-5.086 1.428-50 1.949-206.5.465-139.686 1.001-201.809 1.777-206 .611-3.3 1.608-9.15 2.217-13 1.672-10.583 4.039-21.117 7.191-32 8.179-28.247 20.714-55.13 37.188-79.751 24.262-36.262 53.189-63.572 93.074-87.872 4.95-3.016 12.825-7.435 17.5-9.82s8.95-4.668 9.5-5.074c3.565-2.63 34.688-13.266 52.465-17.93 6.2-1.627 11.49-3.174 11.754-3.439 1.003-1.002-1.016-2.602-10.967-8.689-5.639-3.449-16.552-10.172-24.252-14.94-13.435-8.319-31.76-19.604-58.5-36.029-6.875-4.222-16.1-9.911-20.5-12.641-7.667-4.758-73.088-45.103-122.5-75.546-75.227-46.348-108.509-66.591-116.5-70.86-9.422-5.033-25.23-10.76-37.043-13.419-7.967-1.794-40.076-2.843-47.957-1.567m473.5 305.564c-5.775.685-11.625 1.491-13 1.792-1.375.3-5.2 1.088-8.5 1.749-7.914 1.587-27.103 7.461-36.5 11.174-38.797 15.33-75.171 44.925-98.829 80.41-11.24 16.86-21.329 38.407-26.167 55.888-2.443 8.825-3.85 14.608-4.866 20-.621 3.3-1.653 8.475-2.292 11.5-.846 4.008-1.345 59.624-1.837 205-.618 182.331-.824 200.361-2.399 209.5-1.629 9.459-4.196 22.506-6.744 34.279-.628 2.903-.881 5.54-.561 5.859.596.596 455.986-279.084 472.195-290.001 17.547-11.819 36.335-33.412 46.291-53.203 3.956-7.863 9.527-23.924 11.597-33.434 4.848-22.272 3.572-48.26-3.506-71.387-6.907-22.572-18.055-40.93-35.316-58.158-12.705-12.681-16.829-15.485-79.066-53.756-7.15-4.397-15.7-9.654-19-11.684-3.3-2.029-8.925-5.504-12.5-7.722-53.826-33.397-67.199-40.611-88.616-47.8-29.343-9.85-61.599-13.421-90.384-10.006m-1066.25 1048.256c3.988.189 10.513.189 14.5 0 3.988-.19.725-.346-7.25-.346s-11.238.156-7.25.346",fillRule:"evenodd"})});function Yje(){const[e]=vo("feat_insights_display",!1,!0);vo("feat_export_mcp_server",!1,!0),vo("feat_rules_ui",!1,!0);const t=m.useMemo(()=>{let w=Tje;return e!==!0&&(w=w.filter(E=>E.slug!=="insights")),w},[e]),[r,n]=m.useState(()=>t[0]),{route:a,currentNav:o,handleTabClick:s}=bke(t),l=m.useMemo(()=>t.filter(w=>!w.hidden),[t]),c=o.component,[u,d]=m.useState(!1),[f,p]=m.useState(!1),[h,g]=dr("recordStart",null),[b,y]=m.useState(()=>!!h);m.useEffect(()=>{y(!!h)},[h]),m.useEffect(()=>{o&&n(o)},[o]);const[v,k]=m.useState(!1),N=Dn(async()=>!b||!h?0:await Fr.db.events.where("time").above(h).count(),[b,h]);return i.jsxs(Pq,{children:[i.jsx(Eje,{}),i.jsxs("div",{className:"flex flex-col min-h-screen",children:[i.jsx("div",{className:"border-b border-tremor-border dark:border-dark-tremor-border relative h-full bg-gray-50 dark:bg-dark-tremor-background-subtle",children:i.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:i.jsxs("div",{className:"flex h-16 items-center gap-6",children:[i.jsx("div",{className:"hidden shrink-0 sm:flex sm:items-center",children:i.jsx("a",{href:"/",className:"p-1.5",children:i.jsx(_je,{className:"size-4 shrink-0 w-8 h-8 text-tremor-content-strong dark:text-dark-tremor-content-strong","aria-hidden":!0})})}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("nav",{className:"flex-1 min-w-0 flex space-x-6 overflow-x-auto overflow-y-visible","aria-label":"Tabs",children:l.map(w=>w.slug==="inspectr"?i.jsx(Dje,{navItem:w,isActive:w.slug===o.slug,onClick:()=>s(w),isCurrent:w.name===r.name},w.slug):i.jsx("button",{onClick:()=>s(w),className:QR(w.slug===o.slug?"dark:text-tremor-dark-brand border-tremor-brand text-tremor-brand":"border-transparent text-tremor-content-emphasis hover:border-tremor-content-subtle hover:text-tremor-content-strong dark:text-dark-tremor-content-emphasis hover:dark:border-dark-tremor-content-subtle hover:dark:text-dark-tremor-content-strong","inline-flex items-center whitespace-nowrap border-b-2 px-2 py-2 text-tremor-default font-medium"),"aria-current":w.name===r.name?"page":void 0,children:w.name},w.slug))})}),i.jsxs("div",{className:"ml-auto flex items-center space-x-2",children:[i.jsx(Aje,{}),i.jsx(C9,{onClick:()=>d(!0),children:"Export"}),i.jsx(C9,{onClick:()=>p(!0),children:"Import"}),i.jsx(Mje,{isRecording:b,recordCount:N,disabled:v,onClick:()=>{b?N>0?k(!0):(y(!1),g(null)):(g(new Date().toISOString()),y(!0))}})]})]})})}),i.jsx("div",{className:"flex-grow overflow-auto",children:["insights","statistics","settings","usage","rules","traces"].includes(o.slug)?i.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-950",children:i.jsx(c,{route:a},o.slug)}):i.jsx(jR,{route:a},"inspectr")}),i.jsx(Ije,{}),i.jsx(Sje,{open:u,onClose:()=>d(!1)}),i.jsx(Oje,{open:f,onClose:()=>p(!1)}),i.jsx(Cje,{open:v,onContinue:()=>{k(!1)},onCancelRecording:()=>{k(!1),y(!1),g(null)},onClose:()=>k(!1),startTime:h})]})]})}const Ije=()=>{const{toast:e,setToast:t}=fr();return e?i.jsx(rp,{message:e.message,subMessage:e.subMessage,type:e.type,onClose:()=>t(null)}):null},Dje=({navItem:e,isActive:t,onClick:r,isCurrent:n})=>{const{connectionStatus:a}=fr(),[o,s]=dr("inspectrLastSeenAt",null),[l,c]=m.useState(()=>$i(o)),u=Dn(async()=>{try{return(await Fr.db.events.orderBy("time").last())?.time||null}catch{return null}},[]),d=Dn(async()=>{if(!l)return 0;try{return await Fr.db.events.where("time").above(l).count()}catch{return 0}},[l]);m.useEffect(()=>{const h=$i(o);c(g=>{const b=$i(g);return h?t||!b?h:wj(h,b)?b:h:b?g:null})},[o,t]);const f=a==="connected"?"green":a==="disconnected"?"red":"orange",p=()=>{const h=$i(u)||new Date().toISOString();s(g=>{const b=$i(g);return!b||wj(h,b)?h:b}),c(h),r&&r()};return i.jsx("button",{onClick:p,className:QR(t?"dark:text-tremor-dark-brand border-tremor-brand text-tremor-brand":"border-transparent text-tremor-content-emphasis hover:border-tremor-content-subtle hover:text-tremor-content-strong dark:text-dark-tremor-content-emphasis hover:dark:border-dark-tremor-content-subtle hover:dark:text-dark-tremor-content-strong","inline-flex items-center whitespace-nowrap border-b-2 px-2 py-2 pr-2 text-tremor-default font-medium relative"),"aria-current":n?"page":void 0,children:i.jsxs("span",{className:"relative inline-flex items-center",children:[i.jsx("span",{children:e.name}),!t&&d>0&&i.jsx("span",{className:"absolute -top-2 right-0 translate-x-full pointer-events-none",children:i.jsx(IR,{count:d,color:f})})]})},e.slug)};export{Yje as Workspace};