arize-phoenix 12.3.0__py3-none-any.whl → 12.5.0__py3-none-any.whl

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.

Potentially problematic release.


This version of arize-phoenix might be problematic. Click here for more details.

Files changed (73) hide show
  1. {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.5.0.dist-info}/METADATA +2 -1
  2. {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.5.0.dist-info}/RECORD +73 -72
  3. phoenix/auth.py +27 -2
  4. phoenix/config.py +302 -53
  5. phoenix/db/README.md +546 -28
  6. phoenix/db/models.py +3 -3
  7. phoenix/server/api/auth.py +9 -0
  8. phoenix/server/api/context.py +2 -0
  9. phoenix/server/api/dataloaders/__init__.py +2 -0
  10. phoenix/server/api/dataloaders/dataset_dataset_splits.py +52 -0
  11. phoenix/server/api/input_types/ProjectSessionSort.py +158 -1
  12. phoenix/server/api/input_types/SpanSort.py +2 -1
  13. phoenix/server/api/input_types/UserRoleInput.py +1 -0
  14. phoenix/server/api/mutations/annotation_config_mutations.py +6 -6
  15. phoenix/server/api/mutations/api_key_mutations.py +13 -5
  16. phoenix/server/api/mutations/chat_mutations.py +3 -3
  17. phoenix/server/api/mutations/dataset_label_mutations.py +6 -6
  18. phoenix/server/api/mutations/dataset_mutations.py +8 -8
  19. phoenix/server/api/mutations/dataset_split_mutations.py +7 -7
  20. phoenix/server/api/mutations/experiment_mutations.py +2 -2
  21. phoenix/server/api/mutations/export_events_mutations.py +3 -3
  22. phoenix/server/api/mutations/model_mutations.py +4 -4
  23. phoenix/server/api/mutations/project_mutations.py +4 -4
  24. phoenix/server/api/mutations/project_session_annotations_mutations.py +4 -4
  25. phoenix/server/api/mutations/project_trace_retention_policy_mutations.py +8 -4
  26. phoenix/server/api/mutations/prompt_label_mutations.py +7 -7
  27. phoenix/server/api/mutations/prompt_mutations.py +7 -7
  28. phoenix/server/api/mutations/prompt_version_tag_mutations.py +3 -3
  29. phoenix/server/api/mutations/span_annotations_mutations.py +5 -5
  30. phoenix/server/api/mutations/trace_annotations_mutations.py +4 -4
  31. phoenix/server/api/mutations/trace_mutations.py +3 -3
  32. phoenix/server/api/mutations/user_mutations.py +8 -5
  33. phoenix/server/api/routers/auth.py +23 -32
  34. phoenix/server/api/routers/oauth2.py +213 -24
  35. phoenix/server/api/routers/v1/__init__.py +18 -4
  36. phoenix/server/api/routers/v1/annotation_configs.py +19 -30
  37. phoenix/server/api/routers/v1/annotations.py +21 -22
  38. phoenix/server/api/routers/v1/datasets.py +86 -64
  39. phoenix/server/api/routers/v1/documents.py +2 -3
  40. phoenix/server/api/routers/v1/evaluations.py +12 -24
  41. phoenix/server/api/routers/v1/experiment_evaluations.py +2 -3
  42. phoenix/server/api/routers/v1/experiment_runs.py +16 -11
  43. phoenix/server/api/routers/v1/experiments.py +57 -22
  44. phoenix/server/api/routers/v1/projects.py +16 -50
  45. phoenix/server/api/routers/v1/prompts.py +30 -31
  46. phoenix/server/api/routers/v1/sessions.py +2 -5
  47. phoenix/server/api/routers/v1/spans.py +35 -26
  48. phoenix/server/api/routers/v1/traces.py +11 -19
  49. phoenix/server/api/routers/v1/users.py +13 -29
  50. phoenix/server/api/routers/v1/utils.py +3 -7
  51. phoenix/server/api/subscriptions.py +3 -3
  52. phoenix/server/api/types/Dataset.py +95 -6
  53. phoenix/server/api/types/Project.py +24 -68
  54. phoenix/server/app.py +3 -2
  55. phoenix/server/authorization.py +5 -4
  56. phoenix/server/bearer_auth.py +13 -5
  57. phoenix/server/jwt_store.py +8 -6
  58. phoenix/server/oauth2.py +172 -5
  59. phoenix/server/static/.vite/manifest.json +39 -39
  60. phoenix/server/static/assets/{components-Bs8eJEpU.js → components-cwdYEs7B.js} +501 -404
  61. phoenix/server/static/assets/{index-C6WEu5UP.js → index-Dc0vD1Rn.js} +1 -1
  62. phoenix/server/static/assets/{pages-D-n2pkoG.js → pages-BDkB3a_a.js} +577 -533
  63. phoenix/server/static/assets/{vendor-D2eEI-6h.js → vendor-Ce6GTAin.js} +1 -1
  64. phoenix/server/static/assets/{vendor-arizeai-kfOei7nf.js → vendor-arizeai-CSF-1Kc5.js} +1 -1
  65. phoenix/server/static/assets/{vendor-codemirror-1bq_t1Ec.js → vendor-codemirror-Bv8J_7an.js} +3 -3
  66. phoenix/server/static/assets/{vendor-recharts-DQ4xfrf4.js → vendor-recharts-DcLgzI7g.js} +1 -1
  67. phoenix/server/static/assets/{vendor-shiki-GGmcIQxA.js → vendor-shiki-BF8rh_7m.js} +1 -1
  68. phoenix/trace/attributes.py +80 -13
  69. phoenix/version.py +1 -1
  70. {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.5.0.dist-info}/WHEEL +0 -0
  71. {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.5.0.dist-info}/entry_points.txt +0 -0
  72. {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.5.0.dist-info}/licenses/IP_NOTICE +0 -0
  73. {arize_phoenix-12.3.0.dist-info → arize_phoenix-12.5.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
1
- import{dZ as Ye,r as u,d_ as Gu,d$ as _,e0 as Vu,e1 as Hu,e2 as Xu,e3 as Yu,e4 as Uu,e5 as qu,e6 as Zu,e7 as No,e8 as Xn,e9 as Ju,ea as P,eb as br,ec as je,ed as Qu,ee as es,ef as ts,eg as rs,eh as as,ei as ns,ej as He,ek as de,l as Mo,el as Ut,em as is,en as os,eo as ls,ep as cs,eq as us,er as ss,es as ds,et as _o,eu as vs,ev as fs,ew as ps,ex as ms,ey as hs,ez as ys,eA as gs,eB as R,eC as kt,eD as Lo,eE as bs,eF as xs,eG as Ps,eH as Os,q as ws,eI as bt,eJ as Lt,eK as As,eL as Es,eM as js}from"./vendor-D2eEI-6h.js";var ee=e=>e===0?0:e>0?1:-1,ue=e=>typeof e=="number"&&e!=+e,tt=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,j=e=>(typeof e=="number"||e instanceof Number)&&!ue(e),Ae=e=>j(e)||typeof e=="string",Ss=0,Ue=e=>{var t=++Ss;return"".concat(e||"").concat(t)},ve=function(t,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!j(t)&&typeof t!="string")return a;var i;if(tt(t)){if(r==null)return a;var o=t.indexOf("%");i=r*parseFloat(t.slice(0,o))/100}else i=+t;return ue(i)&&(i=a),n&&r!=null&&i>r&&(i=r),i},Bo=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},a=0;a<t;a++)if(!r[e[a]])r[e[a]]=!0;else return!0;return!1},ge=(e,t)=>j(e)&&j(t)?r=>e+r*(t-e):()=>t;function st(e,t,r){return j(e)&&j(t)?e+r*(t-e):t}function Ko(e,t,r){if(!(!e||!e.length))return e.find(a=>a&&(typeof t=="function"?t(a):Ye(a,t))===r)}var z=e=>e===null||typeof e>"u",Bt=e=>z(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),Cs=["viewBox","children"],ks=["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"],Yn=["points","pathLength"],Xr={svg:Cs,polygon:Yn,polyline:Yn},Ta=["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"],$a=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(u.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var a={};return Object.keys(r).forEach(n=>{Ta.includes(n)&&(a[n]=(i=>r[n](r,i)))}),a},Is=(e,t,r)=>a=>(e(t,r,a),null),Kt=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var a=null;return Object.keys(e).forEach(n=>{var i=e[n];Ta.includes(n)&&typeof i=="function"&&(a||(a={}),a[n]=Is(i,t,r))}),a},Un=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",qn=null,Yr=null,Ro=e=>{if(e===qn&&Array.isArray(Yr))return Yr;var t=[];return u.Children.forEach(e,r=>{z(r)||(Gu.isFragment(r)?t=t.concat(Ro(r.props.children)):t.push(r))}),Yr=t,qn=e,t};function Rt(e,t){var r=[],a=[];return Array.isArray(t)?a=t.map(n=>Un(n)):a=[Un(t)],Ro(e).forEach(n=>{var i=Ye(n,"type.displayName")||Ye(n,"type.name");a.indexOf(i)!==-1&&r.push(n)}),r}var xr=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,Ds=(e,t,r,a)=>{var n,i=(n=a&&(Xr==null?void 0:Xr[a]))!==null&&n!==void 0?n:[];return t.startsWith("data-")||typeof e!="function"&&(a&&i.includes(t)||ks.includes(t))||r&&Ta.includes(t)},N=(e,t,r)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var a=e;if(u.isValidElement(e)&&(a=e.props),typeof a!="object"&&typeof a!="function")return null;var n={};return Object.keys(a).forEach(i=>{var o;Ds((o=a)===null||o===void 0?void 0:o[i],i,t,r)&&(n[i]=a[i])}),n},Ts=["children","width","height","viewBox","className","style","title","desc"];function Qr(){return Qr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},Qr.apply(null,arguments)}function $s(e,t){if(e==null)return{};var r,a,n=Ns(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ns(e,t){if(e==null)return{};var r={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;r[a]=e[a]}return r}var Na=u.forwardRef((e,t)=>{var{children:r,width:a,height:n,viewBox:i,className:o,style:l,title:c,desc:d}=e,s=$s(e,Ts),v=i||{width:a,height:n,x:0,y:0},f=_("recharts-surface",o);return u.createElement("svg",Qr({},N(s,!0,"svg"),{className:f,width:a,height:n,style:l,viewBox:"".concat(v.x," ").concat(v.y," ").concat(v.width," ").concat(v.height),ref:t}),u.createElement("title",null,c),u.createElement("desc",null,d),r)}),Ms=["children","className"];function ea(){return ea=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ea.apply(null,arguments)}function _s(e,t){if(e==null)return{};var r,a,n=Ls(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ls(e,t){if(e==null)return{};var r={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;r[a]=e[a]}return r}var V=u.forwardRef((e,t)=>{var{children:r,className:a}=e,n=_s(e,Ms),i=_("recharts-layer",a);return u.createElement("g",ea({className:i},N(n,!0),{ref:t}),r)}),zo=u.createContext(null),Bs=()=>u.useContext(zo),Ks=["type","size","sizeType"];function ta(){return ta=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ta.apply(null,arguments)}function Zn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function Jn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zn(Object(r),!0).forEach(function(a){Rs(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zn(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function Rs(e,t,r){return(t=zs(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zs(e){var t=Ws(e,"string");return typeof t=="symbol"?t:t+""}function Ws(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fs(e,t){if(e==null)return{};var r,a,n=Gs(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gs(e,t){if(e==null)return{};var r={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;r[a]=e[a]}return r}var Wo={symbolCircle:No,symbolCross:Zu,symbolDiamond:qu,symbolSquare:Uu,symbolStar:Yu,symbolTriangle:Xu,symbolWye:Hu},Vs=Math.PI/180,Hs=e=>{var t="symbol".concat(Bt(e));return Wo[t]||No},Xs=(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 a=18*Vs;return 1.25*e*e*(Math.tan(a)-Math.tan(a*2)*Math.tan(a)**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}},Ys=(e,t)=>{Wo["symbol".concat(Bt(e))]=t},Ma=e=>{var{type:t="circle",size:r=64,sizeType:a="area"}=e,n=Fs(e,Ks),i=Jn(Jn({},n),{},{type:t,size:r,sizeType:a}),o=()=>{var v=Hs(t),f=Vu().type(v).size(Xs(r,a,t));return f()},{className:l,cx:c,cy:d}=i,s=N(i,!0);return c===+c&&d===+d&&r===+r?u.createElement("path",ta({},s,{className:_("recharts-symbols",l),transform:"translate(".concat(c,", ").concat(d,")"),d:o()})):null};Ma.registerSymbol=Ys;function ra(){return ra=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ra.apply(null,arguments)}function Qn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function Us(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Qn(Object(r),!0).forEach(function(a){_a(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qn(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function _a(e,t,r){return(t=qs(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qs(e){var t=Zs(e,"string");return typeof t=="symbol"?t:t+""}function Zs(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Pe=32;class La extends u.PureComponent{renderIcon(t,r){var{inactiveColor:a}=this.props,n=Pe/2,i=Pe/6,o=Pe/3,l=t.inactive?a:t.color,c=r??t.type;if(c==="none")return null;if(c==="plainline")return u.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:t.payload.strokeDasharray,x1:0,y1:n,x2:Pe,y2:n,className:"recharts-legend-icon"});if(c==="line")return u.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(n,"h").concat(o,`
1
+ import{dZ as Ye,r as u,d_ as Gu,d$ as _,e0 as Vu,e1 as Hu,e2 as Xu,e3 as Yu,e4 as Uu,e5 as qu,e6 as Zu,e7 as No,e8 as Xn,e9 as Ju,ea as P,eb as br,ec as je,ed as Qu,ee as es,ef as ts,eg as rs,eh as as,ei as ns,ej as He,ek as de,l as Mo,el as Ut,em as is,en as os,eo as ls,ep as cs,eq as us,er as ss,es as ds,et as _o,eu as vs,ev as fs,ew as ps,ex as ms,ey as hs,ez as ys,eA as gs,eB as R,eC as kt,eD as Lo,eE as bs,eF as xs,eG as Ps,eH as Os,q as ws,eI as bt,eJ as Lt,eK as As,eL as Es,eM as js}from"./vendor-Ce6GTAin.js";var ee=e=>e===0?0:e>0?1:-1,ue=e=>typeof e=="number"&&e!=+e,tt=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,j=e=>(typeof e=="number"||e instanceof Number)&&!ue(e),Ae=e=>j(e)||typeof e=="string",Ss=0,Ue=e=>{var t=++Ss;return"".concat(e||"").concat(t)},ve=function(t,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!j(t)&&typeof t!="string")return a;var i;if(tt(t)){if(r==null)return a;var o=t.indexOf("%");i=r*parseFloat(t.slice(0,o))/100}else i=+t;return ue(i)&&(i=a),n&&r!=null&&i>r&&(i=r),i},Bo=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},a=0;a<t;a++)if(!r[e[a]])r[e[a]]=!0;else return!0;return!1},ge=(e,t)=>j(e)&&j(t)?r=>e+r*(t-e):()=>t;function st(e,t,r){return j(e)&&j(t)?e+r*(t-e):t}function Ko(e,t,r){if(!(!e||!e.length))return e.find(a=>a&&(typeof t=="function"?t(a):Ye(a,t))===r)}var z=e=>e===null||typeof e>"u",Bt=e=>z(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),Cs=["viewBox","children"],ks=["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"],Yn=["points","pathLength"],Xr={svg:Cs,polygon:Yn,polyline:Yn},Ta=["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"],$a=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(u.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var a={};return Object.keys(r).forEach(n=>{Ta.includes(n)&&(a[n]=(i=>r[n](r,i)))}),a},Is=(e,t,r)=>a=>(e(t,r,a),null),Kt=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var a=null;return Object.keys(e).forEach(n=>{var i=e[n];Ta.includes(n)&&typeof i=="function"&&(a||(a={}),a[n]=Is(i,t,r))}),a},Un=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",qn=null,Yr=null,Ro=e=>{if(e===qn&&Array.isArray(Yr))return Yr;var t=[];return u.Children.forEach(e,r=>{z(r)||(Gu.isFragment(r)?t=t.concat(Ro(r.props.children)):t.push(r))}),Yr=t,qn=e,t};function Rt(e,t){var r=[],a=[];return Array.isArray(t)?a=t.map(n=>Un(n)):a=[Un(t)],Ro(e).forEach(n=>{var i=Ye(n,"type.displayName")||Ye(n,"type.name");a.indexOf(i)!==-1&&r.push(n)}),r}var xr=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,Ds=(e,t,r,a)=>{var n,i=(n=a&&(Xr==null?void 0:Xr[a]))!==null&&n!==void 0?n:[];return t.startsWith("data-")||typeof e!="function"&&(a&&i.includes(t)||ks.includes(t))||r&&Ta.includes(t)},N=(e,t,r)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var a=e;if(u.isValidElement(e)&&(a=e.props),typeof a!="object"&&typeof a!="function")return null;var n={};return Object.keys(a).forEach(i=>{var o;Ds((o=a)===null||o===void 0?void 0:o[i],i,t,r)&&(n[i]=a[i])}),n},Ts=["children","width","height","viewBox","className","style","title","desc"];function Qr(){return Qr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},Qr.apply(null,arguments)}function $s(e,t){if(e==null)return{};var r,a,n=Ns(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ns(e,t){if(e==null)return{};var r={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;r[a]=e[a]}return r}var Na=u.forwardRef((e,t)=>{var{children:r,width:a,height:n,viewBox:i,className:o,style:l,title:c,desc:d}=e,s=$s(e,Ts),v=i||{width:a,height:n,x:0,y:0},f=_("recharts-surface",o);return u.createElement("svg",Qr({},N(s,!0,"svg"),{className:f,width:a,height:n,style:l,viewBox:"".concat(v.x," ").concat(v.y," ").concat(v.width," ").concat(v.height),ref:t}),u.createElement("title",null,c),u.createElement("desc",null,d),r)}),Ms=["children","className"];function ea(){return ea=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ea.apply(null,arguments)}function _s(e,t){if(e==null)return{};var r,a,n=Ls(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ls(e,t){if(e==null)return{};var r={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;r[a]=e[a]}return r}var V=u.forwardRef((e,t)=>{var{children:r,className:a}=e,n=_s(e,Ms),i=_("recharts-layer",a);return u.createElement("g",ea({className:i},N(n,!0),{ref:t}),r)}),zo=u.createContext(null),Bs=()=>u.useContext(zo),Ks=["type","size","sizeType"];function ta(){return ta=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ta.apply(null,arguments)}function Zn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function Jn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zn(Object(r),!0).forEach(function(a){Rs(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zn(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function Rs(e,t,r){return(t=zs(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zs(e){var t=Ws(e,"string");return typeof t=="symbol"?t:t+""}function Ws(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fs(e,t){if(e==null)return{};var r,a,n=Gs(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gs(e,t){if(e==null)return{};var r={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;r[a]=e[a]}return r}var Wo={symbolCircle:No,symbolCross:Zu,symbolDiamond:qu,symbolSquare:Uu,symbolStar:Yu,symbolTriangle:Xu,symbolWye:Hu},Vs=Math.PI/180,Hs=e=>{var t="symbol".concat(Bt(e));return Wo[t]||No},Xs=(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 a=18*Vs;return 1.25*e*e*(Math.tan(a)-Math.tan(a*2)*Math.tan(a)**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}},Ys=(e,t)=>{Wo["symbol".concat(Bt(e))]=t},Ma=e=>{var{type:t="circle",size:r=64,sizeType:a="area"}=e,n=Fs(e,Ks),i=Jn(Jn({},n),{},{type:t,size:r,sizeType:a}),o=()=>{var v=Hs(t),f=Vu().type(v).size(Xs(r,a,t));return f()},{className:l,cx:c,cy:d}=i,s=N(i,!0);return c===+c&&d===+d&&r===+r?u.createElement("path",ta({},s,{className:_("recharts-symbols",l),transform:"translate(".concat(c,", ").concat(d,")"),d:o()})):null};Ma.registerSymbol=Ys;function ra(){return ra=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ra.apply(null,arguments)}function Qn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function Us(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Qn(Object(r),!0).forEach(function(a){_a(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qn(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function _a(e,t,r){return(t=qs(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qs(e){var t=Zs(e,"string");return typeof t=="symbol"?t:t+""}function Zs(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Pe=32;class La extends u.PureComponent{renderIcon(t,r){var{inactiveColor:a}=this.props,n=Pe/2,i=Pe/6,o=Pe/3,l=t.inactive?a:t.color,c=r??t.type;if(c==="none")return null;if(c==="plainline")return u.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:t.payload.strokeDasharray,x1:0,y1:n,x2:Pe,y2:n,className:"recharts-legend-icon"});if(c==="line")return u.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(n,"h").concat(o,`
2
2
  A`).concat(i,",").concat(i,",0,1,1,").concat(2*o,",").concat(n,`
3
3
  H`).concat(Pe,"M").concat(2*o,",").concat(n,`
4
4
  A`).concat(i,",").concat(i,",0,1,1,").concat(o,",").concat(n),className:"recharts-legend-icon"});if(c==="rect")return u.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(Pe/8,"h").concat(Pe,"v").concat(Pe*3/4,"h").concat(-Pe,"z"),className:"recharts-legend-icon"});if(u.isValidElement(t.legendIcon)){var d=Us({},t);return delete d.legendIcon,u.cloneElement(t.legendIcon,d)}return u.createElement(Ma,{fill:l,cx:n,cy:n,size:Pe,sizeType:"diameter",type:c})}renderItems(){var{payload:t,iconSize:r,layout:a,formatter:n,inactiveColor:i,iconType:o}=this.props,l={x:0,y:0,width:Pe,height:Pe},c={display:a==="horizontal"?"inline-block":"block",marginRight:10},d={display:"inline-block",verticalAlign:"middle",marginRight:4};return t.map((s,v)=>{var f=s.formatter||n,p=_({"recharts-legend-item":!0,["legend-item-".concat(v)]:!0,inactive:s.inactive});if(s.type==="none")return null;var m=s.inactive?i:s.color,h=f?f(s.value,s,v):s.value;return u.createElement("li",ra({className:p,style:c,key:"legend-item-".concat(v)},Kt(this.props,s,v)),u.createElement(Na,{width:r,height:r,viewBox:l,style:d,"aria-label":"".concat(h," legend icon")},this.renderIcon(s,o)),u.createElement("span",{className:"recharts-legend-item-text",style:{color:m}},h))})}render(){var{payload:t,layout:r,align:a}=this.props;if(!t||!t.length)return null;var n={padding:0,margin:0,textAlign:r==="horizontal"?a:"left"};return u.createElement("ul",{className:"recharts-default-legend",style:n},this.renderItems())}}_a(La,"displayName","Legend");_a(La,"defaultProps",{align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle"});function Fo(e,t,r){return t===!0?Xn(e,r):typeof t=="function"?Xn(e,t):e}var Ba=u.createContext(null),Js=e=>e,G=()=>{var e=u.useContext(Ba);return e?e.store.dispatch:Js},nr=()=>{},Qs=()=>nr,ed=(e,t)=>e===t;function k(e){var t=u.useContext(Ba);return Ju.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:Qs,t?t.store.getState:nr,t?t.store.getState:nr,t?e:nr,ed)}var Go=e=>e.legend.settings,td=e=>e.legend.size,rd=e=>e.legend.payload,ad=P([rd,Go],(e,t)=>{var{itemSorter:r}=t,a=e.flat(1);return r?br(a,r):a});function nd(){return k(ad)}var qt=1;function Vo(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=u.useState({height:0,left:0,top:0,width:0}),a=u.useCallback(n=>{if(n!=null){var i=n.getBoundingClientRect(),o={height:i.height,left:i.left,top:i.top,width:i.width};(Math.abs(o.height-t.height)>qt||Math.abs(o.left-t.left)>qt||Math.abs(o.top-t.top)>qt||Math.abs(o.width-t.width)>qt)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,a]}var id={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},Ho=je({name:"chartLayout",initialState:id,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top,e.margin.right=t.payload.right,e.margin.bottom=t.payload.bottom,e.margin.left=t.payload.left},setScale(e,t){e.scale=t.payload}}}),{setMargin:od,setLayout:ld,setChartSize:cd,setScale:ud}=Ho.actions,sd=Ho.reducer;function ei(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function ti(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ei(Object(r),!0).forEach(function(a){dd(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ei(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function dd(e,t,r){return(t=vd(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vd(e){var t=fd(e,"string");return typeof t=="symbol"?t:t+""}function fd(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ir=Math.PI/180,pd=e=>e*180/Math.PI,Z=(e,t,r,a)=>({x:e+Math.cos(-ir*a)*r,y:t+Math.sin(-ir*a)*r}),Xo=function(t,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(a.left||0)-(a.right||0)),Math.abs(r-(a.top||0)-(a.bottom||0)))/2},md=(e,t)=>{var{x:r,y:a}=e,{x:n,y:i}=t;return Math.sqrt((r-n)**2+(a-i)**2)},hd=(e,t)=>{var{x:r,y:a}=e,{cx:n,cy:i}=t,o=md({x:r,y:a},{x:n,y:i});if(o<=0)return{radius:o,angle:0};var l=(r-n)/o,c=Math.acos(l);return a>i&&(c=2*Math.PI-c),{radius:o,angle:pd(c),angleInRadian:c}},yd=e=>{var{startAngle:t,endAngle:r}=e,a=Math.floor(t/360),n=Math.floor(r/360),i=Math.min(a,n);return{startAngle:t-i*360,endAngle:r-i*360}},gd=(e,t)=>{var{startAngle:r,endAngle:a}=t,n=Math.floor(r/360),i=Math.floor(a/360),o=Math.min(n,i);return e+o*360},bd=(e,t)=>{var{x:r,y:a}=e,{radius:n,angle:i}=hd({x:r,y:a},t),{innerRadius:o,outerRadius:l}=t;if(n<o||n>l||n===0)return null;var{startAngle:c,endAngle:d}=yd(t),s=i,v;if(c<=d){for(;s>d;)s-=360;for(;s<c;)s+=360;v=s>=c&&s<=d}else{for(;s>c;)s-=360;for(;s<d;)s+=360;v=s>=d&&s<=c}return v?ti(ti({},t),{},{radius:n,angle:gd(s,t)}):null};function ri(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function we(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ri(Object(r),!0).forEach(function(a){xd(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ri(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function xd(e,t,r){return(t=Pd(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pd(e){var t=Od(e,"string");return typeof t=="symbol"?t:t+""}function Od(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function F(e,t,r){return z(e)||z(t)?r:Ae(t)?Ye(e,t,r):typeof t=="function"?t(e):r}var wd=(e,t,r,a,n)=>{var i,o=-1,l=(i=t==null?void 0:t.length)!==null&&i!==void 0?i:0;if(l<=1||e==null)return 0;if(a==="angleAxis"&&n!=null&&Math.abs(Math.abs(n[1]-n[0])-360)<=1e-6)for(var c=0;c<l;c++){var d=c>0?r[c-1].coordinate:r[l-1].coordinate,s=r[c].coordinate,v=c>=l-1?r[0].coordinate:r[c+1].coordinate,f=void 0;if(ee(s-d)!==ee(v-s)){var p=[];if(ee(v-s)===ee(n[1]-n[0])){f=v;var m=s+n[1]-n[0];p[0]=Math.min(m,(m+d)/2),p[1]=Math.max(m,(m+d)/2)}else{f=d;var h=v+n[1]-n[0];p[0]=Math.min(s,(h+s)/2),p[1]=Math.max(s,(h+s)/2)}var y=[Math.min(s,(f+s)/2),Math.max(s,(f+s)/2)];if(e>y[0]&&e<=y[1]||e>=p[0]&&e<=p[1]){({index:o}=r[c]);break}}else{var b=Math.min(d,v),g=Math.max(d,v);if(e>(b+s)/2&&e<=(g+s)/2){({index:o}=r[c]);break}}}else if(t){for(var x=0;x<l;x++)if(x===0&&e<=(t[x].coordinate+t[x+1].coordinate)/2||x>0&&x<l-1&&e>(t[x].coordinate+t[x-1].coordinate)/2&&e<=(t[x].coordinate+t[x+1].coordinate)/2||x===l-1&&e>(t[x].coordinate+t[x-1].coordinate)/2){({index:o}=t[x]);break}}return o},Ad=(e,t,r)=>{if(t&&r){var{width:a,height:n}=r,{align:i,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&i!=="center"&&j(e[i]))return we(we({},e),{},{[i]:e[i]+(a||0)});if((l==="horizontal"||l==="vertical"&&i==="center")&&o!=="middle"&&j(e[o]))return we(we({},e),{},{[o]:e[o]+(n||0)})}return e},Te=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",Yo=(e,t,r,a)=>{if(a)return e.map(l=>l.coordinate);var n,i,o=e.map(l=>(l.coordinate===t&&(n=!0),l.coordinate===r&&(i=!0),l.coordinate));return n||o.push(t),i||o.push(r),o},Uo=(e,t,r)=>{if(!e)return null;var{duplicateDomain:a,type:n,range:i,scale:o,realScaleType:l,isCategorical:c,categoricalDomain:d,tickCount:s,ticks:v,niceTicks:f,axisType:p}=e;if(!o)return null;var m=l==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,h=n==="category"&&o.bandwidth?o.bandwidth()/m:0;if(h=p==="angleAxis"&&i&&i.length>=2?ee(i[0]-i[1])*2*h:h,v||f){var y=(v||f||[]).map((b,g)=>{var x=a?a.indexOf(b):b;return{coordinate:o(x)+h,value:b,offset:h,index:g}});return y.filter(b=>!ue(b.coordinate))}return c&&d?d.map((b,g)=>({coordinate:o(b)+h,value:b,index:g,offset:h})):o.ticks&&s!=null?o.ticks(s).map((b,g)=>({coordinate:o(b)+h,value:b,offset:h,index:g})):o.domain().map((b,g)=>({coordinate:o(b)+h,value:a?a[b]:b,index:g,offset:h}))},ai=1e-4,Ed=e=>{var t=e.domain();if(!(!t||t.length<=2)){var r=t.length,a=e.range(),n=Math.min(a[0],a[1])-ai,i=Math.max(a[0],a[1])+ai,o=e(t[0]),l=e(t[r-1]);(o<n||o>i||l<n||l>i)&&e.domain([t[0],t[r-1]])}},jd=(e,t)=>{if(!t||t.length!==2||!j(t[0])||!j(t[1]))return e;var r=Math.min(t[0],t[1]),a=Math.max(t[0],t[1]),n=[e[0],e[1]];return(!j(e[0])||e[0]<r)&&(n[0]=r),(!j(e[1])||e[1]>a)&&(n[1]=a),n[0]>a&&(n[0]=a),n[1]<r&&(n[1]=r),n},Sd=e=>{var t=e.length;if(!(t<=0))for(var r=0,a=e[0].length;r<a;++r)for(var n=0,i=0,o=0;o<t;++o){var l=ue(e[o][r][1])?e[o][r][0]:e[o][r][1];l>=0?(e[o][r][0]=n,e[o][r][1]=n+l,n=e[o][r][1]):(e[o][r][0]=i,e[o][r][1]=i+l,i=e[o][r][1])}},Cd=e=>{var t=e.length;if(!(t<=0))for(var r=0,a=e[0].length;r<a;++r)for(var n=0,i=0;i<t;++i){var o=ue(e[i][r][1])?e[i][r][0]:e[i][r][1];o>=0?(e[i][r][0]=n,e[i][r][1]=n+o,n=e[i][r][1]):(e[i][r][0]=0,e[i][r][1]=0)}},kd={sign:Sd,expand:ns,none:as,silhouette:rs,wiggle:ts,positive:Cd},Id=(e,t,r)=>{var a=kd[r],n=Qu().keys(t).value((i,o)=>+F(i,o,0)).order(es).offset(a);return n(e)};function Ka(e){return e==null?void 0:String(e)}function or(e){var{axis:t,ticks:r,bandSize:a,entry:n,index:i,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!z(n[t.dataKey])){var l=Ko(r,"value",n[t.dataKey]);if(l)return l.coordinate+a/2}return r[i]?r[i].coordinate+a/2:null}var c=F(n,z(o)?t.dataKey:o);return z(c)?null:t.scale(c)}var ni=e=>{var{axis:t,ticks:r,offset:a,bandSize:n,entry:i,index:o}=e;if(t.type==="category")return r[o]?r[o].coordinate+a:null;var l=F(i,t.dataKey,t.scale.domain()[o]);return z(l)?null:t.scale(l)-n/2+a},Dd=e=>{var{numericAxis:t}=e,r=t.scale.domain();if(t.type==="number"){var a=Math.min(r[0],r[1]),n=Math.max(r[0],r[1]);return a<=0&&n>=0?0:n<0?n:a}return r[0]},Td=e=>{var t=e.flat(2).filter(j);return[Math.min(...t),Math.max(...t)]},$d=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],Nd=(e,t,r)=>{if(e!=null)return $d(Object.keys(e).reduce((a,n)=>{var i=e[n],{stackedData:o}=i,l=o.reduce((c,d)=>{var s=Td(d.slice(t,r+1));return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]);return[Math.min(l[0],a[0]),Math.max(l[1],a[1])]},[1/0,-1/0]))},ii=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,oi=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,it=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var a=e.scale.bandwidth();if(!r||a>0)return a}if(e&&t&&t.length>=2){for(var n=br(t,s=>s.coordinate),i=1/0,o=1,l=n.length;o<l;o++){var c=n[o],d=n[o-1];i=Math.min((c.coordinate||0)-(d.coordinate||0),i)}return i===1/0?0:i}return r?void 0:0};function li(e){var{tooltipEntrySettings:t,dataKey:r,payload:a,value:n,name:i}=e;return we(we({},t),{},{dataKey:r,payload:a,value:n,name:i})}function Je(e,t){if(e)return String(e);if(typeof t=="string")return t}function Md(e,t,r,a,n){if(r==="horizontal"||r==="vertical"){var i=e>=n.left&&e<=n.left+n.width&&t>=n.top&&t<=n.top+n.height;return i?{x:e,y:t}:null}return a?bd({x:e,y:t},a):null}var _d=(e,t,r,a)=>{var n=t.find(d=>d&&d.index===r);if(n){if(e==="horizontal")return{x:n.coordinate,y:a.y};if(e==="vertical")return{x:a.x,y:n.coordinate};if(e==="centric"){var i=n.coordinate,{radius:o}=a;return we(we(we({},a),Z(a.cx,a.cy,o,i)),{},{angle:i,radius:o})}var l=n.coordinate,{angle:c}=a;return we(we(we({},a),Z(a.cx,a.cy,l,c)),{},{angle:c,radius:l})}return{x:0,y:0}},Ld=(e,t)=>t==="horizontal"?e.x:t==="vertical"?e.y:t==="centric"?e.angle:e.radius,Ke=e=>e.layout.width,Re=e=>e.layout.height,Bd=e=>e.layout.scale,qo=e=>e.layout.margin,Ra=P(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),za=P(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Zo="data-recharts-item-index",Jo="data-recharts-item-data-key",Pr=60;function ci(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function Fe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ci(Object(r),!0).forEach(function(a){Kd(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ci(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function Kd(e,t,r){return(t=Rd(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rd(e){var t=zd(e,"string");return typeof t=="symbol"?t:t+""}function zd(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Wd=e=>e.brush.height,Q=P([Ke,Re,qo,Wd,Ra,za,Go,td],(e,t,r,a,n,i,o,l)=>{var c=i.reduce((m,h)=>{var{orientation:y}=h;if(!h.mirror&&!h.hide){var b=typeof h.width=="number"?h.width:Pr;return Fe(Fe({},m),{},{[y]:m[y]+b})}return m},{left:r.left||0,right:r.right||0}),d=n.reduce((m,h)=>{var{orientation:y}=h;return!h.mirror&&!h.hide?Fe(Fe({},m),{},{[y]:Ye(m,"".concat(y))+h.height}):m},{top:r.top||0,bottom:r.bottom||0}),s=Fe(Fe({},d),c),v=s.bottom;s.bottom+=a,s=Ad(s,o,l);var f=e-s.left-s.right,p=t-s.top-s.bottom;return Fe(Fe({brushBottom:v},s),{},{width:Math.max(f,0),height:Math.max(p,0)})}),Fd=P(Q,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Qo=P(Ke,Re,(e,t)=>({x:0,y:0,width:e,height:t})),Gd=u.createContext(null),ne=()=>u.useContext(Gd)!=null,Or=e=>e.brush,wr=P([Or,Q,qo],(e,t,r)=>({height:e.height,x:j(e.x)?e.x:t.left,y:j(e.y)?e.y:t.top+t.height+t.brushBottom-((r==null?void 0:r.bottom)||0),width:j(e.width)?e.width:t.width})),Ar=()=>{var e,t=ne(),r=k(Fd),a=k(wr),n=(e=k(Or))===null||e===void 0?void 0:e.padding;return!t||!a||!n?r:{width:a.width-n.left-n.right,height:a.height-n.top-n.bottom,x:n.left,y:n.top}},Vd={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},el=()=>{var e;return(e=k(Q))!==null&&e!==void 0?e:Vd},Wa=()=>k(Ke),Fa=()=>k(Re),Hd={top:0,right:0,bottom:0,left:0},Xd=()=>{var e;return(e=k(t=>t.layout.margin))!==null&&e!==void 0?e:Hd},K=e=>e.layout.layoutType,zt=()=>k(K),Yd={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},tl=je({name:"legend",initialState:Yd,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload(e,t){e.payload.push(de(t.payload))},removeLegendPayload(e,t){var r=He(e).payload.indexOf(de(t.payload));r>-1&&e.payload.splice(r,1)}}}),{setLegendSize:ui,setLegendSettings:Ud,addLegendPayload:rl,removeLegendPayload:al}=tl.actions,qd=tl.reducer,Zd=["contextPayload"];function aa(){return aa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},aa.apply(null,arguments)}function si(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function mt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?si(Object(r),!0).forEach(function(a){Ga(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):si(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function Ga(e,t,r){return(t=Jd(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jd(e){var t=Qd(e,"string");return typeof t=="symbol"?t:t+""}function Qd(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ev(e,t){if(e==null)return{};var r,a,n=tv(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tv(e,t){if(e==null)return{};var r={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;r[a]=e[a]}return r}function rv(e){return e.value}function av(e){var{contextPayload:t}=e,r=ev(e,Zd),a=Fo(t,e.payloadUniqBy,rv),n=mt(mt({},r),{},{payload:a});return u.isValidElement(e.content)?u.cloneElement(e.content,n):typeof e.content=="function"?u.createElement(e.content,n):u.createElement(La,n)}function nv(e,t,r,a,n,i){var{layout:o,align:l,verticalAlign:c}=t,d,s;return(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))&&(l==="center"&&o==="vertical"?d={left:((a||0)-i.width)/2}:d=l==="right"?{right:r&&r.right||0}:{left:r&&r.left||0}),(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))&&(c==="middle"?s={top:((n||0)-i.height)/2}:s=c==="bottom"?{bottom:r&&r.bottom||0}:{top:r&&r.top||0}),mt(mt({},d),s)}function iv(e){var t=G();return u.useEffect(()=>{t(Ud(e))},[t,e]),null}function ov(e){var t=G();return u.useEffect(()=>(t(ui(e)),()=>{t(ui({width:0,height:0}))}),[t,e]),null}function lv(e){var t=nd(),r=Bs(),a=Xd(),{width:n,height:i,wrapperStyle:o,portal:l}=e,[c,d]=Vo([t]),s=Wa(),v=Fa(),f=s-(a.left||0)-(a.right||0),p=Va.getWidthOrHeight(e.layout,i,n,f),m=l?o:mt(mt({position:"absolute",width:(p==null?void 0:p.width)||n||"auto",height:(p==null?void 0:p.height)||i||"auto"},nv(o,e,a,s,v,c)),o),h=l??r;if(h==null)return null;var y=u.createElement("div",{className:"recharts-legend-wrapper",style:m,ref:d},u.createElement(iv,{layout:e.layout,align:e.align,verticalAlign:e.verticalAlign,itemSorter:e.itemSorter}),u.createElement(ov,{width:c.width,height:c.height}),u.createElement(av,aa({},e,p,{margin:a,chartWidth:s,chartHeight:v,contextPayload:t})));return Mo.createPortal(y,h)}class Va extends u.PureComponent{static getWidthOrHeight(t,r,a,n){return t==="vertical"&&j(r)?{height:r}:t==="horizontal"?{width:a||n}:null}render(){return u.createElement(lv,this.props)}}Ga(Va,"displayName","Legend");Ga(Va,"defaultProps",{align:"center",iconSize:14,itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"});function na(){return na=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},na.apply(null,arguments)}function di(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function Ur(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?di(Object(r),!0).forEach(function(a){cv(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):di(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function cv(e,t,r){return(t=uv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uv(e){var t=sv(e,"string");return typeof t=="symbol"?t:t+""}function sv(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dv(e){return Array.isArray(e)&&Ae(e[0])&&Ae(e[1])?e.join(" ~ "):e}var vv=e=>{var{separator:t=" : ",contentStyle:r={},itemStyle:a={},labelStyle:n={},payload:i,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:d,label:s,labelFormatter:v,accessibilityLayer:f=!1}=e,p=()=>{if(i&&i.length){var w={padding:0,margin:0},A=(l?br(i,l):i).map((E,S)=>{if(E.type==="none")return null;var C=E.formatter||o||dv,{value:I,name:T}=E,D=I,M=T;if(C){var L=C(I,T,E,S,i);if(Array.isArray(L))[D,M]=L;else if(L!=null)D=L;else return null}var W=Ur({display:"block",paddingTop:4,paddingBottom:4,color:E.color||"#000"},a);return u.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(S),style:W},Ae(M)?u.createElement("span",{className:"recharts-tooltip-item-name"},M):null,Ae(M)?u.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,u.createElement("span",{className:"recharts-tooltip-item-value"},D),u.createElement("span",{className:"recharts-tooltip-item-unit"},E.unit||""))});return u.createElement("ul",{className:"recharts-tooltip-item-list",style:w},A)}return null},m=Ur({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},r),h=Ur({margin:0},n),y=!z(s),b=y?s:"",g=_("recharts-default-tooltip",c),x=_("recharts-tooltip-label",d);y&&v&&i!==void 0&&i!==null&&(b=v(s,i));var O=f?{role:"status","aria-live":"assertive"}:{};return u.createElement("div",na({className:g,style:m},O),u.createElement("p",{className:x,style:h},u.isValidElement(b)?b:"".concat(b)),p())},Et="recharts-tooltip-wrapper",fv={visibility:"hidden"};function pv(e){var{coordinate:t,translateX:r,translateY:a}=e;return _(Et,{["".concat(Et,"-right")]:j(r)&&t&&j(t.x)&&r>=t.x,["".concat(Et,"-left")]:j(r)&&t&&j(t.x)&&r<t.x,["".concat(Et,"-bottom")]:j(a)&&t&&j(t.y)&&a>=t.y,["".concat(Et,"-top")]:j(a)&&t&&j(t.y)&&a<t.y})}function vi(e){var{allowEscapeViewBox:t,coordinate:r,key:a,offsetTopLeft:n,position:i,reverseDirection:o,tooltipDimension:l,viewBox:c,viewBoxDimension:d}=e;if(i&&j(i[a]))return i[a];var s=r[a]-l-(n>0?n:0),v=r[a]+n;if(t[a])return o[a]?s:v;var f=c[a];if(f==null)return 0;if(o[a]){var p=s,m=f;return p<m?Math.max(v,f):Math.max(s,f)}if(d==null)return 0;var h=v+l,y=f+d;return h>y?Math.max(s,f):Math.max(v,f)}function mv(e){var{translateX:t,translateY:r,useTranslate3d:a}=e;return{transform:a?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function hv(e){var{allowEscapeViewBox:t,coordinate:r,offsetTopLeft:a,position:n,reverseDirection:i,tooltipBox:o,useTranslate3d:l,viewBox:c}=e,d,s,v;return o.height>0&&o.width>0&&r?(s=vi({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:a,position:n,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),v=vi({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:a,position:n,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=mv({translateX:s,translateY:v,useTranslate3d:l})):d=fv,{cssProperties:d,cssClasses:pv({translateX:s,translateY:v,coordinate:r})}}function fi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function Zt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fi(Object(r),!0).forEach(function(a){ia(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fi(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function ia(e,t,r){return(t=yv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yv(e){var t=gv(e,"string");return typeof t=="symbol"?t:t+""}function gv(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class bv extends u.PureComponent{constructor(){super(...arguments),ia(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),ia(this,"handleKeyDown",t=>{if(t.key==="Escape"){var r,a,n,i;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(r=(a=this.props.coordinate)===null||a===void 0?void 0:a.x)!==null&&r!==void 0?r:0,y:(n=(i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==null&&n!==void 0?n:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,r;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((r=this.props.coordinate)===null||r===void 0?void 0:r.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:r,animationDuration:a,animationEasing:n,children:i,coordinate:o,hasPayload:l,isAnimationActive:c,offset:d,position:s,reverseDirection:v,useTranslate3d:f,viewBox:p,wrapperStyle:m,lastBoundingBox:h,innerRef:y,hasPortalFromProps:b}=this.props,{cssClasses:g,cssProperties:x}=hv({allowEscapeViewBox:r,coordinate:o,offsetTopLeft:d,position:s,reverseDirection:v,tooltipBox:{height:h.height,width:h.width},useTranslate3d:f,viewBox:p}),O=b?{}:Zt(Zt({transition:c&&t?"transform ".concat(a,"ms ").concat(n):void 0},x),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),w=Zt(Zt({},O),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},m);return u.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:g,style:w,ref:y},i)}}var xv=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Qe={isSsr:xv()},nl=()=>k(e=>e.rootProps.accessibilityLayer);function ae(e){return Number.isFinite(e)}function ht(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function oa(){return oa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},oa.apply(null,arguments)}function pi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function mi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pi(Object(r),!0).forEach(function(a){Pv(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pi(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function Pv(e,t,r){return(t=Ov(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ov(e){var t=wv(e,"string");return typeof t=="symbol"?t:t+""}function wv(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hi={curveBasisClosed:ys,curveBasisOpen:hs,curveBasis:ms,curveBumpX:ps,curveBumpY:fs,curveLinearClosed:vs,curveLinear:_o,curveMonotoneX:ds,curveMonotoneY:ss,curveNatural:us,curveStep:cs,curveStepAfter:ls,curveStepBefore:os},Jt=e=>ae(e.x)&&ae(e.y),jt=e=>e.x,St=e=>e.y,Av=(e,t)=>{if(typeof e=="function")return e;var r="curve".concat(Bt(e));return(r==="curveMonotone"||r==="curveBump")&&t?hi["".concat(r).concat(t==="vertical"?"Y":"X")]:hi[r]||_o},Ev=e=>{var{type:t="linear",points:r=[],baseLine:a,layout:n,connectNulls:i=!1}=e,o=Av(t,n),l=i?r.filter(Jt):r,c;if(Array.isArray(a)){var d=i?a.filter(v=>Jt(v)):a,s=l.map((v,f)=>mi(mi({},v),{},{base:d[f]}));return n==="vertical"?c=Ut().y(St).x1(jt).x0(v=>v.base.x):c=Ut().x(jt).y1(St).y0(v=>v.base.y),c.defined(Jt).curve(o),c(s)}return n==="vertical"&&j(a)?c=Ut().y(St).x1(jt).x0(a):j(a)?c=Ut().x(jt).y1(St).y0(a):c=is().x(jt).y(St),c.defined(Jt).curve(o),c(l)},pt=e=>{var{className:t,points:r,path:a,pathRef:n}=e;if((!r||!r.length)&&!a)return null;var i=r&&r.length?Ev(e):a;return u.createElement("path",oa({},N(e,!1),$a(e),{className:_("recharts-curve",t),d:i===null?void 0:i,ref:n}))},jv=["x","y","top","left","width","height","className"];function la(){return la=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},la.apply(null,arguments)}function yi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function Sv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yi(Object(r),!0).forEach(function(a){Cv(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yi(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function Cv(e,t,r){return(t=kv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kv(e){var t=Iv(e,"string");return typeof t=="symbol"?t:t+""}function Iv(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Dv(e,t){if(e==null)return{};var r,a,n=Tv(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Tv(e,t){if(e==null)return{};var r={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;r[a]=e[a]}return r}var $v=(e,t,r,a,n,i)=>"M".concat(e,",").concat(n,"v").concat(a,"M").concat(i,",").concat(t,"h").concat(r),Nv=e=>{var{x:t=0,y:r=0,top:a=0,left:n=0,width:i=0,height:o=0,className:l}=e,c=Dv(e,jv),d=Sv({x:t,y:r,top:a,left:n,width:i,height:o},c);return!j(t)||!j(r)||!j(i)||!j(o)||!j(a)||!j(n)?null:u.createElement("path",la({},N(d,!0),{className:_("recharts-cross",l),d:$v(t,r,i,o,a,n)}))};function Mv(e,t,r,a){var n=a/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-n:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-n,width:e==="horizontal"?a:r.width-1,height:e==="horizontal"?r.height-1:a}}function gi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function _v(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gi(Object(r),!0).forEach(function(a){Lv(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gi(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function Lv(e,t,r){return(t=Bv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bv(e){var t=Kv(e,"string");return typeof t=="symbol"?t:t+""}function Kv(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function be(e,t){var r=_v({},e),a=t,n=Object.keys(t),i=n.reduce((o,l)=>(o[l]===void 0&&a[l]!==void 0&&(o[l]=a[l]),o),r);return i}function Rv(e){var t={},r=()=>null,a=!1,n=null,i=o=>{if(!a){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...d]=l;if(typeof c=="number"){n=e.setTimeout(i.bind(null,d),c);return}i(c),n=e.setTimeout(i.bind(null,d));return}typeof o=="object"&&(t=o,r(t)),typeof o=="function"&&o()}};return{stop:()=>{a=!0},start:o=>{a=!1,n&&(n(),n=null),i(o)},subscribe:o=>(r=o,()=>{r=()=>null}),getTimeoutController:()=>e}}var lr=1e-4,il=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],ol=(e,t)=>e.map((r,a)=>r*t**a).reduce((r,a)=>r+a),bi=(e,t)=>r=>{var a=il(e,t);return ol(a,r)},zv=(e,t)=>r=>{var a=il(e,t),n=[...a.map((i,o)=>i*o).slice(1),0];return ol(n,r)},xi=function(){for(var t,r,a,n,i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];if(o.length===1)switch(o[0]){case"linear":[t,a,r,n]=[0,0,1,1];break;case"ease":[t,a,r,n]=[.25,.1,.25,1];break;case"ease-in":[t,a,r,n]=[.42,0,1,1];break;case"ease-out":[t,a,r,n]=[.42,0,.58,1];break;case"ease-in-out":[t,a,r,n]=[0,0,.58,1];break;default:{var c=o[0].split("(");c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4&&([t,a,r,n]=c[1].split(")")[0].split(",").map(m=>parseFloat(m)))}}else o.length===4&&([t,a,r,n]=o);var d=bi(t,r),s=bi(a,n),v=zv(t,r),f=m=>m>1?1:m<0?0:m,p=m=>{for(var h=m>1?1:m,y=h,b=0;b<8;++b){var g=d(y)-h,x=v(y);if(Math.abs(g-h)<lr||x<lr)return s(y);y=f(y-g/x)}return s(y)};return p.isStepper=!1,p},Wv=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:r=100,damping:a=8,dt:n=17}=t,i=(o,l,c)=>{var d=-(o-l)*r,s=c*a,v=c+(d-s)*n/1e3,f=c*n/1e3+o;return Math.abs(f-l)<lr&&Math.abs(v)<lr?[l,0]:[f,v]};return i.isStepper=!0,i.dt=n,i},Fv=e=>{if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return xi(e);case"spring":return Wv();default:if(e.split("(")[0]==="cubic-bezier")return xi(e)}return typeof e=="function"?e:null};function Pi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function Oi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Pi(Object(r),!0).forEach(function(a){Gv(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pi(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function Gv(e,t,r){return(t=Vv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vv(e){var t=Hv(e,"string");return typeof t=="symbol"?t:t+""}function Hv(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xv=e=>e.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),Yv=(e,t,r)=>e.map(a=>"".concat(Xv(a)," ").concat(t,"ms ").concat(r)).join(","),Uv=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((r,a)=>r.filter(n=>a.includes(n))),Tt=(e,t)=>Object.keys(t).reduce((r,a)=>Oi(Oi({},r),{},{[a]:e(a,t[a])}),{});function wi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wi(Object(r),!0).forEach(function(a){qv(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wi(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function qv(e,t,r){return(t=Zv(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zv(e){var t=Jv(e,"string");return typeof t=="symbol"?t:t+""}function Jv(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var cr=(e,t,r)=>e+(t-e)*r,ca=e=>{var{from:t,to:r}=e;return t!==r},ll=(e,t,r)=>{var a=Tt((n,i)=>{if(ca(i)){var[o,l]=e(i.from,i.to,i.velocity);return re(re({},i),{},{from:o,velocity:l})}return i},t);return r<1?Tt((n,i)=>ca(i)?re(re({},i),{},{velocity:cr(i.velocity,a[n].velocity,r),from:cr(i.from,a[n].from,r)}):i,t):ll(e,a,r-1)};function Qv(e,t,r,a,n,i){var o,l=a.reduce((f,p)=>re(re({},f),{},{[p]:{from:e[p],velocity:0,to:t[p]}}),{}),c=()=>Tt((f,p)=>p.from,l),d=()=>!Object.values(l).filter(ca).length,s=null,v=f=>{o||(o=f);var p=f-o,m=p/r.dt;l=ll(r,l,m),n(re(re(re({},e),t),c())),o=f,d()||(s=i.setTimeout(v))};return()=>(s=i.setTimeout(v),()=>{s()})}function ef(e,t,r,a,n,i,o){var l=null,c=n.reduce((v,f)=>re(re({},v),{},{[f]:[e[f],t[f]]}),{}),d,s=v=>{d||(d=v);var f=(v-d)/a,p=Tt((h,y)=>cr(...y,r(f)),c);if(i(re(re(re({},e),t),p)),f<1)l=o.setTimeout(s);else{var m=Tt((h,y)=>cr(...y,r(1)),c);i(re(re(re({},e),t),m))}};return()=>(l=o.setTimeout(s),()=>{l()})}const tf=(e,t,r,a,n,i)=>{var o=Uv(e,t);return r.isStepper===!0?Qv(e,t,r,o,n,i):ef(e,t,r,a,o,n,i)};class rf{setTimeout(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=performance.now(),n=null,i=o=>{o-a>=r?t(o):typeof requestAnimationFrame=="function"&&(n=requestAnimationFrame(i))};return n=requestAnimationFrame(i),()=>{cancelAnimationFrame(n)}}}var af=["children","begin","duration","attributeName","easing","isActive","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart","animationManager"];function ua(){return ua=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ua.apply(null,arguments)}function nf(e,t){if(e==null)return{};var r,a,n=of(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function of(e,t){if(e==null)return{};var r={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;r[a]=e[a]}return r}function Ai(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function Ge(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ai(Object(r),!0).forEach(function(a){rt(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ai(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function rt(e,t,r){return(t=lf(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lf(e){var t=cf(e,"string");return typeof t=="symbol"?t:t+""}function cf(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function uf(){return Rv(new rf)}class Ha extends u.PureComponent{constructor(t,r){super(t,r),rt(this,"mounted",!1),rt(this,"manager",null),rt(this,"stopJSAnimation",null),rt(this,"unSubscribe",null);var{isActive:a,attributeName:n,from:i,to:o,children:l,duration:c,animationManager:d}=this.props;if(this.manager=d,this.handleStyleChange=this.handleStyleChange.bind(this),this.changeStyle=this.changeStyle.bind(this),!a||c<=0){this.state={style:{}},typeof l=="function"&&(this.state={style:o});return}if(i){if(typeof l=="function"){this.state={style:i};return}this.state={style:n?{[n]:i}:i}}else this.state={style:{}}}componentDidMount(){var{isActive:t,canBegin:r}=this.props;this.mounted=!0,!(!t||!r)&&this.runAnimation(this.props)}componentDidUpdate(t){var{isActive:r,canBegin:a,attributeName:n,shouldReAnimate:i,to:o,from:l}=this.props,{style:c}=this.state;if(a){if(!r){var d={style:n?{[n]:o}:o};this.state&&c&&(n&&c[n]!==o||!n&&c!==o)&&this.setState(d);return}if(!(gs(t.to,o)&&t.canBegin&&t.isActive)){var s=!t.canBegin||!t.isActive;this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var v=s||i?l:t.to;if(this.state&&c){var f={style:n?{[n]:v}:v};(n&&c[n]!==v||!n&&c!==v)&&this.setState(f)}this.runAnimation(Ge(Ge({},this.props),{},{from:v,begin:0}))}}}componentWillUnmount(){this.mounted=!1;var{onAnimationEnd:t}=this.props;this.unSubscribe&&this.unSubscribe(),this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation(),t&&t()}handleStyleChange(t){this.changeStyle(t)}changeStyle(t){this.mounted&&this.setState({style:t})}runJSAnimation(t){var{from:r,to:a,duration:n,easing:i,begin:o,onAnimationEnd:l,onAnimationStart:c}=t,d=tf(r,a,Fv(i),n,this.changeStyle,this.manager.getTimeoutController()),s=()=>{this.stopJSAnimation=d()};this.manager.start([c,o,s,n,l])}runAnimation(t){var{begin:r,duration:a,attributeName:n,to:i,easing:o,onAnimationStart:l,onAnimationEnd:c,children:d}=t;if(this.unSubscribe=this.manager.subscribe(this.handleStyleChange),typeof o=="function"||typeof d=="function"||o==="spring"){this.runJSAnimation(t);return}var s=n?{[n]:i}:i,v=Yv(Object.keys(s),a,o);this.manager.start([l,r,Ge(Ge({},s),{},{transition:v}),a,c])}render(){var t=this.props,{children:r,begin:a,duration:n,attributeName:i,easing:o,isActive:l,from:c,to:d,canBegin:s,onAnimationEnd:v,shouldReAnimate:f,onAnimationReStart:p,animationManager:m}=t,h=nf(t,af),y=u.Children.count(r),b=this.state.style;if(typeof r=="function")return r(b);if(!l||y===0||n<=0)return r;var g=x=>{var{style:O={},className:w}=x.props,A=u.cloneElement(x,Ge(Ge({},h),{},{style:Ge(Ge({},O),b),className:w}));return A};return y===1?g(u.Children.only(r)):u.createElement("div",null,u.Children.map(r,x=>g(x)))}}rt(Ha,"displayName","Animate");rt(Ha,"defaultProps",{begin:0,duration:1e3,attributeName:"",easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}});var sf=u.createContext(null);function Be(e){var t,r,a=u.useContext(sf);return u.createElement(Ha,ua({},e,{animationManager:(t=(r=e.animationManager)!==null&&r!==void 0?r:a)!==null&&t!==void 0?t:uf()}))}function ur(){return ur=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ur.apply(null,arguments)}var Ei=(e,t,r,a,n)=>{var i=Math.min(Math.abs(r)/2,Math.abs(a)/2),o=a>=0?1:-1,l=r>=0?1:-1,c=a>=0&&r>=0||a<0&&r<0?1:0,d;if(i>0&&n instanceof Array){for(var s=[0,0,0,0],v=0,f=4;v<f;v++)s[v]=n[v]>i?i:n[v];d="M".concat(e,",").concat(t+o*s[0]),s[0]>0&&(d+="A ".concat(s[0],",").concat(s[0],",0,0,").concat(c,",").concat(e+l*s[0],",").concat(t)),d+="L ".concat(e+r-l*s[1],",").concat(t),s[1]>0&&(d+="A ".concat(s[1],",").concat(s[1],",0,0,").concat(c,`,
@@ -1,4 +1,4 @@
1
- var jt=Object.defineProperty;var kt=(n,e,t)=>e in n?jt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var f=(n,e,t)=>kt(n,typeof e!="symbol"?e+"":e,t);import{eN as wt}from"./vendor-D2eEI-6h.js";function vt(n,e,t){const{parseMetaString:a,trimEndingNewline:s=!0,defaultLanguage:r="text",fallbackLanguage:i}=t,c=e.getLoadedLanguages();n.options.highlight=(o,l="text",u)=>{l===""&&(l=r),i&&!c.includes(l)&&(l=i);const d=(a==null?void 0:a(u,o,l))||{},m={...t,lang:l,meta:{...t.meta,...d,__raw:u}},p=[];return p.push({name:"@shikijs/markdown-it:block-class",code(g){g.properties.class=`language-${l}`}}),s&&o.endsWith(`
1
+ var jt=Object.defineProperty;var kt=(n,e,t)=>e in n?jt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var f=(n,e,t)=>kt(n,typeof e!="symbol"?e+"":e,t);import{eN as wt}from"./vendor-Ce6GTAin.js";function vt(n,e,t){const{parseMetaString:a,trimEndingNewline:s=!0,defaultLanguage:r="text",fallbackLanguage:i}=t,c=e.getLoadedLanguages();n.options.highlight=(o,l="text",u)=>{l===""&&(l=r),i&&!c.includes(l)&&(l=i);const d=(a==null?void 0:a(u,o,l))||{},m={...t,lang:l,meta:{...t.meta,...d,__raw:u}},p=[];return p.push({name:"@shikijs/markdown-it:block-class",code(g){g.properties.class=`language-${l}`}}),s&&o.endsWith(`
2
2
  `)&&(o=o.slice(0,-1)),e.codeToHtml(o,{...m,transformers:[...p,...m.transformers||[]]})}}function ba(n,e){return function(t){vt(t,n,e)}}let O=class extends Error{constructor(e){super(e),this.name="ShikiError"}},Ae=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Ct(){return 2147483648}function xt(){return typeof performance<"u"?performance.now():Date.now()}const St=(n,e)=>n+(e-n%e)%e;async function Bt(n){let e,t;const a={};function s(p){t=p,a.HEAPU8=new Uint8Array(p),a.HEAPU32=new Uint32Array(p)}function r(p,g,$){a.HEAPU8.copyWithin(p,g,g+$)}function i(p){try{return e.grow(p-t.byteLength+65535>>>16),s(e.buffer),1}catch{}}function c(p){const g=a.HEAPU8.length;p=p>>>0;const $=Ct();if(p>$)return!1;for(let b=1;b<=4;b*=2){let h=g*(1+.2/b);h=Math.min(h,p+100663296);const _=Math.min($,St(Math.max(p,h),65536));if(i(_))return!0}return!1}const o=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function l(p,g,$=1024){const b=g+$;let h=g;for(;p[h]&&!(h>=b);)++h;if(h-g>16&&p.buffer&&o)return o.decode(p.subarray(g,h));let _="";for(;g<h;){let y=p[g++];if(!(y&128)){_+=String.fromCharCode(y);continue}const j=p[g++]&63;if((y&224)===192){_+=String.fromCharCode((y&31)<<6|j);continue}const k=p[g++]&63;if((y&240)===224?y=(y&15)<<12|j<<6|k:y=(y&7)<<18|j<<12|k<<6|p[g++]&63,y<65536)_+=String.fromCharCode(y);else{const B=y-65536;_+=String.fromCharCode(55296|B>>10,56320|B&1023)}}return _}function u(p,g){return p?l(a.HEAPU8,p,g):""}const d={emscripten_get_now:xt,emscripten_memcpy_big:r,emscripten_resize_heap:c,fd_write:()=>0};async function m(){const g=await n({env:d,wasi_snapshot_preview1:d});e=g.memory,s(e.buffer),Object.assign(a,g),a.UTF8ToString=u}return await m(),a}var Rt=Object.defineProperty,At=(n,e,t)=>e in n?Rt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,v=(n,e,t)=>(At(n,typeof e!="symbol"?e+"":e,t),t);let C=null;function It(n){throw new Ae(n.UTF8ToString(n.getLastOnigError()))}class fe{constructor(e){v(this,"utf16Length"),v(this,"utf8Length"),v(this,"utf16Value"),v(this,"utf8Value"),v(this,"utf16OffsetToUtf8"),v(this,"utf8OffsetToUtf16");const t=e.length,a=fe._utf8ByteLength(e),s=a!==t,r=s?new Uint32Array(t+1):null;s&&(r[t]=a);const i=s?new Uint32Array(a+1):null;s&&(i[a]=t);const c=new Uint8Array(a);let o=0;for(let l=0;l<t;l++){const u=e.charCodeAt(l);let d=u,m=!1;if(u>=55296&&u<=56319&&l+1<t){const p=e.charCodeAt(l+1);p>=56320&&p<=57343&&(d=(u-55296<<10)+65536|p-56320,m=!0)}s&&(r[l]=o,m&&(r[l+1]=o),d<=127?i[o+0]=l:d<=2047?(i[o+0]=l,i[o+1]=l):d<=65535?(i[o+0]=l,i[o+1]=l,i[o+2]=l):(i[o+0]=l,i[o+1]=l,i[o+2]=l,i[o+3]=l)),d<=127?c[o++]=d:d<=2047?(c[o++]=192|(d&1984)>>>6,c[o++]=128|(d&63)>>>0):d<=65535?(c[o++]=224|(d&61440)>>>12,c[o++]=128|(d&4032)>>>6,c[o++]=128|(d&63)>>>0):(c[o++]=240|(d&1835008)>>>18,c[o++]=128|(d&258048)>>>12,c[o++]=128|(d&4032)>>>6,c[o++]=128|(d&63)>>>0),m&&l++}this.utf16Length=t,this.utf8Length=a,this.utf16Value=e,this.utf8Value=c,this.utf16OffsetToUtf8=r,this.utf8OffsetToUtf16=i}static _utf8ByteLength(e){let t=0;for(let a=0,s=e.length;a<s;a++){const r=e.charCodeAt(a);let i=r,c=!1;if(r>=55296&&r<=56319&&a+1<s){const o=e.charCodeAt(a+1);o>=56320&&o<=57343&&(i=(r-55296<<10)+65536|o-56320,c=!0)}i<=127?t+=1:i<=2047?t+=2:i<=65535?t+=3:t+=4,c&&a++}return t}createString(e){const t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}const I=class{constructor(n){if(v(this,"id",++I.LAST_ID),v(this,"_onigBinding"),v(this,"content"),v(this,"utf16Length"),v(this,"utf8Length"),v(this,"utf16OffsetToUtf8"),v(this,"utf8OffsetToUtf16"),v(this,"ptr"),!C)throw new Ae("Must invoke loadWasm first.");this._onigBinding=C,this.content=n;const e=new fe(n);this.utf16Length=e.utf16Length,this.utf8Length=e.utf8Length,this.utf16OffsetToUtf8=e.utf16OffsetToUtf8,this.utf8OffsetToUtf16=e.utf8OffsetToUtf16,this.utf8Length<1e4&&!I._sharedPtrInUse?(I._sharedPtr||(I._sharedPtr=C.omalloc(1e4)),I._sharedPtrInUse=!0,C.HEAPU8.set(e.utf8Value,I._sharedPtr),this.ptr=I._sharedPtr):this.ptr=e.createString(C)}convertUtf8OffsetToUtf16(n){return this.utf8OffsetToUtf16?n<0?0:n>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[n]:n}convertUtf16OffsetToUtf8(n){return this.utf16OffsetToUtf8?n<0?0:n>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[n]:n}dispose(){this.ptr===I._sharedPtr?I._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let J=I;v(J,"LAST_ID",0);v(J,"_sharedPtr",0);v(J,"_sharedPtrInUse",!1);class Tt{constructor(e){if(v(this,"_onigBinding"),v(this,"_ptr"),!C)throw new Ae("Must invoke loadWasm first.");const t=[],a=[];for(let c=0,o=e.length;c<o;c++){const l=new fe(e[c]);t[c]=l.createString(C),a[c]=l.utf8Length}const s=C.omalloc(4*e.length);C.HEAPU32.set(t,s/4);const r=C.omalloc(4*e.length);C.HEAPU32.set(a,r/4);const i=C.createOnigScanner(s,r,e.length);for(let c=0,o=e.length;c<o;c++)C.ofree(t[c]);C.ofree(r),C.ofree(s),i===0&&It(C),this._onigBinding=C,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,a){let s=0;if(typeof a=="number"&&(s=a),typeof e=="string"){e=new J(e);const r=this._findNextMatchSync(e,t,!1,s);return e.dispose(),r}return this._findNextMatchSync(e,t,!1,s)}_findNextMatchSync(e,t,a,s){const r=this._onigBinding,i=r.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),s);if(i===0)return null;const c=r.HEAPU32;let o=i/4;const l=c[o++],u=c[o++],d=[];for(let m=0;m<u;m++){const p=e.convertUtf8OffsetToUtf16(c[o++]),g=e.convertUtf8OffsetToUtf16(c[o++]);d[m]={start:p,end:g,length:g-p}}return{index:l,captureIndices:d}}}function Et(n){return typeof n.instantiator=="function"}function Nt(n){return typeof n.default=="function"}function Pt(n){return typeof n.data<"u"}function Lt(n){return typeof Response<"u"&&n instanceof Response}function Gt(n){var e;return typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||ArrayBuffer.isView(n))||typeof Buffer<"u"&&((e=Buffer.isBuffer)==null?void 0:e.call(Buffer,n))||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&n instanceof Uint32Array}let ee;function Ft(n){if(ee)return ee;async function e(){C=await Bt(async t=>{let a=n;return a=await a,typeof a=="function"&&(a=await a(t)),typeof a=="function"&&(a=await a(t)),Et(a)?a=await a.instantiator(t):Nt(a)?a=await a.default(t):(Pt(a)&&(a=a.data),Lt(a)?typeof WebAssembly.instantiateStreaming=="function"?a=await Ot(a)(t):a=await Mt(a)(t):Gt(a)?a=await ye(a)(t):a instanceof WebAssembly.Module?a=await ye(a)(t):"default"in a&&a.default instanceof WebAssembly.Module&&(a=await ye(a.default)(t))),"instance"in a&&(a=a.instance),"exports"in a&&(a=a.exports),a})}return ee=e(),ee}function ye(n){return e=>WebAssembly.instantiate(n,e)}function Ot(n){return e=>WebAssembly.instantiateStreaming(n,e)}function Mt(n){return async e=>{const t=await n.arrayBuffer();return WebAssembly.instantiate(t,e)}}let Wt;function Ht(){return Wt}async function zt(n){return n&&await Ft(n),{createScanner(e){return new Tt(e.map(t=>typeof t=="string"?t:t.source))},createString(e){return new J(e)}}}function Ut(n){return Ie(n)}function Ie(n){return Array.isArray(n)?Dt(n):n instanceof RegExp?n:typeof n=="object"?qt(n):n}function Dt(n){let e=[];for(let t=0,a=n.length;t<a;t++)e[t]=Ie(n[t]);return e}function qt(n){let e={};for(let t in n)e[t]=Ie(n[t]);return e}function Qe(n,...e){return e.forEach(t=>{for(let a in t)n[a]=t[a]}),n}function Ye(n){const e=~n.lastIndexOf("/")||~n.lastIndexOf("\\");return e===0?n:~e===n.length-1?Ye(n.substring(0,n.length-1)):n.substr(~e+1)}var $e=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,te=class{static hasCaptures(n){return n===null?!1:($e.lastIndex=0,$e.test(n))}static replaceCaptures(n,e,t){return n.replace($e,(a,s,r,i)=>{let c=t[parseInt(s||r,10)];if(c){let o=e.substring(c.start,c.end);for(;o[0]===".";)o=o.substring(1);switch(i){case"downcase":return o.toLowerCase();case"upcase":return o.toUpperCase();default:return o}}else return a})}};function et(n,e){return n<e?-1:n>e?1:0}function tt(n,e){if(n===null&&e===null)return 0;if(!n)return-1;if(!e)return 1;let t=n.length,a=e.length;if(t===a){for(let s=0;s<t;s++){let r=et(n[s],e[s]);if(r!==0)return r}return 0}return t-a}function Fe(n){return!!(/^#[0-9a-f]{6}$/i.test(n)||/^#[0-9a-f]{8}$/i.test(n)||/^#[0-9a-f]{3}$/i.test(n)||/^#[0-9a-f]{4}$/i.test(n))}function nt(n){return n.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var at=class{constructor(n){f(this,"cache",new Map);this.fn=n}get(n){if(this.cache.has(n))return this.cache.get(n);const e=this.fn(n);return this.cache.set(n,e),e}},se=class{constructor(n,e,t){f(this,"_cachedMatchRoot",new at(n=>this._root.match(n)));this._colorMap=n,this._defaults=e,this._root=t}static createFromRawTheme(n,e){return this.createFromParsedTheme(Zt(n),e)}static createFromParsedTheme(n,e){return Jt(n,e)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(n){if(n===null)return this._defaults;const e=n.scopeName,a=this._cachedMatchRoot.get(e).find(s=>Vt(n.parent,s.parentScopes));return a?new st(a.fontStyle,a.foreground,a.background):null}},je=class ne{constructor(e,t){this.parent=e,this.scopeName=t}static push(e,t){for(const a of t)e=new ne(e,a);return e}static from(...e){let t=null;for(let a=0;a<e.length;a++)t=new ne(t,e[a]);return t}push(e){return new ne(this,e)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let a=this;for(;a&&a!==e;)t.push(a.scopeName),a=a.parent;return a===e?t.reverse():void 0}};function Vt(n,e){if(e.length===0)return!0;for(let t=0;t<e.length;t++){let a=e[t],s=!1;if(a===">"){if(t===e.length-1)return!1;a=e[++t],s=!0}for(;n&&!Xt(n.scopeName,a);){if(s)return!1;n=n.parent}if(!n)return!1;n=n.parent}return!0}function Xt(n,e){return e===n||n.startsWith(e)&&n[e.length]==="."}var st=class{constructor(n,e,t){this.fontStyle=n,this.foregroundId=e,this.backgroundId=t}};function Zt(n){if(!n)return[];if(!n.settings||!Array.isArray(n.settings))return[];let e=n.settings,t=[],a=0;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(!i.settings)continue;let c;if(typeof i.scope=="string"){let d=i.scope;d=d.replace(/^[,]+/,""),d=d.replace(/[,]+$/,""),c=d.split(",")}else Array.isArray(i.scope)?c=i.scope:c=[""];let o=-1;if(typeof i.settings.fontStyle=="string"){o=0;let d=i.settings.fontStyle.split(" ");for(let m=0,p=d.length;m<p;m++)switch(d[m]){case"italic":o=o|1;break;case"bold":o=o|2;break;case"underline":o=o|4;break;case"strikethrough":o=o|8;break}}let l=null;typeof i.settings.foreground=="string"&&Fe(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Fe(i.settings.background)&&(u=i.settings.background);for(let d=0,m=c.length;d<m;d++){let g=c[d].trim().split(" "),$=g[g.length-1],b=null;g.length>1&&(b=g.slice(0,g.length-1),b.reverse()),t[a++]=new Kt($,b,s,o,l,u)}}return t}var Kt=class{constructor(n,e,t,a,s,r){this.scope=n,this.parentScopes=e,this.index=t,this.fontStyle=a,this.foreground=s,this.background=r}},L=(n=>(n[n.NotSet=-1]="NotSet",n[n.None=0]="None",n[n.Italic=1]="Italic",n[n.Bold=2]="Bold",n[n.Underline=4]="Underline",n[n.Strikethrough=8]="Strikethrough",n))(L||{});function Jt(n,e){n.sort((o,l)=>{let u=et(o.scope,l.scope);return u!==0||(u=tt(o.parentScopes,l.parentScopes),u!==0)?u:o.index-l.index});let t=0,a="#000000",s="#ffffff";for(;n.length>=1&&n[0].scope==="";){let o=n.shift();o.fontStyle!==-1&&(t=o.fontStyle),o.foreground!==null&&(a=o.foreground),o.background!==null&&(s=o.background)}let r=new Qt(e),i=new st(t,r.getId(a),r.getId(s)),c=new en(new ve(0,null,-1,0,0),[]);for(let o=0,l=n.length;o<l;o++){let u=n[o];c.insert(0,u.scope,u.parentScopes,u.fontStyle,r.getId(u.foreground),r.getId(u.background))}return new se(r,i,c)}var Qt=class{constructor(n){f(this,"_isFrozen");f(this,"_lastColorId");f(this,"_id2color");f(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(n)){this._isFrozen=!0;for(let e=0,t=n.length;e<t;e++)this._color2id[n[e]]=e,this._id2color[e]=n[e]}else this._isFrozen=!1}getId(n){if(n===null)return 0;n=n.toUpperCase();let e=this._color2id[n];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${n}`);return e=++this._lastColorId,this._color2id[n]=e,this._id2color[e]=n,e}getColorMap(){return this._id2color.slice(0)}},Yt=Object.freeze([]),ve=class rt{constructor(e,t,a,s,r){f(this,"scopeDepth");f(this,"parentScopes");f(this,"fontStyle");f(this,"foreground");f(this,"background");this.scopeDepth=e,this.parentScopes=t||Yt,this.fontStyle=a,this.foreground=s,this.background=r}clone(){return new rt(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let a=0,s=e.length;a<s;a++)t[a]=e[a].clone();return t}acceptOverwrite(e,t,a,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),a!==0&&(this.foreground=a),s!==0&&(this.background=s)}},en=class Ce{constructor(e,t=[],a={}){f(this,"_rulesWithParentScopes");this._mainRule=e,this._children=a,this._rulesWithParentScopes=t}static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let a=0,s=0;for(;e.parentScopes[a]===">"&&a++,t.parentScopes[s]===">"&&s++,!(a>=e.parentScopes.length||s>=t.parentScopes.length);){const r=t.parentScopes[s].length-e.parentScopes[a].length;if(r!==0)return r;a++,s++}return t.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let a=e.indexOf("."),s,r;if(a===-1?(s=e,r=""):(s=e.substring(0,a),r=e.substring(a+1)),this._children.hasOwnProperty(s))return this._children[s].match(r)}const t=this._rulesWithParentScopes.concat(this._mainRule);return t.sort(Ce._cmpBySpecificity),t}insert(e,t,a,s,r,i){if(t===""){this._doInsertHere(e,a,s,r,i);return}let c=t.indexOf("."),o,l;c===-1?(o=t,l=""):(o=t.substring(0,c),l=t.substring(c+1));let u;this._children.hasOwnProperty(o)?u=this._children[o]:(u=new Ce(this._mainRule.clone(),ve.cloneArr(this._rulesWithParentScopes)),this._children[o]=u),u.insert(e+1,l,a,s,r,i)}_doInsertHere(e,t,a,s,r){if(t===null){this._mainRule.acceptOverwrite(e,a,s,r);return}for(let i=0,c=this._rulesWithParentScopes.length;i<c;i++){let o=this._rulesWithParentScopes[i];if(tt(o.parentScopes,t)===0){o.acceptOverwrite(e,a,s,r);return}}a===-1&&(a=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),r===0&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new ve(e,t,a,s,r))}},W=class R{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const t=R.getLanguageId(e),a=R.getTokenType(e),s=R.getFontStyle(e),r=R.getForeground(e),i=R.getBackground(e);console.log({languageId:t,tokenType:a,fontStyle:s,foreground:r,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,t,a,s,r,i,c){let o=R.getLanguageId(e),l=R.getTokenType(e),u=R.containsBalancedBrackets(e)?1:0,d=R.getFontStyle(e),m=R.getForeground(e),p=R.getBackground(e);return t!==0&&(o=t),a!==8&&(l=a),s!==null&&(u=s?1:0),r!==-1&&(d=r),i!==0&&(m=i),c!==0&&(p=c),(o<<0|l<<8|u<<10|d<<11|m<<15|p<<24)>>>0}};function re(n,e){const t=[],a=tn(n);let s=a.next();for(;s!==null;){let o=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":o=1;break;case"L":o=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=a.next()}let l=i();if(t.push({matcher:l,priority:o}),s!==",")break;s=a.next()}return t;function r(){if(s==="-"){s=a.next();const o=r();return l=>!!o&&!o(l)}if(s==="("){s=a.next();const o=c();return s===")"&&(s=a.next()),o}if(Oe(s)){const o=[];do o.push(s),s=a.next();while(Oe(s));return l=>e(o,l)}return null}function i(){const o=[];let l=r();for(;l;)o.push(l),l=r();return u=>o.every(d=>d(u))}function c(){const o=[];let l=i();for(;l&&(o.push(l),s==="|"||s===",");){do s=a.next();while(s==="|"||s===",");l=i()}return u=>o.some(d=>d(u))}}function Oe(n){return!!n&&!!n.match(/[\w\.:]+/)}function tn(n){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,t=e.exec(n);return{next:()=>{if(!t)return null;const a=t[0];return t=e.exec(n),a}}}function it(n){typeof n.dispose=="function"&&n.dispose()}var V=class{constructor(n){this.scopeName=n}toKey(){return this.scopeName}},nn=class{constructor(n,e){this.scopeName=n,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},an=class{constructor(){f(this,"_references",[]);f(this,"_seenReferenceKeys",new Set);f(this,"visitedRule",new Set)}get references(){return this._references}add(n){const e=n.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(n))}},sn=class{constructor(n,e){f(this,"seenFullScopeRequests",new Set);f(this,"seenPartialScopeRequests",new Set);f(this,"Q");this.repo=n,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new V(this.initialScopeName)]}processQueue(){const n=this.Q;this.Q=[];const e=new an;for(const t of n)rn(t,this.initialScopeName,this.repo,e);for(const t of e.references)if(t instanceof V){if(this.seenFullScopeRequests.has(t.scopeName))continue;this.seenFullScopeRequests.add(t.scopeName),this.Q.push(t)}else{if(this.seenFullScopeRequests.has(t.scopeName)||this.seenPartialScopeRequests.has(t.toKey()))continue;this.seenPartialScopeRequests.add(t.toKey()),this.Q.push(t)}}};function rn(n,e,t,a){const s=t.lookup(n.scopeName);if(!s){if(n.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const r=t.lookup(e);n instanceof V?ae({baseGrammar:r,selfGrammar:s},a):xe(n.ruleName,{baseGrammar:r,selfGrammar:s,repository:s.repository},a);const i=t.injections(n.scopeName);if(i)for(const c of i)a.add(new V(c))}function xe(n,e,t){if(e.repository&&e.repository[n]){const a=e.repository[n];ie([a],e,t)}}function ae(n,e){n.selfGrammar.patterns&&Array.isArray(n.selfGrammar.patterns)&&ie(n.selfGrammar.patterns,{...n,repository:n.selfGrammar.repository},e),n.selfGrammar.injections&&ie(Object.values(n.selfGrammar.injections),{...n,repository:n.selfGrammar.repository},e)}function ie(n,e,t){for(const a of n){if(t.visitedRule.has(a))continue;t.visitedRule.add(a);const s=a.repository?Qe({},e.repository,a.repository):e.repository;Array.isArray(a.patterns)&&ie(a.patterns,{...e,repository:s},t);const r=a.include;if(!r)continue;const i=ot(r);switch(i.kind){case 0:ae({...e,selfGrammar:e.baseGrammar},t);break;case 1:ae(e,t);break;case 2:xe(i.ruleName,{...e,repository:s},t);break;case 3:case 4:const c=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(c){const o={baseGrammar:e.baseGrammar,selfGrammar:c,repository:s};i.kind===4?xe(i.ruleName,o,t):ae(o,t)}else i.kind===4?t.add(new nn(i.scopeName,i.ruleName)):t.add(new V(i.scopeName));break}}}var on=class{constructor(){f(this,"kind",0)}},cn=class{constructor(){f(this,"kind",1)}},ln=class{constructor(n){f(this,"kind",2);this.ruleName=n}},un=class{constructor(n){f(this,"kind",3);this.scopeName=n}},dn=class{constructor(n,e){f(this,"kind",4);this.scopeName=n,this.ruleName=e}};function ot(n){if(n==="$base")return new on;if(n==="$self")return new cn;const e=n.indexOf("#");if(e===-1)return new un(n);if(e===0)return new ln(n.substring(1));{const t=n.substring(0,e),a=n.substring(e+1);return new dn(t,a)}}var pn=/\\(\d+)/,Me=/\\(\d+)/g,mn=-1,ct=-2;var Q=class{constructor(n,e,t,a){f(this,"$location");f(this,"id");f(this,"_nameIsCapturing");f(this,"_name");f(this,"_contentNameIsCapturing");f(this,"_contentName");this.$location=n,this.id=e,this._name=t||null,this._nameIsCapturing=te.hasCaptures(this._name),this._contentName=a||null,this._contentNameIsCapturing=te.hasCaptures(this._contentName)}get debugName(){const n=this.$location?`${Ye(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${n}`}getName(n,e){return!this._nameIsCapturing||this._name===null||n===null||e===null?this._name:te.replaceCaptures(this._name,n,e)}getContentName(n,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:te.replaceCaptures(this._contentName,n,e)}},fn=class extends Q{constructor(e,t,a,s,r){super(e,t,a,s);f(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,a,s){throw new Error("Not supported!")}},gn=class extends Q{constructor(e,t,a,s,r){super(e,t,a,null);f(this,"_match");f(this,"captures");f(this,"_cachedCompiledPatterns");this._match=new X(s,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,a,s){return this._getCachedCompiledPatterns(e).compileAG(e,a,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Z,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},We=class extends Q{constructor(e,t,a,s,r){super(e,t,a,s);f(this,"hasMissingPatterns");f(this,"patterns");f(this,"_cachedCompiledPatterns");this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const a of this.patterns)e.getRule(a).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,a,s){return this._getCachedCompiledPatterns(e).compileAG(e,a,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Z,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Se=class extends Q{constructor(e,t,a,s,r,i,c,o,l,u){super(e,t,a,s);f(this,"_begin");f(this,"beginCaptures");f(this,"_end");f(this,"endHasBackReferences");f(this,"endCaptures");f(this,"applyEndPatternLast");f(this,"hasMissingPatterns");f(this,"patterns");f(this,"_cachedCompiledPatterns");this._begin=new X(r,this.id),this.beginCaptures=i,this._end=new X(c||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,a,s){return this._getCachedCompiledPatterns(e,t).compileAG(e,a,s)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Z;for(const a of this.patterns)e.getRule(a).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},oe=class extends Q{constructor(e,t,a,s,r,i,c,o,l){super(e,t,a,s);f(this,"_begin");f(this,"beginCaptures");f(this,"whileCaptures");f(this,"_while");f(this,"whileHasBackReferences");f(this,"hasMissingPatterns");f(this,"patterns");f(this,"_cachedCompiledPatterns");f(this,"_cachedCompiledWhilePatterns");this._begin=new X(r,this.id),this.beginCaptures=i,this.whileCaptures=o,this._while=new X(c,ct),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,a,s){return this._getCachedCompiledPatterns(e).compileAG(e,a,s)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Z;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,a,s){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,a,s)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Z,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},lt=class x{static createCaptureRule(e,t,a,s,r){return e.registerRule(i=>new fn(t,i,a,s,r))}static getCompiledRuleId(e,t,a){return e.id||t.registerRule(s=>{if(e.id=s,e.match)return new gn(e.$vscodeTextmateLocation,e.id,e.name,e.match,x._compileCaptures(e.captures,t,a));if(typeof e.begin>"u"){e.repository&&(a=Qe({},a,e.repository));let r=e.patterns;return typeof r>"u"&&e.include&&(r=[{include:e.include}]),new We(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,x._compilePatterns(r,t,a))}return e.while?new oe(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,x._compileCaptures(e.beginCaptures||e.captures,t,a),e.while,x._compileCaptures(e.whileCaptures||e.captures,t,a),x._compilePatterns(e.patterns,t,a)):new Se(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,x._compileCaptures(e.beginCaptures||e.captures,t,a),e.end,x._compileCaptures(e.endCaptures||e.captures,t,a),e.applyEndPatternLast,x._compilePatterns(e.patterns,t,a))}),e.id}static _compileCaptures(e,t,a){let s=[];if(e){let r=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const c=parseInt(i,10);c>r&&(r=c)}for(let i=0;i<=r;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const c=parseInt(i,10);let o=0;e[i].patterns&&(o=x.getCompiledRuleId(e[i],t,a)),s[c]=x.createCaptureRule(t,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,o)}}return s}static _compilePatterns(e,t,a){let s=[];if(e)for(let r=0,i=e.length;r<i;r++){const c=e[r];let o=-1;if(c.include){const l=ot(c.include);switch(l.kind){case 0:case 1:o=x.getCompiledRuleId(a[c.include],t,a);break;case 2:let u=a[l.ruleName];u&&(o=x.getCompiledRuleId(u,t,a));break;case 3:case 4:const d=l.scopeName,m=l.kind===4?l.ruleName:null,p=t.getExternalGrammar(d,a);if(p)if(m){let g=p.repository[m];g&&(o=x.getCompiledRuleId(g,t,p.repository))}else o=x.getCompiledRuleId(p.repository.$self,t,p.repository);break}}else o=x.getCompiledRuleId(c,t,a);if(o!==-1){const l=t.getRule(o);let u=!1;if((l instanceof We||l instanceof Se||l instanceof oe)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(o)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},X=class ut{constructor(e,t){f(this,"source");f(this,"ruleId");f(this,"hasAnchor");f(this,"hasBackReferences");f(this,"_anchorCache");if(e&&typeof e=="string"){const a=e.length;let s=0,r=[],i=!1;for(let c=0;c<a;c++)if(e.charAt(c)==="\\"&&c+1<a){const l=e.charAt(c+1);l==="z"?(r.push(e.substring(s,c)),r.push("$(?!\\n)(?<!\\n)"),s=c+2):(l==="A"||l==="G")&&(i=!0),c++}this.hasAnchor=i,s===0?this.source=e:(r.push(e.substring(s,a)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source=="string"?this.hasBackReferences=pn.test(this.source):this.hasBackReferences=!1}clone(){return new ut(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let a=t.map(s=>e.substring(s.start,s.end));return Me.lastIndex=0,this.source.replace(Me,(s,r)=>nt(a[parseInt(r,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],t=[],a=[],s=[],r,i,c,o;for(r=0,i=this.source.length;r<i;r++)c=this.source.charAt(r),e[r]=c,t[r]=c,a[r]=c,s[r]=c,c==="\\"&&r+1<i&&(o=this.source.charAt(r+1),o==="A"?(e[r+1]="￿",t[r+1]="￿",a[r+1]="A",s[r+1]="A"):o==="G"?(e[r+1]="￿",t[r+1]="G",a[r+1]="￿",s[r+1]="G"):(e[r+1]=o,t[r+1]=o,a[r+1]=o,s[r+1]=o),r++);return{A0_G0:e.join(""),A0_G1:t.join(""),A1_G0:a.join(""),A1_G1:s.join("")}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Z=class{constructor(){f(this,"_items");f(this,"_hasAnchors");f(this,"_cached");f(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(n){this._items.push(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}unshift(n){this._items.unshift(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}length(){return this._items.length}setSource(n,e){this._items[n].source!==e&&(this._disposeCaches(),this._items[n].setSource(e))}compile(n){if(!this._cached){let e=this._items.map(t=>t.source);this._cached=new He(n,e,this._items.map(t=>t.ruleId))}return this._cached}compileAG(n,e,t){return this._hasAnchors?e?t?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G0):t?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G0):this.compile(n)}_resolveAnchors(n,e,t){let a=this._items.map(s=>s.resolveAnchors(e,t));return new He(n,a,this._items.map(s=>s.ruleId))}},He=class{constructor(n,e,t){f(this,"scanner");this.regExps=e,this.rules=t,this.scanner=n.createOnigScanner(e)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const n=[];for(let e=0,t=this.rules.length;e<t;e++)n.push(" - "+this.rules[e]+": "+this.regExps[e]);return n.join(`
3
3
  `)}findNextMatchSync(n,e,t){const a=this.scanner.findNextMatchSync(n,e,t);return a?{ruleId:this.rules[a.index],captureIndices:a.captureIndices}:null}},ke=class{constructor(n,e){this.languageId=n,this.tokenType=e}},P,hn=(P=class{constructor(e,t){f(this,"_defaultAttributes");f(this,"_embeddedLanguagesMatcher");f(this,"_getBasicScopeAttributes",new at(e=>{const t=this._scopeToLanguage(e),a=this._toStandardTokenType(e);return new ke(t,a)}));this._defaultAttributes=new ke(e,8),this._embeddedLanguagesMatcher=new bn(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?P._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const t=e.match(P.STANDARD_TOKEN_TYPE_REGEXP);if(!t)return 8;switch(t[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},f(P,"_NULL_SCOPE_METADATA",new ke(0,0)),f(P,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),P),bn=class{constructor(n){f(this,"values");f(this,"scopesRegExp");if(n.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(n);const e=n.map(([t,a])=>nt(t));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(n){if(!this.scopesRegExp)return;const e=n.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},ze=class{constructor(n,e){this.stack=n,this.stoppedEarly=e}};function dt(n,e,t,a,s,r,i,c){const o=e.content.length;let l=!1,u=-1;if(i){const p=_n(n,e,t,a,s,r);s=p.stack,a=p.linePos,t=p.isFirstLine,u=p.anchorPosition}const d=Date.now();for(;!l;){if(c!==0&&Date.now()-d>c)return new ze(s,!0);m()}return new ze(s,!1);function m(){const p=yn(n,e,t,a,s,u);if(!p){r.produce(s,o),l=!0;return}const g=p.captureIndices,$=p.matchedRuleId,b=g&&g.length>0?g[0].end>a:!1;if($===mn){const h=s.getRule(n);r.produce(s,g[0].start),s=s.withContentNameScopesList(s.nameScopesList),D(n,e,t,s,r,h.endCaptures,g),r.produce(s,g[0].end);const _=s;if(s=s.parent,u=_.getAnchorPos(),!b&&_.getEnterPos()===a){s=_,r.produce(s,o),l=!0;return}}else{const h=n.getRule($);r.produce(s,g[0].start);const _=s,y=h.getName(e.content,g),j=s.contentNameScopesList.pushAttributed(y,n);if(s=s.push($,a,u,g[0].end===o,null,j,j),h instanceof Se){const k=h;D(n,e,t,s,r,k.beginCaptures,g),r.produce(s,g[0].end),u=g[0].end;const B=k.getContentName(e.content,g),w=j.pushAttributed(B,n);if(s=s.withContentNameScopesList(w),k.endHasBackReferences&&(s=s.withEndRule(k.getEndWithResolvedBackReferences(e.content,g))),!b&&_.hasSameRuleAs(s)){s=s.pop(),r.produce(s,o),l=!0;return}}else if(h instanceof oe){const k=h;D(n,e,t,s,r,k.beginCaptures,g),r.produce(s,g[0].end),u=g[0].end;const B=k.getContentName(e.content,g),w=j.pushAttributed(B,n);if(s=s.withContentNameScopesList(w),k.whileHasBackReferences&&(s=s.withEndRule(k.getWhileWithResolvedBackReferences(e.content,g))),!b&&_.hasSameRuleAs(s)){s=s.pop(),r.produce(s,o),l=!0;return}}else if(D(n,e,t,s,r,h.captures,g),r.produce(s,g[0].end),s=s.pop(),!b){s=s.safePop(),r.produce(s,o),l=!0;return}}g[0].end>a&&(a=g[0].end,t=!1)}}function _n(n,e,t,a,s,r){let i=s.beginRuleCapturedEOL?0:-1;const c=[];for(let o=s;o;o=o.pop()){const l=o.getRule(n);l instanceof oe&&c.push({rule:l,stack:o})}for(let o=c.pop();o;o=c.pop()){const{ruleScanner:l,findOptions:u}=kn(o.rule,n,o.stack.endRule,t,a===i),d=l.findNextMatchSync(e,a,u);if(d){if(d.ruleId!==ct){s=o.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(r.produce(o.stack,d.captureIndices[0].start),D(n,e,t,o.stack,r,o.rule.whileCaptures,d.captureIndices),r.produce(o.stack,d.captureIndices[0].end),i=d.captureIndices[0].end,d.captureIndices[0].end>a&&(a=d.captureIndices[0].end,t=!1))}else{s=o.stack.pop();break}}return{stack:s,linePos:a,anchorPosition:i,isFirstLine:t}}function yn(n,e,t,a,s,r){const i=$n(n,e,t,a,s,r),c=n.getInjections();if(c.length===0)return i;const o=jn(c,n,e,t,a,s,r);if(!o)return i;if(!i)return o;const l=i.captureIndices[0].start,u=o.captureIndices[0].start;return u<l||o.priorityMatch&&u===l?o:i}function $n(n,e,t,a,s,r){const i=s.getRule(n),{ruleScanner:c,findOptions:o}=pt(i,n,s.endRule,t,a===r),l=c.findNextMatchSync(e,a,o);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function jn(n,e,t,a,s,r,i){let c=Number.MAX_VALUE,o=null,l,u=0;const d=r.contentNameScopesList.getScopeNames();for(let m=0,p=n.length;m<p;m++){const g=n[m];if(!g.matcher(d))continue;const $=e.getRule(g.ruleId),{ruleScanner:b,findOptions:h}=pt($,e,null,a,s===i),_=b.findNextMatchSync(t,s,h);if(!_)continue;const y=_.captureIndices[0].start;if(!(y>=c)&&(c=y,o=_.captureIndices,l=_.ruleId,u=g.priority,c===s))break}return o?{priorityMatch:u===-1,captureIndices:o,matchedRuleId:l}:null}function pt(n,e,t,a,s){return{ruleScanner:n.compileAG(e,t,a,s),findOptions:0}}function kn(n,e,t,a,s){return{ruleScanner:n.compileWhileAG(e,t,a,s),findOptions:0}}function D(n,e,t,a,s,r,i){if(r.length===0)return;const c=e.content,o=Math.min(r.length,i.length),l=[],u=i[0].end;for(let d=0;d<o;d++){const m=r[d];if(m===null)continue;const p=i[d];if(p.length===0)continue;if(p.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=p.start;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?s.produceFromScopes(l[l.length-1].scopes,p.start):s.produce(a,p.start),m.retokenizeCapturedWithRuleId){const $=m.getName(c,i),b=a.contentNameScopesList.pushAttributed($,n),h=m.getContentName(c,i),_=b.pushAttributed(h,n),y=a.push(m.retokenizeCapturedWithRuleId,p.start,-1,!1,null,b,_),j=n.createOnigString(c.substring(0,p.end));dt(n,j,t&&p.start===0,p.start,y,s,!1,0),it(j);continue}const g=m.getName(c,i);if(g!==null){const b=(l.length>0?l[l.length-1].scopes:a.contentNameScopesList).pushAttributed(g,n);l.push(new wn(b,p.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var wn=class{constructor(n,e){f(this,"scopes");f(this,"endPos");this.scopes=n,this.endPos=e}};function vn(n,e,t,a,s,r,i,c){return new xn(n,e,t,a,s,r,i,c)}function Ue(n,e,t,a,s){const r=re(e,ce),i=lt.getCompiledRuleId(t,a,s.repository);for(const c of r)n.push({debugSelector:e,matcher:c.matcher,ruleId:i,grammar:s,priority:c.priority})}function ce(n,e){if(e.length<n.length)return!1;let t=0;return n.every(a=>{for(let s=t;s<e.length;s++)if(Cn(e[s],a))return t=s+1,!0;return!1})}function Cn(n,e){if(!n)return!1;if(n===e)return!0;const t=e.length;return n.length>t&&n.substr(0,t)===e&&n[t]==="."}var xn=class{constructor(n,e,t,a,s,r,i,c){f(this,"_rootId");f(this,"_lastRuleId");f(this,"_ruleId2desc");f(this,"_includedGrammars");f(this,"_grammarRepository");f(this,"_grammar");f(this,"_injections");f(this,"_basicScopeAttributesProvider");f(this,"_tokenTypeMatchers");if(this._rootScopeName=n,this.balancedBracketSelectors=r,this._onigLib=c,this._basicScopeAttributesProvider=new hn(t,a),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=De(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const o of Object.keys(s)){const l=re(o,ce);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[o]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const n of this._ruleId2desc)n&&n.dispose()}createOnigScanner(n){return this._onigLib.createOnigScanner(n)}createOnigString(n){return this._onigLib.createOnigString(n)}getMetadataForScope(n){return this._basicScopeAttributesProvider.getBasicScopeAttributes(n)}_collectInjections(){const n={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],t=this._rootScopeName,a=n.lookup(t);if(a){const s=a.injections;if(s)for(let i in s)Ue(e,i,s[i],this,a);const r=this._grammarRepository.injections(t);r&&r.forEach(i=>{const c=this.getExternalGrammar(i);if(c){const o=c.injectionSelector;o&&Ue(e,o,c,this,c)}})}return e.sort((s,r)=>s.priority-r.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(n){const e=++this._lastRuleId,t=n(e);return this._ruleId2desc[e]=t,t}getRule(n){return this._ruleId2desc[n]}getExternalGrammar(n,e){if(this._includedGrammars[n])return this._includedGrammars[n];if(this._grammarRepository){const t=this._grammarRepository.lookup(n);if(t)return this._includedGrammars[n]=De(t,e&&e.$base),this._includedGrammars[n]}}tokenizeLine(n,e,t=0){const a=this._tokenize(n,e,!1,t);return{tokens:a.lineTokens.getResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}tokenizeLine2(n,e,t=0){const a=this._tokenize(n,e,!0,t);return{tokens:a.lineTokens.getBinaryResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}_tokenize(n,e,t,a){this._rootId===-1&&(this._rootId=lt.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===Be.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),d=W.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),m=this.getRule(this._rootId).getName(null,null);let p;m?p=q.createRootAndLookUpScopeName(m,d,this):p=q.createRoot("unknown",d),e=new Be(null,this._rootId,-1,-1,!1,null,p,p)}else s=!1,e.reset();n=n+`
4
4
  `;const r=this.createOnigString(n),i=r.content.length,c=new Bn(t,n,this._tokenTypeMatchers,this.balancedBracketSelectors),o=dt(this,r,s,0,e,c,!0,a);return it(r),{lineLength:i,lineTokens:c,ruleStack:o.stack,stoppedEarly:o.stoppedEarly}}};function De(n,e){return n=Ut(n),n.repository=n.repository||{},n.repository.$self={$vscodeTextmateLocation:n.$vscodeTextmateLocation,patterns:n.patterns,name:n.scopeName},n.repository.$base=e||n.repository.$self,n}var q=class T{constructor(e,t,a){this.parent=e,this.scopePath=t,this.tokenAttributes=a}static fromExtension(e,t){let a=e,s=(e==null?void 0:e.scopePath)??null;for(const r of t)s=je.push(s,r.scopeNames),a=new T(a,s,r.encodedTokenAttributes);return a}static createRoot(e,t){return new T(null,new je(null,e),t)}static createRootAndLookUpScopeName(e,t,a){const s=a.getMetadataForScope(e),r=new je(null,e),i=a.themeProvider.themeMatch(r),c=T.mergeAttributes(t,s,i);return new T(null,r,c)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return T.equals(this,e)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,a){let s=-1,r=0,i=0;return a!==null&&(s=a.fontStyle,r=a.foregroundId,i=a.backgroundId),W.set(e,t.languageId,t.tokenType,null,s,r,i)}pushAttributed(e,t){if(e===null)return this;if(e.indexOf(" ")===-1)return T._pushAttributed(this,e,t);const a=e.split(/ /g);let s=this;for(const r of a)s=T._pushAttributed(s,r,t);return s}static _pushAttributed(e,t,a){const s=a.getMetadataForScope(t),r=e.scopePath.push(t),i=a.themeProvider.themeMatch(r),c=T.mergeAttributes(e.tokenAttributes,s,i);return new T(e,r,c)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){var s;const t=[];let a=this;for(;a&&a!==e;)t.push({encodedTokenAttributes:a.tokenAttributes,scopeNames:a.scopePath.getExtensionIfDefined(((s=a.parent)==null?void 0:s.scopePath)??null)}),a=a.parent;return a===e?t.reverse():void 0}},A,Be=(A=class{constructor(e,t,a,s,r,i,c,o){f(this,"_stackElementBrand");f(this,"_enterPos");f(this,"_anchorPos");f(this,"depth");this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=r,this.endRule=i,this.nameScopesList=c,this.contentNameScopesList=o,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=a,this._anchorPos=s}equals(e){return e===null?!1:A._equals(this,e)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?q.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){A._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,t,a,s,r,i,c){return new A(this,e,t,a,s,r,i,c)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){var a,s;return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${(a=this.nameScopesList)==null?void 0:a.toString()}, ${(s=this.contentNameScopesList)==null?void 0:s.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new A(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){var e,t,a;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((t=this.nameScopesList)==null?void 0:t.getExtensionIfDefined(((e=this.parent)==null?void 0:e.nameScopesList)??null))??[],contentNameScopesList:((a=this.contentNameScopesList)==null?void 0:a.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(e,t){const a=q.fromExtension((e==null?void 0:e.nameScopesList)??null,t.nameScopesList);return new A(e,t.ruleId,t.enterPos??-1,t.anchorPos??-1,t.beginRuleCapturedEOL,t.endRule,a,q.fromExtension(a,t.contentNameScopesList))}},f(A,"NULL",new A(null,0,0,0,!1,null,null,null)),A),Sn=class{constructor(n,e){f(this,"balancedBracketScopes");f(this,"unbalancedBracketScopes");f(this,"allowAny",!1);this.balancedBracketScopes=n.flatMap(t=>t==="*"?(this.allowAny=!0,[]):re(t,ce).map(a=>a.matcher)),this.unbalancedBracketScopes=e.flatMap(t=>re(t,ce).map(a=>a.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(n){for(const e of this.unbalancedBracketScopes)if(e(n))return!1;for(const e of this.balancedBracketScopes)if(e(n))return!0;return this.allowAny}},Bn=class{constructor(n,e,t,a){f(this,"_emitBinaryTokens");f(this,"_lineText");f(this,"_tokens");f(this,"_binaryTokens");f(this,"_lastTokenEndIndex");f(this,"_tokenTypeOverrides");this.balancedBracketSelectors=a,this._emitBinaryTokens=n,this._tokenTypeOverrides=t,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(n,e){this.produceFromScopes(n.contentNameScopesList,e)}produceFromScopes(n,e){var a;if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let s=(n==null?void 0:n.tokenAttributes)??0,r=!1;if((a=this.balancedBracketSelectors)!=null&&a.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=(n==null?void 0:n.getScopeNames())??[];for(const c of this._tokenTypeOverrides)c.matcher(i)&&(s=W.set(s,0,c.type,null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(i))}if(r&&(s=W.set(s,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),this._lastTokenEndIndex=e;return}const t=(n==null?void 0:n.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:t}),this._lastTokenEndIndex=e}getResult(n,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(n,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(n,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(n,e),this._binaryTokens[this._binaryTokens.length-2]=0);const t=new Uint32Array(this._binaryTokens.length);for(let a=0,s=this._binaryTokens.length;a<s;a++)t[a]=this._binaryTokens[a];return t}},Rn=class{constructor(n,e){f(this,"_grammars",new Map);f(this,"_rawGrammars",new Map);f(this,"_injectionGrammars",new Map);f(this,"_theme");this._onigLib=e,this._theme=n}dispose(){for(const n of this._grammars.values())n.dispose()}setTheme(n){this._theme=n}getColorMap(){return this._theme.getColorMap()}addGrammar(n,e){this._rawGrammars.set(n.scopeName,n),e&&this._injectionGrammars.set(n.scopeName,e)}lookup(n){return this._rawGrammars.get(n)}injections(n){return this._injectionGrammars.get(n)}getDefaults(){return this._theme.getDefaults()}themeMatch(n){return this._theme.match(n)}grammarForScopeName(n,e,t,a,s){if(!this._grammars.has(n)){let r=this._rawGrammars.get(n);if(!r)return null;this._grammars.set(n,vn(n,r,e,t,a,s,this,this._onigLib))}return this._grammars.get(n)}},An=class{constructor(e){f(this,"_options");f(this,"_syncRegistry");f(this,"_ensureGrammarCache");this._options=e,this._syncRegistry=new Rn(se.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(se.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,a){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:a})}loadGrammarWithConfiguration(e,t,a){return this._loadGrammar(e,t,a.embeddedLanguages,a.tokenTypes,new Sn(a.balancedBracketSelectors||[],a.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,a,s,r){const i=new sn(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(c=>this._loadSingleGrammar(c.scopeName)),i.processQueue();return this._grammarForScopeName(e,t,a,s,r)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const a=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,a)}}addGrammar(e,t=[],a=0,s=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,a,s)}_grammarForScopeName(e,t=0,a=null,s=null,r=null){return this._syncRegistry.grammarForScopeName(e,t,a,s,r)}},Re=Be.NULL;function In(n){return Array.isArray(n)?n:[n]}function ge(n,e=!1){var r;const t=n.split(/(\r?\n)/g);let a=0;const s=[];for(let i=0;i<t.length;i+=2){const c=e?t[i]+(t[i+1]||""):t[i];s.push([c,a]),a+=t[i].length,a+=((r=t[i+1])==null?void 0:r.length)||0}return s}function Te(n){return!n||["plaintext","txt","text","plain"].includes(n)}function Tn(n){return n==="ansi"||Te(n)}function Ee(n){return n==="none"}function En(n){return Ee(n)}function mt(n,e){var a;if(!e)return n;n.properties||(n.properties={}),(a=n.properties).class||(a.class=[]),typeof n.properties.class=="string"&&(n.properties.class=n.properties.class.split(/\s+/g)),Array.isArray(n.properties.class)||(n.properties.class=[]);const t=Array.isArray(e)?e:e.split(/\s+/g);for(const s of t)s&&!n.properties.class.includes(s)&&n.properties.class.push(s);return n}function Nn(n,e){let t=0;const a=[];for(const s of e)s>t&&a.push({...n,content:n.content.slice(t,s),offset:n.offset+t}),t=s;return t<n.content.length&&a.push({...n,content:n.content.slice(t),offset:n.offset+t}),a}function Pn(n,e){const t=Array.from(e instanceof Set?e:new Set(e)).sort((a,s)=>a-s);return t.length?n.map(a=>a.flatMap(s=>{const r=t.filter(i=>s.offset<i&&i<s.offset+s.content.length).map(i=>i-s.offset).sort((i,c)=>i-c);return r.length?Nn(s,r):s})):n}async function ft(n){return Promise.resolve(typeof n=="function"?n():n).then(e=>e.default||e)}function le(n,e){const t=typeof n=="string"?{}:{...n.colorReplacements},a=typeof n=="string"?n:n.name;for(const[s,r]of Object.entries((e==null?void 0:e.colorReplacements)||{}))typeof r=="string"?t[s]=r:s===a&&Object.assign(t,r);return t}function G(n,e){return n&&((e==null?void 0:e[n==null?void 0:n.toLowerCase()])||n)}function gt(n){const e={};return n.color&&(e.color=n.color),n.bgColor&&(e["background-color"]=n.bgColor),n.fontStyle&&(n.fontStyle&L.Italic&&(e["font-style"]="italic"),n.fontStyle&L.Bold&&(e["font-weight"]="bold"),n.fontStyle&L.Underline&&(e["text-decoration"]="underline")),e}function Ln(n){return typeof n=="string"?n:Object.entries(n).map(([e,t])=>`${e}:${t}`).join(";")}function Gn(n){const e=ge(n,!0).map(([s])=>s);function t(s){if(s===n.length)return{line:e.length-1,character:e[e.length-1].length};let r=s,i=0;for(const c of e){if(r<c.length)break;r-=c.length,i++}return{line:i,character:r}}function a(s,r){let i=0;for(let c=0;c<s;c++)i+=e[c].length;return i+=r,i}return{lines:e,indexToPos:t,posToIndex:a}}class S extends Error{constructor(e){super(e),this.name="ShikiError"}}const ht=new WeakMap;function he(n,e){ht.set(n,e)}function K(n){return ht.get(n)}class H{constructor(...e){f(this,"_stacks",{});f(this,"lang");if(e.length===2){const[t,a]=e;this.lang=a,this._stacks=t}else{const[t,a,s]=e;this.lang=a,this._stacks={[s]:t}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new H(Object.fromEntries(In(t).map(a=>[a,Re])),e)}getInternalStack(e=this.theme){return this._stacks[e]}get scopes(){return qe(this._stacks[this.theme])}getScopes(e=this.theme){return qe(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function qe(n){const e=[],t=new Set;function a(s){var i;if(t.has(s))return;t.add(s);const r=(i=s==null?void 0:s.nameScopesList)==null?void 0:i.scopeName;r&&e.push(r),s.parent&&a(s.parent)}return a(n),e}function Fn(n,e){if(!(n instanceof H))throw new S("Invalid grammar state");return n.getInternalStack(e)}function On(){const n=new WeakMap;function e(t){if(!n.has(t.meta)){let a=function(i){if(typeof i=="number"){if(i<0||i>t.source.length)throw new S(`Invalid decoration offset: ${i}. Code length: ${t.source.length}`);return{...s.indexToPos(i),offset:i}}else{const c=s.lines[i.line];if(c===void 0)throw new S(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${s.lines.length}`);if(i.character<0||i.character>c.length)throw new S(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${c.length}`);return{...i,offset:s.posToIndex(i.line,i.character)}}};const s=Gn(t.source),r=(t.options.decorations||[]).map(i=>({...i,start:a(i.start),end:a(i.end)}));Mn(r),n.set(t.meta,{decorations:r,converter:s,source:t.source})}return n.get(t.meta)}return{name:"shiki:decorations",tokens(t){var i;if(!((i=this.options.decorations)!=null&&i.length))return;const s=e(this).decorations.flatMap(c=>[c.start.offset,c.end.offset]);return Pn(t,s)},code(t){var u;if(!((u=this.options.decorations)!=null&&u.length))return;const a=e(this),s=Array.from(t.children).filter(d=>d.type==="element"&&d.tagName==="span");if(s.length!==a.converter.lines.length)throw new S(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${a.converter.lines.length}). Failed to apply decorations.`);function r(d,m,p,g){const $=s[d];let b="",h=-1,_=-1;if(m===0&&(h=0),p===0&&(_=0),p===Number.POSITIVE_INFINITY&&(_=$.children.length),h===-1||_===-1)for(let j=0;j<$.children.length;j++)b+=bt($.children[j]),h===-1&&b.length===m&&(h=j+1),_===-1&&b.length===p&&(_=j+1);if(h===-1)throw new S(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(_===-1)throw new S(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);const y=$.children.slice(h,_);if(!g.alwaysWrap&&y.length===$.children.length)c($,g,"line");else if(!g.alwaysWrap&&y.length===1&&y[0].type==="element")c(y[0],g,"token");else{const j={type:"element",tagName:"span",properties:{},children:y};c(j,g,"wrapper"),$.children.splice(h,y.length,j)}}function i(d,m){s[d]=c(s[d],m,"line")}function c(d,m,p){var b;const g=m.properties||{},$=m.transform||(h=>h);return d.tagName=m.tagName||"span",d.properties={...d.properties,...g,class:d.properties.class},(b=m.properties)!=null&&b.class&&mt(d,m.properties.class),d=$(d,p)||d,d}const o=[],l=a.decorations.sort((d,m)=>m.start.offset-d.start.offset);for(const d of l){const{start:m,end:p}=d;if(m.line===p.line)r(m.line,m.character,p.character,d);else if(m.line<p.line){r(m.line,m.character,Number.POSITIVE_INFINITY,d);for(let g=m.line+1;g<p.line;g++)o.unshift(()=>i(g,d));r(p.line,0,p.character,d)}}o.forEach(d=>d())}}}function Mn(n){for(let e=0;e<n.length;e++){const t=n[e];if(t.start.offset>t.end.offset)throw new S(`Invalid decoration range: ${JSON.stringify(t.start)} - ${JSON.stringify(t.end)}`);for(let a=e+1;a<n.length;a++){const s=n[a],r=t.start.offset<s.start.offset&&s.start.offset<t.end.offset,i=t.start.offset<s.end.offset&&s.end.offset<t.end.offset,c=s.start.offset<t.start.offset&&t.start.offset<s.end.offset,o=s.start.offset<t.end.offset&&t.end.offset<s.end.offset;if(r||i||c||o){if(i&&i||c&&o)continue;throw new S(`Decorations ${JSON.stringify(t.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function bt(n){return n.type==="text"?n.value:n.type==="element"?n.children.map(bt).join(""):""}const Wn=[On()];function ue(n){return[...n.transformers||[],...Wn]}var F=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],we={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function Hn(n,e){const t=n.indexOf("\x1B[",e);if(t!==-1){const a=n.indexOf("m",t);return{sequence:n.substring(t+2,a).split(";"),startPosition:t,position:a+1}}return{position:n.length}}function Ve(n,e){let t=1;const a=n[e+t++];let s;if(a==="2"){const r=[n[e+t++],n[e+t++],n[e+t]].map(i=>Number.parseInt(i));r.length===3&&!r.some(i=>Number.isNaN(i))&&(s={type:"rgb",rgb:r})}else if(a==="5"){const r=Number.parseInt(n[e+t]);Number.isNaN(r)||(s={type:"table",index:Number(r)})}return[t,s]}function zn(n){const e=[];for(let t=0;t<n.length;t++){const a=n[t],s=Number.parseInt(a);if(!Number.isNaN(s))if(s===0)e.push({type:"resetAll"});else if(s<=9)we[s]&&e.push({type:"setDecoration",value:we[s]});else if(s<=29){const r=we[s-20];r&&e.push({type:"resetDecoration",value:r})}else if(s<=37)e.push({type:"setForegroundColor",value:{type:"named",name:F[s-30]}});else if(s===38){const[r,i]=Ve(n,t);i&&e.push({type:"setForegroundColor",value:i}),t+=r}else if(s===39)e.push({type:"resetForegroundColor"});else if(s<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:F[s-40]}});else if(s===48){const[r,i]=Ve(n,t);i&&e.push({type:"setBackgroundColor",value:i}),t+=r}else s===49?e.push({type:"resetBackgroundColor"}):s>=90&&s<=97?e.push({type:"setForegroundColor",value:{type:"named",name:F[s-90+8]}}):s>=100&&s<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:F[s-100+8]}})}return e}function Un(){let n=null,e=null,t=new Set;return{parse(a){const s=[];let r=0;do{const i=Hn(a,r),c=i.sequence?a.substring(r,i.startPosition):a.substring(r);if(c.length>0&&s.push({value:c,foreground:n,background:e,decorations:new Set(t)}),i.sequence){const o=zn(i.sequence);for(const l of o)l.type==="resetAll"?(n=null,e=null,t.clear()):l.type==="resetForegroundColor"?n=null:l.type==="resetBackgroundColor"?e=null:l.type==="resetDecoration"&&t.delete(l.value);for(const l of o)l.type==="setForegroundColor"?n=l.value:l.type==="setBackgroundColor"?e=l.value:l.type==="setDecoration"&&t.add(l.value)}r=i.position}while(r<a.length);return s}}}var Dn={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function qn(n=Dn){function e(c){return n[c]}function t(c){return`#${c.map(o=>Math.max(0,Math.min(o,255)).toString(16).padStart(2,"0")).join("")}`}let a;function s(){if(a)return a;a=[];for(let l=0;l<F.length;l++)a.push(e(F[l]));let c=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let u=0;u<6;u++)for(let d=0;d<6;d++)a.push(t([c[l],c[u],c[d]]));let o=8;for(let l=0;l<24;l++,o+=10)a.push(t([o,o,o]));return a}function r(c){return s()[c]}function i(c){switch(c.type){case"named":return e(c.name);case"rgb":return t(c.rgb);case"table":return r(c.index)}}return{value:i}}function Vn(n,e,t){const a=le(n,t),s=ge(e),r=qn(Object.fromEntries(F.map(c=>{var o;return[c,(o=n.colors)==null?void 0:o[`terminal.ansi${c[0].toUpperCase()}${c.substring(1)}`]]}))),i=Un();return s.map(c=>i.parse(c[0]).map(o=>{let l,u;o.decorations.has("reverse")?(l=o.background?r.value(o.background):n.bg,u=o.foreground?r.value(o.foreground):n.fg):(l=o.foreground?r.value(o.foreground):n.fg,u=o.background?r.value(o.background):void 0),l=G(l,a),u=G(u,a),o.decorations.has("dim")&&(l=Xn(l));let d=L.None;return o.decorations.has("bold")&&(d|=L.Bold),o.decorations.has("italic")&&(d|=L.Italic),o.decorations.has("underline")&&(d|=L.Underline),{content:o.value,offset:c[1],color:l,bgColor:u,fontStyle:d}}))}function Xn(n){const e=n.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(e)if(e[3]){const a=Math.round(Number.parseInt(e[3],16)/2).toString(16).padStart(2,"0");return`#${e[1]}${e[2]}${a}`}else return e[2]?`#${e[1]}${e[2]}80`:`#${Array.from(e[1]).map(a=>`${a}${a}`).join("")}80`;const t=n.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return t?`var(${t[1]}-dim)`:n}function Ne(n,e,t={}){const{lang:a="text",theme:s=n.getLoadedThemes()[0]}=t;if(Te(a)||Ee(s))return ge(e).map(o=>[{content:o[0],offset:o[1]}]);const{theme:r,colorMap:i}=n.setTheme(s);if(a==="ansi")return Vn(r,e,t);const c=n.getLanguage(a);if(t.grammarState){if(t.grammarState.lang!==c.name)throw new O(`Grammar state language "${t.grammarState.lang}" does not match highlight language "${c.name}"`);if(!t.grammarState.themes.includes(r.name))throw new O(`Grammar state themes "${t.grammarState.themes}" do not contain highlight theme "${r.name}"`)}return Kn(e,c,r,i,t)}function Zn(...n){if(n.length===2)return K(n[1]);const[e,t,a={}]=n,{lang:s="text",theme:r=e.getLoadedThemes()[0]}=a;if(Te(s)||Ee(r))throw new O("Plain language does not have grammar state");if(s==="ansi")throw new O("ANSI language does not have grammar state");const{theme:i,colorMap:c}=e.setTheme(r),o=e.getLanguage(s);return new H(de(t,o,i,c,a).stateStack,o.name,i.name)}function Kn(n,e,t,a,s){const r=de(n,e,t,a,s),i=new H(de(n,e,t,a,s).stateStack,e.name,t.name);return he(r.tokens,i),r.tokens}function de(n,e,t,a,s){const r=le(t,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:c=500}=s,o=ge(n);let l=s.grammarState?Fn(s.grammarState,t.name)??Re:s.grammarContextCode!=null?de(s.grammarContextCode,e,t,a,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Re,u=[];const d=[];for(let m=0,p=o.length;m<p;m++){const[g,$]=o[m];if(g===""){u=[],d.push([]);continue}if(i>0&&g.length>=i){u=[],d.push([{content:g,offset:$,color:"",fontStyle:0}]);continue}let b,h,_;s.includeExplanation&&(b=e.tokenizeLine(g,l),h=b.tokens,_=0);const y=e.tokenizeLine2(g,l,c),j=y.tokens.length/2;for(let k=0;k<j;k++){const B=y.tokens[2*k],w=k+1<j?y.tokens[2*k+2]:g.length;if(B===w)continue;const E=y.tokens[2*k+1],Y=G(a[W.getForeground(E)],r),z=W.getFontStyle(E),be={content:g.substring(B,w),offset:$+B,color:Y,fontStyle:z};if(s.includeExplanation){const Le=[];if(s.includeExplanation!=="scopeName")for(const N of t.settings){let M;switch(typeof N.scope){case"string":M=N.scope.split(/,/).map(_e=>_e.trim());break;case"object":M=N.scope;break;default:continue}Le.push({settings:N,selectors:M.map(_e=>_e.split(/ /))})}be.explanation=[];let Ge=0;for(;B+Ge<w;){const N=h[_],M=g.substring(N.startIndex,N.endIndex);Ge+=M.length,be.explanation.push({content:M,scopes:s.includeExplanation==="scopeName"?Jn(N.scopes):Qn(Le,N.scopes)}),_+=1}}u.push(be)}d.push(u),u=[],l=y.ruleStack}return{tokens:d,stateStack:l}}function Jn(n){return n.map(e=>({scopeName:e}))}function Qn(n,e){const t=[];for(let a=0,s=e.length;a<s;a++){const r=e[a];t[a]={scopeName:r,themeMatches:ea(n,r,e.slice(0,a))}}return t}function Xe(n,e){return n===e||e.substring(0,n.length)===n&&e[n.length]==="."}function Yn(n,e,t){if(!Xe(n[n.length-1],e))return!1;let a=n.length-2,s=t.length-1;for(;a>=0&&s>=0;)Xe(n[a],t[s])&&(a-=1),s-=1;return a===-1}function ea(n,e,t){const a=[];for(const{selectors:s,settings:r}of n)for(const i of s)if(Yn(i,e,t)){a.push(r);break}return a}function _t(n,e,t){const a=Object.entries(t.themes).filter(o=>o[1]).map(o=>({color:o[0],theme:o[1]})),s=a.map(o=>{const l=Ne(n,e,{...t,theme:o.theme}),u=K(l),d=typeof o.theme=="string"?o.theme:o.theme.name;return{tokens:l,state:u,theme:d}}),r=ta(...s.map(o=>o.tokens)),i=r[0].map((o,l)=>o.map((u,d)=>{const m={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in t&&t.includeExplanation&&(m.explanation=u.explanation),r.forEach((p,g)=>{const{content:$,explanation:b,offset:h,..._}=p[l][d];m.variants[a[g].color]=_}),m})),c=s[0].state?new H(Object.fromEntries(s.map(o=>{var l;return[o.theme,(l=o.state)==null?void 0:l.getInternalStack(o.theme)]})),s[0].state.lang):void 0;return c&&he(i,c),i}function ta(...n){const e=n.map(()=>[]),t=n.length;for(let a=0;a<n[0].length;a++){const s=n.map(o=>o[a]),r=e.map(()=>[]);e.forEach((o,l)=>o.push(r[l]));const i=s.map(()=>0),c=s.map(o=>o[0]);for(;c.every(o=>o);){const o=Math.min(...c.map(l=>l.content.length));for(let l=0;l<t;l++){const u=c[l];u.content.length===o?(r[l].push(u),i[l]+=1,c[l]=s[l][i[l]]):(r[l].push({...u,content:u.content.slice(0,o)}),c[l]={...u,content:u.content.slice(o),offset:u.offset+o})}}}return e}function pe(n,e,t){let a,s,r,i,c,o;if("themes"in t){const{defaultColor:l="light",cssVariablePrefix:u="--shiki-"}=t,d=Object.entries(t.themes).filter(b=>b[1]).map(b=>({color:b[0],theme:b[1]})).sort((b,h)=>b.color===l?-1:h.color===l?1:0);if(d.length===0)throw new O("`themes` option must not be empty");const m=_t(n,e,t);if(o=K(m),l&&!d.find(b=>b.color===l))throw new O(`\`themes\` option must contain the defaultColor key \`${l}\``);const p=d.map(b=>n.getTheme(b.theme)),g=d.map(b=>b.color);r=m.map(b=>b.map(h=>na(h,g,u,l))),o&&he(r,o);const $=d.map(b=>le(b.theme,t));s=d.map((b,h)=>(h===0&&l?"":`${u+b.color}:`)+(G(p[h].fg,$[h])||"inherit")).join(";"),a=d.map((b,h)=>(h===0&&l?"":`${u+b.color}-bg:`)+(G(p[h].bg,$[h])||"inherit")).join(";"),i=`shiki-themes ${p.map(b=>b.name).join(" ")}`,c=l?void 0:[s,a].join(";")}else if("theme"in t){const l=le(t.theme,t);r=Ne(n,e,t);const u=n.getTheme(t.theme);a=G(u.bg,l),s=G(u.fg,l),i=u.name,o=K(r)}else throw new O("Invalid options, either `theme` or `themes` must be provided");return{tokens:r,fg:s,bg:a,themeName:i,rootStyle:c,grammarState:o}}function na(n,e,t,a){const s={content:n.content,explanation:n.explanation,offset:n.offset},r=e.map(o=>gt(n.variants[o])),i=new Set(r.flatMap(o=>Object.keys(o))),c={};return r.forEach((o,l)=>{for(const u of i){const d=o[u]||"inherit";if(l===0&&a)c[u]=d;else{const m=u==="color"?"":u==="background-color"?"-bg":`-${u}`,p=t+e[l]+(u==="color"?"":m);c[p]=d}}}),s.htmlStyle=c,s}function me(n,e,t,a={meta:{},options:t,codeToHast:(s,r)=>me(n,s,r),codeToTokens:(s,r)=>pe(n,s,r)}){var p,g;let s=e;for(const $ of ue(t))s=((p=$.preprocess)==null?void 0:p.call(a,s,t))||s;let{tokens:r,fg:i,bg:c,themeName:o,rootStyle:l,grammarState:u}=pe(n,s,t);const{mergeWhitespaces:d=!0}=t;d===!0?r=sa(r):d==="never"&&(r=ra(r));const m={...a,get source(){return s}};for(const $ of ue(t))r=((g=$.tokens)==null?void 0:g.call(m,r))||r;return aa(r,{...t,fg:i,bg:c,themeName:o,rootStyle:l},m,u)}function aa(n,e,t,a=K(n)){var g,$,b;const s=ue(e),r=[],i={type:"root",children:[]},{structure:c="classic",tabindex:o="0"}=e;let l={type:"element",tagName:"pre",properties:{class:`shiki ${e.themeName||""}`,style:e.rootStyle||`background-color:${e.bg};color:${e.fg}`,...o!==!1&&o!=null?{tabindex:o.toString()}:{},...Object.fromEntries(Array.from(Object.entries(e.meta||{})).filter(([h])=>!h.startsWith("_")))},children:[]},u={type:"element",tagName:"code",properties:{},children:r};const d=[],m={...t,structure:c,addClassToHast:mt,get source(){return t.source},get tokens(){return n},get options(){return e},get root(){return i},get pre(){return l},get code(){return u},get lines(){return d}};if(n.forEach((h,_)=>{var k,B;_&&(c==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):c==="classic"&&r.push({type:"text",value:`
@@ -1,18 +1,63 @@
1
1
  """
2
+ OpenTelemetry Span Attribute Flattening/Unflattening for Phoenix
3
+
4
+ This module handles the conversion between flattened dot-separated key-value pairs
5
+ (as received from OpenTelemetry protobuf) and nested dictionary structures (as used
6
+ internally by Phoenix).
7
+
8
+ Basic Behavior
9
+ --------------
2
10
  Span attribute keys have a special relationship with the `.` separator. When
3
11
  a span attribute is ingested from protobuf, it's in the form of a key value
4
- pair such as `("llm.token_count.completion", 123)`. What we need to do is to split
5
- the key by the `.` separator and turn it into part of a nested dictionary such
6
- as {"llm": {"token_count": {"completion": 123}}}. We also need to reverse this
7
- process, which is to flatten the nested dictionary into a list of key value
8
- pairs. This module provides functions to do both of these operations.
9
-
10
- Note that digit keys are treated as indices of a nested array. For example,
11
- the digits inside `("retrieval.documents.0.document.content", 'A')` and
12
- `("retrieval.documents.1.document.content": 'B')` turn the sub-keys following
13
- them into a nested list of dictionaries i.e.
14
- {`retrieval: {"documents": [{"document": {"content": "A"}}, {"document":
15
- {"content": "B"}}]}`.
12
+ pair such as `("llm.token_count.completion", 123)`. We split the key by the `.`
13
+ separator and turn it into a nested dictionary:
14
+ {"llm": {"token_count": {"completion": 123}}}
15
+
16
+ Array Creation Rule
17
+ -------------------
18
+ Numeric keys are treated specially to support array-like structures in OpenTelemetry
19
+ semantic conventions. A numeric key becomes an array index ONLY when:
20
+ 1. The numeric key has additional segments after it (e.g., "documents.0.content")
21
+ 2. Those segments lead to mappings (dictionaries), not scalar values
22
+
23
+ Examples:
24
+ ("documents.0.content", "A"), ("documents.1.content", "B")
25
+ → {"documents": [{"content": "A"}, {"content": "B"}]} # Array created
26
+
27
+ ("tags.0", "python"), ("tags.1", "ai")
28
+ → {"tags": {"0": "python", "1": "ai"}} # Dict with string keys, NOT array
29
+
30
+ Rationale: In OpenTelemetry semantic conventions, arrays typically contain structured
31
+ objects (like documents or events), not primitive values. This rule ensures that only
32
+ semantically meaningful arrays are created, avoiding ambiguity with numeric string keys.
33
+
34
+ Terminal Value Node Behavior
35
+ ----------------------------
36
+ When a path receives an explicit value (typically from pre-nested input), that node
37
+ becomes "terminal" and cannot have children added via flattened keys. Instead,
38
+ attempted extensions become separate dotted keys:
39
+
40
+ ("a", {"b": 1}), ("a.c", 2)
41
+ → {"a": {"b": 1}, "a.c": 2} # "a.c" becomes dotted key, not nested
42
+
43
+ This preserves all data during OpenTelemetry ingestion where:
44
+ - Pre-nested values (dicts/arrays) come from the OTEL data model
45
+ - Flattened keys come from custom instrumentation
46
+ - Both must be preserved to avoid data loss
47
+
48
+ Edge Cases
49
+ ----------
50
+ - None values: Skipped entirely during processing
51
+ - Leading zeros: Normalized ("00" → "0", treated as same key)
52
+ - Negative numbers: Treated as string keys, not array indices
53
+ - Empty key segments: Ignored ("a..b" → "a.b")
54
+ - Alphanumeric keys: "0a", "1x" are string keys, not array indices
55
+ - Whitespace: Stripped from key segments (" key " → "key")
56
+ - Empty string key: Valid key, preserved as-is
57
+ - Duplicate keys: Last write wins
58
+
59
+ These edge cases are handled consistently to ensure reliable round-tripping
60
+ between flattened and nested representations.
16
61
  """
17
62
 
18
63
  import inspect
@@ -107,6 +152,13 @@ def has_mapping(sequence: Iterable[Any]) -> bool:
107
152
  only contain primitive types, such as strings, integers, etc. Conversely,
108
153
  we'll only un-flatten digit sub-keys if it can be interpreted the index of
109
154
  an array of dictionaries.
155
+
156
+ This is the key function that implements the "arrays only for mappings" rule.
157
+ In OpenTelemetry semantic conventions, arrays typically contain structured
158
+ objects (e.g., retrieval.documents[0], llm.messages[1]) not primitive arrays
159
+ like ["tag1", "tag2"]. This check ensures semantic correctness during round-
160
+ trip conversions: primitive arrays stay as-is, only structured arrays are
161
+ flattened/unflattened with numeric indices.
110
162
  """
111
163
  for item in sequence:
112
164
  if isinstance(item, Mapping):
@@ -189,7 +241,9 @@ class _Trie(defaultdict[Union[str, int], "_Trie"]):
189
241
 
190
242
  def set_value(self, value: Any) -> None:
191
243
  self.value = value
192
- # value and indices must not coexist
244
+ # value and indices must not coexist - convert indices to branches
245
+ # This handles the case where a numeric key ends a path (scalar value)
246
+ # vs. continues a path (array index). Example: "a.0" vs "a.0.b"
193
247
  self.branches.update(self.indices)
194
248
  self.indices.clear()
195
249
 
@@ -230,8 +284,14 @@ def _build_trie(
230
284
  separator,
231
285
  prefix_exclusions,
232
286
  )
287
+ # Strip whitespace from key segments for cleaner attribute keys
288
+ prefix = prefix.strip()
233
289
  if prefix.isdigit():
234
290
  index = int(prefix)
291
+ # Key decision: numeric key with suffix → array index (add_index)
292
+ # numeric key without suffix → dict key (add_branch)
293
+ # This ensures arrays only contain mappings, not scalar values,
294
+ # matching OpenTelemetry semantic conventions.
235
295
  t = t.add_index(index) if suffix else t.add_branch(index)
236
296
  else:
237
297
  t = t.add_branch(prefix)
@@ -253,8 +313,15 @@ def _walk(
253
313
  yield the prefix and the value. If the Trie node has indices, then yield the
254
314
  prefix and a list of dictionaries. If the Trie node has branches, then yield
255
315
  the prefix and a dictionary.
316
+
317
+ Conflict Resolution: When a node has both a value and child nodes, both are
318
+ yielded. The value is yielded with its current prefix, and children create
319
+ additional dotted keys. This preserves all data from mixed flattened/nested
320
+ input, avoiding data loss during OpenTelemetry span ingestion.
256
321
  """
257
322
  if trie.value is not None:
323
+ # Yield the value first - if there are also branches, those will become
324
+ # separate dotted keys (e.g., "a" and "a.b" coexist)
258
325
  yield prefix, trie.value
259
326
  elif prefix and trie.indices:
260
327
  yield (
phoenix/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "12.3.0"
1
+ __version__ = "12.5.0"