@perses-dev/trace-table-plugin 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/__mf/css/async/263.3d4493d2.css +1 -0
  2. package/__mf/js/TraceTable.845c8aa8.js +5 -0
  3. package/__mf/js/async/109.0d6c2876.js +22 -0
  4. package/__mf/js/async/109.0d6c2876.js.LICENSE.txt +25 -0
  5. package/__mf/js/async/173.085e8c1f.js +2 -0
  6. package/__mf/js/async/175.ba9a4640.js +147 -0
  7. package/__mf/js/async/214.0bac5b59.js +1 -0
  8. package/__mf/js/async/224.51c57ceb.js +1 -0
  9. package/__mf/js/async/235.be067e8a.js +28 -0
  10. package/__mf/js/async/238.ccd6c3b2.js +1 -0
  11. package/__mf/js/async/251.b73e9968.js +7 -0
  12. package/__mf/js/async/251.b73e9968.js.LICENSE.txt +21 -0
  13. package/__mf/js/async/292.d26d57c4.js +1 -0
  14. package/__mf/js/async/409.d01a441f.js +1 -0
  15. package/__mf/js/async/488.1ae7b913.js +1 -0
  16. package/__mf/js/async/62.724a7239.js +1 -0
  17. package/__mf/js/async/651.996aef16.js +1 -0
  18. package/__mf/js/async/69.0b1487b7.js +2 -0
  19. package/__mf/js/async/69.0b1487b7.js.LICENSE.txt +24 -0
  20. package/__mf/js/async/{770.6cac4f4b.js → 694.5d60f324.js} +1 -1
  21. package/__mf/js/async/738.4eaf0328.js +1 -0
  22. package/__mf/js/async/740.3195ce93.js +1 -0
  23. package/__mf/js/async/75.8f589ac7.js +1 -0
  24. package/__mf/js/async/770.06030c80.js +1 -0
  25. package/__mf/js/async/812.f87960e5.js +53 -0
  26. package/__mf/js/async/83.16406283.js +1 -0
  27. package/__mf/js/async/834.67d500ed.js +2 -0
  28. package/__mf/js/async/834.67d500ed.js.LICENSE.txt +21 -0
  29. package/__mf/js/async/863.17535c71.js +2 -0
  30. package/__mf/js/async/960.3373bed4.js +2 -0
  31. package/__mf/js/async/964.1165a855.js +2 -0
  32. package/__mf/js/async/981.92685962.js +2 -0
  33. package/__mf/js/async/981.92685962.js.LICENSE.txt +8 -0
  34. package/__mf/js/async/__federation_expose_TraceTable.a8f48497.js +1 -0
  35. package/__mf/js/async/lib-router.5b98a3da.js +2 -0
  36. package/__mf/js/main.34c90ec4.js +5 -0
  37. package/lib/DataTable.d.ts +0 -1
  38. package/lib/DataTable.d.ts.map +1 -1
  39. package/lib/DataTable.js +14 -9
  40. package/lib/DataTable.js.map +1 -1
  41. package/lib/TraceTablePanel.d.ts +2 -14
  42. package/lib/TraceTablePanel.d.ts.map +1 -1
  43. package/lib/TraceTablePanel.js +2 -17
  44. package/lib/TraceTablePanel.js.map +1 -1
  45. package/lib/cjs/DataTable.js +14 -9
  46. package/lib/cjs/TraceTablePanel.js +5 -28
  47. package/lib/cjs/trace-table-model.js +1 -1
  48. package/lib/trace-table-model.d.ts +8 -0
  49. package/lib/trace-table-model.d.ts.map +1 -1
  50. package/lib/trace-table-model.js +1 -1
  51. package/lib/trace-table-model.js.map +1 -1
  52. package/mf-manifest.json +100 -60
  53. package/mf-stats.json +113 -64
  54. package/package.json +15 -5
  55. package/__mf/js/152.20a64e89.js +0 -5
  56. package/__mf/js/TraceTable.d244402d.js +0 -5
  57. package/__mf/js/async/156.525f3a44.js +0 -1
  58. package/__mf/js/async/173.f0db00ba.js +0 -2
  59. package/__mf/js/async/377.d6e7ba1a.js +0 -2
  60. package/__mf/js/async/51.a8d0a55c.js +0 -147
  61. package/__mf/js/async/620.006d05f8.js +0 -2
  62. package/__mf/js/async/651.4fdbe698.js +0 -1
  63. package/__mf/js/async/694.3c3c415f.js +0 -1
  64. package/__mf/js/async/740.fe5d3770.js +0 -1
  65. package/__mf/js/async/75.c1d82ca8.js +0 -1
  66. package/__mf/js/async/764.102c33d3.js +0 -7
  67. package/__mf/js/async/764.102c33d3.js.LICENSE.txt +0 -68
  68. package/__mf/js/async/902.129cd5da.js +0 -80
  69. package/__mf/js/async/960.dc16b984.js +0 -2
  70. package/__mf/js/async/964.01c67113.js +0 -2
  71. package/__mf/js/async/__federation_expose_TraceTable.0bcb874f.js +0 -1
  72. package/__mf/js/main.b975eef1.js +0 -1
  73. /package/__mf/js/async/{173.f0db00ba.js.LICENSE.txt → 173.085e8c1f.js.LICENSE.txt} +0 -0
  74. /package/__mf/js/async/{51.a8d0a55c.js.LICENSE.txt → 175.ba9a4640.js.LICENSE.txt} +0 -0
  75. /package/__mf/js/async/{902.129cd5da.js.LICENSE.txt → 812.f87960e5.js.LICENSE.txt} +0 -0
  76. /package/__mf/js/async/{620.006d05f8.js.LICENSE.txt → 863.17535c71.js.LICENSE.txt} +0 -0
  77. /package/__mf/js/async/{960.dc16b984.js.LICENSE.txt → 960.3373bed4.js.LICENSE.txt} +0 -0
  78. /package/__mf/js/async/{964.01c67113.js.LICENSE.txt → 964.1165a855.js.LICENSE.txt} +0 -0
  79. /package/__mf/js/async/{377.d6e7ba1a.js.LICENSE.txt → lib-router.5b98a3da.js.LICENSE.txt} +0 -0
@@ -0,0 +1,7 @@
1
+ /*! For license information please see 251.b73e9968.js.LICENSE.txt */
2
+ (self.chunk_TraceTable=self.chunk_TraceTable||[]).push([["251"],{77946:function(e,t,n){"use strict";let r,i,o;n.r(t),n.d(t,{SeriesLabelsStack:()=>DB,getTooltipStyles:()=>D8,TimeRangeSelector:()=>DL,ChartsThemeContext:()=>eI,DiscardChangesConfirmationDialog:()=>ls,DEFAULT_TOOLTIP_CONFIG:()=>DQ,OptionsEditorGrid:()=>lb,TOOLTIP_BG_COLOR_FALLBACK:()=>DG,DEFAULT_PINNED_CROSSHAIR:()=>tK,FontSizeSelector:()=>cl,TOOLTIP_MAX_WIDTH:()=>DV,InfoTooltip:()=>lp,TOOLTIP_MIN_WIDTH:()=>DF,SortSelector:()=>wI,SettingsAutocomplete:()=>lC,getClosestTimestamp:()=>t8,DragButton:()=>ax,NEARBY_SERIES_DESCRIPTION:()=>D_,DYNAMIC_NEARBY_SERIES_MULTIPLIER:()=>D6,TOOLTIP_ADJUST_Y_POS_MULTIPLIER:()=>Dz,SHOW_FEWER_SERIES_LIMIT:()=>D9,useId:()=>t9,getNearbySeriesData:()=>At,legacyCheckforNearbySeries:()=>Ae,ColorPicker:()=>eA,TooltipHeader:()=>Aa,checkforNearbyTimeSeries:()=>D7,FALLBACK_CHART_WIDTH:()=>DW,getYBuffer:()=>Ai,SortSelectorButtons:()=>wE,YAxisLabel:()=>Av,handleMoveDown:()=>ay,OptionsEditorGroup:()=>ly,TOOLTIP_DATE_FORMAT:()=>DU,dateFormatOptionsWithTimeZone:()=>ne,mockChartsContext:()=>Ax,assembleTransform:()=>D3,restoreChart:()=>t0,EMPTY_TOOLTIP_DATA:()=>DY,persesColumnsToTanstackColumns:()=>sP,TextField:()=>s6,OptionsColorPicker:()=>na,TimeChartTooltip:()=>Au,buildRelativeTimeOption:()=>tQ,useMousePosition:()=>DX,PINNED_CROSSHAIR_SERIES_NAME:()=>tU,batchDispatchNearbySeriesActions:()=>t5,getClosestTimestampInFullDataset:()=>t4,DEFAULT_COLUMN_WIDTH:()=>sD,ModeSelector:()=>wT,ThresholdsEditor:()=>wU,DragAndDropElement:()=>ap,useSnackbar:()=>tH,useTimeZone:()=>nl,getPointInGrid:()=>t2,isWithinPercentageRange:()=>Ar,clearHighlightedSeries:()=>t1,PIN_TOOLTIP_HELP_TEXT:()=>DJ,ContentWithLegend:()=>s3,FormActions:()=>cc,OPTIMIZED_MODE_SERIES_LIMIT:()=>tG,getTableCellLayout:()=>sR,getFormattedAxis:()=>tq,EMPHASIZED_SERIES_DESCRIPTION:()=>Dq,FormatControls:()=>Ag,ErrorAlert:()=>ci,OptionsEditorControl:()=>lv,formatWithTimeZone:()=>nt,testChartsTheme:()=>Ay,combineSx:()=>t6,ErrorBoundary:()=>co.ErrorBoundary,LoadingOverlay:()=>wP,TransformsEditor:()=>Aq,legacyGetNearbySeriesData:()=>An,SnackbarProvider:()=>tN,SeriesInfo:()=>D1,Table:()=>sX,UNPIN_TOOLTIP_HELP_TEXT:()=>D0,getTheme:()=>AE,SeriesMarker:()=>Dj,LinksEditor:()=>wS,TimeZoneContext:()=>no,DEFAULT_COLUMN_HEIGHT:()=>sA,TOOLTIP_PADDING:()=>D$,INCREASE_NEARBY_SERIES_MULTIPLIER:()=>D4,ToolbarIconButton:()=>Ad,enableDataZoom:()=>tJ,NoDataOverlay:()=>wR,RefreshIntervalPicker:()=>AG,AlignSelector:()=>G,TOOLTIP_MAX_HEIGHT:()=>DN,DensitySelector:()=>lk,DropIndicator:()=>lM,TextOverlay:()=>wA,Drawer:()=>aN,TooltipContent:()=>Ac,getDateAndTime:()=>nr,useChartsContext:()=>eE,typography:()=>AO,isLegendItemVisuallySelected:()=>oD,EChart:()=>cn,JSONEditor:()=>wb,TOOLTIP_LABELS_MAX_WIDTH:()=>DH,Legend:()=>s2,OptionsEditorColumn:()=>la,ValueMappingsEditor:()=>Ra,Dialog:()=>lo,TimeZoneProvider:()=>ns,ChartsProvider:()=>eO,useChartsTheme:()=>eZ,handleMoveUp:()=>ab,getFormattedAxisLabel:()=>nn,useDragAndDropMonitor:()=>af,checkCrosshairPinnedStatus:()=>t3,generateChartsTheme:()=>ni,defaultCursorData:()=>DK,DateTimeRangePicker:()=>DZ});var s,l,a,c,u,h,d,f,p,m,g,v,b,y,x,w,C,S,k,M,T=n(24246),D=n(54538),A=n.n(D),R=n(90496),P=n(82267),O=n(16838);function I(e){return D.Children.toArray(e).filter(e=>D.isValidElement(e))}var E=n(51640),Z=n(12709),L=n(82319),j=n(90433),B=n(51751),F=n(44124),V=n(6749);function N(e){return(0,V.ZP)("MuiButtonGroup",e)}let H=(0,F.Z)("MuiButtonGroup",["root","contained","outlined","text","disableElevation","disabled","firstButton","fullWidth","horizontal","vertical","colorPrimary","colorSecondary","grouped","groupedHorizontal","groupedVertical","groupedText","groupedTextHorizontal","groupedTextVertical","groupedTextPrimary","groupedTextSecondary","groupedOutlined","groupedOutlinedHorizontal","groupedOutlinedVertical","groupedOutlinedPrimary","groupedOutlinedSecondary","groupedContained","groupedContainedHorizontal","groupedContainedVertical","groupedContainedPrimary","groupedContainedSecondary","lastButton","middleButton"]);var z=n(55720),$=n(71645);let W=(0,Z.ZP)("div",{name:"MuiButtonGroup",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${H.grouped}`]:t.grouped},{[`& .${H.grouped}`]:t[`grouped${(0,E.Z)(n.orientation)}`]},{[`& .${H.grouped}`]:t[`grouped${(0,E.Z)(n.variant)}`]},{[`& .${H.grouped}`]:t[`grouped${(0,E.Z)(n.variant)}${(0,E.Z)(n.orientation)}`]},{[`& .${H.grouped}`]:t[`grouped${(0,E.Z)(n.variant)}${(0,E.Z)(n.color)}`]},{[`& .${H.firstButton}`]:t.firstButton},{[`& .${H.lastButton}`]:t.lastButton},{[`& .${H.middleButton}`]:t.middleButton},t.root,t[n.variant],!0===n.disableElevation&&t.disableElevation,n.fullWidth&&t.fullWidth,"vertical"===n.orientation&&t.vertical]}})((0,L.Z)(({theme:e})=>({display:"inline-flex",borderRadius:(e.vars||e).shape.borderRadius,variants:[{props:{variant:"contained"},style:{boxShadow:(e.vars||e).shadows[2]}},{props:{disableElevation:!0},style:{boxShadow:"none"}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${H.lastButton},& .${H.middleButton}`]:{borderTopRightRadius:0,borderTopLeftRadius:0},[`& .${H.firstButton},& .${H.middleButton}`]:{borderBottomRightRadius:0,borderBottomLeftRadius:0}}},{props:{orientation:"horizontal"},style:{[`& .${H.firstButton},& .${H.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${H.lastButton},& .${H.middleButton}`]:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}},{props:{variant:"text",orientation:"horizontal"},style:{[`& .${H.firstButton},& .${H.middleButton}`]:{borderRight:e.vars?`1px solid rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:`1px solid ${"light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${H.disabled}`]:{borderRight:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},{props:{variant:"text",orientation:"vertical"},style:{[`& .${H.firstButton},& .${H.middleButton}`]:{borderBottom:e.vars?`1px solid rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:`1px solid ${"light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${H.disabled}`]:{borderBottom:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},...Object.entries(e.palette).filter((0,j.Z)()).flatMap(([t])=>[{props:{variant:"text",color:t},style:{[`& .${H.firstButton},& .${H.middleButton}`]:{borderColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / 0.5)`:(0,O.Fq)(e.palette[t].main,.5)}}}]),{props:{variant:"outlined",orientation:"horizontal"},style:{[`& .${H.firstButton},& .${H.middleButton}`]:{borderRightColor:"transparent","&:hover":{borderRightColor:"currentColor"}},[`& .${H.lastButton},& .${H.middleButton}`]:{marginLeft:-1}}},{props:{variant:"outlined",orientation:"vertical"},style:{[`& .${H.firstButton},& .${H.middleButton}`]:{borderBottomColor:"transparent","&:hover":{borderBottomColor:"currentColor"}},[`& .${H.lastButton},& .${H.middleButton}`]:{marginTop:-1}}},{props:{variant:"contained",orientation:"horizontal"},style:{[`& .${H.firstButton},& .${H.middleButton}`]:{borderRight:`1px solid ${(e.vars||e).palette.grey[400]}`,[`&.${H.disabled}`]:{borderRight:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},{props:{variant:"contained",orientation:"vertical"},style:{[`& .${H.firstButton},& .${H.middleButton}`]:{borderBottom:`1px solid ${(e.vars||e).palette.grey[400]}`,[`&.${H.disabled}`]:{borderBottom:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},...Object.entries(e.palette).filter((0,j.Z)(["dark"])).map(([t])=>({props:{variant:"contained",color:t},style:{[`& .${H.firstButton},& .${H.middleButton}`]:{borderColor:(e.vars||e).palette[t].dark}}}))],[`& .${H.grouped}`]:{minWidth:40,boxShadow:"none",props:{variant:"contained"},style:{"&:hover":{boxShadow:"none"}}}}))),_=D.forwardRef(function(e,t){let n=(0,B.i)({props:e,name:"MuiButtonGroup"}),{children:r,className:i,color:o="primary",component:s="div",disabled:l=!1,disableElevation:a=!1,disableFocusRipple:c=!1,disableRipple:u=!1,fullWidth:h=!1,orientation:d="horizontal",size:f="medium",variant:p="outlined",...m}=n,g={...n,color:o,component:s,disabled:l,disableElevation:a,disableFocusRipple:c,disableRipple:u,fullWidth:h,orientation:d,size:f,variant:p},v=(e=>{let{classes:t,color:n,disabled:r,disableElevation:i,fullWidth:o,orientation:s,variant:l}=e,a={root:["root",l,s,o&&"fullWidth",i&&"disableElevation",`color${(0,E.Z)(n)}`],grouped:["grouped",`grouped${(0,E.Z)(s)}`,`grouped${(0,E.Z)(l)}`,`grouped${(0,E.Z)(l)}${(0,E.Z)(s)}`,`grouped${(0,E.Z)(l)}${(0,E.Z)(n)}`,r&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return(0,P.Z)(a,N,t)})(g),b=D.useMemo(()=>({className:v.grouped,color:o,disabled:l,disableElevation:a,disableFocusRipple:c,disableRipple:u,fullWidth:h,size:f,variant:p}),[o,l,a,c,u,h,f,p,v.grouped]),y=I(r),x=y.length;return(0,T.jsx)(W,{as:s,role:"group",className:(0,R.Z)(v.root,i),ref:t,ownerState:g,...m,children:(0,T.jsx)(z.Z.Provider,{value:b,children:y.map((e,t)=>(0,T.jsx)($.Z.Provider,{value:(e=>{let t=0===e,n=e===x-1;return t&&n?"":t?v.firstButton:n?v.lastButton:v.middleButton})(t),children:e},t))})})});var q=n(48565);function G({onChange:e,value:t="left",...n}){let r=t=>{e(t)};return(0,T.jsxs)(_,{"aria-label":"Alignement",...n,children:[(0,T.jsx)(q.Z,{onClick:()=>r("left"),variant:"left"===t?"contained":"outlined",children:"Left"},"left"),(0,T.jsx)(q.Z,{onClick:()=>r("center"),variant:"center"===t?"contained":"outlined",children:"Center"},"center"),(0,T.jsx)(q.Z,{onClick:()=>r("right"),variant:"right"===t?"contained":"outlined",children:"Right"},"right")]})}var U=n(25283),K=n(75094),Y=n(8695);function X(){return(X=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Q(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function J(e){var t=(0,D.useRef)(e),n=(0,D.useRef)(function(e){t.current&&t.current(e)});return t.current=e,n.current}var ee,et=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e<t?t:e},en=function(e){return"touches"in e},er=function(e){return e&&e.ownerDocument.defaultView||self},ei=function(e,t,n){var r=e.getBoundingClientRect(),i=en(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:et((i.pageX-(r.left+er(e).pageXOffset))/r.width),top:et((i.pageY-(r.top+er(e).pageYOffset))/r.height)}},eo=function(e){en(e)||e.preventDefault()},es=D.memo(function(e){var t=e.onMove,n=e.onKey,r=Q(e,["onMove","onKey"]),i=(0,D.useRef)(null),o=J(t),s=J(n),l=(0,D.useRef)(null),a=(0,D.useRef)(!1),c=(0,D.useMemo)(function(){var e=function(e){eo(e),(en(e)?e.touches.length>0:e.buttons>0)&&i.current?o(ei(i.current,e,l.current)):n(!1)},t=function(){return n(!1)};function n(n){var r=a.current,o=er(i.current),s=n?o.addEventListener:o.removeEventListener;s(r?"touchmove":"mousemove",e),s(r?"touchend":"mouseup",t)}return[function(e){var t=e.nativeEvent,r=i.current;if(r&&(eo(t),(!a.current||en(t))&&r)){if(en(t)){a.current=!0;var s=t.changedTouches||[];s.length&&(l.current=s[0].identifier)}r.focus(),o(ei(r,t,l.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),s({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},n]},[s,o]),u=c[0],h=c[1],d=c[2];return(0,D.useEffect)(function(){return d},[d]),D.createElement("div",X({},r,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:i,onKeyDown:h,tabIndex:0,role:"slider"}))}),el=function(e){return e.filter(Boolean).join(" ")},ea=function(e){var t=e.color,n=e.left,r=e.top,i=el(["react-colorful__pointer",e.className]);return D.createElement("div",{className:i,style:{top:100*(void 0===r?.5:r)+"%",left:100*n+"%"}},D.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},ec=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n},eu=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?ec(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?ec(parseInt(e.substring(6,8),16)/255,2):1}},eh=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:ec(e.h),s:ec(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:ec(i/2),a:ec(r,2)}},ed=function(e){var t=eh(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},ef=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var o=Math.floor(t),s=r*(1-n),l=r*(1-(t-o)*n),a=r*(1-(1-t+o)*n),c=o%6;return{r:ec(255*[r,l,s,s,a,r][c]),g:ec(255*[a,r,r,l,s,s][c]),b:ec(255*[s,s,a,r,r,l][c]),a:ec(i,2)}},ep=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},em=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,o=i<1?ep(ec(255*i)):"";return"#"+ep(t)+ep(n)+ep(r)+o},eg=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,o=Math.max(t,n,r),s=o-Math.min(t,n,r),l=s?o===t?(n-r)/s:o===n?2+(r-t)/s:4+(t-n)/s:0;return{h:ec(60*(l<0?l+6:l)),s:ec(o?s/o*100:0),v:ec(o/255*100),a:i}},ev=D.memo(function(e){var t=e.hue,n=e.onChange,r=el(["react-colorful__hue",e.className]);return D.createElement("div",{className:r},D.createElement(es,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:et(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":ec(t),"aria-valuemax":"360","aria-valuemin":"0"},D.createElement(ea,{className:"react-colorful__hue-pointer",left:t/360,color:ed({h:t,s:100,v:100,a:1})})))}),eb=D.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:ed({h:t.h,s:100,v:100,a:1})};return D.createElement("div",{className:"react-colorful__saturation",style:r},D.createElement(es,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:et(t.s+100*e.left,0,100),v:et(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+ec(t.s)+"%, Brightness "+ec(t.v)+"%"},D.createElement(ea,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:ed(t)})))}),ey=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},ex="undefined"!=typeof window?D.useLayoutEffect:D.useEffect,ew=new Map,eC=function(e){ex(function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!ew.has(t)){var r=t.createElement("style");r.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',ew.set(t,r);var i=ee||n.nc;i&&r.setAttribute("nonce",i),t.head.appendChild(r)}},[])},eS=function(e){var t,n,r,i,o,s=e.className,l=e.colorModel,a=e.color,c=void 0===a?l.defaultColor:a,u=e.onChange,h=Q(e,["className","colorModel","color","onChange"]),d=(0,D.useRef)(null);eC(d);var f=(t=J(u),r=(n=(0,D.useState)(function(){return l.toHsva(c)}))[0],i=n[1],o=(0,D.useRef)({color:c,hsva:r}),(0,D.useEffect)(function(){if(!l.equal(c,o.current.color)){var e=l.toHsva(c);o.current={hsva:e,color:c},i(e)}},[c,l]),(0,D.useEffect)(function(){var e;ey(r,o.current.hsva)||l.equal(e=l.fromHsva(r),o.current.color)||(o.current={hsva:r,color:e},t(e))},[r,l,t]),[r,(0,D.useCallback)(function(e){i(function(t){return Object.assign({},t,e)})},[])]),p=f[0],m=f[1],g=el(["react-colorful",s]);return D.createElement("div",X({},h,{ref:d,className:g}),D.createElement(eb,{hsva:p,onChange:m}),D.createElement(ev,{hue:p.h,onChange:m,className:"react-colorful__last-control"}))},ek={defaultColor:"000",toHsva:function(e){return eg(eu(e))},fromHsva:function(e){return em(ef({h:e.h,s:e.s,v:e.v,a:1}))},equal:function(e,t){return e.toLowerCase()===t.toLowerCase()||ey(eu(e),eu(t))}},eM=function(e){return D.createElement(eS,X({},e,{colorModel:ek}))},eT=n(20791),eD=n(80354);let eA=({color:e,onChange:t,onClear:n,palette:r})=>{let[i,o]=(0,D.useState)(e),s=e=>{o(e),t?.(e)};return(0,T.jsxs)(U.Z,{spacing:1,children:[(0,T.jsx)(eM,{color:e,onChange:s,style:{width:"100%"}}),(0,T.jsx)(U.Z,{direction:"row",flexWrap:"wrap",justifyContent:"space-evenly",width:"200px",children:r&&r.map((e,t)=>(0,T.jsx)(K.Z,{size:"small","aria-label":`change color to ${e}`,sx:{color:e},onClick:()=>s(e),children:(0,T.jsx)(eT.default,{})},t))}),(0,T.jsxs)(U.Z,{direction:"row",gap:1,alignItems:"center",children:[(0,T.jsx)(Y.Z,{inputProps:{"aria-label":"enter hex color"},fullWidth:!0,value:i,onChange:e=>{let n=e.target.value.replace(/([^0-9A-F]+)/gi,"").substring(0,8);o(`#${n}`),eR(e.target.value)&&t?.(e.target.value)}}),n&&(0,T.jsx)(K.Z,{onClick:n,children:(0,T.jsx)(eD.default,{})})]})]})},eR=(e,t)=>{let n=/^#?([0-9A-F]{3,8})$/i.exec(e),r=n&&n[1]?n[1].length:0;return 3===r||6===r||!!t&&4===r||!!t&&8===r};var eP=n(6714);function eO(e){let{children:t,chartsTheme:n,enablePinning:r=!1,enableSyncGrouping:i=!0}=e,[o,s]=(0,D.useState)(null),l=(0,D.useMemo)(()=>({chartsTheme:n,enablePinning:r,lastTooltipPinnedCoords:o,enableSyncGrouping:i,setLastTooltipPinnedCoords:s}),[n,r,i,o,s]);return(0,T.jsx)(eI.Provider,{value:l,children:t})}let eI=(0,D.createContext)(void 0);function eE(){let e=(0,D.useContext)(eI);if(void 0===e)throw Error("No ChartsThemeContext found. Did you forget a Provider?");return e}function eZ(){return eE().chartsTheme}var eL=n(6085);let ej=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=function e(t){var n,r,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t))for(n=0;n<t.length;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=" "),i+=r);else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}(e))&&(r&&(r+=" "),r+=t);return r},eB={data:""},eF=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,eV=/\/\*[^]*?\*\/| +/g,eN=/\n+/g,eH=(e,t)=>{let n="",r="",i="";for(let o in e){let s=e[o];"@"==o[0]?"i"==o[1]?n=o+" "+s+";":r+="f"==o[1]?eH(s,o):o+"{"+eH(s,"k"==o[1]?"":t)+"}":"object"==typeof s?r+=eH(s,t?t.replace(/([^,])+/g,e=>o.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):o):null!=s&&(o=/^--/.test(o)?o:o.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=eH.p?eH.p(o,s):o+":"+s+";")}return n+(t&&i?t+"{"+i+"}":i)+r},ez={},e$=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+e$(e[n]);return t}return e};function eW(e){let t,n,r,i=this||{},o=e.call?e(i.p):e;return((e,t,n,r,i)=>{var o;let s=e$(e),l=ez[s]||(ez[s]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(s));if(!ez[l]){let t=s!==e?e:(e=>{let t,n,r=[{}];for(;t=eF.exec(e.replace(eV,""));)t[4]?r.shift():t[3]?(n=t[3].replace(eN," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(eN," ").trim();return r[0]})(e);ez[l]=eH(i?{["@keyframes "+l]:t}:t,n?"":"."+l)}let a=n&&ez.g?ez.g:null;return n&&(ez.g=ez[l]),o=ez[l],a?t.data=t.data.replace(a,o):-1===t.data.indexOf(o)&&(t.data=r?o+t.data:t.data+o),l})(o.unshift?o.raw?(t=[].slice.call(arguments,1),n=i.p,o.reduce((e,r,i)=>{let o=t[i];if(o&&o.call){let e=o(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":eH(e,""):!1===e?"":e}return e+r+(null==o?"":o)},"")):o.reduce((e,t)=>Object.assign(e,t&&t.call?t(i.p):t),{}):o,(r=i.target,"object"==typeof window?((r?r.querySelector("#_goober"):window._goober)||Object.assign((r||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:r||eB),i.g,i.o,i.k)}function e_(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function eq(e,t,n){return t&&e_(e.prototype,t),n&&e_(e,n),e}function eG(){return(eG=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function eU(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function eK(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}function eY(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}eW.bind({g:1}),eW.bind({k:1});var eX=function(){return""},eQ=A().createContext({enqueueSnackbar:eX,closeSnackbar:eX}),eJ="@media (max-width:599.95px)",e0="@media (min-width:600px)",e1=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},e2=function(e){return""+e1(e.vertical)+e1(e.horizontal)},e5=function(e){return!!e||0===e},e3="unmounted",e8="exited",e4="entering",e6="entered",e9="exiting",e7=function(e){function t(t){var n,r=e.call(this,t)||this,i=t.appear;return r.appearStatus=null,t.in?i?(n=e8,r.appearStatus=e4):n=e6:n=t.unmountOnExit||t.mountOnEnter?e3:e8,r.state={status:n},r.nextCallback=null,r}eU(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===e3?{status:e8}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==e4&&n!==e6&&(t=e4):(n===e4||n===e6)&&(t=e9)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e=this.props.timeout,t=e,n=e;return null!=e&&"number"!=typeof e&&"string"!=typeof e&&(n=e.exit,t=e.enter),{exit:n,enter:t}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===e4?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&this.state.status===e8&&this.setState({status:e3})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.getTimeouts();if(!e&&!n)return void this.safeSetState({status:e6},function(){t.props.onEntered&&t.props.onEntered(t.node,e)});this.props.onEnter&&this.props.onEnter(this.node,e),this.safeSetState({status:e4},function(){t.props.onEntering&&t.props.onEntering(t.node,e),t.onTransitionEnd(r.enter,function(){t.safeSetState({status:e6},function(){t.props.onEntered&&t.props.onEntered(t.node,e)})})})},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts();if(!t)return void this.safeSetState({status:e8},function(){e.props.onExited&&e.props.onExited(e.node)});this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:e9},function(){e.props.onExiting&&e.props.onExiting(e.node),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:e8},function(){e.props.onExited&&e.props.onExited(e.node)})})})},n.cancelNextCallback=function(){null!==this.nextCallback&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(){n&&(n=!1,t.nextCallback=null,e())},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=null==e&&!this.props.addEndListener;if(!this.node||n)return void setTimeout(this.nextCallback,0);this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),null!=e&&setTimeout(this.nextCallback,e)},n.render=function(){var e=this.state.status;if(e===e3)return null;var t=this.props;return(0,t.children)(e,eK(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},eq(t,[{key:"node",get:function(){var e,t=null==(e=this.props.nodeRef)?void 0:e.current;if(!t)throw Error("notistack - Custom snackbar is not refForwarding");return t}}]),t}(A().Component);function te(){}function tt(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function tn(e,t){return(0,D.useMemo)(function(){return null==e&&null==t?null:function(n){tt(e,n),tt(t,n)}},[e,t])}function tr(e){var t=e.timeout,n=e.style,r=void 0===n?{}:n,i=e.mode;return{duration:"object"==typeof t?t[i]||0:t,easing:r.transitionTimingFunction,delay:r.transitionDelay}}e7.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:te,onEntering:te,onEntered:te,onExit:te,onExiting:te,onExited:te};var ti=function(e){e.scrollTop=e.scrollTop},to=function(e){return Math.round(e)+"ms"};function ts(e,t){void 0===e&&(e=["all"]);var n=t||{},r=n.duration,i=void 0===r?300:r,o=n.easing,s=void 0===o?"cubic-bezier(0.4, 0, 0.2, 1)":o,l=n.delay,a=void 0===l?0:l;return(Array.isArray(e)?e:[e]).map(function(e){return e+" "+("string"==typeof i?i:to(i))+" "+s+" "+("string"==typeof a?a:to(a))}).join(",")}function tl(e){return(e&&e.ownerDocument||document).defaultView||window}function ta(e,t){if(t){var n=function(e,t){var n,r=t.getBoundingClientRect(),i=tl(t);if(t.fakeTransform)n=t.fakeTransform;else{var o=i.getComputedStyle(t);n=o.getPropertyValue("-webkit-transform")||o.getPropertyValue("transform")}var s=0,l=0;if(n&&"none"!==n&&"string"==typeof n){var a=n.split("(")[1].split(")")[0].split(",");s=parseInt(a[4],10),l=parseInt(a[5],10)}switch(e){case"left":return"translateX("+(i.innerWidth+s-r.left)+"px)";case"right":return"translateX(-"+(r.left+r.width-s)+"px)";case"up":return"translateY("+(i.innerHeight+l-r.top)+"px)";default:return"translateY(-"+(r.top+r.height-l)+"px)"}}(e,t);n&&(t.style.webkitTransform=n,t.style.transform=n)}}var tc=(0,D.forwardRef)(function(e,t){var n=e.children,r=e.direction,i=void 0===r?"down":r,o=e.in,s=e.style,l=e.timeout,a=void 0===l?0:l,c=e.onEnter,u=e.onEntered,h=e.onExit,d=e.onExited,f=eK(e,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),p=(0,D.useRef)(null),m=tn(n.ref,p),g=tn(m,t),v=(0,D.useCallback)(function(){p.current&&ta(i,p.current)},[i]);return(0,D.useEffect)(function(){if(!o&&"down"!==i&&"right"!==i){var e=function(e,t){var n;function r(){for(var r=this,i=arguments.length,o=Array(i),s=0;s<i;s++)o[s]=arguments[s];clearTimeout(n),n=setTimeout(function(){e.apply(r,o)},t)}return void 0===t&&(t=166),r.clear=function(){clearTimeout(n)},r}(function(){p.current&&ta(i,p.current)}),t=tl(p.current);return t.addEventListener("resize",e),function(){e.clear(),t.removeEventListener("resize",e)}}},[i,o]),(0,D.useEffect)(function(){o||v()},[o,v]),(0,D.createElement)(e7,Object.assign({appear:!0,nodeRef:p,onEnter:function(e,t){ta(i,e),ti(e),c&&c(e,t)},onEntered:u,onEntering:function(e){var t=(null==s?void 0:s.transitionTimingFunction)||"cubic-bezier(0.0, 0, 0.2, 1)",n=tr({timeout:a,mode:"enter",style:eG({},s,{transitionTimingFunction:t})});e.style.webkitTransition=ts("-webkit-transform",n),e.style.transition=ts("transform",n),e.style.webkitTransform="none",e.style.transform="none"},onExit:function(e){var t=(null==s?void 0:s.transitionTimingFunction)||"cubic-bezier(0.4, 0, 0.6, 1)",n=tr({timeout:a,mode:"exit",style:eG({},s,{transitionTimingFunction:t})});e.style.webkitTransition=ts("-webkit-transform",n),e.style.transition=ts("transform",n),ta(i,e),h&&h(e)},onExited:function(e){e.style.webkitTransition="",e.style.transition="",d&&d(e)},in:o,timeout:a},f),function(e,t){return(0,D.cloneElement)(n,eG({ref:g,style:eG({visibility:"exited"!==e||o?void 0:"hidden"},s,{},n.props.style)},t))})});tc.displayName="Slide";var tu=function(e){return A().createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},e))},th={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:A().createElement(function(){return A().createElement(tu,null,A().createElement("path",{d:"M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41\n 10.59L10 14.17L17.59 6.58L19 8L10 17Z"}))},null),warning:A().createElement(function(){return A().createElement(tu,null,A().createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},null),error:A().createElement(function(){return A().createElement(tu,null,A().createElement("path",{d:"M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,\n 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,\n 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z"}))},null),info:A().createElement(function(){return A().createElement(tu,null,A().createElement("path",{d:"M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,\n 0 22,12A10,10 0 0,0 12,2Z"}))},null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:tc,transitionDuration:{enter:225,exit:195}},td=function(e,t){var n=function(e){return"number"==typeof e||null===e};return n(e)?e:n(t)?t:th.autoHideDuration},tf=function(e,t){var n=function(e,t){return t.some(function(t){return typeof e===t})};return n(e,["string","number"])?e:n(e,["object"])?eG({},th.transitionDuration,{},n(t,["object"])&&t,{},e):n(t,["string","number"])?t:n(t,["object"])?eG({},th.transitionDuration,{},t):th.transitionDuration};function tp(e){return Object.entries(e).reduce(function(e,t){var n,r=t[0],i=t[1];return eG({},e,((n={})[r]=eW(i),n))},{})}var tm="notistack-CollapseWrapper",tg=tp({root:{height:0},entered:{height:"auto"}}),tv=(0,D.forwardRef)(function(e,t){var n=e.children,r=e.in,i=e.onExited,o=(0,D.useRef)(null),s=(0,D.useRef)(null),l=tn(t,s),a=function(){return o.current?o.current.clientHeight:0};return(0,D.createElement)(e7,{in:r,unmountOnExit:!0,onEnter:function(e){e.style.height="0px"},onEntered:function(e){e.style.height="auto"},onEntering:function(e){var t=a(),n=tr({timeout:175,mode:"enter"}),r=n.duration,i=n.easing;e.style.transitionDuration="string"==typeof r?r:r+"ms",e.style.height=t+"px",e.style.transitionTimingFunction=i||""},onExit:function(e){e.style.height=a()+"px"},onExited:i,onExiting:function(e){ti(e);var t=tr({timeout:175,mode:"exit"}),n=t.duration,r=t.easing;e.style.transitionDuration="string"==typeof n?n:n+"ms",e.style.height="0px",e.style.transitionTimingFunction=r||""},nodeRef:s,timeout:175},function(e,t){return(0,D.createElement)("div",Object.assign({ref:l,className:ej(tg.root,"entered"===e&&tg.entered),style:eG({pointerEvents:"all",overflow:"hidden",minHeight:"0px",transition:ts("height")},"entered"===e&&{overflow:"visible"},{},"exited"===e&&!r&&{visibility:"hidden"})},t),(0,D.createElement)("div",{ref:o,className:tm,style:{display:"flex",width:"100%"}},n))})});tv.displayName="Collapse";var tb={right:"left",left:"right",bottom:"up",top:"down"},ty=function(e){void 0===e&&(e={});var t={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(e).filter(function(e){return!t[e]}).reduce(function(t,n){var r;return eG({},t,((r={})[n]=e[n],r))},{})},tx=function(){};function tw(e,t){return e.reduce(function(e,n){return null==n?e:function(){for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];var s=[].concat(i);t&&-1===s.indexOf(t)&&s.push(t),e.apply(this,s),n.apply(this,s)}},tx)}var tC="undefined"!=typeof window?D.useLayoutEffect:D.useEffect;function tS(e){var t=(0,D.useRef)(e);return tC(function(){t.current=e}),(0,D.useCallback)(function(){return t.current.apply(void 0,arguments)},[])}var tk=(0,D.forwardRef)(function(e,t){var n=e.children,r=e.className,i=e.autoHideDuration,o=e.disableWindowBlurListener,s=void 0!==o&&o,l=e.onClose,a=e.id,c=e.open,u=e.SnackbarProps,h=void 0===u?{}:u,d=(0,D.useRef)(),f=tS(function(){l&&l.apply(void 0,arguments)}),p=tS(function(e){l&&null!=e&&(d.current&&clearTimeout(d.current),d.current=setTimeout(function(){f(null,"timeout",a)},e))});(0,D.useEffect)(function(){return c&&p(i),function(){d.current&&clearTimeout(d.current)}},[c,i,p]);var m=function(){d.current&&clearTimeout(d.current)},g=(0,D.useCallback)(function(){null!=i&&p(.5*i)},[i,p]);return(0,D.useEffect)(function(){if(!s&&c)return window.addEventListener("focus",g),window.addEventListener("blur",m),function(){window.removeEventListener("focus",g),window.removeEventListener("blur",m)}},[s,g,c]),(0,D.createElement)("div",Object.assign({ref:t},h,{className:ej("notistack-Snackbar",r),onMouseEnter:function(e){h.onMouseEnter&&h.onMouseEnter(e),m()},onMouseLeave:function(e){h.onMouseLeave&&h.onMouseLeave(e),g()}}),n)});tk.displayName="Snackbar";var tM=tp({root:((b={display:"flex",flexWrap:"wrap",flexGrow:1})[e0]={flexGrow:"initial",minWidth:"288px"},b)}),tT=(0,D.forwardRef)(function(e,t){var n=e.className,r=eK(e,["className"]);return A().createElement("div",Object.assign({ref:t,className:ej(tM.root,n)},r))});tT.displayName="SnackbarContent";var tD=tp({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),tA="notistack-snackbar",tR=(0,D.forwardRef)(function(e,t){var n=e.id,r=e.message,i=e.action,o=e.iconVariant,s=e.variant,l=e.hideIconVariant,a=e.style,c=e.className,u=o[s],h=i;return"function"==typeof h&&(h=h(n)),A().createElement(tT,{ref:t,role:"alert","aria-describedby":tA,style:a,className:ej("notistack-MuiContent","notistack-MuiContent-"+s,tD.root,tD[s],c,!l&&u&&tD.lessPadding)},A().createElement("div",{id:tA,className:tD.message},l?null:u,r),h&&A().createElement("div",{className:tD.action},h))});tR.displayName="MaterialDesignContent";var tP=(0,D.memo)(tR),tO=tp({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),tI=function(e){var t,n=(0,D.useRef)(),r=(0,D.useState)(!0),i=r[0],o=r[1],s=tw([e.snack.onClose,e.onClose]),l=(0,D.useCallback)(function(){n.current=setTimeout(function(){o(function(e){return!e})},125)},[]);(0,D.useEffect)(function(){return function(){n.current&&clearTimeout(n.current)}},[]);var a=e.snack,c=e.classes,u=e.Component,h=(0,D.useMemo)(function(){return ty(c)},[c]),d=a.open,f=a.SnackbarProps,p=a.TransitionComponent,m=a.TransitionProps,g=a.transitionDuration,v=a.disableWindowBlurListener,b=a.content,y=eK(a,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),x=eG({direction:"center"!==(t=y.anchorOrigin).horizontal?tb[t.horizontal]:tb[t.vertical],timeout:g},m),w=b;"function"==typeof w&&(w=w(y.id,y.message));var C=["onEnter","onEntered","onExit","onExited"].reduce(function(t,n){var r;return eG({},t,((r={})[n]=tw([e.snack[n],e[n]],y.id),r))},{});return A().createElement(tv,{in:i,onExited:C.onExited},A().createElement(tk,{open:d,id:y.id,disableWindowBlurListener:v,autoHideDuration:y.autoHideDuration,className:ej(tO.wrappedRoot,h.root,h["anchorOrigin"+e2(y.anchorOrigin)]),SnackbarProps:f,onClose:s},A().createElement(p,Object.assign({},x,{appear:!0,in:d,onExit:C.onExit,onExited:l,onEnter:C.onEnter,onEntered:tw([C.onEntered,function(){e.snack.requestClose&&s(null,"instructed",e.snack.id)}],y.id)}),w||A().createElement(void 0===u?tP:u,Object.assign({},y)))))},tE=20,tZ=6,tL=2,tj="."+tm,tB=tp({root:((y={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:ts(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"})[tj]={padding:tZ+"px 0px",transition:"padding 300ms ease 0ms"},y.maxWidth="calc(100% - "+2*tE+"px)",y[eJ]={width:"100%",maxWidth:"calc(100% - 32px)"},y),rootDense:((x={})[tj]={padding:tL+"px 0px"},x),top:{top:tE-tZ+"px",flexDirection:"column"},bottom:{bottom:tE-tZ+"px",flexDirection:"column-reverse"},left:((w={left:tE+"px"})[e0]={alignItems:"flex-start"},w[eJ]={left:"16px"},w),right:((C={right:tE+"px"})[e0]={alignItems:"flex-end"},C[eJ]={right:"16px"},C),center:((S={left:"50%",transform:"translateX(-50%)"})[e0]={alignItems:"center"},S)}),tF=(0,D.memo)(function(e){var t=e.classes,n=void 0===t?{}:t,r=e.anchorOrigin,i=e.dense,o=e.children,s=ej("notistack-SnackbarContainer",tB[r.vertical],tB[r.horizontal],tB.root,n.containerRoot,n["containerAnchorOrigin"+e2(r)],i&&tB.rootDense);return A().createElement("div",{className:s},o)}),tV=function(e){return!("string"==typeof e||(0,D.isValidElement)(e))},tN=function(e){function t(t){var n;return(n=e.call(this,t)||this).enqueueSnackbar=function(e,t){if(void 0===t&&(t={}),null==e)throw Error("enqueueSnackbar called with invalid argument");var r,i=tV(e)?e:t,o=tV(e)?e.message:e,s=i.key,l=i.preventDuplicate,a=eK(i,["key","preventDuplicate"]),c=e5(s),u=c?s:new Date().getTime()+Math.random(),h=(r=n.props,function(e,t){return(void 0===t&&(t=!1),t)?eG({},th[e],{},r[e],{},a[e]):"autoHideDuration"===e?td(a.autoHideDuration,r.autoHideDuration):"transitionDuration"===e?tf(a.transitionDuration,r.transitionDuration):a[e]||r[e]||th[e]}),d=eG({id:u},a,{message:o,open:!0,entered:!1,requestClose:!1,persist:h("persist"),action:h("action"),content:h("content"),variant:h("variant"),anchorOrigin:h("anchorOrigin"),disableWindowBlurListener:h("disableWindowBlurListener"),autoHideDuration:h("autoHideDuration"),hideIconVariant:h("hideIconVariant"),TransitionComponent:h("TransitionComponent"),transitionDuration:h("transitionDuration"),TransitionProps:h("TransitionProps",!0),iconVariant:h("iconVariant",!0),style:h("style",!0),SnackbarProps:h("SnackbarProps",!0),className:ej(n.props.className,a.className)});return d.persist&&(d.autoHideDuration=void 0),n.setState(function(e){if(void 0===l&&n.props.preventDuplicate||l){var t=function(e){return c?e.id===u:e.message===o},r=e.queue.findIndex(t)>-1,i=e.snacks.findIndex(t)>-1;if(r||i)return e}return n.handleDisplaySnack(eG({},e,{queue:[].concat(e.queue,[d])}))}),u},n.handleDisplaySnack=function(e){return e.snacks.length>=n.maxSnack?n.handleDismissOldest(e):n.processQueue(e)},n.processQueue=function(e){var t=e.queue,n=e.snacks;return t.length>0?eG({},e,{snacks:[].concat(n,[t[0]]),queue:t.slice(1,t.length)}):e},n.handleDismissOldest=function(e){if(e.snacks.some(function(e){return!e.open||e.requestClose}))return e;var t=!1,r=!1;e.snacks.reduce(function(e,t){return e+(t.open&&t.persist?1:0)},0)===n.maxSnack&&(r=!0);var i=e.snacks.map(function(e){return t||e.persist&&!r?eG({},e):(t=!0,e.entered)?(e.onClose&&e.onClose(null,"maxsnack",e.id),n.props.onClose&&n.props.onClose(null,"maxsnack",e.id),eG({},e,{open:!1})):eG({},e,{requestClose:!0})});return eG({},e,{snacks:i})},n.handleEnteredSnack=function(e,t,r){if(!e5(r))throw Error("handleEnteredSnack Cannot be called with undefined key");n.setState(function(e){return{snacks:e.snacks.map(function(e){return e.id===r?eG({},e,{entered:!0}):eG({},e)})}})},n.handleCloseSnack=function(e,t,r){n.props.onClose&&n.props.onClose(e,t,r);var i=void 0===r;n.setState(function(e){var t=e.snacks,n=e.queue;return{snacks:t.map(function(e){return i||e.id===r?e.entered?eG({},e,{open:!1}):eG({},e,{requestClose:!0}):eG({},e)}),queue:n.filter(function(e){return e.id!==r})}})},n.closeSnackbar=function(e){var t=n.state.snacks.find(function(t){return t.id===e});e5(e)&&t&&t.onClose&&t.onClose(null,"instructed",e),n.handleCloseSnack(null,"instructed",e)},n.handleExitedSnack=function(e,t){if(!e5(t))throw Error("handleExitedSnack Cannot be called with undefined key");n.setState(function(e){var r=n.processQueue(eG({},e,{snacks:e.snacks.filter(function(e){return e.id!==t})}));return 0===r.queue.length?r:n.handleDismissOldest(r)})},n.enqueueSnackbar,n.closeSnackbar,n.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:n.enqueueSnackbar.bind(eY(n)),closeSnackbar:n.closeSnackbar.bind(eY(n))}},n}return eU(t,e),t.prototype.render=function(){var e=this,t=this.state.contextValue,n=this.props,r=n.domRoot,i=n.children,o=n.dense,s=void 0!==o&&o,l=n.Components,a=void 0===l?{}:l,c=n.classes,u=this.state.snacks.reduce(function(e,t){var n,r=e2(t.anchorOrigin),i=e[r]||[];return eG({},e,((n={})[r]=[].concat(i,[t]),n))},{}),h=Object.keys(u).map(function(t){var n=u[t],r=n[0];return A().createElement(tF,{key:t,dense:s,anchorOrigin:r.anchorOrigin,classes:c},n.map(function(t){return A().createElement(tI,{key:t.id,snack:t,classes:c,Component:a[t.variant],onClose:e.handleCloseSnack,onEnter:e.props.onEnter,onExit:e.props.onExit,onExited:tw([e.handleExitedSnack,e.props.onExited],t.id),onEntered:tw([e.handleEnteredSnack,e.props.onEntered],t.id)})}))});return A().createElement(eQ.Provider,{value:t},i,r?(0,eL.createPortal)(h,r):h)},eq(t,[{key:"maxSnack",get:function(){return this.props.maxSnack||th.maxSnack}}]),t}(D.Component);function tH(){let{enqueueSnackbar:e,closeSnackbar:t}=(0,D.useContext)(eQ),n=tz(e,"error"),r=tz(e,"info"),i=tz(e,"warning"),o=tz(e,"success"),s=(0,D.useCallback)((e,t)=>n(e instanceof Error?e.message:`An unexpected error occurred: ${e}`,t),[n]);return{enqueueSnackbar:e,closeSnackbar:t,errorSnackbar:n,infoSnackbar:r,warningSnackbar:i,successSnackbar:o,exceptionSnackbar:s}}function tz(e,t){return(0,D.useCallback)((n,r)=>e(n,{...r,variant:t}),[e,t])}var t$=n(15409),tW=n.n(t$),t_=n(1148);function tq(e,t){return[tW()({type:"value",boundaryGap:[0,"10%"],axisLabel:{formatter:e=>(0,t_.Bw)(e,t)}},e)]}let tG=1e3,tU="Pinned Crosshair",tK={name:tU,type:"line",markLine:{data:[],lineStyle:{type:"dashed",width:2},emphasis:{lineStyle:{width:2,opacity:1}},blur:{lineStyle:{width:2,opacity:1}}}};var tY=n(29085),tX=n(20461);function tQ(e){return{value:{pastDuration:e},display:`Last ${(0,tX.formatDuration)((0,tY.Ib)(e),{delimiter:", "})}`}}function tJ(e){let t=e._model;void 0!==t&&void 0!==t.option.toolbox&&t.option.toolbox.length>0&&"normal"===t.option.toolbox[0].feature.dataZoom.iconStatus.zoom&&e.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:!0})}function t0(e){e.dispatchAction({type:"restore"})}function t1(e){void 0!==e.dispatchAction&&(e.dispatchAction({type:"unselect"}),e.dispatchAction({type:"downplay"}))}function t2(e,t,n){if(void 0===n)return null;let r=[e,t];return n.containPixel("grid",r)?n.convertFromPixel("grid",r):null}function t5(e,t,n,r,i,o){let s=o.length>0?o[o.length-1]:i[i.length-1];void 0!==s&&e.dispatchAction({type:"select",seriesIndex:s.seriesIndex,dataIndex:s.dataIndex,escapeConnect:!0}),e.dispatchAction({type:"downplay",seriesIndex:r}),n.length>0?e.dispatchAction({type:"highlight",seriesIndex:n,notBlur:!1,escapeConnect:!0}):(e.dispatchAction({type:"highlight",seriesIndex:t,notBlur:!0,escapeConnect:!0}),e.dispatchAction({type:"toggleSelect"}))}function t3(e){return e[e.length-1]?.name===tU}function t8(e,t){if(void 0===e||void 0===t)return null;let n=null,r=1/0;for(let[i]of e){let e=Math.abs(i-t);e<r&&(n=i,r=e)}return n}function t4(e,t){if(void 0===t)return null;let n=e.length,r=null;for(let i=0;i<n;i++){let o=n>0?e[i]:null;if(!o)break;r=t8(o.values,t)}return r}function t6(...e){return e.flatMap(e=>void 0===e?[]:Array.isArray(e)?e:[e])}function t9(e){void 0===globalThis.useIdValue&&(globalThis.useIdValue=0);let t=(0,D.useRef)(void 0);return void 0===t.current&&(t.current=`${e}-${globalThis.useIdValue++}`),t.current}var t7=n(4665);function ne(e,t){if(t){let n=t.toLowerCase();if("local"!==n&&"browser"!==n)return{...e,timeZone:"utc"===n?"UTC":t}}return e}function nt(e,t,n){let r=n?.toLowerCase();return n&&"local"!==r&&"browser"!==r?(0,t7.formatInTimeZone)(e,"utc"===r?"UTC":n,t):(0,tX.format)(e,t)}function nn(e){return e>15768e7?"{yyyy}":e>63072e6?"{MMM} {yyyy}":e>432e6&&e<1577664e4?"{MM}/{dd}":e>1728e5&&e<=432e6?"{MM}/{dd} {HH}:{mm}":{year:"{yearStyle|{yyyy}}\n{monthStyle|{MMM}}",month:"{MMM}",day:"{MM}/{dd}"}}let nr=e=>{if(!e)return{formattedDate:"",formattedTime:""};let t=new Date(e);return{formattedDate:(0,tX.format)(t,"MMM dd, yyyy - "),formattedTime:(0,tX.format)(t,"HH:mm:ss")}};function ni(e,t){let n=e.palette.text?.primary??"#222",r={title:{show:!1},textStyle:{color:n,fontFamily:e.typography.fontFamily,fontSize:12},grid:{top:5,right:20,bottom:0,left:20,containLabel:!0},color:["#56B4E9","#009E73","#0072B2","#CC79A7","#F0E442","#E69F00","#D55E00"],categoryAxis:{show:!0,axisLabel:{show:!0,color:n,margin:15},axisTick:{show:!1,length:6,lineStyle:{color:e.palette.grey[600]}},axisLine:{show:!0,lineStyle:{color:e.palette.grey[600]}},splitLine:{show:!0,lineStyle:{width:.5,color:e.palette.grey[300],opacity:.4}},splitArea:{show:!1,areaStyle:{color:[e.palette.grey[300]]}}},timeAxis:{show:!0,axisLabel:{show:!0,color:n,margin:15},axisTick:{show:!1,length:6,lineStyle:{color:e.palette.grey[600]}},axisLine:{show:!0,lineStyle:{color:e.palette.grey[600]}},splitLine:{show:!0,lineStyle:{width:.5,color:e.palette.grey[300],opacity:.4}},splitArea:{show:!1,areaStyle:{color:[e.palette.grey[300]]}}},valueAxis:{show:!0,axisLabel:{color:n,margin:12},axisLine:{show:!1},splitLine:{show:!0,lineStyle:{width:.5,color:e.palette.grey[300],opacity:.6}}},legend:{orient:"horizontal",textStyle:{color:n},pageTextStyle:{color:e.palette.grey[600]},pageIconColor:e?.palette?.action?.active,pageIconInactiveColor:e?.palette?.action?.disabled},toolbox:{show:!0,top:10,right:10,iconStyle:{borderColor:n}},tooltip:{backgroundColor:e.palette.designSystem?.grey[800],borderColor:e.palette.designSystem?.grey[800],textStyle:{color:"#fff",fontSize:11}},axisPointer:{lineStyle:{color:e.palette.grey[500]}},markLine:{symbol:"none",symbolSize:0,itemStyle:{color:e.palette.grey[500]},lineStyle:{type:"dashed",width:1}},line:{showSymbol:!1,symbol:"circle",symbolSize:4,smooth:!1,lineStyle:{width:1},emphasis:{lineStyle:{width:1.5}}},bar:{barMaxWidth:150,itemStyle:{borderWidth:0,borderRadius:0,borderColor:e.palette.grey[300]},label:{show:!1,color:n}},gauge:{detail:{fontSize:18,fontWeight:600,valueAnimation:!1},splitLine:{distance:0,length:4,lineStyle:{width:1}},splitNumber:12}};return tW()({echartsTheme:r,noDataOption:{title:{show:!0,textStyle:{color:n,fontSize:16,fontWeight:400},text:"No data",left:"center",top:"center"},xAxis:{show:!1},yAxis:{show:!1}},sparkline:{width:2,color:"#1976d2"},container:{padding:{default:parseInt(e.spacing(1.5),10)}},thresholds:{defaultColor:e.palette.success.main,palette:["#FFCC00",e.palette.warning.main,e.palette.error.main]}},t)}let no=(0,D.createContext)(void 0);function ns(e){let{children:t,timeZone:n}=e;return(0,T.jsx)(no.Provider,{value:n,children:t})}function nl(){let e=(0,D.useContext)(no);return{timeZone:e??"local",formatWithUserTimeZone:(t,n)=>nt(t,n,e),dateFormatOptionsWithUserTimeZone:t=>ne(t,e)}}function na({label:e,color:t,onColorChange:n,onClear:r}){let[i,o]=(0,D.useState)(null),s=!!i,{thresholds:{defaultColor:l,palette:a}}=eZ();return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(nc,{size:"small","aria-label":`change ${e} color`,isSelected:s,iconColor:t,onClick:e=>{o(e.currentTarget)},children:(0,T.jsx)(eT.default,{})}),(0,T.jsx)(eP.ZP,{"data-testid":"options color picker",open:s,anchorEl:i,onClose:()=>{o(null)},slotProps:{paper:{sx:{padding:e=>e.spacing(2)}}},anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"right"},children:(0,T.jsx)(eA,{color:t,palette:[l,...a],onChange:n,onClear:r})})]})}let nc=(0,Z.ZP)(K.Z,{shouldForwardProp:e=>"isSelected"!==e&&"iconColor"!==e})(({iconColor:e,isSelected:t})=>({backgroundColor:t&&e?`${e}3F`:"undefined",color:e}));var nu=n(94776),nh=n(36372),nd=n(8193),nf=n(75586);function np(e){e()}function nm(e,t){return n=>e(t(n))}function ng(e){return void 0!==e}function nv(){}function nb(e,t){return t(e)}function ny(...e){return e}function nx(e,t){e(0,t)}function nw(e){e(2)}function nC(e){return e(4)}function nS(e,t){return e(1,e=>t(0,e))}function nk(e,t){let n=e(1,e=>{n(),t(e)});return n}function nM(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function nT(e,t){return e===t}function nD(e=nT){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function nA(e){return t=>n=>{e(n)&&t(n)}}function nR(e){return t=>nm(t,e)}function nP(e){return t=>()=>{t(e)}}function nO(e,...t){let n=function(...e){return t=>e.reduceRight(nb,t)}(...t);return(t,r)=>{switch(t){case 2:nw(e);return;case 1:return e(1,n(r))}}}function nI(e,t){return n=>r=>{n(t=e(t,r))}}function nE(e){return t=>n=>{e>0?e--:t(n)}}function nZ(e){let t=null,n;return r=>i=>{t=i,n||(n=setTimeout(()=>{n=void 0,r(t)},e))}}function nL(...e){let t=Array(e.length),n=0,r=null,i=Math.pow(2,e.length)-1;return e.forEach((e,o)=>{let s=Math.pow(2,o);e(1,e=>{let l=n;n|=s,t[o]=e,l!==i&&n===i&&r&&(r(),r=null)})}),e=>o=>{let s=()=>{e([o].concat(t))};n===i?s():r=s}}function nj(e){let t=e,n=nF();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function nB(e,t){var n;return n=nj(t),nS(e,n),n}function nF(){let e=[];return(t,n)=>{switch(t){case 0:e.slice().forEach(e=>{e(n)});return;case 2:e.splice(0,e.length);return;case 1:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}}}function nV(e){var t;return t=nF(),nS(e,t),t}function nN(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:nH(),singleton:n}}let nH=()=>Symbol();function nz(...e){let t=nF(),n=Array(e.length),r=0,i=Math.pow(2,e.length)-1;return e.forEach((e,o)=>{let s=Math.pow(2,o);e(1,e=>{n[o]=e,(r|=s)===i&&t(0,n)})}),function(e,o){switch(e){case 2:return void nw(t);case 1:return r===i&&o(n),t(1,o)}}}function n$(e,t=nT){return nO(e,nD(t))}function nW(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(np)}}(...e.map(e=>e(1,n)))}}}var n_=((o=n_||{})[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARN=2]="WARN",o[o.ERROR=3]="ERROR",o);let nq={0:"debug",3:"error",1:"log",2:"warn"},nG=nN(()=>{let e=nj(3);return{log:nj((t,n,r=1)=>{var i;r>=(null!=(i=(typeof globalThis>"u"?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:nC(e))&&console[nq[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function nU(e,t,n){return nK(e,t,n).callbackRef}function nK(e,t,n){let r=D.useRef(null),i=e=>{};if("u">typeof ResizeObserver){let o=D.useMemo(()=>new ResizeObserver(t=>{let r=()=>{let n=t[0].target;null!==n.offsetParent&&e(n)};n?r():requestAnimationFrame(r)}),[e]);i=e=>{e&&t?(o.observe(e),r.current=e):(r.current&&o.unobserve(r.current),r.current=null)}}return{callbackRef:i,ref:r}}function nY(e,t,n,r,i,o,s,l,a){return nK(D.useCallback(n=>{let a=function(e,t,n,r){let i=e.length;if(0===i)return null;let o=[];for(let s=0;s<i;s++){let i=e.item(s);if(void 0===i.dataset.index)continue;let l=parseInt(i.dataset.index),a=parseFloat(i.dataset.knownSize),c=t(i,n);if(0===c&&r("Zero-sized element, this should not happen",{child:i},n_.ERROR),c===a)continue;let u=o[o.length-1];0===o.length||u.size!==c||u.endIndex!==l-1?o.push({endIndex:l,size:c,startIndex:l}):o[o.length-1].endIndex++}return o}(n.children,t,l?"offsetWidth":"offsetHeight",i),c=n.parentElement;for(;!c.dataset.virtuosoScroller;)c=c.parentElement;let u="window"===c.lastElementChild.dataset.viewportType,h=s?l?s.scrollLeft:s.scrollTop:u?l?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:l?c.scrollLeft:c.scrollTop;r({scrollHeight:s?l?s.scrollWidth:s.scrollHeight:u?l?document.documentElement.scrollWidth:document.documentElement.scrollHeight:l?c.scrollWidth:c.scrollHeight,scrollTop:Math.max(h,0),viewportHeight:s?l?s.offsetWidth:s.offsetHeight:u?l?window.innerWidth:window.innerHeight:l?c.offsetWidth:c.offsetHeight}),null==o||o(l?nX("column-gap",getComputedStyle(n).columnGap,i):nX("row-gap",getComputedStyle(n).rowGap,i)),null!==a&&e(a)},[e,t,i,o,s,r]),n,a)}function nX(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n(`${e} was not resolved to pixel value correctly`,t,n_.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}function nQ(e,t,n){let r=D.useRef(null),i=D.useCallback(n=>{let i,o;if(!(null!=n&&n.offsetParent))return;let s=n.getBoundingClientRect(),l=s.width;if(t){let e=t.getBoundingClientRect(),n=s.top-e.top;o=e.height-Math.max(0,n),i=n+t.scrollTop}else o=window.innerHeight-Math.max(0,s.top),i=s.top+window.pageYOffset;r.current={offsetTop:i,visibleHeight:o,visibleWidth:l},e(r.current)},[e,t]),{callbackRef:o,ref:s}=nK(i,!0,n),l=D.useCallback(()=>{i(s.current)},[i,s]);return D.useEffect(()=>{if(!t)return window.addEventListener("scroll",l),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l),window.removeEventListener("resize",l)};{t.addEventListener("scroll",l);let e=new ResizeObserver(()=>{requestAnimationFrame(l)});return e.observe(t),()=>{t.removeEventListener("scroll",l),e.unobserve(t)}}},[l,t]),o}let nJ=nN(()=>{let e=nF(),t=nF(),n=nj(0),r=nF(),i=nj(0),o=nF(),s=nF(),l=nj(0),a=nj(0),c=nj(0),u=nj(0),h=nF(),d=nF(),f=nj(!1),p=nj(!1),m=nj(!1);return nS(nO(e,nR(({scrollTop:e})=>e)),t),nS(nO(e,nR(({scrollHeight:e})=>e)),s),nS(t,i),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:a,footerHeight:u,headerHeight:l,horizontalDirection:p,scrollBy:d,scrollContainerState:e,scrollHeight:s,scrollingInProgress:f,scrollTo:h,scrollTop:t,skipAnimationFrameInResizeObserver:m,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:o}},[],{singleton:!0}),n0={lvl:0};function n1(e,t){let n=e.length;if(0===n)return[];let{index:r,value:i}=t(e[0]),o=[];for(let s=1;s<n;s++){let{index:n,value:l}=t(e[s]);o.push({end:n-1,start:r,value:i}),r=n,i=l}return o.push({end:1/0,start:r,value:i}),o}function n2(e){return e===n0}function n5(e,t){if(!n2(e))return t===e.k?e.v:t<e.k?n5(e.l,t):n5(e.r,t)}function n3(e,t,n="k"){if(n2(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=n3(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return n3(e.l,t,n)}function n8(e,t,n){return n2(e)?rt(t,n,1):t===e.k?n7(e,{k:t,v:n}):t<e.k?rr(rn(n7(e,{l:n8(e.l,t,n)}))):rr(rn(n7(e,{r:n8(e.r,t,n)})))}function n4(e,t,n){if(n2(e))return[];let r=n3(e,t)[0];return n1(function e(t,n,r){if(n2(t))return[];let{k:i,l:o,r:s,v:l}=t,a=[];return i>n&&(a=a.concat(e(o,n,r))),i>=n&&i<=r&&a.push({k:i,v:l}),i<=r&&(a=a.concat(e(s,n,r))),a}(e,r,n),({k:e,v:t})=>({index:e,value:t}))}function n6(e){return n2(e)?[]:[...n6(e.l),{k:e.k,v:e.v},...n6(e.r)]}function n9(e){let{l:t,lvl:n,r:r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(re(t))return rn(n7(e,{lvl:n-1}));if(!n2(t)&&!n2(t.r))return n7(t.r,{l:n7(t,{r:t.r.l}),lvl:n,r:n7(e,{l:t.r.r,lvl:n-1})});throw Error("Unexpected empty nodes")}if(re(e))return rr(n7(e,{lvl:n-1}));if(n2(r)||n2(r.l))throw Error("Unexpected empty nodes");{let t=r.l,i=re(t)?r.lvl-1:r.lvl;return n7(t,{l:n7(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:rr(n7(r,{l:t.r,lvl:i}))})}}function n7(e,t){return rt(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function re(e){return n2(e)||e.lvl>e.r.lvl}function rt(e,t,n,r=n0,i=n0){return{k:e,l:r,lvl:n,r:i,v:t}}function rn(e){let{l:t}=e;return n2(t)||t.lvl!==e.lvl?e:n7(t,{r:n7(e,{l:t.r})})}function rr(e){let{lvl:t,r:n}=e;return n2(n)||n2(n.r)||n.lvl!==t||n.r.lvl!==t?e:n7(n,{l:n7(e,{r:n.l}),lvl:t+1})}function ri(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function ro(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}let rs=nN(()=>({recalcInProgress:nj(!1)}),[],{singleton:!0});function rl(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let o=Math.floor((r+i)/2),s=n(e[o],t);if(0===s)return o;if(-1===s){if(i-r<2)return o-1;i=o-1}else{if(i===r)return o;r=o+1}}throw Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function ra(e,t){return Math.round(e.getBoundingClientRect()[t])}function rc(e){return!n2(e.groupOffsetTree)}function ru({index:e},t){return t===e?0:t<e?-1:1}function rh({offset:e},t){return t===e?0:t<e?-1:1}function rd(e,t,n){if(0===t.length)return 0;let{index:r,offset:i,size:o}=t[rl(t,e,ru)],s=e-r,l=o*s+(s-1)*n+i;return l>0?l+n:l}function rf(e,t){if(!rc(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function rp(e,t,n){if("u">typeof e.groupIndex)return t.groupIndices[e.groupIndex]+1;{let r=rf("LAST"===e.index?n:e.index,t);return Math.max(0,r,Math.min(n,r))}}function rm(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,n_.DEBUG);let o=e.sizeTree,s=o,l=0;if(n.length>0&&n2(o)&&2===t.length){let e=t[0].size,r=t[1].size;s=n.reduce((t,n)=>n8(n8(t,n,e),n+1,r),s)}else[s,l]=function(e,t){let n=n2(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:o}=r;if(n=Math.min(n,o),n2(e)){e=n8(e,0,i);continue}let s=n4(e,o-1,t+1);if(s.some(function(e){let{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}(r)))continue;let l=!1,a=!1;for(let{end:n,start:r,value:o}of s)l?(t>=r||i===o)&&(e=function e(t,n){if(n2(t))return n0;let{k:r,l:i,r:o}=t;if(n!==r)return n<r?n9(n7(t,{l:e(i,n)})):n9(n7(t,{r:e(o,n)}));if(n2(i))return o;if(n2(o))return i;{let[e,n]=function e(t){return n2(t.r)?[t.k,t.v]:e(t.r)}(i);return n9(n7(t,{k:e,l:function e(t){return n2(t.r)?t.l:n9(n7(t,{r:e(t.r)}))}(i),v:n}))}}(e,r)):(a=o!==i,l=!0),n>t&&t>=r&&o!==i&&(e=n8(e,t+1,o));a&&(e=n8(e,o,i))}return[e,n]}(s,t);if(s===o)return e;let{lastIndex:a,lastOffset:c,lastSize:u,offsetTree:h}=rv(e.offsetTree,l,s,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>n8(e,t,rd(t,h,i)),n0),lastIndex:a,lastOffset:c,lastSize:u,offsetTree:h,sizeTree:s}}function rg(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n!==e)}function rv(e,t,n,r){let i=e,o=0,s=0,l=0,a=0;if(0!==t){a=rl(i,t-1,ru),l=i[a].offset;let e=n3(n,t-1);o=e[0],s=e[1],i.length&&i[a].size===n3(n,t)[1]&&(a-=1),i=i.slice(0,a+1)}else i=[];for(let{start:e,value:a}of n4(n,t,1/0)){let t=e-o,n=t*s+l+t*r;i.push({index:e,offset:n,size:a}),o=e,l=n,s=a}return{lastIndex:o,lastOffset:l,lastSize:s,offsetTree:i}}function rb(e){return{index:e.index,value:e}}let ry={offsetHeight:"height",offsetWidth:"width"},rx=nN(([{log:e},{recalcInProgress:t}])=>{let n=nF(),r=nF(),i=nB(r,0),o=nF(),s=nF(),l=nj(0),a=nj([]),c=nj(void 0),u=nj(void 0),h=nj((e,t)=>ra(e,ry[t])),d=nj(void 0),f=nj(0),p={groupIndices:[],groupOffsetTree:n0,lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:n0},m=nB(nO(n,nL(a,e,f),nI(rm,p),nD()),p),g=nB(nO(a,nD(),nI((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),nR(({prev:e})=>e)),[]);nS(nO(a,nA(e=>e.length>0),nL(m,f),nR(([e,t,n])=>{let r=e.reduce((e,r,i)=>n8(e,r,rd(r,t.offsetTree,n)||i),n0);return{...t,groupIndices:e,groupOffsetTree:r}})),m),nS(nO(r,nL(m),nA(([e,{lastIndex:t}])=>e<t),nR(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),nS(c,u);let v=nB(nO(c,nR(e=>void 0===e)),!0);nS(nO(u,nA(e=>void 0!==e&&n2(nC(m).sizeTree)),nR(e=>[{endIndex:0,size:e,startIndex:0}])),n);let b=nV(nO(n,nL(m),nI(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:p}),nR(e=>e.changed)));nO(l,nI((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),nR(e=>e.diff))(1,e=>{let{groupIndices:n}=nC(m);if(e>0)t(0,!0),o(0,e+rg(e,n));else if(e<0){let t=nC(g);t.length>0&&(e-=rg(-e,t)),s(0,e)}}),nO(l,nL(e))(1,([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},n_.ERROR)});let y=nV(o);nS(nO(o,nL(m),nR(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=n5(t.sizeTree,0),o=0,s=0;for(;o<e;){let e=t.groupIndices[s],l=t.groupIndices.length===s+1?1/0:t.groupIndices[s+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+l-1,size:i,startIndex:e+1}),s++,o+=l+1}let l=n6(t.sizeTree);return o!==e&&l.shift(),l.reduce((t,{k:n,v:r})=>{let i=t.ranges;return 0!==t.prevSize&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return n6(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let x=nV(nO(s,nL(m,f),nR(([e,{offsetTree:t},n])=>rd(-e,t,n))));return nS(nO(s,nL(m,f),nR(([e,t,n])=>{if(t.groupIndices.length>0){if(n2(t.sizeTree))return t;let r=n0,i=nC(g),o=0,s=0,l=0;for(;o<-e;){l=i[s];let e=i[s+1]-l-1;s++,o+=e+1}return r=n6(t.sizeTree).reduce((t,{k:n,v:r})=>n8(t,Math.max(0,n+e),r),r),o!==-e&&(r=n8(r,0,n5(t.sizeTree,l)),r=n8(r,1,n3(t.sizeTree,-e+1)[1])),{...t,sizeTree:r,...rv(t.offsetTree,0,r,n)}}{let r=n6(t.sizeTree).reduce((t,{k:n,v:r})=>n8(t,Math.max(0,n+e),r),n0);return{...t,sizeTree:r,...rv(t.offsetTree,0,r,n)}}})),m),{beforeUnshiftWith:y,data:d,defaultItemSize:u,firstItemIndex:l,fixedItemSize:c,gap:f,groupIndices:a,itemSize:h,listRefresh:b,shiftWith:s,shiftWithOffset:x,sizeRanges:n,sizes:m,statefulTotalCount:i,totalCount:r,trackItemSizes:v,unshiftWith:o}},ny(nG,rs),{singleton:!0});function rw(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}let rC=nN(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let o=nF(),s=nF(),l=nV(nO(o,nR(rw)));return nS(nO(l,nR(e=>e.totalCount)),n),nS(nO(l,nR(e=>e.groupIndices)),e),nS(nO(nz(i,t,r),nA(([e,t])=>rc(t)),nR(([e,t,n])=>n3(t.groupOffsetTree,Math.max(e-n,0),"v")[0]),nD(),nR(e=>[e])),s),{groupCounts:o,topItemsIndexes:s}},ny(rx,nJ)),rS=nN(([{log:e}])=>{let t=nj(!1),n=nV(nO(t,nA(e=>e),nD()));return t(1,t=>{t&&nC(e)("props updated",{},n_.DEBUG)}),{didMount:n,propsReady:t}},ny(nG),{singleton:!0}),rk="u">typeof document&&"scrollBehavior"in document.documentElement.style;function rM(e){let t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&rk||(t.behavior="auto"),t.offset||(t.offset=0),t}let rT=nN(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:o,footerHeight:s,headerHeight:l,scrollingInProgress:a,scrollTo:c,smoothScrollTargetReached:u,viewportHeight:h},{log:d}])=>{let f=nF(),p=nF(),m=nj(0),g=null,v=null,b=null;function y(){g&&(g(),g=null),b&&(b(),b=null),v&&(clearTimeout(v),v=null),a(0,!1)}return nS(nO(f,nL(n,h,r,m,l,s,d),nL(e,o,i),nR(([[e,n,r,i,o,s,l,c],h,d,m])=>{let x=rM(e),{align:w,behavior:C,offset:S}=x,k=i-1,M=rp(x,n,k),T=rd(M,n.offsetTree,h)+s;"end"===w?(T+=d+n3(n.sizeTree,M)[1]-r+m,M===k&&(T+=l)):"center"===w?T+=(d+n3(n.sizeTree,M)[1]-r+m)/2:T-=o,S&&(T+=S);let D=t=>{y(),t?(c("retrying to scroll to",{location:e},n_.DEBUG),f(0,e)):(p(0,!0),c("list did not change, scroll successful",{},n_.DEBUG))};if(y(),"smooth"===C){let e=!1;b=t(1,t=>{e=e||t}),g=nk(u,()=>{D(e)})}else g=nk(nO(t,e=>{let t=setTimeout(()=>{e(!1)},150);return n=>{n&&(e(!0),clearTimeout(t))}}),D);return v=setTimeout(()=>{y()},1200),a(0,!0),c("scrolling from index to",{behavior:C,index:M,top:T},n_.DEBUG),{behavior:C,top:T}})),c),{scrollTargetReached:p,scrollToIndex:f,topListHeight:m}},ny(rx,nJ,nG),{singleton:!0});function rD(e,t){0==e?t():requestAnimationFrame(()=>{rD(e-1,t)})}function rA(e,t){return"number"==typeof e?e:"LAST"===e.index?t-1:e.index}let rR=nN(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:o},{didMount:s}])=>{let l=nj(!0),a=nj(0),c=nj(!0);return nS(nO(s,nL(a),nA(([e,t])=>!!t),nP(!1)),l),nS(nO(s,nL(a),nA(([e,t])=>!!t),nP(!1)),c),nO(nz(t,s),nL(l,n,e,c),nA(([[,e],t,{sizeTree:n},r,i])=>e&&(!n2(n)||ng(r))&&!t&&!i),nL(a))(1,([,e])=>{nk(i,()=>{c(0,!0)}),rD(4,()=>{nk(r,()=>{l(0,!0)}),o(0,e)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:a,scrolledToInitialItem:l}},ny(rx,nJ,rT,rS),{singleton:!0});function rP(e,t){return 1.01>Math.abs(e-t)}let rO="down",rI={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},rE=nN(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:o}])=>{let s=nj(!1),l=nj(!0),a=nF(),c=nF(),u=nj(4),h=nj(0),d=nB(nO(nW(nO(n$(i),nE(1),nP(!0)),nO(n$(i),nE(1),nP(!1),nM(100))),nD()),!1),f=nB(nO(nW(nO(n,nP(!0)),nO(n,nP(!1),nM(200))),nD()),!1);nS(nO(nz(n$(i),n$(h)),nR(([e,t])=>e<=t),nD()),l),nS(nO(l,nZ(50)),c);let p=nV(nO(nz(r,n$(o),n$(t),n$(e),n$(u)),nI((e,[{scrollHeight:t,scrollTop:n},r,i,o,s])=>{let l={scrollHeight:t,scrollTop:n,viewportHeight:r};if(n+r-t>-s){let t,r;return n>e.state.scrollTop?(t="SCROLLED_DOWN",r=e.state.scrollTop-n):(t="SIZE_DECREASED",r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:l}}return{atBottom:!1,notAtBottomBecause:l.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":r<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":n<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:l}},rI),nD((e,t)=>e&&e.atBottom===t.atBottom))),m=nB(nO(r,nI((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(rP(e.scrollHeight,t))return{changed:!1,jump:0,scrollHeight:t,scrollTop:n};{let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),nA(e=>e.changed),nR(e=>e.jump)),0);nS(nO(p,nR(e=>e.atBottom)),s),nS(nO(s,nZ(50)),a);let g=nj(rO);nS(nO(r,nR(({scrollTop:e})=>e),nD(),nI((e,t)=>nC(f)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?"up":rO,prevScrollTop:t},{direction:rO,prevScrollTop:0}),nR(e=>e.direction)),g),nS(nO(r,nZ(50),nP("none")),g);let v=nj(0);return nS(nO(d,nA(e=>!e),nP(0)),v),nS(nO(i,nZ(100),nL(d),nA(([e,t])=>!!t),nI(([e,t],[n])=>[t,n],[0,0]),nR(([e,t])=>t-e)),v),{atBottomState:p,atBottomStateChange:a,atBottomThreshold:u,atTopStateChange:c,atTopThreshold:h,isAtBottom:s,isAtTop:l,isScrolling:d,lastJumpDueToItemResize:m,scrollDirection:g,scrollVelocity:v}},ny(nJ)),rZ="bottom",rL="none";function rj(e,t,n){return"number"==typeof e?"up"===n&&"top"===t||n===rO&&t===rZ?e:0:"up"===n?"top"===t?e.main:e.reverse:t===rZ?e.main:e.reverse}function rB(e,t){var n;return"number"==typeof e?e:null!=(n=e[t])?n:0}let rF=nN(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let o=nF(),s=nj(0),l=nj(0),a=nj(0),c=nB(nO(nz(n$(r),n$(i),n$(n),n$(o,ro),n$(a),n$(s),n$(t),n$(e),n$(l)),nR(([e,t,n,[r,i],o,s,l,a,c])=>{let u=e-a,h=Math.max(n-u,0),d=rL,f=rB(c,"top"),p=rB(c,rZ);return r-=a,r+=n+l,i+=n+l,r>e+(s+l)-f&&(d="up"),(i-=a)<e-h+t+p&&(d=rO),d!==rL?[Math.max(u-n-rj(o,"top",d)-f,0),u-h-l+t+rj(o,rZ,d)+p]:null}),nA(e=>null!=e),nD(ro)),[0,0]);return{increaseViewportBy:l,listBoundary:o,overscan:a,topListHeight:s,visibleRange:c}},ny(nJ),{singleton:!0}),rV={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function rN(e,t,n,r,i,o){let{lastIndex:s,lastOffset:l,lastSize:a}=i,c=0,u=0;if(e.length>0){c=e[0].offset;let t=e[e.length-1];u=t.offset+t.size}let h=n-s,d=c,f=l+h*a+(h-1)*r-u;return{bottom:u,firstItemIndex:o,items:rz(e,i,o),offsetBottom:f,offsetTop:c,top:d,topItems:rz(t,i,o),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function rH(e,t,n,r,i,o){let s=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-s>=e)break;s++}let l=e+s,a=rA(t,l);return rN(Array.from({length:l}).map((e,t)=>({data:o[t+a],index:t+a,offset:0,size:0})),[],l,i,n,r)}function rz(e,t,n){if(0===e.length)return[];if(!rc(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,o=[],s=n4(t.groupOffsetTree,r,i),l,a=0;for(let r of e){let e;(!l||l.end<r.index)&&(l=s.shift(),a=t.groupIndices.indexOf(l.start)),e=r.index===l.start?{index:a,type:"group"}:{groupIndex:a,index:r.index-(a+1)+n},o.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return o}let r$=nN(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},o,{listBoundary:s,topListHeight:l,visibleRange:a},{initialTopMostItemIndex:c,scrolledToInitialItem:u},{topListHeight:h},d,{didMount:f},{recalcInProgress:p}])=>{let m=nj([]),g=nj(0),v=nF();nS(o.topItemsIndexes,m);let b=nB(nO(nz(f,p,n$(a,ro),n$(i),n$(r),n$(c),u,n$(m),n$(t),n$(n),e),nA(([e,t,,n,,,,,,,r])=>{let i=r&&r.length!==n;return e&&!t&&!i}),nR(([,,[e,t],n,r,i,o,s,l,a,c])=>{var u;let{offsetTree:h,sizeTree:d}=r,f=nC(g);if(0===n)return{...rV,totalCount:n};if(0===e&&0===t)return 0===f?{...rV,totalCount:n}:rH(f,i,r,l,a,c||[]);if(n2(d))return f>0?null:rN(function(e,t,n){if(rc(t)){let r=rf(e,t);return[{index:n3(t.groupOffsetTree,r)[0],offset:0,size:0},{data:null==n?void 0:n[0],index:r,offset:0,size:0}]}return[{data:null==n?void 0:n[0],index:e,offset:0,size:0}]}(rA(i,n),r,c),[],n,a,r,l);let p=[];if(s.length>0){let e=s[0],t=s[s.length-1],n=0;for(let r of n4(d,e,t)){let i=r.value,o=Math.max(r.start,e),s=Math.min(r.end,t);for(let e=o;e<=s;e++)p.push({data:null==c?void 0:c[e],index:e,offset:n,size:i}),n+=i}}if(!o)return rN([],p,n,a,r,l);let m=s.length>0?s[s.length-1]+1:0,v=function(e,t,n,r=0){return r>0&&(t=Math.max(t,e[rl(e,r,ru)].offset)),n1(function(e,t,n,r){let i=rl(e,t,r),o=rl(e,n,r,i);return e.slice(i,o+1)}(e,t,n,rh),rb)}(h,e,t,m);if(0===v.length)return null;let b=n-1;return rN(((n=>{for(let r of v){let i=r.value,o=i.offset,s=r.start,l=i.size;if(i.offset<e){let t=(s+=Math.floor((e-i.offset+a)/(l+a)))-r.start;o+=t*l+t*a}s<m&&(o+=(m-s)*l,s=m);let u=Math.min(r.end,b);for(let e=s;e<=u&&!(o>=t);e++)n.push({data:null==c?void 0:c[e],index:e,offset:o,size:l}),o+=l+a}})(u=[]),u),p,n,a,r,l)}),nA(e=>null!==e),nD()),rV);nS(nO(e,nA(ng),nR(e=>null==e?void 0:e.length)),i),nS(nO(b,nR(e=>e.topListHeight)),h),nS(h,l),nS(nO(b,nR(e=>[e.top,e.bottom])),s),nS(nO(b,nR(e=>e.items)),v);let y=nV(nO(b,nA(({items:e})=>e.length>0),nL(i,e),nA(([{items:e},t])=>e[e.length-1].originalIndex===t-1),nR(([,e,t])=>[e-1,t]),nD(ro),nR(([e])=>e))),x=nV(nO(b,nZ(200),nA(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),nR(({items:e})=>e[0].index),nD())),w=nV(nO(b,nA(({items:e})=>e.length>0),nR(({items:e})=>{let t=0,n=e.length-1;for(;"group"===e[t].type&&t<n;)t++;for(;"group"===e[n].type&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),nD(ri)));return{endReached:y,initialItemCount:g,itemsRendered:v,listState:b,rangeChanged:w,startReached:x,topItemsIndexes:m,...d}},ny(rx,rC,rF,rR,rT,rE,rS,rs),{singleton:!0}),rW=nN(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let o=nF(),s=nB(nO(nz(n,e,r,t,i),nR(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return nS(n$(s),o),{totalListHeight:s,totalListHeightChanged:o}},ny(nJ,r$),{singleton:!0}),r_=nN(([{viewportHeight:e},{totalListHeight:t}])=>{let n=nj(!1),r=nB(nO(nz(n,e,t),nA(([e])=>e),nR(([,e,t])=>Math.max(0,e-t)),nZ(0),nD()),0);return{alignToBottom:n,paddingTopAddition:r}},ny(nJ,rW),{singleton:!0});function rq(e){return!!e&&("smooth"===e?"smooth":"auto")}let rG=nN(([{listRefresh:e,totalCount:t},{atBottomState:n,isAtBottom:r},{scrollToIndex:i},{scrolledToInitialItem:o},{didMount:s,propsReady:l},{log:a},{scrollingInProgress:c}])=>{let u=nj(!1),h=nF(),d=null;function f(e){i(0,{align:"end",behavior:e,index:"LAST"})}function p(e){setTimeout(nk(n,t=>{!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||d||(nC(a)("scrolling to bottom due to increased size",{},n_.DEBUG),f("auto"))}),100)}return nO(nz(nO(n$(t),nE(1)),s),nL(n$(u),r,o,c),nR(([[e,t],n,r,i,o])=>{let s,l=t&&i,a="auto";return l&&(s=r||o,a="function"==typeof n?rq(n(s)):s&&rq(n),l=l&&!!a),{followOutputBehavior:a,shouldFollow:l,totalCount:e}}),nA(({shouldFollow:e})=>e))(1,({followOutputBehavior:t,totalCount:n})=>{d&&(d(),d=null),d=nk(e,()=>{nC(a)("following output to ",{totalCount:n},n_.DEBUG),f(t),d=null})}),nO(nz(n$(u),t,l),nA(([e,,t])=>e&&t),nI(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),nA(({refreshed:e})=>e),nL(u,t))(1,([,e])=>{nC(o)&&p(!1!==e)}),h(1,()=>{p(!1!==nC(u))}),nz(n$(u),n)(1,([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&f("auto")}),{autoscrollToBottom:h,followOutput:u}},ny(rx,rE,rT,rR,rS,nG,nJ)),rU=nN(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:s},{didMount:l}])=>(nS(nO(l,nL(o),nA(([,e])=>0!==e),nL(i,r,t,n,e),nR(([[,e],t,n,r,i,o=[]])=>rH(e,t,n,r,i,o))),s),{}),ny(rx,rR,r$,rS),{singleton:!0}),rK=nN(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=nj(0);return nO(e,nL(r),nA(([,e])=>0!==e),nR(([,e])=>({top:e})))(1,e=>{nk(nO(n,nE(1),nA(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{t(0,e)})})}),{initialScrollTop:r}},ny(rS,nJ,r$),{singleton:!0}),rY=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:o,viewportTop:s})=>t<s?{...i,align:null!=n?n:"start",behavior:r}:e>o?{...i,align:null!=n?n:"end",behavior:r}:null,rX=nN(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:s,scrollTop:l,viewportHeight:a},{scrollToIndex:c}])=>{let u=nF();return nS(nO(u,nL(t,a,n,o,i,r,l),nL(e),nR(([[e,t,n,r,i,o,l,a],c])=>{let{align:u,behavior:h,calculateViewLocation:d=rY,done:f,...p}=e,m=rp(e,t,r-1),g=rd(m,t.offsetTree,c)+i+o,v=d({itemBottom:g+n3(t.sizeTree,m)[1],itemTop:g,locationParams:{align:u,behavior:h,...p},viewportBottom:a+n-l,viewportTop:a+o});return v?f&&nk(nO(s,nA(e=>!e),nE(nC(s)?1:2)),f):f&&f(),v}),nA(e=>null!==e)),c),{scrollIntoView:u}},ny(rx,nJ,rT,r$,nG),{singleton:!0}),rQ=nN(([{scrollVelocity:e}])=>{let t=nj(!1),n=nF(),r=nj(!1);return nS(nO(e,nL(r,t,n),nA(([e,t])=>!!t),nR(([e,t,n,r])=>{let{enter:i,exit:o}=t;if(n){if(o(e,r))return!1}else if(i(e,r))return!0;return n}),nD()),t),nO(nz(t,e,n),nL(r))(1,([[e,t,n],r])=>{e&&r&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},ny(rE),{singleton:!0}),rJ=nN(([{scrollContainerState:e,scrollTo:t}])=>{let n=nF(),r=nF(),i=nF(),o=nj(!1),s=nj(void 0);return nS(nO(nz(n,r),nR(([{scrollHeight:e,scrollTop:t,viewportHeight:n},{offsetTop:r}])=>({scrollHeight:e,scrollTop:Math.max(0,t-r),viewportHeight:n}))),e),nS(nO(t,nL(r),nR(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:s,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},ny(nJ)),r0=nN(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:s,windowScrollContainerState:l,windowViewportRect:a}])=>{let c=nF(),u=nj(void 0),h=nj(null),d=nj(null);return nS(l,h),nS(a,d),nO(c,nL(t,r,s,h,d,n))(1,([e,t,n,r,i,o,s])=>{let l=n6(t.sizeTree).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:i?i.k-1:1/0,size:t,startIndex:e}});r&&null!==i&&null!==o&&(n=i.scrollTop-o.offsetTop),e({ranges:l,scrollTop:n-=s})}),nS(nO(u,nA(ng),nR(r1)),i),nS(nO(o,nL(u),nA(([,e])=>void 0!==e),nD(),nR(([,e])=>e.ranges)),e),{getState:c,restoreStateFrom:u}},ny(rx,nJ,rR,rS,rJ));function r1(e){return{align:"start",index:0,offset:e.scrollTop}}let r2=nN(([{topItemsIndexes:e}])=>{let t=nj(0);return nS(nO(t,nA(e=>e>=0),nR(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},ny(r$));function r5(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}let r3=r5(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),r8=nN(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:o,lastJumpDueToItemResize:s,scrollDirection:l},{listState:a},{beforeUnshiftWith:c,gap:u,shiftWithOffset:h,sizes:d},{log:f},{recalcInProgress:p}])=>{let m=nV(nO(a,nL(s),nI(([,e,t,n],[{bottom:r,items:i,offsetBottom:o,totalCount:s},l])=>{let a=r+o,c=0;return t===s&&e.length>0&&i.length>0&&(0===i[0].originalIndex&&0===e[0].originalIndex||0!=(c=a-n)&&(c+=l)),[c,i,s,a]},[0,[],0,0]),nA(([e])=>0!==e),nL(r,l,n,i,f,p),nA(([,e,t,n,,,r])=>!r&&!n&&0!==e&&"up"===t),nR(([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},n_.DEBUG),e))));function g(n){n>0?(t(0,{behavior:"auto",top:-n}),e(0,0)):(e(0,0),t(0,{behavior:"auto",top:-n}))}return nO(m,nL(e,o))(1,([t,n,r])=>{r&&r3()?e(0,n-t):g(-t)}),nO(nz(nB(o,!1),e,p),nA(([e,t,n])=>!e&&!n&&0!==t),nR(([e,t])=>t),nZ(1))(1,g),nS(nO(h,nR(e=>({top:-e}))),t),nO(c,nL(d,u),nR(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{if(0===t.length)return e*(n+i);{let o=0,s=n5(r,0),l=0,a=0;for(;l<e;){l++,o+=s;let r=t.length===a+1?1/0:t[a+1]-t[a]-1;l+r>e&&(o-=s,r=e-l+1),l+=r,o+=r*(n+i),a++}return o}}))(1,n=>{e(0,n),requestAnimationFrame(()=>{t(0,{top:n}),requestAnimationFrame(()=>{var t;t=0,e(0,0),p(0,!1)})})}),{deviation:e}},ny(nJ,rE,r$,rx,nG,rs)),r4=nN(([e,t,n,r,i,o,s,l,a,c])=>({...e,...t,...n,...r,...i,...o,...s,...l,...a,...c}),ny(rF,rU,rS,rQ,rW,rK,r_,rJ,rX,nG)),r6=nN(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,gap:i,groupIndices:o,itemSize:s,sizeRanges:l,sizes:a,statefulTotalCount:c,totalCount:u,trackItemSizes:h},{initialItemFinalLocationReached:d,initialTopMostItemIndex:f,scrolledToInitialItem:p},m,g,v,{listState:b,topItemsIndexes:y,...x},{scrollToIndex:w},C,{topItemCount:S},{groupCounts:k},M])=>(nS(x.rangeChanged,M.scrollSeekRangeChanged),nS(nO(M.windowViewportRect,nR(e=>e.visibleHeight)),m.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,gap:i,groupCounts:k,initialItemFinalLocationReached:d,initialTopMostItemIndex:f,scrolledToInitialItem:p,sizeRanges:l,topItemCount:S,topItemsIndexes:y,totalCount:u,...v,groupIndices:o,itemSize:s,listState:b,scrollToIndex:w,statefulTotalCount:c,trackItemSizes:h,...x,...M,...m,sizes:a,...g}),ny(rx,rR,nJ,r0,rG,r$,rT,r8,r2,rC,r4)),r9="u">typeof document?D.useLayoutEffect:D.useEffect;function r7(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),s=Object.keys(t.events||{}),l=D.createContext({});function a(e,n){var o,s,l,a;for(let i of(e.propsReady&&(o=e.propsReady,o(0,!1)),r)){s=e[t.required[i]],s(0,n[i])}for(let r of i){r in n&&(l=e[t.optional[r]],l(0,n[r]))}e.propsReady&&(a=e.propsReady,a(0,!0))}function c(e){return s.reduce((n,r)=>(n[r]=function(e){let t,n,r=()=>null==t?void 0:t();return function(i,o){switch(i){case 1:return o?n===o?void 0:(r(),n=o,t=e(1,o)):(r(),nv);case 2:r(),n=null;return}}}(e[t.events[r]]),n),{})}return{Component:D.forwardRef((u,h)=>{var d;let{children:f,...p}=u,[m]=D.useState(()=>{var t;return a(t=function(e){let t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:o})=>{if(o&&t.has(i))return t.get(i);let s=e(r.map(e=>n(e)));return o&&t.set(i,s),s};return n(e)}(e),p),t}),[g]=D.useState(()=>c(m));return r9(()=>{for(let e of s)e in p&&(0,g[e])(1,p[e]);return()=>{Object.values(g).map(nw)}},[p,g,m]),r9(()=>{a(m,p)}),D.useImperativeHandle(h,(d=o.reduce((e,n)=>(e[n]=e=>{var r;r=m[t.methods[n]],r(0,e)},e),{}),()=>d)),(0,T.jsx)(l.Provider,{value:m,children:n?(0,T.jsx)(n,{...function(e,t){let n={},r={},i=0,o=e.length;for(;i<o;)r[e[i]]=1,i+=1;for(let e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}([...r,...i,...s],p),children:f}):f})}),useEmitter:(e,t)=>{let n=D.useContext(l)[e];r9(()=>n(1,t),[t,n])},useEmitterValue:D.version.startsWith("18")?e=>{let t=D.useContext(l)[e],n=D.useCallback(e=>t(1,e),[t]);return D.useSyncExternalStore(n,()=>nC(t),()=>nC(t))}:e=>{let t=D.useContext(l)[e],[n,r]=D.useState(()=>nC(t));return r9(()=>t(1,e=>{e!==n&&r(()=>e)}),[t,n]),n},usePublisher:e=>{var t;return D.useCallback((t=D.useContext(l)[e],e=>(function(e,t){e(0,t)})(t,e)),[e])}}}let ie=D.createContext(void 0),it=D.createContext(void 0),ir="u">typeof document?D.useLayoutEffect:D.useEffect;function ii(e,t,n,r=nv,i,o){let s=D.useRef(null),l=D.useRef(null),a=D.useRef(null),c=D.useCallback(n=>{let r=n.target,i=r===window||r===document,s=o?i?window.pageXOffset||document.documentElement.scrollLeft:r.scrollLeft:i?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,c=o?i?document.documentElement.scrollWidth:r.scrollWidth:i?document.documentElement.scrollHeight:r.scrollHeight,u=o?i?window.innerWidth:r.offsetWidth:i?window.innerHeight:r.offsetHeight,h=()=>{e({scrollHeight:c,scrollTop:Math.max(s,0),viewportHeight:u})};n.suppressFlushSync?h():eL.flushSync(h),null!==l.current&&(s===l.current||s<=0||s===c-u)&&(l.current=null,t(!0),a.current&&(clearTimeout(a.current),a.current=null))},[e,t]);return D.useEffect(()=>{let e=i||s.current;return r(i||s.current),c({suppressFlushSync:!0,target:e}),e.addEventListener("scroll",c,{passive:!0}),()=>{r(null),e.removeEventListener("scroll",c)}},[s,c,n,r,i]),{scrollByCallback:function(e){o&&(e={behavior:e.behavior,left:e.top}),s.current.scrollBy(e)},scrollerRef:s,scrollToCallback:function(n){let r,i,c,u=s.current;if(!u||(o?"offsetWidth"in u&&0===u.offsetWidth:"offsetHeight"in u&&0===u.offsetHeight))return;let h="smooth"===n.behavior;u===window?(i=Math.max(ra(document.documentElement,o?"width":"height"),o?document.documentElement.scrollWidth:document.documentElement.scrollHeight),r=o?window.innerWidth:window.innerHeight,c=o?document.documentElement.scrollLeft:document.documentElement.scrollTop):(i=u[o?"scrollWidth":"scrollHeight"],r=ra(u,o?"width":"height"),c=u[o?"scrollLeft":"scrollTop"]);let d=i-r;if(n.top=Math.ceil(Math.max(Math.min(d,n.top),0)),rP(r,i)||n.top===c){e({scrollHeight:i,scrollTop:c,viewportHeight:r}),h&&t(!0);return}h?(l.current=n.top,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,l.current=null,t(!0)},1e3)):l.current=null,o&&(n={behavior:n.behavior,left:n.top}),u.scrollTo(n)}}}let io="-webkit-sticky",is="sticky",il=r5(()=>{if(typeof document>"u")return is;let e=document.createElement("div");return e.style.position=io,e.style.position===io?io:is});function ia(e){return e}let ic=nN(()=>{let e=nj(e=>`Item ${e}`),t=nj(null),n=nj(e=>`Group ${e}`),r=nj({}),i=nj(ia),o=nj("div"),s=nj(nv),l=(e,t=null)=>nB(nO(r,nR(t=>t[e]),nD()),t);return{components:r,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FooterComponent:l("Footer"),GroupComponent:l("Group","div"),groupContent:n,HeaderComponent:l("Header"),HeaderFooterTag:o,ItemComponent:l("Item","div"),itemContent:e,ListComponent:l("List","div"),ScrollerComponent:l("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TopItemListComponent:l("TopItemList")}}),iu=nN(([e,t])=>({...e,...t}),ny(r6,ic)),ih=({height:e})=>(0,T.jsx)("div",{style:{height:e}}),id={overflowAnchor:"none",position:il(),zIndex:1},ip={overflowAnchor:"none"},im={...ip,display:"inline-block",height:"100%"},ig=D.memo(function({showTopList:e=!1}){let t=iI("listState"),n=iE("sizeRanges"),r=iI("useWindowScroll"),i=iI("customScrollParent"),o=iE("windowScrollContainerState"),s=iE("scrollContainerState"),l=iI("itemContent"),a=iI("context"),c=iI("groupContent"),u=iI("trackItemSizes"),h=iI("itemSize"),d=iI("log"),f=iE("gap"),p=iI("horizontalDirection"),{callbackRef:m}=nY(n,h,u,e?nv:i||r?o:s,d,f,i,p,iI("skipAnimationFrameInResizeObserver")),[g,v]=D.useState(0);iO("deviation",e=>{g!==e&&v(e)});let b=iI("EmptyPlaceholder"),y=iI("ScrollSeekPlaceholder")||ih,x=iI("ListComponent"),w=iI("ItemComponent"),C=iI("GroupComponent"),S=iI("computeItemKey"),k=iI("isSeeking"),M=iI("groupIndices").length>0,A=iI("alignToBottom"),R=iI("initialItemFinalLocationReached"),P=e?{}:{boxSizing:"border-box",...p?{display:"inline-block",height:"100%",marginLeft:0!==g?g:A?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:0!==g?g:A?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...R?{}:{visibility:"hidden"}};return!e&&0===t.totalCount&&b?(0,T.jsx)(b,{...iw(b,a)}):(0,T.jsx)(x,{...iw(x,a),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:m,style:P,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=S(n+t.firstItemIndex,e.data,a);return k?(0,D.createElement)(y,{...iw(y,a),height:e.size,index:e.index,key:r,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?(0,D.createElement)(C,{...iw(C,a),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:id},c(e.index,a)):(0,D.createElement)(w,{...iw(w,a),...iC(w,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:p?im:ip},M?l(e.index,e.groupIndex,e.data,a):l(e.index,e.data,a))})})}),iv={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},ib={outline:"none",overflowX:"auto",position:"relative"},iy=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),ix={position:il(),top:0,width:"100%",zIndex:1};function iw(e,t){if("string"!=typeof e)return{context:t}}function iC(e,t){return{item:"string"==typeof e?void 0:t}}let iS=D.memo(function(){let e=iI("HeaderComponent"),t=iE("headerHeight"),n=iI("HeaderFooterTag"),r=nU(D.useMemo(()=>e=>{t(ra(e,"height"))},[t]),!0,iI("skipAnimationFrameInResizeObserver")),i=iI("context");return e?(0,T.jsx)(n,{ref:r,children:(0,T.jsx)(e,{...iw(e,i)})}):null}),ik=D.memo(function(){let e=iI("FooterComponent"),t=iE("footerHeight"),n=iI("HeaderFooterTag"),r=nU(D.useMemo(()=>e=>{t(ra(e,"height"))},[t]),!0,iI("skipAnimationFrameInResizeObserver")),i=iI("context");return e?(0,T.jsx)(n,{ref:r,children:(0,T.jsx)(e,{...iw(e,i)})}):null});function iM({useEmitter:e,useEmitterValue:t,usePublisher:n}){return D.memo(function({children:r,style:i,...o}){let s=n("scrollContainerState"),l=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),c=t("scrollerRef"),u=t("context"),h=t("horizontalDirection")||!1,{scrollByCallback:d,scrollerRef:f,scrollToCallback:p}=ii(s,a,l,c,void 0,h);return e("scrollTo",p),e("scrollBy",d),(0,T.jsx)(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:f,style:{...h?ib:iv,...i},tabIndex:0,...o,...iw(l,u),children:r})})}function iT({useEmitter:e,useEmitterValue:t,usePublisher:n}){return D.memo(function({children:r,style:i,...o}){let s=n("windowScrollContainerState"),l=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),c=t("totalListHeight"),u=t("deviation"),h=t("customScrollParent"),d=t("context"),{scrollByCallback:f,scrollerRef:p,scrollToCallback:m}=ii(s,a,l,nv,h);return ir(()=>(p.current=h||window,()=>{p.current=null}),[p,h]),e("windowScrollTo",m),e("scrollBy",f),(0,T.jsx)(l,{"data-virtuoso-scroller":!0,style:{position:"relative",...i,...0!==c?{height:c+u}:{}},...o,...iw(l,d),children:r})})}let iD=({children:e})=>{let t=D.useContext(ie),n=iE("viewportHeight"),r=iE("fixedItemHeight"),i=iI("alignToBottom"),o=iI("horizontalDirection"),s=nU(D.useMemo(()=>nm(n,e=>ra(e,o?"width":"height")),[n,o]),!0,iI("skipAnimationFrameInResizeObserver"));return D.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,T.jsx)("div",{"data-viewport-type":"element",ref:s,style:iy(i),children:e})},iA=({children:e})=>{let t=D.useContext(ie),n=iE("windowViewportRect"),r=iE("fixedItemHeight"),i=nQ(n,iI("customScrollParent"),iI("skipAnimationFrameInResizeObserver")),o=iI("alignToBottom");return D.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,T.jsx)("div",{"data-viewport-type":"window",ref:i,style:iy(o),children:e})},iR=({children:e})=>{let t=iI("TopItemListComponent")||"div",n=iI("headerHeight"),r={...ix,marginTop:`${n}px`},i=iI("context");return(0,T.jsx)(t,{style:r,...iw(t,i),children:e})},{Component:iP,useEmitter:iO,useEmitterValue:iI,usePublisher:iE}=r7(iu,{events:{atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",endReached:"endReached",groupIndices:"groupIndices",isScrolling:"isScrolling",itemsRendered:"itemsRendered",rangeChanged:"rangeChanged",startReached:"startReached",totalListHeightChanged:"totalListHeightChanged"},methods:{autoscrollToBottom:"autoscrollToBottom",getState:"getState",scrollBy:"scrollBy",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollToIndex:"scrollToIndex"},optional:{alignToBottom:"alignToBottom",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",components:"components",computeItemKey:"computeItemKey",context:"context",customScrollParent:"customScrollParent",data:"data",defaultItemHeight:"defaultItemHeight",firstItemIndex:"firstItemIndex",fixedItemHeight:"fixedItemHeight",followOutput:"followOutput",groupContent:"groupContent",groupCounts:"groupCounts",headerFooterTag:"HeaderFooterTag",horizontalDirection:"horizontalDirection",increaseViewportBy:"increaseViewportBy",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",initialTopMostItemIndex:"initialTopMostItemIndex",itemContent:"itemContent",itemSize:"itemSize",logLevel:"logLevel",overscan:"overscan",restoreStateFrom:"restoreStateFrom",scrollerRef:"scrollerRef",scrollSeekConfiguration:"scrollSeekConfiguration",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver",topItemCount:"topItemCount",totalCount:"totalCount",useWindowScroll:"useWindowScroll"},required:{}},D.memo(function(e){let t=iI("useWindowScroll"),n=iI("topItemsIndexes").length>0,r=iI("customScrollParent"),i=iI("context"),o=r||t?iL:iZ,s=r||t?iA:iD;return(0,T.jsxs)(o,{...e,...iw(o,i),children:[n&&(0,T.jsx)(iR,{children:(0,T.jsx)(ig,{showTopList:!0})}),(0,T.jsxs)(s,{children:[(0,T.jsx)(iS,{}),(0,T.jsx)(ig,{}),(0,T.jsx)(ik,{})]})]})})),iZ=iM({useEmitter:iO,useEmitterValue:iI,usePublisher:iE}),iL=iT({useEmitter:iO,useEmitterValue:iI,usePublisher:iE}),ij=nN(()=>{let e=nj(e=>(0,T.jsxs)("td",{children:["Item $",e]})),t=nj(null),n=nj(null),r=nj(null),i=nj({}),o=nj(ia),s=nj(nv),l=(e,t=null)=>nB(nO(i,nR(t=>t[e]),nD()),t);return{components:i,computeItemKey:o,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:r,fixedHeaderContent:n,itemContent:e,ScrollerComponent:l("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr")}}),iB=nN(([e,t])=>({...e,...t}),ny(r6,ij)),iF=({height:e})=>(0,T.jsx)("tr",{children:(0,T.jsx)("td",{style:{height:e}})}),iV=({height:e})=>(0,T.jsx)("tr",{children:(0,T.jsx)("td",{style:{border:0,height:e,padding:0}})}),iN={overflowAnchor:"none"},iH=D.memo(function({showTopList:e=!1}){let t=iG("listState"),n=iG("computeItemKey"),r=iG("firstItemIndex"),i=iG("isSeeking"),o=iG("ScrollSeekPlaceholder")||iF,s=iG("context"),l=iG("TableRowComponent"),a=iG("fixedHeaderHeight"),c=iG("itemContent"),u=(e?t.topItems:[]).reduce((e,t,n)=>(0===n?e.push(t.size):e.push(e[n-1]+t.size),e),[]),h=(e?t.topItems:t.items).map(t=>{let h=t.originalIndex,d=n(h+r,t.data,s),f=e?0===h?0:u[h-1]:0;return i?(0,D.createElement)(o,{...iw(o,s),height:t.size,index:t.index,key:d,type:t.type||"item"}):(0,D.createElement)(l,{...iw(l,s),...iC(l,t.data),"data-index":h,"data-item-index":t.index,"data-known-size":t.size,key:d,style:e?{overflowAnchor:"none",position:"sticky",top:a+f,zIndex:2}:iN},c(t.index,t.data,s))});return(0,T.jsx)(T.Fragment,{children:h})}),iz=D.memo(function(){let e=iG("listState"),t=iG("topItemsIndexes").length>0,n=iU("sizeRanges"),r=iG("useWindowScroll"),i=iG("customScrollParent"),o=iU("windowScrollContainerState"),s=iU("scrollContainerState"),l=iG("trackItemSizes"),{callbackRef:a,ref:c}=nY(n,iG("itemSize"),l,i||r?o:s,iG("log"),void 0,i,!1,iG("skipAnimationFrameInResizeObserver")),[u,h]=D.useState(0);iq("deviation",e=>{u!==e&&(c.current.style.marginTop=`${e}px`,h(e))});let d=iG("EmptyPlaceholder"),f=iG("FillerRow")||iV,p=iG("TableBodyComponent"),m=iG("paddingTopAddition"),g=iG("statefulTotalCount"),v=iG("context");if(0===g&&d)return(0,T.jsx)(d,{...iw(d,v)});let b=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),y=e.offsetTop+m+u-b,x=e.offsetBottom,w=y>0?(0,T.jsx)(f,{context:v,height:y},"padding-top"):null,C=x>0?(0,T.jsx)(f,{context:v,height:x},"padding-bottom"):null;return(0,T.jsxs)(p,{"data-testid":"virtuoso-item-list",ref:a,...iw(p,v),children:[w,t&&(0,T.jsx)(iH,{showTopList:!0}),(0,T.jsx)(iH,{}),C]})}),i$=({children:e})=>{let t=D.useContext(ie),n=iU("viewportHeight"),r=iU("fixedItemHeight"),i=nU(D.useMemo(()=>nm(n,e=>ra(e,"height")),[n]),!0,iG("skipAnimationFrameInResizeObserver"));return D.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,T.jsx)("div",{"data-viewport-type":"element",ref:i,style:iy(!1),children:e})},iW=({children:e})=>{let t=D.useContext(ie),n=iU("windowViewportRect"),r=iU("fixedItemHeight"),i=nQ(n,iG("customScrollParent"),iG("skipAnimationFrameInResizeObserver"));return D.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,T.jsx)("div",{"data-viewport-type":"window",ref:i,style:iy(!1),children:e})},{Component:i_,useEmitter:iq,useEmitterValue:iG,usePublisher:iU}=r7(iB,{events:{atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",endReached:"endReached",groupIndices:"groupIndices",isScrolling:"isScrolling",itemsRendered:"itemsRendered",rangeChanged:"rangeChanged",startReached:"startReached",totalListHeightChanged:"totalListHeightChanged"},methods:{getState:"getState",scrollBy:"scrollBy",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollToIndex:"scrollToIndex"},optional:{alignToBottom:"alignToBottom",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",components:"components",computeItemKey:"computeItemKey",context:"context",customScrollParent:"customScrollParent",data:"data",defaultItemHeight:"defaultItemHeight",firstItemIndex:"firstItemIndex",fixedFooterContent:"fixedFooterContent",fixedHeaderContent:"fixedHeaderContent",fixedItemHeight:"fixedItemHeight",followOutput:"followOutput",groupCounts:"groupCounts",increaseViewportBy:"increaseViewportBy",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",initialTopMostItemIndex:"initialTopMostItemIndex",itemContent:"itemContent",itemSize:"itemSize",logLevel:"logLevel",overscan:"overscan",restoreStateFrom:"restoreStateFrom",scrollerRef:"scrollerRef",scrollSeekConfiguration:"scrollSeekConfiguration",topItemCount:"topItemCount",totalCount:"totalCount",useWindowScroll:"useWindowScroll"},required:{}},D.memo(function(e){let t=iG("useWindowScroll"),n=iG("customScrollParent"),r=iU("fixedHeaderHeight"),i=iU("fixedFooterHeight"),o=iG("fixedHeaderContent"),s=iG("fixedFooterContent"),l=iG("context"),a=nU(D.useMemo(()=>nm(r,e=>ra(e,"height")),[r]),!0,iG("skipAnimationFrameInResizeObserver")),c=nU(D.useMemo(()=>nm(i,e=>ra(e,"height")),[i]),!0,iG("skipAnimationFrameInResizeObserver")),u=n||t?iY:iK,h=n||t?iW:i$,d=iG("TableComponent"),f=iG("TableHeadComponent"),p=iG("TableFooterComponent"),m=o?(0,T.jsx)(f,{ref:a,style:{position:"sticky",top:0,zIndex:2},...iw(f,l),children:o()},"TableHead"):null,g=s?(0,T.jsx)(p,{ref:c,style:{bottom:0,position:"sticky",zIndex:1},...iw(p,l),children:s()},"TableFoot"):null;return(0,T.jsx)(u,{...e,...iw(u,l),children:(0,T.jsx)(h,{children:(0,T.jsxs)(d,{style:{borderSpacing:0,overflowAnchor:"none"},...iw(d,l),children:[m,(0,T.jsx)(iz,{},"TableBody"),g]})})})})),iK=iM({useEmitter:iq,useEmitterValue:iG,usePublisher:iU}),iY=iT({useEmitter:iq,useEmitterValue:iG,usePublisher:iU}),iX={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},iQ={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:iJ,floor:i0,max:i1,min:i2,round:i5}=Math;function i3(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:null===n?null:n[r+e],index:r+e}))}function i8(e,t){return e&&e.width===t.width&&e.height===t.height}function i4(e,t){return e&&e.column===t.column&&e.row===t.row}let i6=nN(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:o,scrollBy:s,scrollContainerState:l,scrollTo:a,scrollTop:c,smoothScrollTargetReached:u,viewportHeight:h},d,f,{didMount:p,propsReady:m},{customScrollParent:g,useWindowScroll:v,windowScrollContainerState:b,windowScrollTo:y,windowViewportRect:x},w])=>{let C=nj(0),S=nj(0),k=nj(iX),M=nj({height:0,width:0}),T=nj({height:0,width:0}),D=nF(),A=nF(),R=nj(0),P=nj(null),O=nj({column:0,row:0}),I=nF(),E=nF(),Z=nj(!1),L=nj(0),j=nj(!0),B=nj(!1),F=nj(!1);nO(p,nL(L),nA(([e,t])=>!!t))(1,()=>{j(0,!1)}),nO(nz(p,j,T,M,L,B),nA(([e,t,n,r,,i])=>e&&!t&&0!==n.height&&0!==r.height&&!i))(1,([,,,,e])=>{B(0,!0),rD(1,()=>{D(0,e)}),nk(nO(c),()=>{t(0,[0,0]),j(0,!0)})}),nS(nO(E,nA(e=>null!=e&&e.scrollTop>0),nP(0)),S),nO(p,nL(E),nA(([,e])=>null!=e))(1,([,e])=>{e&&(M(0,e.viewport),T(0,e.item),O(0,e.gap),e.scrollTop>0&&(Z(0,!0),nk(nO(c,nE(1)),e=>{Z(0,!1)}),a(0,{top:e.scrollTop})))}),nS(nO(M,nR(({height:e})=>e)),h),nS(nO(nz(n$(M,i8),n$(T,i8),n$(O,(e,t)=>e&&e.column===t.column&&e.row===t.row),n$(c)),nR(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),I),nS(nO(nz(n$(C),r,n$(O,i4),n$(T,i8),n$(M,i8),n$(P),n$(S),n$(Z),n$(j),n$(L)),nA(([,,,,,,,e])=>!e),nR(([e,[t,n],r,i,o,s,l,,a,c])=>{let u,h,{column:d,row:f}=r,{height:p,width:m}=i,{width:g}=o;if(0===l&&(0===e||0===g))return iX;if(0===m){var v;let t=rA(c,e),n=t+Math.max(l-1,0);return v=i3(t,n,s),{...iQ,items:v}}let b=i9(g,m,d);a?0===t&&0===n&&l>0?(u=0,h=l-1):(u=b*i0((t+f)/(p+f)),h=i2(e-1,i1(h=b*iJ((n+f)/(p+f))-1,b-1)),u=i2(h,i1(0,u))):(u=0,h=-1);let y=i3(u,h,s),{bottom:x,top:w}=i7(o,r,i,y),C=iJ(e/b);return{bottom:x,itemHeight:p,items:y,itemWidth:m,offsetBottom:C*p+(C-1)*f-x,offsetTop:w,top:w}})),k),nS(nO(P,nA(e=>null!==e),nR(e=>e.length)),C),nS(nO(nz(M,T,k,O),nA(([e,t,{items:n}])=>n.length>0&&0!==t.height&&0!==e.height),nR(([e,t,{items:n},r])=>{let{bottom:i,top:o}=i7(e,r,t,n);return[o,i]}),nD(ro)),t);let V=nj(!1);nS(nO(c,nL(V),nR(([e,t])=>t||0!==e)),V);let N=nV(nO(nz(k,C),nA(([{items:e}])=>e.length>0),nL(V),nA(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&0===e.offsetBottom&&e.items.length===t)&&r}),nR(([[,e]])=>e-1),nD())),H=nV(nO(n$(k),nA(({items:e})=>e.length>0&&0===e[0].index),nP(0),nD())),z=nV(nO(n$(k),nL(Z),nA(([{items:e},t])=>e.length>0&&!t),nR(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),nD(ri),nZ(0)));nS(z,f.scrollSeekRangeChanged),nS(nO(D,nL(M,T,C,O),nR(([e,t,n,r,i])=>{let o=rM(e),{align:s,behavior:l,offset:a}=o,c=o.index;"LAST"===c&&(c=r-1);let u=oe(t,i,n,c=i1(0,c,i2(r-1,c)));return"end"===s?u=i5(u-t.height+n.height):"center"===s&&(u=i5(u-t.height/2+n.height/2)),a&&(u+=a),{behavior:l,top:u}})),a);let $=nB(nO(k,nR(e=>e.offsetBottom+e.bottom)),0);return nS(nO(x,nR(e=>({height:e.visibleHeight,width:e.visibleWidth}))),M),{customScrollParent:g,data:P,deviation:R,footerHeight:i,gap:O,headerHeight:o,increaseViewportBy:e,initialItemCount:S,itemDimensions:T,overscan:n,restoreStateFrom:E,scrollBy:s,scrollContainerState:l,scrollHeight:A,scrollTo:a,scrollToIndex:D,scrollTop:c,smoothScrollTargetReached:u,totalCount:C,useWindowScroll:v,viewportDimensions:M,windowScrollContainerState:b,windowScrollTo:y,windowViewportRect:x,...f,gridState:k,horizontalDirection:F,initialTopMostItemIndex:L,totalListHeight:$,...d,endReached:N,propsReady:m,rangeChanged:z,startReached:H,stateChanged:I,stateRestoreInProgress:Z,...w}},ny(rF,nJ,rE,rQ,rS,rJ,nG));function i9(e,t,n){return i1(1,i0((e+n)/(i0(t)+n)))}function i7(e,t,n,r){let{height:i}=n;if(void 0===i||0===r.length)return{bottom:0,top:0};let o=oe(e,t,n,r[0].index);return{bottom:oe(e,t,n,r[r.length-1].index)+i,top:o}}function oe(e,t,n,r){let i=i0(r/i9(e.width,n.width,t.column)),o=i*n.height+i1(0,i-1)*t.row;return o>0?o+t.row:o}let ot=nN(()=>{let e=nj(e=>`Item ${e}`),t=nj({}),n=nj(null),r=nj("virtuoso-grid-item"),i=nj("virtuoso-grid-list"),o=nj(ia),s=nj("div"),l=nj(nv),a=(e,n=null)=>nB(nO(t,nR(t=>t[e]),nD()),n),c=nj(!1),u=nj(!1);return nS(n$(u),c),{components:t,computeItemKey:o,context:n,FooterComponent:a("Footer"),HeaderComponent:a("Header"),headerFooterTag:s,itemClassName:r,ItemComponent:a("Item","div"),itemContent:e,listClassName:i,ListComponent:a("List","div"),readyStateChanged:c,reportReadyState:u,ScrollerComponent:a("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder","div")}}),on=nN(([e,t])=>({...e,...t}),ny(i6,ot)),or=D.memo(function(){let e=oc("gridState"),t=oc("listClassName"),n=oc("itemClassName"),r=oc("itemContent"),i=oc("computeItemKey"),o=oc("isSeeking"),s=ou("scrollHeight"),l=oc("ItemComponent"),a=oc("ListComponent"),c=oc("ScrollSeekPlaceholder"),u=oc("context"),h=ou("itemDimensions"),d=ou("gap"),f=oc("log"),p=oc("stateRestoreInProgress"),m=ou("reportReadyState"),g=nU(D.useMemo(()=>e=>{s(e.parentElement.parentElement.scrollHeight);let t=e.firstChild;if(t){let{height:e,width:n}=t.getBoundingClientRect();h({height:e,width:n})}d({column:of("column-gap",getComputedStyle(e).columnGap,f),row:of("row-gap",getComputedStyle(e).rowGap,f)})},[s,h,d,f]),!0,!1);return ir(()=>{e.itemHeight>0&&e.itemWidth>0&&m(!0)},[e]),p?null:(0,T.jsx)(a,{className:t,ref:g,...iw(a,u),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let s=i(t.index,t.data,u);return o?(0,T.jsx)(c,{...iw(c,u),height:e.itemHeight,index:t.index,width:e.itemWidth},s):(0,D.createElement)(l,{...iw(l,u),className:n,"data-index":t.index,key:s},r(t.index,t.data,u))})})}),oi=D.memo(function(){let e=oc("HeaderComponent"),t=ou("headerHeight"),n=oc("headerFooterTag"),r=nU(D.useMemo(()=>e=>{t(ra(e,"height"))},[t]),!0,!1),i=oc("context");return e?(0,T.jsx)(n,{ref:r,children:(0,T.jsx)(e,{...iw(e,i)})}):null}),oo=D.memo(function(){let e=oc("FooterComponent"),t=ou("footerHeight"),n=oc("headerFooterTag"),r=nU(D.useMemo(()=>e=>{t(ra(e,"height"))},[t]),!0,!1),i=oc("context");return e?(0,T.jsx)(n,{ref:r,children:(0,T.jsx)(e,{...iw(e,i)})}):null}),os=({children:e})=>{let t=D.useContext(it),n=ou("itemDimensions"),r=ou("viewportDimensions"),i=nU(D.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return D.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,T.jsx)("div",{ref:i,style:iy(!1),children:e})},ol=({children:e})=>{let t=D.useContext(it),n=ou("windowViewportRect"),r=ou("itemDimensions"),i=nQ(n,oc("customScrollParent"),!1);return D.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,T.jsx)("div",{ref:i,style:iy(!1),children:e})},{useEmitter:oa,useEmitterValue:oc,usePublisher:ou}=r7(on,{events:{atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",endReached:"endReached",isScrolling:"isScrolling",rangeChanged:"rangeChanged",readyStateChanged:"readyStateChanged",startReached:"startReached",stateChanged:"stateChanged"},methods:{scrollBy:"scrollBy",scrollTo:"scrollTo",scrollToIndex:"scrollToIndex"},optional:{components:"components",computeItemKey:"computeItemKey",context:"context",customScrollParent:"customScrollParent",data:"data",headerFooterTag:"headerFooterTag",increaseViewportBy:"increaseViewportBy",initialItemCount:"initialItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",itemClassName:"itemClassName",itemContent:"itemContent",listClassName:"listClassName",logLevel:"logLevel",overscan:"overscan",restoreStateFrom:"restoreStateFrom",scrollerRef:"scrollerRef",scrollSeekConfiguration:"scrollSeekConfiguration",totalCount:"totalCount",useWindowScroll:"useWindowScroll"}},D.memo(function({...e}){let t=oc("useWindowScroll"),n=oc("customScrollParent"),r=n||t?od:oh,i=n||t?ol:os,o=oc("context");return(0,T.jsx)(r,{...e,...iw(r,o),children:(0,T.jsxs)(i,{children:[(0,T.jsx)(oi,{}),(0,T.jsx)(or,{}),(0,T.jsx)(oo,{})]})})})),oh=iM({useEmitter:oa,useEmitterValue:oc,usePublisher:ou}),od=iT({useEmitter:oa,useEmitterValue:oc,usePublisher:ou});function of(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n(`${e} was not resolved to pixel value correctly`,t,n_.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}var op=n(73037),om=n(14544),og=n(16758),ov=n(51183),ob=n(78849);function oy(e){return(0,V.ZP)("MuiListItemButton",e)}let ox=(0,F.Z)("MuiListItemButton",["root","focusVisible","dense","alignItemsFlexStart","disabled","divider","gutters","selected"]),ow=(0,Z.ZP)(om.Z,{shouldForwardProp:e=>(0,op.Z)(e)||"classes"===e,name:"MuiListItemButton",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,"flex-start"===n.alignItems&&t.alignItemsFlexStart,n.divider&&t.divider,!n.disableGutters&&t.gutters]}})((0,L.Z)(({theme:e})=>({display:"flex",flexGrow:1,justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minWidth:0,boxSizing:"border-box",textAlign:"left",paddingTop:8,paddingBottom:8,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${ox.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,O.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity),[`&.${ox.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:(0,O.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`&.${ox.selected}:hover`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:(0,O.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,O.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${ox.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${ox.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},variants:[{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"}},{props:{alignItems:"flex-start"},style:{alignItems:"flex-start"}},{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.dense,style:{paddingTop:4,paddingBottom:4}}]}))),oC=D.forwardRef(function(e,t){let n=(0,B.i)({props:e,name:"MuiListItemButton"}),{alignItems:r="center",autoFocus:i=!1,component:o="div",children:s,dense:l=!1,disableGutters:a=!1,divider:c=!1,focusVisibleClassName:u,selected:h=!1,className:d,...f}=n,p=D.useContext(ob.Z),m=D.useMemo(()=>({dense:l||p.dense||!1,alignItems:r,disableGutters:a}),[r,p.dense,l,a]),g=D.useRef(null);(0,og.Z)(()=>{i&&g.current&&g.current.focus()},[i]);let v={...n,alignItems:r,dense:m.dense,disableGutters:a,divider:c,selected:h},b=(e=>{let{alignItems:t,classes:n,dense:r,disabled:i,disableGutters:o,divider:s,selected:l}=e,a=(0,P.Z)({root:["root",r&&"dense",!o&&"gutters",s&&"divider",i&&"disabled","flex-start"===t&&"alignItemsFlexStart",l&&"selected"]},oy,n);return{...n,...a}})(v),y=(0,ov.Z)(g,t);return(0,T.jsx)(ob.Z.Provider,{value:m,children:(0,T.jsx)(ow,{ref:y,href:f.href||f.to,component:(f.href||f.to)&&"div"===o?"button":o,focusVisibleClassName:(0,R.Z)(b.focusVisible,u),ownerState:v,className:(0,R.Z)(b.root,d),...f,classes:b,children:s})})});var oS=n(12577);let ok=(0,D.memo)(function({color:e,sx:t,...n}){return(0,T.jsx)(nh.Z,{...n,sx:t6({height:4,width:16,margin:e=>e.spacing(.5)},t),style:{backgroundColor:e}})}),oM=(0,D.forwardRef)(function({item:e,sx:t,truncateLabel:n,onClick:r,isVisuallySelected:i,onMouseOver:o,onMouseOut:s,index:l,...a},c){let[u,h]=(0,D.useState)(n);return(0,T.jsxs)(oC,{...a,role:"listitem",sx:t6({padding:0,cursor:"pointer"},t),dense:!0,onClick:t=>{r(t,e.id),e.onClick?.(t)},onMouseOver:t=>o?.(t,{id:e.id,index:l}),onMouseOut:t=>s?.(t,{id:e.id,index:l}),selected:i,ref:c,children:[(0,T.jsx)(nh.Z,{sx:{display:"flex",alignItems:"center"},children:(0,T.jsx)(ok,{color:e.color})}),(0,T.jsx)(oS.Z,{primary:e.label,primaryTypographyProps:{noWrap:u},onMouseOver:function(){n&&h(!1)},onMouseOut:function(){n&&h(!0)}})]})}),oT=(0,D.memo)(oM);function oD(e,t){return"ALL"!==t&&!!t[e.id]}function oA({items:e,height:t,width:n,selectedItems:r,onLegendItemClick:i,onItemMouseOver:o,onItemMouseOut:s}){let l=e.length>5;return(0,T.jsx)(iP,{style:{height:t,width:n},data:e,itemContent:(e,t)=>(0,T.jsx)(oT,{item:t,index:e,truncateLabel:l,isVisuallySelected:oD(t,r),onClick:i,onMouseOver:o,onMouseOut:s,sx:{width:"100%",wordBreak:"break-word",overflow:"hidden"}},t.id),role:"list"})}function oR({height:e,items:t,selectedItems:n,onLegendItemClick:r,onItemMouseOver:i,onItemMouseOut:o}){return(0,T.jsx)(nh.Z,{component:"ul",sx:{width:"100%",height:e,padding:[0,1,0,0],overflowY:"scroll",margin:0},children:t.map((e,t)=>(0,T.jsx)(oT,{item:e,index:t,isVisuallySelected:oD(e,n),onMouseOver:i,onMouseOut:o,onClick:r,sx:{width:"auto",float:"left",paddingRight:1.5}},e.id))})}function oP(e,t){return"function"==typeof e?e(t):e}function oO(e,t){return n=>{t.setState(t=>({...t,[e]:oP(n,t[e])}))}}function oI(e){return e instanceof Function}function oE(e,t,n){let r,i=[];return o=>{let s,l;n.key&&n.debug&&(s=Date.now());let a=e(o);if(!(a.length!==i.length||a.some((e,t)=>i[t]!==e)))return r;if(i=a,n.key&&n.debug&&(l=Date.now()),r=t(...a),null==n||null==n.onChange||n.onChange(r),n.key&&n.debug&&null!=n&&n.debug()){let e=Math.round((Date.now()-s)*100)/100,t=Math.round((Date.now()-l)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
3
+ font-size: .6rem;
4
+ font-weight: bold;
5
+ color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return r}}function oZ(e,t,n,r){return{debug:()=>{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:r}}let oL="debugHeaders";function oj(e,t,n){var r;let i={id:null!=(r=n.id)?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(i),e},getContext:()=>({table:e,header:i,column:t})};return e._features.forEach(t=>{null==t.createHeader||t.createHeader(i,e)}),i}function oB(e,t,n,r){var i,o;let s=0,l=function(e,t){void 0===t&&(t=1),s=Math.max(s,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;null!=(n=e.columns)&&n.length&&l(e.columns,t+1)},0)};l(e);let a=[],c=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join("_"),headers:[]},o=[];e.forEach(e=>{let s,l=[...o].reverse()[0],a=e.column.depth===i.depth,c=!1;if(a&&e.column.parent?s=e.column.parent:(s=e.column,c=!0),l&&(null==l?void 0:l.column)===s)l.subHeaders.push(e);else{let i=oj(n,s,{id:[r,t,s.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:c,placeholderId:c?`${o.filter(e=>e.column===s).length}`:void 0,depth:t,index:o.length});i.subHeaders.push(e),o.push(i)}i.headers.push(e),e.headerGroup=i}),a.push(i),t>0&&c(o,t-1)};c(t.map((e,t)=>oj(n,e,{depth:s,index:t})),s-1),a.reverse();let u=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];return e.subHeaders&&e.subHeaders.length?(r=[],u(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1,n+=Math.min(...r),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return u(null!=(i=null==(o=a[0])?void 0:o.headers)?i:[]),a}let oF=(e,t,n,r,i,o,s)=>{let l={id:t,index:r,original:n,depth:i,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(l._valuesCache.hasOwnProperty(t))return l._valuesCache[t];let n=e.getColumn(t);if(null!=n&&n.accessorFn)return l._valuesCache[t]=n.accessorFn(l.original,r),l._valuesCache[t]},getUniqueValues:t=>{if(l._uniqueValuesCache.hasOwnProperty(t))return l._uniqueValuesCache[t];let n=e.getColumn(t);if(null!=n&&n.accessorFn)return n.columnDef.getUniqueValues?l._uniqueValuesCache[t]=n.columnDef.getUniqueValues(l.original,r):l._uniqueValuesCache[t]=[l.getValue(t)],l._uniqueValuesCache[t]},renderValue:t=>{var n;return null!=(n=l.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=o?o:[],getLeafRows:()=>(function(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);null!=i&&i.length&&r(i)})};return r(e),n})(l.subRows,e=>e.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let e=[],t=l;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:oE(()=>[e.getAllLeafColumns()],t=>t.map(t=>(function(e,t,n,r){let i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>{var t;return null!=(t=i.getValue())?t:e.options.renderFallbackValue},getContext:oE(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),oZ(e.options,"debugCells","cell.getContext"))};return e._features.forEach(r=>{null==r.createCell||r.createCell(i,n,t,e)},{}),i})(e,l,t,t.id)),oZ(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:oE(()=>[l.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),oZ(e.options,"debugRows","getAllCellsByColumnId"))};for(let t=0;t<e._features.length;t++){let n=e._features[t];null==n||null==n.createRow||n.createRow(l,e)}return l},oV=(e,t,n)=>{var r,i;let o=null==n||null==(r=n.toString())?void 0:r.toLowerCase();return!!(null==(i=e.getValue(t))||null==(i=i.toString())||null==(i=i.toLowerCase())?void 0:i.includes(o))};oV.autoRemove=e=>oK(e);let oN=(e,t,n)=>{var r;return!!(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.includes(n))};oN.autoRemove=e=>oK(e);let oH=(e,t,n)=>{var r;return(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.toLowerCase())===(null==n?void 0:n.toLowerCase())};oH.autoRemove=e=>oK(e);let oz=(e,t,n)=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)};oz.autoRemove=e=>oK(e);let o$=(e,t,n)=>!n.some(n=>{var r;return!(null!=(r=e.getValue(t))&&r.includes(n))});o$.autoRemove=e=>oK(e)||!(null!=e&&e.length);let oW=(e,t,n)=>n.some(n=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)});oW.autoRemove=e=>oK(e)||!(null!=e&&e.length);let o_=(e,t,n)=>e.getValue(t)===n;o_.autoRemove=e=>oK(e);let oq=(e,t,n)=>e.getValue(t)==n;oq.autoRemove=e=>oK(e);let oG=(e,t,n)=>{let[r,i]=n,o=e.getValue(t);return o>=r&&o<=i};oG.resolveFilterValue=e=>{let[t,n]=e,r="number"!=typeof t?parseFloat(t):t,i="number"!=typeof n?parseFloat(n):n,o=null===t||Number.isNaN(r)?-1/0:r,s=null===n||Number.isNaN(i)?1/0:i;if(o>s){let e=o;o=s,s=e}return[o,s]},oG.autoRemove=e=>oK(e)||oK(e[0])&&oK(e[1]);let oU={includesString:oV,includesStringSensitive:oN,equalsString:oH,arrIncludes:oz,arrIncludesAll:o$,arrIncludesSome:oW,equals:o_,weakEquals:oq,inNumberRange:oG};function oK(e){return null==e||""===e}function oY(e,t,n){return!!e&&!!e.autoRemove&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}let oX={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+("number"==typeof r?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(r>n||void 0===r&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(r<n||void 0===r&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(void 0===r?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);null!=i&&(i*=1)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!(Array.isArray(n)&&n.every(e=>"number"==typeof e)))return;if(1===n.length)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2!=0?i[r]:(i[r-1]+i[r])/2},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},oQ=()=>({left:[],right:[]}),oJ={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},o0=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),o1=null;function o2(e){return"touchstart"===e.type}function o5(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}let o3=()=>({pageIndex:0,pageSize:10}),o8=()=>({top:[],bottom:[]}),o4=(e,t,n,r,i)=>{var o;let s=i.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),s.getCanSelect()&&(e[t]=!0)):delete e[t],r&&null!=(o=s.subRows)&&o.length&&s.getCanSelectSubRows()&&s.subRows.forEach(t=>o4(e,t.id,n,r,i))};function o6(e,t){let n=e.getState().rowSelection,r=[],i={},o=function(e,t){return e.map(e=>{var t;let s=o9(e,n);if(s&&(r.push(e),i[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:o(e.subRows)}),s)return e}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:i}}function o9(e,t){var n;return null!=(n=t[e.id])&&n}function o7(e,t,n){var r;if(!(null!=(r=e.subRows)&&r.length))return!1;let i=!0,o=!1;return e.subRows.forEach(e=>{if((!o||i)&&(e.getCanSelect()&&(o9(e,t)?o=!0:i=!1),e.subRows&&e.subRows.length)){let n=o7(e,t);"all"===n?o=!0:("some"===n&&(o=!0),i=!1)}}),i?"all":!!o&&"some"}let se=/([0-9]+)/gm;function st(e,t){return e===t?0:e>t?1:-1}function sn(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function sr(e,t){let n=e.split(se).filter(Boolean),r=t.split(se).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),o=parseInt(t,10),s=[i,o].sort();if(isNaN(s[0])){if(e>t)return 1;if(t>e)return -1;continue}if(isNaN(s[1]))return isNaN(i)?-1:1;if(i>o)return 1;if(o>i)return -1}return n.length-r.length}let si={alphanumeric:(e,t,n)=>sr(sn(e.getValue(n)).toLowerCase(),sn(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>sr(sn(e.getValue(n)),sn(t.getValue(n))),text:(e,t,n)=>st(sn(e.getValue(n)).toLowerCase(),sn(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>st(sn(e.getValue(n)),sn(t.getValue(n))),datetime:(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},basic:(e,t,n)=>st(e.getValue(n),t.getValue(n))},so=[{createTable:e=>{e.getHeaderGroups=oE(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,s;let l=null!=(o=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?o:[],a=null!=(s=null==i?void 0:i.map(e=>n.find(t=>t.id===e)).filter(Boolean))?s:[];return oB(t,[...l,...n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=i&&i.includes(e.id))),...a],e)},oZ(e.options,oL,"getHeaderGroups")),e.getCenterHeaderGroups=oE(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>oB(t,n=n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=i&&i.includes(e.id))),e,"center"),oZ(e.options,oL,"getCenterHeaderGroups")),e.getLeftHeaderGroups=oE(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;return oB(t,null!=(i=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"left")},oZ(e.options,oL,"getLeftHeaderGroups")),e.getRightHeaderGroups=oE(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;return oB(t,null!=(i=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"right")},oZ(e.options,oL,"getRightHeaderGroups")),e.getFooterGroups=oE(()=>[e.getHeaderGroups()],e=>[...e].reverse(),oZ(e.options,oL,"getFooterGroups")),e.getLeftFooterGroups=oE(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),oZ(e.options,oL,"getLeftFooterGroups")),e.getCenterFooterGroups=oE(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),oZ(e.options,oL,"getCenterFooterGroups")),e.getRightFooterGroups=oE(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),oZ(e.options,oL,"getRightFooterGroups")),e.getFlatHeaders=oE(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),oZ(e.options,oL,"getFlatHeaders")),e.getLeftFlatHeaders=oE(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),oZ(e.options,oL,"getLeftFlatHeaders")),e.getCenterFlatHeaders=oE(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),oZ(e.options,oL,"getCenterFlatHeaders")),e.getRightFlatHeaders=oE(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),oZ(e.options,oL,"getRightFlatHeaders")),e.getCenterLeafHeaders=oE(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),oZ(e.options,oL,"getCenterLeafHeaders")),e.getLeftLeafHeaders=oE(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),oZ(e.options,oL,"getLeftLeafHeaders")),e.getRightLeafHeaders=oE(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),oZ(e.options,oL,"getRightLeafHeaders")),e.getLeafHeaders=oE(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>{var r,i,o,s,l,a;return[...null!=(r=null==(i=e[0])?void 0:i.headers)?r:[],...null!=(o=null==(s=t[0])?void 0:s.headers)?o:[],...null!=(l=null==(a=n[0])?void 0:a.headers)?l:[]].map(e=>e.getLeafHeaders()).flat()},oZ(e.options,oL,"getLeafHeaders"))}},{getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:oO("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;let i=e.columns;return null==(n=i.length?i.some(e=>e.getIsVisible()):null==(r=t.getState().columnVisibility)?void 0:r[e.id])||n},e.getCanHide=()=>{var n,r;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(r=t.options.enableHiding)||r)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=oE(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),oZ(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=oE(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],oZ(t.options,"debugRows","getVisibleCells"))},createTable:e=>{let t=(t,n)=>oE(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join("_")],e=>e.filter(e=>null==e.getIsVisible?void 0:e.getIsVisible()),oZ(e.options,"debugColumns",t));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(null!=e.getIsVisible&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>null==e.getIsVisible?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}},{getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:oO("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=oE(e=>[o5(t,e)],t=>t.findIndex(t=>t.id===e.id),oZ(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=n=>{var r;return(null==(r=o5(t,n)[0])?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;let i=o5(t,n);return(null==(r=i[i.length-1])?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=oE(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(null!=e&&e.length){let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}else i=r;var o=i;if(!(null!=t&&t.length)||!n)return o;let s=o.filter(e=>!t.includes(e.id));return"remove"===n?s:[...t.map(e=>o.find(t=>t.id===e)).filter(Boolean),...s]},oZ(e.options,"debugTable","_getOrderColumnsFn"))}},{getInitialState:e=>({columnPinning:oQ(),...e}),getDefaultOptions:e=>({onColumnPinningChange:oO("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>{var t,i,o,s,l,a;return"right"===n?{left:(null!=(o=null==e?void 0:e.left)?o:[]).filter(e=>!(null!=r&&r.includes(e))),right:[...(null!=(s=null==e?void 0:e.right)?s:[]).filter(e=>!(null!=r&&r.includes(e))),...r]}:"left"===n?{left:[...(null!=(l=null==e?void 0:e.left)?l:[]).filter(e=>!(null!=r&&r.includes(e))),...r],right:(null!=(a=null==e?void 0:e.right)?a:[]).filter(e=>!(null!=r&&r.includes(e)))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter(e=>!(null!=r&&r.includes(e))),right:(null!=(i=null==e?void 0:e.right)?i:[]).filter(e=>!(null!=r&&r.includes(e)))}})},e.getCanPin=()=>e.getLeafColumns().some(e=>{var n,r,i;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(r=null!=(i=t.options.enableColumnPinning)?i:t.options.enablePinning)||r)}),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,o=n.some(e=>null==r?void 0:r.includes(e)),s=n.some(e=>null==i?void 0:i.includes(e));return o?"left":!!s&&"right"},e.getPinnedIndex=()=>{var n,r;let i=e.getIsPinned();return i?null!=(n=null==(r=t.getState().columnPinning)||null==(r=r[i])?void 0:r.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=oE(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.column.id))},oZ(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=oE(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"left"})),oZ(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=oE(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"right"})),oZ(t.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?oQ():null!=(n=null==(r=e.initialState)?void 0:r.columnPinning)?n:oQ())},e.getIsSomeColumnsPinned=t=>{var n,r,i;let o=e.getState().columnPinning;return t?!!(null==(n=o[t])?void 0:n.length):!!((null==(r=o.left)?void 0:r.length)||(null==(i=o.right)?void 0:i.length))},e.getLeftLeafColumns=oE(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),oZ(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=oE(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),oZ(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=oE(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.id))},oZ(e.options,"debugColumns","getCenterLeafColumns"))}},{createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},{getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:oO("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"string"==typeof r?oU.includesString:"number"==typeof r?oU.inNumberRange:"boolean"==typeof r||null!==r&&"object"==typeof r?oU.equals:Array.isArray(r)?oU.arrIncludes:oU.weakEquals},e.getFilterFn=()=>{var n,r;return oI(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(n=null==(r=t.options.filterFns)?void 0:r[e.columnDef.filterFn])?n:oU[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,i;return(null==(n=e.columnDef.enableColumnFilter)||n)&&(null==(r=t.options.enableColumnFilters)||r)&&(null==(i=t.options.enableFilters)||i)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return null==(n=t.getState().columnFilters)||null==(n=n.find(t=>t.id===e.id))?void 0:n.value},e.getFilterIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().columnFilters)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.setFilterValue=n=>{t.setColumnFilters(t=>{var r,i;let o=e.getFilterFn(),s=null==t?void 0:t.find(t=>t.id===e.id),l=oP(n,s?s.value:void 0);if(oY(o,l,e))return null!=(r=null==t?void 0:t.filter(t=>t.id!==e.id))?r:[];let a={id:e.id,value:l};return s?null!=(i=null==t?void 0:t.map(t=>t.id===e.id?a:t))?i:[]:null!=t&&t.length?[...t,a]:[a]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange(e=>{var r;return null==(r=oP(t,e))?void 0:r.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&oY(t.getFilterFn(),e.value,t))&&!0})})},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel)?e.getPreFilteredRowModel():e._getFilteredRowModel()}},{createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},{getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:oO("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;let r=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof r||"number"==typeof r}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,i,o;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(r=t.options.enableGlobalFilter)||r)&&(null==(i=t.options.enableFilters)||i)&&(null==(o=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||o)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>oU.includesString,e.getGlobalFilterFn=()=>{var t,n;let{globalFilterFn:r}=e.options;return oI(r)?r:"auto"===r?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[r])?t:oU[r]},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:oO("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return si.datetime;if("string"==typeof n&&(r=!0,n.split(se).length>1))return si.alphanumeric}return r?si.text:si.basic},e.getAutoSortDir=()=>{let n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw Error();return oI(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(r=t.options.sortingFns)?void 0:r[e.columnDef.sortingFn])?n:si[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),o=null!=n;t.setSorting(s=>{let l,a=null==s?void 0:s.find(t=>t.id===e.id),c=null==s?void 0:s.findIndex(t=>t.id===e.id),u=[],h=o?n:"desc"===i;if("toggle"!=(l=null!=s&&s.length&&e.getCanMultiSort()&&r?a?"toggle":"add":null!=s&&s.length&&c!==s.length-1?"replace":a?"toggle":"replace")||o||i||(l="remove"),"add"===l){var d;(u=[...s,{id:e.id,desc:h}]).splice(0,u.length-(null!=(d=t.options.maxMultiSortColCount)?d:Number.MAX_SAFE_INTEGER))}else u="toggle"===l?s.map(t=>t.id===e.id?{...t,desc:h}:t):"remove"===l?s.filter(t=>t.id!==e.id):[{id:e.id,desc:h}];return u})},e.getFirstSortDir=()=>{var n,r;return(null!=(n=null!=(r=e.columnDef.sortDescFirst)?r:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var r,i;let o=e.getFirstSortDir(),s=e.getIsSorted();return s?(s===o||null!=(r=t.options.enableSortingRemoval)&&!r||!!n&&null!=(i=t.options.enableMultiRemove)&&!i)&&("desc"===s?"asc":"desc"):o},e.getCanSort=()=>{var n,r;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(r=t.options.enableSorting)||r)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return null!=(n=null!=(r=e.columnDef.enableMultiSort)?r:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;let r=null==(n=t.getState().sorting)?void 0:n.find(t=>t.id===e.id);return!!r&&(r.desc?"desc":"asc")},e.getSortIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().sorting)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.clearSorting=()=>{t.setSorting(t=>null!=t&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(null==r.persist||r.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(r))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel)?e.getPreSortedRowModel():e._getSortedRowModel()}},{getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:oO("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>null!=t&&t.includes(e.id)?t.filter(t=>t!==e.id):[...null!=t?t:[],e.id])},e.getCanGroup=()=>{var n,r;return(null==(n=e.columnDef.enableGrouping)||n)&&(null==(r=t.options.enableGrouping)||r)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"number"==typeof r?oX.sum:"[object Date]"===Object.prototype.toString.call(r)?oX.extent:void 0},e.getAggregationFn=()=>{var n,r;if(!e)throw Error();return oI(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(r=t.options.aggregationFns)?void 0:r[e.columnDef.aggregationFn])?n:oX[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel)?e.getPreGroupedRowModel():e._getGroupedRowModel()},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return null!=r&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!(null!=(t=n.subRows)&&t.length)}}},{getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:oO("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,i;if(!t)return void e._queue(()=>{t=!0});if(null!=(r=null!=(i=e.options.autoResetAll)?i:e.options.autoResetExpanded)?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,r;e.setExpanded(t?{}:null!=(n=null==(r=e.initialState)?void 0:r.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return"boolean"==typeof t?!0===t:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(".");t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel)?e.getPreExpandedRowModel():e._getExpandedRowModel()},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var i;let o=!0===r||!!(null!=r&&r[e.id]),s={};if(!0===r?Object.keys(t.getRowModel().rowsById).forEach(e=>{s[e]=!0}):s=r,n=null!=(i=n)?i:!o,!o&&n)return{...s,[e.id]:!0};if(o&&!n){let{[e.id]:t,...n}=s;return n}return r})},e.getIsExpanded=()=>{var n;let r=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===r||(null==r?void 0:r[e.id]))},e.getCanExpand=()=>{var n,r,i;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(r=t.options.enableExpanding)||r)&&!!(null!=(i=e.subRows)&&i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)n=(r=t.getRow(r.parentId,!0)).getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},{getInitialState:e=>({...e,pagination:{...o3(),...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:oO("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,i;if(!t)return void e._queue(()=>{t=!0});if(null!=(r=null!=(i=e.options.autoResetAll)?i:e.options.autoResetPageIndex)?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange(e=>oP(t,e)),e.resetPagination=t=>{var n;e.setPagination(t?o3():null!=(n=e.initialState.pagination)?n:o3())},e.setPageIndex=t=>{e.setPagination(n=>{let r=oP(t,n.pageIndex);return r=Math.max(0,Math.min(r,void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n,r;e.setPageIndex(t?0:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageIndex)?n:0)},e.resetPageSize=t=>{var n,r;e.setPageSize(t?10:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageSize)?n:10)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,oP(t,e.pageSize)),r=Math.floor(e.pageSize*e.pageIndex/n);return{...e,pageIndex:r,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{var r;let i=oP(t,null!=(r=e.options.pageCount)?r:-1);return"number"==typeof i&&(i=Math.max(-1,i)),{...n,pageCount:i}}),e.getPageOptions=oE(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},oZ(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return -1===n||0!==n&&t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel)?e.getPrePaginationRowModel():e._getPaginationRowModel(),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},{getInitialState:e=>({rowPinning:o8(),...e}),getDefaultOptions:e=>({onRowPinningChange:oO("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let o=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],s=new Set([...i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],e.id,...o]);t.setRowPinning(e=>{var t,r,i,o,l,a;return"bottom"===n?{top:(null!=(i=null==e?void 0:e.top)?i:[]).filter(e=>!(null!=s&&s.has(e))),bottom:[...(null!=(o=null==e?void 0:e.bottom)?o:[]).filter(e=>!(null!=s&&s.has(e))),...Array.from(s)]}:"top"===n?{top:[...(null!=(l=null==e?void 0:e.top)?l:[]).filter(e=>!(null!=s&&s.has(e))),...Array.from(s)],bottom:(null!=(a=null==e?void 0:e.bottom)?a:[]).filter(e=>!(null!=s&&s.has(e)))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter(e=>!(null!=s&&s.has(e))),bottom:(null!=(r=null==e?void 0:e.bottom)?r:[]).filter(e=>!(null!=s&&s.has(e)))}})},e.getCanPin=()=>{var n;let{enableRowPinning:r,enablePinning:i}=t.options;return"function"==typeof r?r(e):null==(n=null!=r?r:i)||n},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,o=n.some(e=>null==r?void 0:r.includes(e)),s=n.some(e=>null==i?void 0:i.includes(e));return o?"top":!!s&&"bottom"},e.getPinnedIndex=()=>{var n,r;let i=e.getIsPinned();if(!i)return -1;let o=null==(n="top"===i?t.getTopRows():t.getBottomRows())?void 0:n.map(e=>{let{id:t}=e;return t});return null!=(r=null==o?void 0:o.indexOf(e.id))?r:-1}},createTable:e=>{e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?o8():null!=(n=null==(r=e.initialState)?void 0:r.rowPinning)?n:o8())},e.getIsSomeRowsPinned=t=>{var n,r,i;let o=e.getState().rowPinning;return t?!!(null==(n=o[t])?void 0:n.length):!!((null==(r=o.top)?void 0:r.length)||(null==(i=o.bottom)?void 0:i.length))},e._getPinnedRows=(t,n,r)=>{var i;return(null==(i=e.options.keepPinnedRows)||i?(null!=n?n:[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(null!=n?n:[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r}))},e.getTopRows=oE(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),oZ(e.options,"debugRows","getTopRows")),e.getBottomRows=oE(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),oZ(e.options,"debugRows","getBottomRows")),e.getCenterRows=oE(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter(e=>!r.has(e.id))},oZ(e.options,"debugRows","getCenterRows"))}},{getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:oO("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=void 0!==t?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(t=>{o4(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=oE(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?o6(e,n):{rows:[],flatRows:[],rowsById:{}},oZ(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=oE(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?o6(e,n):{rows:[],flatRows:[],rowsById:{}},oZ(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=oE(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?o6(e,n):{rows:[],flatRows:[],rowsById:{}},oZ(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;let n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(o=>{var s;if(n=void 0!==n?n:!i,e.getCanSelect()&&i===n)return o;let l={...o};return o4(l,e.id,n,null==(s=null==r?void 0:r.selectChildren)||s,t),l})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return o9(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return"some"===o7(e,n)},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return"all"===o7(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected(null==(r=n.target)?void 0:r.checked)}}}},{getDefaultColumnDef:()=>oJ,getInitialState:e=>({columnSizing:{},columnSizingInfo:o0(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:oO("columnSizing",e),onColumnSizingInfoChange:oO("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,i;let o=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:oJ.minSize,null!=(r=null!=o?o:e.columnDef.size)?r:oJ.size),null!=(i=e.columnDef.maxSize)?i:oJ.maxSize)},e.getStart=oE(e=>[e,o5(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),oZ(t.options,"debugColumns","getStart")),e.getAfter=oE(e=>[e,o5(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),oZ(t.options,"debugColumns","getAfter")),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>{var n,r;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(r=t.options.enableColumnResizing)||r)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{if(e.subHeaders.length)e.subHeaders.forEach(n);else{var r;t+=null!=(r=e.column.getSize())?r:0}};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=null==r?void 0:r.getCanResize();return o=>{if(!r||!i||(null==o.persist||o.persist(),o2(o)&&o.touches&&o.touches.length>1))return;let s=e.getSize(),l=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],a=o2(o)?Math.round(o.touches[0].clientX):o.clientX,c={},u=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo(e=>{var r,i;let o="rtl"===t.options.columnResizeDirection?-1:1,s=(n-(null!=(r=null==e?void 0:e.startOffset)?r:0))*o,l=Math.max(s/(null!=(i=null==e?void 0:e.startSize)?i:0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;c[t]=Math.round(100*Math.max(n+n*l,0))/100}),{...e,deltaOffset:s,deltaPercentage:l}}),("onChange"===t.options.columnResizeMode||"end"===e)&&t.setColumnSizing(e=>({...e,...c})))},h=e=>u("move",e),d=e=>{u("end",e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f=n||"undefined"!=typeof document?document:null,p={moveHandler:e=>h(e.clientX),upHandler:e=>{null==f||f.removeEventListener("mousemove",p.moveHandler),null==f||f.removeEventListener("mouseup",p.upHandler),d(e.clientX)}},m={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),h(e.touches[0].clientX),!1),upHandler:e=>{var t;null==f||f.removeEventListener("touchmove",m.moveHandler),null==f||f.removeEventListener("touchend",m.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(null==(t=e.touches[0])?void 0:t.clientX)}},g=!!function(){if("boolean"==typeof o1)return o1;let e=!1;try{let t=()=>{};window.addEventListener("test",t,{get passive(){return e=!0,!1}}),window.removeEventListener("test",t)}catch(t){e=!1}return o1=e}()&&{passive:!1};o2(o)?(null==f||f.addEventListener("touchmove",m.moveHandler,g),null==f||f.addEventListener("touchend",m.upHandler,g)):(null==f||f.addEventListener("mousemove",p.moveHandler,g),null==f||f.addEventListener("mouseup",p.upHandler,g)),t.setColumnSizingInfo(e=>({...e,startOffset:a,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?o0():null!=(n=e.initialState.columnSizingInfo)?n:o0())},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0}}}];var ss=n(14968),sl=n(9449);let sa=(0,D.forwardRef)(function(e,t){return(0,T.jsx)(ss.Z,{...e,ref:t,sx:{backgroundColor:e=>e.palette.background.default,"&:hover":{backgroundColor:e=>(0,O.Fq)(e.palette.primary.main,e.palette.action.hoverOpacity)}}})});var sc=n(56174);let su=(0,D.forwardRef)(function(e,t){return(0,T.jsx)(sc.Z,{...e,ref:t})});var sh=n(90190);let sd=(0,Z.ZP)(sh.Z)(({theme:e})=>({tableLayout:"fixed",borderCollapse:"separate",backgroundColor:e.palette.background.default})),sf={compact:"small",standard:"medium",comfortable:"medium"},sp=(0,D.forwardRef)(function({density:e,...t},n){return(0,T.jsx)(sd,{...t,tabIndex:-1,size:sf[e],ref:n,sx:{width:"100%"}})});var sm=n(31889);let sg=(0,D.forwardRef)(function(e,t){return(0,T.jsx)(sm.Z,{...e,ref:t})});var sv=n(52054),sb=n(90247);let sy=(0,sb.Z)((0,T.jsx)("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownward");function sx(e){return(0,V.ZP)("MuiTableSortLabel",e)}let sw=(0,F.Z)("MuiTableSortLabel",["root","active","icon","iconDirectionDesc","iconDirectionAsc","directionDesc","directionAsc"]);var sC=n(16351);let sS=(0,Z.ZP)(om.Z,{name:"MuiTableSortLabel",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.active&&t.active]}})((0,L.Z)(({theme:e})=>({cursor:"pointer",display:"inline-flex",justifyContent:"flex-start",flexDirection:"inherit",alignItems:"center","&:focus":{color:(e.vars||e).palette.text.secondary},"&:hover":{color:(e.vars||e).palette.text.secondary,[`& .${sw.icon}`]:{opacity:.5}},[`&.${sw.active}`]:{color:(e.vars||e).palette.text.primary,[`& .${sw.icon}`]:{opacity:1,color:(e.vars||e).palette.text.secondary}}}))),sk=(0,Z.ZP)("span",{name:"MuiTableSortLabel",slot:"Icon",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,t[`iconDirection${(0,E.Z)(n.direction)}`]]}})((0,L.Z)(({theme:e})=>({fontSize:18,marginRight:4,marginLeft:4,opacity:0,transition:e.transitions.create(["opacity","transform"],{duration:e.transitions.duration.shorter}),userSelect:"none",variants:[{props:{direction:"desc"},style:{transform:"rotate(0deg)"}},{props:{direction:"asc"},style:{transform:"rotate(180deg)"}}]}))),sM=D.forwardRef(function(e,t){let n=(0,B.i)({props:e,name:"MuiTableSortLabel"}),{active:r=!1,children:i,className:o,direction:s="asc",hideSortIcon:l=!1,IconComponent:a=sy,slots:c={},slotProps:u={},...h}=n,d={...n,active:r,direction:s,hideSortIcon:l,IconComponent:a},f=(e=>{let{classes:t,direction:n,active:r}=e,i={root:["root",r&&"active",`direction${(0,E.Z)(n)}`],icon:["icon",`iconDirection${(0,E.Z)(n)}`]};return(0,P.Z)(i,sx,t)})(d),p={slots:c,slotProps:u},[m,g]=(0,sC.Z)("root",{elementType:sS,externalForwardedProps:p,ownerState:d,className:(0,R.Z)(f.root,o),ref:t}),[v,b]=(0,sC.Z)("icon",{elementType:sk,externalForwardedProps:p,ownerState:d,className:f.icon});return(0,T.jsxs)(m,{disableRipple:!0,component:"span",...g,...h,children:[i,l&&!r?null:(0,T.jsx)(v,{as:a,...b})]})});var sT=n(96205);let sD=150,sA=40;function sR(e,t,{isHeader:n,isLastColumn:r,isFirstColumn:i,defaultColumnHeight:o}={}){var s,l;let a=e.spacing(1),c=e.spacing(1.25),u=e.spacing(2),h=i?u:c,d=r?u:c,f=e.typography.body1.lineHeight,p=e.typography.body1.fontSize;"compact"===t&&(a=e.spacing(.5),c=e.spacing(.5),u=e.spacing(1),h=i?u:c,d=r?u:c,f=e.typography.body2.lineHeight,p=e.typography.body2.fontSize),"comfortable"===t&&(a=e.spacing(2),c=e.spacing(1.5),u=e.spacing(2),h=i?u:c,d=r?u:c,f=e.typography.body1.lineHeight,p=e.typography.body1.fontSize);let m=n||!o||"auto"===o?(s=f,l=a,("string"==typeof s?parseInt(s,10):s??0)+2*("string"==typeof l?parseInt(l,10):l)):o;return{padding:`${a} ${d} ${a} ${h}`,height:m,fontSize:p,lineHeight:f}}function sP(e){return e.map(({width:e,align:t,headerDescription:n,cellDescription:r,enableSorting:i,...o})=>({...o,..."auto"===e||void 0===e?{size:0,minSize:0,maxSize:0}:{size:e},enableSorting:!!i,meta:{align:t,headerDescription:n,cellDescription:r}}))}let sO=(0,Z.ZP)(sT.Z)(({theme:e})=>({padding:0,backgroundColor:"inherit","&.MuiTableCell-head":{backgroundColor:e.palette.background.default},"&:focus-visible":{outline:`solid 1px ${e.palette.primary.main}`,outlineOffset:"-1px",borderRadius:0}}));function sI({children:e,density:t,variant:n,width:r,defaultColumnHeight:i,focusState:o="none",onFocusTrigger:s,isFirstColumn:l,isLastColumn:a,description:c,align:u,color:h,backgroundColor:d,...f}){let p=(0,nu.Z)(),m=(0,D.useRef)(),g="head"===n;(0,D.useEffect)(()=>{"trigger-focus"===o&&m.current&&m.current.focus()},[o]);let v=e=>{s?.(e)};return(0,T.jsx)(sO,{...f,tabIndex:"none"!==o?0:-1,onFocus:e=>{let t=e.currentTarget?.querySelector('a[href], button, input, textarea, select, details,[role="button"]');t&&t.focus()},onClick:v,onKeyUp:v,style:{width:r},sx:{position:"relative",borderBottom:g?`solid 1px ${p.palette.grey[100]}`:`solid 1px ${p.palette.grey[50]}`,"&:hover #original-cell":{position:"absolute",top:0,left:0,zIndex:10,width:"fit-content",minWidth:"100%",whiteSpace:"nowrap",overflow:"visible",backgroundColor:`${d??p.palette.background.default} !important`,outline:`solid 1px ${p.palette.info.main}`,outlineOffset:"-1px"}},ref:m,children:(0,T.jsx)(nh.Z,{id:"original-cell",sx:{...sR(p,t,{isHeader:g,isLastColumn:a,isFirstColumn:l,defaultColumnHeight:i}),position:"relative",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flexDirection:"inherit"},style:{backgroundColor:d??"inherit",color:h??"inherit"},title:c,"aria-label":c,textAlign:u,children:e})})}function sE({onSort:e,sortDirection:t,nextSortDirection:n,children:r,...i}){let o=!!e,s=(0,T.jsx)(sv.Z,{noWrap:!0,variant:"inherit",component:"div",color:"inherit",children:r}),l=!!t;return(0,T.jsx)(sI,{...i,children:o?(0,T.jsx)(sM,{onClick:e,direction:l?t:n,active:l,sx:{verticalAlign:"unset",maxWidth:"100%","&:focus-visible":{[`& .${sw.icon}`]:{opacity:l?1:.5}}},children:s}):s})}var sZ=n(59019);let sL=(0,D.forwardRef)(function(e,t){return(0,T.jsx)(sZ.Z,{...e,tabIndex:-1,ref:t})}),sj={row:0,column:0},sB=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"];var sF=n(32641);function sV(e){return(0,V.ZP)("MuiTableFooter",e)}(0,F.Z)("MuiTableFooter",["root"]);let sN=(0,Z.ZP)("tfoot",{name:"MuiTableFooter",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"table-footer-group"}),sH={variant:"footer"},sz="tfoot",s$=D.forwardRef(function(e,t){let n=(0,B.i)({props:e,name:"MuiTableFooter"}),{className:r,component:i=sz,...o}=n,s={...n,component:i},l=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"]},sV,t)})(s);return(0,T.jsx)(sF.Z.Provider,{value:sH,children:(0,T.jsx)(sN,{as:i,className:(0,R.Z)(l.root,r),ref:t,role:i===sz?null:"rowgroup",ownerState:s,...o})})}),sW=(0,D.forwardRef)(function(e,t){return(0,T.jsx)(s$,{...e,ref:t})});function s_({width:e,height:t,density:n,defaultColumnWidth:r,defaultColumnHeight:i,onRowClick:o,onRowMouseOver:s,onRowMouseOut:l,rows:a,columns:c,headers:u,cellConfigs:h,pagination:d,onPaginationChange:f,rowCount:p}){let m=(0,D.useRef)(null),g=(0,D.useRef)({startIndex:0,endIndex:0}),v=function({visibleRange:e,virtualTable:t,maxRows:n,maxColumns:r}){return function({maxRows:e,maxColumns:t,onActiveCellChange:n}){let[r,i]=(0,D.useState)(sj),[o,s]=(0,D.useState)(!1);return{activeCell:r,isActive:o,onTableKeyDown:(0,D.useCallback)(r=>{let o=r.key;(sB.includes(o)||"Home"===o||"End"===o||"PageDown"===o||"PageUp"===o)&&i(i=>{let s=i.row,l=i.column;"ArrowRight"===o&&l<t-1?(r.preventDefault(),l+=1):"ArrowLeft"===o&&l>0?(r.preventDefault(),l-=1):"ArrowDown"===o&&s<e-1?(r.preventDefault(),s+=1):"ArrowUp"===o&&s>0?(r.preventDefault(),s-=1):"Home"===o?(r.preventDefault(),s=0,l=0):"End"===o&&(r.preventDefault(),s=e-1,l=t-1);let a={column:l,row:s},c=n?.(r,i,a)||a;return c.row===i.row&&c.column===i.column?i:c})},[t,e,n]),onCellFocus:e=>{e.column===r.column&&e.row===r.row&&o||(s(!0),i(e))}}}({maxRows:n,maxColumns:r,onActiveCellChange:(r,i,o)=>{let s=r.key,l=o&&(i.column!==o.column||i.row!==o.row),a=o?.row??i.row;if("ArrowDown"===s&&l)(a-1<e.current.startIndex||a-1>e.current.endIndex)&&t.current?.scrollToIndex({index:a-1,align:"end"});else if("ArrowUp"===s&&l)(a-1<e.current.startIndex||a-1>e.current.endIndex)&&t.current?.scrollToIndex({index:a-1,align:"start"});else if(l&&("Home"===s||"End"===s))t.current?.scrollToIndex({index:Math.max(a-1,0),align:"start"});else if("PageDown"===s){r.preventDefault();let o=i.row;return o=Math.min(n-1,e.current.endIndex+1),t.current?.scrollToIndex({index:o-1,align:"start"}),{row:o,column:i.column}}else if("PageUp"===s){let n=i.row;return n=Math.max(0,e.current.startIndex-1),t.current?.scrollToIndex({index:n-1,align:"end"}),{row:n,column:i.column}}return o}})}({visibleRange:g,virtualTable:m,maxRows:a.length+1,maxColumns:c.length}),b=e=>e.row===v.activeCell.row&&e.column===v.activeCell.column?v.isActive?"trigger-focus":"focus-next":"none",y=(0,D.useMemo)(()=>({Scroller:sL,Table:t=>(0,T.jsx)(sp,{...t,width:e,density:n,onKeyDown:v.onTableKeyDown}),TableHead:sg,TableFoot:sW,TableRow:({item:e,...t})=>{let r=a[t["data-index"]];if(!r)return null;let i={id:r.id,index:r.index};return(0,T.jsx)(sa,{...t,onClick:e=>o(e,r.id),density:n,onMouseOver:e=>{s?.(e,i)},onMouseOut:e=>{l?.(e,i)}})},TableBody:su}),[n,v.onTableKeyDown,o,l,s,a,e]),x=(e,t)=>{d&&f&&f({...d,pageIndex:t})},w=e=>{d&&f&&f({pageIndex:0,pageSize:parseInt(e.target.value,10)})};return(0,T.jsx)(nh.Z,{style:{width:e,height:t},children:(0,T.jsx)(i_,{ref:m,totalCount:a.length,components:y,rangeChanged:e=>{g.current=e},fixedHeaderContent:()=>(0,T.jsx)(T.Fragment,{children:u.map(e=>(0,T.jsx)(sa,{density:n,children:e.headers.map((e,t,o)=>{var s,l,a,c,u;let h=e.column,d={row:0,column:t},f=h.getIsSorted(),p=h.getNextSortingOrder();return(0,T.jsx)(sE,{onSort:h.getCanSort()?h.getToggleSortingHandler():void 0,sortDirection:"string"==typeof f?f:void 0,nextSortDirection:"string"==typeof p?p:void 0,width:h.getSize()||r,defaultColumnHeight:i,align:h.columnDef.meta?.align,variant:"head",density:n,description:h.columnDef.meta?.headerDescription,focusState:b(d),onFocusTrigger:()=>v.onCellFocus(d),isFirstColumn:0===t,isLastColumn:t===o.length-1,children:(s=h.columnDef.header,l=e.getContext(),s?"function"==typeof(c=a=s)&&(()=>{let e=Object.getPrototypeOf(c);return e.prototype&&e.prototype.isReactComponent})()||"function"==typeof a||"object"==typeof(u=a)&&"symbol"==typeof u.$$typeof&&["react.memo","react.forward_ref"].includes(u.$$typeof.description)?D.createElement(s,l):s:null)},e.id)})},e.id))}),fixedFooterContent:d?()=>(0,T.jsx)(ss.Z,{sx:{backgroundColor:e=>e.palette.background.default},children:(0,T.jsx)(sl.Z,{colSpan:c.length,count:p,page:d.pageIndex,rowsPerPage:d.pageSize,onPageChange:x,onRowsPerPageChange:w})}):void 0,itemContent:e=>{let t=a[e];return t?(0,T.jsx)(T.Fragment,{children:t.getVisibleCells().map((t,o,s)=>{let l,a={row:e+1,column:o},c=t.getContext(),u=h?.[c.cell.id],d=t.column.columnDef.cell,f="function"==typeof d?d(c):null,p=t.column.columnDef.meta?.cellDescription;return"function"==typeof p?l=p(c):p&&"string"==typeof f&&(l=f),(0,T.jsx)(sI,{"data-testid":t.id,title:l||u?.text||f,width:t.column.getSize()||r,defaultColumnHeight:i,align:t.column.columnDef.meta?.align,density:n,focusState:b(a),onFocusTrigger:()=>v.onCellFocus(a),isFirstColumn:0===o,isLastColumn:o===s.length-1,description:l,color:u?.textColor??void 0,backgroundColor:u?.backgroundColor??void 0,children:u?.text||f},t.id)})}):null}})})}var sq=n(82707);function sG({color:e,density:t,...n}){let r="compact"===t;return(0,T.jsx)(sq.Z,{size:r?"small":"medium",...n,focusRipple:!1,tabIndex:-1,sx:{color:e,padding:e=>e.spacing(r?.25:.5),position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)","&.Mui-checked":{color:e},"&.Mui-focusVisible":{background:e?(0,O.Fq)(e,.5):void 0},"& .MuiSvgIcon-root":{fontSize:r?16:18}}})}let sU=(e,t)=>`${t}`,sK={},sY=[];function sX({data:e,columns:t,cellConfigs:n,density:r="standard",defaultColumnWidth:i=sD,defaultColumnHeight:o="auto",checkboxSelection:s,onRowSelectionChange:l,onSortingChange:a,getCheckboxColor:c,getRowId:u=sU,rowSelection:h=sK,sorting:d=sY,pagination:f,onPaginationChange:p,rowSelectionVariant:m="standard",...g}){let v=(0,nu.Z)(),b=(0,D.useCallback)((e,t,n)=>{"standard"===m||n?t.toggleSelected():t.getIsSelected()&&!e.getIsAllRowsSelected()?e.toggleAllRowsSelected():l?.({[t.id]:!0})},[l,m]),y=(0,D.useCallback)((e,t,n)=>{let r=e.nativeEvent&&(e.nativeEvent instanceof MouseEvent||e.nativeEvent instanceof KeyboardEvent)?e.nativeEvent:void 0;b(t,n,!!r?.metaKey||!!r?.shiftKey)},[b]),x=(0,D.useMemo)(()=>({id:"checkboxRowSelect",size:28,header:({table:e})=>(0,T.jsx)(sG,{checked:e.getIsAllRowsSelected(),indeterminate:e.getIsSomeRowsSelected(),onChange:e.getToggleAllRowsSelectedHandler(),color:v.palette.text.primary,density:r}),cell:({row:e,table:t})=>(0,T.jsx)(sG,{checked:e.getIsSelected(),indeterminate:e.getIsSomeSelected(),onChange:n=>{y(n,t,e)},color:c?.(e.original),density:r}),enableSorting:!1}),[v.palette.text.primary,r,c,y]),w=function(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=D.useState(()=>({current:function(e){var t,n;let r=[...so,...null!=(t=e._features)?t:[]],i={_features:r},o=i._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(i)),{}),s={...null!=(n=e.initialState)?n:{}};i._features.forEach(e=>{var t;s=null!=(t=null==e.getInitialState?void 0:e.getInitialState(s))?t:s});let l=[],a=!1,c={_features:r,options:{...o,...e},initialState:s,_queue:e=>{l.push(e),a||(a=!0,Promise.resolve().then(()=>{for(;l.length;)l.shift()();a=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{i.setState(i.initialState)},setOptions:e=>{var t;t=oP(e,i.options),i.options=i.options.mergeOptions?i.options.mergeOptions(o,t):{...o,...t}},getState:()=>i.options.state,setState:e=>{null==i.options.onStateChange||i.options.onStateChange(e)},_getRowId:(e,t,n)=>{var r;return null!=(r=null==i.options.getRowId?void 0:i.options.getRowId(e,t,n))?r:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(e,t)=>{let n=(t?i.getPrePaginationRowModel():i.getRowModel()).rowsById[e];if(!n&&!(n=i.getCoreRowModel().rowsById[e]))throw Error();return n},_getDefaultColumnDef:oE(()=>[i.options.defaultColumn],e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...i._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef()),{}),...e}},oZ(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>i.options.columns,getAllColumns:oE(()=>[i._getColumnDefs()],e=>{let t=function(e,n,r){return void 0===r&&(r=0),e.map(e=>{let o=function(e,t,n,r){var i,o;let s,l={...e._getDefaultColumnDef(),...t},a=l.accessorKey,c=null!=(i=null!=(o=l.id)?o:a?"function"==typeof String.prototype.replaceAll?a.replaceAll(".","_"):a.replace(/\./g,"_"):void 0)?i:"string"==typeof l.header?l.header:void 0;if(l.accessorFn?s=l.accessorFn:a&&(s=a.includes(".")?e=>{let t=e;for(let e of a.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[l.accessorKey]),!c)throw Error();let u={id:`${String(c)}`,accessorFn:s,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:oE(()=>[!0],()=>{var e;return[u,...null==(e=u.columns)?void 0:e.flatMap(e=>e.getFlatColumns())]},oZ(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:oE(()=>[e._getOrderColumnsFn()],e=>{var t;return null!=(t=u.columns)&&t.length?e(u.columns.flatMap(e=>e.getLeafColumns())):[u]},oZ(e.options,"debugColumns","column.getLeafColumns"))};for(let t of e._features)null==t.createColumn||t.createColumn(u,e);return u}(i,e,r,n);return o.columns=e.columns?t(e.columns,o,r+1):[],o})};return t(e)},oZ(e,"debugColumns","getAllColumns")),getAllFlatColumns:oE(()=>[i.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),oZ(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:oE(()=>[i.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),oZ(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:oE(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),oZ(e,"debugColumns","getAllLeafColumns")),getColumn:e=>i._getAllFlatColumnsById()[e]};Object.assign(i,c);for(let e=0;e<i._features.length;e++){let t=i._features[e];null==t||null==t.createTable||t.createTable(i)}return i}(t)})),[r,i]=D.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),null==e.onStateChange||e.onStateChange(t)}})),n.current}({data:e,columns:(0,D.useMemo)(()=>{let e=sP(t);return s&&e.unshift(x),e},[x,s,t]),getRowId:u,getCoreRowModel:e=>oE(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,o){void 0===i&&(i=0);let s=[];for(let a=0;a<t.length;a++){let c=oF(e,e._getRowId(t[a],a,o),t[a],a,i,void 0,null==o?void 0:o.id);if(n.flatRows.push(c),n.rowsById[c.id]=c,s.push(c),e.options.getSubRows){var l;c.originalSubRows=e.options.getSubRows(t[a],a),null!=(l=c.originalSubRows)&&l.length&&(c.subRows=r(c.originalSubRows,i+1,c))}}return s};return n.rows=r(t),n},oZ(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex())),getSortedRowModel:e=>oE(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(null!=t&&t.length))return n;let r=e.getState().sorting,i=[],o=r.filter(t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()}),s={};o.forEach(t=>{let n=e.getColumn(t.id);n&&(s[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});let l=e=>{let t=e.map(e=>({...e}));return t.sort((e,t)=>{for(let r=0;r<o.length;r+=1){var n;let i=o[r],l=s[i.id],a=l.sortUndefined,c=null!=(n=null==i?void 0:i.desc)&&n,u=0;if(a){let n=e.getValue(i.id),r=t.getValue(i.id),o=void 0===n,s=void 0===r;if(o||s){if("first"===a)return o?-1:1;if("last"===a)return o?1:-1;u=o&&s?0:o?a:-a}}if(0===u&&(u=l.sortingFn(e,t,i.id)),0!==u)return c&&(u*=-1),l.invertSorting&&(u*=-1),u}return e.index-t.index}),t.forEach(e=>{var t;i.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=l(e.subRows))}),t};return{rows:l(n.rows),flatRows:i,rowsById:n.rowsById}},oZ(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex())),getPaginationRowModel:f?e=>oE(()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded],(t,n)=>{let r;if(!n.rows.length)return n;let{pageSize:i,pageIndex:o}=t,{rows:s,flatRows:l,rowsById:a}=n,c=i*o;s=s.slice(c,c+i),(r=e.options.paginateExpandedRows?{rows:s,flatRows:l,rowsById:a}:function(e){let t=[],n=e=>{var r;t.push(e),null!=(r=e.subRows)&&r.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}({rows:s,flatRows:l,rowsById:a})).flatRows=[];let u=e=>{r.flatRows.push(e),e.subRows.length&&e.subRows.forEach(u)};return r.rows.forEach(u),r},oZ(e.options,"debugTable","getPaginationRowModel")):void 0,manualPagination:!f,enableRowSelection:!!s,onRowSelectionChange:e=>{let t="function"==typeof e?e(h):e;l?.(t)},onSortingChange:e=>{let t="function"==typeof e?e(d):e;a?.(t)},sortDescFirst:!0,state:{rowSelection:h,sorting:d,...f?{pagination:f}:{}}}),C=(0,D.useCallback)((e,t)=>{let n=w.getRow(t);b(w,n,e.metaKey||e.shiftKey)},[b,w]);return(0,T.jsx)(s_,{...g,density:r,defaultColumnWidth:i,defaultColumnHeight:o,onRowClick:C,rows:w.getRowModel().rows,columns:w.getAllFlatColumns(),headers:w.getHeaderGroups(),cellConfigs:n,pagination:f,onPaginationChange:p,rowCount:w.getRowCount()})}let sQ=[{accessorKey:"label",header:"Name",enableSorting:!0,cell:({getValue:e})=>(0,T.jsx)("span",{title:e(),children:e()})}],sJ=e=>e.id,s0=e=>e.color;function s1({items:e,selectedItems:t,onSelectedItemsChange:n,onItemMouseOver:r,onItemMouseOut:i,height:o,width:s,columns:l=[],sorting:a,onSortingChange:c}){let u=(0,D.useMemo)(()=>"string"!=typeof t?t:e.reduce((e,t,n)=>(e[sJ(t,n)]=!0,e),{}),[t,e]),h=(0,D.useMemo)(()=>[...sQ,...l],[l]);return(0,T.jsx)(sX,{height:o,width:s,rowSelection:u,onRowSelectionChange:n,onRowMouseOver:r,onRowMouseOut:i,sorting:a,onSortingChange:c,data:e,columns:h,density:"compact",defaultColumnWidth:"auto",getRowId:sJ,getCheckboxColor:s0,checkboxSelection:!0,rowSelectionVariant:"legend"})}function s2({width:e,height:t,options:n,data:r,selectedItems:i,onSelectedItemsChange:o,onItemMouseOver:s,onItemMouseOut:l,tableProps:a}){let c,u=(e,t)=>{let n=e.metaKey||e.shiftKey;o((0,nf.Uy)(i,e=>{if("ALL"===e)return{[t]:!0};let r=!!e[t];return n?(r?delete e[t]:e[t]=!0,e):r?"ALL":{[t]:!0}}))},h=(0,nd.bk)(n.mode),d=r.length>=500,f={height:t,items:r,selectedItems:i,onLegendItemClick:u,onItemMouseOver:s,onItemMouseOut:l};return(c="table"===h?(0,T.jsx)(s1,{...f,onSelectedItemsChange:o,width:e,...a}):"right"===n.position||d?(0,T.jsx)(oA,{...f,width:e,onLegendItemClick:u}):(0,T.jsx)(oR,{...f,onLegendItemClick:u}),"right"===n.position)?(0,T.jsx)(nh.Z,{style:{width:e,height:t},sx:{position:"absolute",top:0,right:0,backgroundColor:e=>`${e.palette.background.default}`},children:c}):(0,T.jsx)(nh.Z,{style:{width:e,height:t},sx:{position:"absolute",bottom:0,backgroundColor:e=>`${e.palette.background.default}`},children:c})}let s5={medium:{bottom:6,right:250},small:{bottom:4,right:150}};function s3({children:e,legendProps:t,width:n,height:r,spacing:i=0,legendSize:o,minChildrenWidth:s=100,minChildrenHeight:l=100}){let{content:a,legend:c,margin:u}=function({width:e,height:t,legendProps:n,legendSize:r,minChildrenHeight:i,minChildrenWidth:o,spacing:s,theme:l}){let a,c,u=n?.options,h={legend:{show:!1,width:0,height:0},content:{width:e,height:t},margin:{right:0,bottom:0}};if(!u)return h;let{position:d}=u;if("list"===(0,nd.bk)(u.mode))a="right"===d?200:e,c=40,"right"===d?c=t:t>=300&&(c=100);else{let i=sR(l,"compact"),o=(n?.tableProps?.columns||[]).reduce((e,t)=>("number"==typeof t.width&&(e+=t.width),e),0);a="right"===d?s5[r].right+o:e;let s=Math.min(s5[r].bottom,n.data.length+1);c="bottom"===d?s*i.height:t}let f="right"===d?e-a-s:e,p="bottom"===d?t-c-s:t;return"right"===d&&f<o||"bottom"===d&&p<i?h:{legend:{width:a,height:c,show:!0},content:{width:f,height:p},margin:{right:"right"===d?s:0,bottom:"bottom"===d?s:0}}}({width:n,height:r,legendProps:t,minChildrenHeight:l,minChildrenWidth:s,spacing:i,theme:(0,nu.Z)(),legendSize:(0,nd.dT)(o)});return(0,T.jsxs)(nh.Z,{style:{width:n,height:r},sx:{position:"relative",overflow:"hidden"},children:[(0,T.jsx)(nh.Z,{style:{width:a.width,height:a.height},sx:{marginRight:`${u.right}px`,marginBottom:`${u.bottom}px`},children:"function"==typeof e?e({width:a.width,height:a.height}):e}),t&&c.show&&(0,T.jsx)(s2,{...t,height:c.height,width:c.width})]})}var s8=n(66726),s4=n.n(s8);let s6=(0,D.forwardRef)(function({debounceMs:e=250,value:t,onChange:n,...r},i){let[o,s]=(0,D.useState)(t),l=(0,D.useCallback)(e=>{n?.(e)},[n]),a=(0,D.useMemo)(()=>s4()(l,e),[e,l]);return(0,T.jsx)(Y.Z,{ref:i,value:o,onChange:function(e){s(e.target.value),a(e.target.value)},...r})});s6.displayName="TextField";var s9=n(51602),s7=n(19978),le=n(56873),lt=n(70616),ln=n(10763);let lr=(0,Z.ZP)("form")({overflowY:"auto",display:"flex",flexDirection:"column"}),li=e=>({position:"absolute",top:e.spacing(.5),right:e.spacing(.5)}),lo=({children:e,...t})=>(0,T.jsx)(le.Z,{...t,children:e});lo.Header=({children:e,onClose:t,...n})=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(s9.Z,{style:{textOverflow:"ellipsis",overflow:"hidden"},...n,children:e}),t&&(0,T.jsx)(K.Z,{"aria-label":"Close",onClick:t,sx:li,children:(0,T.jsx)(ln.default,{})})]}),lo.Form=lr,lo.Content=({children:e,sx:t,...n})=>(0,T.jsx)(s7.Z,{dividers:!0,...n,sx:t6({minWidth:"500px",textWrap:"balance"},t),children:e}),lo.PrimaryButton=({children:e,...t})=>(0,T.jsx)(q.Z,{variant:"contained",type:"submit",...t,children:e}),lo.SecondaryButton=({children:e,...t})=>(0,T.jsx)(q.Z,{variant:"outlined",color:"secondary",...t,children:e}),lo.Actions=lt.Z;let ls=e=>{let{description:t,isOpen:n,onCancel:r,onDiscardChanges:i}=e;return(0,T.jsxs)(lo,{open:n,"aria-labelledby":"discard-dialog",children:[(0,T.jsx)(lo.Header,{children:"Discard Changes"}),(0,T.jsx)(lo.Content,{children:t}),(0,T.jsxs)(lo.Actions,{children:[(0,T.jsx)(q.Z,{variant:"contained",onClick:i,children:"Discard Changes"}),(0,T.jsx)(q.Z,{variant:"outlined",color:"secondary",onClick:r,children:"Cancel"})]})]})};var ll=n(38359);let la=({children:e})=>(0,T.jsx)(ll.ZP,{item:!0,xs:4,children:(0,T.jsx)(U.Z,{spacing:3,children:e})});var lc=n(90192),lu=n(23626),lh=n(39398),ld=n(32964),lf=n(87143);let lp=({id:e,title:t,description:n,placement:r,children:i,enterDelay:o,enterNextDelay:s})=>{let l=(0,T.jsx)("span",{children:i});return(0,T.jsx)(lg,{arrow:!0,id:e,placement:r??"top",title:(0,T.jsx)(lm,{title:t,description:n}),enterDelay:o??500,enterNextDelay:s??500,children:l})},lm=({title:e,description:t})=>(0,T.jsxs)(T.Fragment,{children:[e&&(0,T.jsx)(sv.Z,{variant:"body2",sx:e=>({color:e.palette.text.primary,fontWeight:e.typography.fontWeightMedium}),children:e}),(0,T.jsx)(sv.Z,{variant:"caption",sx:e=>({color:e.palette.text.primary,whiteSpace:"pre-line"}),children:t})]}),lg=(0,Z.ZP)(({className:e,...t})=>(0,T.jsx)(ld.Z,{...t,classes:{popper:e}}))(({theme:e})=>({[`& .${lf.Z.tooltip}`]:{backgroundColor:e.palette.background.tooltip,color:e.palette.text.primary,maxWidth:"300px",padding:e.spacing(1),boxShadow:e.shadows[1]},[`& .${lf.Z.arrow}`]:{color:e.palette.background.tooltip}})),lv=({label:e,control:t,description:n})=>{let r=t9("EditorSectionControl"),i=`${r}-control`;return(0,T.jsx)(lc.Z,{children:(0,T.jsxs)(U.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[(0,T.jsxs)(U.Z,{direction:"row",alignItems:"center",justifyContent:"center",children:[(0,T.jsx)(lu.Z,{htmlFor:i,children:e}),n&&(0,T.jsx)(lp,{description:n,enterDelay:100,children:(0,T.jsx)(K.Z,{size:"small",sx:e=>({borderRadius:e.shape.borderRadius,padding:"4x",margin:"0 2px"}),children:(0,T.jsx)(lh.default,{"aria-describedby":"info-tooltip","aria-hidden":!1,fontSize:"inherit",sx:{color:e=>e.palette.grey[700]}})})})]}),(0,T.jsxs)(nh.Z,{sx:{width:"180px",textAlign:"right"},children:[" ",A().cloneElement(t,{id:i})]})]})})},lb=({children:e})=>(0,T.jsx)(ll.ZP,{container:!0,spacing:8,children:e}),ly=({title:e,children:t,icon:n})=>(0,T.jsxs)(nh.Z,{children:[(0,T.jsxs)(nh.Z,{display:"flex",borderBottom:1,borderColor:"grey.300",marginBottom:e=>e.spacing(1),children:[(0,T.jsx)(sv.Z,{variant:"overline",component:"h4",children:e}),n&&(0,T.jsx)(nh.Z,{sx:{marginLeft:"auto"},children:n})]}),(0,T.jsx)(U.Z,{spacing:1,children:t})]});var lx=n(11774),lw=n(70678);function lC({options:e,renderInput:t=e=>(0,T.jsx)(Y.Z,{...e}),...n}){let r=e=>e.label??e.id;return(0,T.jsx)(lx.Z,{isOptionEqualToValue:(e,t)=>e.id===t.id,getOptionDisabled:e=>!!e.disabled,getOptionLabel:r,options:e,renderInput:t,renderOption:({key:e,...t},n)=>(0,T.jsx)("li",{...t,children:(0,T.jsxs)("div",{children:[(0,T.jsx)(sv.Z,{variant:"body1",component:"div",children:r(n)}),n.description&&(0,T.jsx)(sv.Z,{variant:"body2",component:"div",sx:{color:e=>e.palette.text.secondary},children:n.description})]})},e),filterOptions:(0,lw.D)({stringify:e=>`${r(e)} ${e.description||""}`}),...n})}let lS=[{id:"compact",label:"Compact"},{id:"standard",label:"Standard"},{id:"comfortable",label:"Comfortable"}];function lk({onChange:e,value:t="standard"}){return(0,T.jsx)(lv,{label:"Density",control:(0,T.jsx)(lC,{value:lS.find(e=>e.id===t),options:lS,getOptionLabel:e=>e.label,onChange:(t,{id:n})=>{e(n)},disableClearable:!0})})}function lM(){return(0,T.jsxs)(U.Z,{direction:"row",alignItems:"center",children:[(0,T.jsx)(nh.Z,{sx:{content:'""',width:8,height:8,boxSizing:"border-box",position:"absolute",backgroundColor:e=>e.palette.background.default,border:e=>`2px solid ${e.palette.info.main}`,borderRadius:"50%"}}),(0,T.jsx)(nh.Z,{sx:{content:'""',height:2,background:e=>e.palette.info.main,width:"100%"}})]})}function lT(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function lD(e,t){if(e){if("string"==typeof e)return lT(e,t);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lT(e,t):void 0}}function lA(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,l=[],a=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;a=!1}else for(;!(a=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);a=!0);}catch(e){c=!0,i=e}finally{try{if(!a&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return l}}(e,t)||lD(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var lR=n(70501),lP="data-pdnd-honey-pot";function lO(e){return e instanceof Element&&e.hasAttribute(lP)}function lI(e){var t=lA(document.elementsFromPoint(e.x,e.y),2),n=t[0],r=t[1];return n?lO(n)?null!=r?r:null:n:null}var lE=n(91510);function lZ(e,t,n){return(t=(0,lE.Z)(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function lj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lL(Object(n),!0).forEach(function(t){lZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function lB(e){var t,n,r,i,o={x:Math.min((i={x:Math.max((r={x:(n={x:Math.floor((t=e.client).x),y:Math.floor(t.y)}).x-1,y:n.y-1}).x,0),y:Math.max(r.y,0)}).x,window.innerWidth-2),y:Math.min(i.y,window.innerHeight-2)};return DOMRect.fromRect({x:o.x,y:o.y,width:2,height:2})}function lF(e){var t=e.clientRect;return{left:"".concat(t.left,"px"),top:"".concat(t.top,"px"),width:"".concat(t.width,"px"),height:"".concat(t.height,"px")}}function lV(e){return function(e){if(Array.isArray(e))return lT(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||lD(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lN(e){var t=null;return function(){if(!t){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];t={result:e.apply(this,r)}}return t.result}}var lH=lN(function(){return navigator.userAgent.includes("Firefox")}),lz=lN(function(){var e=navigator.userAgent;return e.includes("AppleWebKit")&&!e.includes("Chrome")}),l$={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};if("undefined"!=typeof window&&lz()){var lW=l_();(0,lR.bindAll)(window,[{type:"dragstart",listener:function(){lW.enterCount=0,lW.isOverWindow=!0}},{type:"drop",listener:lq},{type:"dragend",listener:lq},{type:"dragenter",listener:function(e){lW.isOverWindow||0!==lW.enterCount||(e[l$.isEnteringWindow]=!0),lW.isOverWindow=!0,lW.enterCount++}},{type:"dragleave",listener:function(e){lW.enterCount--,lW.isOverWindow&&0===lW.enterCount&&(e[l$.isLeavingWindow]=!0,lW.isOverWindow=!1)}}],{capture:!0})}function l_(){return{enterCount:0,isOverWindow:!1}}function lq(){lW=l_()}function lG(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var lU=(s=function(e){return e()},l=[],a=null,(c=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];l=t,a||(a=requestAnimationFrame(function(){a=null,s.apply(void 0,l)}))}).cancel=function(){a&&(cancelAnimationFrame(a),a=null)},c),lK=(u=null,{schedule:function(e){u={frameId:requestAnimationFrame(function(){u=null,e()}),fn:e}},flush:function(){u&&(cancelAnimationFrame(u.frameId),u.fn(),u=null)}}),lY={isActive:!1};function lX(){return!lY.isActive}function lQ(e){var t,n=e.event,r=null==(t=e.current[0])?void 0:t.dropEffect;null!=r&&n.dataTransfer&&(n.dataTransfer.dropEffect=r)}var lJ=function(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=e.dispatchEvent;if(lX()){var o,s,l=function(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=lG(t);if("external"===n.startedFrom)return{input:i,dropTargets:[]};var o=r({input:i,source:n.payload,target:t.target,current:[]});return{input:i,dropTargets:o}}({event:t,dragType:n,getDropTargetsOver:r});lY.isActive=!0;var a={current:l};lQ({event:t,current:l.dropTargets});var c=function(e){var t=e.source,n=e.initial,r=e.dispatchEvent,i={dropTargets:[]};function o(e){r(e),i={dropTargets:e.payload.location.current.dropTargets}}return{start:function(e){var r=e.nativeSetDragImage,s={current:n,previous:i,initial:n};o({eventName:"onGenerateDragPreview",payload:{source:t,location:s,nativeSetDragImage:r}}),lK.schedule(function(){o({eventName:"onDragStart",payload:{source:t,location:s}})})},dragUpdate:function(e){var r=e.current;lK.flush(),lU.cancel(),o({eventName:"onDropTargetChange",payload:{source:t,location:{initial:n,previous:i,current:r}}})},drag:function(e){var r=e.current;lU(function(){lK.flush(),o({eventName:"onDrag",payload:{source:t,location:{initial:n,previous:i,current:r}}})})},drop:function(e){var r=e.current,s=e.updatedSourcePayload;lK.flush(),lU.cancel(),o({eventName:"onDrop",payload:{source:null!=s?s:t,location:{current:r,previous:i,initial:n}}})}}}({source:n.payload,dispatchEvent:i,initial:l}),u=(0,lR.bindAll)(window,[{type:"dragover",listener:function(e){d(e),c.drag({current:a.current})}},{type:"dragenter",listener:d},{type:"dragleave",listener:function(e){(function(e){var t=e.dragLeave,n=t.type,r=t.relatedTarget;return"dragleave"===n&&(lz()?!!lz()&&t.hasOwnProperty(l$.isLeavingWindow):null==r||(lH()?"nodeName"in r&&r.ownerDocument!==document:r instanceof HTMLIFrameElement))})({dragLeave:e})&&(h({input:a.current.input,dropTargets:[]}),"external"===n.startedFrom&&f())}},{type:"drop",listener:function(e){if(a.current={dropTargets:a.current.dropTargets,input:lG(e)},!a.current.dropTargets.length)return void f();e.preventDefault(),lQ({event:e,current:a.current.dropTargets}),c.drop({current:a.current,updatedSourcePayload:"external"===n.type?n.getDropPayload(e):null}),p()}},{type:"dragend",listener:function(e){a.current={dropTargets:a.current.dropTargets,input:lG(e)},f()}}].concat(lV([{type:"pointermove",listener:(s=0,function(){if(s<20)return void s++;o()})},{type:"pointerdown",listener:o=f}])),{capture:!0});c.start({nativeSetDragImage:t.dataTransfer?t.dataTransfer.setDragImage.bind(t.dataTransfer):null})}function h(e){var t=function(e){var t=e.current,n=e.next;if(t.length!==n.length)return!0;for(var r=0;r<t.length;r++)if(t[r].element!==n[r].element)return!0;return!1}({current:a.current.dropTargets,next:e.dropTargets});a.current=e,t&&c.dragUpdate({current:a.current})}function d(e){var t=lG(e),i=r({target:lO(e.target)?lI({x:t.clientX,y:t.clientY}):e.target,input:t,source:n.payload,current:a.current.dropTargets});i.length&&(e.preventDefault(),lQ({event:e,current:i})),h({dropTargets:i,input:t})}function f(){a.current.dropTargets.length&&h({dropTargets:[],input:a.current.input}),c.drop({current:a.current,updatedSourcePayload:null}),p()}function p(){lY.isActive=!1,u()}},l0=new Map;function l1(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){t.forEach(function(e){return e()})}}function l2(e,t){var n=t.attribute,r=t.value;return e.setAttribute(n,r),function(){return e.removeAttribute(n)}}function l5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l3(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l5(Object(n),!0).forEach(function(t){lZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l5(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l8(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l4(e,void 0);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l4(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw o}}}}function l4(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l6(e){return e.slice(0).reverse()}function l9(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var ae=lN(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),at="text/plain",an=new WeakMap,ar=(h=null,{bindEvents:function(){return h=null,(0,lR.bind)(window,{type:"pointermove",listener:function(e){h={x:e.clientX,y:e.clientY}},options:{capture:!0}})},getOnPostDispatch:function(){var e=null;return function(t){var n=t.eventName,r=t.payload;if("onDragStart"===n){var i,o,s,l,a=r.location.initial.input,c=null!=(l=h)?l:{x:a.clientX,y:a.clientY};(i=document.createElement("div")).setAttribute(lP,"true"),o=lB({client:c}),Object.assign(i.style,lj(lj({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},lF({clientRect:o})),{},{pointerEvents:"auto",zIndex:0x7fffffff})),document.body.appendChild(i),s=(0,lR.bind)(window,{type:"pointermove",listener:function(e){o=lB({client:{x:e.clientX,y:e.clientY}}),Object.assign(i.style,lF({clientRect:o}))},options:{capture:!0}}),e=function(e){var t,n,r,l=e.current;if(s(),n=(t={client:l,clientRect:o}).client,r=t.clientRect,n.x>=r.x&&n.x<=r.x+r.width&&n.y>=r.y&&n.y<=r.y+r.height)return void i.remove();function a(){c(),i.remove()}var c=(0,lR.bindAll)(window,[{type:"pointerdown",listener:a},{type:"pointermove",listener:a},{type:"focusin",listener:a},{type:"focusout",listener:a},{type:"dragstart",listener:a},{type:"dragenter",listener:a},{type:"dragover",listener:a}],{capture:!0})}}if("onDrop"===n){var u,d=r.location.current.input;null==(u=e)||u({current:{x:d.clientX,y:d.clientY}}),e=null,h=null}}}}),ai=function(e){var t=e.typeKey,n=e.mount,r=e.dispatchEventToSource,i=e.onPostDispatch,o=e.defaultDropEffect,s=function(){var e=new Set,t=null;function n(e){t&&(!e.canMonitor||e.canMonitor(t.canMonitorArgs))&&t.active.add(e)}return{dispatchEvent:function(r){var i=r.eventName,o=r.payload;if("onGenerateDragPreview"===i){t={canMonitorArgs:{initial:o.location.initial,source:o.source},active:new Set};var s,l=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l9(e,void 0);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l9(e,t):void 0}}(e))){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw o}}}}(e);try{for(l.s();!(s=l.n()).done;){var a=s.value;n(a)}}catch(e){l.e(e)}finally{l.f()}}if(t){for(var c=Array.from(t.active),u=0;u<c.length;u++){var h,d=c[u];t.active.has(d)&&(null==(h=d[i])||h.call(d,o))}"onDrop"===i&&(t.active.clear(),t=null)}},monitorForConsumers:function(r){var i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l7(Object(n),!0).forEach(function(t){lZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l7(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},r);return e.add(i),n(i),function(){e.delete(i),t&&t.active.delete(i)}}}}(),l=function(e){var t=e.typeKey,n=e.defaultDropEffect,r=new WeakMap,i="data-drop-target-for-".concat(t),o="[".concat(i,"]");function s(e){var t,n=e.eventName,i=e.payload,o=l8(i.location.current.dropTargets);try{for(o.s();!(t=o.n()).done;){var s,l=t.value,a=r.get(l.element),c=l3(l3({},i),{},{self:l});null==a||null==(s=a[n])||s.call(a,c)}}catch(e){o.e(e)}finally{o.f()}}var l={onGenerateDragPreview:s,onDrag:s,onDragStart:s,onDrop:s,onDropTargetChange:function(e){var t,n=e.payload,i=new Set(n.location.current.dropTargets.map(function(e){return e.element})),o=new Set,s=l8(n.location.previous.dropTargets);try{for(s.s();!(t=s.n()).done;){var l,a,c=t.value;o.add(c.element);var u=r.get(c.element),h=i.has(c.element),d=l3(l3({},n),{},{self:c});null==u||null==(l=u.onDropTargetChange)||l.call(u,d),h||null==u||null==(a=u.onDragLeave)||a.call(u,d)}}catch(e){s.e(e)}finally{s.f()}var f,p=l8(n.location.current.dropTargets);try{for(p.s();!(f=p.n()).done;){var m,g,v=f.value;if(!o.has(v.element)){var b=l3(l3({},n),{},{self:v}),y=r.get(v.element);null==y||null==(m=y.onDropTargetChange)||m.call(y,b),null==y||null==(g=y.onDragEnter)||g.call(y,b)}}}catch(e){p.e(e)}finally{p.f()}}};return{dropTargetForConsumers:function(e){return l1(l2(e.element,{attribute:i,value:"true"}),(r.set(e.element,e),function(){return r.delete(e.element)}))},getIsOver:function(e){var t=e.source,i=e.target,s=e.input,l=e.current,a=function e(t){var i,s,l,a,c=t.source,u=t.target,h=t.input,d=t.result,f=void 0===d?[]:d;if(null==u)return f;if(!(u instanceof Element))return u instanceof Node?e({source:c,target:u.parentElement,input:h,result:f}):f;var p=u.closest(o);if(null==p)return f;var m=r.get(p);if(null==m)return f;var g={input:h,source:c,element:m.element};if(m.canDrop&&!m.canDrop(g))return e({source:c,target:m.element.parentElement,input:h,result:f});var v=null!=(i=null==(s=m.getData)?void 0:s.call(m,g))?i:{},b=null!=(l=null==(a=m.getDropEffect)?void 0:a.call(m,g))?l:n,y={data:v,element:m.element,dropEffect:b,isActiveDueToStickiness:!1};return e({source:c,target:m.element.parentElement,input:h,result:[].concat(lV(f),[y])})}({source:t,target:i,input:s});if(a.length>=l.length)return a;for(var c=l6(l),u=l6(a),h=[],d=0;d<c.length;d++){var f,p=c[d],m=u[d];if(null!=m){h.push(m);continue}var g=h[d-1],v=c[d-1];if((null==g?void 0:g.element)!==(null==v?void 0:v.element))break;var b=r.get(p.element);if(!b)break;var y={input:s,source:t,element:b.element};if(b.canDrop&&!b.canDrop(y)||!(null!=(f=b.getIsSticky)&&f.call(b,y)))break;h.push(l3(l3({},p),{},{isActiveDueToStickiness:!0}))}return l6(h)},dispatchEvent:function(e){l[e.eventName](e)}}}({typeKey:t,defaultDropEffect:o});function a(e){null==r||r(e),l.dispatchEvent(e),s.dispatchEvent(e),null==i||i(e)}function c(e){lJ({event:e.event,dragType:e.dragType,getDropTargetsOver:l.getIsOver,dispatchEvent:a})}return{registerUsage:function(){var e,r;return r=function(e){var t=e.typeKey,n=e.mount,r=l0.get(t);if(r)return r.usageCount++,r;var i={typeKey:t,unmount:n(),usageCount:1};return l0.set(t,i),i}(e={typeKey:t,mount:function(){return n({canStart:lX,start:c})}}),function(){r.usageCount--,r.usageCount>0||(r.unmount(),l0.delete(e.typeKey))}},dropTarget:l.dropTargetForConsumers,monitor:s.monitorForConsumers}}({typeKey:"element",defaultDropEffect:"move",mount:function(e){return l1(ar.bindEvents(),(0,lR.bind)(document,{type:"dragstart",listener:function(t){if(e.canStart(t)&&!t.defaultPrevented){if(t.dataTransfer){var n,r,i,o,s,l,a=t.target;if(!(a instanceof HTMLElement))return null;var c=an.get(a);if(!c)return null;var u=lG(t),h={element:c.element,dragHandle:null!=(n=c.dragHandle)?n:null,input:u};if(c.canDrag&&!c.canDrag(h))return t.preventDefault(),null;if(c.dragHandle){var d=lI({x:u.clientX,y:u.clientY});if(!c.dragHandle.contains(d))return t.preventDefault(),null}var f=null!=(r=null==(i=c.getInitialDataForExternal)?void 0:i.call(c,h))?r:null;if(f)for(var p=0,m=Object.entries(f);p<m.length;p++){var g=lA(m[p],2),v=g[0],b=g[1];t.dataTransfer.setData(v,null!=b?b:"")}!ae()||t.dataTransfer.types.includes(at)||t.dataTransfer.types.includes("text/uri-list")||t.dataTransfer.setData(at,"pdnd:android-fallback"),t.dataTransfer.setData("application/vnd.pdnd","");var y={element:c.element,dragHandle:null!=(o=c.dragHandle)?o:null,data:null!=(s=null==(l=c.getInitialData)?void 0:l.call(c,h))?s:{}};e.start({event:t,dragType:{type:"element",payload:y,startedFrom:"internal"}})}}}}))},dispatchEventToSource:function(e){var t,n,r=e.eventName,i=e.payload;null==(t=an.get(i.source.element))||null==(n=t[r])||n.call(t,i)},onPostDispatch:ar.getOnPostDispatch()}),ao=ai.dropTarget,as=ai.monitor;function al(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?al(Object(n),!0).forEach(function(t){lZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):al(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ac={top:function(e,t){return Math.abs(t.y-e.top)},right:function(e,t){return Math.abs(e.right-t.x)},bottom:function(e,t){return Math.abs(e.bottom-t.y)},left:function(e,t){return Math.abs(t.x-e.left)}},au=Symbol("closestEdge");function ah(e){var t;return null!=(t=e[au])?t:null}let ad={type:"idle"};function af({elements:e,accessKey:t,axis:n="vertical",onChange:r}){return(0,D.useEffect)(()=>as({onDrop({location:i,source:o}){var s,l;let a=i.current.dropTargets[0];if(!a)return;let c=o.data,u=a.data,h=e.findIndex(e=>e[t]===c[t]),d=e.findIndex(e=>e[t]===u[t]);d<0||h<0||r(function(e){var t=e.list,n=e.startIndex,r=e.finishIndex;if(-1===n||-1===r)return Array.from(t);var i=Array.from(t),o=lA(i.splice(n,1),1)[0];return i.splice(r,0,o),i}({list:(s={list:e,startIndex:h,indexOfTarget:d,closestEdgeOfTarget:ah(u),axis:n}).list,startIndex:l=s.startIndex,finishIndex:function(e){var t=e.startIndex,n=e.closestEdgeOfTarget,r=e.indexOfTarget,i=e.axis;if(-1===t||-1===r||t===r)return t;if(null==n)return r;var o="vertical"===i&&"bottom"===n||"horizontal"===i&&"right"===n;return t<r?o?r:r-1:o?r+1:r}({closestEdgeOfTarget:s.closestEdgeOfTarget,startIndex:l,indexOfTarget:s.indexOfTarget,axis:s.axis})}))}}),[t,n,e,r])}function ap({children:e,data:t}){let n=(0,D.useRef)(null),[r,i]=(0,D.useState)(ad);return(0,D.useEffect)(()=>{let e=n.current;if(e){var r;return l1((r={element:e,getInitialData:()=>t,onDragStart(){i({type:"is-dragging"})},onDrop(){i(ad)}},l1(ai.registerUsage(),(an.set(r.element,r),function(){an.delete(r.element)}),l2(r.element,{attribute:"draggable",value:"true"}))),ao({element:e,canDrop:({source:t})=>t.element!==e,getData:({input:n})=>{var r,i,o,s,l,a,c,u,h;return s=(r={element:e,input:n,allowedEdges:["top","bottom"]}).element,l=r.input,a=r.allowedEdges,c={x:l.clientX,y:l.clientY},u=s.getBoundingClientRect(),h=null!=(i=null==(o=a.map(function(e){return{edge:e,value:ac[e](u,c)}}).sort(function(e,t){return e.value-t.value})[0])?void 0:o.edge)?i:null,aa(aa({},t),{},lZ({},au,h))},getIsSticky:()=>!0,onDragEnter({self:e}){i({type:"is-dragging-over",closestEdge:ah(e.data)})},onDrag({self:e}){let t=ah(e.data);i(e=>"is-dragging-over"===e.type&&e.closestEdge===t?e:{type:"is-dragging-over",closestEdge:t})},onDragLeave(){i(ad)},onDrop(){i(ad)}}))}},[t]),(0,T.jsxs)(U.Z,{ref:n,spacing:1,style:{opacity:"is-dragging"===r.type?.5:"unset"},children:["is-dragging-over"===r.type&&"top"===r.closestEdge?(0,T.jsx)(lM,{}):null,e,"is-dragging-over"===r.type&&"bottom"===r.closestEdge?(0,T.jsx)(lM,{}):null]})}var am=n(5549),ag=n(30743),av=n(11682);function ab(e,t){let n=t.indexOf(e);if(0===n)return t;let r=[...t];return r.splice(n,1),r.splice(n-1,0,e),r}function ay(e,t){let n=t.indexOf(e);if(n===t.length-1)return t;let r=[...t];return r.splice(n,1),r.splice(n+1,0,e),r}let ax=(0,D.forwardRef)(function({onMoveUp:e,onMoveDown:t,onMoveLeft:n,onMoveRight:r,menuSx:i,...o},s){let[l,a]=(0,D.useState)(null),c=!!l;function u(e){a(null),e?.()}return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(K.Z,{...o,ref:s,"aria-label":"move","aria-haspopup":!0,"aria-expanded":c,size:"small",onClick:function(e){a(e.currentTarget)},children:(0,T.jsx)(av.default,{})}),(e||t||n||r)&&(0,T.jsxs)(am.Z,{id:"drag-button-menu",MenuListProps:{"aria-labelledby":"drag-button-menu"},anchorEl:l,open:c,onClose:()=>u(void 0),sx:i,children:[e&&(0,T.jsx)(ag.Z,{onClick:()=>u(e),children:"Move Up"}),t&&(0,T.jsx)(ag.Z,{onClick:()=>u(t),children:"Move Down"}),n&&(0,T.jsx)(ag.Z,{onClick:()=>u(n),children:"Move Left"}),r&&(0,T.jsx)(ag.Z,{onClick:()=>u(r),children:"Move Right"}),r&&(0,T.jsx)(ag.Z,{onClick:()=>u(r),children:"Move Right"})]})]})});var aw=n(76439),aC=n(6595),aS=n(80058),ak=n(41825),aM=n(94680),aT=n(77999),aD=n(42777),aA=n(24255);function aR(e,t,n){let r=function(e,t,n){let r,i=t.getBoundingClientRect(),o=n&&n.getBoundingClientRect(),s=(0,aA.Z)(t);if(t.fakeTransform)r=t.fakeTransform;else{let e=s.getComputedStyle(t);r=e.getPropertyValue("-webkit-transform")||e.getPropertyValue("transform")}let l=0,a=0;if(r&&"none"!==r&&"string"==typeof r){let e=r.split("(")[1].split(")")[0].split(",");l=parseInt(e[4],10),a=parseInt(e[5],10)}return"left"===e?o?`translateX(${o.right+l-i.left}px)`:`translateX(${s.innerWidth+l-i.left}px)`:"right"===e?o?`translateX(-${i.right-o.left-l}px)`:`translateX(-${i.left+i.width-l}px)`:"up"===e?o?`translateY(${o.bottom+a-i.top}px)`:`translateY(${s.innerHeight+a-i.top}px)`:o?`translateY(-${i.top-o.top+i.height-a}px)`:`translateY(-${i.top+i.height-a}px)`}(e,t,"function"==typeof n?n():n);r&&(t.style.webkitTransform=r,t.style.transform=r)}let aP=D.forwardRef(function(e,t){let n=(0,nu.Z)(),r={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},i={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:o,appear:s=!0,children:l,container:a,direction:c="down",easing:u=r,in:h,onEnter:d,onEntered:f,onEntering:p,onExit:m,onExited:g,onExiting:v,style:b,timeout:y=i,TransitionComponent:x=ak.ZP,...w}=e,C=D.useRef(null),S=(0,ov.Z)((0,aM.Z)(l),C,t),k=e=>t=>{e&&(void 0===t?e(C.current):e(C.current,t))},M=k((e,t)=>{aR(c,e,a),(0,aD.n)(e),d&&d(e,t)}),A=k((e,t)=>{let r=(0,aD.C)({timeout:y,style:b,easing:u},{mode:"enter"});e.style.webkitTransition=n.transitions.create("-webkit-transform",{...r}),e.style.transition=n.transitions.create("transform",{...r}),e.style.webkitTransform="none",e.style.transform="none",p&&p(e,t)}),R=k(f),P=k(v),O=k(e=>{let t=(0,aD.C)({timeout:y,style:b,easing:u},{mode:"exit"});e.style.webkitTransition=n.transitions.create("-webkit-transform",t),e.style.transition=n.transitions.create("transform",t),aR(c,e,a),m&&m(e)}),I=k(e=>{e.style.webkitTransition="",e.style.transition="",g&&g(e)}),E=D.useCallback(()=>{C.current&&aR(c,C.current,a)},[c,a]);return D.useEffect(()=>{if(h||"down"===c||"right"===c)return;let e=(0,aT.Z)(()=>{C.current&&aR(c,C.current,a)}),t=(0,aA.Z)(C.current);return t.addEventListener("resize",e),()=>{e.clear(),t.removeEventListener("resize",e)}},[c,h,a]),D.useEffect(()=>{h||E()},[h,E]),(0,T.jsx)(x,{nodeRef:C,onEnter:M,onEntered:R,onEntering:A,onExit:O,onExited:I,onExiting:P,addEndListener:e=>{o&&o(C.current,e)},appear:s,in:h,timeout:y,...w,children:(e,{ownerState:t,...n})=>D.cloneElement(l,{ref:S,style:{visibility:"exited"!==e||h?void 0:"hidden",...b,...l.props.style},...n})})});var aO=n(28866);function aI(e){return(0,V.ZP)("MuiDrawer",e)}(0,F.Z)("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);var aE=n(27834);let aZ=(e,t)=>{let{ownerState:n}=e;return[t.root,("permanent"===n.variant||"persistent"===n.variant)&&t.docked,t.modal]},aL=(0,Z.ZP)(aS.Z,{name:"MuiDrawer",slot:"Root",overridesResolver:aZ})((0,L.Z)(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),aj=(0,Z.ZP)("div",{shouldForwardProp:op.Z,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:aZ})({flex:"0 0 auto"}),aB=(0,Z.ZP)(aO.Z,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`paperAnchor${(0,E.Z)(n.anchor)}`],"temporary"!==n.variant&&t[`paperAnchorDocked${(0,E.Z)(n.anchor)}`]]}})((0,L.Z)(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:e})=>"left"===e.anchor&&"temporary"!==e.variant,style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>"top"===e.anchor&&"temporary"!==e.variant,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>"right"===e.anchor&&"temporary"!==e.variant,style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>"bottom"===e.anchor&&"temporary"!==e.variant,style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),aF={left:"right",right:"left",top:"down",bottom:"up"},aV=D.forwardRef(function(e,t){let n=(0,B.i)({props:e,name:"MuiDrawer"}),r=(0,nu.Z)(),i=(0,aC.V)(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{anchor:s="left",BackdropProps:l,children:a,className:c,elevation:u=16,hideBackdrop:h=!1,ModalProps:{BackdropProps:d,...f}={},onClose:p,open:m=!1,PaperProps:g={},SlideProps:v,TransitionComponent:b,transitionDuration:y=o,variant:x="temporary",slots:w={},slotProps:C={},...S}=n,k=D.useRef(!1);D.useEffect(()=>{k.current=!0},[]);let M=function({direction:e},t){return"rtl"===e&&["left","right"].includes(t)?aF[t]:t}({direction:i?"rtl":"ltr"},s),A={...n,anchor:s,elevation:u,open:m,variant:x,...S},O=(e=>{let{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${(0,E.Z)(n)}`],docked:[("permanent"===r||"persistent"===r)&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${(0,E.Z)(n)}`,"temporary"!==r&&`paperAnchorDocked${(0,E.Z)(n)}`]};return(0,P.Z)(i,aI,t)})(A),I={slots:{transition:b,...w},slotProps:{paper:g,transition:v,...C,backdrop:(0,aE.Z)(C.backdrop||{...l,...d},{transitionDuration:y})}},[Z,L]=(0,sC.Z)("root",{ref:t,elementType:aL,className:(0,R.Z)(O.root,O.modal,c),shouldForwardComponentProp:!0,ownerState:A,externalForwardedProps:{...I,...S,...f},additionalProps:{open:m,onClose:p,hideBackdrop:h,slots:{backdrop:I.slots.backdrop},slotProps:{backdrop:I.slotProps.backdrop}}}),[j,F]=(0,sC.Z)("paper",{elementType:aB,shouldForwardComponentProp:!0,className:(0,R.Z)(O.paper,g.className),ownerState:A,externalForwardedProps:I,additionalProps:{elevation:"temporary"===x?u:0,square:!0}}),[V,N]=(0,sC.Z)("docked",{elementType:aj,ref:t,className:(0,R.Z)(O.root,O.docked,c),ownerState:A,externalForwardedProps:I,additionalProps:S}),[H,z]=(0,sC.Z)("transition",{elementType:aP,ownerState:A,externalForwardedProps:I,additionalProps:{in:m,direction:aF[M],timeout:y,appear:k.current}}),$=(0,T.jsx)(j,{...F,children:a});if("permanent"===x)return(0,T.jsx)(V,{...N,children:$});let W=(0,T.jsx)(H,{...z,children:$});return"persistent"===x?(0,T.jsx)(V,{...N,children:W}):(0,T.jsx)(Z,{...L,children:W})}),aN=({anchor:e="right",isOpen:t,onClose:n,PaperProps:r,children:i,...o})=>{let s=(0,aw.Z)("(max-width:1080px)");return(0,T.jsx)(aV,{...o,open:t,onClose:n,anchor:e,PaperProps:{...r,sx:t6({width:s?"100%":"1080px",overflow:"hidden"},r?.sx)},children:i})};var aH=n(36232),az=n(59161),a$=n(56141),aW=n.n(a$),a_=n(508),aq=n(44811),aG=n(78846),aU=n(85731),aK=n(8890),aY=n(35246),aX=n(27835),aQ=n(99635),aJ=n(48906),a0=n(27806),a1=n(65201),a2=n(23709),a5=n(55328),a3=n(67745),a8=n(943),a4=n(98857),a6=n(219),a9=n(17846),a7=n(50378);(0,aH.D)([aQ.N,aJ.N,a0.N,a_.N,aq.N,aG.N,aU.N,aK.N,aY.N,aX.N,a1.N,a2.N,a5.N,a3.N,a7.N,a8.N,a4.N,a6.N,a9.N]);let ce=["click","dblclick","mousedown","mousemove","mouseup","mouseover","mouseout","globalout","contextmenu"],ct=["datazoom","downplay","highlight"],cn=(0,D.memo)(function({option:e,theme:t,renderer:n,sx:r,style:i,onEvents:o,_instance:s,syncGroup:l,onChartInitialized:a}){let c=(0,D.useRef)(e),u=(0,D.useRef)(e),h=(0,D.useRef)(null),d=(0,D.useRef)(null);return(0,D.useLayoutEffect)(()=>{if(null!==h.current&&null===d.current&&(d.current=(0,az.S1)(h.current,t,{renderer:n??"canvas"}),void 0!==d.current))return d.current.setOption(c.current,!0),a?.(d.current),void 0!==s&&(s.current=d.current),()=>{null!==d.current&&(d.current.dispose(),d.current=null)}},[s,a,t,n]),(0,D.useEffect)(()=>{d.current&&l&&(d.current.group=l,(0,az.$j)([d.current]))},[l,d]),(0,D.useEffect)(()=>{!(void 0===u.current||aW()(u.current,e))&&d.current&&(d.current.setOption(e,!0),u.current=e)},[e]),(0,D.useLayoutEffect)(()=>{let e=s4()(()=>{d.current&&d.current.resize()},200);return window.addEventListener("resize",e),e(),()=>{window.removeEventListener("resize",e)}},[]),(0,D.useEffect)(()=>{let e=d.current;if(e&&void 0!==o)return function(e,t){if(void 0!==t){for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let r=t[n]??null;r&&function(t,n){var r,i;"function"==typeof n&&((r=t,ce.includes(r))?e.on(t,t=>n(t,e)):(i=t,ct.includes(i))?e.on(t,e=>n(e)):e.on(t,()=>n(null,e)))}(n,r)}}}(e,o),()=>{if(void 0!==e&&!0!==e.isDisposed())for(let t in o)e.off(t)}},[o]),(0,D.useEffect)(()=>{s4()(()=>{d.current&&d.current.resize()},200,{leading:!0})()},[r,i]),(0,T.jsx)(nh.Z,{ref:h,sx:r,style:i})});var cr=n(315);function ci(e){let{error:t}=e;return(0,T.jsx)(cr.Z,{severity:"error",children:t.message})}var co=n(68715);let cs=[{id:"default",label:"Default",value:void 0},{id:"12",label:"12",value:12},{id:"14",label:"14",value:14},{id:"16",label:"16",value:16},{id:"20",label:"20",value:20},{id:"24",label:"24",value:24},{id:"28",label:"28",value:28},{id:"32",label:"32",value:32},{id:"36",label:"36",value:36},{id:"40",label:"40",value:40},{id:"48",label:"48",value:48},{id:"56",label:"56",value:56},{id:"64",label:"64",value:64},{id:"72",label:"72",value:72},{id:"96",label:"96",value:96},{id:"128",label:"128",value:128},{id:"160",label:"160",value:160},{id:"192",label:"192",value:192}];function cl({value:e,onChange:t}){return(0,T.jsx)(lv,{label:"Font Size",control:(0,T.jsx)(lC,{value:cs.find(t=>t.value===e),options:cs,getOptionLabel:e=>e.label,onChange:(e,{value:n})=>{t(n)},disableClearable:!0})})}var ca=n(79119);function cc({action:e,submitText:t="Save",cancelText:n="Cancel",isReadonly:r,isValid:i,onActionChange:o,onSubmit:s,onDelete:l,onCancel:a,...c}){return(0,T.jsx)(U.Z,{direction:"row",gap:1,sx:{marginLeft:"auto"},...c,children:"read"===e?(0,T.jsxs)(T.Fragment,{children:[o&&(0,T.jsx)(q.Z,{disabled:r,variant:"contained",onClick:()=>o("update"),children:"Edit"}),l&&(0,T.jsx)(q.Z,{color:"error",disabled:r,variant:"outlined",onClick:l,children:"Delete"}),a&&(s||l)&&(0,T.jsx)(ca.Z,{orientation:"vertical",flexItem:!0,sx:{borderColor:e=>e.palette.grey["500"],"&.MuiDivider-root":{marginLeft:2,marginRight:1}}}),a&&(0,T.jsx)(q.Z,{color:"secondary",variant:"outlined",onClick:a,children:n})]}):(0,T.jsxs)(T.Fragment,{children:[s&&(0,T.jsx)(q.Z,{variant:"contained",disabled:!i,onClick:s,children:t}),a&&(0,T.jsx)(q.Z,{color:"secondary",variant:"outlined",onClick:a,children:n})]})})}var cu=n(70252),ch=n(97784);let cd=[],cf=[],cp="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<cp.length;e++)(e%2?cf:cd).push(t+=cp[e]);function cm(e){return e>=127462&&e<=127487}function cg(e,t,n){if(t==e.length)return t;t&&cb(e.charCodeAt(t))&&cy(e.charCodeAt(t-1))&&t--;let r=cv(e,t);for(t+=cx(r);t<e.length;){let i=cv(e,t);if(8205==r||8205==i||n&&function(e){if(e<768)return!1;for(let t=0,n=cd.length;;){let r=t+n>>1;if(e<cd[r])n=r;else{if(!(e>=cf[r]))return!0;t=r+1}if(t==n)return!1}}(i))t+=cx(i),r=i;else if(cm(i)){let n=0,r=t-2;for(;r>=0&&cm(cv(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function cv(e,t){let n=e.charCodeAt(t);if(!cy(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return cb(r)?(n-55296<<10)+(r-56320)+65536:n}function cb(e){return e>=56320&&e<57344}function cy(e){return e>=55296&&e<56320}function cx(e){return e<65536?1:2}class cw{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=cR(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),cS.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=cR(this,e,t);let n=[];return this.decompose(e,t,n,0),cS.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new cM(this),i=new cM(e);for(let e=t,o=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(o+=r.value.length,r.done||o>=n)return!0}}iter(e=1){return new cM(this,e)}iterRange(e,t=this.length){return new cT(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new cD(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new cC(e):cS.from(cC.split(e,[])):cw.empty}}class cC extends cw{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.text[i],s=r+o.length;if((t?n:s)>=e)return new cA(r,s,n,o);r=s+1,n++}}decompose(e,t,n,r){var i;let o=e<=0&&t>=this.length?this:new cC((i=this.text,ck(i,[""],e,t)),Math.min(t,this.length)-Math.max(0,e));if(1&r){let e=n.pop(),t=ck(o.text,e.text.slice(),0,o.length);if(t.length<=32)n.push(new cC(t,e.length+o.length));else{let e=t.length>>1;n.push(new cC(t.slice(0,e)),new cC(t.slice(e)))}}else n.push(o)}replace(e,t,n){var r;if(!(n instanceof cC))return super.replace(e,t,n);[e,t]=cR(this,e,t);let i=ck(this.text,ck(n.text,(r=this.text,ck(r,[""],0,e))),t),o=this.length+n.length-(t-e);return i.length<=32?new cC(i,o):cS.from(cC.split(i,[]),o)}sliceString(e,t=this.length,n="\n"){[e,t]=cR(this,e,t);let r="";for(let i=0,o=0;i<=t&&o<this.text.length;o++){let s=this.text[o],l=i+s.length;i>e&&o&&(r+=n),e<l&&t>i&&(r+=s.slice(Math.max(0,e-i),t-i)),i=l+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let i of e)n.push(i),r+=i.length+1,32==n.length&&(t.push(new cC(n,r)),n=[],r=-1);return r>-1&&t.push(new cC(n,r)),t}}class cS extends cw{constructor(e,t){for(let n of(super(),this.children=e,this.length=t,this.lines=0,e))this.lines+=n.lines}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.children[i],s=r+o.length,l=n+o.lines-1;if((t?l:s)>=e)return o.lineInner(e,t,n,r);r=s+1,n=l+1}}decompose(e,t,n,r){for(let i=0,o=0;o<=t&&i<this.children.length;i++){let s=this.children[i],l=o+s.length;if(e<=l&&t>=o){let i=r&(o<=e|2*(l>=t));o>=e&&l<=t&&!i?n.push(s):s.decompose(e-o,t-o,n,i)}o=l+1}}replace(e,t,n){if([e,t]=cR(this,e,t),n.lines<this.lines)for(let r=0,i=0;r<this.children.length;r++){let o=this.children[r],s=i+o.length;if(e>=i&&t<=s){let l=o.replace(e-i,t-i,n),a=this.lines-o.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let i=this.children.slice();return i[r]=l,new cS(i,this.length-(t-e)+n.length)}return super.replace(i,s,l)}i=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=cR(this,e,t);let r="";for(let i=0,o=0;i<this.children.length&&o<=t;i++){let s=this.children[i],l=o+s.length;o>e&&i&&(r+=n),e<l&&t>o&&(r+=s.sliceString(e-o,t-o,n)),o=l+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof cS))return 0;let n=0,[r,i,o,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,i+=t){if(r==o||i==s)return n;let l=this.children[r],a=e.children[i];if(l!=a)return n+l.scanIdentical(a,t);n+=l.length+1}}static from(e,t=e.reduce((e,t)=>e+t.length+1,-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new cC(n,t)}let r=Math.max(32,n>>5),i=r<<1,o=r>>1,s=[],l=0,a=-1,c=[];function u(){0!=l&&(s.push(1==c.length?c[0]:cS.from(c,a)),a=-1,l=c.length=0)}for(let t of e)!function e(t){let n;if(t.lines>i&&t instanceof cS)for(let n of t.children)e(n);else t.lines>o&&(l>o||!l)?(u(),s.push(t)):t instanceof cC&&l&&(n=c[c.length-1])instanceof cC&&t.lines+n.lines<=32?(l+=t.lines,a+=t.length+1,c[c.length-1]=new cC(n.text.concat(t.text),n.length+1+t.length)):(l+t.lines>r&&u(),l+=t.lines,a+=t.length+1,c.push(t))}(t);return u(),1==s.length?s[0]:new cS(s,t)}}function ck(e,t,n=0,r=1e9){for(let i=0,o=0,s=!0;o<e.length&&i<=r;o++){let l=e[o],a=i+l.length;a>=n&&(a>r&&(l=l.slice(0,r-i)),i<n&&(l=l.slice(n-i)),s?(t[t.length-1]+=l,s=!1):t.push(l)),i=a+1}return t}cw.empty=new cC([""],0);class cM{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof cC?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],o=i>>1,s=r instanceof cC?r.text.length:r.children.length;if(o==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&i)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(r instanceof cC){let i=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=0==e?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[o+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof cC?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class cT{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new cM(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class cD{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(cw.prototype[Symbol.iterator]=function(){return this.iter()},cM.prototype[Symbol.iterator]=cT.prototype[Symbol.iterator]=cD.prototype[Symbol.iterator]=function(){return this});class cA{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}}function cR(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function cP(e,t,n=!0,r=!0){return function(e,t,n=!0,r=!0){return(n?cg:function(e,t,n){for(;t>0;){let r=cg(e,t-2,n);if(r<t)return r;t--}return 0})(e,t,r)}(e,t,n,r)}function cO(e,t){let n=e.charCodeAt(t);if(!(n>=55296&&n<56320)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return r>=56320&&r<57344?(n-55296<<10)+(r-56320)+65536:n}function cI(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(((e-=65536)>>10)+55296,(1023&e)+56320)}function cE(e){return e<65536?1:2}let cZ=/\r\n?|\n/;var cL=((d=cL||(cL={}))[d.Simple=0]="Simple",d[d.TrackDel=1]="TrackDel",d[d.TrackBefore=2]="TrackBefore",d[d.TrackAfter=3]="TrackAfter",d);class cj{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],o=this.sections[t++];o<0?(e(n,r,i),r+=i):r+=o,n+=i}}iterChangedRanges(e,t=!1){cN(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];r<0?e.push(n,r):e.push(r,n)}return new cj(e)}composeDesc(e){return this.empty?e:e.empty?this:cz(this,e)}mapDesc(e,t=!1){return e.empty?this:cH(this,e,t)}mapPos(e,t=-1,n=cL.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],l=this.sections[o++],a=r+s;if(l<0){if(a>e)return i+(e-r);i+=s}else{if(n!=cL.Simple&&a>=e&&(n==cL.TrackDel&&r<e&&a>e||n==cL.TrackBefore&&r<e||n==cL.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!s)return e==r||t<0?i:i+l;i+=l}r=a}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],o=this.sections[n++],s=r+i;if(o>=0&&r<=t&&s>=e)return!(r<e)||!(s>t)||"cover";r=s}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw RangeError("Invalid JSON representation of ChangeDesc");return new cj(e)}static create(e){return new cj(e)}}class cB extends cj{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError("Applying change set to a document with the wrong length");return cN(this,(t,n,r,i,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return cH(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,i=0;r<t.length;r+=2){let o=t[r],s=t[r+1];if(s>=0){t[r]=s,t[r+1]=o;let l=r>>1;for(;n.length<l;)n.push(cw.empty);n.push(o?e.slice(i,i+o):cw.empty)}i+=o}return new cB(t,n)}compose(e){return this.empty?e:e.empty?this:cz(this,e,!0)}map(e,t=!1){return e.empty?this:cH(this,e,t,!0)}iterChanges(e,t=!1){cN(this,e,t)}get desc(){return cj.create(this.sections)}filter(e){let t=[],n=[],r=[],i=new c$(this);e:for(let o=0,s=0;;){let l=o==e.length?1e9:e[o++];for(;s<l||s==l&&0==i.len;){if(i.done)break e;let e=Math.min(i.len,l-s);cF(r,e,-1);let o=-1==i.ins?-1:0==i.off?i.ins:0;cF(t,e,o),o>0&&cV(n,t,i.text),i.forward(e),s+=e}let a=e[o++];for(;s<a;){if(i.done)break e;let e=Math.min(i.len,a-s);cF(t,e,-1),cF(r,e,-1==i.ins?-1:0==i.off?i.ins:0),i.forward(e),s+=e}}return{changes:new cB(t,n),filtered:cj.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):0==r?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let r=[],i=[],o=0,s=null;function l(e=!1){if(!e&&!r.length)return;o<t&&cF(r,t-o,-1);let n=new cB(r,i);s=s?s.compose(n.map(s)):n,r=[],i=[],o=0}return!function e(a){if(Array.isArray(a))for(let t of a)e(t);else if(a instanceof cB){if(a.length!=t)throw RangeError(`Mismatched change set length (got ${a.length}, expected ${t})`);l(),s=s?s.compose(a.map(s)):a}else{let{from:e,to:s=e,insert:c}=a;if(e>s||e<0||s>t)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let u=c?"string"==typeof c?cw.of(c.split(n||cZ)):c:cw.empty,h=u.length;if(e==s&&0==h)return;e<o&&l(),e>o&&cF(r,e-o,-1),cF(r,s-e,h),cV(i,r,u),o=s}}(e),l(!s),s}static empty(e){return new cB(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if("number"==typeof i)t.push(i,-1);else if(!Array.isArray(i)||"number"!=typeof i[0]||i.some((e,t)=>t&&"string"!=typeof e))throw RangeError("Invalid JSON representation of ChangeSet");else if(1==i.length)t.push(i[0],0);else{for(;n.length<r;)n.push(cw.empty);n[r]=cw.of(i.slice(1)),t.push(i[0],n[r].length)}}return new cB(t,n)}static createSet(e,t){return new cB(e,t)}}function cF(e,t,n,r=!1){if(0==t&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&0==t&&0==e[i]?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function cV(e,t,n){if(0==n.length)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(cw.empty);e.push(n)}}function cN(e,t,n){let r=e.inserted;for(let i=0,o=0,s=0;s<e.sections.length;){let l=e.sections[s++],a=e.sections[s++];if(a<0)i+=l,o+=l;else{let c=i,u=o,h=cw.empty;for(;c+=l,u+=a,a&&r&&(h=h.append(r[s-2>>1])),!n&&s!=e.sections.length&&!(e.sections[s+1]<0);)l=e.sections[s++],a=e.sections[s++];t(i,c,o,u,h),i=c,o=u}}}function cH(e,t,n,r=!1){let i=[],o=r?[]:null,s=new c$(e),l=new c$(t);for(let e=-1;;)if(s.done&&l.len||l.done&&s.len)throw Error("Mismatched change set lengths");else if(-1==s.ins&&-1==l.ins){let e=Math.min(s.len,l.len);cF(i,e,-1),s.forward(e),l.forward(e)}else if(l.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(l.len<s.len||l.len==s.len&&!n))){let t=l.len;for(cF(i,l.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(cF(i,0,s.ins),o&&cV(o,i,s.text),e=s.i),s.forward(n),t-=n}l.next()}else if(s.ins>=0){let t=0,n=s.len;for(;n;)if(-1==l.ins){let e=Math.min(n,l.len);t+=e,n-=e,l.forward(e)}else if(0==l.ins&&l.len<n)n-=l.len,l.next();else break;cF(i,t,e<s.i?s.ins:0),o&&e<s.i&&cV(o,i,s.text),e=s.i,s.forward(s.len-n)}else if(s.done&&l.done)return o?cB.createSet(i,o):cj.create(i);else throw Error("Mismatched change set lengths")}function cz(e,t,n=!1){let r=[],i=n?[]:null,o=new c$(e),s=new c$(t);for(let e=!1;;)if(o.done&&s.done)return i?cB.createSet(r,i):cj.create(r);else if(0==o.ins)cF(r,o.len,0,e),o.next();else if(0!=s.len||s.done)if(o.done||s.done)throw Error("Mismatched change set lengths");else{let t=Math.min(o.len2,s.len),n=r.length;if(-1==o.ins){let n=-1==s.ins?-1:s.off?0:s.ins;cF(r,t,n,e),i&&n&&cV(i,r,s.text)}else -1==s.ins?(cF(r,o.off?0:o.len,t,e),i&&cV(i,r,o.textBit(t))):(cF(r,o.off?0:o.len,s.off?0:s.ins,e),i&&!s.off&&cV(i,r,s.text));e=(o.ins>t||s.ins>=0&&s.len>t)&&(e||r.length>n),o.forward2(t),s.forward(t)}else cF(r,0,s.ins,e),i&&cV(i,r,s.text),s.next()}class c${constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return -2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?cw.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?cw.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class cW{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 0xffffff==e?void 0:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new cW(n,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return c_.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return c_.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw RangeError("Invalid JSON representation for SelectionRange");return c_.range(e.anchor,e.head)}static create(e,t,n){return new cW(e,t,n)}}class c_{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:c_.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new c_([this.main],0)}addRange(e,t=!0){return c_.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,c_.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw RangeError("Invalid JSON representation for EditorSelection");return new c_(e.ranges.map(e=>cW.fromJSON(e)),e.main)}static single(e,t=e){return new c_([c_.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let i=e[r];if(i.empty?i.from<=n:i.from<n)return c_.normalized(e.slice(),t);n=i.to}return new c_(e,t)}static cursor(e,t=0,n,r){return cW.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=r?r:0xffffff)<<6)}static range(e,t,n,r){let i=(null!=n?n:0xffffff)<<6|(null==r?7:Math.min(6,r));return t<e?cW.create(t,e,48|i):cW.create(e,t,8*(t>e)|i)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;n<e.length;n++){let r=e[n],i=e[n-1];if(r.empty?r.from<=i.to:r.from<i.to){let o=i.from,s=Math.max(r.to,i.to);n<=t&&t--,e.splice(--n,2,r.anchor>r.head?c_.range(s,o):c_.range(o,s))}}return new c_(e,t)}}function cq(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError("Selection points outside of document")}let cG=0;class cU{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=cG++,this.default=e([]),this.extensions="function"==typeof i?i(this):i}get reader(){return this}static define(e={}){return new cU(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(!e.combine?cK:(e,t)=>e===t),!!e.static,e.enables)}of(e){return new cY([],this,0,e)}compute(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new cY(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new cY(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function cK(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class cY{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=cG++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,i=this.id,o=e[i]>>1,s=2==this.type,l=!1,a=!1,c=[];for(let n of this.dependencies)"doc"==n?l=!0:"selection"==n?a=!0:((null!=(t=e[n.id])?t:1)&1)==0&&c.push(e[n.id]);return{create:e=>(e.values[o]=n(e),1),update(e,t){if(l&&t.docChanged||a&&(t.docChanged||t.selection)||cQ(e,c)){let t=n(e);if(s?!cX(t,e.values[o],r):!r(t,e.values[o]))return e.values[o]=t,1}return 0},reconfigure:(e,t)=>{let l,a=t.config.address[i];if(null!=a){let i=c9(t,a);if(this.dependencies.every(n=>n instanceof cU?t.facet(n)===e.facet(n):!(n instanceof c0)||t.field(n,!1)==e.field(n,!1))||(s?cX(l=n(e),i,r):r(l=n(e),i)))return e.values[o]=i,0}else l=n(e);return e.values[o]=l,1}}}}function cX(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function cQ(e,t){let n=!1;for(let r of t)1&c6(e,r)&&(n=!0);return n}let cJ=cU.define({static:!0});class c0{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(e){let t=new c0(cG++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(cJ).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(cJ),i=n.facet(cJ),o;return(o=r.find(e=>e.field==this))&&o!=i.find(e=>e.field==this)?(e.values[t]=o.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,cJ.of({field:this,create:e})]}get extension(){return this}}function c1(e){return t=>new c5(t,e)}let c2={highest:c1(0),high:c1(1),default:c1(2),low:c1(3),lowest:c1(4)};class c5{constructor(e,t){this.inner=e,this.prec=t}}class c3{of(e){return new c8(this,e)}reconfigure(e){return c3.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class c8{constructor(e,t){this.compartment=e,this.inner=t}}class c4{constructor(e,t,n,r,i,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){var r,i,o;let s,l,a=[],c=Object.create(null),u=new Map;for(let n of(r=e,i=t,o=u,s=[[],[],[],[],[]],l=new Map,!function e(t,n){let r=l.get(t);if(null!=r){if(r<=n)return;let e=s[r].indexOf(t);e>-1&&s[r].splice(e,1),t instanceof c8&&o.delete(t.compartment)}if(l.set(t,n),Array.isArray(t))for(let r of t)e(r,n);else if(t instanceof c8){if(o.has(t.compartment))throw RangeError("Duplicate use of compartment in extensions");let r=i.get(t.compartment)||t.inner;o.set(t.compartment,r),e(r,n)}else if(t instanceof c5)e(t.inner,t.prec);else if(t instanceof c0)s[n].push(t),t.provides&&e(t.provides,n);else if(t instanceof cY)s[n].push(t),t.facet.extensions&&e(t.facet.extensions,2);else{let r=t.extension;if(!r)throw Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(r,n)}}(r,2),s.reduce((e,t)=>e.concat(t))))n instanceof c0?a.push(n):(c[n.facet.id]||(c[n.facet.id]=[])).push(n);let h=Object.create(null),d=[],f=[];for(let e of a)h[e.id]=f.length<<1,f.push(t=>e.slot(t));let p=null==n?void 0:n.config.facets;for(let e in c){let t=c[e],r=t[0].facet,i=p&&p[e]||[];if(t.every(e=>0==e.type))if(h[r.id]=d.length<<1|1,cK(i,t))d.push(n.facet(r));else{let e=r.combine(t.map(e=>e.value));d.push(n&&r.compare(e,n.facet(r))?n.facet(r):e)}else{for(let e of t)0==e.type?(h[e.id]=d.length<<1|1,d.push(e.value)):(h[e.id]=f.length<<1,f.push(t=>e.dynamicSlot(t)));h[r.id]=f.length<<1,f.push(e=>(function(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),o=r.filter(e=>!(1&e)),s=e[t.id]>>1;function l(e){let n=[];for(let t=0;t<r.length;t++){let o=c9(e,r[t]);if(2==i[t])for(let e of o)n.push(e);else n.push(o)}return t.combine(n)}return{create(e){for(let t of r)c6(e,t);return e.values[s]=l(e),1},update(e,n){if(!cQ(e,o))return 0;let r=l(e);return t.compare(r,e.values[s])?0:(e.values[s]=r,1)},reconfigure(e,i){let o=cQ(e,r),a=i.config.facets[t.id],c=i.facet(t);if(a&&!o&&cK(n,a))return e.values[s]=c,0;let u=l(e);return t.compare(u,c)?(e.values[s]=c,0):(e.values[s]=u,1)}}})(e,r,t))}}return new c4(e,u,f.map(e=>e(h)),h,d,c)}}function c6(e,t){if(1&t)return 2;let n=t>>1,r=e.status[n];if(4==r)throw Error("Cyclic dependency between fields and/or facets");if(2&r)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function c9(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}let c7=cU.define(),ue=cU.define({combine:e=>e.some(e=>e),static:!0}),ut=cU.define({combine:e=>e.length?e[0]:void 0,static:!0}),un=cU.define(),ur=cU.define(),ui=cU.define(),uo=cU.define({combine:e=>!!e.length&&e[0]});class us{constructor(e,t){this.type=e,this.value=t}static define(){return new ul}}class ul{of(e){return new us(this,e)}}class ua{constructor(e){this.map=e}of(e){return new uc(this,e)}}class uc{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new uc(this.type,t)}is(e){return this.type==e}static define(e={}){return new ua(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}}uc.reconfigure=uc.define(),uc.appendConfig=uc.define();class uu{constructor(e,t,n,r,i,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,n&&cq(n,t.newLength),i.some(e=>e.type==uu.time)||(this.annotations=i.concat(uu.time.of(Date.now())))}static create(e,t,n,r,i,o){return new uu(e,t,n,r,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(uu.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function uh(e,t,n){var r;let i,o,s;return n?(i=t.changes,o=cB.empty(t.changes.length),s=e.changes.compose(t.changes)):(i=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(i)),{changes:s,selection:t.selection?t.selection.map(o):null==(r=e.selection)?void 0:r.map(i),effects:uc.mapEffects(e.effects,i).concat(uc.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function ud(e,t,n){let r=t.selection,i=up(t.annotations);return t.userEvent&&(i=i.concat(uu.userEvent.of(t.userEvent))),{changes:t.changes instanceof cB?t.changes:cB.of(t.changes||[],n,e.facet(ut)),selection:r&&(r instanceof c_?r:c_.single(r.anchor,r.head)),effects:up(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}uu.time=us.define(),uu.userEvent=us.define(),uu.addToHistory=us.define(),uu.remote=us.define();let uf=[];function up(e){return null==e?uf:Array.isArray(e)?e:[e]}var um=((f=um||(um={}))[f.Word=0]="Word",f[f.Space=1]="Space",f[f.Other=2]="Other",f);let ug=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{r=RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class uv{constructor(e,t,n,r,i,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)c6(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null==n){if(t)throw RangeError("Field is not present in this state");return}return c6(this,n),c9(this,n)}update(...e){return function e(t,n,r){let i=ud(t,n.length?n[0]:{},t.doc.length);n.length&&!1===n[0].filter&&(r=!1);for(let e=1;e<n.length;e++){!1===n[e].filter&&(r=!1);let o=!!n[e].sequential;i=uh(i,ud(t,n[e],o?i.changes.newLength:t.doc.length),o)}let o=uu.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,n=t.facet(ui),r=e;for(let i=n.length-1;i>=0;i--){let o=n[i](e);o&&Object.keys(o).length&&(r=uh(r,ud(t,o,e.changes.newLength),!0))}return r==e?e:uu.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}(r?function(t){let n=t.startState,r=!0;for(let e of n.facet(un)){let n=e(t);if(!1===n){r=!1;break}Array.isArray(n)&&(r=!0===r?n:function(e,t){let n=[];for(let r=0,i=0;;){let o,s;if(r<e.length&&(i==t.length||t[i]>=e[r]))o=e[r++],s=e[r++];else{if(!(i<t.length))return n;o=t[i++],s=t[i++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}(r,n))}if(!0!==r){let e,i;if(!1===r)i=t.changes.invertedDesc,e=cB.empty(n.doc.length);else{let n=t.changes.filter(r);e=n.changes,i=n.filtered.mapDesc(n.changes).invertedDesc}t=uu.create(n,e,t.selection&&t.selection.map(i),uc.mapEffects(t.effects,i),t.annotations,t.scrollIntoView)}let i=n.facet(ur);for(let r=i.length-1;r>=0;r--){let o=i[r](t);t=o instanceof uu?o:Array.isArray(o)&&1==o.length&&o[0]instanceof uu?o[0]:e(n,up(o),!1)}return t}(o):o)}(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:r,compartments:i}=n;for(let t of e.effects)t.is(c3.reconfigure)?(n&&(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),n=null),i.set(t.value.compartment,t.value.extension)):t.is(uc.reconfigure)?(n=null,r=t.value):t.is(uc.appendConfig)&&(n=null,r=up(r).concat(t.value));t=n?e.startState.values.slice():new uv(n=c4.resolve(r,i,this),this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values;let o=e.startState.facet(ue)?e.newSelection:e.newSelection.asSingle();new uv(n,e.newDoc,o,t,(t,n)=>n.update(t,e),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:c_.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],o=up(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),l=this.changes(s.changes),a=l.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(a);let c=r.mapDesc(l,!0);i.push(s.range.map(c)),r=r.compose(a),o=uc.mapEffects(o,a).concat(uc.mapEffects(up(s.effects),c))}return{changes:r,selection:c_.create(i,t.mainIndex),effects:o}}changes(e=[]){return e instanceof cB?e:cB.of(e,this.doc.length,this.facet(uv.lineSeparator))}toText(e){return cw.of(e.split(this.facet(uv.lineSeparator)||cZ))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(c6(this,t),c9(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof c0&&null!=this.config.address[r.id]&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw RangeError("Invalid JSON representation for EditorState");let r=[];if(n){for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let i=n[t],o=e[t];r.push(i.init(e=>i.spec.fromJSON(o,e)))}}return uv.create({doc:e.doc,selection:c_.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=c4.resolve(e.extensions||[],new Map),n=e.doc instanceof cw?e.doc:cw.of((e.doc||"").split(t.staticFacet(uv.lineSeparator)||cZ)),r=e.selection?e.selection instanceof c_?e.selection:c_.single(e.selection.anchor,e.selection.head):c_.single(0);return cq(r,n.length),t.staticFacet(ue)||(r=r.asSingle()),new uv(t,n,r,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(uv.tabSize)}get lineBreak(){return this.facet(uv.lineSeparator)||"\n"}get readOnly(){return this.facet(uo)}phrase(e,...t){for(let t of this.facet(uv.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(e,n)=>{if("$"==n)return"$";let r=+(n||1);return!r||r>t.length?e:t[r-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(c7))for(let o of i(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){var t;return t=this.languageDataAt("wordChars",e).join(""),e=>{if(!/\S/.test(e))return um.Space;if(function(e){if(r)return r.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>"\x80"&&(n.toUpperCase()!=n.toLowerCase()||ug.test(n)))return!0}return!1}(e))return um.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return um.Word;return um.Other}}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),o=e-n,s=e-n;for(;o>0;){let e=cP(t,o,!1);if(i(t.slice(e,o))!=um.Word)break;o=e}for(;s<r;){let e=cP(t,s);if(i(t.slice(s,e))!=um.Word)break;s=e}return o==s?null:c_.range(o+n,s+n)}}function ub(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],o=r[e];if(void 0===o)r[e]=i;else if(o===i||void 0===i);else if(Object.hasOwnProperty.call(n,e))r[e]=n[e](o,i);else throw Error("Config merge conflict for field "+e)}for(let e in t)void 0===r[e]&&(r[e]=t[e]);return r}uv.allowMultipleSelections=ue,uv.tabSize=cU.define({combine:e=>e.length?e[0]:4}),uv.lineSeparator=ut,uv.readOnly=uo,uv.phrases=cU.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),uv.languageData=c7,uv.changeFilter=un,uv.transactionFilter=ur,uv.transactionExtender=ui,c3.reconfigure=uc.define();class uy{eq(e){return this==e}range(e,t=e){return ux.create(e,t,this)}}uy.prototype.startSide=uy.prototype.endSide=0,uy.prototype.point=!1,uy.prototype.mapMode=cL.TrackDel;class ux{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new ux(e,t,n)}}function uw(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class uC{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let o=r,s=i.length;;){if(o==s)return o;let r=o+s>>1,l=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==o)return l>=0?o:s;l>=0?s=r:o=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,i);i<o;i++)if(!1===r(this.from[i]+e,this.to[i]+e,this.value[i]))return!1}map(e,t){let n=[],r=[],i=[],o=-1,s=-1;for(let l=0;l<this.value.length;l++){let a=this.value[l],c=this.from[l]+e,u=this.to[l]+e,h,d;if(c==u){let e=t.mapPos(c,a.startSide,a.mapMode);if(null==e||(h=d=e,a.startSide!=a.endSide&&(d=t.mapPos(c,a.endSide))<h))continue}else if((h=t.mapPos(c,a.startSide))>(d=t.mapPos(u,a.endSide))||h==d&&a.startSide>0&&a.endSide<=0)continue;0>(d-h||a.endSide-a.startSide)||(o<0&&(o=h),a.point&&(s=Math.max(s,d-h)),n.push(a),r.push(h-o),i.push(d-o))}return{mapped:n.length?new uC(r,i,n,s):null,pos:o}}}class uS{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new uS(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:i=this.length}=e,o=e.filter;if(0==t.length&&!o)return this;if(n&&(t=t.slice().sort(uw)),this.isEmpty)return t.length?uS.of(t):this;let s=new uT(this,null,-1).goto(0),l=0,a=[],c=new uk;for(;s.value||l<t.length;)if(l<t.length&&(s.from-t[l].from||s.startSide-t[l].value.startSide)>=0){let e=t[l++];c.addInner(e.from,e.to,e.value)||a.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(s.chunkIndex)<t[l].from)&&(!o||r>this.chunkEnd(s.chunkIndex)||i<this.chunkPos[s.chunkIndex])&&c.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||r>s.to||i<s.from||o(s.from,s.to,s.value))&&!c.addInner(s.from,s.to,s.value)&&a.push(ux.create(s.from,s.to,s.value)),s.next());return c.finishInner(this.nextLayer.isEmpty&&!a.length?uS.empty:this.nextLayer.update({add:a,filter:o,filterFrom:r,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1;for(let i=0;i<this.chunk.length;i++){let o=this.chunkPos[i],s=this.chunk[i],l=e.touchesRange(o,o+s.length);if(!1===l)r=Math.max(r,s.maxPoint),t.push(s),n.push(e.mapPos(o));else if(!0===l){let{mapped:i,pos:l}=s.map(o,e);i&&(r=Math.max(r,i.maxPoint),t.push(i),n.push(l))}}let i=this.nextLayer.map(e);return 0==t.length?i:new uS(n,t,i||uS.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],o=this.chunk[r];if(t>=i&&e<=i+o.length&&!1===o.between(i,e-i,t-i,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return uD.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return uD.from(e).goto(t)}static compare(e,t,n,r,i=-1){let o=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),l=uM(o,s,n),a=new uR(o,l,i),c=new uR(s,l,i);n.iterGaps((e,t,n)=>uP(a,e,c,t,n,r)),n.empty&&0==n.length&&uP(a,0,c,0,0,r)}static eq(e,t,n=0,r){null==r&&(r=0x3b9ac9ff);let i=e.filter(e=>!e.isEmpty&&0>t.indexOf(e)),o=t.filter(t=>!t.isEmpty&&0>e.indexOf(t));if(i.length!=o.length)return!1;if(!i.length)return!0;let s=uM(i,o),l=new uR(i,s,0).goto(n),a=new uR(o,s,0).goto(n);for(;;){if(l.to!=a.to||!uO(l.active,a.active)||l.point&&(!a.point||!l.point.eq(a.point)))return!1;if(l.to>r)return!0;l.next(),a.next()}}static spans(e,t,n,r,i=-1){let o=new uR(e,null,i).goto(t),s=t,l=o.openStart;for(;;){let e=Math.min(o.to,n);if(o.point){let n=o.activeForPoint(o.to),i=o.pointFrom<t?n.length+1:o.point.startSide<0?n.length:Math.min(n.length,l);r.point(s,e,o.point,n,i,o.pointRank),l=Math.min(o.openEnd(e),n.length)}else e>s&&(r.span(s,e,o.active,l),l=o.openEnd(e));if(o.to>n)return l+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new uk;for(let r of e instanceof ux?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(uw(t,r)>0)return e.slice().sort(uw);t=r}return e}(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return uS.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=uS.empty;r=r.nextLayer)t=new uS(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}uS.empty=new uS([],[],null,-1),uS.empty.nextLayer=uS.empty;class uk{finishChunk(e){this.chunks.push(new uC(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new uk)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&0>(e-this.lastFrom||n.startSide-this.last.startSide))throw Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if(0>(e-this.lastTo||t.value[0].startSide-this.last.endSide))return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(uS.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=uS.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function uM(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let o=r.get(e.chunk[t]);null==o||(n?n.mapPos(o):o)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(o,o+e.chunk[t].length))||i.add(e.chunk[t])}return i}class uT{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){0>(this.to-e||this.endSide-t)&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class uD{constructor(e){this.heap=e}static from(e,t=null,n=-1){let r=[];for(let i=0;i<e.length;i++)for(let o=e[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&r.push(new uT(o,t,n,i));return 1==r.length?r[0]:new uD(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)uA(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)uA(this.heap,e);0>(this.to-e||this.value.endSide-t)&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),uA(this.heap,0)}}}function uA(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),0>n.compare(i))break;e[r]=n,e[t]=i,t=r}}class uR{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=uD.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&0>(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t);)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){uI(this.active,e),uI(this.activeTo,e),uI(this.activeRank,e),this.minActive=uZ(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;uE(this.active,t,n),uE(this.activeTo,t,r),uE(this.activeRank,t,i),e&&uE(e,t,this.cursor.from),this.minActive=uZ(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&0>(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&uI(n,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let e=this.cursor.value;if(e.point)if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}else this.addActive(n),this.cursor.next()}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function uP(e,t,n,r,i,o){e.goto(t),n.goto(r);let s=r+i,l=r,a=r-t;for(;;){let t=e.to+a-n.to,r=t||e.endSide-n.endSide,i=r<0?e.to+a:n.to,c=Math.min(i,s);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&uO(e.activeForPoint(e.to),n.activeForPoint(n.to))||o.comparePoint(l,c,e.point,n.point):c>l&&!uO(e.active,n.active)&&o.compareRange(l,c,e.active,n.active),i>s)break;(t||e.openEnd!=n.openEnd)&&o.boundChange&&o.boundChange(i),l=i,r<=0&&e.next(),r>=0&&n.next()}}function uO(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!e[n].eq(t[n]))return!1;return!0}function uI(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function uE(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function uZ(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)0>(t[i]-r||e[i].endSide-e[n].endSide)&&(n=i,r=t[i]);return n}function uL(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)9==e.charCodeAt(i)?(r+=t-r%t,i++):(r++,i=cP(e,i));return r}function uj(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=9==e.charCodeAt(r)?n-i%n:1,r=cP(e,r)}return!0===r?-1:e.length}let uB="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),uF="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),uV="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class uN{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}for(let t in e)!function e(t,i,o,s){let l=[],a=/^@(\w+)\b/.exec(t[0]),c=a&&"keyframes"==a[1];if(a&&null==i)return o.push(t[0]+";");for(let n in i){let s=i[n];if(/&/.test(n))e(n.split(/,\s*/).map(e=>t.map(t=>e.replace(/&/,t))).reduce((e,t)=>e.concat(t)),s,o);else if(s&&"object"==typeof s){if(!a)throw RangeError("The value of a property ("+n+") should be a primitive value.");e(r(n),s,l,c)}else null!=s&&l.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+s+";")}(l.length||c)&&o.push((n&&!a&&!s?t.map(n):t).join(", ")+" {"+l.join(" ")+"}")}(r(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=uV[uB]||1;return uV[uB]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let r=e[uF],i=n&&n.nonce;r?i&&r.setNonce(i):r=new uz(e,i),r.mount(Array.isArray(t)?t:[t],e)}}let uH=new Map;class uz{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=uH.get(n);if(t)return e[uF]=t;this.sheet=new r.CSSStyleSheet,uH.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[uF]=this}mount(e,t){let n=this.sheet,r=0,i=0;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),i--,s=-1),-1==s){if(this.modules.splice(i++,0,o),n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)0>t.adoptedStyleSheets.indexOf(this.sheet)&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var u$={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},uW={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},u_="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),uq="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),uG=0;uG<10;uG++)u$[48+uG]=u$[96+uG]=String(uG);for(var uG=1;uG<=24;uG++)u$[uG+111]="F"+uG;for(var uG=65;uG<=90;uG++)u$[uG]=String.fromCharCode(uG+32),uW[uG]=String.fromCharCode(uG);for(var uU in u$)uW.hasOwnProperty(uU)||(uW[uU]=u$[uU]);function uK(e){return(11==e.nodeType?e.getSelection?e:e.ownerDocument:e).getSelection()}function uY(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function uX(e,t){if(!t.anchorNode)return!1;try{return uY(e,t.anchorNode)}catch(e){return!1}}function uQ(e){return 3==e.nodeType?u7(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function uJ(e,t,n,r){return!!n&&(u2(e,t,n,r,-1)||u2(e,t,n,r,1))}function u0(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function u1(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function u2(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:u5(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=u0(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType||1==(e=e.childNodes[t+(i<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=i<0?u5(e):0}}}function u5(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function u3(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function u8(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||1>Math.abs(t.width-e.offsetWidth))&&(n=1),(r>.995&&r<1.005||!isFinite(r)||1>Math.abs(t.height-e.offsetHeight))&&(r=1),{scaleX:n,scaleY:r}}class u4{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?u5(t):0),n,Math.min(e.focusOffset,n?u5(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}let u6=null;function u9(e){if(e.setActive)return e.setActive();if(u6)return e.focus(u6);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==u6?{get preventScroll(){return u6={preventScroll:!0},!0}}:void 0),!u6){u6=!1;for(let e=0;e<t.length;){let n=t[e++],r=t[e++],i=t[e++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=i&&(n.scrollLeft=i)}}}function u7(e,t,n=t){let r=i||(i=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function he(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let o=new KeyboardEvent("keydown",i);o.synthetic=!0,e.dispatchEvent(o);let s=new KeyboardEvent("keyup",i);return s.synthetic=!0,e.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function ht(e){for(;e.attributes.length;)e.removeAttributeNode(e.attributes[0])}function hn(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function hr(e,t){for(let n=e,r=t;;)if(3==n.nodeType&&r>0)return{node:n,offset:r};else if(1==n.nodeType&&r>0){if("false"==n.contentEditable)return null;r=u5(n=n.childNodes[r-1])}else{if(!n.parentNode||u1(n))return null;r=u0(n),n=n.parentNode}}function hi(e,t){for(let n=e,r=t;;)if(3==n.nodeType&&r<n.nodeValue.length)return{node:n,offset:r};else if(1==n.nodeType&&r<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[r],r=0}else{if(!n.parentNode||u1(n))return null;r=u0(n)+1,n=n.parentNode}}class ho{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new ho(e.parentNode,u0(e),t)}static after(e,t){return new ho(e.parentNode,u0(e)+1,t)}}let hs=[];class hl{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(2&this.flags){let n=this.dom,r=null,i;for(let o of this.children){if(7&o.flags){if(!o.dom&&(i=r?r.nextSibling:n.firstChild)){let e=hl.get(i);(!e||!e.parent&&e.canReuseDOM(o))&&o.reuseDOM(i)}o.sync(e,t),o.flags&=-8}if(i=r?r.nextSibling:n.firstChild,t&&!t.written&&t.node==n&&i!=o.dom&&(t.written=!0),o.dom.parentNode==n)for(;i&&i!=o.dom;)i=ha(i);else n.insertBefore(o.dom,i);r=o.dom}for((i=r?r.nextSibling:n.firstChild)&&t&&t.node==n&&(t.written=!0);i;)i=ha(i)}else if(1&this.flags)for(let n of this.children)7&n.flags&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let r=0==u5(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==this.dom)break;0==r&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}n=r<0?e:e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!hl.get(n);)n=n.nextSibling;if(!n)return this.length;for(let e=0,t=0;;e++){let r=this.children[e];if(r.dom==n)return t;t+=r.length+r.breakAfter}}domBoundsAround(e,t,n=0){let r=-1,i=-1,o=-1,s=-1;for(let l=0,a=n,c=n;l<this.children.length;l++){let n=this.children[l],u=a+n.length;if(a<e&&u>t)return n.domBoundsAround(e,t,a);if(u>=e&&-1==r&&(r=l,i=a),a>t&&n.dom.parentNode==this.dom){o=l,s=c;break}c=u,a=u+n.breakAfter}return{from:i,to:s<0?n+this.length:s,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=hs){this.markDirty();for(let r=e;r<t;r++){let e=this.children[r];e.parent==this&&0>n.indexOf(e)&&e.destroy()}n.length<250?this.children.splice(e,t-e,...n):this.children=[].concat(this.children.slice(0,e),n,this.children.slice(t));for(let e=0;e<n.length;e++)n[e].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new hc(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==e?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,n,r,i,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}function ha(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}hl.prototype.breakAfter=0;class hc{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function hu(e,t,n,r,i,o,s,l,a){let{children:c}=e,u=c.length?c[t]:null,h=o.length?o[o.length-1]:null,d=h?h.breakAfter:s;if(!(t==r&&u&&!s&&!d&&o.length<2&&u.merge(n,i,o.length?h:null,0==n,l,a))){if(r<c.length){let e=c[r];e&&(i<e.length||e.breakAfter&&(null==h?void 0:h.breakAfter))?(t==r&&(e=e.split(i),i=0),!d&&h&&e.merge(0,i,h,!0,0,a)?o[o.length-1]=e:((i||e.children.length&&!e.children[0].length)&&e.merge(0,i,null,!1,0,a),o.push(e))):(null==e?void 0:e.breakAfter)&&(h?h.breakAfter=1:s=1),r++}for(u&&(u.breakAfter=s,n>0&&(!s&&o.length&&u.merge(n,u.length,o[0],!1,l,0)?u.breakAfter=o.shift().breakAfter:(n<u.length||u.children.length&&0==u.children[u.children.length-1].length)&&u.merge(n,u.length,null,!1,l,0),t++));t<r&&o.length;)if(c[r-1].become(o[o.length-1]))r--,o.pop(),a=o.length?0:l;else if(c[t].become(o[0]))t++,o.shift(),l=o.length?0:a;else break;!o.length&&t&&r<c.length&&!c[t-1].breakAfter&&c[r].merge(0,0,c[t-1],!1,l,a)&&t--,(t<r||o.length)&&e.replaceChildren(t,r,o)}}function hh(e,t,n,r,i,o){let s=e.childCursor(),{i:l,off:a}=s.findPos(n,1),{i:c,off:u}=s.findPos(t,-1),h=t-n;for(let e of r)h+=e.length;e.length+=h,hu(e,c,u,l,a,r,0,i,o)}let hd="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},hf="undefined"!=typeof document?document:{documentElement:{style:{}}},hp=/Edge\/(\d+)/.exec(hd.userAgent),hm=/MSIE \d/.test(hd.userAgent),hg=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hd.userAgent),hv=!!(hm||hg||hp),hb=!hv&&/gecko\/(\d+)/i.test(hd.userAgent),hy=!hv&&/Chrome\/(\d+)/.exec(hd.userAgent),hx="webkitFontSmoothing"in hf.documentElement.style,hw=!hv&&/Apple Computer/.test(hd.vendor),hC=hw&&(/Mobile\/\w+/.test(hd.userAgent)||hd.maxTouchPoints>2);var hS={mac:hC||/Mac/.test(hd.platform),windows:/Win/.test(hd.platform),linux:/Linux|X11/.test(hd.platform),ie:hv,ie_version:hm?hf.documentMode||6:hg?+hg[1]:hp?+hp[1]:0,gecko:hb,gecko_version:hb?+(/Firefox\/(\d+)/.exec(hd.userAgent)||[0,0])[1]:0,chrome:!!hy,chrome_version:hy?+hy[1]:0,ios:hC,android:/Android\b/.test(hd.userAgent),webkit:hx,safari:hw,webkit_version:hx?+(/\bAppleWebKit\/(\d+)/.exec(hd.userAgent)||[0,0])[1]:0,tabSize:null!=hf.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class hk extends hl{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){3==e.nodeType&&this.createDOM(e)}merge(e,t,n){return!(8&this.flags)&&(!n||n instanceof hk&&!(this.length-(t-e)+n.length>256)&&!(8&n.flags))&&(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new hk(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=8&this.flags,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new ho(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return function(e,t,n){let r=e.nodeValue.length;t>r&&(t=r);let i=t,o=t,s=0;0==t&&n<0||t==r&&n>=0?!(hS.chrome||hS.gecko)&&(t?(i--,s=1):o<r&&(o++,s=-1)):n<0?i--:o<r&&o++;let l=u7(e,i,o).getClientRects();if(!l.length)return null;let a=l[(s?s<0:n>=0)?0:l.length-1];return hS.safari&&!s&&0==a.width&&(a=Array.prototype.find.call(l,e=>e.width)||a),s?u3(a,s<0):a||null}(this.dom,e,t)}}class hM extends hl{constructor(e,t=[],n=0){for(let r of(super(),this.mark=e,this.children=t,this.length=n,t))r.setParent(this)}setAttrs(e){if(ht(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,r,i,o){return(!n||!!(n instanceof hM&&n.mark.eq(this.mark))&&(!e||!(i<=0))&&(!(t<this.length)||!(o<=0)))&&(hh(this,e,t,n?n.children.slice():[],i-1,o-1),this.markDirty(),!0)}split(e){let t=[],n=0,r=-1,i=0;for(let o of this.children){let s=n+o.length;s>e&&t.push(n<e?o.split(e-n):o),r<0&&n>=e&&(r=i),n=s,i++}let o=this.length-e;return this.length=e,r>-1&&(this.children.length=r,this.markDirty()),new hM(this.mark,t,o)}domAtPos(e){return hA(this,e)}coordsAt(e,t){return hR(this,e,t)}}class hT extends hl{static create(e,t,n){return new hT(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=hT.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,r,i,o){return(!n||n instanceof hT&&!!this.widget.compare(n.widget)&&(!(e>0)||!(i<=0))&&(!(t<this.length)||!(o<=0)))&&(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof hT&&e.side==this.side&&this.widget.constructor==e.widget.constructor&&(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0)}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(0==this.length)return cw.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,r=this.posAtStart;return n?n.slice(r,r+this.length):cw.empty}domAtPos(e){return(this.length?0==e:this.side>0)?ho.before(this.dom):ho.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let r=this.dom.getClientRects(),i=null;if(!r.length)return null;let o=this.side?this.side<0:e>0;for(let t=o?r.length-1:0;i=r[t],e>0?0!=t:t!=r.length-1&&!(i.top<i.bottom);t+=o?-1:1);return u3(i,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class hD extends hl{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof hD&&e.side==this.side}split(){return new hD(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?ho.before(this.dom):ho.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return cw.empty}get isHidden(){return!0}}function hA(e,t){let n=e.dom,{children:r}=e,i=0;for(let e=0;i<r.length;i++){let o=r[i],s=e+o.length;if(!(s==e&&0>=o.getSide())){if(t>e&&t<s&&o.dom.parentNode==n)return o.domAtPos(t-e);if(t<=e)break;e=s}}for(let e=i;e>0;e--){let t=r[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=i;e<r.length;e++){let t=r[e];if(t.dom.parentNode==n)return t.domAtPos(0)}return new ho(n,0)}function hR(e,t,n){let r=null,i=-1,o=null,s=-1;!function e(t,l){for(let a=0,c=0;a<t.children.length&&c<=l;a++){let u=t.children[a],h=c+u.length;h>=l&&(u.children.length?e(u,l-c):(!o||o.isHidden&&n>0)&&(h>l||c==h&&u.getSide()>0)?(o=u,s=l-c):(c<l||c==h&&0>u.getSide()&&!u.isHidden)&&(r=u,i=l-c)),c=h}}(e,t);let l=(n<0?r:o)||r||o;return l?l.coordsAt(Math.max(0,l==r?i:s),n):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=uQ(t);return n[n.length-1]||null}(e)}function hP(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}hk.prototype.children=hT.prototype.children=hD.prototype.children=hs;let hO=Object.create(null);function hI(e,t,n){if(e==t)return!0;e||(e=hO),t||(t=hO);let r=Object.keys(e),i=Object.keys(t);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let o of r)if(o!=n&&(-1==i.indexOf(o)||e[o]!==t[o]))return!1;return!0}function hE(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,"style"==i?e.style.cssText="":e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,"style"==i?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}class hZ{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return -1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var hL=((p=hL||(hL={}))[p.Text=0]="Text",p[p.WidgetBefore=1]="WidgetBefore",p[p.WidgetAfter=2]="WidgetAfter",p[p.WidgetRange=3]="WidgetRange",p);class hj extends uy{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new hB(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new hV(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:i,end:o}=hN(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(o?t?2e8:1:-6e8)+1}return new hV(e,n,r,t,e.widget||null,!0)}static line(e){return new hF(e)}static set(e,t=!1){return uS.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}hj.none=uS.empty;class hB extends hj{constructor(e){let{start:t,end:n}=hN(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof hB&&this.tagName==e.tagName&&(this.class||(null==(t=this.attrs)?void 0:t.class))==(e.class||(null==(n=e.attrs)?void 0:n.class))&&hI(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw RangeError("Mark decorations may not be empty");return super.range(e,t)}}hB.prototype.point=!1;class hF extends hj{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof hF&&this.spec.class==e.spec.class&&hI(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}hF.prototype.mapMode=cL.TrackBefore,hF.prototype.point=!0;class hV extends hj{constructor(e,t,n,r,i,o){super(t,n,i,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?cL.TrackBefore:cL.TrackAfter:cL.TrackDel}get type(){return this.startSide!=this.endSide?hL.WidgetRange:this.startSide<=0?hL.WidgetBefore:hL.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){var t,n;return e instanceof hV&&(t=this.widget,t==(n=e.widget)||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function hN(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return null==n&&(n=e.inclusive),null==r&&(r=e.inclusive),{start:null!=n?n:t,end:null!=r?r:t}}function hH(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}hV.prototype.point=!0;class hz extends hl{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,r,i,o){if(n){if(!(n instanceof hz))return!1;this.dom||n.transferDOM(this)}return r&&this.setDeco(n?n.attrs:null),hh(this,e,t,n?n.children.slice():[],i,o),!0}split(e){let t=new hz;if(t.breakAfter=this.breakAfter,0==this.length)return t;let{i:n,off:r}=this.childPos(e);r&&(t.append(this.children[n].split(r),0),this.children[n].merge(r,this.children[n].length,null,!1,0,0),n++);for(let e=n;e<this.children.length;e++)t.append(this.children[e],0);for(;n>0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){hI(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){!function e(t,n,r){let i,{children:o}=t;r>0&&n instanceof hM&&o.length&&(i=o[o.length-1])instanceof hM&&i.mark.eq(n.mark)?e(i,n.children[0],r-1):(o.push(n),n.setParent(t)),t.length+=n.length}(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=hP(t,this.attrs||{})),n&&(this.attrs=hP({class:n},this.attrs||{}))}domAtPos(e){return hA(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(ht(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(hE(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let r=this.dom.lastChild;for(;r&&hl.get(r)instanceof hM;)r=r.lastChild;if(!r||!this.length||"BR"!=r.nodeName&&(null==(n=hl.get(r))?void 0:n.isEditable)==!1&&(!hS.ios||!this.children.some(e=>e instanceof hk))){let e=document.createElement("BR");e.cmIgnore=!0,this.dom.appendChild(e)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let e=0,t;for(let n of this.children){if(!(n instanceof hk)||/[^ -~]/.test(n.text))return null;let r=uQ(n.dom);if(1!=r.length)return null;e+=r[0].width,t=r[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=hR(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:e}=this.parent.view.viewState,t=n.bottom-n.top;if(2>Math.abs(t-e.lineHeight)&&e.textHeight<t){let r=(t-e.textHeight)/2;return{top:n.top+r,bottom:n.bottom-r,left:n.left,right:n.left}}}return n}become(e){return e instanceof hz&&0==this.children.length&&0==e.children.length&&hI(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let n=0,r=0;n<e.children.length;n++){let i=e.children[n],o=r+i.length;if(o>=t){if(i instanceof hz)return i;if(o>t)break}r=o+i.breakAfter}return null}}class h$ extends hl{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,r,i,o){return(!n||n instanceof h$&&!!this.widget.compare(n.widget)&&(!(e>0)||!(i<=0))&&(!(t<this.length)||!(o<=0)))&&(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return 0==e?ho.before(this.dom):ho.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new h$(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return hs}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):cw.empty}domBoundsAround(){return null}become(e){return e instanceof h$&&e.widget.constructor==this.widget.constructor&&(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0)}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);return n||(this.widget instanceof hW?null:u3(this.dom.getBoundingClientRect(),this.length?0==e:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t!=n&&(e<0?t<0:n>0)}}class hW extends hZ{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class h_{constructor(e,t,n,r){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof h$&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new hz),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(hq(new hD(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||e&&this.content.length&&this.content[this.content.length-1]instanceof h$||this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skip);if(this.skip=0,r)throw Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}this.text=t,this.textOff=0}let r=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(hq(new hk(this.text.slice(this.textOff,this.textOff+r)),t),n),this.atCursorPos=!0,this.textOff+=r,e-=r,n=0}}span(e,t,n,r){this.buildText(t-e,n,r),this.pos=t,this.openStart<0&&(this.openStart=r)}point(e,t,n,r,i,o){if(this.disallowBlockEffectsFor[o]&&n instanceof hV){if(n.block)throw RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw RangeError("Decorations that replace line breaks may not be specified via plugins")}let s=t-e;if(n instanceof hV)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new h$(n.widget||hG.block,s,n));else{let o=hT.create(n.widget||hG.inline,s,s?0:n.startSide),l=this.atCursorPos&&!o.isEditable&&i<=r.length&&(e<t||n.startSide>0),a=!o.isEditable&&(e<t||i>r.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||l||o.isEditable||(this.pendingBuffer=0),this.flushBuffer(r),l&&(c.append(hq(new hD(1),r),i),i=r.length+Math.max(0,i-r.length)),c.append(hq(o,r),i),this.atCursorPos=a,this.pendingBuffer=a?e<t||i>r.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=i)}static build(e,t,n,r,i){let o=new h_(e,t,n,i);return o.openEnd=uS.spans(r,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function hq(e,t){for(let n of t)e=new hM(n,[e],e.length);return e}class hG extends hZ{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}hG.inline=new hG("span"),hG.block=new hG("div");var hU=((m=hU||(hU={}))[m.LTR=0]="LTR",m[m.RTL=1]="RTL",m);let hK=hU.LTR,hY=hU.RTL;function hX(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}let hQ=hX("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),hJ=hX("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),h0=Object.create(null),h1=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);h0[t]=n,h0[n]=-t}function h2(e){return e<=247?hQ[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?hJ[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}let h5=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class h3{get dir(){return this.level%2?hY:hK}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let o=0;o<e.length;o++){let s=e[o];if(s.from<=t&&s.to>=t){if(s.level==n)return o;(i<0||(0!=r?r<0?s.from<t:s.to>t:e[i].level>s.level))&&(i=o)}}if(i<0)throw RangeError("Index out of range");return i}}let h8=[];function h4(e){return[new h3(0,e,0)]}let h6="",h9=cU.define(),h7=cU.define(),de=cU.define(),dt=cU.define(),dn=cU.define(),dr=cU.define(),di=cU.define(),ds=cU.define(),dl=cU.define(),da=cU.define({combine:e=>e.some(e=>e)}),dc=cU.define({combine:e=>e.some(e=>e)}),du=cU.define();class dh{constructor(e,t="nearest",n="nearest",r=5,i=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=o}map(e){return e.empty?this:new dh(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new dh(c_.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}let dd=uc.define({map:(e,t)=>e.map(t)}),df=uc.define();function dp(e,t,n){let r=e.facet(dt);r.length?r[0](t):window.onerror?window.onerror(String(t),n,void 0,void 0,t):n?console.error(n+":",t):console.error(t)}let dm=cU.define({combine:e=>!e.length||e[0]}),dg=0,dv=cU.define();class db{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.extension=i(this)}static define(e,t){let{eventHandlers:n,eventObservers:r,provide:i,decorations:o}=t||{};return new db(dg++,e,n,r,e=>{let t=[dv.of(e)];return o&&t.push(dC.of(t=>{let n=t.plugin(e);return n?o(n):hj.none})),i&&t.push(i(e)),t})}static fromClass(e,t){return db.define(t=>new e(t),t)}}class dy{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(dp(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){dp(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null==(t=this.value)?void 0:t.destroy)try{this.value.destroy()}catch(t){dp(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}let dx=cU.define(),dw=cU.define(),dC=cU.define(),dS=cU.define(),dk=cU.define(),dM=cU.define();function dT(e,t){let n=e.state.facet(dM);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return uS.spans(r,t.from,t.to,{point(){},span(e,n,r,o){let s=e-t.from,l=n-t.from,a=i;for(let e=r.length-1;e>=0;e--,o--){let n=r[e].spec.bidiIsolate,i;if(null==n&&(n=function(e,t,n){for(let r=t;r<n;r++){let t=h2(e.charCodeAt(r));if(1==t)break;if(2==t||4==t)return hY}return hK}(t.text,s,l)),o>0&&a.length&&(i=a[a.length-1]).to==s&&i.direction==n)i.to=l,a=i.inner;else{let e={from:s,to:l,direction:n,inner:[]};a.push(e),a=e.inner}}}}),i}let dD=cU.define();function dA(e){let t=0,n=0,r=0,i=0;for(let o of e.state.facet(dD)){let s=o(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(r=Math.max(r,s.top)),null!=s.bottom&&(i=Math.max(i,s.bottom)))}return{left:t,right:n,top:r,bottom:i}}let dR=cU.define();class dP{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new dP(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let r=0,i=0,o=0,s=0;;r++){let l=r==e.length?null:e[r],a=o-s,c=l?l.fromB:1e9;for(;i<t.length&&t[i]<c;){let e=t[i],r=t[i+1],o=Math.max(s,e),l=Math.min(c,r);if(o<=l&&new dP(o+a,l+a,o,l).addToSet(n),r>c)break;i+=2}if(!l)return n;new dP(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),o=l.toA,s=l.toB}}}class dO{constructor(e,t,n){for(let r of(this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=cB.empty(this.startState.doc.length),n))this.changes=this.changes.compose(r.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new dP(e,t,n,i))),this.changedRanges=r}static create(e,t,n){return new dO(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}class dI extends hl{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=hj.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new hz],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new dP(0,0,0,e.state.doc.length)],0,null)}update(e){var t,n,r,i,o,s;let l,a,c=e.changedRanges;this.minWidth>0&&c.length&&(c.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let u=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null==(t=this.domChanged)?void 0:t.newSel)?u=this.domChanged.newSel.head:(n=e.changes,r=this.hasComposition,l=!1,r&&n.iterChangedRanges((e,t)=>{e<r.to&&t>r.from&&(l=!0)}),l||e.selectionSet||(u=e.state.selection.main.head)));let h=u>-1?function(e,t,n){let r=dE(e,n);if(!r)return null;let{node:i,from:o,to:s}=r,l=i.nodeValue;if(/[\n\r]/.test(l)||e.state.doc.sliceString(r.from,r.to)!=l)return null;let a=t.invertedDesc,c=new dP(a.mapPos(o),a.mapPos(s),o,s),u=[];for(let t=i.parentNode;;t=t.parentNode){let n=hl.get(t);if(n instanceof hM)u.push({node:t,deco:n.mark});else{if(n instanceof hz||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:c,text:i,marks:u,line:t};if(t==e.contentDOM)return null;u.push({node:t,deco:new hB({inclusive:!0,attributes:function(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}(t),tagName:t.tagName.toLowerCase()})})}}}(this.view,e.changes,u):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:n}=this.hasComposition;c=new dP(t,n,e.changes.mapPos(t,-1),e.changes.mapPos(n,1)).addToSet(c.slice())}this.hasComposition=h?{from:h.range.fromB,to:h.range.toB}:null,(hS.ie||hS.chrome)&&!h&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let d=(i=this.decorations,o=this.updateDeco(),s=e.changes,a=new dZ,uS.compare(i,o,s,a),a.changes);return c=dP.extendWithRanges(c,d),(!!(7&this.flags)||0!=c.length)&&(this.updateInner(c,e.startState.doc.length,h),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:r}=this.view;r.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let e=hS.chrome||hS.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||r.selectionRange.focusNode!=e.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(e=>e.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.children)e instanceof h$&&e.widget instanceof hW&&i.push(e.dom);r.updateGaps(i)}updateChildren(e,t,n){let r=n?n.range.addToSet(e.slice()):e,i=this.childCursor(t);for(let e=r.length-1;;e--){let t=e>=0?r[e]:null;if(!t)break;let{fromA:o,toA:s,fromB:l,toB:a}=t,c,u,h,d;if(n&&n.range.fromB<a&&n.range.toB>l){let e=h_.build(this.view.state.doc,l,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=h_.build(this.view.state.doc,n.range.toB,a,this.decorations,this.dynamicDecorationMap);u=e.breakAtStart,h=e.openStart,d=t.openEnd;let r=this.compositionView(n);t.breakAtStart?r.breakAfter=1:t.content.length&&r.merge(r.length,r.length,t.content[0],!1,t.openStart,0)&&(r.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&r.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),c=e.content.concat(r).concat(t.content)}else({content:c,breakAtStart:u,openStart:h,openEnd:d}=h_.build(this.view.state.doc,l,a,this.decorations,this.dynamicDecorationMap));let{i:f,off:p}=i.findPos(s,1),{i:m,off:g}=i.findPos(o,-1);hu(this,m,g,f,p,c,u,h,d)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){for(let t of(this.editContextFormatting=this.editContextFormatting.map(e.changes),e.transactions))for(let e of t.effects)e.is(df)&&(this.editContextFormatting=e.value)}compositionView(e){let t=new hk(e.text.nodeValue);for(let{deco:n}of(t.flags|=8,e.marks))t=new hM(n,[t],t.length);let n=new hz;return n.append(t,0),n}fixCompositionDOM(e){let t=(e,t)=>{t.flags|=8|!!t.children.some(e=>7&e.flags),this.markedForComposition.add(t);let n=hl.get(e);n&&n!=t&&(n.dom=null),t.setDOM(e)},n=this.childPos(e.range.fromB,1),r=this.children[n.i];t(e.line,r);for(let i=e.marks.length-1;i>=-1;i--)n=r.childPos(n.off,1),r=r.children[n.i],t(i>=0?e.marks[i].node:e.text,r)}updateSelection(e=!1,t=!1){var n;(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,i=r==this.dom,o=!i&&!(this.view.state.facet(dm)||this.dom.tabIndex>-1)&&uX(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(i||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),c=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(hS.gecko&&l.empty&&!this.hasComposition&&1==(n=a).node.nodeType&&n.node.firstChild&&(0==n.offset||"false"==n.node.childNodes[n.offset-1].contentEditable)&&(n.offset==n.node.childNodes.length||"false"==n.node.childNodes[n.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null)),a=c=new ho(e,0),s=!0}let u=this.view.observer.selectionRange;!s&&u.focusNode&&(uJ(a.node,a.offset,u.anchorNode,u.anchorOffset)&&uJ(c.node,c.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,l))||(this.view.observer.ignore(()=>{hS.android&&hS.chrome&&this.dom.contains(u.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=uK(this.view.root);if(e)if(l.empty){if(hS.gecko){var t,n;let e=(t=a.node,n=a.offset,1!=t.nodeType?0:(n&&"false"==t.childNodes[n-1].contentEditable?1:0)|2*(n<t.childNodes.length&&"false"==t.childNodes[n].contentEditable));if(e&&3!=e){let t=(1==e?hr:hi)(a.node,a.offset);t&&(a=new ho(t.node,t.offset))}}e.collapse(a.node,a.offset),null!=l.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=l.bidiLevel)}else if(e.extend){e.collapse(a.node,a.offset);try{e.extend(c.node,c.offset)}catch(e){}}else{let t=document.createRange();l.anchor>l.head&&([a,c]=[c,a]),t.setEnd(c.node,c.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,c)),this.impreciseAnchor=a.precise?null:new ho(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new ho(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&uJ(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=uK(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=hz.find(this,t.head);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let l=this.coordsAt(t.head,-1),a=this.coordsAt(t.head,1);if(!l||!a||l.bottom>a.top)return;let c=this.domAtPos(t.head+t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,i)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let r=e.offset;!n&&r<t.childNodes.length;r++){let e=hl.get(t.childNodes[r]);e instanceof hz&&(n=e.domAtPos(0))}for(let r=e.offset-1;!n&&r>=0;r--){let e=hl.get(t.childNodes[r]);e instanceof hz&&(n=e.domAtPos(e.length))}return n?new ho(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let e=hl.get(t);if(e&&e.rootView==this)return e;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let e=this.children[t];if(n<e.length||e instanceof hz)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,r=0;for(let i=this.length,o=this.children.length-1;o>=0;o--){let s=this.children[o],l=i-s.breakAfter,a=l-s.length;if(l<e)break;if(a<=e&&(a<e||s.covers(-1))&&(l>e||s.covers(1))&&(!n||s instanceof hz&&!(n instanceof hz&&t>=0)))n=s,r=a;else if(n&&a==e&&l==e&&s instanceof h$&&2>Math.abs(t))if(s.deco.startSide<0)break;else o&&(n=null);i=a}return n?n.coordsAt(e-r,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),r=this.children[t];if(!(r instanceof hz))return null;for(;r.children.length;){let{i:e,off:t}=r.childPos(n,1);for(;;e++){if(e==r.children.length)return null;if((r=r.children[e]).length)break}n=t}if(!(r instanceof hk))return null;let i=cP(r.text,n);if(i==n)return null;let o=u7(r.dom,n,i).getClientRects();for(let e=0;e<o.length;e++){let t=o[e];if(e==o.length-1||t.top<t.bottom&&t.left<t.right)return t}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,l=this.view.textDirection==hU.LTR;for(let e=0,a=0;a<this.children.length;a++){let c=this.children[a],u=e+c.length;if(u>r)break;if(e>=n){let n=c.dom.getBoundingClientRect();if(t.push(n.height),o){let t=c.dom.lastChild,r=t?uQ(t):[];if(r.length){let t=r[r.length-1],o=l?t.right-n.left:n.right-t.left;o>s&&(s=o,this.minWidth=i,this.minWidthFrom=e,this.minWidthTo=u)}}}e=u+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?hU.RTL:hU.LTR}measureTextSize(){for(let e of this.children)if(e instanceof hz){let t=e.measureTextSize();if(t)return t}let e=document.createElement("div"),t,n,r;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=uQ(e.firstChild)[0];t=e.getBoundingClientRect().height,n=i?i.width/27:7,r=i?i.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:r}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new hc(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],o=i?i.from-1:this.length;if(o>n){let r=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(hj.replace({widget:new hW(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!i)break;n=i.to+1}return hj.set(e)}updateDeco(){let e=1,t=this.view.state.facet(dC).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,r=this.view.state.facet(dS).map((e,t)=>{let r="function"==typeof e;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(uS.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(du))try{if(t(this.view,e.range,e))return!0}catch(e){dp(this.view.state,e,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let i=dA(this.view),o={left:n.left-i.left,top:n.top-i.top,right:n.right+i.right,bottom:n.bottom+i.bottom},{offsetWidth:s,offsetHeight:l}=this.view.scrollDOM;!function(e,t,n,r,i,o,s,l){let a=e.ownerDocument,c=a.defaultView||window;for(let u=e,h=!1;u&&!h;)if(1==u.nodeType){let e,d=u==a.body,f=1,p=1;if(d)e=function(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let t=u.getBoundingClientRect();({scaleX:f,scaleY:p}=u8(u,t)),e={left:t.left,right:t.left+u.clientWidth*f,top:t.top,bottom:t.top+u.clientHeight*p}}let m=0,g=0;if("nearest"==i)t.top<e.top?(g=t.top-(e.top+s),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+s)):t.bottom>e.bottom&&(g=t.bottom-e.bottom+s,n<0&&t.top-g<e.top&&(g=t.top-(e.top+s)));else{let r=t.bottom-t.top,o=e.bottom-e.top;g=("center"==i&&r<=o?t.top+r/2-o/2:"start"==i||"center"==i&&n<0?t.top-s:t.bottom-o+s)-e.top}if("nearest"==r?t.left<e.left?(m=t.left-(e.left+o),n>0&&t.right>e.right+m&&(m=t.right-e.right+o)):t.right>e.right&&(m=t.right-e.right+o,n<0&&t.left<e.left+m&&(m=t.left-(e.left+o))):m=("center"==r?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==r==l?t.left-o:t.right-(e.right-e.left)+o)-e.left,m||g)if(d)c.scrollBy(m,g);else{let e=0,n=0;if(g){let e=u.scrollTop;u.scrollTop+=g/p,n=(u.scrollTop-e)*p}if(m){let t=u.scrollLeft;u.scrollLeft+=m/f,e=(u.scrollLeft-t)*f}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&1>Math.abs(e-m)&&(r="nearest"),n&&1>Math.abs(n-g)&&(i="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else if(11==u.nodeType)u=u.host;else break}(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==hU.LTR)}}function dE(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=hr(n.focusNode,n.focusOffset),i=hi(n.focusNode,n.focusOffset),o=r||i;if(i&&r&&i.node!=r.node){let t=hl.get(i.node);if(!t||t instanceof hk&&t.text!=i.node.nodeValue)o=i;else if(e.docView.lastCompositionAfterCursor){let e=hl.get(r.node);!e||e instanceof hk&&e.text!=r.node.nodeValue||(o=i)}}if(e.docView.lastCompositionAfterCursor=o!=r,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}let dZ=class{constructor(){this.changes=[]}compareRange(e,t){hH(e,t,this.changes)}comparePoint(e,t){hH(e,t,this.changes)}boundChange(e){hH(e,e,this.changes)}};function dL(e,t){return e.top<t.bottom-1&&e.bottom>t.top+1}function dj(e,t){return t<e.top?{top:t,left:e.left,right:e.right,bottom:e.bottom}:e}function dB(e,t){return t>e.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function dF(e,t,n){let r=e.nodeValue.length,i=-1,o=1e9,s=0;for(let l=0;l<r;l++){let r=u7(e,l,l+1).getClientRects();for(let a=0;a<r.length;a++){let c=r[a];if(c.top==c.bottom)continue;s||(s=t-c.left);let u=(c.top>n?c.top-n:n-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&u<o){let n=t>=(c.left+c.right)/2,r=n;if((hS.chrome||hS.gecko)&&u7(e,l).getBoundingClientRect().left==c.right&&(r=!n),u<=0)return{node:e,offset:l+ +!!r};i=l+ +!!r,o=u}}}return{node:e,offset:i>-1?i:s>0?e.nodeValue.length:0}}function dV(e,t,n,r=-1){var i,o;let s=e.contentDOM.getBoundingClientRect(),l=s.top+e.viewState.paddingTop,a,{docHeight:c}=e.viewState,{x:u,y:h}=t,d=h-l;if(d<0)return 0;if(d>c)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,i=!1;(a=e.elementAtHeight(d)).type!=hL.Text;)for(;!((d=r>0?a.bottom+t:a.top-t)>=0)||!(d<=c);){if(i)return n?null:0;i=!0,r=-r}h=l+d;let f=a.from;if(f<e.viewport.from)return 0==e.viewport.from?0:n?null:dN(e,s,a,u,h);if(f>e.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:dN(e,s,a,u,h);let p=e.dom.ownerDocument,m=e.root.elementFromPoint?e.root:p,g=m.elementFromPoint(u,h);g&&!e.contentDOM.contains(g)&&(g=null),!g&&(u=Math.max(s.left+1,Math.min(s.right-1,u)),(g=m.elementFromPoint(u,h))&&!e.contentDOM.contains(g)&&(g=null));let v,b=-1;if(g&&(null==(i=e.docView.nearest(g))?void 0:i.isEditable)!=!1){if(p.caretPositionFromPoint){let e=p.caretPositionFromPoint(u,h);e&&({offsetNode:v,offset:b}=e)}else if(p.caretRangeFromPoint){let t=p.caretRangeFromPoint(u,h);t&&({startContainer:v,startOffset:b}=t,(!e.contentDOM.contains(v)||hS.safari&&function(e,t,n){let r;if(3!=e.nodeType||t!=(r=e.nodeValue.length))return!1;for(let t=e.nextSibling;t;t=t.nextSibling)if(1!=t.nodeType||"BR"!=t.nodeName)return!1;return u7(e,r-1,r).getBoundingClientRect().left>n}(v,b,u)||hS.chrome&&function(e,t,n){if(0!=t)return!1;for(let t=e;;){let e=t.parentNode;if(!e||1!=e.nodeType||e.firstChild!=t)return!1;if(e.classList.contains("cm-line"))break;t=e}return n-(1==e.nodeType?e.getBoundingClientRect():u7(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect()).left>5}(v,b,u))&&(v=void 0))}v&&(b=Math.min(u5(v),b))}if(!v||!e.docView.dom.contains(v)){let t=hz.find(e.docView,f);if(!t)return d>a.top+a.height/2?a.to:a.from;({node:v,offset:b}=function e(t,n,r){let i,o,s,l,a,c,u,h,d=!1;for(let m=t.firstChild;m;m=m.nextSibling){let t=uQ(m);for(let g=0;g<t.length;g++){var f,p;let v=t[g];c&&dL(c,v)&&(v=dj(dB(v,c.bottom),c.top));let b=(f=v).left>n?f.left-n:Math.max(0,n-f.right),y=(p=v).top>r?p.top-r:Math.max(0,r-p.bottom);if(0==b&&0==y)return 3==m.nodeType?dF(m,n,r):e(m,n,r);if(!a||h>y||h==y&&u>b){a=m,c=v,u=b,h=y;let e=y?r<v.top?-1:1:b?n<v.left?-1:1:0;d=!e||(e>0?g<t.length-1:g>0)}0==b?r>v.bottom&&(!s||s.bottom<v.bottom)?(i=m,s=v):r<v.top&&(!l||l.top>v.top)&&(o=m,l=v):s&&dL(s,v)?s=dB(s,v.bottom):l&&dL(l,v)&&(l=dj(l,v.top))}}if(s&&s.bottom>=r?(a=i,c=s):l&&l.top<=r&&(a=o,c=l),!a)return{node:t,offset:0};let m=Math.max(c.left,Math.min(c.right,n));if(3==a.nodeType)return dF(a,m,r);if(d&&"false"!=a.contentEditable)return e(a,m,r);let g=Array.prototype.indexOf.call(t.childNodes,a)+ +(n>=(c.left+c.right)/2);return{node:t,offset:g}}(t.dom,u,h))}let y=e.docView.nearest(v);if(!y)return null;if(!y.isWidget||(null==(o=y.dom)?void 0:o.nodeType)!=1)return y.localPosFromDOM(v,b)+y.posAtStart;{let e=y.dom.getBoundingClientRect();return t.y<e.top||t.y<=e.bottom&&t.x<=(e.left+e.right)/2?y.posAtStart:y.posAtEnd}}function dN(e,t,n,r,i){let o=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;o+=Math.floor((i-n.top-(e.defaultLineHeight-t)*.5)/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+uj(s,o,e.state.tabSize)}function dH(e,t){let n=e.lineBlockAt(t);if(Array.isArray(n.type)){for(let e of n.type)if(e.to>t||e.to==t&&(e.to==n.to||e.type==hL.Text))return e}return n}function dz(e,t,n,r){let i=e.state.doc.lineAt(t.head),o=e.bidiSpans(i),s=e.textDirectionAt(i.from);for(let l=t,a=null;;){let t=function(e,t,n,r,i){var o;let s=r.head-e.from,l=h3.find(t,s,null!=(o=r.bidiLevel)?o:-1,r.assoc),a=t[l],c=a.side(i,n);if(s==c){let e=l+=i?1:-1;if(e<0||e>=t.length)return null;s=(a=t[l=e]).side(!i,n),c=a.side(i,n)}let u=cP(e.text,s,a.forward(i,n));(u<a.from||u>a.to)&&(u=c),h6=e.text.slice(Math.min(s,u),Math.max(s,u));let h=l==(i?t.length-1:0)?null:t[l+(i?1:-1)];return h&&u==c&&h.level+ +!i<a.level?c_.cursor(h.side(!i,n)+e.from,h.forward(i,n)?1:-1,h.level):c_.cursor(u+e.from,a.forward(i,n)?-1:1,a.level)}(i,o,s,l,n),c=h6;if(!t){if(i.number==(n?e.state.doc.lines:1))return l;c="\n",i=e.state.doc.line(i.number+(n?1:-1)),o=e.bidiSpans(i),t=e.visualLineSide(i,!n)}if(a){if(!a(c))return l}else{if(!r)return t;a=r(c)}l=t}}function d$(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,o)=>{if(t>e&&t<i){let o=r||n||(t-e<i-t?-1:1);t=o<0?e:i,r=o}});if(!r)return t}}function dW(e,t,n){let r=d$(e.state.facet(dk).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:c_.cursor(r,r<n.from?1:-1)}class d_{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(uv.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+="￿"}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=r.nextSibling;if(i==t)break;let o=hl.get(r),s=hl.get(i);(o&&s?o.breakAfter:(o?o.breakAfter:u1(r))||u1(i)&&("BR"!=r.nodeName||r.cmIgnore)&&this.text.length>e)&&this.lineBreak(),r=i}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,s;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(s=r.exec(t))&&(i=s.index,o=s[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),o>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=o-1);n=i+o}}readNode(e){if(e.cmIgnore)return;let t=hl.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(!function(e,t,n){for(;;){if(!t||n<u5(t))return!1;if(t==e)return!0;n=u0(t)+1,t=t.parentNode}}(e,n.node,n.offset)?0:t))}}class dq{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class dG{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let t=i||o?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}=e.observer.selectionRange;return n&&(t.push(new dq(n,r)),(i!=n||o!=r)&&t.push(new dq(i,o))),t}(e),n=new d_(t,e.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,r=2==e.length?e[1].pos:n;return n>-1&&r>-1?c_.single(n+t,r+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!uY(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=o&&o.node==t.anchorNode&&o.offset==t.anchorOffset||!uY(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((hS.ios||hS.chrome)&&e.state.selection.main.empty&&n!=r&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),o=s.from-t,l=s.to-i;(0==o||1==o||0==t)&&(0==l||-1==l||i==e.state.doc.length)&&(n=0,r=e.state.doc.length)}this.newSel=c_.single(r,n)}}}function dU(e,t){let n,{newSel:r}=t,i=e.state.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:r,to:s}=t.bounds,l=i.from,a=null;(8===o||hS.android&&t.text.length<s-r)&&(l=i.to,a="end");let c=function(e,t,n,r){let i=Math.min(e.length,t.length),o=0;for(;o<i&&e.charCodeAt(o)==t.charCodeAt(o);)o++;if(o==i&&e.length==t.length)return null;let s=e.length,l=t.length;for(;s>0&&l>0&&e.charCodeAt(s-1)==t.charCodeAt(l-1);)s--,l--;if("end"==r){let e=Math.max(0,o-Math.min(s,l));n-=s+e-o}if(s<o&&e.length<t.length){let e=n<=o&&n>=s?o-n:0;o-=e,l=o+(l-s),s=o}else if(l<o){let e=n<=o&&n>=l?o-n:0;o-=e,s=o+(s-l),l=o}return{from:o,toA:s,toB:l}}(e.state.doc.sliceString(r,s,"￿"),t.text,l-r,a);c&&(hS.chrome&&13==o&&c.toB==c.from+2&&"￿￿"==t.text.slice(c.from,c.toB)&&c.toB--,n={from:r+c.from,to:r+c.toA,insert:cw.of(t.text.slice(c.from,c.toB).split("￿"))})}else r&&(!e.hasFocus&&e.state.facet(dm)||r.main.eq(i))&&(r=null);if(!n&&!r)return!1;if(!n&&t.typeOver&&!i.empty&&r&&r.main.empty?n={from:i.from,to:i.to,insert:e.state.doc.slice(i.from,i.to)}:(hS.mac||hS.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=c_.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:cw.of([n.insert.toString().replace("."," ")])}):n&&n.from>=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:e.state.doc.slice(i.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,i.to))}:hS.chrome&&n&&n.from==n.to&&n.from==i.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=c_.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:cw.of([" "])}),n)return dK(e,n,r,o);if(!r||r.main.eq(i))return!1;{let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}}function dK(e,t,n,r=-1){let i;if(hS.ios&&e.inputState.flushIOSKey(t))return!0;let o=e.state.selection.main;if(hS.android&&(t.to==o.to&&(t.from==o.from||t.from==o.from-1&&" "==e.state.sliceDoc(t.from,o.from))&&1==t.insert.length&&2==t.insert.lines&&he(e.contentDOM,"Enter",13)||(t.from==o.from-1&&t.to==o.to&&0==t.insert.length||8==r&&t.insert.length<t.to-t.from&&t.to>o.head)&&he(e.contentDOM,"Backspace",8)||t.from==o.from&&t.to==o.to+1&&0==t.insert.length&&he(e.contentDOM,"Delete",46)))return!0;let s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let l=()=>i||(i=function(e,t,n){let r,i=e.state,o=i.selection.main;if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=o.from<t.from?i.sliceDoc(o.from,t.from):"",s=o.to>t.to?i.sliceDoc(t.to,o.to):"";r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=i.changes(t),l=n&&n.main.to<=s.newLength?n.main:void 0;if(i.selection.ranges.length>1&&e.inputState.composing>=0&&t.to<=o.to&&t.to>=o.to-10){let a=e.state.sliceDoc(t.from,t.to),c,u=n&&dE(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);c={from:u.from,to:u.to-e}}else c=e.state.doc.lineAt(o.head);let h=o.to-t.to,d=o.to-o.from;r=i.changeByRange(n=>{if(n.from==o.from&&n.to==o.to)return{changes:s,range:l||n.map(s)};let r=n.to-h,u=r-a.length;if(n.to-n.from!=d||e.state.sliceDoc(u,r)!=a||n.to>=c.from&&n.from<=c.to)return{range:n};let f=i.changes({from:u,to:r,insert:t.insert}),p=n.to-o.to;return{changes:f,range:l?c_.range(Math.max(0,l.anchor+p),Math.max(0,l.head+p)):n.map(f)}})}else r={changes:s,selection:l&&i.selection.replaceRange(l)}}let s="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=".compose",e.inputState.compositionFirstChange&&(s+=".start",e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:s,scrollIntoView:!0})}(e,t,n));return e.state.facet(dr).some(n=>n(e,t.from,t.to,s,l))||e.dispatch(l()),!0}class dY{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,hS.safari&&e.contentDOM.addEventListener("input",()=>null),hS.gecko&&function(e){fh.has(e)||(fh.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){!(!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(r=hl.get(n))&&r.ignoreEvent(t))return!1;return!0}(this.view,e)||this.ignoreDuringComposition(e))&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=function(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec;if(e&&e.domEventHandlers)for(let r in e.domEventHandlers){let i=e.domEventHandlers[r];i&&n(r).handlers.push(dX(t.value,i))}if(e&&e.domEventObservers)for(let r in e.domEventObservers){let i=e.domEventObservers[r];i&&n(r).observers.push(dX(t.value,i))}}for(let e in d5)n(e).handlers.push(d5[e]);for(let e in d3)n(e).observers.push(d3[e]);return t}(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if("scroll"!=e){let i=!t[e].handlers.length,o=n[e];o&&!o.handlers.length!=i&&(r.removeEventListener(e,this.handleEvent),o=null),o||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)"scroll"==e||t[e]||r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){let t;return this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),!!(9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))||((this.tabFocusMode>0&&27!=e.keyCode&&0>d0.indexOf(e.keyCode)&&(this.tabFocusMode=-1),hS.android&&hS.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))?(this.view.observer.delayAndroidKey(e.key,e.keyCode),!0):hS.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=dQ.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||dJ.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(229!=e.keyCode&&this.view.observer.forceFlush(),!1))}flushIOSKey(e){let t=this.pendingIOSKey;return!(!t||"Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,he(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!!/^key/.test(e.type)&&(this.composing>0||!!(hS.safari&&!hS.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function dX(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){dp(n.state,e)}}}let dQ=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],dJ="dthko",d0=[16,17,18,20,91,92,224,225];function d1(e){return .7*Math.max(0,e)+8}class d2{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=function(e){let t=e.ownerDocument,n,r;for(let i=e.parentNode;i;)if(i==t.body||n&&r)break;else if(1==i.nodeType)!r&&i.scrollHeight>i.clientHeight&&(r=i),!n&&i.scrollWidth>i.clientWidth&&(n=i),i=i.assignedSlot||i.parentNode;else if(11==i.nodeType)i=i.host;else break;return{x:n,y:r}}(e.contentDOM),this.atoms=e.state.facet(dk).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(uv.allowMultipleSelections)&&function(e,t){let n=e.state.facet(h9);return n.length?n[0](t):hS.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=uK(e.root);if(!r||0==r.rangeCount)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)&&1==fo(t)&&null}start(e){!1===this.dragging&&this.select(e)}move(e){var t;if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&10>(t=this.startEvent,Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))))return;this.select(this.lastEvent=e);let n=0,r=0,i=0,o=0,s=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:s}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=dA(this.view);e.clientX-a.left<=i+6?n=-d1(i-e.clientX):e.clientX+a.right>=s-6&&(n=d1(e.clientX-s)),e.clientY-a.top<=o+6?r=-d1(o-e.clientY):e.clientY+a.bottom>=l-6&&(r=d1(e.clientY-l)),this.setScrollSpeed(n,r)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],i=null;if(r.empty){let e=d$(this.atoms,r.from,0);e!=r.from&&(i=c_.cursor(e,-1))}else{let e=d$(this.atoms,r.from,-1),t=d$(this.atoms,r.to,1);(e!=r.from||t!=r.to)&&(i=c_.range(r.from==r.anchor?e:t,r.from==r.head?e:t))}i&&(t||(t=e.ranges.slice()),t[n]=i)}return t?c_.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,!1===this.dragging))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}let d5=Object.create(null),d3=Object.create(null),d8=hS.ie&&hS.ie_version<15||hS.ios&&hS.webkit_version<604;function d4(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function d6(e,t){t=d4(e.state,ds,t);let{state:n}=e,r,i=1,o=n.toText(t),s=o.lines==n.selection.ranges.length;if(null!=fl&&n.selection.ranges.every(e=>e.empty)&&fl==o.toString()){let e=-1;r=n.changeByRange(r=>{let l=n.doc.lineAt(r.from);if(l.from==e)return{range:r};e=l.from;let a=n.toText((s?o.line(i++).text:t)+n.lineBreak);return{changes:{from:l.from,insert:a},range:c_.cursor(r.from+a.length)}})}else r=s?n.changeByRange(e=>{let t=o.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:c_.cursor(e.from+t.length)}}):n.replaceSelection(o);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}function d9(e,t,n,r){if(1==r)return c_.cursor(t,n);{if(2==r)return function(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),o=t-i.from;if(0==i.length)return c_.cursor(t);0==o?n=1:o==i.length&&(n=-1);let s=o,l=o;n<0?s=cP(i.text,o,!1):l=cP(i.text,o);let a=r(i.text.slice(s,l));for(;s>0;){let e=cP(i.text,s,!1);if(r(i.text.slice(e,s))!=a)break;s=e}for(;l<i.length;){let e=cP(i.text,l);if(r(i.text.slice(l,e))!=a)break;l=e}return c_.range(s+i.from,l+i.from)}(e.state,t,n);let i=hz.find(e.docView,t),o=e.state.doc.lineAt(i?i.posAtEnd:t),s=i?i.posAtStart:o.from,l=i?i.posAtEnd:o.to;return l<e.state.doc.length&&l==o.to&&l++,c_.range(s,l)}}d3.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},d5.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),d3.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},d3.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},d5.mousedown=(e,t)=>{var n,r;let i,o,s;if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let l=null;for(let n of e.state.facet(de))if(l=n(e,t))break;if(l||0!=t.button||(i=fe(n=e,r=t),o=fo(r),s=n.state.selection,l={update(e){e.docChanged&&(i.pos=e.changes.mapPos(i.pos),s=s.map(e.changes))},get(e,t,r){let l=fe(n,e),a,c=d9(n,l.pos,l.bias,o);if(i.pos!=l.pos&&!t){let e=d9(n,i.pos,i.bias,o),t=Math.min(e.from,c.from),r=Math.max(e.to,c.to);c=t<c.from?c_.range(t,r):c_.range(r,t)}return t?s.replaceRange(s.main.extend(c.from,c.to)):r&&1==o&&s.ranges.length>1&&(a=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return c_.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n))}return null}(s,l.pos))?a:r?s.addRange(c):c_.create([c])}}),l){let n=!e.hasFocus;e.inputState.startMouseSelection(new d2(e,t,l,n)),n&&e.observer.ignore(()=>{u9(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),!1===r.dragging}return!1};let d7=(e,t,n)=>t>=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right;function fe(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:function(e,t,n,r){let i=hz.find(e.docView,t);if(!i)return 1;let o=t-i.posAtStart;if(0==o)return 1;if(o==i.length)return -1;let s=i.coordsAt(o,-1);if(s&&d7(n,r,s))return -1;let l=i.coordsAt(o,1);return l&&d7(n,r,l)?1:s&&s.bottom>=r?-1:1}(e,n,t.clientX,t.clientY)}}let ft=hS.ie&&hS.ie_version<=11,fn=null,fr=0,fi=0;function fo(e){if(!ft)return e.detail;let t=fn,n=fi;return fn=e,fi=Date.now(),fr=!t||n>Date.now()-400&&2>Math.abs(t.clientX-e.clientX)&&2>Math.abs(t.clientY-e.clientY)?(fr+1)%3:1}function fs(e,t,n,r){let i;if(!(n=d4(e.state,ds,n)))return;let o=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,l=r&&s&&((i=e.state.facet(h7)).length?i[0](t):hS.mac?!t.altKey:!t.ctrlKey)?{from:s.from,to:s.to}:null,a={from:o,insert:n},c=e.state.changes(l?[l,a]:a);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(o,-1),head:c.mapPos(o,1)},userEvent:l?"move.drop":"input.drop"}),e.inputState.draggedContent=null}d5.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.nearest(t.target);if(r&&r.isWidget){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=c_.range(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",d4(e.state,dl,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},d5.dragend=e=>(e.inputState.draggedContent=null,!1),d5.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,o=()=>{++i==n.length&&fs(e,t,r.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=o,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),o()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return fs(e,t,n,!0),!0}return!1},d5.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=d8?null:t.clipboardData;return n?(d6(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(!function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),d6(e,n.value)},50)}(e),!1)};let fl=null;d5.copy=d5.cut=(e,t)=>{let{text:n,ranges:r,linewise:i}=function(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let o=e.doc.lineAt(r);o.number>i&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),i=o.number}r=!0}return{text:d4(e,dl,t.join(e.lineBreak)),ranges:n,linewise:r}}(e.state);if(!n&&!i)return!1;fl=i?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let o=d8?null:t.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(!function(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}(e,n),!1)};let fa=us.define();function fc(e,t){let n=[];for(let r of e.facet(di)){let i=r(e,t);i&&n.push(i)}return n?e.update({effects:n,annotations:fa.of(!0)}):null}function fu(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=fc(e.state,t);n?e.dispatch(n):e.update([])}},10)}d3.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),fu(e)},d3.blur=e=>{e.observer.clearSelectionRange(),fu(e)},d3.compositionstart=d3.compositionupdate=e=>{!e.observer.editContext&&(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},d3.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,hS.chrome&&hS.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},d3.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},d5.beforeinput=(e,t)=>{var n,r;let i;if("insertReplacementText"==t.inputType&&e.observer.editContext){let r=null==(n=t.dataTransfer)?void 0:n.getData("text/plain"),i=t.getTargetRanges();if(r&&i.length){let t=i[0],n=e.posAtDOM(t.startContainer,t.startOffset),o=e.posAtDOM(t.endContainer,t.endOffset);return dK(e,{from:n,to:o,insert:e.state.toText(r)},null),!0}}if(hS.chrome&&hS.android&&(i=dQ.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=(null==(r=window.visualViewport)?void 0:r.height)||0;setTimeout(()=>{var n;((null==(n=window.visualViewport)?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return hS.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),hS.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>d3.compositionend(e,t),20),!1};let fh=new Set,fd=["pre-wrap","normal","pre-line","break-spaces"],ff=!1;class fp{constructor(e){this.lineWrapping=e,this.doc=cw.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return fd.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(10*r)]||(t=!0,this.heightSamples[Math.floor(10*r)]=!0)}return t}refresh(e,t,n,r,i,o){let s=fd.indexOf(e)>-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,l){this.heightSamples={};for(let e=0;e<o.length;e++){let t=o[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return l}}class fm{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class fg{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return"number"==typeof this._content?hL.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof hV?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new fg(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var fv=((g=fv||(fv={}))[g.ByPos=0]="ByPos",g[g.ByHeight=1]="ByHeight",g[g.ByPosNoHeight=2]="ByPosNoHeight",g);class fb{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=2*!!e|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>.001&&(ff=!0),this.height=e)}replace(e,t,n){return fb.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,o=n.doc;for(let s=r.length-1;s>=0;s--){let{fromA:l,toA:a,fromB:c,toB:u}=r[s],h=i.lineAt(l,fv.ByPosNoHeight,n.setDoc(t),0,0),d=h.to>=a?h:i.lineAt(a,fv.ByPosNoHeight,n,0,0);for(u+=d.to-a,a=d.to;s>0&&h.from<=r[s-1].toA;)l=r[s-1].fromA,c=r[s-1].fromB,s--,l<h.from&&(h=i.lineAt(l,fv.ByPosNoHeight,n,0,0));c+=h.from-l,l=h.from;let f=fM.build(n.setDoc(o),e,c,u);i=fy(i,i.replace(l,a,f))}return i.updateHeight(n,0)}static empty(){return new fw(0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,r=0,i=0;for(;;)if(t==n)if(r>2*i){let i=e[t-1];i.break?e.splice(--t,1,i.left,null,i.right):e.splice(--t,1,i.left,i.right),n+=1+i.break,r-=i.size}else if(i>2*r){let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,i-=t.size}else break;else if(r<i){let n=e[t++];n&&(r+=n.size)}else{let t=e[--n];t&&(i+=t.size)}let o=0;return null==e[t-1]?(o=1,t--):null==e[t]&&(o=1,n++),new fS(fb.of(e.slice(0,t)),o,fb.of(e.slice(n)))}}function fy(e,t){return e==t?e:(e.constructor!=t.constructor&&(ff=!0),t)}fb.prototype.size=1;class fx extends fb{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,r){return new fg(r,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,r,i){return this.blockAt(0,n,r,i)}forEachLine(e,t,n,r,i,o){e<=i+this.length&&t>=i&&o(this.blockAt(0,n,r,i))}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setHeight(r.heights[r.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class fw extends fx{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,r){return new fg(r,this.length,n,this.height,this.breaks)}replace(e,t,n){let r=n[0];return 1==n.length&&(r instanceof fw||r instanceof fC&&4&r.flags)&&10>Math.abs(this.length-r.length)?(r instanceof fC?r=new fw(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):fb.of(n)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setHeight(r.heights[r.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class fC extends fb{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-n+1,o,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);o=t/i,this.length>i+1&&(s=(this.height-t)/(this.length-i-1))}else o=this.height/i;return{firstLine:n,lastLine:r,perLine:o,perChar:s}}blockAt(e,t,n,r){let{firstLine:i,lastLine:o,perLine:s,perChar:l}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),o=t.doc.lineAt(i),a=s+o.length*l,c=Math.max(n,e-a/2);return new fg(o.from,o.length,c,a,0)}{let r=Math.max(0,Math.min(o-i,Math.floor((e-n)/s))),{from:l,length:a}=t.doc.line(i+r);return new fg(l,a,n+s*r,s,0)}}lineAt(e,t,n,r,i){if(t==fv.ByHeight)return this.blockAt(e,n,r,i);if(t==fv.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new fg(t,r-t,0,0,0)}let{firstLine:o,perLine:s,perChar:l}=this.heightMetrics(n,i),a=n.doc.lineAt(e),c=s+a.length*l,u=a.number-o,h=r+s*u+l*(a.from-i-u);return new fg(a.from,a.length,Math.max(r,Math.min(h,r+this.height-c)),c,0)}forEachLine(e,t,n,r,i,o){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:s,perLine:l,perChar:a}=this.heightMetrics(n,i);for(let c=e,u=r;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;u+=l*n+a*(e-i-n)}let r=l+a*t.length;o(new fg(t.from,t.length,u,r,0)),u+=r,c=t.to+1}}replace(e,t,n){let r=this.length-t;if(r>0){let e=n[n.length-1];e instanceof fC?n[n.length-1]=new fC(e.length+r):n.push(null,new fC(r-1))}if(e>0){let t=n[0];t instanceof fC?n[0]=new fC(e+t.length):n.unshift(new fC(e-1),null)}return fb.of(n)}decomposeLeft(e,t){t.push(new fC(e-1),null)}decomposeRight(e,t){t.push(null,new fC(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let i=t+this.length;if(r&&r.from<=t+this.length&&r.more){let n=[],o=Math.max(t,r.from),s=-1;for(r.from>t&&n.push(new fC(r.from-t-1).updateHeight(e,t));o<=i&&r.more;){let t=e.doc.lineAt(o).length;n.length&&n.push(null);let i=r.heights[r.index++];-1==s?s=i:Math.abs(i-s)>=.001&&(s=-2);let l=new fw(t,i);l.outdated=!1,n.push(l),o+=t+1}o<=i&&n.push(null,new fC(i-o).updateHeight(e,o));let l=fb.of(n);return(s<0||Math.abs(l.height-this.height)>=.001||Math.abs(s-this.heightMetrics(e,t).perLine)>=.001)&&(ff=!0),fy(this,l)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class fS extends fb{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let o=r+this.left.height,s=i+this.left.length+this.break,l=t==fv.ByHeight?e<o:e<s,a=l?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,o,s);if(this.break||(l?a.to<s:a.from>s))return a;let c=t==fv.ByPosNoHeight?fv.ByPosNoHeight:fv.ByPos;return l?a.join(this.right.lineAt(s,c,n,o,s)):this.left.lineAt(s,c,n,r,i).join(a)}forEachLine(e,t,n,r,i,o){let s=r+this.left.height,l=i+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,n,r,i,o),t>=l&&this.right.forEachLine(e,t,n,s,l,o);else{let a=this.lineAt(l,fv.ByPos,n,r,i);e<a.from&&this.left.forEachLine(e,a.from-1,n,r,i,o),a.to>=e&&a.from<=t&&o(a),t>a.to&&this.right.forEachLine(a.to+1,t,n,s,l,o)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let o=i.length;for(let e of n)i.push(e);if(e>0&&fk(i,o-1),t<this.length){let e=i.length;this.decomposeRight(t,i),fk(i,e)}return fb.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&e>=++n&&t.push(null),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?fb.of(this.break?[e,null,t]:[e,t]):(this.left=fy(this.left,e),this.right=fy(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:i,right:o}=this,s=t+i.length+this.break,l=null;return(r&&r.from<=t+i.length&&r.more?l=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=s+o.length&&r.more?l=o=o.updateHeight(e,s,n,r):o.updateHeight(e,s,n),l)?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function fk(e,t){let n,r;null==e[t]&&(n=e[t-1])instanceof fC&&(r=e[t+1])instanceof fC&&e.splice(t-1,3,new fC(n.length+1+r.length))}class fM{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof fw?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new fw(e-this.pos,-1)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new fx(o,r,n)):(o||i||r>=5)&&this.addLineDeco(r,i,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new fw(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new fC(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof fw)return e;let t=new fw(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof fw||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new fw(0,-1));let n=e;for(let e of this.nodes)e instanceof fw&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,r){let i=new fM(n,e);return uS.spans(t,n,r,i,0),i.finish(n)}}class fT{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&hH(e,t,this.changes,5)}}class fD{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return hj.replace({widget:new fA(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class fA extends hZ{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class fR{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=fE,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=hU.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(dw).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new fp(t),this.stateDeco=e.facet(dC).filter(e=>"function"!=typeof e),this.heightMap=fb.empty().applyChanges(this.stateDeco,cw.empty,this.heightOracle.setDoc(e.doc),[new dP(0,0,0,e.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=hj.set(this.lineGaps.map(e=>e.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new fP(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?fE:new fZ(this.heightOracle,this.heightMap,this.viewports),2*!e.eq(this.scaler)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(fL(e,this.scaler))})}update(e,t=null){var n,r;let i;this.state=e.state;let o=this.stateDeco;this.stateDeco=this.state.facet(dC).filter(e=>"function"!=typeof e);let s=e.changedRanges,l=dP.extendWithRanges(s,(n=this.stateDeco,r=e?e.changes:cB.empty(this.state.doc.length),i=new fT,uS.compare(o,n,r,i,0),i.changes)),a=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);ff=!1,this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),l),(this.heightMap.height!=a||ff)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let u=l.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<u.from||t.range.head>u.to)||!this.viewportIsAppropriate(u))&&(u=this.getViewport(0,t));let h=u.from!=this.viewport.from||u.to!=this.viewport.to;this.viewport=u,e.flags|=this.updateForViewport(),(h||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(dc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){var t;let n,r,i=e.contentDOM,o=window.getComputedStyle(i),s=this.heightOracle,l=o.whiteSpace;this.defaultTextDirection="rtl"==o.direction?hU.RTL:hU.LTR;let a=this.heightOracle.mustRefreshForWrapping(l),c=i.getBoundingClientRect(),u=a||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let h=0,d=0;if(c.width&&c.height){let{scaleX:e,scaleY:t}=u8(i,c);(e>.005&&Math.abs(this.scaleX-e)>.005||t>.005&&Math.abs(this.scaleY-t)>.005)&&(this.scaleX=e,this.scaleY=t,h|=16,a=u=!0)}let f=(parseInt(o.paddingTop)||0)*this.scaleY,p=(parseInt(o.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=p)&&(this.paddingTop=f,this.paddingBottom=p,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(u=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=hn(e.scrollDOM);let g=(this.printing?function(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}:function(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,o=Math.max(0,n.left),s=Math.min(i.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(1==t.nodeType){let n=t,r=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=r.overflow){let r=n.getBoundingClientRect();o=Math.max(o,r.left),s=Math.min(s,r.right),l=Math.max(l,r.top),a=Math.min(t==e.parentNode?i.innerHeight:a,r.bottom)}t="absolute"==r.position||"fixed"==r.position?n.offsetParent:n.parentNode}else if(11==t.nodeType)t=t.host;else break;return{left:o-n.left,right:Math.max(o,s)-n.left,top:l-(n.top+t),bottom:Math.max(l,a)-(n.top+t)}})(i,this.paddingTop),v=g.top-this.pixelViewport.top,b=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(u=!0)),!this.inView&&!this.scrollTarget&&(n=(t=e.dom).getBoundingClientRect(),r=t.ownerDocument.defaultView||window,!(n.left<r.innerWidth)||!(n.right>0)||!(n.top<r.innerHeight)||!(n.bottom>0)))return 0;let x=c.width;if((this.contentDOMWidth!=x||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),u){let t=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(t)&&(a=!0),a||s.lineWrapping&&Math.abs(x-this.contentDOMWidth)>s.charWidth){let{lineHeight:n,charWidth:r,textHeight:i}=e.docView.measureTextSize();(a=n>0&&s.refresh(l,n,r,i,x/r,t))&&(e.docView.minWidth=0,h|=16)}for(let n of(v>0&&b>0?d=Math.max(v,b):v<0&&b<0&&(d=Math.min(v,b)),ff=!1,this.viewports)){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?fb.empty().applyChanges(this.stateDeco,cw.empty,this.heightOracle,[new dP(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new fm(n.from,r))}ff&&(h|=2)}let w=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return w&&(2&h&&(h|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),h|=this.updateForViewport()),(2&h||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,l=new fP(r.lineAt(o-1e3*n,fv.ByHeight,i,0,0).from,r.lineAt(s+(1-n)*1e3,fv.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<l.from||e>l.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=r.lineAt(e,fv.ByPos,i,0,0),s;s="center"==t.y?(o.top+o.bottom)/2-n/2:"start"==t.y||"nearest"==t.y&&e<l.from?o.top:o.bottom-n,l=new fP(r.lineAt(s-500,fv.ByHeight,i,0,0).from,r.lineAt(s+n+500,fv.ByHeight,i,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new fP(this.heightMap.lineAt(n,fv.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,fv.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,fv.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,fv.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(0==e||r<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=s+Math.max(10,Math.min(n,250)))&&r>o-2e3&&i<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new fD(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,o=r<<1;if(this.defaultTextDirection!=hU.LTR&&!n)return[];let s=[],l=(r,o,a,c)=>{if(o-r<i)return;let u=this.state.selection.main,h=[u.from];for(let e of(u.empty||h.push(u.to),h))if(e>r&&e<o){l(r,e-10,a,c),l(e+10,o,a,c);return}let d=function(e,t){for(let n of e)if(t(n))return n}(e,e=>e.from>=a.from&&e.to<=a.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-o)<i&&!h.some(t=>e.from<t&&e.to>t));if(!d){if(o<a.to&&t&&n&&t.visibleRanges.some(e=>e.from<=o&&e.to>=o)){let e=t.moveToLineBoundary(c_.cursor(o),!1,!0).head;e>r&&(o=e)}let e=this.gapSize(a,r,o,c),i=n||e<2e6?e:2e6;d=new fD(r,o,e,i)}s.push(d)},a=t=>{var i,s,a;let c,u,h,d,f;if(t.length<o||t.type!=hL.Text)return;let p=(i=t.from,s=t.to,a=this.stateDeco,h=[],d=i,f=0,uS.spans(a,i,s,{span(){},point(e,t){e>d&&(h.push({from:d,to:e}),f+=e-d),d=t}},20),d<s&&(h.push({from:d,to:s}),f+=s-d),{total:f,ranges:h});if(p.total<o)return;let m=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,i=r/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=m){let r=fI(p,m),o=((this.visibleBottom-this.visibleTop)/2+i)/t.height;e=r-o,n=r+o}else e=(this.visibleTop-t.top-i)/t.height,n=(this.visibleBottom-t.top+i)/t.height;c=fO(p,e),u=fO(p,n)}else{let n,i,o=p.total*this.heightOracle.charWidth,s=r*this.heightOracle.charWidth,l=0;if(o>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+l<this.pixelViewport.left&&(l=n.size-n.displaySize);let a=this.pixelViewport.left+l,h=this.pixelViewport.right+l;if(null!=m){let e=fI(p,m),t=((h-a)/2+s)/o;n=e-t,i=e+t}else n=(a-s)/o,i=(h+s)/o;c=fO(p,n),u=fO(p,i)}c>t.from&&l(t.from,c,t,p),u<t.to&&l(u,t.to,t,p)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(a):a(e);return s}gapSize(e,t,n,r){let i=fI(r,n)-fI(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){fD.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=hj.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];uS.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(8&r);t++){let i=this.visibleRanges[t],o=n[t];(i.from!=o.from||i.to!=o.to)&&(r|=4,e&&e.mapPos(i.from,-1)==o.from&&e.mapPos(i.to,1)==o.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||fL(this.heightMap.lineAt(e,fv.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||fL(this.heightMap.lineAt(this.scaler.fromDOM(e),fv.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return fL(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class fP{constructor(e,t){this.from=e,this.to=t}}function fO({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],o=i-n;if(r<=o)return n+r;r-=o}}function fI(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}let fE={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};class fZ{constructor(e,t,n){let r=0,i=0,o=0;for(let s of(this.viewports=n.map(({from:n,to:i})=>{let o=t.lineAt(n,fv.ByPos,e,0,0).top,s=t.lineAt(i,fv.ByPos,e,0,0).bottom;return r+=s-o,{from:n,to:i,top:o,bottom:s,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r),this.viewports))s.domTop=o+(s.top-i)*this.scale,o=s.domBottom=s.domTop+(s.bottom-s.top),i=s.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(e){return e instanceof fZ&&this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)}}function fL(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new fg(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>fL(e,t)):e._content)}let fj=cU.define({combine:e=>e.join(" ")}),fB=cU.define({combine:e=>e.indexOf(!0)>-1}),fF=uN.newName(),fV=uN.newName(),fN=uN.newName(),fH={"&light":"."+fV,"&dark":"."+fN};function fz(e,t,n){return new uN(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+" "+t})}let f$=fz("."+fF,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},fH),fW={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},f_=hS.ie&&hS.ie_version<=11;class fq{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new u4,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(hS.ie&&hS.ie_version<=11||hS.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&!1!==e.constructor.EDIT_CONTEXT&&!(hS.chrome&&hS.chrome_version<126)&&(this.editContext=new fK(e),e.state.facet(dm)&&(e.contentDOM.editContext=this.editContext.editContext)),f_&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null==(e=this.view.docView)?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){for(let t of(this.gapIntersection.disconnect(),e))this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(dm)?n.root.activeElement!=this.dom:!uX(this.dom,r))return;let i=r.anchorNode&&n.docView.nearest(r.anchorNode);if(i&&i.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(hS.ie&&hS.ie_version<=11||hS.android&&hS.chrome)&&!n.state.selection.main.empty&&r.focusNode&&uJ(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=uK(e.root);if(!t)return!1;let n=hS.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return fU(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?fU(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=uX(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,u5(n));;)if(r){if(1!=n.nodeType)return!1;let e=n.childNodes[r-1];"false"==e.contentEditable?r--:r=u5(n=e)}else{if(n==e)return!0;r=u0(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(11==n.nodeType)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,fW),f_&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),f_&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&he(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null==(n=this.delayedAndroidKey)?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),-1==t?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&uX(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new dG(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=dU(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty("attributes"==e.type),"attributes"==e.type&&(t.flags|=4),"childList"==e.type){let n=fG(t,e.previousSibling||e.target.previousSibling,-1),r=fG(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(dm)!=e.state.facet(dm)&&(e.view.contentDOM.editContext=e.state.facet(dm)?this.editContext.editContext:null))}destroy(){var e,t,n;for(let r of(this.stop(),null==(e=this.intersection)||e.disconnect(),null==(t=this.gapIntersection)||t.disconnect(),null==(n=this.resizeScroll)||n.disconnect(),this.scrollTargets))r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function fG(e,t,n){for(;t;){let r=hl.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i!=e.dom?i:n>0?t.nextSibling:t.previousSibling}return null}function fU(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor);return uJ(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}class fK{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});for(let n in this.handlers.textupdate=t=>{let n=e.state.selection.main,{anchor:r,head:i}=n,o=this.toEditorPos(t.updateRangeStart),s=this.toEditorPos(t.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:t.updateRangeStart,editorBase:o,drifted:!1});let l={from:o,to:s,insert:cw.of(t.text.split("\n"))};if(l.from==this.from&&r<this.from?l.from=r:l.to==this.to&&r>this.to&&(l.to=r),l.from==l.to&&!l.insert.length){let r=c_.single(this.toEditorPos(t.selectionStart),this.toEditorPos(t.selectionEnd));r.main.eq(n)||e.dispatch({selection:r,userEvent:"select"});return}if((hS.mac||hS.android)&&l.from==i-1&&/^\. ?$/.test(t.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(l={from:o,to:s,insert:cw.of([t.text.replace("."," ")])}),this.pendingContextChange=l,!e.state.readOnly){let n=this.to-this.from+(l.to-l.from+l.insert.length);dK(e,l,c_.single(this.toEditorPos(t.selectionStart,n),this.toEditorPos(t.selectionEnd,n)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),o=this.toEditorPos(n.rangeEnd);t<o;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if("None"!=t&&"None"!=r){let i=this.toEditorPos(e.rangeStart),o=this.toEditorPos(e.rangeEnd);if(i<o){let e=`text-decoration: underline ${"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${"Thin"==r?1:2}px`;n.push(hj.mark({attributes:{style:e}}).range(i,o))}}}e.dispatch({effects:df.of(hj.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}},this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=uK(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,o,s,l,a)=>{if(n)return;let c=a.length-(o-i);if(r&&o>=r.to)if(r.from==i&&r.to==o&&r.insert.eq(a)){r=this.pendingContextChange=null,t+=c,this.to+=c;return}else r=null,this.revertPending(e.state);if(i+=t,(o+=t)<=this.from)this.from+=c,this.to+=c;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+a.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),a.toString()),this.to+=c}t+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class fY{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;for(let t of(this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach(e=>n(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new fR(e.state||uv.create(e)),e.scrollTo&&e.scrollTo.is(dd)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(dv).map(e=>new dy(e)),this.plugins))t.update(this);this.observer=new fq(this),this.inputState=new dY(this),this.inputState.ensureHandlers(this.plugins),this.docView=new dI(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null==(t=document.fonts)?void 0:t.ready)&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=1==e.length&&e[0]instanceof uu?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,r,i=this.state;for(let t of e){if(t.startState!=i)throw RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=t.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,s=0,l=null;e.some(e=>e.annotation(fa))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,(l=fc(i,o))||(s=1));let a=this.observer.delayedAndroidKey,c=null;if(a?(this.observer.clearDelayedAndroidKey(),((c=this.observer.readChange())&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(c=null)):this.observer.clear(),i.facet(uv.phrases)!=this.state.facet(uv.phrases))return this.setState(i);r=dO.create(this,i,e),r.flags|=s;let u=this.viewState.scrollTarget;try{for(let t of(this.updateState=2,e)){if(u&&(u=u.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;u=new dh(e.empty?e:c_.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(dd)&&(u=e.value.clip(this.state))}this.viewState.update(r,u),this.bidiCache=fJ.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(dR)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(fj)!=r.state.facet(fj)&&(this.viewState.mustMeasureContent=!0),(t||n||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let e of this.state.facet(dn))try{e(r)}catch(e){dp(this.state,e,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!dU(this,c)&&a.force&&he(this.contentDOM,a.key,a.keyCode)})}setState(e){if(0!=this.updateState)throw Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);for(let t of(this.viewState=new fR(e),this.plugins=e.facet(dv).map(e=>new dy(e)),this.pluginMap.clear(),this.plugins))t.update(this);this.docView.destroy(),this.docView=new dI(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(dv),n=e.state.facet(dv);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new dy(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){dp(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(o<0)if(hn(n))i=-1,o=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,o=e.top}this.updateState=1;let s=this.viewState.measure(this);if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&s||([this.measureRequests,l]=[l,this.measureRequests]);let a=l.map(e=>{try{return e.read(this)}catch(e){return dp(this.state,e),fQ}}),c=dO.create(this,this.state,[]),u=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,!c.empty&&(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),(u=this.docView.update(c))&&this.docViewUpdate());for(let e=0;e<l.length;e++)if(a[e]!=fQ)try{let t=l[e];t.write&&t.write(a[e],this)}catch(e){dp(this.state,e)}if(u&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(e>1||e<-1){n.scrollTop=(r+=e)/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(dn))e(t)}get themeClasses(){return fF+" "+(this.state.facet(fB)?fN:fV)+" "+this.state.facet(fj)}updateAttrs(){let e=f0(this,dx,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(dm)?"true":"false",class:"cm-content",style:`${hS.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),f0(this,dw,t);let n=this.observer.ignore(()=>{let n=hE(this.contentDOM,this.contentAttrs,t),r=hE(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(fY.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(dR);let e=this.state.facet(fY.cspNonce);uN.mount(this.root,this.styleModules.concat(f$).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if((this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e)&&!(this.measureRequests.indexOf(e)>-1)){if(null!=e.key){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return dW(this,e,dz(this,e,t,n))}moveByGroup(e,t){return dW(this,e,dz(this,e,t,t=>{var n;let r,i;return n=e.head,i=(r=this.state.charCategorizer(n))(t),e=>{let t=r(e);return i==um.Space&&(i=t),i==t}}))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=n[t?n.length-1:0];return c_.cursor(i.side(t,r)+e.from,i.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,r){let i=dH(e,t.head),o=r&&i.type==hL.Text&&(e.lineWrapping||i.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head):null;if(o){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),s=e.posAtCoords({x:n==(r==hU.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(null!=s)return c_.cursor(s,n?-1:1)}return c_.cursor(n?i.to:i.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return dW(this,e,function(e,t,n,r){let i=t.head,o=n?1:-1;if(i==(n?e.state.doc.length:0))return c_.cursor(i,t.assoc);let s=t.goalColumn,l,a=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(i,t.assoc||-1),u=e.documentTop;if(c)null==s&&(s=c.left-a.left),l=o<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(i);null==s&&(s=Math.min(a.right-a.left,e.defaultCharacterWidth*(i-t.from))),l=(o<0?t.top:t.bottom)+u}let h=a.left+s,d=null!=r?r:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=l+(d+t)*o,r=dV(e,{x:h,y:n},!1,o);if(n<a.top||n>a.bottom||(o<0?r<i:r>i)){let t=e.docView.coordsForChar(r),i=!t||n<t.top?-1:1;return c_.cursor(r,i,void 0,s)}}}(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),dV(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),i=this.bidiSpans(r);return u3(n,i[h3.find(i,e-r.from,-1,t)].dir==hU.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(da)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>fX)return h4(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||function e(t,n){if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++){let i=t[r],o=n[r];if(i.from!=o.from||i.to!=o.to||i.direction!=o.direction||!e(i.inner,o.inner))return!1}return!0}(r.isolates,n=dT(this,e))))return r.order;n||(n=dT(this,e));let r=function(e,t,n){if(!e)return[new h3(0,0,+(t==hY))];if(t==hK&&!n.length&&!h5.test(e))return h4(e.length);if(n.length)for(;e.length>h8.length;)h8[h8.length]=256;let r=[],i=+(t!=hK);return function e(t,n,r,i,o,s,l){let a=n%2?2:1;!function(e,t,n,r,i){for(let o=0;o<=r.length;o++){let s=o?r[o-1].to:t,l=o<r.length?r[o].from:n,a=o?256:i;for(let t=s,n=a,r=a;t<l;t++){let i=h2(e.charCodeAt(t));512==i?i=n:8==i&&4==r&&(i=16),h8[t]=4==i?2:i,7&i&&(r=i),n=i}for(let e=s,t=a,r=a;e<l;e++){let i=h8[e];if(128==i)e<l-1&&t==h8[e+1]&&24&t?i=h8[e]=t:h8[e]=256;else if(64==i){let i=e+1;for(;i<l&&64==h8[i];)i++;let o=e&&8==t||i<n&&8==h8[i]?1==r?1:8:256;for(let t=e;t<i;t++)h8[t]=o;e=i-1}else 8==i&&1==r&&(h8[e]=1);t=i,7&i&&(r=i)}}}(t,o,s,i,a),function(e,t,n,r,i){let o=1==i?2:1;for(let s=0,l=0,a=0;s<=r.length;s++){let c=s?r[s-1].to:t,u=s<r.length?r[s].from:n;for(let t=c,n,r,s;t<u;t++)if(r=h0[n=e.charCodeAt(t)])if(r<0){for(let e=l-3;e>=0;e-=3)if(h1[e+1]==-r){let n=h1[e+2],r=2&n?i:4&n?1&n?o:i:0;r&&(h8[t]=h8[h1[e]]=r),l=e;break}}else if(189==h1.length)break;else h1[l++]=t,h1[l++]=n,h1[l++]=a;else if(2==(s=h8[t])||1==s){let e=s==i;a=+!e;for(let t=l-3;t>=0;t-=3){let n=h1[t+2];if(2&n)break;if(e)h1[t+2]|=2;else{if(4&n)break;h1[t+2]|=4}}}}}(t,o,s,i,a),function(e,t,n,r){for(let i=0,o=r;i<=n.length;i++){let s=i?n[i-1].to:e,l=i<n.length?n[i].from:t;for(let a=s;a<l;){let s=h8[a];if(256==s){let s=a+1;for(;;)if(s==l){if(i==n.length)break;s=n[i++].to,l=i<n.length?n[i].from:t}else if(256==h8[s])s++;else break;let c=1==o,u=c==((s<t?h8[s]:r)==1)?c?1:2:r;for(let t=s,r=i,o=r?n[r-1].to:e;t>a;)t==o&&(t=n[--r].from,o=r?n[r-1].to:e),h8[--t]=u;a=s}else o=s,a++}}}(o,s,i,a),function t(n,r,i,o,s,l,a){let c=o%2?2:1;if(o%2==s%2)for(let u=r,h=0;u<i;){let r=!0,d=!1;if(h==l.length||u<l[h].from){let e=h8[u];e!=c&&(r=!1,d=16==e)}let f=r||1!=c?null:[],p=r?o:o+1,m=u;t:for(;;)if(h<l.length&&m==l[h].from){if(d)break;let t=l[h];if(!r)for(let e=t.to,n=h+1;;){if(e==i)break t;if(n<l.length&&l[n].from==e)e=l[n++].to;else if(h8[e]==c)break t;else break}h++,f?f.push(t):(t.from>u&&a.push(new h3(u,t.from,p)),e(n,t.direction==hK!=!(p%2)?o+1:o,s,t.inner,t.from,t.to,a),u=t.to),m=t.to}else if(m==i||(r?h8[m]!=c:h8[m]==c))break;else m++;f?t(n,u,m,o+1,s,f,a):u<m&&a.push(new h3(u,m,p)),u=m}else for(let u=i,h=l.length;u>r;){let i=!0,d=!1;if(!h||u>l[h-1].to){let e=h8[u-1];e!=c&&(i=!1,d=16==e)}let f=i||1!=c?null:[],p=i?o:o+1,m=u;t:for(;;)if(h&&m==l[h-1].to){if(d)break;let t=l[--h];if(!i)for(let e=t.from,n=h;;){if(e==r)break t;if(n&&l[n-1].to==e)e=l[--n].from;else if(h8[e-1]==c)break t;else break}f?f.push(t):(t.to<u&&a.push(new h3(t.to,u,p)),e(n,t.direction==hK!=!(p%2)?o+1:o,s,t.inner,t.from,t.to,a),u=t.from),m=t.from}else if(m==r||(i?h8[m-1]!=c:h8[m-1]==c))break;else m--;f?t(n,m,u,o+1,s,f,a):m<u&&a.push(new h3(m,u,p)),u=m}}(t,o,s,n,r,i,l)}(e,i,i,n,0,e.length,r),r}(e.text,t,n);return this.bidiCache.push(new fJ(e.from,e.to,t,n,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||hS.safari&&(null==(e=this.inputState)?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{u9(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of(this.root.activeElement==this.contentDOM&&this.contentDOM.blur(),this.plugins))e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return dd.of(new dh("number"==typeof e?c_.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return dd.of(new dh(c_.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return db.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return db.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=uN.newName(),r=[fj.of(n),dR.of(fz(`.${n}`,e))];return t&&t.dark&&r.push(fB.of(!0)),r}static baseTheme(e){return c2.lowest(dR.of(fz("."+fF,e,fH)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&hl.get(n)||hl.get(e);return(null==(t=null==r?void 0:r.rootView)?void 0:t.view)||null}}fY.styleModule=dR,fY.inputHandler=dr,fY.clipboardInputFilter=ds,fY.clipboardOutputFilter=dl,fY.scrollHandler=du,fY.focusChangeEffect=di,fY.perLineTextDirection=da,fY.exceptionSink=dt,fY.updateListener=dn,fY.editable=dm,fY.mouseSelectionStyle=de,fY.dragMovesSelection=h7,fY.clickAddsSelectionRange=h9,fY.decorations=dC,fY.outerDecorations=dS,fY.atomicRanges=dk,fY.bidiIsolatedRanges=dM,fY.scrollMargins=dD,fY.darkTheme=fB,fY.cspNonce=cU.define({combine:e=>e.length?e[0]:""}),fY.contentAttributes=dw,fY.editorAttributes=dx,fY.lineWrapping=fY.contentAttributes.of({class:"cm-lineWrapping"}),fY.announce=uc.define();let fX=4096,fQ={};class fJ{constructor(e,t,n,r,i,o){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=o}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:hU.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir!=r||t.touchesRange(o.from,o.to)||n.push(new fJ(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function f0(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],o="function"==typeof t?t(e):t;o&&hP(o,n)}return n}let f1=hS.mac?"mac":hS.windows?"win":hS.linux?"linux":"key";function f2(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}let f5=c2.default(fY.domEventHandlers({keydown:(e,t)=>f7(f4(t.state),e,t,"editor")})),f3=cU.define({enables:f5}),f8=new WeakMap;function f4(e){let t=e.facet(f3),n=f8.get(t);return n||f8.set(t,n=function(e,t=f1){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(null==n)r[e]=t;else if(n!=t)throw Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},o=(e,r,o,s,l)=>{var a,c;let u=n[e]||(n[e]=Object.create(null)),h=r.split(/ (?!$)/).map(e=>(function(e,t){let n,r,i,o,s=e.split(/-(?!$)/),l=s[s.length-1];"Space"==l&&(l=" ");for(let e=0;e<s.length-1;++e){let l=s[e];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))"mac"==t?o=!0:r=!0;else throw Error("Unrecognized modifier name: "+l)}return n&&(l="Alt-"+l),r&&(l="Ctrl-"+l),o&&(l="Meta-"+l),i&&(l="Shift-"+l),l})(e,t));for(let t=1;t<h.length;t++){let n=h.slice(0,t).join(" ");i(n,!0),u[n]||(u[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=f6={view:t,prefix:n,scope:e};return setTimeout(()=>{f6==r&&(f6=null)},4e3),!0}]})}let d=h.join(" ");i(d,!1);let f=u[d]||(u[d]={preventDefault:!1,stopPropagation:!1,run:(null==(c=null==(a=u._any)?void 0:a.run)?void 0:c.slice())||[]});o&&f.run.push(o),s&&(f.preventDefault=!0),l&&(f.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(" "):["editor"];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,f9))}let i=r[t]||r.key;if(i)for(let t of e)o(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&o(t,"Shift-"+i,r.shift,r.preventDefault,r.stopPropagation)}return n}(t.reduce((e,t)=>e.concat(t),[]))),n}let f6=null,f9=null;function f7(e,t,n,r){var i;f9=t;let o=("Esc"==(i=!(u_&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||uq&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?uW:u$)[t.keyCode]||t.key||"Unidentified")&&(i="Escape"),"Del"==i&&(i="Delete"),"Left"==i&&(i="ArrowLeft"),"Up"==i&&(i="ArrowUp"),"Right"==i&&(i="ArrowRight"),"Down"==i&&(i="ArrowDown"),i),s=cE(cO(o,0))==o.length&&" "!=o,l="",a=!1,c=!1,u=!1;f6&&f6.view==n&&f6.scope==r&&(l=f6.prefix+" ",0>d0.indexOf(t.keyCode)&&(c=!0,f6=null));let h=new Set,d=e=>{if(e){for(let t of e.run)if(!h.has(t)&&(h.add(t),t(n)))return e.stopPropagation&&(u=!0),!0;e.preventDefault&&(e.stopPropagation&&(u=!0),c=!0)}return!1},f=e[r],p,m;return f&&(d(f[l+f2(o,t,!s)])?a=!0:s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(hS.windows&&t.ctrlKey&&t.altKey)&&(p=u$[t.keyCode])&&p!=o?d(f[l+f2(p,t,!0)])?a=!0:t.shiftKey&&(m=uW[t.keyCode])!=o&&m!=p&&d(f[l+f2(m,t,!1)])&&(a=!0):s&&t.shiftKey&&d(f[l+f2(o,t,!0)])&&(a=!0),!a&&d(f._any)&&(a=!0)),c&&(a=!0),a&&u&&t.stopPropagation(),f9=null,a}class pe{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(!n.empty)return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),o=e.textDirection==hU.LTR,s=e.contentDOM,l=s.getBoundingClientRect(),a=pt(e),c=s.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=l.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=l.right-(u?parseInt(u.paddingRight):0),f=dH(e,r),p=dH(e,i),m=f.type==hL.Text?f:null,g=p.type==hL.Text?p:null;if(m&&(e.lineWrapping||f.widgetLineBreaks)&&(m=pn(e,r,1,m)),g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=pn(e,i,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return b(y(n.from,n.to,m));{let t=m?y(n.from,null,m):x(f,!1),r=g?y(null,n.to,g):x(p,!0),i=[];return(m||f).to<(g||p).from-(m&&g?1:0)||f.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(v(h,t.bottom,d,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==hL.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),b(t).concat(i).concat(b(r))}function v(e,n,r,i){return new pe(t,e-a.left,n-a.top,r-e,i-n)}function b({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(v(n[i],e,n[i+1],t));return r}function y(t,n,r){let i=1e9,s=-1e9,l=[];function a(t,n,a,c,u){let f=e.coordsAtPos(t,t==r.to?-2:2),p=e.coordsAtPos(a,a==r.from?2:-2);f&&p&&(i=Math.min(f.top,p.top,i),s=Math.max(f.bottom,p.bottom,s),u==hU.LTR?l.push(o&&n?h:f.left,o&&c?d:p.right):l.push(!o&&c?h:p.left,!o&&n?d:f.right))}let c=null!=t?t:r.from,u=null!=n?n:r.to;for(let r of e.visibleRanges)if(r.to>c&&r.from<u)for(let i=Math.max(r.from,c),o=Math.min(r.to,u);;){let r=e.state.doc.lineAt(i);for(let s of e.bidiSpans(r)){let e=s.from+r.from,l=s.to+r.from;if(e>=o)break;l>i&&a(Math.max(e,i),null==t&&e<=c,Math.min(l,o),null==n&&l>=u,s.dir)}if((i=r.to+1)>=o)break}return 0==l.length&&a(c,null==t,u,null==n,e.textDirection),{top:i,bottom:s,horizontal:l}}function x(e,t){let n=l.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n);{let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let i=pt(e);return[new pe(t,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}}}function pt(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==hU.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function pn(e,t,n,r){let i=e.coordsAtPos(t,2*n);if(!i)return r;let o=e.dom.getBoundingClientRect(),s=(i.top+i.bottom)/2,l=e.posAtCoords({x:o.left+1,y:s}),a=e.posAtCoords({x:o.right-1,y:s});return null==l||null==a?r:{from:Math.max(r.from,Math.min(l,a)),to:Math.min(r.to,Math.max(l,a))}}class pr{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(pi)!=e.state.facet(pi)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(pi);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>{var n;return n=this.drawn[t],!(e.constructor==n.constructor&&e.eq(n))})){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}let pi=cU.define();function po(e){return[db.define(t=>new pr(t,e)),pi.of(e)]}let ps=!(hS.ios&&hS.webkit&&hS.webkit_version<534),pl=cU.define({combine:e=>ub(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function pa(e){return e.startState.facet(pl)!=e.state.facet(pl)}let pc=po({above:!0,markers(e){let{state:t}=e,n=t.facet(pl),r=[];for(let i of t.selection.ranges){let o=i==t.selection.main;if(i.empty?!o||ps:n.drawRangeCursor){let t=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=i.empty?i:c_.cursor(i.head,i.head>i.anchor?-1:1);for(let i of pe.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=pa(e);return n&&pu(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){pu(t.state,e)},class:"cm-cursorLayer"});function pu(e,t){t.style.animationDuration=e.facet(pl).cursorBlinkRate+"ms"}let ph=po({above:!1,markers:e=>e.state.selection.ranges.map(t=>t.empty?[]:pe.forRange(e,"cm-selectionBackground",t)).reduce((e,t)=>e.concat(t)),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||pa(e),class:"cm-selectionLayer"}),pd={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};ps&&(pd[".cm-line"].caretColor=pd[".cm-content"].caretColor="transparent !important");let pf=c2.highest(fY.theme(pd)),pp=uc.define({map:(e,t)=>null==e?null:t.mapPos(e)}),pm=c0.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(pp)?t.value:e,e))}),pg=db.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(pm);null==n?null!=this.cursor&&(null==(t=this.cursor)||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(pm)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(pm),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(pm)!=e&&this.view.dispatch({effects:pp.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function pv(e,t,n,r,i){t.lastIndex=0;for(let o=e.iterRange(n,r),s=n,l;!o.next().done;s+=o.value.length)if(!o.lineBreak)for(;l=t.exec(o.value);)i(s+l.index,l)}class pb{constructor(e){let{regexp:t,decoration:n,decorate:r,boundary:i,maxLength:o=1e3}=e;if(!t.global)throw RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,r)this.addMatch=(e,t,n,i)=>r(i,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,r,i)=>{let o=n(e,t,r);o&&i(r,r+e[0].length,o)};else if(n)this.addMatch=(e,t,r,i)=>i(r,r+e[0].length,n);else throw RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(e){let t=new uk,n=t.add.bind(t);for(let{from:t,to:r}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:o}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),o=Math.min(e.state.doc.lineAt(o).to,o+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=o:r.push({from:i,to:o});return r}(e,this.maxLength))pv(e.state.doc,this.regexp,t,r,(t,r)=>this.addMatch(r,e,t,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return(e.docChanged&&e.changes.iterChanges((t,i,o,s)=>{s>=e.view.viewport.from&&o<=e.view.viewport.to&&(n=Math.min(o,n),r=Math.max(s,r))}),e.viewportMoved||r-n>1e3)?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let i of e.visibleRanges){let o=Math.max(i.from,n),s=Math.min(i.to,r);if(s>o){let n=e.state.doc.lineAt(o),r=n.to<s?e.state.doc.lineAt(s):n,l=Math.max(i.from,n.from),a=Math.min(i.to,r.to);if(this.boundary){for(;o>n.from;o--)if(this.boundary.test(n.text[o-1-n.from])){l=o;break}for(;s<r.to;s++)if(this.boundary.test(r.text[s-r.from])){a=s;break}}let c=[],u,h=(e,t,n)=>c.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=l-n.from;(u=this.regexp.exec(n.text))&&u.index<a-n.from;)this.addMatch(u,e,u.index+n.from,h);else pv(e.state.doc,this.regexp,l,a,(t,n)=>this.addMatch(n,e,t,h));t=t.update({filterFrom:l,filterTo:a,filter:(e,t)=>e<l||t>a,add:c})}}return t}}let py=null!=/x/.unicode?"gu":"g",px=RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]",py),pw={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},pC=null,pS=cU.define({combine(e){let t=ub(e,{render:null,specialChars:px,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==pC&&"undefined"!=typeof document&&document.body){let t=document.body.style;pC=(null!=(e=t.tabSize)?e:t.MozTabSize)!=null}return pC||!1}())&&(t.specialChars=RegExp(" |"+t.specialChars.source,py)),t.addSpecialChars&&(t.specialChars=RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,py)),t}}),pk=null;class pM extends hZ{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){var t;let n=(t=this.code)>=32?"•":10==t?"␤":String.fromCharCode(9216+t),r=e.state.phrase("Control character")+" "+(pw[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let o=document.createElement("span");return o.textContent=n,o.title=r,o.setAttribute("aria-label",r),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class pT extends hZ{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}let pD=hj.line({class:"cm-activeLine"}),pA=db.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(pD.range(i.from)),t=i.from)}return hj.set(n)}},{decorations:e=>e.decorations});class pR extends hZ{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?uQ(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=u3(t[0],"rtl"!=n.direction),i=parseInt(n.lineHeight);return r.bottom-r.top>1.5*i?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}}function pP(e,t){var n;let r,i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),o=e.state.doc.lineAt(i),s=i-o.from,l=s>2e3?-1:s==o.length?(n=t.clientX,(r=e.coordsAtPos(e.viewport.from))?Math.round(Math.abs((r.left-n)/e.defaultCharacterWidth)):-1):uL(o.text,e.state.tabSize,i-o.from);return{line:o.number,col:l,off:s}}let pO={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},pI={style:"cursor: crosshair"},pE="-10000px";class pZ{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let o=[],s=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],l=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(l=e)}if(l<0)o[n]=this.createTooltipView(r,n?o[n-1]:null),s&&(s[n]=!!r.above);else{let r=o[n]=this.tooltipViews[l];s&&(s[n]=t[l]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)0>o.indexOf(e)&&(this.removeTooltipView(e),null==(n=e.destroy)||n.call(e));return t&&(s.forEach((e,n)=>t[n]=e),t.length=s.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function pL(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}let pj=cU.define({combine:e=>{var t,n,r;return{position:hS.ios?"absolute":(null==(t=e.find(e=>e.position))?void 0:t.position)||"fixed",parent:(null==(n=e.find(e=>e.parent))?void 0:n.parent)||null,tooltipSpace:(null==(r=e.find(e=>e.tooltipSpace))?void 0:r.tooltipSpace)||pL}}}),pB=new WeakMap,pF=db.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(pj);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new pZ(e,pz,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver)for(let e of(this.intersectionObserver.disconnect(),this.manager.tooltipViews))this.intersectionObserver.observe(e.dom)}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(pj);if(r.position!=this.position&&!this.madeAbsolute){for(let e of(this.position=r.position,this.manager.tooltipViews))e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){for(let e of(this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer(),this.manager.tooltipViews))this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=pE,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;for(let t of(this.view.win.removeEventListener("resize",this.measureSoon),this.manager.tooltipViews))t.dom.remove(),null==(e=t.destroy)||e.call(t);this.parent&&this.container.remove(),null==(t=this.resizeObserver)||t.disconnect(),null==(n=this.intersectionObserver)||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(hS.gecko)n=e.offsetParent!=this.container.ownerDocument.body;else if(e.style.top==pE&&"0px"==e.style.left){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=dA(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(pj).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute)for(let e of(this.madeAbsolute=!0,this.position="absolute",this.manager.tooltipViews))e.dom.style.position="absolute";let{visible:n,space:r,scaleX:i,scaleY:o}=e,s=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:u}=c,h=e.pos[l],d=e.size[l];if(!h||!1!==a.clip&&(h.bottom<=Math.max(n.top,r.top)||h.top>=Math.min(n.bottom,r.bottom)||h.right<Math.max(n.left,r.left)-.1||h.left>Math.min(n.right,r.right)+.1)){u.style.top=pE;continue}let f=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=7*!!f,m=d.right-d.left,g=null!=(t=pB.get(c))?t:d.bottom-d.top,v=c.offset||pH,b=this.view.textDirection==hU.LTR,y=d.width>r.right-r.left?b?r.left:r.right-d.width:b?Math.max(r.left,Math.min(h.left-14*!!f+v.x,r.right-m)):Math.min(Math.max(r.left,h.left-m+14*!!f-v.x),r.right-m),x=this.above[l];!a.strictSide&&(x?h.top-g-p-v.y<r.top:h.bottom+g+p+v.y>r.bottom)&&x==r.bottom-h.bottom>h.top-r.top&&(x=this.above[l]=!x);let w=(x?h.top-r.top:r.bottom-h.bottom)-p;if(w<g&&!1!==c.resize){if(w<this.view.defaultLineHeight){u.style.top=pE;continue}pB.set(c,g),u.style.height=(g=w)/o+"px"}else u.style.height&&(u.style.height="");let C=x?h.top-g-p-v.y:h.bottom+p+v.y,S=y+m;if(!0!==c.overlap)for(let e of s)e.left<S&&e.right>y&&e.top<C+g&&e.bottom>C&&(C=x?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(u.style.top=(C-e.parent.top)/o+"px",pV(u,(y-e.parent.left)/i)):(u.style.top=C/o+"px",pV(u,y/i)),f){let e=h.left+(b?v.x:-v.x)-(y+14-7);f.style.left=e/i+"px"}!0!==c.overlap&&s.push({left:y,top:C,right:S,bottom:C+g}),u.classList.toggle("cm-tooltip-above",x),u.classList.toggle("cm-tooltip-below",!x),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView)&&(this.inView=this.view.inView,!this.inView))for(let e of this.manager.tooltipViews)e.dom.style.top=pE}},{eventObservers:{scroll(){this.maybeMeasure()}}});function pV(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}let pN=fY.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),pH={x:0,y:0},pz=cU.define({enables:[pF,pN]}),p$=cU.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class pW{static create(e){return new pW(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new pZ(e,p$,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null==(e=t.destroy)||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(void 0!==r){if(void 0===t)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}let p_=pz.compute([p$],e=>{let t=e.facet(p$);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!=(t=e.end)?t:e.pos})),create:pW.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class pq{constructor(e,t,n,r,i){this.view=e,this.source=t,this.field=n,this.setHover=r,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.nearest(t.target);if(!n)return;let r,i=1;if(n instanceof hT)r=n.posAtStart;else{if(null==(r=e.posAtCoords(t)))return;let n=e.coordsAtPos(r);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let o=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),s=o&&o.dir==hU.RTL?-1:1;i=t.x<n.left?-s:s}let o=this.source(e,r,i);if(null==o?void 0:o.then){let t=this.pending={pos:r};o.then(n=>{this.pending==t&&(this.pending=null,n&&!(Array.isArray(n)&&!n.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))},t=>dp(e.state,t,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(pF),t=e?e.manager.tooltips.findIndex(e=>e.create==pW.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:i}=this;if(r.length&&i&&!function(e,t){let{left:n,right:r,top:i,bottom:o}=e.getBoundingClientRect(),s;if(s=e.querySelector(".cm-tooltip-arrow")){let e=s.getBoundingClientRect();i=Math.min(e.top,i),o=Math.max(e.bottom,o)}return t.clientX>=n-4&&t.clientX<=r+4&&t.clientY>=i-4&&t.clientY<=o+4}(i.dom,e)||this.pending){let{pos:i}=r[0]||this.pending,o=null!=(n=null==(t=r[0])?void 0:t.end)?n:i;(i==o?this.view.posAtCoords(this.lastMove)!=i:!function(e,t,n,r,i,o){let s=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(s.left>r||s.right<r||s.top>i||Math.min(s.bottom,l)<i)return!1;let a=e.posAtCoords({x:r,y:i},!1);return a>=t&&a<=n}(this.view,i,o,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function pG(e,t){let n=e.plugin(pF);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}let pU=uc.define(),pK=cU.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function pY(e,t){let n=e.plugin(pX),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}let pX=db.fromClass(class{constructor(e){this.input=e.state.facet(p0),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(pK);for(let n of(this.top=new pQ(e,!0,t.topContainer),this.bottom=new pQ(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top)),this.panels))n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(e){let t=e.state.facet(pK);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new pQ(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new pQ(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(p0);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],o=[],s=[];for(let n of t){let t=this.specs.indexOf(n),l;t<0?(l=n(e.view),s.push(l)):(l=this.panels[t]).update&&l.update(e),r.push(l),(l.top?i:o).push(l)}for(let e of(this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(o),s))e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>fY.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class pQ{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&0>e.indexOf(t)&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=pJ(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=pJ(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function pJ(e){let t=e.nextSibling;return e.remove(),t}let p0=cU.define({enables:pX});class p1 extends uy{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}p1.prototype.elementClass="",p1.prototype.toDOM=void 0,p1.prototype.mapMode=cL.TrackBefore,p1.prototype.startSide=p1.prototype.endSide=-1,p1.prototype.point=!0;let p2=cU.define(),p5=cU.define(),p3={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>uS.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},p8=cU.define();function p4(e){return[p9(),p8.of(Object.assign(Object.assign({},p3),e))]}let p6=cU.define({combine:e=>e.some(e=>e)});function p9(e){let t=[p7];return e&&!1===e.fixed&&t.push(p6.of(!0)),t}let p7=db.fromClass(class{constructor(e){for(let t of(this.view=e,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(p8).map(t=>new mr(e,t)),this.gutters))this.dom.appendChild(t.dom);this.fixed=!e.state.facet(p6),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}e.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(p6)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&this.dom.remove();let n=uS.iter(this.view.state.facet(p2),this.view.viewport.from),r=[],i=this.gutters.map(e=>new mn(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let o of e.type)if(o.type==hL.Text&&t){for(let e of(mt(n,r,o.from),i))e.line(this.view,o,r);t=!1}else if(o.widget)for(let e of i)e.widget(this.view,o)}else if(e.type==hL.Text)for(let t of(mt(n,r,e.from),i))t.line(this.view,e,r);else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(e){let t=e.startState.facet(p8),n=e.state.facet(p8),r=e.docChanged||e.heightChanged||e.viewportChanged||!uS.eq(e.startState.facet(p2),e.state.facet(p2),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new mr(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),0>i.indexOf(e)&&e.destroy();for(let e of i)this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove()}},{provide:e=>fY.scrollMargins.of(t=>{let n=t.plugin(e);return n&&0!=n.gutters.length&&n.fixed?t.textDirection==hU.LTR?{left:n.dom.offsetWidth*t.scaleX}:{right:n.dom.offsetWidth*t.scaleX}:null})});function me(e){return Array.isArray(e)?e:[e]}function mt(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class mn{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=uS.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let t=new mi(e,o,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,o,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];mt(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let o=this.gutter;(0!=r.length||o.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(p5)){let i=n(e,t.widget,t);i&&(r||(r=[])).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class mr{constructor(e,t){for(let n in this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),t.domEventHandlers)this.dom.addEventListener(n,r=>{let i=r.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let e=i.getBoundingClientRect();o=(e.top+e.bottom)/2}else o=r.clientY;let s=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,s,r)&&r.preventDefault()});this.markers=me(t.markers(e)),t.initialSpacer&&(this.spacer=new mi(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=me(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!uS.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class mi{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),!function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,r)&&this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let i=0,o=0;;){let s=o,l=i<t.length?t[i++]:null,a=!1;if(l){let e=l.elementClass;e&&(n+=" "+e);for(let e=o;e<this.markers.length;e++)if(this.markers[e].compare(l)){s=e,a=!0;break}}else s=this.markers.length;for(;o<s;){let e=this.markers[o++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!l)break;l.toDOM&&(a?r=r.nextSibling:this.dom.insertBefore(l.toDOM(e),r)),a&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}let mo=cU.define(),ms=cU.define(),ml=cU.define({combine:e=>ub(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})});class ma extends p1{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function mc(e,t){return e.state.facet(ml).formatNumber(t,e.state)}let mu=p8.compute([ml],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(mo),lineMarker:(e,t,n)=>n.some(e=>e.toDOM)?null:new ma(mc(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let r of e.state.facet(ms)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(ml)!=e.state.facet(ml),initialSpacer:e=>new ma(mc(e,mh(e.state.doc.lines))),updateSpacer(e,t){let n=mc(t.view,mh(t.view.state.doc.lines));return n==e.number?e:new ma(n)},domEventHandlers:e.facet(ml).domEventHandlers}));function mh(e){let t=9;for(;t<e;)t=10*t+9;return t}let md=new class extends p1{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},mf=p2.compute(["selection"],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(md.range(i)))}return uS.of(t)}),mp=0;class mm{constructor(e,t){this.from=e,this.to=t}}class mg{constructor(e={}){this.id=mp++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=my.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}mg.closedBy=new mg({deserialize:e=>e.split(" ")}),mg.openedBy=new mg({deserialize:e=>e.split(" ")}),mg.group=new mg({deserialize:e=>e.split(" ")}),mg.isolate=new mg({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw RangeError("Invalid value for isolate: "+e);return e||"auto"}}),mg.contextHash=new mg({perNode:!0}),mg.lookAhead=new mg({perNode:!0}),mg.mounted=new mg({perNode:!0});class mv{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[mg.mounted.id]}}let mb=Object.create(null);class my{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):mb,n=!!e.top|2*!!e.skipped|4*!!e.error|8*(null==e.name),r=new my(e.name||"",t,e.id,n);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(r)),n){if(n[0].perNode)throw RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(mg.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return e=>{for(let n=e.prop(mg.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}}my.none=new my("",Object.create(null),0,8);class mx{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let r=null;for(let t of e){let e=t(n);e&&(r||(r=Object.assign({},n.props)),r[e[0].id]=e[1])}t.push(r?new my(n.name,r,n.id,n.flags):n)}return new mx(t)}}let mw=new WeakMap,mC=new WeakMap;(v=k||(k={}))[v.ExcludeBuffers=1]="ExcludeBuffers",v[v.IncludeAnonymous=2]="IncludeAnonymous",v[v.IgnoreMounts=4]="IgnoreMounts",v[v.IgnoreOverlays=8]="IgnoreOverlays";class mS{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length)for(let[e,t]of(this.props=Object.create(null),i))this.props["number"==typeof e?e:e.id]=t}toString(){let e=mv.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new mj(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new mj(mw.get(this)||this.topNode);return r.moveTo(e,t),mw.set(this,r._tree),r}get topNode(){return new mR(this,0,0,null)}resolve(e,t=0){let n=mD(mw.get(this)||this.topNode,e,t,!1);return mw.set(this,n),n}resolveInner(e,t=0){let n=mD(mC.get(this)||this.topNode,e,t,!0);return mC.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof mR?r:r.context.parent;e;e=e.parent)if(e.index<0){let o=e.parent;(i||(i=[r])).push(o.resolve(t,n)),e=o}else{let o=mv.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let s=new mR(o.tree,o.overlay[0].from+e.from,-1,e);(i||(i=[r])).push(mD(s,t,n,!1))}}return i?mZ(i):r}(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,o=e.mode||0,s=(o&k.IncludeAnonymous)>0;for(let e=this.cursor(o|k.IncludeAnonymous);;){let o=!1;if(e.from<=i&&e.to>=r&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;o=!0}for(;o&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;o=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:mN(my.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new mS(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new mS(my.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=1024,reused:o=[],minRepeatType:s=r.types.length}=e,l=Array.isArray(n)?new mk(n,n.length):n,a=r.types,c=0,u=0;function h(e,t,n,i,o,s,l,a,c){let u=[],h=[];for(;e.length>i;)u.push(e.pop()),h.push(t.pop()+n-o);e.push(d(r.types[l],u,h,s-o,a-s,c)),t.push(o-n)}function d(e,t,n,r,i,o,s){if(o){let e=[mg.contextHash,o];s=s?[e].concat(s):[e]}if(i>25){let e=[mg.lookAhead,i];s=s?[e].concat(s):[e]}return new mS(e,t,n,r,s)}let f=[],p=[];for(;l.pos>0;)!function e(t,n,f,p,m,g){let{id:v,start:b,end:y,size:x}=l,w=u,C=c;for(;x<0;){if(l.next(),-1==x){let e=o[v];f.push(e),p.push(b-t);return}if(-3==x){c=v;return}if(-4==x){u=v;return}else throw RangeError(`Unrecognized record size: ${x}`)}let S=a[v],k,M,T=b-t;if(y-b<=i&&(M=function(e,t){let n=l.fork(),r=0,o=0,a=0,c=n.end-i,u={size:0,start:0,skip:0};n:for(let i=n.pos-e;n.pos>i;){let e=n.size;if(n.id==t&&e>=0){u.size=r,u.start=o,u.skip=a,a+=4,r+=4,n.next();continue}let l=n.pos-e;if(e<0||l<i||n.start<c)break;let h=4*(n.id>=s),d=n.start;for(n.next();n.pos>l;){if(n.size<0)if(-3==n.size)h+=4;else break n;else n.id>=s&&(h+=4);n.next()}o=d,r+=e,a+=h}return(t<0||r==e)&&(u.size=r,u.start=o,u.skip=a),u.size>4?u:void 0}(l.pos-n,m))){let e=new Uint16Array(M.size-M.skip),n=l.pos-M.size,i=e.length;for(;l.pos>n;)i=function e(t,n,r){let{id:i,start:o,end:a,size:h}=l;if(l.next(),h>=0&&i<s){let s=r;if(h>4){let i=l.pos-(h-4);for(;l.pos>i;)r=e(t,n,r)}n[--r]=s,n[--r]=a-t,n[--r]=o-t,n[--r]=i}else -3==h?c=i:-4==h&&(u=i);return r}(M.start,e,i);k=new mM(e,y-M.start,r),T=M.start-t}else{let t=l.pos-x;l.next();let n=[],o=[],a=v>=s?v:-1,c=0,u=y;for(;l.pos>t;)a>=0&&l.id==a&&l.size>=0?(l.end<=u-i&&(h(n,o,b,c,l.end,u,a,w,C),c=n.length,u=l.end),l.next()):g>2500?function(e,t,n,o){let s=[],a=0,c=-1;for(;l.pos>t;){let{id:e,start:t,end:n,size:r}=l;if(r>4)l.next();else if(c>-1&&t<c)break;else c<0&&(c=n-i),s.push(e,t,n),a++,l.next()}if(a){let t=new Uint16Array(4*a),i=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-i,t[n++]=s[e+2]-i,t[n++]=n;n.push(new mM(t,s[2]-i,r)),o.push(i-e)}}(b,t,n,o):e(b,t,n,o,a,g+1);if(a>=0&&c>0&&c<n.length&&h(n,o,b,c,b,u,a,w,C),n.reverse(),o.reverse(),a>-1&&c>0){let e=function(e,t){return(n,r,i)=>{let o=0,s=n.length-1,l,a;if(s>=0&&(l=n[s])instanceof mS){if(!s&&l.type==e&&l.length==i)return l;(a=l.prop(mg.lookAhead))&&(o=r[s]+l.length+a)}return d(e,n,r,i,o,t)}}(S,C);k=mN(S,n,o,0,n.length,0,y-b,e,e)}else k=d(S,n,o,y-b,w-y,C)}f.push(k),p.push(T)}(e.start||0,e.bufferStart||0,f,p,-1,0);let m=null!=(t=e.length)?t:f.length?p[0]+f[0].length:0;return new mS(a[e.topID],f.reverse(),p.reverse(),m)}(e)}}mS.empty=new mS(my.none,[],[],0);class mk{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new mk(this.buffer,this.index)}}class mM{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return my.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),n==(e+=4))return i;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,t,n,r,i){let{buffer:o}=this,s=-1;for(let l=e;l!=t&&(!mT(i,r,o[l+1],o[l+2])||(s=l,!(n>0)));l=o[l+3]);return s}slice(e,t,n){let r=this.buffer,i=new Uint16Array(t-e),o=0;for(let s=e,l=0;s<t;){i[l++]=r[s++],i[l++]=r[s++]-n;let t=i[l++]=r[s++]-n;i[l++]=r[s++]-e,o=Math.max(o,t)}return new mM(i,o,this.set)}}function mT(e,t,n,r){switch(e){case -2:return n<t;case -1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function mD(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof mR&&e.index<0?null:e.parent;if(!t)return e;e=t}let o=r?0:k.IgnoreOverlays;if(r)for(let r=e,s=r.parent;s;s=(r=s).parent)r instanceof mR&&r.index<0&&(null==(i=s.enter(t,n,o))?void 0:i.from)!=r.from&&(e=s);for(;;){let r=e.enter(t,n,o);if(!r)return e;e=r}}class mA{cursor(e=0){return new mj(this,e)}getChild(e,t=null,n=null){let r=mP(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return mP(this,e,t,n)}resolve(e,t=0){return mD(this,e,t,!1)}resolveInner(e,t=0){return mD(this,e,t,!0)}matchContext(e){return mO(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class mR extends mA{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,r,i=0){for(let o=this;;){for(let{children:s,positions:l}=o._tree,a=t>0?s.length:-1;e!=a;e+=t){let a=s[e],c=l[e]+o.from;if(mT(r,n,c,c+a.length)){if(a instanceof mM){if(i&k.ExcludeBuffers)continue;let s=a.findChild(0,a.buffer.length,t,n-c,r);if(s>-1)return new mE(new mI(o,a,e,c),null,s)}else if(i&k.IncludeAnonymous||!a.type.isAnonymous||mB(a)){let s;if(!(i&k.IgnoreMounts)&&(s=mv.get(a))&&!s.overlay)return new mR(s.tree,c,e,o);let l=new mR(a,c,e,o);return i&k.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?a.children.length-1:0,t,n,r)}}}if(i&k.IncludeAnonymous||!o.type.isAnonymous||(e=o.index>=0?o.index+t:t<0?-1:o._parent._tree.children.length,!(o=o._parent)))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let r;if(!(n&k.IgnoreOverlays)&&(r=mv.get(this._tree))&&r.overlay){let n=e-this.from;for(let{from:e,to:i}of r.overlay)if((t>0?e<=n:e<n)&&(t<0?i>=n:i>n))return new mR(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function mP(e,t,n,r){let i=e.cursor(),o=[];if(!i.firstChild())return o;if(null!=n){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return o}for(;;){if(null!=r&&i.type.is(r))return o;if(i.type.is(t)&&o.push(i.node),!i.nextSibling())return null==r?o:[]}}function mO(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class mI{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class mE extends mA{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return i<0?null:new mE(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&k.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new mE(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new mE(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new mE(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let o=n.buffer[this.index+1];e.push(n.slice(r,i,o)),t.push(0)}return new mS(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function mZ(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof mR&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new mL(i,n)}class mL{constructor(e,t){this.heads=e,this.node=t}get next(){return mZ(this.heads)}}class mj{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof mR)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return!!e&&(e instanceof mR?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?!(n&k.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&k.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&k.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&k.IncludeAnonymous||e instanceof mM||!e.type.isAnonymous||mB(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)n:for(let r=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=i+1;break n}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new mE(this.buffer,t,this.stack[e]);return this.bufferNode=new mE(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return mO(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return mO(this._tree,e,r);let o=n[t.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function mB(e){return e.children.some(e=>e instanceof mM||!e.type.isAnonymous||mB(e))}let mF=new WeakMap;function mV(e,t){if(!e.isAnonymous||t instanceof mM||t.type!=e)return 1;let n=mF.get(t);if(null==n){for(let r of(n=1,t.children)){if(r.type!=e||!(r instanceof mS)){n=1;break}n+=mV(e,r)}mF.set(t,n)}return n}function mN(e,t,n,r,i,o,s,l,a){let c=0;for(let n=r;n<i;n++)c+=mV(e,t[n]);let u=Math.ceil(1.5*c/8),h=[],d=[];return!function t(n,r,i,s,l){for(let c=i;c<s;){let i=c,f=r[c],p=mV(e,n[c]);for(c++;c<s;c++){let t=mV(e,n[c]);if(p+t>=u)break;p+=t}if(c==i+1){if(p>u){let e=n[i];t(e.children,e.positions,0,e.children.length,r[i]+l);continue}h.push(n[i])}else{let t=r[c-1]+n[c-1].length-f;h.push(mN(e,n,r,i,c,f,t,null,a))}d.push(f+l-o)}}(t,n,r,i,0),(l||a)(h,d,s)}class mH{constructor(e,t,n,r,i=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|2*!!o}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let r=[new mH(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&r.push(n);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],i=1,o=e.length?e[0]:null;for(let s=0,l=0,a=0;;s++){let c=s<t.length?t[s]:null,u=c?c.fromA:1e9;if(u-l>=n)for(;o&&o.from<u;){let t=o;if(l>=t.from||u<=t.to||a){let e=Math.max(t.from,l)-a,n=Math.min(t.to,u)-a;t=e>=n?null:new mH(e,n,t.tree,t.offset+a,s>0,!!c)}if(t&&r.push(t),o.to>u)break;o=i<e.length?e[i++]:null}if(!c)break;l=c.toA,a=c.toA-c.toB}return r}}class mz{startParse(e,t,n){return"string"==typeof e&&(e=new m$(e)),n=n?n.length?n.map(e=>new mm(e.from,e.to)):[new mm(0,0)]:[new mm(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}}class m${constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new mg({perNode:!0});let mW=0;class m_{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=mW++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){if(e instanceof m_&&(t=e),null==t?void 0:t.base)throw Error("Can not derive from a modified tag");let n=new m_("string"==typeof e?e:"?",[],null,[]);if(n.set.push(n),t)for(let e of t.set)n.set.push(e);return n}static defineModifier(e){let t=new mG(e);return e=>e.modified.indexOf(t)>-1?e:mG.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let mq=0;class mG{constructor(e){this.name=e,this.instances=[],this.id=mq++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{var r,i;return n.base==e&&(r=t,i=n.modified,r.length==i.length&&r.every((e,t)=>e==i[t]))});if(n)return n;let r=[],i=new m_(e.name,r,e,t);for(let e of t)e.instances.push(i);let o=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of o)r.push(mG.get(t,e));return i}}function mU(e){let t=Object.create(null);for(let n in e){let r=e[n];for(let e of(Array.isArray(r)||(r=[r]),n.split(" ")))if(e){let n=[],i=2,o=e;for(let t=0;;){if("..."==o&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!r)throw RangeError("Invalid path: "+e);if(n.push("*"==r[0]?"":'"'==r[0][0]?JSON.parse(r[0]):r[0]),(t+=r[0].length)==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){i=0;break}if("/"!=s)throw RangeError("Invalid path: "+e);o=e.slice(t)}let s=n.length-1,l=n[s];if(!l)throw RangeError("Invalid path: "+e);let a=new mY(r,i,s>0?n.slice(0,s):null);t[l]=a.sort(t[l])}}return mK.add(t)}let mK=new mg;class mY{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function mX(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+" "+r:r;break}}return t},scope:r}}mY.empty=new mY([],2,null);class mQ{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:o,from:s,to:l}=e;if(s>=n||l<=t)return;o.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(o)));let a=r,c=function(e){let t=e.type.prop(mK);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||mY.empty,u=function(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+" "+e:e)}return n}(i,c.tags);if(u&&(a&&(a+=" "),a+=u,1==c.mode&&(r+=(r?" ":"")+u)),this.startSpan(Math.max(t,s),a),c.opaque)return;let h=e.tree&&e.tree.prop(mg.mounted);if(h&&h.overlay){let o=e.node.enter(h.overlay[0].from+s,1),c=this.highlighters.filter(e=>!e.scope||e.scope(h.tree.type)),u=e.firstChild();for(let d=0,f=s;;d++){let p=d<h.overlay.length?h.overlay[d]:null,m=p?p.from+s:l,g=Math.max(t,f),v=Math.min(n,m);if(g<v&&u)for(;e.from<v&&(this.highlightRange(e,g,v,r,i),this.startSpan(Math.min(v,e.to),a),!(e.to>=m)&&e.nextSibling()););if(!p||m>n)break;(f=p.to+s)>t&&(this.highlightRange(o.cursor(),Math.max(t,p.from+s),Math.min(n,f),"",c),this.startSpan(Math.min(n,f),a))}u&&e.parent()}else if(e.firstChild()){h&&(r="");do{if(e.to<=t)continue;if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),a)}while(e.nextSibling());e.parent()}}}let mJ=m_.define,m0=mJ(),m1=mJ(),m2=mJ(m1),m5=mJ(m1),m3=mJ(),m8=mJ(m3),m4=mJ(m3),m6=mJ(),m9=mJ(m6),m7=mJ(),ge=mJ(),gt=mJ(),gn=mJ(gt),gr=mJ(),gi={comment:m0,lineComment:mJ(m0),blockComment:mJ(m0),docComment:mJ(m0),name:m1,variableName:mJ(m1),typeName:m2,tagName:mJ(m2),propertyName:m5,attributeName:mJ(m5),className:mJ(m1),labelName:mJ(m1),namespace:mJ(m1),macroName:mJ(m1),literal:m3,string:m8,docString:mJ(m8),character:mJ(m8),attributeValue:mJ(m8),number:m4,integer:mJ(m4),float:mJ(m4),bool:mJ(m3),regexp:mJ(m3),escape:mJ(m3),color:mJ(m3),url:mJ(m3),keyword:m7,self:mJ(m7),null:mJ(m7),atom:mJ(m7),unit:mJ(m7),modifier:mJ(m7),operatorKeyword:mJ(m7),controlKeyword:mJ(m7),definitionKeyword:mJ(m7),moduleKeyword:mJ(m7),operator:ge,derefOperator:mJ(ge),arithmeticOperator:mJ(ge),logicOperator:mJ(ge),bitwiseOperator:mJ(ge),compareOperator:mJ(ge),updateOperator:mJ(ge),definitionOperator:mJ(ge),typeOperator:mJ(ge),controlOperator:mJ(ge),punctuation:gt,separator:mJ(gt),bracket:gn,angleBracket:mJ(gn),squareBracket:mJ(gn),paren:mJ(gn),brace:mJ(gn),content:m6,heading:m9,heading1:mJ(m9),heading2:mJ(m9),heading3:mJ(m9),heading4:mJ(m9),heading5:mJ(m9),heading6:mJ(m9),contentSeparator:mJ(m6),list:mJ(m6),quote:mJ(m6),emphasis:mJ(m6),strong:mJ(m6),link:mJ(m6),monospace:mJ(m6),strikethrough:mJ(m6),inserted:mJ(),deleted:mJ(),changed:mJ(),invalid:mJ(),meta:gr,documentMeta:mJ(gr),annotation:mJ(gr),processingInstruction:mJ(gr),definition:m_.defineModifier("definition"),constant:m_.defineModifier("constant"),function:m_.defineModifier("function"),standard:m_.defineModifier("standard"),local:m_.defineModifier("local"),special:m_.defineModifier("special")};for(let e in gi){let t=gi[e];t instanceof m_&&(t.name=e)}mX([{tag:gi.link,class:"tok-link"},{tag:gi.heading,class:"tok-heading"},{tag:gi.emphasis,class:"tok-emphasis"},{tag:gi.strong,class:"tok-strong"},{tag:gi.keyword,class:"tok-keyword"},{tag:gi.atom,class:"tok-atom"},{tag:gi.bool,class:"tok-bool"},{tag:gi.url,class:"tok-url"},{tag:gi.labelName,class:"tok-labelName"},{tag:gi.inserted,class:"tok-inserted"},{tag:gi.deleted,class:"tok-deleted"},{tag:gi.literal,class:"tok-literal"},{tag:gi.string,class:"tok-string"},{tag:gi.number,class:"tok-number"},{tag:[gi.regexp,gi.escape,gi.special(gi.string)],class:"tok-string2"},{tag:gi.variableName,class:"tok-variableName"},{tag:gi.local(gi.variableName),class:"tok-variableName tok-local"},{tag:gi.definition(gi.variableName),class:"tok-variableName tok-definition"},{tag:gi.special(gi.variableName),class:"tok-variableName2"},{tag:gi.definition(gi.propertyName),class:"tok-propertyName tok-definition"},{tag:gi.typeName,class:"tok-typeName"},{tag:gi.namespace,class:"tok-namespace"},{tag:gi.className,class:"tok-className"},{tag:gi.macroName,class:"tok-macroName"},{tag:gi.propertyName,class:"tok-propertyName"},{tag:gi.operator,class:"tok-operator"},{tag:gi.comment,class:"tok-comment"},{tag:gi.meta,class:"tok-meta"},{tag:gi.invalid,class:"tok-invalid"},{tag:gi.punctuation,class:"tok-punctuation"}]);let go=new mg,gs=new mg;class gl{constructor(e,t,n=[],r=""){this.data=e,this.name=r,uv.prototype.hasOwnProperty("tree")||Object.defineProperty(uv.prototype,"tree",{get(){return gu(this)}}),this.parser=t,this.extension=[gy.of(this),uv.languageData.of((e,t,n)=>{let r=ga(e,t,n),i=r.type.prop(go);if(!i)return[];let o=e.facet(i),s=r.type.prop(gs);if(s){let i=r.resolve(t-r.from,n);for(let t of s)if(t.test(i,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(o)}}return o})].concat(n)}isActiveAt(e,t,n=-1){return ga(e,t,n).type.prop(go)==this.data}findRegions(e){let t=e.facet(gy);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(go)==this.data)return void n.push({from:t,to:t+e.length});let i=e.prop(mg.mounted);if(i){if(i.tree.prop(go)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}else if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof mS&&r(i,e.positions[n]+t)}};return r(gu(e),0),n}get allowsNesting(){return!0}}function ga(e,t,n){let r=e.facet(gy),i=gu(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,k.ExcludeBuffers))e.type.isTop&&(i=e);return i}gl.setState=uc.define();class gc extends gl{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){var t;let n=(t=e.languageData,cU.define({combine:t?e=>e.concat(t):void 0}));return new gc(n,e.parser.configure({props:[go.add(e=>e.isTop?n:void 0)]}),e.name)}configure(e,t){return new gc(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function gu(e){let t=e.field(gl.state,!1);return t?t.tree:mS.empty}class gh{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let gd=null;class gf{constructor(e,t,n=[],r,i,o,s,l){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new gf(e,t,[],mS.empty,0,n,[],null)}startParse(){return this.parser.startParse(new gh(this.state.doc),this.fragments)}work(e,t){return(null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=mS.empty&&this.isDone(null!=t?t:this.state.doc.length))?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r){if(this.fragments=this.withoutTempSkipped(mH.addTree(r,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!=(n=this.parse.stoppedAt)?n:this.state.doc.length,this.tree=r,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(mH.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=gd;gd=this;try{return e()}finally{gd=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=gp(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:i,viewport:o,skipped:s}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,n,r,i)=>t.push({fromA:e,toA:n,fromB:r,toB:i})),n=mH.applyChanges(n,t),r=mS.empty,i=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length)for(let t of(s=[],this.skipped)){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);n<r&&s.push({from:n,to:r})}}return new gf(this.parser,t,n,r,i,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=gp(this.fragments,n,r),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends mz{createParse(t,n,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let t=gd;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new mS(my.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return gd}}function gp(e,t,n){return mH.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class gm{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new gm(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=gf.create(e.facet(gy).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new gm(n)}}gl.state=c0.define({create:gm.init,update(e,t){for(let e of t.effects)if(e.is(gl.setState))return e.value;return t.startState.facet(gy)!=t.state.facet(gy)?gm.init(t.state):e.apply(t)}});let gg=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(gg=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});let gv="undefined"!=typeof navigator&&(null==(M=navigator.scheduling)?void 0:M.isInputPending)?()=>navigator.scheduling.isInputPending():null,gb=db.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(gl.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(gl.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=gg(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(gl.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!gv?Math.max(25,e.timeRemaining()-5):1e9),s=i.context.treeLen<r&&n.doc.length>r+1e3,l=i.context.work(()=>gv&&gv()||Date.now()>o,r+1e5*!s);this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:gl.setState.of(new gm(i.context))})),this.chunkBudget>0&&!(l&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>dp(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),gy=cU.define({combine:e=>e.length?e[0]:null,enables:e=>[gl.state,gb,fY.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class gx{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}let gw=cU.define(),gC=cU.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function gS(e){let t=e.facet(gC);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function gk(e,t){let n="",r=e.tabSize,i=e.facet(gC)[0];if(" "==i){for(;t>=r;)n+=" ",t-=r;i=" "}for(let e=0;e<t;e++)n+=i;return n}function gM(e,t){for(let n of(e instanceof uv&&(e=new gT(e)),e.state.facet(gw))){let r=n(e,t);if(void 0!==r)return r}let n=gu(e.state);return n.length>=t?function(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&(t.from!=r.node.from||t.type!=r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return gA(r,e,n)}(e,n,t):null}class gT{constructor(e,t={}){this.state=e,this.options=t,this.unit=gS(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;if(null!=r&&r>=n.from&&r<=n.to)if(i&&r==e)return{text:"",from:e};else if(t<0?r<e:r<=e)return{text:n.text.slice(r-n.from),from:r};else return{text:n.text.slice(0,r-n.from),from:n.from};return n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return uL(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}let gD=new mg;function gA(e,t,n){for(let r=e;r;r=r.next){let e=function(e){let t=e.type.prop(gD);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(mg.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>(function(e,t,n,r,i){let o=e.textAfter,s=o.match(/^\s*/)[0].length,l=r&&o.slice(s,s+r.length)==r||i==e.pos+s,a=t?function(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=null==i||i<=o.from?o.to:Math.min(o.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=s)return null;let e=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}(e):null;return a?l?e.column(a.from):e.column(a.to):e.baseIndent+(l?0:+e.unit)})(e,!0,1,void 0,n&&!(e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak)?t.from:void 0)}return null==e.parent?gR:null}(r.node);if(e)return e(gP.create(t,n,r))}return 0}function gR(){return 0}class gP extends gT{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new gP(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(function(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return gA(this.context.next,this.base,this.pos)}}function gO({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}let gI=cU.define(),gE=new mg;function gZ(e,t,n){for(let r of e.facet(gI)){let i=r(e,t,n);if(i)return i}return function(e,t,n){let r=gu(e);if(r.length<n)return null;let i=r.resolveStack(n,1),o=null;for(let s=i;s;s=s.next){let i=s.node;if(i.to<=n||i.from>n)continue;if(o&&i.from<t)break;let l=i.type.prop(gE);if(l&&(i.to<r.length-50||r.length==e.doc.length||!function(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}(i))){let r=l(i,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(o=r)}}return o}(e,t,n)}function gL(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}let gj=uc.define({map:gL}),gB=uc.define({map:gL});function gF(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}let gV=c0.define({create:()=>hj.none,update(e,t){for(let n of(e=e.map(t.changes),t.effects))if(n.is(gj)&&!function(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(g_),i=r?hj.replace({widget:new gK(r(t.state,n.value))}):gU;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(gB)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));if(t.selection){let n=!1,{head:r}=t.selection.main;e.between(r,r,(e,t)=>{e<r&&t>r&&(n=!0)}),n&&(e=e.update({filterFrom:r,filterTo:r,filter:(e,t)=>t<=r||e>=r}))}return e},provide:e=>fY.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if("number"!=typeof r||"number"!=typeof i)throw RangeError("Invalid JSON for fold state");t.push(gU.range(r,i))}return hj.set(t,!0)}});function gN(e,t,n){var r;let i=null;return null==(r=e.field(gV,!1))||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function gH(e,t){return e.field(gV,!1)?t:t.concat(uc.appendConfig.of(gq()))}function gz(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return fY.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}let g$=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of gF(e)){let n=gZ(e.state,t.from,t.to);if(n)return e.dispatch({effects:gH(e.state,[gj.of(n),gz(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(gV,!1))return!1;let t=[];for(let n of gF(e)){let r=gN(e.state,n.from,n.to);r&&t.push(gB.of(r),gz(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),o=gZ(t,i.from,i.to);o&&n.push(gj.of(o)),r=(o?e.lineBlockAt(o.to):i).to+1}return n.length&&e.dispatch({effects:gH(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(gV,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(gB.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],gW={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},g_=cU.define({combine:e=>ub(e,gW)});function gq(e){let t=[gV,gQ];return e&&t.push(g_.of(e)),t}function gG(e,t){let{state:n}=e,r=n.facet(g_),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=gN(e.state,n.from,n.to);r&&e.dispatch({effects:gB.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=i,o}let gU=hj.replace({widget:new class extends hZ{toDOM(e){return gG(e,null)}}});class gK extends hZ{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return gG(e,this.value)}}let gY={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class gX extends p1{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}let gQ=fY.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class gJ{constructor(e,t){let n;function r(e){let t=uN.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;let i="string"==typeof t.all?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof gl?e=>e.prop(go)==o.data:o?e=>e==o:void 0,this.style=mX(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new uN(n):null,this.themeType=t.themeType}static define(e,t){return new gJ(e,t||{})}}let g0=cU.define(),g1=cU.define({combine:e=>e.length?[e[0]]:null});function g2(e){let t=e.facet(g0);return t.length?t:e.facet(g1)}function g5(e,t){let n=[g3],r;return e instanceof gJ&&(e.module&&n.push(fY.styleModule.of(e.module)),r=e.themeType),(null==t?void 0:t.fallback)?n.push(g1.of(e)):r?n.push(g0.computeN([fY.darkTheme],t=>t.facet(fY.darkTheme)==("dark"==r)?[e]:[])):n.push(g0.of(e)),n}let g3=c2.high(db.fromClass(class{constructor(e){this.markCache=Object.create(null),this.tree=gu(e.state),this.decorations=this.buildDeco(e,g2(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=gu(e.state),n=g2(e.state),r=n!=g2(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return hj.none;let n=new uk;for(let{from:r,to:i}of e.visibleRanges)!function(e,t,n,r=0,i=e.length){let o=new mQ(r,Array.isArray(t)?t:[t],n);o.highlightRange(e.cursor(),r,i,"",o.highlighters),o.flush(i)}(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=hj.mark({class:r})))},r,i);return n.finish()}},{decorations:e=>e.decorations})),g8=gJ.define([{tag:gi.meta,color:"#404740"},{tag:gi.link,textDecoration:"underline"},{tag:gi.heading,textDecoration:"underline",fontWeight:"bold"},{tag:gi.emphasis,fontStyle:"italic"},{tag:gi.strong,fontWeight:"bold"},{tag:gi.strikethrough,textDecoration:"line-through"},{tag:gi.keyword,color:"#708"},{tag:[gi.atom,gi.bool,gi.url,gi.contentSeparator,gi.labelName],color:"#219"},{tag:[gi.literal,gi.inserted],color:"#164"},{tag:[gi.string,gi.deleted],color:"#a11"},{tag:[gi.regexp,gi.escape,gi.special(gi.string)],color:"#e40"},{tag:gi.definition(gi.variableName),color:"#00f"},{tag:gi.local(gi.variableName),color:"#30a"},{tag:[gi.typeName,gi.namespace],color:"#085"},{tag:gi.className,color:"#167"},{tag:[gi.special(gi.variableName),gi.macroName],color:"#256"},{tag:gi.definition(gi.propertyName),color:"#00c"},{tag:gi.comment,color:"#940"},{tag:gi.invalid,color:"#f00"}]),g4=fY.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),g6="()[]{}",g9=cU.define({combine:e=>ub(e,{afterCursor:!0,brackets:g6,maxScanDistance:1e4,renderMatch:vt})}),g7=hj.mark({class:"cm-matchingBracket"}),ve=hj.mark({class:"cm-nonmatchingBracket"});function vt(e){let t=[],n=e.matched?g7:ve;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}let vn=[c0.define({create:()=>hj.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],r=t.state.facet(g9);for(let e of t.state.selection.ranges){if(!e.empty)continue;let i=vs(t.state,e.head,-1,r)||e.head>0&&vs(t.state,e.head-1,1,r)||r.afterCursor&&(vs(t.state,e.head,1,r)||e.head<t.state.doc.length&&vs(t.state,e.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,t.state)))}return hj.set(n,!0)},provide:e=>fY.decorations.from(e)}),g4],vr=new mg;function vi(e,t,n){let r=e.prop(t<0?mg.openedBy:mg.closedBy);if(r)return r;if(1==e.name.length){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function vo(e){let t=e.type.prop(vr);return t?t(e.node):e}function vs(e,t,n,r={}){let i=r.maxScanDistance||1e4,o=r.brackets||g6,s=gu(e),l=s.resolveInner(t,n);for(let e=l;e;e=e.parent){let r=vi(e.type,n,o);if(r&&e.from<e.to){let i=vo(e);if(i&&(n>0?t>=i.from&&t<i.to:t>i.from&&t<=i.to))return function(e,t,n,r,i,o,s){let l=r.parent,a={from:i.from,to:i.to},c=0,u=null==l?void 0:l.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(0==c&&o.indexOf(u.type.name)>-1&&u.from<u.to){let e=vo(u);return{start:a,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}else if(vi(u.type,n,s))c++;else if(vi(u.type,-n,s)){if(0==c){let e=vo(u);return{start:a,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:a,matched:!1}}(0,0,n,e,i,r,o)}}return function(e,t,n,r,i,o,s){let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),a=s.indexOf(l);if(a<0||a%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let e=0;!u.next().done&&e<=o;){let o=u.value;n<0&&(e+=o.length);let l=t+e*n;for(let e=n>0?0:o.length-1,t=n>0?o.length:-1;e!=t;e+=n){let t=s.indexOf(o[e]);if(!(t<0)&&r.resolveInner(l+e,1).type==i)if(t%2==0==n>0)h++;else{if(1==h)return{start:c,end:{from:l+e,to:l+e+1},matched:t>>1==a>>1};h--}}n>0&&(e+=o.length)}return u.done?{start:c,matched:!1}:null}(e,t,n,s,l.type,i,o)}let vl=Object.create(null),va=[my.none],vc=[],vu=Object.create(null),vh=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])vh[e]=function(e,t){let n=[];for(let r of t.split(" ")){let t=[];for(let n of r.split(".")){let r=e[n]||gi[n];r?"function"==typeof r?t.length?t=t.map(r):vd(n,`Modifier ${n} used at start of tag`):t.length?vd(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:vd(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map(e=>e.id),o=vu[i];if(o)return o.id;let s=vu[i]=my.define({id:va.length,name:r,props:[mU({[r]:n})]});return va.push(s),s.id}(vl,t);function vd(e,t){vc.indexOf(e)>-1||(vc.push(e),console.warn(t))}function vf(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}hU.RTL,hU.LTR;let vp=vf(function(e,t,n=t.selection.ranges){let r=[],i=-1;for(let{from:e,to:o}of n){let n=r.length,s=1e9,l=vv(t,e).line;if(l){for(let n=e;n<=o;){let a=t.doc.lineAt(n);if(a.from>i&&(e==o||o>a.from)){i=a.from;let e=/^\s*/.exec(a.text)[0].length,t=e==a.length,n=a.text.slice(e,e+l.length)==l?e:-1;e<a.text.length&&e<s&&(s=e),r.push({line:a,comment:n,token:l,indent:e,empty:t,single:!1})}n=a.to+1}if(s<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=s);r.length==n+1&&(r[n].single=!0)}}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:o,single:s}of r)(s||!o)&&e.push({from:t.from+i,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,o=r+i.length;" "==t.text[o-t.from]&&o++,e.push({from:r,to:o})}return{changes:e}}return null},0),vm=vf(vb,0),vg=vf((e,t)=>vb(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}(t)),0);function vv(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}function vb(e,t,n=t.selection.ranges){let r=n.map(e=>vv(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>(function(e,{open:t,close:n},r,i){let o,s,l=e.sliceDoc(r-50,r),a=e.sliceDoc(i,i+50),c=/\s*$/.exec(l)[0].length,u=/^\s*/.exec(a)[0].length,h=l.length-c;if(l.slice(h-t.length,h)==t&&a.slice(u,u+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:i+u,margin:u&&1}};i-r<=100?o=s=e.sliceDoc(r,i):(o=e.sliceDoc(r,r+50),s=e.sliceDoc(i-50,i));let d=/^\s*/.exec(o)[0].length,f=/\s*$/.exec(s)[0].length,p=s.length-f-n.length;return o.slice(d,d+t.length)==t&&s.slice(p,p+n.length)==n?{open:{pos:r+d+t.length,margin:+!!/\s/.test(o.charAt(d+t.length))},close:{pos:i-f-n.length,margin:+!!/\s/.test(s.charAt(p-1))}}:null})(t,r[n],e.from,e.to));if(2!=e&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:o,close:s}=n;e.push({from:o.pos-i.open.length,to:o.pos+o.margin},{from:s.pos-s.margin,to:s.pos+i.close.length})}return{changes:e}}return null}let vy=us.define(),vx=us.define(),vw=cU.define(),vC=cU.define({combine:e=>ub(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),vS=c0.define({create:()=>vj.empty,update(e,t){let n=t.state.facet(vC),r=t.annotation(vy);if(r){let i=vR.fromTransaction(t,r.selection),o=r.side,s=0==o?e.undone:e.done;return s=i?vP(s,s.length,n.minDepth,i):vE(s,t.startState.selection),new vj(0==o?r.rest:s,0==o?s:r.rest)}let i=t.annotation(vx);if(("full"==i||"before"==i)&&(e=e.isolate()),!1===t.annotation(uu.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let o=vR.fromTransaction(t),s=t.annotation(uu.time),l=t.annotation(uu.userEvent);return o?e=e.addChanges(o,s,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,l,n.newGroupDelay)),("full"==i||"after"==i)&&(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new vj(e.done.map(vR.fromJSON),e.undone.map(vR.fromJSON))});function vk(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(vS,!1);if(!i)return!1;let o=i.pop(e,n,t);return!!o&&(r(o),!0)}}let vM=vk(0,!1),vT=vk(1,!1),vD=vk(0,!0),vA=vk(1,!0);class vR{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new vR(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null==(e=this.changes)?void 0:e.toJSON(),mapped:null==(t=this.mapped)?void 0:t.toJSON(),startSelection:null==(n=this.startSelection)?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new vR(e.changes&&cB.fromJSON(e.changes),[],e.mapped&&cj.fromJSON(e.mapped),e.startSelection&&c_.fromJSON(e.startSelection),e.selectionsAfter.map(c_.fromJSON))}static fromTransaction(e,t){let n=vI;for(let t of e.startState.facet(vw)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new vR(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,vI)}static selection(e){return new vR(void 0,vI,void 0,void 0,e)}}function vP(e,t,n,r){let i=e.slice(t+1>n+20?t-n-1:0,t);return i.push(r),i}function vO(e,t){return e.length?t.length?e.concat(t):e:t}let vI=[];function vE(e,t){if(!e.length)return[vR.selection([t])];{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),vP(e,e.length-1,1e9,n.setSelAfter(r)))}}function vZ(e,t){if(!e.length)return e;let n=e.length,r=vI;for(;n;){let i=function(e,t,n){let r=vO(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):vI,n);if(!e.changes)return vR.selection(r);let i=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new vR(i,uc.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[vR.selection(r)]:vI}let vL=/^(input\.type|delete)($|\.)/;class vj{constructor(e,t,n=0,r){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new vj(this.done,this.undone):this}addChanges(e,t,n,r,i){var o,s;let l,a,c=this.done,u=c[c.length-1];return new vj(c=u&&u.changes&&!u.changes.empty&&e.changes&&(!n||vL.test(n))&&(!u.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,(o=u.changes,s=e.changes,l=[],a=!1,o.iterChangedRanges((e,t)=>l.push(e,t)),s.iterChangedRanges((e,t,n,r)=>{for(let e=0;e<l.length;){let t=l[e++],i=l[e++];r>=t&&n<=i&&(a=!0)}}),a))||"input.type.compose"==n)?vP(c,c.length-1,r.minDepth,new vR(e.changes.compose(u.changes),vO(uc.mapEffects(e.effects,u.changes),u.effects),u.mapped,u.startSelection,vI)):vP(c,c.length,r.minDepth,e),vI,t,n)}addSelection(e,t,n,r){var i;let o=this.done.length?this.done[this.done.length-1].selectionsAfter:vI;return o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=o[o.length-1],i.ranges.length==e.ranges.length&&0===i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length)?this:new vj(vE(this.done,e),this.undone,t,n)}addMapping(e){return new vj(vZ(this.done,e),vZ(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||t.selection;if(n&&i.selectionsAfter.length){let n,s;return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:vy.of({side:e,rest:(n=r[r.length-1],(s=r.slice())[r.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),s),selection:o}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0})}{if(!i.changes)return null;let n=1==r.length?vI:r.slice(0,r.length-1);return i.mapped&&(n=vZ(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:vy.of({side:e,rest:n,selection:o}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}}}vj.empty=new vj(vI,vI);let vB=[{key:"Mod-z",run:vM,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:vT,preventDefault:!0},{linux:"Ctrl-Shift-z",run:vT,preventDefault:!0},{key:"Mod-u",run:vD,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:vA,preventDefault:!0}];function vF(e,t){return c_.create(e.ranges.map(t),e.mainIndex)}function vV(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function vN({state:e,dispatch:t},n){let r=vF(e.selection,n);return!r.eq(e.selection,!0)&&(t(vV(e,r)),!0)}function vH(e,t){return c_.cursor(t?e.to:e.from)}function vz(e,t){return vN(e,n=>n.empty?e.moveByChar(n,t):vH(n,t))}function v$(e){return e.textDirectionAt(e.state.selection.main.head)==hU.LTR}let vW=e=>vz(e,!v$(e)),v_=e=>vz(e,v$(e));function vq(e,t){return vN(e,n=>n.empty?e.moveByGroup(n,t):vH(n,t))}function vG(e,t,n){let r,i,o=gu(e).resolveInner(t.head),s=n?mg.closedBy:mg.openedBy;for(let r=t.head;;){let t=n?o.childAfter(r):o.childBefore(r);if(!t)break;!function(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}(e,t,s)?r=n?t.to:t.from:o=t}return i=o.type.prop(s)&&(r=n?vs(e,o.from,1):vs(e,o.to,-1))&&r.matched?n?r.end.to:r.end.from:n?o.to:o.from,c_.cursor(i,n?-1:1)}function vU(e,t){return vN(e,n=>{if(!n.empty)return vH(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}"undefined"!=typeof Intl&&Intl.Segmenter;let vK=e=>vU(e,!1),vY=e=>vU(e,!0);function vX(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(fY.scrollMargins)){let i=t(e);(null==i?void 0:i.top)&&(n=Math.max(null==i?void 0:i.top,n)),(null==i?void 0:i.bottom)&&(r=Math.max(null==i?void 0:i.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function vQ(e,t){let n,r=vX(e),{state:i}=e,o=vF(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):vH(n,t));if(o.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),l=s.top+r.marginTop,a=s.bottom-r.marginBottom;t&&t.top>l&&t.bottom<a&&(n=fY.scrollIntoView(o.main.head,{y:"start",yMargin:t.top-l}))}return e.dispatch(vV(i,o),{effects:n}),!0}let vJ=e=>vQ(e,!1),v0=e=>vQ(e,!0);function v1(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=c_.cursor(r.from+n))}return i}function v2(e,t){let n=vF(e.state.selection,e=>{let n=t(e);return c_.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(e.state.selection)&&(e.dispatch(vV(e.state,n)),!0)}function v5(e,t){return v2(e,n=>e.moveByChar(n,t))}let v3=e=>v5(e,!v$(e)),v8=e=>v5(e,v$(e));function v4(e,t){return v2(e,n=>e.moveByGroup(n,t))}function v6(e,t){return v2(e,n=>e.moveVertically(n,t))}let v9=e=>v6(e,!1),v7=e=>v6(e,!0);function be(e,t){return v2(e,n=>e.moveVertically(n,t,vX(e).height))}let bt=e=>be(e,!1),bn=e=>be(e,!0),br=({state:e,dispatch:t})=>(t(vV(e,{anchor:0})),!0),bi=({state:e,dispatch:t})=>(t(vV(e,{anchor:e.doc.length})),!0),bo=({state:e,dispatch:t})=>(t(vV(e,{anchor:e.selection.main.anchor,head:0})),!0),bs=({state:e,dispatch:t})=>(t(vV(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function bl(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:o}=r;if(i==o){let s=t(r);s<i?(n="delete.backward",s=ba(e,s,!1)):s>i&&(n="delete.forward",s=ba(e,s,!0)),i=Math.min(i,s),o=Math.max(o,s)}else i=ba(e,i,!1),o=ba(e,o,!0);return i==o?{range:r}:{changes:{from:i,to:o},range:c_.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?fY.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function ba(e,t,n){if(e instanceof fY)for(let r of e.state.facet(fY.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}let bc=(e,t,n)=>bl(e,r=>{let i=r.from,{state:o}=e,s=o.doc.lineAt(i),l,a;if(n&&!t&&i>s.from&&i<s.from+200&&!/[^ \t]/.test(l=s.text.slice(0,i-s.from))){if(" "==l[l.length-1])return i-1;let e=uL(l,o.tabSize)%gS(o)||gS(o);for(let t=0;t<e&&" "==l[l.length-1-t];t++)i--;a=i}else(a=cP(s.text,i-s.from,t,t)+s.from)==i&&s.number!=(t?o.doc.lines:1)?a+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(a-s.from,i-s.from))&&(a=cP(s.text,a-s.from,!1,!1)+s.from);return a}),bu=e=>bc(e,!1,!0),bh=e=>bc(e,!0,!1),bd=(e,t)=>bl(e,n=>{let r=n.head,{state:i}=e,o=i.doc.lineAt(r),s=i.charCategorizer(r);for(let e=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let l=cP(o.text,r-o.from,t)+o.from,a=o.text.slice(Math.min(r,l)-o.from,Math.max(r,l)-o.from),c=s(a);if(null!=e&&c!=e)break;(" "!=a||r!=n.head)&&(e=c),r=l}return r}),bf=e=>bd(e,!1);function bp(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(r.empty||r.to!=o.from||(o=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=o.to,e.ranges.push(r)}else t.push({from:i.from,to:o.to,ranges:[r]});n=o.number+1}return t}function bm(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of bp(e)){if(n?t.to==e.doc.length:0==t.from)continue;let o=e.doc.lineAt(n?t.to+1:t.from-1),s=o.length+1;if(n)for(let n of(r.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak}),t.ranges))i.push(c_.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)));else for(let n of(r.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text}),t.ranges))i.push(c_.range(n.anchor-s,n.head-s))}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:c_.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function bg(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of bp(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}let bv=by(!1),bb=by(!0);function by(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,o=t.doc.lineAt(r),s=!e&&r==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=gu(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),o;return r&&i&&r.to<=t&&i.from>=t&&(o=r.type.prop(mg.closedBy))&&o.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}(t,r);e&&(r=i=(i<=o.to?o:t.doc.lineAt(i)).to);let l=new gT(t,{simulateBreak:r,simulateDoubleBreak:!!s}),a=gM(l,r);for(null==a&&(a=uL(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;s?{from:r,to:i}=s:r>o.from&&r<o.from+100&&!/\S/.test(o.text.slice(0,r))&&(r=o.from);let c=["",gk(t,a)];return s&&c.push(gk(t,l.lineIndent(o.from,-1))),{changes:{from:r,to:i,insert:cw.of(c)},range:c_.cursor(r+1+c[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function bx(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let s=e.doc.lineAt(o);s.number>n&&(r.empty||r.to>s.from)&&(t(s,i,r),n=s.number),o=s.to+1}let o=e.changes(i);return{changes:i,range:c_.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}let bw=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(bx(e,(t,n)=>{n.push({from:t.from,insert:e.facet(gC)})}),{userEvent:"input.indent"})),!0),bC=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(bx(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=uL(r,e.tabSize),o=0,s=gk(e,Math.max(0,i-gS(e)));for(;o<r.length&&o<s.length&&r.charCodeAt(o)==s.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+r.length,insert:s.slice(o)})}),{userEvent:"delete.dedent"})),!0),bS=[{key:"Ctrl-b",run:vW,shift:v3,preventDefault:!0},{key:"Ctrl-f",run:v_,shift:v8},{key:"Ctrl-p",run:vK,shift:v9},{key:"Ctrl-n",run:vY,shift:v7},{key:"Ctrl-a",run:e=>vN(e,t=>c_.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>v2(e,t=>c_.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>vN(e,t=>c_.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>v2(e,t=>c_.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:bh},{key:"Ctrl-h",run:bu},{key:"Ctrl-k",run:e=>bl(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:bf},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:cw.of(["",""])},range:c_.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:cP(r.text,n-r.from,!1)+r.from,o=n==r.to?n+1:cP(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(i,n))},range:c_.cursor(o)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:v0}],bk=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>vN(e,t=>vG(e.state,t,!v$(e))),shift:e=>v2(e,t=>vG(e.state,t,!v$(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>vN(e,t=>vG(e.state,t,v$(e))),shift:e=>v2(e,t=>vG(e.state,t,v$(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>bm(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>bg(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>bm(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>bg(e,t,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=c_.create([n.main]):n.main.empty||(r=c_.create([c_.cursor(n.main.head)])),!!r&&(t(vV(e,r)),!0)}},{key:"Mod-Enter",run:bb},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=bp(e).map(({from:t,to:n})=>c_.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:c_.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=vF(e.selection,t=>{let n=gu(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return c_.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(vV(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:bC},{key:"Mod-]",run:bw},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new gT(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=bx(e,(t,i,o)=>{let s=gM(r,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let l=/^\s*/.exec(t.text)[0],a=gk(e,s);(l!=a||o.from<t.from+l.length)&&(n[t.from]=s,i.push({from:t.from,to:t.from+l.length,insert:a}))});return i.changes.empty||t(e.update(i,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(bp(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=vF(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>{let n,r;return n=!1,r=vF(e.selection,t=>{let r=vs(e,t.head,-1)||vs(e,t.head,1)||t.head>0&&vs(e,t.head-1,1)||t.head<e.doc.length&&vs(e,t.head+1,-1);if(!r||!r.end)return t;n=!0;let i=r.start.from==t.head?r.end.to:r.end.from;return c_.cursor(i)}),!!n&&(t(vV(e,r)),!0)}},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=vv(e.state,n.from);return r.line?vp(e):!!r.block&&vg(e)}},{key:"Alt-A",run:vm},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:vW,shift:v3,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>vq(e,!v$(e)),shift:e=>v4(e,!v$(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>vN(e,t=>v1(e,t,!v$(e))),shift:e=>v2(e,t=>v1(e,t,!v$(e))),preventDefault:!0},{key:"ArrowRight",run:v_,shift:v8,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>vq(e,v$(e)),shift:e=>v4(e,v$(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>vN(e,t=>v1(e,t,v$(e))),shift:e=>v2(e,t=>v1(e,t,v$(e))),preventDefault:!0},{key:"ArrowUp",run:vK,shift:v9,preventDefault:!0},{mac:"Cmd-ArrowUp",run:br,shift:bo},{mac:"Ctrl-ArrowUp",run:vJ,shift:bt},{key:"ArrowDown",run:vY,shift:v7,preventDefault:!0},{mac:"Cmd-ArrowDown",run:bi,shift:bs},{mac:"Ctrl-ArrowDown",run:v0,shift:bn},{key:"PageUp",run:vJ,shift:bt},{key:"PageDown",run:v0,shift:bn},{key:"Home",run:e=>vN(e,t=>v1(e,t,!1)),shift:e=>v2(e,t=>v1(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:br,shift:bo},{key:"End",run:e=>vN(e,t=>v1(e,t,!0)),shift:e=>v2(e,t=>v1(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:bi,shift:bs},{key:"Enter",run:bv,shift:bv},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:bu,shift:bu},{key:"Delete",run:bh},{key:"Mod-Backspace",mac:"Alt-Backspace",run:bf},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>bd(e,!0)},{mac:"Mod-Backspace",run:e=>bl(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)})},{mac:"Mod-Delete",run:e=>bl(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})}].concat(bS.map(e=>({mac:e.key,run:e.run,shift:e.shift})))),bM={key:"Tab",run:bw,shift:bC};function bT(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];"string"==typeof i?e.setAttribute(r,i):null!=i&&(e[r]=i)}t++}for(;t<arguments.length;t++)!function e(t,n){if("string"==typeof n)t.appendChild(document.createTextNode(n));else if(null==n);else if(null!=n.nodeType)t.appendChild(n);else if(Array.isArray(n))for(var r=0;r<n.length;r++)e(t,n[r]);else throw RangeError("Unsupported child node: "+n)}(e,arguments[t]);return e}let bD="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class bA{constructor(e,t,n=0,r=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(bD(e)):bD,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return -1;this.bufferPos=0,this.buffer=this.iter.value}return cO(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=cI(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=cE(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let o=r.charCodeAt(e),s=this.match(o,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(s)return this.value=s,this;break}i==n&&e<t.length&&t.charCodeAt(e)==o&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],o=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,o=!0)),o||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(1==this.query.length?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}"undefined"!=typeof Symbol&&(bA.prototype[Symbol.iterator]=function(){return this});let bR={from:-1,to:-1,match:/.*/.exec("")},bP="gm"+(null==/x/.unicode?"":"u");class bO{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=bR,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new bZ(e,t,n,r,i);this.re=new RegExp(t,bP+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=bL(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=bL(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}let bI=new WeakMap;class bE{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=bI.get(e);if(!r||r.from>=n||r.to<=t){let r=new bE(t,e.sliceString(t,n));return bI.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:o}=r;return o>t&&(i=e.sliceString(t,o)+i,o=t),r.to<n&&(i+=e.sliceString(r.to,n)),bI.set(e,new bE(o,i)),new bE(t,i.slice(t-o,n-o))}}class bZ{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=bR,this.matchPos=bL(e,r),this.re=new RegExp(t,bP+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=bE.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=bL(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=bE.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function bL(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}function bj(e){let t=bT("input",{class:"cm-textfield",name:"line",value:String(e.state.doc.lineAt(e.state.selection.main.head).number)});function n(){let n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!n)return;let{state:r}=e,i=r.doc.lineAt(r.selection.main.head),[,o,s,l,a]=n,c=l?+l.slice(1):0,u=s?+s:i.number;if(s&&a){let e=u/100;o&&(e=e*("-"==o?-1:1)+i.number/r.doc.lines),u=Math.round(r.doc.lines*e)}else s&&o&&(u=u*("-"==o?-1:1)+i.number);let h=r.doc.line(Math.max(1,Math.min(r.doc.lines,u))),d=c_.cursor(h.from+Math.max(0,Math.min(c,h.length)));e.dispatch({effects:[bB.of(!1),fY.scrollIntoView(d.from,{y:"center"})],selection:d}),e.focus()}return{dom:bT("form",{class:"cm-gotoLine",onkeydown:t=>{27==t.keyCode?(t.preventDefault(),e.dispatch({effects:bB.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),n())},onsubmit:e=>{e.preventDefault(),n()}},bT("label",e.state.phrase("Go to line"),": ",t)," ",bT("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),bT("button",{name:"close",onclick:()=>{e.dispatch({effects:bB.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["\xd7"]))}}"undefined"!=typeof Symbol&&(bO.prototype[Symbol.iterator]=bZ.prototype[Symbol.iterator]=function(){return this});let bB=uc.define(),bF=c0.define({create:()=>!0,update(e,t){for(let n of t.effects)n.is(bB)&&(e=n.value);return e},provide:e=>p0.from(e,e=>e?bj:null)}),bV=fY.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),bN={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},bH=cU.define({combine:e=>ub(e,bN,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),bz=hj.mark({class:"cm-selectionMatch"}),b$=hj.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function bW(e,t,n,r){return(0==n||e(t.sliceDoc(n-1,n))!=um.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=um.Word)}let b_=db.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(bH),{state:n}=e,r=n.selection;if(r.ranges.length>1)return hj.none;let i=r.main,o,s=null;if(i.empty){if(!t.highlightWordAroundCursor)return hj.none;let e=n.wordAt(i.head);if(!e)return hj.none;s=n.charCategorizer(i.head),o=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return hj.none;if(t.wholeWords){var l,a,c;if(o=n.sliceDoc(i.from,i.to),!(bW(s=n.charCategorizer(i.head),n,i.from,i.to)&&(l=s,a=i.from,c=i.to,l(n.sliceDoc(a,a+1))==um.Word&&l(n.sliceDoc(c-1,c))==um.Word)))return hj.none}else if(!(o=n.sliceDoc(i.from,i.to)))return hj.none}let u=[];for(let r of e.visibleRanges){let e=new bA(n.doc,o,r.from,r.to);for(;!e.next().done;){let{from:r,to:o}=e.value;if((!s||bW(s,n,r,o))&&(i.empty&&r<=i.from&&o>=i.to?u.push(b$.range(r,o)):(r>=i.to||o<=i.from)&&u.push(bz.range(r,o)),u.length>t.maxMatches))return hj.none}}return hj.set(u)}},{decorations:e=>e.decorations}),bq=fY.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),bG=cU.define({combine:e=>ub(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new yd(e),scrollToMatch:e=>fY.scrollIntoView(e)})});class bU{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,bP),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new b1(this):new bX(this)}getCursor(e,t=0,n){let r=e.doc?e:uv.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?bQ(this,r,t,n):bY(this,r,t,n)}}class bK{constructor(e){this.spec=e}}function bY(e,t,n,r){var i,o;return new bA(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?(i=t.doc,o=t.charCategorizer(t.selection.main.head),(e,t,n,r)=>((r>e||r+n.length<t)&&(r=Math.max(0,e-2),n=i.sliceString(r,Math.min(i.length,t+2))),(o(bJ(n,e-r))!=um.Word||o(b0(n,e-r))!=um.Word)&&(o(b0(n,t-r))!=um.Word||o(bJ(n,t-r))!=um.Word))):void 0)}class bX extends bK{constructor(e){super(e)}nextMatch(e,t,n){let r=bY(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=bY(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=bY(this.spec,e,n,r),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=bY(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=bY(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function bQ(e,t,n,r){var i;return new bO(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(i=t.charCategorizer(t.selection.main.head),(e,t,n)=>!n[0].length||(i(bJ(n.input,n.index))!=um.Word||i(b0(n.input,n.index))!=um.Word)&&(i(b0(n.input,n.index+n[0].length))!=um.Word||i(bJ(n.input,n.index+n[0].length))!=um.Word)):void 0},n,r)}function bJ(e,t){return e.slice(cP(e,t,!1),t)}function b0(e,t){return e.slice(t,cP(e,t))}class b1 extends bK{nextMatch(e,t,n){let r=bQ(this.spec,e,n,e.doc.length).next();return r.done&&(r=bQ(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),o=bQ(this.spec,e,i,n),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==t||s.from>i+10))return s;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=bQ(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=bQ(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}let b2=uc.define(),b5=uc.define(),b3=c0.define({create:e=>new b8(ys(e).create(),null),update(e,t){for(let n of t.effects)n.is(b2)?e=new b8(n.value.create(),e.panel):n.is(b5)&&(e=new b8(e.query,n.value?yo:null));return e},provide:e=>p0.from(e,e=>e.panel)});class b8{constructor(e,t){this.query=e,this.panel=t}}let b4=hj.mark({class:"cm-searchMatch"}),b6=hj.mark({class:"cm-searchMatch cm-searchMatch-selected"}),b9=db.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(b3))}update(e){let t=e.state.field(b3);(t!=e.startState.field(b3)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return hj.none;let{view:n}=this,r=new uk;for(let t=0,i=n.visibleRanges,o=i.length;t<o;t++){let{from:s,to:l}=i[t];for(;t<o-1&&l>i[t+1].from-500;)l=i[++t].to;e.highlight(n.state,s,l,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?b6:b4)})}return r.finish()}},{decorations:e=>e.decorations});function b7(e){return t=>{let n=t.state.field(b3,!1);return n&&n.query.spec.valid?e(t,n):yc(t)}}let ye=b7((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=c_.single(r.from,r.to),o=e.state.facet(bG);return e.dispatch({selection:i,effects:[ym(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),ya(e),!0}),yt=b7((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let o=c_.single(i.from,i.to),s=e.state.facet(bG);return e.dispatch({selection:o,effects:[ym(e,i),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),ya(e),!0}),yn=b7((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!!n&&!!n.length&&(e.dispatch({selection:c_.create(n.map(e=>c_.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),yr=b7((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let o=t.nextMatch(n,r,r);if(!o)return!1;let s=o,l=[],a,c,u=[];if(s.from==r&&s.to==i&&(c=n.toText(t.getReplacement(s)),l.push({from:s.from,to:s.to,insert:c}),s=t.nextMatch(n,s.from,s.to),u.push(fY.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))),s){let t=0==l.length||l[0].from>=o.to?0:o.to-o.from-c.length;a=c_.single(s.from-t,s.to-t),u.push(ym(e,s)),u.push(n.facet(bG).scrollToMatch(a.main,e))}return e.dispatch({changes:l,selection:a,effects:u,userEvent:"input.replace"}),!0}),yi=b7((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:fY.announce.of(r),userEvent:"input.replace.all"}),!0});function yo(e){return e.state.facet(bG).createPanel(e)}function ys(e,t){var n,r,i,o,s;let l=e.selection.main,a=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!a)return t;let c=e.facet(bG);return new bU({search:(null!=(n=null==t?void 0:t.literal)?n:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!=(r=null==t?void 0:t.caseSensitive)?r:c.caseSensitive,literal:null!=(i=null==t?void 0:t.literal)?i:c.literal,regexp:null!=(o=null==t?void 0:t.regexp)?o:c.regexp,wholeWord:null!=(s=null==t?void 0:t.wholeWord)?s:c.wholeWord})}function yl(e){let t=pY(e,yo);return t&&t.dom.querySelector("[main-field]")}function ya(e){let t=yl(e);t&&t==e.root.activeElement&&t.select()}let yc=e=>{let t=e.state.field(b3,!1);if(t&&t.panel){let n=yl(e);if(n&&n!=e.root.activeElement){let r=ys(e.state,t.query.spec);r.valid&&e.dispatch({effects:b2.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[b5.of(!0),t?b2.of(ys(e.state,t.query.spec)):uc.appendConfig.of(yv)]});return!0},yu=e=>{let t=e.state.field(b3,!1);if(!t||!t.panel)return!1;let n=pY(e,yo);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:b5.of(!1)}),!0},yh=[{key:"Mod-f",run:yc,scope:"editor search-panel"},{key:"F3",run:ye,shift:yt,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ye,shift:yt,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:yu,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,o=[],s=0;for(let t=new bA(e.doc,e.sliceDoc(r,i));!t.next().done;){if(o.length>1e3)return!1;t.value.from==r&&(s=o.length),o.push(c_.range(t.value.from,t.value.to))}return t(e.update({selection:c_.create(o,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let t=pY(e,bj);if(!t){let n=[bB.of(!0)];null==e.state.field(bF,!1)&&n.push(uc.appendConfig.of([bF,bV])),e.dispatch({effects:n}),t=pY(e,bj)}return t&&t.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:n}=e,r=c_.create(n.ranges.map(t=>e.wordAt(t.head)||c_.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)})({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=function(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),o=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new bA(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new bA(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(o){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}(e,r);return!!i&&(t(e.update({selection:e.selection.addRange(c_.range(i.from,i.to),!1),effects:fY.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class yd{constructor(e){this.view=e;let t=this.query=e.state.field(b3).query.spec;function n(e,t,n){return bT("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=bT("input",{value:t.search,placeholder:yf(e,"Find"),"aria-label":yf(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=bT("input",{value:t.replace,placeholder:yf(e,"Replace"),"aria-label":yf(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=bT("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=bT("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=bT("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=bT("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>ye(e),[yf(e,"next")]),n("prev",()=>yt(e),[yf(e,"previous")]),n("select",()=>yn(e),[yf(e,"all")]),bT("label",null,[this.caseField,yf(e,"match case")]),bT("label",null,[this.reField,yf(e,"regexp")]),bT("label",null,[this.wordField,yf(e,"by word")]),...e.state.readOnly?[]:[bT("br"),this.replaceField,n("replace",()=>yr(e),[yf(e,"replace")]),n("replaceAll",()=>yi(e),[yf(e,"replace all")])],bT("button",{name:"close",onclick:()=>yu(e),"aria-label":yf(e,"close"),type:"button"},["\xd7"])])}commit(){let e=new bU({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:b2.of(e)}))}keydown(e){var t;(t=this.view,f7(f4(t.state),e,t,"search-panel"))?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?yt:ye)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),yr(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(b2)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(bG).top}}function yf(e,t){return e.state.phrase(t)}let yp=/[\s\.,:;?!]/;function ym(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,o=Math.max(r.from,t-30),s=Math.min(i,n+30),l=e.state.sliceDoc(o,s);if(o!=r.from){for(let e=0;e<30;e++)if(!yp.test(l[e+1])&&yp.test(l[e])){l=l.slice(e);break}}if(s!=i){for(let e=l.length-1;e>l.length-30;e--)if(!yp.test(l[e-1])&&yp.test(l[e])){l=l.slice(0,e);break}}return fY.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}let yg=fY.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),yv=[b3,c2.low(b9),yg];class yb{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=gu(this.state).resolveInner(this.pos,-1);for(;t&&0>e.indexOf(t.name);)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(yC(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function yy(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}class yx{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function yw(e){return e.selection.main.from}function yC(e,t){var n;let{source:r}=e,i=t&&"^"!=r[0],o="$"!=r[r.length-1];return i||o?RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,null!=(n=e.flags)?n:e.ignoreCase?"i":""):e}let yS=us.define(),yk=new WeakMap;function yM(e){if(!Array.isArray(e))return e;let t=yk.get(e);return t||yk.set(e,t=function(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=yy(t)+yy(n)+"*$";return[RegExp("^"+r),new RegExp(r)]}(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}(e)),t}let yT=uc.define(),yD=uc.define();class yA{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=cO(e,t),r=cE(n);this.chars.push(n);let i=e.slice(t,t+r),o=i.toUpperCase();this.folded.push(cO(o==i?i.toLowerCase():o,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:o}=this;if(1==t.length){let r=cO(e,0),i=cE(r),o=i==e.length?0:-100;if(r==t[0]);else{if(r!=n[0])return null;o+=-200}return this.ret(o,[0,i])}let s=e.indexOf(this.pattern);if(0==s)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,a=0;if(s<0){for(let i=0,o=Math.min(e.length,200);i<o&&a<l;){let o=cO(e,i);(o==t[a]||o==n[a])&&(r[a++]=i),i+=cE(o)}if(a<l)return null}let c=0,u=0,h=!1,d=0,f=-1,p=-1,m=/[a-z]/.test(e),g=!0;for(let r=0,a=Math.min(e.length,200),v=0;r<a&&u<l;){let a=cO(e,r);s<0&&(c<l&&a==t[c]&&(i[c++]=r),d<l&&(a==t[d]||a==n[d]?(0==d&&(f=r),p=r+1,d++):d=0));let b,y=a<255?a>=48&&a<=57||a>=97&&a<=122?2:+(a>=65&&a<=90):(b=cI(a))!=b.toLowerCase()?1:2*(b!=b.toUpperCase());(!r||1==y&&m||0==v&&0!=y)&&(t[u]==a||n[u]==a&&(h=!0)?o[u++]=r:o.length&&(g=!1)),v=y,r+=cE(a)}return u==l&&0==o[0]&&g?this.result(-100+(h?-200:0),o,e):d==l&&0==f?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):d==l?this.ret(-900-e.length,[f,p]):u==l?this.result(-100+(h?-200:0)+-700+(g?0:-1100),o,e):2==t.length?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?cE(cO(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}}class yR{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}let yP=cU.define({combine:e=>ub(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:yI,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>yO(e(n),t(n)),optionClass:(e,t)=>n=>yO(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function yO(e,t){return e?t?e+" "+t:e:t}function yI(e,t,n,r,i,o){let s=e.textDirection==hU.RTL,l=s,a=!1,c="top",u,h,d=t.left-i.left,f=i.right-t.right,p=r.right-r.left,m=r.bottom-r.top;if(l&&d<Math.min(p,f)?l=!1:!l&&f<Math.min(p,d)&&(l=!0),p<=(l?d:f))u=Math.max(i.top,Math.min(n.top,i.bottom-m))-t.top,h=Math.min(400,l?d:f);else{a=!0,h=Math.min(400,(s?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=m||e>t.top?u=n.bottom-t.top:(c="bottom",u=t.bottom-n.top)}let g=(t.bottom-t.top)/o.offsetHeight,v=(t.right-t.left)/o.offsetWidth;return{style:`${c}: ${u/g}px; max-width: ${h/v}px`,class:"cm-completionInfo-"+(a?s?"left-narrow":"right-narrow":l?"left":"right")}}function yE(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}class yZ{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let r=e.state.field(t),{options:i,selected:o}=r.open,s=e.state.facet(yP);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement("span");i.className="cm-completionLabel";let o=e.displayLabel||e.label,s=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>s&&i.appendChild(document.createTextNode(o.slice(s,t)));let l=i.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(o.slice(t,n))),l.className="cm-completionMatchedText",s=n}return s<o.length&&i.appendChild(document.createTextNode(o.slice(s))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=yE(i.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if("LI"==t.nodeName&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(yP).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:yD.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:i,selected:o,disabled:s}=n.open;r.open&&r.open.options==i||(this.range=yE(i.length,o,e.state.facet(yP).maxRenderedOptions),this.showOptions(i,n.id)),this.updateSel(),s!=(null==(t=r.open)?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=yE(t.options.length,t.selected,this.view.state.facet(yP).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:r}=n;if(!r)return;let i="string"==typeof r?document.createTextNode(r):r(n);if(!i)return;"then"in i?i.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,n)}).catch(e=>dp(this.view.state,e,"completion info")):this.addInfoPane(i,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){var t,n;let r,i,o,s=null;for(let t=this.list.firstChild,n=this.range.from;t;t=t.nextSibling,n++)"LI"==t.nodeName&&t.id?n==e?t.hasAttribute("aria-selected")||(t.setAttribute("aria-selected","true"),s=t):t.hasAttribute("aria-selected")&&t.removeAttribute("aria-selected"):n--;return s&&(t=this.list,n=s,r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.height/t.offsetHeight,i.top<r.top?t.scrollTop-=(r.top-i.top)/o:i.bottom>r.bottom&&(t.scrollTop+=(i.bottom-r.bottom)/o)),s}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(yP).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){let r=document.createElement("ul");r.id=t,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",e=>{e.target==r&&e.preventDefault()});let i=null;for(let o=n.from;o<n.to;o++){let{completion:s,match:l}=e[o],{section:a}=s;if(a){let e="string"==typeof a?a:a.name;e!=i&&(o>n.from||0==n.from)&&(i=e,"string"!=typeof a&&a.header?r.appendChild(a.header(a)):r.appendChild(document.createElement("completion-section")).textContent=e)}let c=r.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let u=this.optionClass(s);for(let e of(u&&(c.className=u),this.optionContent)){let t=e(s,this.view.state,this.view,l);t&&c.appendChild(t)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function yL(e){return 100*(e.boost||0)+10*!!e.apply+5*!!e.info+ +!!e.type}class yj{constructor(e,t,n,r,i,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new yj(this.options,yN(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,r,i,o){if(r&&!o&&e.some(e=>e.isPending))return r.setDisabled();let s=function(e,t){let n=[],r=null,i=e=>{n.push(e);let{section:t}=e.completion;if(t){r||(r=[]);let e="string"==typeof t?t:t.name;r.some(t=>t.name==e)||r.push("string"==typeof t?{name:e}:t)}},o=t.facet(yP);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(!1===r.result.filter)for(let t of r.result.options)i(new yx(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,l=o.filterStrict?new yR(n):new yA(n);for(let t of r.result.options)if(s=l.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched;i(new yx(t,r.source,n,s.score+(t.boost||0)))}}}if(r){let e=Object.create(null),t=0;for(let n of r.sort((e,t)=>{var n,r;return(null!=(n=e.rank)?n:1e9)-(null!=(r=t.rank)?r:1e9)||(e.name<t.name?-1:1)}))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let s=[],l=null,a=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||a(e.completion,t.completion))){let t=e.completion;l&&l.label==t.label&&l.detail==t.detail&&(null==l.type||null==t.type||l.type==t.type)&&l.apply==t.apply&&l.boost==t.boost?yL(e.completion)>yL(l)&&(s[s.length-1]=e):s.push(e),l=e.completion}return s}(e,t);if(!s.length)return r&&e.some(e=>e.isPending)?r.setDisabled():null;let l=t.facet(yP).selectOnOpen?0:-1;if(r&&r.selected!=l&&-1!=r.selected){let e=r.options[r.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){l=t;break}}return new yj(s,yN(n,l),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:yK,above:i.aboveCursor},r?r.timestamp:Date.now(),l,!1)}map(e){return new yj(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new yj(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class yB{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new yB(yH,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(yP),r=(n.override||t.languageDataAt("autocomplete",yw(t)).map(yM)).map(t=>(this.active.find(e=>e.source==t)||new y$(t,+!!this.active.some(e=>0!=e.state))).update(e,n));r.length==this.active.length&&r.every((e,t)=>e==this.active[t])&&(r=this.active);let i=this.open,o=e.effects.some(e=>e.is(y_));for(let s of(i&&e.docChanged&&(i=i.map(e.changes)),e.selection||r.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,o=r==t.length;if(i||o)return i==o;if(e[n++].result!=t[r++].result)return!1}}(r,this.active)||o?i=yj.build(r,t,this.id,i,n,o):i&&i.disabled&&!r.some(e=>e.isPending)&&(i=null),!i&&r.every(e=>!e.isPending)&&r.some(e=>e.hasResult())&&(r=r.map(e=>e.hasResult()?new y$(e.source,0):e)),e.effects))s.is(yq)&&(i=i&&i.setSelected(s.value,this.id));return r==this.active&&i==this.open?this:new yB(r,this.id,i)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?yF:yV}}let yF={"aria-autocomplete":"list"},yV={};function yN(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}let yH=[];function yz(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(yS);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:16*!!e.docChanged}class y${constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=yz(e,t),r=this;for(let t of((8&n||16&n&&this.touches(e))&&(r=new y$(r.source,0)),4&n&&0==r.state&&(r=new y$(this.source,1)),r=r.updateFor(e,n),e.effects))if(t.is(yT))r=new y$(r.source,1,t.value);else if(t.is(yD))r=new y$(r.source,0);else if(t.is(y_))for(let e of t.value)e.source==r.source&&(r=e);return r}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(yw(e.state))}}class yW extends y${constructor(e,t,n,r,i,o){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=yw(e.state);if(s>o||!r||2&t&&(yw(e.startState)==this.from||s<this.limit))return new y$(this.source,4&t?1:0);let l=e.changes.mapPos(this.limit);return!function(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return"function"==typeof e?e(i,n,r,t):yC(e,!0).test(i)}(r.validFor,e.state,i,o)?r.update&&(r=r.update(r,i,o,new yb(e.state,s,!1)))?new yW(this.source,this.explicit,l,r,r.from,null!=(n=r.to)?n:yw(e.state)):new y$(this.source,1,this.explicit):new yW(this.source,this.explicit,l,r,i,o)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new yW(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new y$(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}let y_=uc.define({map:(e,t)=>e.map(e=>e.map(t))}),yq=uc.define(),yG=c0.define({create:()=>yB.start(),update:(e,t)=>e.update(t),provide:e=>[pz.from(e,e=>e.tooltip),fY.contentAttributes.from(e,e=>e.attrs)]});function yU(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(yG).active.find(e=>e.source==t.source);return r instanceof yW&&("string"==typeof n?e.dispatch(Object.assign(Object.assign({},function(e,t,n,r){let{main:i}=e.selection,o=n-i.from,s=r-i.from;return Object.assign(Object.assign({},e.changeByRange(l=>{if(l!=i&&n!=r&&e.sliceDoc(l.from+o,l.from+s)!=e.sliceDoc(n,r))return{range:l};let a=e.toText(t);return{changes:{from:l.from+o,to:r==i.from?l.to:l.from+s,insert:a},range:c_.cursor(l.from+o+a.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}(e.state,n,r.from,r.to)),{annotations:yS.of(t.completion)})):n(e,t.completion,r.from,r.to),!0)}let yK=e=>new yZ(e,yG,yU);function yY(e,t="option"){return n=>{let r=n.state.field(yG,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(yP).interactionDelay)return!1;let i=1,o;"page"==t&&(o=pG(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:s}=r.open.options,l=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:s-1;return l<0?l="page"==t?0:s-1:l>=s&&(l="page"==t?s-1:0),n.dispatch({effects:yq.of(l)}),!0}}let yX=e=>!!e.state.field(yG,!1)&&(e.dispatch({effects:yT.of(!0)}),!0);class yQ{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}let yJ=db.fromClass(class{constructor(e){for(let t of(this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0,e.state.field(yG).active))t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(yG),n=e.state.facet(yP);if(!e.selectionSet&&!e.docChanged&&e.startState.field(yG)==t)return;let r=e.transactions.some(e=>{let t=yz(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){dp(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(yT)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(yG);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(yP).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=yw(t),r=new yb(t,n,e.explicit,this.view),i=new yQ(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:yD.of(null)}),dp(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(yP).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(yP),r=this.view.state.field(yG);for(let i=0;i<this.running.length;i++){let o=this.running[i];if(void 0===o.done)continue;if(this.running.splice(i--,1),o.done){let r=yw(o.updates.length?o.updates[0].startState:this.view.state),i=Math.min(r,o.done.from+ +!o.active.explicit),s=new yW(o.active.source,o.active.explicit,i,o.done,o.done.from,null!=(e=o.done.to)?e:r);for(let e of o.updates)s=s.update(e,n);if(s.hasResult()){t.push(s);continue}}let s=r.active.find(e=>e.source==o.active.source);if(s&&s.isPending)if(null==o.done){let e=new y$(o.active.source,0);for(let t of o.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(s)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:y_.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(yG,!1);if(t&&t.tooltip&&this.view.state.facet(yP).closeOnBlur){let n=t.open&&pG(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:yD.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:yT.of(!1)}),20),this.composing=0}}}),y0="object"==typeof navigator&&/Win/.test(navigator.platform),y1=c2.highest(fY.domEventHandlers({keydown(e,t){let n=t.state.field(yG,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(y0&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),o=r.completion.commitCharacters||i.result.commitCharacters;return o&&o.indexOf(e.key)>-1&&yU(t,r),!1}})),y2=fY.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'\uD835\uDC65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\uD835\uDC36'"}},".cm-completionIcon-type":{"&:after":{content:"'\uD835\uDC61'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\uD83D\uDD11︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),y5={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},y3=uc.define({map(e,t){let n=t.mapPos(e,-1,cL.TrackAfter);return null==n?void 0:n}}),y8=new class extends uy{};y8.startSide=1,y8.endSide=-1;let y4=c0.define({create:()=>uS.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(y3)&&(e=e.update({add:[y8.range(n.value,n.value+1)]}));return e}}),y6="()[]{}<>\xab\xbb\xbb\xab[]{}";function y9(e){for(let t=0;t<y6.length;t+=2)if(y6.charCodeAt(t)==e)return y6.charAt(t+1);return cI(e<128?e:e+1)}function y7(e,t){return e.languageDataAt("closeBrackets",t)[0]||y5}let xe="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),xt=fY.inputHandler.of((e,t,n,r)=>{if((xe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||2==r.length&&1==cE(cO(r,0))||t!=i.from||n!=i.to)return!1;let o=function(e,t){let n=y7(e,e.selection.main.head),r=n.brackets||y5.brackets;for(let i of r){let o=y9(cO(i,0));if(t==i)return o==i?function(e,t,n,r){let i=r.stringPrefixes||y5.stringPrefixes,o=null,s=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:y3.of(r.to+t.length),range:c_.range(r.anchor+t.length,r.head+t.length)};let s=r.head,l=xi(e.doc,s),a;if(l==t){if(xo(e,s))return{changes:{insert:t+t,from:s},effects:y3.of(s+t.length),range:c_.cursor(s+t.length)};else if(xr(e,s)){let r=n&&e.sliceDoc(s,s+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:s,to:s+r.length,insert:r},range:c_.cursor(s+r.length)}}}else if(n&&e.sliceDoc(s-2*t.length,s)==t+t&&(a=xs(e,s-2*t.length,i))>-1&&xo(e,a))return{changes:{insert:t+t+t+t,from:s},effects:y3.of(s+t.length),range:c_.cursor(s+t.length)};else if(e.charCategorizer(s)(l)!=um.Word&&xs(e,s,i)>-1&&!function(e,t,n,r){let i=gu(e).resolveInner(t,-1),o=r.reduce((e,t)=>Math.max(e,t.length),0);for(let s=0;s<5;s++){let s=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),l=s.indexOf(n);if(!l||l>-1&&r.indexOf(s.slice(0,l))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+l;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let a=i.to==t&&i.parent;if(!a)break;i=a}return!1}(e,s,t,i))return{changes:{insert:t+t,from:s},effects:y3.of(s+t.length),range:c_.cursor(s+t.length)};return{range:o=r}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}(e,i,r.indexOf(i+i+i)>-1,n):function(e,t,n,r){let i=null,o=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:y3.of(o.to+t.length),range:c_.range(o.anchor+t.length,o.head+t.length)};let s=xi(e.doc,o.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:t+n,from:o.head},effects:y3.of(o.head+t.length),range:c_.cursor(o.head+t.length)}:{range:i=o}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}(e,i,o,n.before||y5.before);if(t==o&&xr(e,e.selection.main.from))return function(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&xi(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:c_.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}(e,0,o)}return null}(e.state,r);return!!o&&(e.dispatch(o),!0)}),xn=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=y7(e,e.selection.main.head).brackets||y5.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){var i,o;let r,s=(i=e.doc,o=t.head,cE(cO(r=i.sliceString(o-2,o),0))==r.length?r:r.slice(1));for(let r of n)if(r==s&&xi(e.doc,t.head)==y9(cO(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:c_.cursor(t.head-r.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function xr(e,t){let n=!1;return e.field(y4).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function xi(e,t){let n=e.sliceString(t,t+2);return n.slice(0,cE(cO(n,0)))}function xo(e,t){let n=gu(e).resolveInner(t+1);return n.parent&&n.from==t}function xs(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=um.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=um.Word)return n}return -1}let xl=[{key:"Ctrl-Space",run:yX},{mac:"Alt-`",run:yX},{key:"Escape",run:e=>{let t=e.state.field(yG,!1);return!!t&&!!t.active.some(e=>0!=e.state)&&(e.dispatch({effects:yD.of(null)}),!0)}},{key:"ArrowDown",run:yY(!0)},{key:"ArrowUp",run:yY(!1)},{key:"PageDown",run:yY(!0,"page")},{key:"PageUp",run:yY(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(yG,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(yP).interactionDelay)&&yU(e,t.open.options[t.open.selected])}}],xa=c2.highest(f3.computeN([yP],e=>e.facet(yP).defaultKeymap?[xl]:[]));class xc{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class xu{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=e,i=n.facet(xS).markerFilter;i&&(r=i(r,n));let o=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),s=new uk,l=[],a=0;for(let e=0;;){let t,r,i=e==o.length?null:o[e];if(!i&&!l.length)break;for(l.length?(t=a,r=l.reduce((e,t)=>Math.min(e,t.to),i&&i.from>t?i.from:1e8)):(t=i.from,r=i.to,l.push(i),e++);e<o.length;){let n=o[e];if(n.from==t&&(n.to>n.from||n.to==t))l.push(n),e++,r=Math.min(n.to,r);else{r=Math.min(n.from,r);break}}let c=xI(l);if(l.some(e=>e.from==e.to||e.from==e.to-1&&n.doc.lineAt(e.from).to==e.from))s.add(t,t,hj.widget({widget:new xT(c),diagnostics:l.slice()}));else{let e=l.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");s.add(t,r,hj.mark({class:"cm-lintRange cm-lintRange-"+c+e,diagnostics:l.slice(),inclusiveEnd:l.some(e=>e.to>r)}))}a=r;for(let e=0;e<l.length;e++)l[e].to<=a&&l.splice(e--,1)}let c=s.finish();return new xu(c,t,xh(c))}}function xh(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&0>i.diagnostics.indexOf(t)))if(r){if(0>i.diagnostics.indexOf(r.diagnostic))return!1;r=new xc(r.from,n,r.diagnostic)}else r=new xc(e,n,t||i.diagnostics[0])}),r}function xd(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(xS).hideOn(e,n,r);if(null!=i)return i;let o=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(xp))||e.changes.touchesRange(o.from,Math.max(o.to,r)))}function xf(e,t){return e.field(xv,!1)?t:t.concat(uc.appendConfig.of(xV))}let xp=uc.define(),xm=uc.define(),xg=uc.define(),xv=c0.define({create:()=>new xu(hj.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=xh(n,e.selected.diagnostic,i)||xh(n,null,i)}!n.size&&i&&t.state.facet(xS).autoPanel&&(i=null),e=new xu(n,i,r)}for(let n of t.effects)if(n.is(xp)){let r=t.state.facet(xS).autoPanel?n.value.length?xA.open:null:e.panel;e=xu.init(n.value,r,t.state)}else n.is(xm)?e=new xu(e.diagnostics,n.value?xA.open:null,e.selected):n.is(xg)&&(e=new xu(e.diagnostics,e.panel,n.value));return e},provide:e=>[p0.from(e,e=>e.panel),fY.decorations.from(e,e=>e.diagnostics)]}),xb=hj.mark({class:"cm-lintRange cm-lintRange-active"});function xy(e,t){return bT("ul",{class:"cm-tooltip-lint"},t.map(t=>xM(e,t,!1)))}let xx=e=>{let t=e.state.field(xv,!1);return!!t&&!!t.panel&&(e.dispatch({effects:xm.of(!1)}),!0)},xw=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(xv,!1);t&&t.panel||e.dispatch({effects:xf(e.state,[xm.of(!0)])});let n=pY(e,xA.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(xv,!1);if(!t)return!1;let n=e.state.selection.main,r=t.diagnostics.iter(n.to+1);return(!!r.value||!!(r=t.diagnostics.iter(0)).value&&(r.from!=n.from||r.to!=n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],xC=db.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(xS);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(xS);t.length&&function(e,t,n){let r=[],i=-1;for(let o of e)o.then(n=>{r.push(n),clearTimeout(i),r.length==e.length?t(r):i=setTimeout(()=>t(r),200)},n)}(t.map(e=>Promise.resolve(e(this.view))),t=>{var n,r;this.view.state.doc==e.doc&&this.view.dispatch((n=this.view.state,r=t.reduce((e,t)=>e.concat(t)),{effects:xf(n,[xp.of(r)])}))},e=>{dp(this.view.state,e)})}}update(e){let t=e.state.facet(xS);(e.docChanged||t!=e.startState.facet(xS)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),xS=cU.define({combine:e=>Object.assign({sources:e.map(e=>e.source).filter(e=>null!=e)},ub(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))});function xk(e){let t=[];if(e)r:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue r}}t.push("")}return t}function xM(e,t,n){var r;let i=n?xk(t.actions):[];return bT("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},bT("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null==(r=t.actions)?void 0:r.map((n,r)=>{let o=!1,s=r=>{if(r.preventDefault(),o)return;o=!0;let i=xh(e.state.field(xv).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:l}=n,a=i[r]?l.indexOf(i[r]):-1,c=a<0?l:[l.slice(0,a),bT("u",l.slice(a,a+1)),l.slice(a+1)];return bT("button",{type:"button",class:"cm-diagnosticAction",onclick:s,onmousedown:s,"aria-label":` Action: ${l}${a<0?"":` (access key "${i[r]})"`}.`},c)}),t.source&&bT("div",{class:"cm-diagnosticSource"},t.source))}class xT extends hZ{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return bT("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class xD{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(0xffffffff*Math.random()).toString(16),this.dom=xM(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class xA{constructor(e){this.view=e,this.items=[];let t=t=>{if(27==t.keyCode)xx(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65)||!(t.keyCode<=90)||!(this.selectedIndex>=0))return;let{diagnostic:n}=this.items[this.selectedIndex],r=xk(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=xh(this.view.state.field(xv).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}t.preventDefault()},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=bT("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=bT("div",{class:"cm-panel-lint"},this.list,bT("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>xx(this.view)},"\xd7")),this.update()}get selectedIndex(){let e=this.view.state.field(xv).selected;if(!e)return -1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return -1}update(){let{diagnostics:e,selected:t}=this.view.state.field(xv),n=0,r=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(e,s,{spec:l})=>{for(let e of l.diagnostics){if(o.has(e))continue;o.add(e);let s=-1,l;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){s=t;break}s<0?(l=new xD(this.view,e),this.items.splice(n,0,l),r=!0):(l=this.items[s],s>n&&(this.items.splice(n,s-n),r=!0)),t&&l.diagnostic==t.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),i=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();0==this.items.length&&(this.items.push(new xD(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=xh(this.view.state.field(xv).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:xg.of(t)})}static open(e){return new xA(e)}}function xR(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function xP(e){return xR(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}let xO=fY.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:xP("#d11")},".cm-lintRange-warning":{backgroundImage:xP("orange")},".cm-lintRange-info":{backgroundImage:xP("#999")},".cm-lintRange-hint":{backgroundImage:xP("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function xI(e){let t="hint",n=1;for(let i of e){var r;let e="error"==(r=i.severity)?4:"warning"==r?3:"info"==r?2:1;e>n&&(n=e,t=i.severity)}return t}class xE extends p1{constructor(e){super(),this.diagnostics=e,this.severity=xI(e)}toDOM(e){let t=document.createElement("div");t.className="cm-lint-marker cm-lint-marker-"+this.severity;let n=this.diagnostics,r=e.state.facet(xN).tooltipFilter;return r&&(n=r(n,e.state)),n.length&&(t.onmouseover=()=>(function(e,t,n){function r(){let r,i=e.elementAtHeight(t.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(i.from)&&e.dispatch({effects:xj.of({pos:i.from,above:!1,clip:!1,create:()=>({dom:xy(e,n),getCoords:()=>t.getBoundingClientRect()})})}),t.onmouseout=t.onmousemove=null,r=n=>{let i=t.getBoundingClientRect();if(!(n.clientX>i.left-10)||!(n.clientX<i.right+10)||!(n.clientY>i.top-10)||!(n.clientY<i.bottom+10)){for(let e=n.target;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",r),e.state.field(xB)&&e.dispatch({effects:xj.of(null)})}},window.addEventListener("mousemove",r)}let{hoverTime:i}=e.state.facet(xN),o=setTimeout(r,i);t.onmouseout=()=>{clearTimeout(o),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(o),o=setTimeout(r,i)}})(e,t,n)),t}}let xZ=p4({class:"cm-gutter-lint",markers:e=>e.state.field(xL),widgetMarker:(e,t,n)=>{let r=[];return e.state.field(xL).between(n.from,n.to,(e,t,i)=>{e>n.from&&e<n.to&&r.push(...i.diagnostics)}),r.length?new xE(r):null}}),xL=c0.define({create:()=>uS.empty,update(e,t){e=e.map(t.changes);let n=t.state.facet(xN).markerFilter;for(let r of t.effects)if(r.is(xp)){let i=r.value;n&&(i=n(i||[],t.state)),e=function(e,t){let n=Object.create(null);for(let r of t){let t=e.lineAt(r.from);(n[t.from]||(n[t.from]=[])).push(r)}let r=[];for(let e in n)r.push(new xE(n[e]).range(+e));return uS.of(r,!0)}(t.state.doc,i.slice(0))}return e}}),xj=uc.define(),xB=c0.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=xd(t,e)?null:Object.assign(Object.assign({},e),{pos:t.changes.mapPos(e.pos)})),t.effects.reduce((e,t)=>t.is(xj)?t.value:e,e)),provide:e=>pz.from(e)}),xF=fY.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:xR('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:xR('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:xR('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),xV=[xv,fY.decorations.compute([xv],e=>{let{selected:t,panel:n}=e.field(xv);return t&&n&&t.from!=t.to?hj.set([xb.range(t.from,t.to)]):hj.none}),function(e,t={}){let n=uc.define(),r=c0.define({create:()=>[],update(e,r){if(e.length&&(t.hideOnChange&&(r.docChanged||r.selection)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(r,e))),r.docChanged)){let t=[];for(let n of e){let e=r.changes.mapPos(n.pos,-1,cL.TrackDel);if(null!=e){let i=Object.assign(Object.create(null),n);i.pos=e,null!=i.end&&(i.end=r.changes.mapPos(i.end)),t.push(i)}}e=t}for(let t of r.effects)t.is(n)&&(e=t.value),t.is(pU)&&(e=[]);return e},provide:e=>p$.from(e)});return{active:r,extension:[r,db.define(i=>new pq(i,e,r,n,t.hoverTime||300)),p_]}}(function(e,t,n){let{diagnostics:r}=e.state.field(xv),i,o=-1,s=-1;r.between(t-(n<0),t+ +(n>0),(e,r,{spec:l})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=l.diagnostics,o=e,s=r,!1});let l=e.state.facet(xS).tooltipFilter;return(i&&l&&(i=l(i,e.state)),i)?{pos:o,end:s,above:e.state.doc.lineAt(o).to<s,create:()=>({dom:xy(e,i)})}:null},{hideOn:xd}),xO],xN=cU.define({combine:e=>ub(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})});var xH=function(e){let t;void 0===e&&(e={});var{crosshairCursor:n=!1}=e,r=[];!1!==e.closeBracketsKeymap&&(r=r.concat(xn)),!1!==e.defaultKeymap&&(r=r.concat(bk)),!1!==e.searchKeymap&&(r=r.concat(yh)),!1!==e.historyKeymap&&(r=r.concat(vB)),!1!==e.foldKeymap&&(r=r.concat(g$)),!1!==e.completionKeymap&&(r=r.concat(xl)),!1!==e.lintKeymap&&(r=r.concat(xw));var i=[];return!1!==e.lineNumbers&&i.push(function(e={}){return[ml.of(e),p9(),mu]}()),!1!==e.highlightActiveLineGutter&&i.push(mf),!1!==e.highlightSpecialChars&&i.push(function(e={}){return[pS.of(e),pk||(pk=db.fromClass(class{constructor(e){this.view=e,this.decorations=hj.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(pS)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new pb({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,o=cO(t[0],0);if(9==o){let e=i.lineAt(r),t=n.state.tabSize,o=uL(e.text,t,r-e.from);return hj.replace({widget:new pT((t-o%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=hj.replace({widget:new pM(e,o)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(pS);e.startState.facet(pS)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}()),!1!==e.history&&i.push(function(e={}){return[vS,vC.of(e),fY.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?vM:"historyRedo"==e.inputType?vT:null;return!!n&&(e.preventDefault(),n(t))}})]}()),!1!==e.foldGutter&&i.push(function(e={}){let t=Object.assign(Object.assign({},gY),e),n=new gX(t,!0),r=new gX(t,!1),i=db.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(gy)!=e.state.facet(gy)||e.startState.field(gV,!1)!=e.state.field(gV,!1)||gu(e.startState)!=gu(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new uk;for(let i of e.viewportLineBlocks){let o=gN(e.state,i.from,i.to)?r:gZ(e.state,i.from,i.to)?n:null;o&&t.add(i.from,i.from,o)}return t.finish()}}),{domEventHandlers:o}=t;return[i,p4({class:"cm-foldGutter",markers(e){var t;return(null==(t=e.plugin(i))?void 0:t.markers)||uS.empty},initialSpacer:()=>new gX(t,!1),domEventHandlers:Object.assign(Object.assign({},o),{click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=gN(e.state,t.from,t.to);if(r)return e.dispatch({effects:gB.of(r)}),!0;let i=gZ(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:gj.of(i)}),!0)}})}),gq()]}()),!1!==e.drawSelection&&i.push(function(e={}){return[pl.of(e),pc,ph,pf,dc.of(!0)]}()),!1!==e.dropCursor&&i.push([pm,pg]),!1!==e.allowMultipleSelections&&i.push(uv.allowMultipleSelections.of(!0)),!1!==e.indentOnInput&&i.push(uv.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+200)return e;let o=n.sliceString(i.from,r);if(!t.some(e=>e.test(o)))return e;let{state:s}=e,l=-1,a=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==l)continue;l=t.from;let n=gM(s,t.from);if(null==n)continue;let r=/^\s*/.exec(t.text)[0],i=gk(s,n);r!=i&&a.push({from:t.from,to:t.from+r.length,insert:i})}return a.length?[e,{changes:a,sequential:!0}]:e})),!1!==e.syntaxHighlighting&&i.push(g5(g8,{fallback:!0})),!1!==e.bracketMatching&&i.push(function(e={}){return[g9.of(e),vn]}()),!1!==e.closeBrackets&&i.push([xt,y4]),!1!==e.autocompletion&&i.push(function(e={}){return[y1,yG,yP.of(e),yJ,xa,y2]}()),!1!==e.rectangularSelection&&i.push((t=e=>e.altKey&&0==e.button,fY.mouseSelectionStyle.of((e,n)=>{let r,i;return t(n)?(r=pP(e,n),i=e.state.selection,r?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(r.line).from),n=e.state.doc.lineAt(t);r={line:n.number,col:r.col,off:Math.min(r.off,n.length)},i=i.map(e.changes)}},get(t,n,o){let s=pP(e,t);if(!s)return i;let l=function(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),o=[];if(t.off>2e3||n.off>2e3||t.col<0||n.col<0){let s=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let t=r;t<=i;t++){let n=e.doc.line(t);n.length<=l&&o.push(c_.range(n.from+s,n.to+l))}}else{let s=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let t=r;t<=i;t++){let n=e.doc.line(t),r=uj(n.text,s,e.tabSize,!0);if(r<0)o.push(c_.cursor(n.to));else{let t=uj(n.text,l,e.tabSize);o.push(c_.range(n.from+r,n.from+t))}}}return o}(e.state,r,s);return l.length?o?c_.create(l.concat(i.ranges)):c_.create(l):i}}:null):null}))),!1!==n&&i.push(function(e={}){let[t,n]=pO[e.key||"Alt"],r=db.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[r,fY.contentAttributes.of(e=>{var t;return(null==(t=e.plugin(r))?void 0:t.isDown)?pI:null})]}()),!1!==e.highlightActiveLine&&i.push(pA),!1!==e.highlightSelectionMatches&&i.push([bq,b_]),e.tabSize&&"number"==typeof e.tabSize&&i.push(gC.of(" ".repeat(e.tabSize))),i.concat([f3.of(r.flat())]).filter(Boolean)};let xz="#e06c75",x$="#abb2bf",xW="#7d8799",x_="#d19a66",xq="#2c313a",xG="#282c34",xU="#353a42",xK="#528bff",xY=[fY.theme({"&":{color:x$,backgroundColor:xG},".cm-content":{caretColor:xK},".cm-cursor, .cm-dropCursor":{borderLeftColor:xK},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:x$},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:xG,color:xW,border:"none"},".cm-activeLineGutter":{backgroundColor:xq},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:xU},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:xU,borderBottomColor:xU},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:xq,color:x$}}},{dark:!0}),g5(gJ.define([{tag:gi.keyword,color:"#c678dd"},{tag:[gi.name,gi.deleted,gi.character,gi.propertyName,gi.macroName],color:xz},{tag:[gi.function(gi.variableName),gi.labelName],color:"#61afef"},{tag:[gi.color,gi.constant(gi.name),gi.standard(gi.name)],color:x_},{tag:[gi.definition(gi.name),gi.separator],color:x$},{tag:[gi.typeName,gi.className,gi.number,gi.changed,gi.annotation,gi.modifier,gi.self,gi.namespace],color:"#e5c07b"},{tag:[gi.operator,gi.operatorKeyword,gi.url,gi.escape,gi.regexp,gi.link,gi.special(gi.string)],color:"#56b6c2"},{tag:[gi.meta,gi.comment],color:xW},{tag:gi.strong,fontWeight:"bold"},{tag:gi.emphasis,fontStyle:"italic"},{tag:gi.strikethrough,textDecoration:"line-through"},{tag:gi.link,color:xW,textDecoration:"underline"},{tag:gi.heading,fontWeight:"bold",color:xz},{tag:[gi.atom,gi.bool,gi.special(gi.variableName)],color:x_},{tag:[gi.processingInstruction,gi.string,gi.inserted],color:"#98c379"},{tag:gi.invalid,color:"#ffffff"}]))];var xX=fY.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),xQ=function(e){void 0===e&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:r=!1,theme:i="light",placeholder:o="",basicSetup:s=!0}=e,l=[];switch(t&&l.unshift(f3.of([bM])),s&&("boolean"==typeof s?l.unshift(xH()):l.unshift(xH(s))),o&&l.unshift(db.fromClass(class{constructor(e){this.view=e,this.placeholder=o?hj.set([hj.widget({widget:new pR(o),side:1}).range(0)]):hj.none}get decorations(){return this.view.state.doc.length?hj.none:this.placeholder}},{decorations:e=>e.decorations})),i){case"light":l.push(xX);break;case"dark":l.push(xY);break;case"none":break;default:l.push(i)}return!1===n&&l.push(fY.editable.of(!1)),r&&l.push(uv.readOnly.of(!0)),[...l]},xJ=us.define(),x0=[],x1=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],x2=(0,D.forwardRef)((e,t)=>{var{className:n,value:r="",selection:i,extensions:o=[],onChange:s,onStatistics:l,onCreateEditor:a,onUpdate:c,autoFocus:u,theme:h="light",height:d,minHeight:f,maxHeight:p,width:m,minWidth:g,maxWidth:v,basicSetup:b,placeholder:y,indentWithTab:x,editable:w,readOnly:C,root:S,initialState:k}=e,M=(0,ch.Z)(e,x1),A=(0,D.useRef)(null),{state:R,view:P,container:O,setContainer:I}=function(e){var{value:t,selection:n,onChange:r,onStatistics:i,onCreateEditor:o,onUpdate:s,extensions:l=x0,autoFocus:a,theme:c="light",height:u=null,minHeight:h=null,maxHeight:d=null,width:f=null,minWidth:p=null,maxWidth:m=null,placeholder:g="",editable:v=!0,readOnly:b=!1,indentWithTab:y=!0,basicSetup:x=!0,root:w,initialState:C}=e,[S,k]=(0,D.useState)(),[M,T]=(0,D.useState)(),[A,R]=(0,D.useState)(),P=fY.theme({"&":{height:u,minHeight:h,maxHeight:d,width:f,minWidth:p,maxWidth:m},"& .cm-scroller":{height:"100% !important"}}),O=[fY.updateListener.of(e=>{e.docChanged&&"function"==typeof r&&!e.transactions.some(e=>e.annotation(xJ))&&r(e.state.doc.toString(),e),i&&i({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)})}),P,...xQ({theme:c,editable:v,readOnly:b,placeholder:g,indentWithTab:y,basicSetup:x})];return s&&"function"==typeof s&&O.push(fY.updateListener.of(s)),O=O.concat(l),(0,D.useLayoutEffect)(()=>{if(S&&!A){var e={doc:t,selection:n,extensions:O},r=C?uv.fromJSON(C.json,e,C.fields):uv.create(e);if(R(r),!M){var i=new fY({state:r,parent:S,root:w});T(i),o&&o(i,r)}}return()=>{M&&(R(void 0),T(void 0))}},[S,A]),(0,D.useEffect)(()=>{e.container&&k(e.container)},[e.container]),(0,D.useEffect)(()=>()=>{M&&(M.destroy(),T(void 0))},[M]),(0,D.useEffect)(()=>{a&&M&&M.focus()},[a,M]),(0,D.useEffect)(()=>{M&&M.dispatch({effects:uc.reconfigure.of(O)})},[c,l,u,h,d,f,p,m,g,v,b,y,x,r,s]),(0,D.useEffect)(()=>{if(void 0!==t){var e=M?M.state.doc.toString():"";M&&t!==e&&M.dispatch({changes:{from:0,to:e.length,insert:t||""},annotations:[xJ.of(!0)]})}},[t,M]),{state:A,setState:R,view:M,setView:T,container:S,setContainer:k}}({root:S,value:r,autoFocus:u,theme:h,height:d,minHeight:f,maxHeight:p,width:m,minWidth:g,maxWidth:v,basicSetup:b,placeholder:y,indentWithTab:x,editable:w,readOnly:C,selection:i,onChange:s,onStatistics:l,onCreateEditor:a,onUpdate:c,extensions:o,initialState:k});(0,D.useImperativeHandle)(t,()=>({editor:A.current,state:R,view:P}),[A,O,R,P]);var E=(0,D.useCallback)(e=>{A.current=e,I(e)},[I]);if("string"!=typeof r)throw Error("value must be typeof string but got "+typeof r);var Z="string"==typeof h?"cm-theme-"+h:"cm-theme";return(0,T.jsx)("div",(0,cu.Z)({ref:E,className:""+Z+(n?" "+n:"")},M))});x2.displayName="CodeMirror";class x5{constructor(e,t,n,r,i,o,s,l,a,c=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=o,this.buffer=s,this.bufferBase=l,this.curContext=a,this.lookAhead=c,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new x5(e,[],t,n,n,0,[],0,r?new x3(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=65535&e,{parser:i}=this.p,o=this.reducePos<this.pos-25;o&&this.setLookAhead(this.pos);let s=i.dynamicPrecedence(r);if(s&&(this.score+=s),0==n){this.pushState(i.getGoto(this.state,r,!0),this.reducePos),r<i.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(r,this.reducePos);return}let l=this.stack.length-(n-1)*3-(262144&e?6:0),a=l?this.stack[l-2]:this.p.ranges[0].from,c=this.reducePos-a;c>=2e3&&!(null==(t=this.p.parser.nodeSet.types[r])?void 0:t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=c));let u=l?this.stack[l-1]:0,h=this.bufferBase+this.buffer.length-u;if(r<i.minRepeatTerm||131072&e){let e=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,a,e,h+4,!0)}if(262144&e)this.state=this.stack[l];else{let e=this.stack[l-3];this.state=i.getGoto(e,r,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(r,a)}storeNode(e,t,n,r=4,i=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,r=this.buffer.length;if(0==r&&e.parent&&(r=e.bufferBase-e.parent.bufferBase,e=e.parent),r>0&&0==e.buffer[r-4]&&e.buffer[r-1]>-1){if(t==n)return;if(e.buffer[r-2]>=t){e.buffer[r-2]=n;return}}}if(i&&this.pos!=n){let i=this.buffer.length;if(i>0&&0!=this.buffer[i-4]){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}else this.buffer.push(e,t,n,r)}shift(e,t,n,r){if(131072&e)this.pushState(65535&e,this.pos);else if((262144&e)==0){let{parser:i}=this.p;(r>this.pos||t<=i.maxNode)&&(this.pos=r,i.stateFlag(e,1)||(this.reducePos=r)),this.pushState(e,n),this.shiftContext(t,n),t<=i.maxNode&&this.buffer.push(t,n,r,4)}else this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4)}apply(e,t,n,r){65536&e?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new x5(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new x8(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if((65536&n)==0)return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>1&t&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((65536&t)==0)return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=65535&t,i=this.stack.length-3*n;if(i<0||0>e.getGoto(this.stack[i],r,!1)){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(393216&t);else if(65536&t){let n=(t>>19)-i;if(n>1){let r=65535&t,i=this.stack.length-3*n;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(null!=e)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new x3(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class x3{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class x8{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e>>19;0==t?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(t-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],65535&e,!0);this.state=n}}class x4{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new x4(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new x4(this.stack,this.pos,this.index)}}function x6(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let r=0,i=0;r<e.length;){let o=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(126==t){o=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),o+=i,n)break;o*=46}n?n[i++]=o:n=new t(o)}return n}class x9{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}let x7=new x9;class we{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=x7,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(null==t)return -1;if((n=t)>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n<this.token.start)throw RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=x7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class wt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;wn(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}function wn(e,t,n,r,i,o){let s=0,l=1<<r,{dialect:a}=n.p.parser;n:for(;(l&e[s])!=0;){let n=e[s+1];for(let r=s+3;r<n;r+=2)if((e[r+1]&l)>0){let n=e[r];if(a.allows(n)&&(-1==t.token.value||t.token.value==n||function(e,t,n,r){let i=wr(n,r,t);return i<0||wr(n,r,e)<i}(n,t.token.value,i,o))){t.acceptToken(n);break}}let r=t.next,c=0,u=e[s+2];if(t.next<0&&u>c&&65535==e[n+3*u-3]){s=e[n+3*u-1];continue}for(;c<u;){let i=c+u>>1,o=n+i+(i<<1),l=e[o],a=e[o+1]||65536;if(r<l)u=i;else if(r>=a)c=i+1;else{s=e[o+2],t.advance();continue n}}break}}function wr(e,t,n){for(let r=t,i;65535!=(i=e[r]);r++)if(i==n)return r-t;return -1}wt.prototype.contextual=wt.prototype.fallback=wt.prototype.extend=!1,(class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data="string"==typeof e?x6(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(wn(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(null==this.elseToken)return;if(!n&&r++,null==i)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}).prototype.contextual=wt.prototype.fallback=wt.prototype.extend=!1;let wi="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG),wo=null;function ws(e,t,n){let r=e.cursor(k.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}class wl{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?ws(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?ws(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=n.children[r],o=this.start[t]+n.positions[r];if(o>e)return this.nextStart=o,null;if(i instanceof mS){if(o==e){if(o<this.safeFrom)return null;let e=o+i.length;if(e<=this.safeTo){let t=i.prop(mg.lookAhead);if(!t||e+t<this.fragment.to)return i}}this.index[t]++,o+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+i.length}}}class wa{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new x9)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,o=r.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,l=0;for(let r=0;r<i.length;r++){if((1<<r&o)==0)continue;let a=i[r],c=this.tokens[r];if((!n||a.fallback)&&((a.contextual||c.start!=e.pos||c.mask!=o||c.context!=s)&&(this.updateCachedToken(c,a,e),c.mask=o,c.context=s),c.lookAhead>c.end+25&&(l=Math.max(c.lookAhead,l)),0!=c.value)){let r=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!a.extend&&(n=c,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),n||e.pos!=this.stream.end||((n=new x9).value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new x9,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){(1&i)==0?e.value=i>>1:e.extended=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:o}=e.p,{data:s}=o;for(let e=0;e<2;e++)for(let l=o.stateSlot(i,e?2:1);;l+=3){if(65535==s[l])if(1==s[l+1])l=wf(s,l+2);else{0==r&&2==s[l+1]&&(r=this.putAction(wf(s,l+2),t,n,r));break}s[l]==t&&(r=this.putAction(wf(s,l+1),t,n,r))}return r}}class wc{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new we(t,r),this.tokens=new wa(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[x5.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>4*e.bufferLength?new wl(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,r=this.minStackPos,i=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<n.length;o++){let s=n[o];for(;;){if(this.tokens.mainToken=null,s.pos>r)i.push(s);else{if(this.advanceStack(s,i,n))continue;e||(e=[],t=[]),e.push(s);let r=this.tokens.getMainToken(s);t.push(r.value,r.end)}break}}if(!i.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}(e);if(t)return wi&&console.log("Finish with "+this.stackID(t)),this.stackToTree(t);if(this.parser.strict)throw wi&&e&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&e){let n=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,i);if(n)return wi&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(i.length>e)for(i.sort((e,t)=>t.score-e.score);i.length>e;)i.pop();i.some(e=>e.reducePos>r)&&this.recovering--}else if(i.length>1){i:for(let e=0;e<i.length-1;e++){let t=i[e];for(let n=e+1;n<i.length;n++){let r=i[n];if(t.sameState(r)||t.buffer.length>500&&r.buffer.length>500)if((t.score-r.score||t.buffer.length-r.buffer.length)>0)i.splice(n--,1);else{i.splice(e--,1);continue i}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let e=1;e<i.length;e++)i[e].pos<this.minStackPos&&(this.minStackPos=i[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,o=wi?this.stackID(e)+" -> ":"";if(null!=this.stoppedAt&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let s=this.fragments.nodeAt(r);s;){let r=this.parser.nodeSet.types[s.type.id]==s.type?i.getGoto(e.state,s.type.id):-1;if(r>-1&&s.length&&(!t||(s.prop(mg.contextHash)||0)==n))return e.useNode(s,r),wi&&console.log(o+this.stackID(e)+` (via reuse of ${i.getName(s.type.id)})`),!0;if(!(s instanceof mS)||0==s.children.length||s.positions[0]>0)break;let l=s.children[0];if(l instanceof mS&&0==s.positions[0])s=l;else break}}let s=i.stateSlot(e.state,4);if(s>0)return e.reduce(s),wi&&console.log(o+this.stackID(e)+` (via always-reduce ${i.getName(65535&s)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let s=0;s<l.length;){let a=l[s++],c=l[s++],u=l[s++],h=s==l.length||!n,d=h?e:e.split(),f=this.tokens.mainToken;if(d.apply(a,c,f?f.start:d.pos,u),wi&&console.log(o+this.stackID(d)+` (via ${(65536&a)==0?"shift":`reduce of ${i.getName(65535&a)}`} for ${i.getName(c)} @ ${r}${d==e?"":", split"})`),h)return!0;d.pos>r?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return wu(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=t[o<<1],a=t[(o<<1)+1],c=wi?this.stackID(s)+" -> ":"";if(s.deadEnd&&(i||(i=!0,s.restart(),wi&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))))continue;let u=s.split(),h=c;for(let e=0;u.forceReduce()&&e<10&&(wi&&console.log(h+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,n));e++)wi&&(h=this.stackID(u)+" -> ");for(let e of s.recoverByInsert(l))wi&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>s.pos?(a==s.pos&&(a++,l=0),s.recoverByDelete(l,a),wi&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(l)})`),wu(s,n)):(!r||r.score<s.score)&&(r=s)}return r}stackToTree(e){return e.close(),mS.build({buffer:x4.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(wo||(wo=new WeakMap)).get(e);return t||wo.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function wu(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}class wh{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}class wd extends mz{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push("");let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),r=[];for(let e=0;e<t.length;e++)r.push([]);function i(e,t,n){r[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=mg[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)i(r,e,t[n++]);else{let o=t[n+-r];for(let s=-r;s>0;s--)i(t[n++],e,o);n++}}}this.nodeSet=new mx(t.map((t,i)=>my.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:0==i,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let o=x6(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(wp),this.states=x6(e.states,Uint32Array),this.data=x6(e.stateData),this.goto=x6(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>"number"==typeof e?new wt(o,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new wc(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return -1;for(let i=r[t+1];;){let t=r[i++],o=1&t,s=r[i++];if(o&&n)return s;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return s;if(o)return -1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),o;;i+=3){if(65535==(o=n[i]))if(1==n[i+1])o=n[i=wf(n,i+2)];else if(2==n[i+1])return wf(n,i+2);else break;if(o==t||0==o)return wf(n,i+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==r;n+=3){if(65535==this.data[n])if(1==this.data[n+1])n=wf(this.data,n+2);else break;r=t(wf(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n])if(1==this.data[n+1])n=wf(this.data,n+2);else break;if((1&this.data[n+2])==0){let e=this.data[n+1];t.some((t,n)=>1&n&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(wd.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let i=e.specializers.find(e=>e.from==n.external);if(!i)return n;let o=Object.assign(Object.assign({},n),{external:i.to});return t.specializers[r]=wp(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(" ")){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;65535!=(i=this.data[n++]);)(r||(r=new Uint8Array(this.maxTerm+1)))[i]=1;return new wh(e,n,r)}static deserialize(e){return new wd(e)}}function wf(e,t){return e[t]|e[t+1]<<16}function wp(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}let wm=mU({String:gi.string,Number:gi.number,"True False":gi.bool,PropertyName:gi.propertyName,Null:gi.null,", :":gi.separator,"[ ]":gi.squareBracket,"{ }":gi.brace}),wg=wd.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[wm],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),wv=gc.define({name:"json",parser:wg.configure({props:[gD.add({Object:gO({except:/^\s*\}/}),Array:gO({except:/^\s*\]/})}),gE.add({"Object Array":function(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function wb(e){let t=(0,nu.Z)(),n="dark"===t.palette.mode,[r,i]=(0,D.useState)(()=>JSON.stringify(e.value,null,2)),[o,s]=(0,D.useState)(r);return(0,T.jsx)(x2,{...e,style:{border:`1px solid ${t.palette.divider}`},theme:n?"dark":"light",extensions:[new gx(wv),function(e,t={}){return[xS.of({source:e,config:t}),xC,xV]}(e=>{try{JSON.parse(e.state.doc.toString())}catch(i){var t;let n;if(!(i instanceof SyntaxError))throw i;let r=(t=e.state.doc,(n=i.message.match(/at position (\d+)/))?Math.min(+n[1],t.length):(n=i.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+n[1]).from+ +n[2]-1,t.length):0);return[{from:r,message:i.message,severity:"error",to:r}]}return[]}),function(e={}){return[xN.of(e),xL,xZ,xF,xB]}()],value:r,onChange:t=>{i(t),e.onChange&&e.onChange(t)},onBlur:()=>{o!==r&&void 0!==e.onChange&&(e.onChange(r),s(r))},placeholder:e.placeholder})}var wy=n(28797),wx=n(36679),ww=n(33755),wC=n(86396);function wS({control:e,...t}){let{fields:n,append:r,remove:i}=(0,wx.useFieldArray)({control:e,name:"panelDefinition.spec.links"});return(0,T.jsxs)(U.Z,{...t,gap:3,children:[n&&n.length>0?n.map((t,n)=>(0,T.jsxs)(D.Fragment,{children:[(0,T.jsxs)(U.Z,{direction:"row",gap:1,alignItems:"center",children:[(0,T.jsx)(wk,{control:e,index:n}),(0,T.jsx)(K.Z,{style:{width:"fit-content",height:"fit-content"},onClick:()=>i(n),children:(0,T.jsx)(wC.default,{})})]}),(0,T.jsx)(ca.Z,{})]},t.id)):(0,T.jsx)(sv.Z,{variant:"subtitle1",mb:2,fontStyle:"italic",children:"No links defined"}),(0,T.jsx)(K.Z,{style:{width:"fit-content",height:"fit-content"},onClick:()=>r({url:""}),children:(0,T.jsx)(ww.default,{})})]})}function wk({control:e,index:t}){return(0,T.jsxs)(U.Z,{gap:2,flexGrow:1,children:[(0,T.jsxs)(U.Z,{direction:"row",gap:2,children:[(0,T.jsx)(wx.Controller,{control:e,name:`panelDefinition.spec.links.${t}.url`,render:({field:e,fieldState:t})=>(0,T.jsx)(Y.Z,{...e,required:!0,fullWidth:!0,label:"URL",error:!!t.error,helperText:t.error?.message,onChange:t=>{e.onChange(t)}})}),(0,T.jsx)(wx.Controller,{control:e,name:`panelDefinition.spec.links.${t}.name`,render:({field:e,fieldState:t})=>(0,T.jsx)(Y.Z,{...e,fullWidth:!0,label:"Name",defaultValue:"",error:!!t.error,helperText:t.error?.message,onChange:t=>{e.onChange(t)}})}),(0,T.jsx)(wx.Controller,{control:e,name:`panelDefinition.spec.links.${t}.tooltip`,render:({field:e,fieldState:t})=>(0,T.jsx)(Y.Z,{...e,fullWidth:!0,label:"Tooltip",defaultValue:"",error:!!t.error,helperText:t.error?.message,onChange:t=>{e.onChange(t)}})})]}),(0,T.jsxs)(U.Z,{gap:2,direction:"row",alignItems:"center",children:[(0,T.jsx)(wx.Controller,{control:e,name:`panelDefinition.spec.links.${t}.renderVariables`,render:({field:e})=>(0,T.jsx)(wy.Z,{label:"Render Variables",control:(0,T.jsx)(sq.Z,{...e,checked:e.value,onChange:t=>e.onChange(t.target.checked)})})}),(0,T.jsx)(wx.Controller,{control:e,name:`panelDefinition.spec.links.${t}.targetBlank`,render:({field:e})=>(0,T.jsx)(wy.Z,{label:"Open in new tab",control:(0,T.jsx)(sq.Z,{...e,checked:e.value,onChange:t=>e.onChange(t.target.checked)})})})]})]})}let wM=[{id:"value",label:"Value"},{id:"percentage",label:"Percentage"}];function wT({disablePercentageMode:e,onChange:t,value:n="value"}){return(0,T.jsx)(lv,{label:"Mode",control:(0,T.jsx)(lC,{value:wM.find(e=>e.id===n),options:wM,getOptionLabel:e=>e.label,getOptionDisabled:t=>"percentage"===t.id&&e,onChange:(e,{id:n})=>{t(n)},disableClearable:!0})})}var wD=n(66224);function wA(e){let{message:t}=e;return(0,T.jsx)(U.Z,{sx:{height:"100%",alignItems:"center",justifyContent:"center"},children:(0,T.jsx)(sv.Z,{children:t})})}function wR(e){let{resource:t}=e;return(0,T.jsx)(wA,{message:`No ${t}`})}function wP(e){let{variant:t="rounded"}=e;return(0,T.jsx)(U.Z,{sx:{height:"100%",alignItems:"center",justifyContent:"center",px:1},children:(0,T.jsx)(wD.Z,{variant:t,width:"100%",height:"30%","aria-label":"Loading..."})})}let wO=[{id:"asc",label:"Ascending"},{id:"desc",label:"Descending"}];function wI({onChange:e,value:t="desc"}){return(0,T.jsx)(lv,{label:"Sort",control:(0,T.jsx)(lC,{value:wO.find(e=>e.id===t),options:wO,getOptionLabel:e=>e.label,onChange:(t,{id:n})=>{e(n)},disableClearable:!0})})}function wE({onChange:e,value:t,...n}){let r=t=>{e(t)};return(0,T.jsxs)(_,{"aria-label":"Sort",...n,children:[(0,T.jsx)(q.Z,{onClick:()=>r(void 0),variant:void 0===t?"contained":"outlined",children:"None"}),(0,T.jsx)(q.Z,{onClick:()=>r("asc"),variant:"asc"===t?"contained":"outlined",children:"Asc"}),(0,T.jsx)(q.Z,{onClick:()=>r("desc"),variant:"desc"===t?"contained":"outlined",children:"Desc"})]})}function wZ(e){return(0,V.ZP)("MuiToggleButtonGroup",e)}let wL=(0,F.Z)("MuiToggleButtonGroup",["root","selected","horizontal","vertical","disabled","grouped","groupedHorizontal","groupedVertical","fullWidth","firstButton","lastButton","middleButton"]),wj=D.createContext({}),wB=D.createContext(void 0);function wF(e){return(0,V.ZP)("MuiToggleButton",e)}let wV=(0,F.Z)("MuiToggleButton",["root","disabled","selected","standard","primary","secondary","sizeSmall","sizeMedium","sizeLarge","fullWidth"]),wN=(0,Z.ZP)("div",{name:"MuiToggleButtonGroup",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${wL.grouped}`]:t.grouped},{[`& .${wL.grouped}`]:t[`grouped${(0,E.Z)(n.orientation)}`]},{[`& .${wL.firstButton}`]:t.firstButton},{[`& .${wL.lastButton}`]:t.lastButton},{[`& .${wL.middleButton}`]:t.middleButton},t.root,"vertical"===n.orientation&&t.vertical,n.fullWidth&&t.fullWidth]}})((0,L.Z)(({theme:e})=>({display:"inline-flex",borderRadius:(e.vars||e).shape.borderRadius,variants:[{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${wL.grouped}`]:{[`&.${wL.selected} + .${wL.grouped}.${wL.selected}`]:{borderTop:0,marginTop:0}},[`& .${wL.firstButton},& .${wL.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${wL.lastButton},& .${wL.middleButton}`]:{marginTop:-1,borderTop:"1px solid transparent",borderTopLeftRadius:0,borderTopRightRadius:0},[`& .${wL.lastButton}.${wV.disabled},& .${wL.middleButton}.${wV.disabled}`]:{borderTop:"1px solid transparent"}}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"horizontal"},style:{[`& .${wL.grouped}`]:{[`&.${wL.selected} + .${wL.grouped}.${wL.selected}`]:{borderLeft:0,marginLeft:0}},[`& .${wL.firstButton},& .${wL.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${wL.lastButton},& .${wL.middleButton}`]:{marginLeft:-1,borderLeft:"1px solid transparent",borderTopLeftRadius:0,borderBottomLeftRadius:0},[`& .${wL.lastButton}.${wV.disabled},& .${wL.middleButton}.${wV.disabled}`]:{borderLeft:"1px solid transparent"}}}]}))),wH=D.forwardRef(function(e,t){let n=(0,B.i)({props:e,name:"MuiToggleButtonGroup"}),{children:r,className:i,color:o="standard",disabled:s=!1,exclusive:l=!1,fullWidth:a=!1,onChange:c,orientation:u="horizontal",size:h="medium",value:d,...f}=n,p={...n,disabled:s,fullWidth:a,orientation:u,size:h},m=(e=>{let{classes:t,orientation:n,fullWidth:r,disabled:i}=e,o={root:["root",n,r&&"fullWidth"],grouped:["grouped",`grouped${(0,E.Z)(n)}`,i&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return(0,P.Z)(o,wZ,t)})(p),g=D.useCallback((e,t)=>{let n;if(!c)return;let r=d&&d.indexOf(t);d&&r>=0?(n=d.slice()).splice(r,1):n=d?d.concat(t):[t],c(e,n)},[c,d]),v=D.useCallback((e,t)=>{c&&c(e,d===t?null:t)},[c,d]),b=D.useMemo(()=>({className:m.grouped,onChange:l?v:g,value:d,size:h,fullWidth:a,color:o,disabled:s}),[m.grouped,l,v,g,d,h,a,o,s]),y=I(r),x=y.length;return(0,T.jsx)(wN,{role:"group",className:(0,R.Z)(m.root,i),ref:t,ownerState:p,...f,children:(0,T.jsx)(wj.Provider,{value:b,children:y.map((e,t)=>(0,T.jsx)(wB.Provider,{value:(e=>{let t=0===e,n=e===x-1;return t&&n?"":t?m.firstButton:n?m.lastButton:m.middleButton})(t),children:e},t))})})});var wz=n(16819);let w$=(0,Z.ZP)(om.Z,{name:"MuiToggleButton",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`size${(0,E.Z)(n.size)}`]]}})((0,L.Z)(({theme:e})=>({...e.typography.button,borderRadius:(e.vars||e).shape.borderRadius,padding:11,border:`1px solid ${(e.vars||e).palette.divider}`,color:(e.vars||e).palette.action.active,[`&.${wV.disabled}`]:{color:(e.vars||e).palette.action.disabled,border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`},"&:hover":{textDecoration:"none",backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,O.Fq)(e.palette.text.primary,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[{props:{color:"standard"},style:{[`&.${wV.selected}`]:{color:(e.vars||e).palette.text.primary,backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,O.Fq)(e.palette.text.primary,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:(0,O.Fq)(e.palette.text.primary,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,O.Fq)(e.palette.text.primary,e.palette.action.selectedOpacity)}}}}},...Object.entries(e.palette).filter((0,j.Z)()).map(([t])=>({props:{color:t},style:{[`&.${wV.selected}`]:{color:(e.vars||e).palette[t].main,backgroundColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,O.Fq)(e.palette[t].main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:(0,O.Fq)(e.palette[t].main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,O.Fq)(e.palette[t].main,e.palette.action.selectedOpacity)}}}}})),{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{padding:7,fontSize:e.typography.pxToRem(13)}},{props:{size:"large"},style:{padding:15,fontSize:e.typography.pxToRem(15)}}]}))),wW=D.forwardRef(function(e,t){var n;let{value:r,...i}=D.useContext(wj),o=D.useContext(wB),s=(0,wz.Z)({...i,selected:(n=e.value,void 0!==r&&void 0!==n&&(Array.isArray(r)?r.includes(n):n===r))},e),l=(0,B.i)({props:s,name:"MuiToggleButton"}),{children:a,className:c,color:u="standard",disabled:h=!1,disableFocusRipple:d=!1,fullWidth:f=!1,onChange:p,onClick:m,selected:g,size:v="medium",value:b,...y}=l,x={...l,color:u,disabled:h,disableFocusRipple:d,fullWidth:f,size:v},w=(e=>{let{classes:t,fullWidth:n,selected:r,disabled:i,size:o,color:s}=e,l={root:["root",r&&"selected",i&&"disabled",n&&"fullWidth",`size${(0,E.Z)(o)}`,s]};return(0,P.Z)(l,wF,t)})(x);return(0,T.jsx)(w$,{className:(0,R.Z)(i.className,w.root,c,o||""),disabled:h,focusRipple:!d,ref:t,onClick:e=>{m&&(m(e,b),e.defaultPrevented)||p&&p(e,b)},onChange:p,value:b,ownerState:x,"aria-pressed":g,...y,children:a})}),w_=(0,n(79886).Z)();var wq=n(22446);function wG({inputRef:e,label:t,color:n,value:r,mode:i,onChange:o,onColorChange:s,onBlur:l,onDelete:a}){let[c,u]=(0,D.useState)(0);return(0,T.jsxs)(U.Z,{flex:1,direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[(0,T.jsx)(na,{label:t,color:n,onColorChange:s}),(0,T.jsx)(lu.Z,{htmlFor:t,children:t}),(0,T.jsx)(Y.Z,{id:t,inputRef:e,type:"number",value:0===r?"":r,placeholder:"0",onChange:o,onBlur:l,onKeyDown:e=>{"Enter"===e.key&&(l(),u(c+1))},InputProps:{endAdornment:"percent"===i?(0,T.jsx)(nh.Z,{paddingX:1,children:"%"}):void 0}},c),(0,T.jsx)(K.Z,{"aria-label":`delete threshold ${t}`,size:"small",onClick:a,children:(0,T.jsx)(wq.default,{})})]})}function wU({thresholds:e,onChange:t,hideDefault:n,disablePercentMode:r}){let{thresholds:{defaultColor:i,palette:o}}=eZ(),s=e?.defaultColor??i,[l,a]=(0,D.useState)(e?.steps);(0,D.useEffect)(()=>{a(e?.steps)},[e?.steps]);let c=(0,D.useRef)(null),u=(0,D.useRef)(!1);(0,D.useEffect)(()=>{c.current&&u.current&&(c.current?.focus(),u.current=!1)},[l?.length]);let h=()=>{if(void 0!==l){let n=[...l];n.sort((e,t)=>e.value-t.value),void 0!==e&&t((0,nf.Uy)(e,e=>{e.steps=n}))}};return(0,T.jsxs)(ly,{title:"Thresholds",icon:(0,T.jsx)(lp,{description:"Add threshold",children:(0,T.jsx)(K.Z,{size:"small","aria-label":"add threshold",onClick:()=>{u.current=!0,void 0===e?t({steps:[{value:10}]}):e&&void 0===e.steps?t((0,nf.Uy)(e,e=>{e.steps=[{value:10}]})):t((0,nf.Uy)(e,e=>{let t=e.steps;if(t?.length){let e=t[t.length-1],n=o[t.length]??wK();t.push({color:n,value:(e?.value??0)+10})}else t&&t.push({value:10})}))},children:(0,T.jsx)(ww.default,{})})}),children:[(0,T.jsx)(lv,{label:"Mode",description:"Percentage means thresholds relative to min & max",control:(0,T.jsxs)(wH,{exclusive:!0,disabled:r,value:e?.mode??"absolute",onChange:(n,r)=>{let i="percent"===r?"percent":void 0;void 0!==e?t((0,nf.Uy)(e,e=>{e.mode=i})):t({mode:i})},sx:{height:"36px",marginLeft:"auto"},children:[(0,T.jsx)(wW,{"aria-label":"absolute",value:"absolute",sx:{fontWeight:500},children:"Absolute"}),(0,T.jsx)(wW,{"aria-label":"percent",value:"percent",sx:{fontWeight:500},children:"Percent"})]})}),l&&l.map((n,r)=>(0,T.jsx)(wG,{inputRef:r===l.length-1?c:void 0,label:`T${r+1}`,color:n.color??o[r]??s,value:n.value,mode:e?.mode,onColorChange:n=>{void 0!==e&&t((0,nf.Uy)(e,e=>{if(void 0!==e.steps){let t=e.steps[r];t&&(t.color=n)}}))},onChange:e=>{a((0,nf.Uy)(l,t=>{let n=t?.[r];n&&(n.value=Number(e.target.value))}))},onDelete:()=>{void 0!==e&&t((0,nf.Uy)(e,e=>{e.steps&&e.steps.splice(r,1)}))},onBlur:h},r)).reverse(),!n&&(0,T.jsxs)(w_,{flex:1,direction:"row",alignItems:"center",spacing:1,children:[(0,T.jsx)(na,{label:"default",color:s,onColorChange:n=>{void 0!==e?t((0,nf.Uy)(e,e=>{e.defaultColor=n})):t({defaultColor:n})}}),(0,T.jsx)(sv.Z,{children:"Default"})]})]})}let wK=()=>"#"+Math.floor(0x1000000*Math.random()).toString(16).padStart(6,"0");var wY=n(63767),wX=n(59986),wQ=n(68014);let wJ=["localeText"],w0=D.createContext(null),w1=function(e){let{localeText:t}=e,n=(0,ch.Z)(e,wJ),{utils:r,localeText:i}=D.useContext(w0)??{utils:void 0,localeText:void 0},{children:o,dateAdapter:s,dateFormats:l,dateLibInstance:a,adapterLocale:c,localeText:u}=(0,wQ.Z)({props:n,name:"MuiLocalizationProvider"}),h=D.useMemo(()=>(0,cu.Z)({},u,i,t),[u,i,t]),d=D.useMemo(()=>{if(!s)return r||null;let e=new s({locale:c,formats:l,instance:a});if(!e.isMUIAdapter)throw Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`","For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`","More information on the installation documentation: https://mui.com/x/react-date-pickers/getting-started/#installation"].join(`
6
+ `));return e},[s,c,l,a,r]),f=D.useMemo(()=>d?{minDate:d.date("1900-01-01T00:00:00.000"),maxDate:d.date("2099-12-31T00:00:00.000")}:null,[d]),p=D.useMemo(()=>({utils:d,defaultDates:f,localeText:h}),[f,d,h]);return(0,T.jsx)(w0.Provider,{value:p,children:o})};var w2=n(23615),w5=n.n(w2);let w3={previousMonth:"Previous month",nextMonth:"Next month",openPreviousView:"Open previous view",openNextView:"Open next view",calendarViewSwitchingButtonAriaLabel:e=>"year"===e?"year view is open, switch to calendar view":"calendar view is open, switch to year view",start:"Start",end:"End",startDate:"Start date",startTime:"Start time",endDate:"End date",endTime:"End time",cancelButtonLabel:"Cancel",clearButtonLabel:"Clear",okButtonLabel:"OK",todayButtonLabel:"Today",datePickerToolbarTitle:"Select date",dateTimePickerToolbarTitle:"Select date & time",timePickerToolbarTitle:"Select time",dateRangePickerToolbarTitle:"Select date range",clockLabelText:(e,t,n,r)=>`Select ${e}. ${!r&&(null===t||!n.isValid(t))?"No time selected":`Selected time is ${r??n.format(t,"fullTime")}`}`,hoursClockNumberText:e=>`${e} hours`,minutesClockNumberText:e=>`${e} minutes`,secondsClockNumberText:e=>`${e} seconds`,selectViewText:e=>`Select ${e}`,calendarWeekNumberHeaderLabel:"Week number",calendarWeekNumberHeaderText:"#",calendarWeekNumberAriaLabelText:e=>`Week ${e}`,calendarWeekNumberText:e=>`${e}`,openDatePickerDialogue:(e,t,n)=>n||null!==e&&t.isValid(e)?`Choose date, selected date is ${n??t.format(e,"fullDate")}`:"Choose date",openTimePickerDialogue:(e,t,n)=>n||null!==e&&t.isValid(e)?`Choose time, selected time is ${n??t.format(e,"fullTime")}`:"Choose time",fieldClearLabel:"Clear",timeTableLabel:"pick time",dateTableLabel:"pick date",fieldYearPlaceholder:e=>"Y".repeat(e.digitAmount),fieldMonthPlaceholder:e=>"letter"===e.contentType?"MMMM":"MM",fieldDayPlaceholder:()=>"DD",fieldWeekDayPlaceholder:e=>"letter"===e.contentType?"EEEE":"EE",fieldHoursPlaceholder:()=>"hh",fieldMinutesPlaceholder:()=>"mm",fieldSecondsPlaceholder:()=>"ss",fieldMeridiemPlaceholder:()=>"aa",year:"Year",month:"Month",day:"Day",weekDay:"Week day",hours:"Hours",minutes:"Minutes",seconds:"Seconds",meridiem:"Meridiem",empty:"Empty"};(0,cu.Z)({},w3);let w8=()=>{let e=D.useContext(w0);if(null===e)throw Error("MUI X: Can not find the date and time pickers localization context.\nIt looks like you forgot to wrap your component in LocalizationProvider.\nThis can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package");if(null===e.utils)throw Error("MUI X: Can not find the date and time pickers adapter from its localization context.\nIt looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.");let t=D.useMemo(()=>(0,cu.Z)({},w3,e.localeText),[e.localeText]);return D.useMemo(()=>(0,cu.Z)({},e,{localeText:t}),[e,t])},w4=()=>w8().utils,w6=()=>w8().defaultDates,w9=e=>{let t=w4(),n=D.useRef(void 0);return void 0===n.current&&(n.current=t.date(void 0,e)),n.current},w7=(e,t,n)=>{let r=t;return r=e.setHours(r,e.getHours(n)),r=e.setMinutes(r,e.getMinutes(n)),r=e.setSeconds(r,e.getSeconds(n)),r=e.setMilliseconds(r,e.getMilliseconds(n))},Ce=({date:e,disableFuture:t,disablePast:n,maxDate:r,minDate:i,isDateDisabled:o,utils:s,timezone:l})=>{let a=w7(s,s.date(void 0,l),e);n&&s.isBefore(i,a)&&(i=a),t&&s.isAfter(r,a)&&(r=a);let c=e,u=e;for(s.isBefore(e,i)&&(c=i,u=null),s.isAfter(e,r)&&(u&&(u=r),c=null);c||u;){if(c&&s.isAfter(c,r)&&(c=null),u&&s.isBefore(u,i)&&(u=null),c){if(!o(c))return c;c=s.addDays(c,1)}if(u){if(!o(u))return u;u=s.addDays(u,-1)}}return null},Ct=(e,t,n)=>null!=t&&e.isValid(t)?t:n,Cn=(e,t)=>{let n=[e.startOfYear(t)];for(;n.length<12;){let t=n[n.length-1];n.push(e.addMonths(t,1))}return n},Cr=(e,t,n)=>"date"===n?e.startOfDay(e.date(void 0,t)):e.date(void 0,t),Ci=(e,t)=>{let n=e.setHours(e.date(),"am"===t?2:14);return e.format(n,"meridiem")},Co=["year","month","day"],Cs=e=>Co.includes(e);var Cl=n(49408),Ca=n(51781),Cc=n(16052);let Cu=(0,sb.Z)((0,T.jsx)("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown"),Ch=(0,sb.Z)((0,T.jsx)("path",{d:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"ArrowLeft"),Cd=(0,sb.Z)((0,T.jsx)("path",{d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"}),"ArrowRight");(0,sb.Z)((0,T.jsx)("path",{d:"M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"}),"Calendar"),(0,sb.Z)((0,T.jsxs)(D.Fragment,{children:[(0,T.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),(0,T.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Clock");let Cf=(0,sb.Z)((0,T.jsx)("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"}),"DateRange"),Cp=(0,sb.Z)((0,T.jsxs)(D.Fragment,{children:[(0,T.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),(0,T.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Time"),Cm=(0,sb.Z)((0,T.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear"),Cg=()=>w8().localeText;function Cv(e){return(0,V.ZP)("MuiDateTimePickerTabs",e)}(0,F.Z)("MuiDateTimePickerTabs",["root"]);let Cb=(0,Z.ZP)(Ca.Z,{name:"MuiDateTimePickerTabs",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({boxShadow:`0 -1px 0 0 inset ${(e.vars||e).palette.divider}`,"&:last-child":{boxShadow:`0 1px 0 0 inset ${(e.vars||e).palette.divider}`,[`& .${Cc.Z.indicator}`]:{bottom:"auto",top:0}}})),Cy=function(e){let t=(0,wQ.Z)({props:e,name:"MuiDateTimePickerTabs"}),{dateIcon:n=(0,T.jsx)(Cf,{}),onViewChange:r,timeIcon:i=(0,T.jsx)(Cp,{}),view:o,hidden:s="undefined"==typeof window||window.innerHeight<667,className:l,sx:a}=t,c=Cg(),u=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"]},Cv,t)})(t);return s?null:(0,T.jsxs)(Cb,{ownerState:t,variant:"fullWidth",value:Cs(o)?"date":"time",onChange:(e,t)=>{r("date"===t?"day":"hours")},className:(0,R.Z)(l,u.root),sx:a,children:[(0,T.jsx)(Cl.Z,{value:"date","aria-label":c.dateTableLabel,icon:(0,T.jsx)(D.Fragment,{children:n})}),(0,T.jsx)(Cl.Z,{value:"time","aria-label":c.timeTableLabel,icon:(0,T.jsx)(D.Fragment,{children:i})})]})};function Cx(e){return(0,V.ZP)("MuiPickersToolbarText",e)}let Cw=(0,F.Z)("MuiPickersToolbarText",["root","selected"]),CC=["className","selected","value"],CS=(0,Z.ZP)(sv.Z,{name:"MuiPickersToolbarText",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`&.${Cw.selected}`]:t.selected}]})(({theme:e})=>({transition:e.transitions.create("color"),color:(e.vars||e).palette.text.secondary,[`&.${Cw.selected}`]:{color:(e.vars||e).palette.text.primary}})),Ck=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiPickersToolbarText"}),{className:r,value:i}=n,o=(0,ch.Z)(n,CC),s=(e=>{let{classes:t,selected:n}=e;return(0,P.Z)({root:["root",n&&"selected"]},Cx,t)})(n);return(0,T.jsx)(CS,(0,cu.Z)({ref:t,className:(0,R.Z)(s.root,r),component:"span"},o,{children:i}))});function CM(e){return(0,V.ZP)("MuiPickersToolbar",e)}let CT=(0,F.Z)("MuiPickersToolbar",["root","content"]),CD=["children","className","toolbarTitle","hidden","titleId","isLandscape","classes","landscapeDirection"],CA=(0,Z.ZP)("div",{name:"MuiPickersToolbar",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"space-between",padding:e.spacing(2,3),variants:[{props:{isLandscape:!0},style:{height:"auto",maxWidth:160,padding:16,justifyContent:"flex-start",flexWrap:"wrap"}}]})),CR=(0,Z.ZP)("div",{name:"MuiPickersToolbar",slot:"Content",overridesResolver:(e,t)=>t.content})({display:"flex",flexWrap:"wrap",width:"100%",flex:1,justifyContent:"space-between",alignItems:"center",flexDirection:"row",variants:[{props:{isLandscape:!0},style:{justifyContent:"flex-start",alignItems:"flex-start",flexDirection:"column"}},{props:{isLandscape:!0,landscapeDirection:"row"},style:{flexDirection:"row"}}]}),CP=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiPickersToolbar"}),{children:r,className:i,toolbarTitle:o,hidden:s,titleId:l}=n,a=(0,ch.Z)(n,CD),c=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"],content:["content"]},CM,t)})(n);return s?null:(0,T.jsxs)(CA,(0,cu.Z)({ref:t,className:(0,R.Z)(c.root,i),ownerState:n},a,{children:[(0,T.jsx)(sv.Z,{color:"text.secondary",variant:"overline",id:l,children:o}),(0,T.jsx)(CR,{className:c.content,ownerState:n,children:r})]}))}),CO=["align","className","selected","typographyClassName","value","variant","width"],CI=(0,Z.ZP)(q.Z,{name:"MuiPickersToolbarButton",slot:"Root",overridesResolver:(e,t)=>t.root})({padding:0,minWidth:16,textTransform:"none"}),CE=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiPickersToolbarButton"}),{align:r,className:i,selected:o,typographyClassName:s,value:l,variant:a,width:c}=n,u=(0,ch.Z)(n,CO),h=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"]},CM,t)})(n);return(0,T.jsx)(CI,(0,cu.Z)({variant:"text",ref:t,className:(0,R.Z)(h.root,i)},c?{sx:{width:c}}:{},u,{children:(0,T.jsx)(Ck,{align:r,className:s,variant:a,value:l,selected:o})}))});function CZ(e){return(0,V.ZP)("MuiDateTimePickerToolbar",e)}let CL=(0,F.Z)("MuiDateTimePickerToolbar",["root","dateContainer","timeContainer","timeDigitsContainer","separator","timeLabelReverse","ampmSelection","ampmLandscape","ampmLabel"]),Cj=["hours","minutes","seconds"],CB=e=>Cj.includes(e),CF=(e,t,n)=>n&&(e>=12?"pm":"am")!==t?"am"===t?e-12:e+12:e,CV=(e,t)=>3600*t.getHours(e)+60*t.getMinutes(e)+t.getSeconds(e),CN=(e,t)=>(n,r)=>e?t.isAfter(n,r):CV(n,t)>CV(r,t);function CH(e,t,n,r){let i=w4();return{meridiemMode:e?i.getHours(e)>=12?"pm":"am":null,handleMeridiemChange:D.useCallback(o=>{n(null==e?null:((e,t,n,r)=>{let i=CF(r.getHours(e),t,n);return r.setHours(e,i)})(e,o,!!t,i),r??"partial")},[t,e,n,r,i])}}let Cz=["ampm","ampmInClock","value","onChange","view","isLandscape","onViewChange","toolbarFormat","toolbarPlaceholder","views","disabled","readOnly","toolbarVariant","toolbarTitle","className"],C$=(0,Z.ZP)(CP,{name:"MuiDateTimePickerToolbar",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({paddingLeft:16,paddingRight:16,justifyContent:"space-around",position:"relative",variants:[{props:{toolbarVariant:"desktop"},style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,[`& .${CT.content} .${Cw.selected}`]:{color:(e.vars||e).palette.primary.main,fontWeight:e.typography.fontWeightBold}}},{props:{toolbarVariant:"desktop",isLandscape:!0},style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:{toolbarVariant:"desktop",isLandscape:!1},style:{paddingLeft:24,paddingRight:0}}]})),CW=(0,Z.ZP)("div",{name:"MuiDateTimePickerToolbar",slot:"DateContainer",overridesResolver:(e,t)=>t.dateContainer})({display:"flex",flexDirection:"column",alignItems:"flex-start"}),C_=(0,Z.ZP)("div",{name:"MuiDateTimePickerToolbar",slot:"TimeContainer",overridesResolver:(e,t)=>t.timeContainer})({display:"flex",flexDirection:"row",variants:[{props:{isRtl:!0},style:{flexDirection:"row-reverse"}},{props:{toolbarVariant:"desktop",isLandscape:!1},style:{gap:9,marginRight:4,alignSelf:"flex-end"}},{props:({isLandscape:e,toolbarVariant:t})=>e&&"desktop"!==t,style:{flexDirection:"column"}},{props:({isLandscape:e,toolbarVariant:t,isRtl:n})=>e&&"desktop"!==t&&n,style:{flexDirection:"column-reverse"}}]}),Cq=(0,Z.ZP)("div",{name:"MuiDateTimePickerToolbar",slot:"TimeDigitsContainer",overridesResolver:(e,t)=>t.timeDigitsContainer})({display:"flex",variants:[{props:{isRtl:!0},style:{flexDirection:"row-reverse"}},{props:{toolbarVariant:"desktop"},style:{gap:1.5}}]}),CG=(0,Z.ZP)(Ck,{name:"MuiDateTimePickerToolbar",slot:"Separator",overridesResolver:(e,t)=>t.separator})({margin:"0 4px 0 2px",cursor:"default",variants:[{props:{toolbarVariant:"desktop"},style:{margin:0}}]}),CU=(0,Z.ZP)("div",{name:"MuiDateTimePickerToolbar",slot:"AmPmSelection",overridesResolver:(e,t)=>[{[`.${CL.ampmLabel}`]:t.ampmLabel},{[`&.${CL.ampmLandscape}`]:t.ampmLandscape},t.ampmSelection]})({display:"flex",flexDirection:"column",marginRight:"auto",marginLeft:12,[`& .${CL.ampmLabel}`]:{fontSize:17},variants:[{props:{isLandscape:!0},style:{margin:"4px 0 auto",flexDirection:"row",justifyContent:"space-around",width:"100%"}}]});function CK(e){let t=(0,wQ.Z)({props:e,name:"MuiDateTimePickerToolbar"}),{ampm:n,ampmInClock:r,value:i,onChange:o,view:s,isLandscape:l,onViewChange:a,toolbarFormat:c,toolbarPlaceholder:u="––",views:h,disabled:d,readOnly:f,toolbarVariant:p="mobile",toolbarTitle:m,className:g}=t,v=(0,ch.Z)(t,Cz),b=(0,aC.V)(),y=(0,cu.Z)({},t,{isRtl:b}),x=w4(),{meridiemMode:w,handleMeridiemChange:C}=CH(i,n,o),S=!!(n&&!r),k="desktop"===p,M=Cg(),A=(e=>{let{classes:t,isLandscape:n,isRtl:r}=e;return(0,P.Z)({root:["root"],dateContainer:["dateContainer"],timeContainer:["timeContainer",r&&"timeLabelReverse"],timeDigitsContainer:["timeDigitsContainer",r&&"timeLabelReverse"],separator:["separator"],ampmSelection:["ampmSelection",n&&"ampmLandscape"],ampmLabel:["ampmLabel"]},CZ,t)})(y),O=m??M.dateTimePickerToolbarTitle,I=D.useMemo(()=>i?c?x.formatByString(i,c):x.format(i,"shortDate"):u,[i,c,u,x]);return(0,T.jsxs)(C$,(0,cu.Z)({isLandscape:l,className:(0,R.Z)(A.root,g),toolbarTitle:O},v,{ownerState:y,children:[(0,T.jsxs)(CW,{className:A.dateContainer,ownerState:y,children:[h.includes("year")&&(0,T.jsx)(CE,{tabIndex:-1,variant:"subtitle1",onClick:()=>a("year"),selected:"year"===s,value:i?x.format(i,"year"):"–"}),h.includes("day")&&(0,T.jsx)(CE,{tabIndex:-1,variant:k?"h5":"h4",onClick:()=>a("day"),selected:"day"===s,value:I})]}),(0,T.jsxs)(C_,{className:A.timeContainer,ownerState:y,children:[(0,T.jsxs)(Cq,{className:A.timeDigitsContainer,ownerState:y,children:[h.includes("hours")&&(0,T.jsxs)(D.Fragment,{children:[(0,T.jsx)(CE,{variant:k?"h5":"h3",width:k&&!l?48:void 0,onClick:()=>a("hours"),selected:"hours"===s,value:i?n?x.format(i,"hours12h"):x.format(i,"hours24h"):"--"}),(0,T.jsx)(CG,{variant:k?"h5":"h3",value:":",className:A.separator,ownerState:y}),(0,T.jsx)(CE,{variant:k?"h5":"h3",width:k&&!l?48:void 0,onClick:()=>a("minutes"),selected:"minutes"===s||!h.includes("minutes")&&"hours"===s,value:i?x.format(i,"minutes"):"--",disabled:!h.includes("minutes")})]}),h.includes("seconds")&&(0,T.jsxs)(D.Fragment,{children:[(0,T.jsx)(CG,{variant:k?"h5":"h3",value:":",className:A.separator,ownerState:y}),(0,T.jsx)(CE,{variant:k?"h5":"h3",width:k&&!l?48:void 0,onClick:()=>a("seconds"),selected:"seconds"===s,value:i?x.format(i,"seconds"):"--"})]})]}),S&&!k&&(0,T.jsxs)(CU,{className:A.ampmSelection,ownerState:y,children:[(0,T.jsx)(CE,{variant:"subtitle2",selected:"am"===w,typographyClassName:A.ampmLabel,value:Ci(x,"am"),onClick:f?void 0:()=>C("am"),disabled:d}),(0,T.jsx)(CE,{variant:"subtitle2",selected:"pm"===w,typographyClassName:A.ampmLabel,value:Ci(x,"pm"),onClick:f?void 0:()=>C("pm"),disabled:d})]}),n&&k&&(0,T.jsx)(CE,{variant:"h5",onClick:()=>a("meridiem"),selected:"meridiem"===s,value:i&&w?Ci(x,w):"--",width:48})]})]}))}var CY=n(5056),CX=n(25399);function CQ(e){return(0,V.ZP)("MuiPickersArrowSwitcher",e)}(0,F.Z)("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);let CJ=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],C0=["ownerState"],C1=["ownerState"],C2=(0,Z.ZP)("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),C5=(0,Z.ZP)("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),C3=(0,Z.ZP)(K.Z,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),C8=D.forwardRef(function(e,t){let n=(0,aC.V)(),r=(0,wQ.Z)({props:e,name:"MuiPickersArrowSwitcher"}),{children:i,className:o,slots:s,slotProps:l,isNextDisabled:a,isNextHidden:c,onGoToNext:u,nextLabel:h,isPreviousDisabled:d,isPreviousHidden:f,onGoToPrevious:p,previousLabel:m,labelId:g}=r,v=(0,ch.Z)(r,CJ),b=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},CQ,t)})(r),y=s?.previousIconButton??C3,x=(0,CX.Z)({elementType:y,externalSlotProps:l?.previousIconButton,additionalProps:{size:"medium",title:m,"aria-label":m,disabled:d,edge:"end",onClick:p},ownerState:(0,cu.Z)({},r,{hidden:f}),className:(0,R.Z)(b.button,b.previousIconButton)}),w=s?.nextIconButton??C3,C=(0,CX.Z)({elementType:w,externalSlotProps:l?.nextIconButton,additionalProps:{size:"medium",title:h,"aria-label":h,disabled:a,edge:"start",onClick:u},ownerState:(0,cu.Z)({},r,{hidden:c}),className:(0,R.Z)(b.button,b.nextIconButton)}),S=s?.leftArrowIcon??Ch,k=(0,CX.Z)({elementType:S,externalSlotProps:l?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:r,className:b.leftArrowIcon}),M=(0,ch.Z)(k,C0),D=s?.rightArrowIcon??Cd,A=(0,CX.Z)({elementType:D,externalSlotProps:l?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:r,className:b.rightArrowIcon}),O=(0,ch.Z)(A,C1);return(0,T.jsxs)(C2,(0,cu.Z)({ref:t,className:(0,R.Z)(b.root,o),ownerState:r},v,{children:[(0,T.jsx)(y,(0,cu.Z)({},x,{children:n?(0,T.jsx)(D,(0,cu.Z)({},O)):(0,T.jsx)(S,(0,cu.Z)({},M))})),i?(0,T.jsx)(sv.Z,{variant:"subtitle1",component:"span",id:g,children:i}):(0,T.jsx)(C5,{className:b.spacer,ownerState:r}),(0,T.jsx)(w,(0,cu.Z)({},C,{children:n?(0,T.jsx)(S,(0,cu.Z)({},M)):(0,T.jsx)(D,(0,cu.Z)({},O))}))]}))});var C4=n(81925),C6=n(9831);function C9({onChange:e,onViewChange:t,openTo:n,view:r,views:i,autoFocus:o,focusedView:s,onFocusedViewChange:l}){let a=D.useRef(n),c=D.useRef(i),u=D.useRef(i.includes(n)?n:i[0]),[h,d]=(0,C6.Z)({name:"useViews",state:"view",controlled:r,default:u.current}),f=D.useRef(o?h:null),[p,m]=(0,C6.Z)({name:"useViews",state:"focusedView",controlled:s,default:f.current});D.useEffect(()=>{(a.current&&a.current!==n||c.current&&c.current.some(e=>!i.includes(e)))&&(d(i.includes(n)?n:i[0]),c.current=i,a.current=n)},[n,d,h,i]);let g=i.indexOf(h),v=i[g-1]??null,b=i[g+1]??null,y=(0,C4.Z)((e,t)=>{t?m(e):m(t=>e===t?null:t),l?.(e,t)}),x=(0,C4.Z)(e=>{y(e,!0),e!==h&&(d(e),t&&t(e))}),w=(0,C4.Z)(()=>{b&&x(b)}),C=(0,C4.Z)((t,n,r)=>{let o="finish"===n,s=r?i.indexOf(r)<i.length-1:!!b;if(e(t,o&&s?"partial":n,r),r&&r!==h){let e=i[i.indexOf(r)+1];e&&x(e)}else o&&w()});return{view:h,setView:x,focusedView:p,setFocusedView:y,nextView:b,previousView:v,defaultView:i.includes(n)?n:i[0],goToNextView:w,setValueAndGoToNextView:C}}let C7=(0,Z.ZP)("div")({overflow:"hidden",width:320,maxHeight:336,display:"flex",flexDirection:"column",margin:"0 auto"});function Se(e){return(0,V.ZP)("MuiTimeClock",e)}(0,F.Z)("MuiTimeClock",["root","arrowSwitcher"]);var St=n(96858);let Sn=110,Sr=110,Si=Sn,So=0,Ss=Si-Sn,Sl=So-Sr,Sa=(e,t,n)=>{let r=t-Sn,i=n-Sr,o=180/Math.PI*(Math.atan2(Ss,Sl)-Math.atan2(r,i));return{value:Math.floor((o=Math.round(o/e)*e%360)/e)||0,distance:Math.sqrt(r**2+i**2)}};function Sc(e){return(0,V.ZP)("MuiClockPointer",e)}(0,F.Z)("MuiClockPointer",["root","thumb"]);let Su=["className","hasSelected","isInner","type","viewValue"],Sh=(0,Z.ZP)("div",{name:"MuiClockPointer",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({width:2,backgroundColor:(e.vars||e).palette.primary.main,position:"absolute",left:"calc(50% - 1px)",bottom:"50%",transformOrigin:"center bottom 0px",variants:[{props:{shouldAnimate:!0},style:{transition:e.transitions.create(["transform","height"])}}]})),Sd=(0,Z.ZP)("div",{name:"MuiClockPointer",slot:"Thumb",overridesResolver:(e,t)=>t.thumb})(({theme:e})=>({width:4,height:4,backgroundColor:(e.vars||e).palette.primary.contrastText,borderRadius:"50%",position:"absolute",top:-21,left:"calc(50% - 18px)",border:`16px solid ${(e.vars||e).palette.primary.main}`,boxSizing:"content-box",variants:[{props:{hasSelected:!0},style:{backgroundColor:(e.vars||e).palette.primary.main}}]}));function Sf(e){let t,n=(0,wQ.Z)({props:e,name:"MuiClockPointer"}),{className:r,isInner:i,type:o,viewValue:s}=n,l=(0,ch.Z)(n,Su),a=D.useRef(o);D.useEffect(()=>{a.current=o},[o]);let c=(0,cu.Z)({},n,{shouldAnimate:a.current!==o}),u=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"],thumb:["thumb"]},Sc,t)})(c);return(0,T.jsx)(Sh,(0,cu.Z)({style:(t=360/("hours"===o?12:60)*s,"hours"===o&&s>12&&(t-=360),{height:Math.round((i?.26:.4)*220),transform:`rotateZ(${t}deg)`}),className:(0,R.Z)(u.root,r),ownerState:c},l,{children:(0,T.jsx)(Sd,{ownerState:c,className:u.thumb})}))}function Sp(e){return(0,V.ZP)("MuiClock",e)}(0,F.Z)("MuiClock",["root","clock","wrapper","squareMask","pin","amButton","pmButton","meridiemText","selected"]);let Sm=(0,Z.ZP)("div",{name:"MuiClock",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",margin:e.spacing(2)})),Sg=(0,Z.ZP)("div",{name:"MuiClock",slot:"Clock",overridesResolver:(e,t)=>t.clock})({backgroundColor:"rgba(0,0,0,.07)",borderRadius:"50%",height:220,width:220,flexShrink:0,position:"relative",pointerEvents:"none"}),Sv=(0,Z.ZP)("div",{name:"MuiClock",slot:"Wrapper",overridesResolver:(e,t)=>t.wrapper})({"&:focus":{outline:"none"}}),Sb=(0,Z.ZP)("div",{name:"MuiClock",slot:"SquareMask",overridesResolver:(e,t)=>t.squareMask})({width:"100%",height:"100%",position:"absolute",pointerEvents:"auto",outline:0,touchAction:"none",userSelect:"none",variants:[{props:{disabled:!1},style:{"@media (pointer: fine)":{cursor:"pointer",borderRadius:"50%"},"&:active":{cursor:"move"}}}]}),Sy=(0,Z.ZP)("div",{name:"MuiClock",slot:"Pin",overridesResolver:(e,t)=>t.pin})(({theme:e})=>({width:6,height:6,borderRadius:"50%",backgroundColor:(e.vars||e).palette.primary.main,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"})),Sx=(e,t)=>({zIndex:1,bottom:8,paddingLeft:4,paddingRight:4,width:36,variants:[{props:{meridiemMode:t},style:{backgroundColor:(e.vars||e).palette.primary.main,color:(e.vars||e).palette.primary.contrastText,"&:hover":{backgroundColor:(e.vars||e).palette.primary.light}}}]}),Sw=(0,Z.ZP)(K.Z,{name:"MuiClock",slot:"AmButton",overridesResolver:(e,t)=>t.amButton})(({theme:e})=>(0,cu.Z)({},Sx(e,"am"),{position:"absolute",left:8})),SC=(0,Z.ZP)(K.Z,{name:"MuiClock",slot:"PmButton",overridesResolver:(e,t)=>t.pmButton})(({theme:e})=>(0,cu.Z)({},Sx(e,"pm"),{position:"absolute",right:8})),SS=(0,Z.ZP)(sv.Z,{name:"MuiClock",slot:"meridiemText",overridesResolver:(e,t)=>t.meridiemText})({overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"});function Sk(e){let t=(0,wQ.Z)({props:e,name:"MuiClock"}),{ampm:n,ampmInClock:r,autoFocus:i,children:o,value:s,handleMeridiemChange:l,isTimeDisabled:a,meridiemMode:c,minutesStep:u=1,onChange:h,selectedId:d,type:f,viewValue:p,viewRange:[m,g],disabled:v=!1,readOnly:b,className:y}=t,x=w4(),w=Cg(),C=D.useRef(!1),S=(e=>{let{classes:t,meridiemMode:n}=e;return(0,P.Z)({root:["root"],clock:["clock"],wrapper:["wrapper"],squareMask:["squareMask"],pin:["pin"],amButton:["amButton","am"===n&&"selected"],pmButton:["pmButton","pm"===n&&"selected"],meridiemText:["meridiemText"]},Sp,t)})(t),k=a(p,f),M=!n&&"hours"===f&&(p<1||p>12),A=(e,t)=>{v||b||a(e,f)||h(e,t)},O=(e,t)=>{let{offsetX:r,offsetY:i}=e;if(void 0===r){let t=e.target.getBoundingClientRect();r=e.changedTouches[0].clientX-t.left,i=e.changedTouches[0].clientY-t.top}A("seconds"===f||"minutes"===f?((e,t,n=1)=>{let{value:r}=Sa(6*n,e,t);return r*n%60})(r,i,u):((e,t,n)=>{let{value:r,distance:i}=Sa(30,e,t),o=r||12;return n?o%=12:i<74&&(o+=12,o%=24),o})(r,i,!!n),t)},I=e=>{C.current=!0,O(e,"shallow")},E=D.useMemo(()=>"hours"===f||p%5==0,[f,p]),Z="minutes"===f?u:1,L=D.useRef(null);(0,St.Z)(()=>{i&&L.current.focus()},[i]);let j=e=>Math.max(m,Math.min(g,e)),B=e=>(e+(g+1))%(g+1);return(0,T.jsxs)(Sm,{className:(0,R.Z)(S.root,y),children:[(0,T.jsxs)(Sg,{className:S.clock,children:[(0,T.jsx)(Sb,{onTouchMove:I,onTouchStart:I,onTouchEnd:e=>{C.current&&(O(e,"finish"),C.current=!1),e.preventDefault()},onMouseUp:e=>{C.current&&(C.current=!1),O(e.nativeEvent,"finish")},onMouseMove:e=>{e.buttons>0&&O(e.nativeEvent,"shallow")},ownerState:{disabled:v},className:S.squareMask}),!k&&(0,T.jsxs)(D.Fragment,{children:[(0,T.jsx)(Sy,{className:S.pin}),null!=s&&(0,T.jsx)(Sf,{type:f,viewValue:p,isInner:M,hasSelected:E})]}),(0,T.jsx)(Sv,{"aria-activedescendant":d,"aria-label":w.clockLabelText(f,s,x,null==s?null:x.format(s,"fullTime")),ref:L,role:"listbox",onKeyDown:e=>{if(!C.current)switch(e.key){case"Home":A(m,"partial"),e.preventDefault();break;case"End":A(g,"partial"),e.preventDefault();break;case"ArrowUp":A(B(p+Z),"partial"),e.preventDefault();break;case"ArrowDown":A(B(p-Z),"partial"),e.preventDefault();break;case"PageUp":A(j(p+5),"partial"),e.preventDefault();break;case"PageDown":A(j(p-5),"partial"),e.preventDefault();break;case"Enter":case" ":A(p,"finish"),e.preventDefault()}},tabIndex:0,className:S.wrapper,children:o})]}),n&&r&&(0,T.jsxs)(D.Fragment,{children:[(0,T.jsx)(Sw,{onClick:b?void 0:()=>l("am"),disabled:v||null===c,ownerState:t,className:S.amButton,title:Ci(x,"am"),children:(0,T.jsx)(SS,{variant:"caption",className:S.meridiemText,children:Ci(x,"am")})}),(0,T.jsx)(SC,{disabled:v||null===c,onClick:b?void 0:()=>l("pm"),ownerState:t,className:S.pmButton,title:Ci(x,"pm"),children:(0,T.jsx)(SS,{variant:"caption",className:S.meridiemText,children:Ci(x,"pm")})})]})]})}function SM(e){return(0,V.ZP)("MuiClockNumber",e)}let ST=(0,F.Z)("MuiClockNumber",["root","selected","disabled"]),SD=["className","disabled","index","inner","label","selected"],SA=(0,Z.ZP)("span",{name:"MuiClockNumber",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`&.${ST.disabled}`]:t.disabled},{[`&.${ST.selected}`]:t.selected}]})(({theme:e})=>({height:36,width:36,position:"absolute",left:"calc((100% - 36px) / 2)",display:"inline-flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",color:(e.vars||e).palette.text.primary,fontFamily:e.typography.fontFamily,"&:focused":{backgroundColor:(e.vars||e).palette.background.paper},[`&.${ST.selected}`]:{color:(e.vars||e).palette.primary.contrastText},[`&.${ST.disabled}`]:{pointerEvents:"none",color:(e.vars||e).palette.text.disabled},variants:[{props:{inner:!0},style:(0,cu.Z)({},e.typography.body2,{color:(e.vars||e).palette.text.secondary})}]}));function SR(e){let t=(0,wQ.Z)({props:e,name:"MuiClockNumber"}),{className:n,disabled:r,index:i,inner:o,label:s,selected:l}=t,a=(0,ch.Z)(t,SD),c=(e=>{let{classes:t,selected:n,disabled:r}=e;return(0,P.Z)({root:["root",n&&"selected",r&&"disabled"]},SM,t)})(t),u=i%12/12*Math.PI*2-Math.PI/2,h=91*(o?.65:1),d=Math.round(Math.cos(u)*h),f=Math.round(Math.sin(u)*h);return(0,T.jsx)(SA,(0,cu.Z)({className:(0,R.Z)(c.root,n),"aria-disabled":!!r||void 0,"aria-selected":!!l||void 0,role:"option",style:{transform:`translate(${d}px, ${f+92}px`},ownerState:t},a,{children:s}))}let SP=({utils:e,value:t,isDisabled:n,getClockNumberText:r,selectedId:i})=>{let o=e.formatNumber;return[[5,o("05")],[10,o("10")],[15,o("15")],[20,o("20")],[25,o("25")],[30,o("30")],[35,o("35")],[40,o("40")],[45,o("45")],[50,o("50")],[55,o("55")],[0,o("00")]].map(([e,o],s)=>{let l=e===t;return(0,T.jsx)(SR,{label:o,id:l?i:void 0,index:s+1,inner:!1,disabled:n(e),selected:l,"aria-label":r(o)},e)})},SO=({timezone:e,value:t,defaultValue:n,referenceDate:r,onChange:i,valueManager:o})=>{let s,l=w4(),a=D.useRef(n),c=t??a.current??o.emptyValue,u=D.useMemo(()=>o.getTimezone(l,c),[l,o,c]),h=(0,C4.Z)(e=>null==u?e:o.setTimezone(l,u,e));return s=e||u||(r?l.getTimezone(r):"default"),{value:D.useMemo(()=>o.setTimezone(l,s,c),[o,l,s,c]),handleValueChange:(0,C4.Z)((e,...t)=>{let n=h(e);i?.(n,...t)}),timezone:s}},SI=({name:e,timezone:t,value:n,defaultValue:r,referenceDate:i,onChange:o,valueManager:s})=>{let[l,a]=(0,C6.Z)({name:e,state:"value",controlled:n,default:r??s.emptyValue});return SO({timezone:t,value:l,defaultValue:void 0,referenceDate:i,onChange:(0,C4.Z)((e,...t)=>{a(e),o?.(e,...t)}),valueManager:s})},SE={year:1,month:2,day:3,hours:4,minutes:5,seconds:6,milliseconds:7},SZ=(e,t,n)=>{if(t===SE.year)return e.startOfYear(n);if(t===SE.month)return e.startOfMonth(n);if(t===SE.day)return e.startOfDay(n);let r=n;return t<SE.minutes&&(r=e.setMinutes(r,0)),t<SE.seconds&&(r=e.setSeconds(r,0)),t<SE.milliseconds&&(r=e.setMilliseconds(r,0)),r},SL=(e,t)=>{let n=e.formatTokenMap[t];if(null==n)throw Error(`MUI X: The token "${t}" is not supported by the Date and Time Pickers.
7
+ Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported.`);return"string"==typeof n?{type:n,contentType:"meridiem"===n?"letter":"digit",maxLength:void 0}:{type:n.sectionType,contentType:n.contentType,maxLength:n.maxLength}},Sj=(e,t)=>{let n=[],r=e.date(void 0,"default"),i=e.startOfWeek(r),o=e.endOfWeek(r),s=i;for(;e.isBefore(s,o);)n.push(s),s=e.addDays(s,1);return n.map(n=>e.formatByString(n,t))},SB=(e,t,n,r)=>{switch(n){case"month":return Cn(e,e.date(void 0,t)).map(t=>e.formatByString(t,r));case"weekDay":return Sj(e,r);case"meridiem":{let n=e.date(void 0,t);return[e.startOfDay(n),e.endOfDay(n)].map(t=>e.formatByString(t,r))}default:return[]}},SF=["0","1","2","3","4","5","6","7","8","9"],SV=(e,t)=>{if("0"===t[0])return e;let n=[],r="";for(let i=0;i<e.length;i+=1){r+=e[i];let o=t.indexOf(r);o>-1&&(n.push(o.toString()),r="")}return n.join("")},SN=(e,t)=>"0"===t[0]?e:e.split("").map(e=>t[Number(e)]).join(""),SH=(e,t)=>{let n=SV(e,t);return" "!==n&&!Number.isNaN(Number(n))},Sz=(e,t)=>{let n=e;for(n=Number(n).toString();n.length<t;)n=`0${n}`;return n},S$=(e,t,n,r,i)=>{if("day"===i.type&&"digit-with-letter"===i.contentType){let r=e.setDate(n.longestMonth,t);return e.formatByString(r,i.format)}let o=t.toString();return i.hasLeadingZerosInInput&&(o=Sz(o,i.maxLength)),SN(o,r)},SW=(e,t,n)=>{let r=e.value||e.placeholder,i="non-input"===t?e.hasLeadingZerosInFormat:e.hasLeadingZerosInInput;return"non-input"===t&&e.hasLeadingZerosInInput&&!e.hasLeadingZerosInFormat&&(r=Number(SV(r,n)).toString()),["input-rtl","input-ltr"].includes(t)&&"digit"===e.contentType&&!i&&1===r.length&&(r=`${r}\u200e`),"input-rtl"===t&&(r=`\u2068${r}\u2069`),r},S_=(e,t,n,r)=>e.formatByString(e.parse(t,n),r),Sq=(e,t)=>4===e.formatByString(e.date(void 0,"system"),t).length,SG=(e,t,n,r)=>{if("digit"!==t)return!1;let i=e.date(void 0,"default");switch(n){case"year":if(Sq(e,r))return"0001"===e.formatByString(e.setYear(i,1),r);return"01"===e.formatByString(e.setYear(i,2001),r);case"month":return e.formatByString(e.startOfYear(i),r).length>1;case"day":return e.formatByString(e.startOfMonth(i),r).length>1;case"weekDay":return e.formatByString(e.startOfWeek(i),r).length>1;case"hours":return e.formatByString(e.setHours(i,1),r).length>1;case"minutes":return e.formatByString(e.setMinutes(i,1),r).length>1;case"seconds":return e.formatByString(e.setSeconds(i,1),r).length>1;default:throw Error("Invalid section type")}},SU=(e,t)=>{},SK={year:1,month:2,day:3,weekDay:4,hours:5,minutes:6,seconds:7,meridiem:8,empty:9},SY=(e,t,n,r,i)=>[...n].sort((e,t)=>SK[e.type]-SK[t.type]).reduce((n,r)=>!i||r.modified?((e,t,n,r)=>{switch(t.type){case"year":return e.setYear(r,e.getYear(n));case"month":return e.setMonth(r,e.getMonth(n));case"weekDay":{let r=Sj(e,t.format),i=e.formatByString(n,t.format),o=r.indexOf(i),s=r.indexOf(t.value);return e.addDays(n,s-o)}case"day":return e.setDate(r,e.getDate(n));case"meridiem":{let t=12>e.getHours(n),i=e.getHours(r);if(t&&i>=12)return e.addHours(r,-12);if(!t&&i<12)return e.addHours(r,12);return r}case"hours":return e.setHours(r,e.getHours(n));case"minutes":return e.setMinutes(r,e.getMinutes(n));case"seconds":return e.setSeconds(r,e.getSeconds(n));default:return r}})(e,r,t,n):n,r),SX=(e,t)=>{if(null==e)return null;if("all"===e)return"all";if("string"==typeof e){let n=t.findIndex(t=>t.type===e);return -1===n?null:n}return e},SQ=["value","referenceDate"],SJ={emptyValue:null,getTodayValue:Cr,getInitialReferenceValue:e=>{let{value:t,referenceDate:n}=e,r=(0,ch.Z)(e,SQ);return null!=t&&r.utils.isValid(t)?t:null!=n?n:(({props:e,utils:t,granularity:n,timezone:r,getTodayDate:i})=>{let o=i?i():SZ(t,n,Cr(t,r));null!=e.minDate&&t.isAfterDay(e.minDate,o)&&(o=SZ(t,n,e.minDate)),null!=e.maxDate&&t.isBeforeDay(e.maxDate,o)&&(o=SZ(t,n,e.maxDate));let s=CN(e.disableIgnoringDatePartForTimeValidation??!1,t);return null!=e.minTime&&s(e.minTime,o)&&(o=SZ(t,n,e.disableIgnoringDatePartForTimeValidation?e.minTime:w7(t,o,e.minTime))),null!=e.maxTime&&s(o,e.maxTime)&&(o=SZ(t,n,e.disableIgnoringDatePartForTimeValidation?e.maxTime:w7(t,o,e.maxTime))),o})(r)},cleanValue:(e,t)=>null!=t&&e.isValid(t)?t:null,areValuesEqual:(e,t,n)=>!(e.isValid(t)||null==t||e.isValid(n))&&null!=n||e.isEqual(t,n),isSameError:(e,t)=>e===t,hasError:e=>null!=e,defaultErrorState:null,getTimezone:(e,t)=>null!=t&&e.isValid(t)?e.getTimezone(t):null,setTimezone:(e,t,n)=>null==n?null:e.setTimezone(n,t)},S0={updateReferenceValue:(e,t,n)=>null!=t&&e.isValid(t)?t:n,getSectionsFromValue:(e,t,n,r)=>!e.isValid(t)&&n?n:r(t),getV7HiddenInputValueFromSections:e=>e.map(e=>`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`).join(""),getV6InputValueFromSections:(e,t,n)=>{let r=e.map(e=>{let r=SW(e,n?"input-rtl":"input-ltr",t);return`${e.startSeparator}${r}${e.endSeparator}`}).join("");return n?`\u2066${r}\u2069`:r},getActiveDateManager:(e,t)=>({date:t.value,referenceDate:t.referenceValue,getSections:e=>e,getNewValuesFromNewActiveDate:n=>({value:n,referenceValue:null!=n&&e.isValid(n)?n:t.referenceValue})}),parseValueStr:(e,t,n)=>n(e.trim(),t)},S1=["ampm","ampmInClock","autoFocus","slots","slotProps","value","defaultValue","referenceDate","disableIgnoringDatePartForTimeValidation","maxTime","minTime","disableFuture","disablePast","minutesStep","shouldDisableTime","showViewSwitcher","onChange","view","views","openTo","onViewChange","focusedView","onFocusedViewChange","className","disabled","readOnly","timezone"],S2=(0,Z.ZP)(C7,{name:"MuiTimeClock",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",position:"relative"}),S5=(0,Z.ZP)(C8,{name:"MuiTimeClock",slot:"ArrowSwitcher",overridesResolver:(e,t)=>t.arrowSwitcher})({position:"absolute",right:12,top:15}),S3=["hours","minutes"],S8=D.forwardRef(function(e,t){let n=w4(),r=(0,wQ.Z)({props:e,name:"MuiTimeClock"}),{ampm:i=n.is12HourCycleInCurrentLocale(),ampmInClock:o=!1,autoFocus:s,slots:l,slotProps:a,value:c,defaultValue:u,referenceDate:h,disableIgnoringDatePartForTimeValidation:d=!1,maxTime:f,minTime:p,disableFuture:m,disablePast:g,minutesStep:v=1,shouldDisableTime:b,showViewSwitcher:y,onChange:x,view:w,views:C=S3,openTo:S,onViewChange:k,focusedView:M,onFocusedViewChange:A,className:O,disabled:I,readOnly:E,timezone:Z}=r,L=(0,ch.Z)(r,S1),{value:j,handleValueChange:B,timezone:F}=SI({name:"TimeClock",timezone:Z,value:c,defaultValue:u,referenceDate:h,onChange:x,valueManager:SJ}),V=(({value:e,referenceDate:t,utils:n,props:r,timezone:i})=>{let o=D.useMemo(()=>SJ.getInitialReferenceValue({value:e,utils:n,props:r,referenceDate:t,granularity:SE.day,timezone:i,getTodayDate:()=>Cr(n,i,"date")}),[]);return e??o})({value:j,referenceDate:h,utils:n,props:r,timezone:F}),N=Cg(),H=w9(F),{view:z,setView:$,previousView:W,nextView:_,setValueAndGoToNextView:q}=C9({view:w,views:C,openTo:S,onViewChange:k,onChange:B,focusedView:M,onFocusedViewChange:A}),{meridiemMode:G,handleMeridiemChange:U}=CH(V,i,q),K=D.useCallback((e,t)=>{let r=CN(d,n),o="hours"===t||"minutes"===t&&C.includes("seconds"),s=({start:e,end:t})=>!(p&&r(p,t)||f&&r(e,f)||m&&r(e,H)||g&&r(H,o?t:e)),l=(e,r=1)=>{if(e%r!=0)return!1;if(b)switch(t){case"hours":return!b(n.setHours(V,e),"hours");case"minutes":return!b(n.setMinutes(V,e),"minutes");case"seconds":return!b(n.setSeconds(V,e),"seconds");default:return!1}return!0};switch(t){case"hours":{let t=CF(e,G,i),r=n.setHours(V,t);if(n.getHours(r)!==t)return!0;return!s({start:n.setSeconds(n.setMinutes(r,0),0),end:n.setSeconds(n.setMinutes(r,59),59)})||!l(t)}case"minutes":{let t=n.setMinutes(V,e);return!s({start:n.setSeconds(t,0),end:n.setSeconds(t,59)})||!l(e,v)}case"seconds":{let t=n.setSeconds(V,e);return!s({start:t,end:t})||!l(e)}default:throw Error("not supported")}},[i,V,d,f,G,p,v,b,n,m,g,H,C]),Y=(0,CY.Z)(),X=D.useMemo(()=>{switch(z){case"hours":{let e,t=(e,t)=>{let r=CF(e,G,i);q(n.setHours(V,r),t,"hours")},r=n.getHours(V);return e=i?r>12?[12,23]:[0,11]:[0,23],{onChange:t,viewValue:r,children:(({ampm:e,value:t,getClockNumberText:n,isDisabled:r,selectedId:i,utils:o})=>{let s=t?o.getHours(t):null,l=[],a=+!!e,c=e?12:23,u=t=>null!==s&&(e?12===t?12===s||0===s:s===t||s-12===t:s===t);for(let t=a;t<=c;t+=1){let s=t.toString();0===t&&(s="00");let a=!e&&(0===t||t>12);s=o.formatNumber(s);let c=u(t);l.push((0,T.jsx)(SR,{id:c?i:void 0,index:t,inner:a,selected:c,disabled:r(t),label:s,"aria-label":n(s)},t))}return l})({value:j,utils:n,ampm:i,onChange:t,getClockNumberText:N.hoursClockNumberText,isDisabled:e=>I||K(e,"hours"),selectedId:Y}),viewRange:e}}case"minutes":{let e=n.getMinutes(V),t=(e,t)=>{q(n.setMinutes(V,e),t,"minutes")};return{viewValue:e,onChange:t,children:SP({utils:n,value:e,onChange:t,getClockNumberText:N.minutesClockNumberText,isDisabled:e=>I||K(e,"minutes"),selectedId:Y}),viewRange:[0,59]}}case"seconds":{let e=n.getSeconds(V),t=(e,t)=>{q(n.setSeconds(V,e),t,"seconds")};return{viewValue:e,onChange:t,children:SP({utils:n,value:e,onChange:t,getClockNumberText:N.secondsClockNumberText,isDisabled:e=>I||K(e,"seconds"),selectedId:Y}),viewRange:[0,59]}}default:throw Error("You must provide the type for ClockView")}},[z,n,j,i,N.hoursClockNumberText,N.minutesClockNumberText,N.secondsClockNumberText,G,q,V,K,Y,I]),Q=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"],arrowSwitcher:["arrowSwitcher"]},Se,t)})(r);return(0,T.jsxs)(S2,(0,cu.Z)({ref:t,className:(0,R.Z)(Q.root,O),ownerState:r},L,{children:[(0,T.jsx)(Sk,(0,cu.Z)({autoFocus:s??!!M,ampmInClock:o&&C.includes("hours"),value:j,type:z,ampm:i,minutesStep:v,isTimeDisabled:K,meridiemMode:G,handleMeridiemChange:U,selectedId:Y,disabled:I,readOnly:E},X)),y&&(0,T.jsx)(S5,{className:Q.arrowSwitcher,slots:l,slotProps:a,onGoToPrevious:()=>$(W),isPreviousDisabled:!W,previousLabel:N.openPreviousView,onGoToNext:()=>$(_),isNextDisabled:!_,nextLabel:N.openNextView,ownerState:r})]}))}),S4=({view:e,onViewChange:t,focusedView:n,onFocusedViewChange:r,views:i,value:o,defaultValue:s,referenceDate:l,onChange:a,className:c,classes:u,disableFuture:h,disablePast:d,minTime:f,maxTime:p,shouldDisableTime:m,minutesStep:g,ampm:v,ampmInClock:b,slots:y,slotProps:x,readOnly:w,disabled:C,sx:S,autoFocus:k,showViewSwitcher:M,disableIgnoringDatePartForTimeValidation:D,timezone:A})=>(0,T.jsx)(S8,{view:e,onViewChange:t,focusedView:n&&CB(n)?n:null,onFocusedViewChange:r,views:i.filter(CB),value:o,defaultValue:s,referenceDate:l,onChange:a,className:c,classes:u,disableFuture:h,disablePast:d,minTime:f,maxTime:p,shouldDisableTime:m,minutesStep:g,ampm:v,ampmInClock:b,slots:y,slotProps:x,readOnly:w,disabled:C,sx:S,autoFocus:k,showViewSwitcher:M,disableIgnoringDatePartForTimeValidation:D,timezone:A}),S6=({props:e,value:t,timezone:n,adapter:r})=>{if(null===t)return null;let{shouldDisableDate:i,shouldDisableMonth:o,shouldDisableYear:s,disablePast:l,disableFuture:a}=e,c=r.utils.date(void 0,n),u=Ct(r.utils,e.minDate,r.defaultDates.minDate),h=Ct(r.utils,e.maxDate,r.defaultDates.maxDate);switch(!0){case!r.utils.isValid(t):return"invalidDate";case!!(i&&i(t)):return"shouldDisableDate";case!!(o&&o(t)):return"shouldDisableMonth";case!!(s&&s(t)):return"shouldDisableYear";case!!(a&&r.utils.isAfterDay(t,c)):return"disableFuture";case!!(l&&r.utils.isBeforeDay(t,c)):return"disablePast";case!!(u&&r.utils.isBeforeDay(t,u)):return"minDate";case!!(h&&r.utils.isAfterDay(t,h)):return"maxDate";default:return null}};S6.valueManager=SJ;let S9=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:i,disableFuture:o,disablePast:s,timezone:l})=>{let a=w8();return D.useCallback(c=>null!==S6({adapter:a,value:c,timezone:l,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:i,disableFuture:o,disablePast:s}}),[a,e,t,n,r,i,o,s,l])};var S7=n(16317),ke=n(69761);let kt=e=>(0,V.ZP)("MuiPickersFadeTransitionGroup",e);(0,F.Z)("MuiPickersFadeTransitionGroup",["root"]);let kn=(0,Z.ZP)(S7.Z,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function kr(e){let t=(0,wQ.Z)({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:i,transKey:o}=t,s=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"]},kt,t)})(t),l=(0,nu.Z)();return i?n:(0,T.jsx)(kn,{className:(0,R.Z)(s.root,r),children:(0,T.jsx)(ke.Z,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:l.transitions.duration.enteringScreen,enter:l.transitions.duration.enteringScreen,exit:0},children:n},o)})}var ki=n(97048);function ko(e){return(0,V.ZP)("MuiPickersDay",e)}let ks=(0,F.Z)("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),kl=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],ka=({theme:e})=>(0,cu.Z)({},e.typography.caption,{width:36,height:36,borderRadius:"50%",padding:0,backgroundColor:"transparent",transition:e.transitions.create("background-color",{duration:e.transitions.duration.short}),color:(e.vars||e).palette.text.primary,"@media (pointer: fine)":{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,O.Fq)(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:(0,O.Fq)(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${ks.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${ks.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,fontWeight:e.typography.fontWeightMedium,"&:hover":{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${ks.disabled}:not(.${ks.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${ks.disabled}&.${ks.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:"0 2px"}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${ks.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),kc=(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableMargin&&t.dayWithMargin,!n.disableHighlightToday&&n.today&&t.today,!n.outsideCurrentMonth&&n.showDaysOutsideCurrentMonth&&t.dayOutsideMonth,n.outsideCurrentMonth&&!n.showDaysOutsideCurrentMonth&&t.hiddenDaySpacingFiller]},ku=(0,Z.ZP)(om.Z,{name:"MuiPickersDay",slot:"Root",overridesResolver:kc})(ka),kh=(0,Z.ZP)("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:kc})(({theme:e})=>(0,cu.Z)({},ka({theme:e}),{opacity:0,pointerEvents:"none"})),kd=()=>{},kf=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiPickersDay"}),{autoFocus:r=!1,className:i,day:o,disabled:s=!1,disableHighlightToday:l=!1,disableMargin:a=!1,isAnimating:c,onClick:u,onDaySelect:h,onFocus:d=kd,onBlur:f=kd,onKeyDown:p=kd,onMouseDown:m=kd,onMouseEnter:g=kd,outsideCurrentMonth:v,selected:b=!1,showDaysOutsideCurrentMonth:y=!1,children:x,today:w=!1}=n,C=(0,ch.Z)(n,kl),S=(0,cu.Z)({},n,{autoFocus:r,disabled:s,disableHighlightToday:l,disableMargin:a,selected:b,showDaysOutsideCurrentMonth:y,today:w}),k=(e=>{let{selected:t,disableMargin:n,disableHighlightToday:r,today:i,disabled:o,outsideCurrentMonth:s,showDaysOutsideCurrentMonth:l,classes:a}=e,c=s&&!l;return(0,P.Z)({root:["root",t&&!c&&"selected",o&&"disabled",!n&&"dayWithMargin",!r&&i&&"today",s&&l&&"dayOutsideMonth",c&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},ko,a)})(S),M=w4(),A=D.useRef(null),O=(0,ki.Z)(A,t);return((0,St.Z)(()=>{!r||s||c||v||A.current.focus()},[r,s,c,v]),v&&!y)?(0,T.jsx)(kh,{className:(0,R.Z)(k.root,k.hiddenDaySpacingFiller,i),ownerState:S,role:C.role}):(0,T.jsx)(ku,(0,cu.Z)({className:(0,R.Z)(k.root,i),ref:O,centerRipple:!0,disabled:s,tabIndex:b?0:-1,onKeyDown:e=>p(e,o),onFocus:e=>d(e,o),onBlur:e=>f(e,o),onMouseEnter:e=>g(e,o),onClick:e=>{s||h(o),v&&e.currentTarget.focus(),u&&u(e)},onMouseDown:e=>{m(e),v&&e.preventDefault()}},C,{ownerState:S,children:x||M.format(o,"dayOfMonth")}))}),kp=D.memo(kf);var km=n(54652);function kg(e,t){return e.replace(RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var kv=n(98683),kb=function(e,t){return e&&t&&t.split(" ").forEach(function(t){e.classList?e.classList.remove(t):"string"==typeof e.className?e.className=kg(e.className,t):e.setAttribute("class",kg(e.className&&e.className.baseVal||"",t))})},ky=function(e){function t(){for(var t,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1];t.removeClasses(i,"exit"),t.addClass(i,o?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1];t.addClass(i,o?"appear":"enter","active"),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1]?"appear":"enter";t.removeClasses(i,o),t.addClass(i,o,"done"),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"appear"),t.removeClasses(n,"enter"),t.addClass(n,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"exit"),t.addClass(n,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,r="string"==typeof n,i=r&&n?n+"-":"",o=r?""+i+e:n[e],s=r?o+"-active":n[e+"Active"],l=r?o+"-done":n[e+"Done"];return{baseClassName:o,activeClassName:s,doneClassName:l}},t}(0,km.Z)(t,e);var n=t.prototype;return n.addClass=function(e,t,n){var r,i=this.getClassNames(t)[n+"ClassName"],o=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&o&&(i+=" "+o),"active"===n&&e&&(0,kv.Q)(e),i&&(this.appliedClasses[t][n]=i,r=i,e&&r&&r.split(" ").forEach(function(t){e.classList?e.classList.add(t):(e.classList?t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" "))||("string"==typeof e.className?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,i=n.active,o=n.done;this.appliedClasses[t]={},r&&kb(e,r),i&&kb(e,i),o&&kb(e,o)},n.render=function(){var e=this.props,t=(e.classNames,(0,ch.Z)(e,["classNames"]));return A().createElement(ak.ZP,(0,cu.Z)({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(A().Component);ky.defaultProps={classNames:""},ky.propTypes={};let kx=e=>(0,V.ZP)("MuiPickersSlideTransition",e),kw=(0,F.Z)("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),kC=["children","className","reduceAnimations","slideDirection","transKey","classes"],kS=(0,Z.ZP)(S7.Z,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${kw["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${kw["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${kw.slideEnterActive}`]:t.slideEnterActive},{[`.${kw.slideExit}`]:t.slideExit},{[`.${kw["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${kw["slideExitActiveLeft-right"]}`]:t["slideExitActiveLeft-right"]}]})(({theme:e})=>{let t=e.transitions.create("transform",{duration:e.transitions.duration.complex,easing:"cubic-bezier(0.35, 0.8, 0.4, 1)"});return{display:"block",position:"relative",overflowX:"hidden","& > *":{position:"absolute",top:0,right:0,left:0},[`& .${kw["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${kw["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${kw.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${kw.slideExit}`]:{transform:"translate(0%)"},[`& .${kw["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${kw["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}}),kk=e=>(0,V.ZP)("MuiDayCalendar",e);(0,F.Z)("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);let kM=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],kT=["ownerState"],kD=(0,Z.ZP)("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),kA=(0,Z.ZP)("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),kR=(0,Z.ZP)(sv.Z,{name:"MuiDayCalendar",slot:"WeekDayLabel",overridesResolver:(e,t)=>t.weekDayLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(e.vars||e).palette.text.secondary})),kP=(0,Z.ZP)(sv.Z,{name:"MuiDayCalendar",slot:"WeekNumberLabel",overridesResolver:(e,t)=>t.weekNumberLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:e.palette.text.disabled})),kO=(0,Z.ZP)(sv.Z,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>(0,cu.Z)({},e.typography.caption,{width:36,height:36,padding:0,margin:"0 2px",color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),kI=(0,Z.ZP)("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:240}),kE=(0,Z.ZP)(function(e){let t=(0,wQ.Z)({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:i,transKey:o}=t,s=(0,ch.Z)(t,kC),l=(e=>{let{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return(0,P.Z)(r,kx,t)})(t),a=(0,nu.Z)();if(i)return(0,T.jsx)("div",{className:(0,R.Z)(l.root,r),children:n});let c={exit:l.exit,enterActive:l.enterActive,enter:l.enter,exitActive:l.exitActive};return(0,T.jsx)(kS,{className:(0,R.Z)(l.root,r),childFactory:e=>D.cloneElement(e,{classNames:c}),role:"presentation",children:(0,T.jsx)(ky,(0,cu.Z)({mountOnEnter:!0,unmountOnExit:!0,timeout:a.transitions.duration.complex,classNames:c},s,{children:n}),o)})},{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:240}),kZ=(0,Z.ZP)("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),kL=(0,Z.ZP)("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:"2px 0",display:"flex",justifyContent:"center"});function kj(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:i,isDateDisabled:o,currentMonthNumber:s,isViewFocused:l}=e,a=(0,ch.Z)(e,kM),{disabled:c,disableHighlightToday:u,isMonthSwitchingAnimating:h,showDaysOutsideCurrentMonth:d,slots:f,slotProps:p,timezone:m}=t,g=w4(),v=w9(m),b=null!==r&&g.isSameDay(n,r),y=i.some(e=>g.isSameDay(e,n)),x=g.isSameDay(n,v),w=f?.day??kp,C=(0,CX.Z)({elementType:w,externalSlotProps:p?.day,additionalProps:(0,cu.Z)({disableHighlightToday:u,showDaysOutsideCurrentMonth:d,role:"gridcell",isAnimating:h,"data-timestamp":g.toJsDate(n).valueOf()},a),ownerState:(0,cu.Z)({},t,{day:n,selected:y})}),S=(0,ch.Z)(C,kT),k=D.useMemo(()=>c||o(n),[c,o,n]),M=D.useMemo(()=>g.getMonth(n)!==s,[g,n,s]),A=D.useMemo(()=>{let e=g.startOfMonth(g.setMonth(n,s));return d?g.isSameDay(n,g.startOfWeek(e)):g.isSameDay(n,e)},[s,n,d,g]),R=D.useMemo(()=>{let e=g.endOfMonth(g.setMonth(n,s));return d?g.isSameDay(n,g.endOfWeek(e)):g.isSameDay(n,e)},[s,n,d,g]);return(0,T.jsx)(w,(0,cu.Z)({},S,{day:n,disabled:k,autoFocus:l&&b,today:x,outsideCurrentMonth:M,isFirstVisibleCell:A,isLastVisibleCell:R,selected:y,tabIndex:b?0:-1,"aria-selected":y,"aria-current":x?"date":void 0}))}function kB(e){let t=(0,wQ.Z)({props:e,name:"MuiDayCalendar"}),n=w4(),{onFocusedDayChange:r,className:i,currentMonth:o,selectedDays:s,focusedDay:l,loading:a,onSelectedDaysChange:c,onMonthSwitchingAnimationEnd:u,readOnly:h,reduceAnimations:d,renderLoading:f=()=>(0,T.jsx)("span",{children:"..."}),slideDirection:p,TransitionProps:m,disablePast:g,disableFuture:v,minDate:b,maxDate:y,shouldDisableDate:x,shouldDisableMonth:w,shouldDisableYear:C,dayOfWeekFormatter:S=e=>n.format(e,"weekdayShort").charAt(0).toUpperCase(),hasFocus:k,onFocusedViewChange:M,gridLabelId:A,displayWeekNumber:O,fixedWeekNumber:I,autoFocus:E,timezone:Z}=t,L=w9(Z),j=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},kk,t)})(t),B=(0,aC.V)(),F=S9({shouldDisableDate:x,shouldDisableMonth:w,shouldDisableYear:C,minDate:b,maxDate:y,disablePast:g,disableFuture:v,timezone:Z}),V=Cg(),[N,H]=(0,C6.Z)({name:"DayCalendar",state:"hasFocus",controlled:k,default:E??!1}),[z,$]=D.useState(()=>l||L),W=(0,C4.Z)(e=>{h||c(e)}),_=e=>{F(e)||(r(e),$(e),M?.(!0),H(!0))},q=(0,C4.Z)((e,t)=>{switch(e.key){case"ArrowUp":_(n.addDays(t,-7)),e.preventDefault();break;case"ArrowDown":_(n.addDays(t,7)),e.preventDefault();break;case"ArrowLeft":{let r=n.addDays(t,B?1:-1),i=n.addMonths(t,B?1:-1);_(Ce({utils:n,date:r,minDate:B?r:n.startOfMonth(i),maxDate:B?n.endOfMonth(i):r,isDateDisabled:F,timezone:Z})||r),e.preventDefault();break}case"ArrowRight":{let r=n.addDays(t,B?-1:1),i=n.addMonths(t,B?-1:1);_(Ce({utils:n,date:r,minDate:B?n.startOfMonth(i):r,maxDate:B?r:n.endOfMonth(i),isDateDisabled:F,timezone:Z})||r),e.preventDefault();break}case"Home":_(n.startOfWeek(t)),e.preventDefault();break;case"End":_(n.endOfWeek(t)),e.preventDefault();break;case"PageUp":_(n.addMonths(t,1)),e.preventDefault();break;case"PageDown":_(n.addMonths(t,-1)),e.preventDefault()}}),G=(0,C4.Z)((e,t)=>_(t)),U=(0,C4.Z)((e,t)=>{N&&n.isSameDay(z,t)&&M?.(!1)}),K=n.getMonth(o),Y=n.getYear(o),X=D.useMemo(()=>s.filter(e=>!!e).map(e=>n.startOfDay(e)),[n,s]),Q=`${Y}-${K}`,J=D.useMemo(()=>D.createRef(),[Q]),ee=D.useMemo(()=>{let e=n.startOfMonth(o),t=n.endOfMonth(o);return F(z)||n.isAfterDay(z,t)||n.isBeforeDay(z,e)?Ce({utils:n,date:z,minDate:e,maxDate:t,disablePast:g,disableFuture:v,isDateDisabled:F,timezone:Z}):z},[o,v,g,z,F,n,Z]),et=D.useMemo(()=>{let e=n.getWeekArray(o),t=n.addMonths(o,1);for(;I&&e.length<I;){let r=n.getWeekArray(t),i=n.isSameDay(e[e.length-1][0],r[0][0]);r.slice(+!!i).forEach(t=>{e.length<I&&e.push(t)}),t=n.addMonths(t,1)}return e},[o,I,n]);return(0,T.jsxs)(kD,{role:"grid","aria-labelledby":A,className:j.root,children:[(0,T.jsxs)(kA,{role:"row",className:j.header,children:[O&&(0,T.jsx)(kP,{variant:"caption",role:"columnheader","aria-label":V.calendarWeekNumberHeaderLabel,className:j.weekNumberLabel,children:V.calendarWeekNumberHeaderText}),((e,t)=>{let n=e.startOfWeek(t);return[0,1,2,3,4,5,6].map(t=>e.addDays(n,t))})(n,L).map((e,t)=>(0,T.jsx)(kR,{variant:"caption",role:"columnheader","aria-label":n.format(e,"weekday"),className:j.weekDayLabel,children:S(e)},t.toString()))]}),a?(0,T.jsx)(kI,{className:j.loadingContainer,children:f()}):(0,T.jsx)(kE,(0,cu.Z)({transKey:Q,onExited:u,reduceAnimations:d,slideDirection:p,className:(0,R.Z)(i,j.slideTransition)},m,{nodeRef:J,children:(0,T.jsx)(kZ,{ref:J,role:"rowgroup",className:j.monthContainer,children:et.map((e,r)=>(0,T.jsxs)(kL,{role:"row",className:j.weekContainer,"aria-rowindex":r+1,children:[O&&(0,T.jsx)(kO,{className:j.weekNumber,role:"rowheader","aria-label":V.calendarWeekNumberAriaLabelText(n.getWeekNumber(e[0])),children:V.calendarWeekNumberText(n.getWeekNumber(e[0]))}),e.map((e,n)=>(0,T.jsx)(kj,{parentProps:t,day:e,selectedDays:X,focusableDay:ee,onKeyDown:q,onFocus:G,onBlur:U,onDaySelect:W,isDateDisabled:F,currentMonthNumber:K,isViewFocused:N,"aria-colindex":n+1},e.toString()))]},`week-${e[0]}`))})}))]})}function kF(e){return(0,V.ZP)("MuiPickersMonth",e)}let kV=(0,F.Z)("MuiPickersMonth",["root","monthButton","disabled","selected"]),kN=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],kH=(0,Z.ZP)("div",{name:"MuiPickersMonth",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{monthsPerRow:4},style:{flexBasis:"25%"}}]}),kz=(0,Z.ZP)("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${kV.disabled}`]:t.disabled},{[`&.${kV.selected}`]:t.selected}]})(({theme:e})=>(0,cu.Z)({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"8px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,O.Fq)(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,O.Fq)(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${kV.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${kV.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),k$=D.memo(function(e){let t=(0,wQ.Z)({props:e,name:"MuiPickersMonth"}),{autoFocus:n,className:r,children:i,disabled:o,selected:s,value:l,tabIndex:a,onClick:c,onKeyDown:u,onFocus:h,onBlur:d,"aria-current":f,"aria-label":p,slots:m,slotProps:g}=t,v=(0,ch.Z)(t,kN),b=D.useRef(null),y=(e=>{let{disabled:t,selected:n,classes:r}=e;return(0,P.Z)({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},kF,r)})(t);(0,St.Z)(()=>{n&&b.current?.focus()},[n]);let x=m?.monthButton??kz,w=(0,CX.Z)({elementType:x,externalSlotProps:g?.monthButton,additionalProps:{children:i,disabled:o,tabIndex:a,ref:b,type:"button",role:"radio","aria-current":f,"aria-checked":s,"aria-label":p,onClick:e=>c(e,l),onKeyDown:e=>u(e,l),onFocus:e=>h(e,l),onBlur:e=>d(e,l)},ownerState:t,className:y.monthButton});return(0,T.jsx)(kH,(0,cu.Z)({className:(0,R.Z)(y.root,r),ownerState:t},v,{children:(0,T.jsx)(x,(0,cu.Z)({},w))}))});function kW(e){return(0,V.ZP)("MuiMonthCalendar",e)}(0,F.Z)("MuiMonthCalendar",["root"]);let k_=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],kq=(0,Z.ZP)("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:320,boxSizing:"border-box"}),kG=D.forwardRef(function(e,t){let n=function(e,t){let n=w4(),r=w6(),i=(0,wQ.Z)({props:e,name:t});return(0,cu.Z)({disableFuture:!1,disablePast:!1},i,{minDate:Ct(n,i.minDate,r.minDate),maxDate:Ct(n,i.maxDate,r.maxDate)})}(e,"MuiMonthCalendar"),{className:r,value:i,defaultValue:o,referenceDate:s,disabled:l,disableFuture:a,disablePast:c,maxDate:u,minDate:h,onChange:d,shouldDisableMonth:f,readOnly:p,autoFocus:m=!1,onMonthFocus:g,hasFocus:v,onFocusedViewChange:b,monthsPerRow:y=3,timezone:x,gridLabelId:w,slots:C,slotProps:S}=n,k=(0,ch.Z)(n,k_),{value:M,handleValueChange:A,timezone:O}=SI({name:"MonthCalendar",timezone:x,value:i,defaultValue:o,referenceDate:s,onChange:d,valueManager:SJ}),I=w9(O),E=(0,aC.V)(),Z=w4(),L=D.useMemo(()=>SJ.getInitialReferenceValue({value:M,utils:Z,props:n,timezone:O,referenceDate:s,granularity:SE.month}),[]),j=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"]},kW,t)})(n),B=D.useMemo(()=>Z.getMonth(I),[Z,I]),F=D.useMemo(()=>null!=M?Z.getMonth(M):null,[M,Z]),[V,N]=D.useState(()=>F||Z.getMonth(L)),[H,z]=(0,C6.Z)({name:"MonthCalendar",state:"hasFocus",controlled:v,default:m??!1}),$=(0,C4.Z)(e=>{z(e),b&&b(e)}),W=D.useCallback(e=>{let t=Z.startOfMonth(c&&Z.isAfter(I,h)?I:h),n=Z.startOfMonth(a&&Z.isBefore(I,u)?I:u),r=Z.startOfMonth(e);return!!(Z.isBefore(r,t)||Z.isAfter(r,n))||!!f&&f(r)},[a,c,u,h,I,f,Z]),_=(0,C4.Z)((e,t)=>{p||A(Z.setMonth(M??L,t))}),q=(0,C4.Z)(e=>{!W(Z.setMonth(M??L,e))&&(N(e),$(!0),g&&g(e))});D.useEffect(()=>{N(e=>null!==F&&e!==F?F:e)},[F]);let G=(0,C4.Z)((e,t)=>{switch(e.key){case"ArrowUp":q((12+t-3)%12),e.preventDefault();break;case"ArrowDown":q((12+t+3)%12),e.preventDefault();break;case"ArrowLeft":q((12+t+(E?1:-1))%12),e.preventDefault();break;case"ArrowRight":q((12+t+(E?-1:1))%12),e.preventDefault()}}),U=(0,C4.Z)((e,t)=>{q(t)}),K=(0,C4.Z)((e,t)=>{V===t&&$(!1)});return(0,T.jsx)(kq,(0,cu.Z)({ref:t,className:(0,R.Z)(j.root,r),ownerState:n,role:"radiogroup","aria-labelledby":w},k,{children:Cn(Z,M??L).map(e=>{let t=Z.getMonth(e),n=Z.format(e,"monthShort"),r=Z.format(e,"month"),i=l||W(e);return(0,T.jsx)(k$,{selected:t===F,value:t,onClick:_,onKeyDown:G,autoFocus:H&&t===V,disabled:i,tabIndex:t!==V||i?-1:0,onFocus:U,onBlur:K,"aria-current":B===t?"date":void 0,"aria-label":r,monthsPerRow:y,slots:C,slotProps:S,children:n},n)})}))});function kU(e){return(0,V.ZP)("MuiPickersYear",e)}let kK=(0,F.Z)("MuiPickersYear",["root","yearButton","selected","disabled"]),kY=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],kX=(0,Z.ZP)("div",{name:"MuiPickersYear",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{yearsPerRow:4},style:{flexBasis:"25%"}}]}),kQ=(0,Z.ZP)("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${kK.disabled}`]:t.disabled},{[`&.${kK.selected}`]:t.selected}]})(({theme:e})=>(0,cu.Z)({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"6px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.focusOpacity})`:(0,O.Fq)(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,O.Fq)(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${kK.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${kK.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),kJ=D.memo(function(e){let t=(0,wQ.Z)({props:e,name:"MuiPickersYear"}),{autoFocus:n,className:r,children:i,disabled:o,selected:s,value:l,tabIndex:a,onClick:c,onKeyDown:u,onFocus:h,onBlur:d,"aria-current":f,slots:p,slotProps:m}=t,g=(0,ch.Z)(t,kY),v=D.useRef(null),b=(e=>{let{disabled:t,selected:n,classes:r}=e;return(0,P.Z)({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},kU,r)})(t);(0,St.Z)(()=>{n&&v.current?.focus()},[n]);let y=p?.yearButton??kQ,x=(0,CX.Z)({elementType:y,externalSlotProps:m?.yearButton,additionalProps:{children:i,disabled:o,tabIndex:a,ref:v,type:"button",role:"radio","aria-current":f,"aria-checked":s,onClick:e=>c(e,l),onKeyDown:e=>u(e,l),onFocus:e=>h(e,l),onBlur:e=>d(e,l)},ownerState:t,className:b.yearButton});return(0,T.jsx)(kX,(0,cu.Z)({className:(0,R.Z)(b.root,r),ownerState:t},g,{children:(0,T.jsx)(y,(0,cu.Z)({},x))}))});function k0(e){return(0,V.ZP)("MuiYearCalendar",e)}(0,F.Z)("MuiYearCalendar",["root"]);let k1=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],k2=(0,Z.ZP)("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:320,maxHeight:280,boxSizing:"border-box",position:"relative"}),k5=D.forwardRef(function(e,t){let n=function(e,t){let n=w4(),r=w6(),i=(0,wQ.Z)({props:e,name:t});return(0,cu.Z)({disablePast:!1,disableFuture:!1},i,{yearsPerRow:i.yearsPerRow??3,minDate:Ct(n,i.minDate,r.minDate),maxDate:Ct(n,i.maxDate,r.maxDate)})}(e,"MuiYearCalendar"),{autoFocus:r,className:i,value:o,defaultValue:s,referenceDate:l,disabled:a,disableFuture:c,disablePast:u,maxDate:h,minDate:d,onChange:f,readOnly:p,shouldDisableYear:m,onYearFocus:g,hasFocus:v,onFocusedViewChange:b,yearsOrder:y="asc",yearsPerRow:x,timezone:w,gridLabelId:C,slots:S,slotProps:k}=n,M=(0,ch.Z)(n,k1),{value:A,handleValueChange:O,timezone:I}=SI({name:"YearCalendar",timezone:w,value:o,defaultValue:s,referenceDate:l,onChange:f,valueManager:SJ}),E=w9(I),Z=(0,aC.V)(),L=w4(),j=D.useMemo(()=>SJ.getInitialReferenceValue({value:A,utils:L,props:n,timezone:I,referenceDate:l,granularity:SE.year}),[]),B=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"]},k0,t)})(n),F=D.useMemo(()=>L.getYear(E),[L,E]),V=D.useMemo(()=>null!=A?L.getYear(A):null,[A,L]),[N,H]=D.useState(()=>V||L.getYear(j)),[z,$]=(0,C6.Z)({name:"YearCalendar",state:"hasFocus",controlled:v,default:r??!1}),W=(0,C4.Z)(e=>{$(e),b&&b(e)}),_=D.useCallback(e=>!!(u&&L.isBeforeYear(e,E)||c&&L.isAfterYear(e,E)||d&&L.isBeforeYear(e,d)||h&&L.isAfterYear(e,h))||!!m&&m(L.startOfYear(e)),[c,u,h,d,E,m,L]),q=(0,C4.Z)((e,t)=>{p||O(L.setYear(A??j,t))}),G=(0,C4.Z)(e=>{_(L.setYear(A??j,e))||(H(e),W(!0),g?.(e))});D.useEffect(()=>{H(e=>null!==V&&e!==V?V:e)},[V]);let U="desc"!==y?+x:-1*x,K=Z&&"asc"===y||!Z&&"desc"===y?-1:1,Y=(0,C4.Z)((e,t)=>{switch(e.key){case"ArrowUp":G(t-U),e.preventDefault();break;case"ArrowDown":G(t+U),e.preventDefault();break;case"ArrowLeft":G(t-K),e.preventDefault();break;case"ArrowRight":G(t+K),e.preventDefault()}}),X=(0,C4.Z)((e,t)=>{G(t)}),Q=(0,C4.Z)((e,t)=>{N===t&&W(!1)}),J=D.useRef(null),ee=(0,ki.Z)(t,J);D.useEffect(()=>{if(r||null===J.current)return;let e=J.current.querySelector('[tabindex="0"]');if(!e)return;let t=e.offsetHeight,n=e.offsetTop,i=J.current.clientHeight,o=J.current.scrollTop;t>i||n<o||(J.current.scrollTop=n+t-i/2-t/2)},[r]);let et=L.getYearRange([d,h]);return"desc"===y&&et.reverse(),(0,T.jsx)(k2,(0,cu.Z)({ref:ee,className:(0,R.Z)(B.root,i),ownerState:n,role:"radiogroup","aria-labelledby":C},M,{children:et.map(e=>{let t=L.getYear(e),n=a||_(e);return(0,T.jsx)(kJ,{selected:t===V,value:t,onClick:q,onKeyDown:Y,autoFocus:z&&t===N,disabled:n,tabIndex:t!==N||n?-1:0,onFocus:X,onBlur:Q,"aria-current":F===t?"date":void 0,yearsPerRow:x,slots:S,slotProps:k,children:L.format(e,"year")},L.format(e,"year"))})}))}),k3=e=>(0,V.ZP)("MuiPickersCalendarHeader",e),k8=(0,F.Z)("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]),k4=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],k6=["ownerState"],k9=(0,Z.ZP)("div",{name:"MuiPickersCalendarHeader",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",alignItems:"center",marginTop:12,marginBottom:4,paddingLeft:24,paddingRight:12,maxHeight:40,minHeight:40}),k7=(0,Z.ZP)("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>(0,cu.Z)({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),Me=(0,Z.ZP)("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),Mt=(0,Z.ZP)(K.Z,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${k8.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),Mn=(0,Z.ZP)(Cu,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),Mr=D.forwardRef(function(e,t){let n=Cg(),r=w4(),i=(0,wQ.Z)({props:e,name:"MuiPickersCalendarHeader"}),{slots:o,slotProps:s,currentMonth:l,disabled:a,disableFuture:c,disablePast:u,maxDate:h,minDate:d,onMonthChange:f,onViewChange:p,view:m,reduceAnimations:g,views:v,labelId:b,className:y,timezone:x,format:w=`${r.formats.month} ${r.formats.year}`}=i,C=(0,ch.Z)(i,k4),S=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},k3,t)})(i),k=o?.switchViewButton??Mt,M=(0,CX.Z)({elementType:k,externalSlotProps:s?.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(m)},ownerState:i,className:S.switchViewButton}),A=o?.switchViewIcon??Mn,O=(0,CX.Z)({elementType:A,externalSlotProps:s?.switchViewIcon,ownerState:i,className:S.switchViewIcon}),I=(0,ch.Z)(O,k6),E=function(e,{disableFuture:t,maxDate:n,timezone:r}){let i=w4();return D.useMemo(()=>{let o=i.date(void 0,r),s=i.startOfMonth(t&&i.isBefore(o,n)?o:n);return!i.isAfter(s,e)},[t,n,e,i,r])}(l,{disableFuture:c,maxDate:h,timezone:x}),Z=function(e,{disablePast:t,minDate:n,timezone:r}){let i=w4();return D.useMemo(()=>{let o=i.date(void 0,r),s=i.startOfMonth(t&&i.isAfter(o,n)?o:n);return!i.isBefore(s,e)},[t,n,e,i,r])}(l,{disablePast:u,minDate:d,timezone:x});if(1===v.length&&"year"===v[0])return null;let L=r.formatByString(l,w);return(0,T.jsxs)(k9,(0,cu.Z)({},C,{ownerState:i,className:(0,R.Z)(S.root,y),ref:t,children:[(0,T.jsxs)(k7,{role:"presentation",onClick:()=>{if(1!==v.length&&p&&!a)if(2===v.length)p(v.find(e=>e!==m)||v[0]);else{let e=+(0===v.indexOf(m));p(v[e])}},ownerState:i,"aria-live":"polite",className:S.labelContainer,children:[(0,T.jsx)(kr,{reduceAnimations:g,transKey:L,children:(0,T.jsx)(Me,{id:b,ownerState:i,className:S.label,children:L})}),v.length>1&&!a&&(0,T.jsx)(k,(0,cu.Z)({},M,{children:(0,T.jsx)(A,(0,cu.Z)({},I))}))]}),(0,T.jsx)(ke.Z,{in:"day"===m,appear:!g,enter:!g,children:(0,T.jsx)(C8,{slots:o,slotProps:s,onGoToPrevious:()=>f(r.addMonths(l,-1),"right"),isPreviousDisabled:Z,previousLabel:n.previousMonth,onGoToNext:()=>f(r.addMonths(l,1),"left"),isNextDisabled:E,nextLabel:n.nextMonth})})]}))}),Mi="undefined"!=typeof navigator&&navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i),Mo=Mi&&Mi[1]?parseInt(Mi[1],10):null,Ms=Mi&&Mi[2]?parseInt(Mi[2],10):null,Ml=Mo&&Mo<10||Ms&&Ms<13||!1,Ma=e=>(0,V.ZP)("MuiDateCalendar",e);(0,F.Z)("MuiDateCalendar",["root","viewTransitionContainer"]);let Mc=["autoFocus","onViewChange","value","defaultValue","referenceDate","disableFuture","disablePast","onChange","onYearChange","onMonthChange","reduceAnimations","shouldDisableDate","shouldDisableMonth","shouldDisableYear","view","views","openTo","className","disabled","readOnly","minDate","maxDate","disableHighlightToday","focusedView","onFocusedViewChange","showDaysOutsideCurrentMonth","fixedWeekNumber","dayOfWeekFormatter","slots","slotProps","loading","renderLoading","displayWeekNumber","yearsOrder","yearsPerRow","monthsPerRow","timezone"],Mu=(0,Z.ZP)(C7,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:336}),Mh=(0,Z.ZP)(kr,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),Md=D.forwardRef(function(e,t){let n=w4(),r=(0,CY.Z)(),i=function(e,t){let n=w4(),r=w6(),i=(0,aw.Z)("@media (prefers-reduced-motion: reduce)",{defaultMatches:!1})||Ml,o=(0,wQ.Z)({props:e,name:t});return(0,cu.Z)({},o,{loading:o.loading??!1,disablePast:o.disablePast??!1,disableFuture:o.disableFuture??!1,openTo:o.openTo??"day",views:o.views??["year","day"],reduceAnimations:o.reduceAnimations??i,renderLoading:o.renderLoading??(()=>(0,T.jsx)("span",{children:"..."})),minDate:Ct(n,o.minDate,r.minDate),maxDate:Ct(n,o.maxDate,r.maxDate)})}(e,"MuiDateCalendar"),{autoFocus:o,onViewChange:s,value:l,defaultValue:a,referenceDate:c,disableFuture:u,disablePast:h,onChange:d,onYearChange:f,onMonthChange:p,reduceAnimations:m,shouldDisableDate:g,shouldDisableMonth:v,shouldDisableYear:b,view:y,views:x,openTo:w,className:C,disabled:S,readOnly:k,minDate:M,maxDate:A,disableHighlightToday:O,focusedView:I,onFocusedViewChange:E,showDaysOutsideCurrentMonth:Z,fixedWeekNumber:L,dayOfWeekFormatter:j,slots:B,slotProps:F,loading:V,renderLoading:N,displayWeekNumber:H,yearsOrder:z,yearsPerRow:$,monthsPerRow:W,timezone:_}=i,q=(0,ch.Z)(i,Mc),{value:G,handleValueChange:U,timezone:K}=SI({name:"DateCalendar",timezone:_,value:l,defaultValue:a,referenceDate:c,onChange:d,valueManager:SJ}),{view:Y,setView:X,focusedView:Q,setFocusedView:J,goToNextView:ee,setValueAndGoToNextView:et}=C9({view:y,views:x,openTo:w,onChange:U,onViewChange:s,autoFocus:o,focusedView:I,onFocusedViewChange:E}),{referenceDate:en,calendarState:er,changeFocusedDay:ei,changeMonth:eo,handleChangeMonth:es,isDateDisabled:el,onMonthSwitchingAnimationEnd:ea}=(e=>{let t,{value:n,referenceDate:r,disableFuture:i,disablePast:o,disableSwitchToMonthOnDayFocus:s=!1,maxDate:l,minDate:a,onMonthChange:c,reduceAnimations:u,shouldDisableDate:h,timezone:d}=e,f=w4(),p=D.useRef((t=!!u,(e,n)=>{switch(n.type){case"changeMonth":return(0,cu.Z)({},e,{slideDirection:n.direction,currentMonth:n.newMonth,isMonthSwitchingAnimating:!t});case"changeMonthTimezone":{let t=n.newTimezone;if(f.getTimezone(e.currentMonth)===t)return e;let r=f.setTimezone(e.currentMonth,t);return f.getMonth(r)!==f.getMonth(e.currentMonth)&&(r=f.setMonth(r,f.getMonth(e.currentMonth))),(0,cu.Z)({},e,{currentMonth:r})}case"finishMonthSwitchingAnimation":return(0,cu.Z)({},e,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(null!=e.focusedDay&&null!=n.focusedDay&&f.isSameDay(n.focusedDay,e.focusedDay))return e;let r=null!=n.focusedDay&&!s&&!f.isSameMonth(e.currentMonth,n.focusedDay);return(0,cu.Z)({},e,{focusedDay:n.focusedDay,isMonthSwitchingAnimating:r&&!t&&!n.withoutMonthSwitchingAnimation,currentMonth:r?f.startOfMonth(n.focusedDay):e.currentMonth,slideDirection:null!=n.focusedDay&&f.isAfterDay(n.focusedDay,e.currentMonth)?"left":"right"})}default:throw Error("missing support")}})).current,m=D.useMemo(()=>SJ.getInitialReferenceValue({value:n,utils:f,timezone:d,props:e,referenceDate:r,granularity:SE.day}),[r,d]),[g,v]=D.useReducer(p,{isMonthSwitchingAnimating:!1,focusedDay:m,currentMonth:f.startOfMonth(m),slideDirection:"left"});D.useEffect(()=>{v({type:"changeMonthTimezone",newTimezone:f.getTimezone(m)})},[m,f]);let b=D.useCallback(e=>{v((0,cu.Z)({type:"changeMonth"},e)),c&&c(e.newMonth)},[c]),y=D.useCallback(e=>{f.isSameMonth(e,g.currentMonth)||b({newMonth:f.startOfMonth(e),direction:f.isAfterDay(e,g.currentMonth)?"left":"right"})},[g.currentMonth,b,f]),x=S9({shouldDisableDate:h,minDate:a,maxDate:l,disableFuture:i,disablePast:o,timezone:d}),w=D.useCallback(()=>{v({type:"finishMonthSwitchingAnimation"})},[]);return{referenceDate:m,calendarState:g,changeMonth:y,changeFocusedDay:(0,C4.Z)((e,t)=>{x(e)||v({type:"changeFocusedDay",focusedDay:e,withoutMonthSwitchingAnimation:t})}),isDateDisabled:x,onMonthSwitchingAnimationEnd:w,handleChangeMonth:b}})({value:G,referenceDate:c,reduceAnimations:m,onMonthChange:p,minDate:M,maxDate:A,shouldDisableDate:g,disablePast:h,disableFuture:u,timezone:K}),ec=S&&G||M,eu=S&&G||A,eh=`${r}-grid-label`,ed=null!==Q,ef=B?.calendarHeader??Mr,ep=(0,CX.Z)({elementType:ef,externalSlotProps:F?.calendarHeader,additionalProps:{views:x,view:Y,currentMonth:er.currentMonth,onViewChange:X,onMonthChange:(e,t)=>es({newMonth:e,direction:t}),minDate:ec,maxDate:eu,disabled:S,disablePast:h,disableFuture:u,reduceAnimations:m,timezone:K,labelId:eh},ownerState:i}),em=(0,C4.Z)(e=>{let t=n.startOfMonth(e),r=n.endOfMonth(e),i=el(e)?Ce({utils:n,date:e,minDate:n.isBefore(M,t)?t:M,maxDate:n.isAfter(A,r)?r:A,disablePast:h,disableFuture:u,isDateDisabled:el,timezone:K}):e;i?(et(i,"finish"),p?.(t)):(ee(),eo(t)),ei(i,!0)}),eg=(0,C4.Z)(e=>{let t=n.startOfYear(e),r=n.endOfYear(e),i=el(e)?Ce({utils:n,date:e,minDate:n.isBefore(M,t)?t:M,maxDate:n.isAfter(A,r)?r:A,disablePast:h,disableFuture:u,isDateDisabled:el,timezone:K}):e;i?(et(i,"finish"),f?.(i)):(ee(),eo(t)),ei(i,!0)}),ev=(0,C4.Z)(e=>e?U(w7(n,e,G??en),"finish",Y):U(e,"finish",Y));D.useEffect(()=>{null!=G&&n.isValid(G)&&eo(G)},[G]);let eb=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},Ma,t)})(i),ey={disablePast:h,disableFuture:u,maxDate:A,minDate:M},ex={disableHighlightToday:O,readOnly:k,disabled:S,timezone:K,gridLabelId:eh,slots:B,slotProps:F},ew=D.useRef(Y);D.useEffect(()=>{ew.current!==Y&&(Q===ew.current&&J(Y,!0),ew.current=Y)},[Q,J,Y]);let eC=D.useMemo(()=>[G],[G]);return(0,T.jsxs)(Mu,(0,cu.Z)({ref:t,className:(0,R.Z)(eb.root,C),ownerState:i},q,{children:[(0,T.jsx)(ef,(0,cu.Z)({},ep,{slots:B,slotProps:F})),(0,T.jsx)(Mh,{reduceAnimations:m,className:eb.viewTransitionContainer,transKey:Y,ownerState:i,children:(0,T.jsxs)("div",{children:["year"===Y&&(0,T.jsx)(k5,(0,cu.Z)({},ey,ex,{value:G,onChange:eg,shouldDisableYear:b,hasFocus:ed,onFocusedViewChange:e=>J("year",e),yearsOrder:z,yearsPerRow:$,referenceDate:en})),"month"===Y&&(0,T.jsx)(kG,(0,cu.Z)({},ey,ex,{hasFocus:ed,className:C,value:G,onChange:em,shouldDisableMonth:v,onFocusedViewChange:e=>J("month",e),monthsPerRow:W,referenceDate:en})),"day"===Y&&(0,T.jsx)(kB,(0,cu.Z)({},er,ey,ex,{onMonthSwitchingAnimationEnd:ea,onFocusedDayChange:ei,reduceAnimations:m,selectedDays:eC,onSelectedDaysChange:ev,shouldDisableDate:g,shouldDisableMonth:v,shouldDisableYear:b,hasFocus:ed,onFocusedViewChange:e=>J("day",e),showDaysOutsideCurrentMonth:Z,fixedWeekNumber:L,dayOfWeekFormatter:j,displayWeekNumber:H,loading:V,renderLoading:N}))]})})]}))}),Mf=({view:e,onViewChange:t,views:n,focusedView:r,onFocusedViewChange:i,value:o,defaultValue:s,referenceDate:l,onChange:a,className:c,classes:u,disableFuture:h,disablePast:d,minDate:f,maxDate:p,shouldDisableDate:m,shouldDisableMonth:g,shouldDisableYear:v,reduceAnimations:b,onMonthChange:y,monthsPerRow:x,onYearChange:w,yearsOrder:C,yearsPerRow:S,slots:k,slotProps:M,loading:D,renderLoading:A,disableHighlightToday:R,readOnly:P,disabled:O,showDaysOutsideCurrentMonth:I,dayOfWeekFormatter:E,sx:Z,autoFocus:L,fixedWeekNumber:j,displayWeekNumber:B,timezone:F})=>(0,T.jsx)(Md,{view:e,onViewChange:t,views:n.filter(Cs),focusedView:r&&Cs(r)?r:null,onFocusedViewChange:i,value:o,defaultValue:s,referenceDate:l,onChange:a,className:c,classes:u,disableFuture:h,disablePast:d,minDate:f,maxDate:p,shouldDisableDate:m,shouldDisableMonth:g,shouldDisableYear:v,reduceAnimations:b,onMonthChange:y,monthsPerRow:x,onYearChange:w,yearsOrder:C,yearsPerRow:S,slots:k,slotProps:M,loading:D,renderLoading:A,disableHighlightToday:R,readOnly:P,disabled:O,showDaysOutsideCurrentMonth:I,dayOfWeekFormatter:E,sx:Z,autoFocus:L,fixedWeekNumber:j,displayWeekNumber:B,timezone:F});function Mp(e){let{props:t,validator:n,value:r,timezone:i,onError:o}=e,s=w8(),l=D.useRef(n.valueManager.defaultErrorState),a=n({adapter:s,value:r,timezone:i,props:t}),c=n.valueManager.hasError(a);return D.useEffect(()=>{o&&!n.valueManager.isSameError(a,l.current)&&o(a,r),l.current=a},[n,o,a,r]),{validationError:a,hasValidationError:c,getValidationErrorForNewValue:(0,C4.Z)(e=>n({adapter:s,value:e,timezone:i,props:t}))}}let Mm=["className","sx"],Mg=(e=document)=>{let t=e.activeElement;return t?t.shadowRoot?Mg(t.shadowRoot):t:null};function Mv(){return"undefined"==typeof window?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?90===Math.abs(window.screen.orientation.angle)?"landscape":"portrait":window.orientation&&90===Math.abs(Number(window.orientation))?"landscape":"portrait"}function Mb(e){return(0,V.ZP)("MuiPickersLayout",e)}let My=(0,F.Z)("MuiPickersLayout",["root","landscape","contentWrapper","toolbar","actionBar","tabs","shortcuts"]),Mx=["onAccept","onClear","onCancel","onSetToday","actions"];function Mw(e){let{onAccept:t,onClear:n,onCancel:r,onSetToday:i,actions:o}=e,s=(0,ch.Z)(e,Mx),l=Cg();if(null==o||0===o.length)return null;let a=o?.map(e=>{switch(e){case"clear":return(0,T.jsx)(q.Z,{onClick:n,children:l.clearButtonLabel},e);case"cancel":return(0,T.jsx)(q.Z,{onClick:r,children:l.cancelButtonLabel},e);case"accept":return(0,T.jsx)(q.Z,{onClick:t,children:l.okButtonLabel},e);case"today":return(0,T.jsx)(q.Z,{onClick:i,children:l.todayButtonLabel},e);default:return null}});return(0,T.jsx)(lt.Z,(0,cu.Z)({},s,{children:a}))}var MC=n(71852),MS=n(88653),Mk=n(70777);function MM(e){return(0,V.ZP)("MuiListItem",e)}function MT(e){return(0,V.ZP)("MuiListItemSecondaryAction",e)}(0,F.Z)("MuiListItem",["root","container","dense","alignItemsFlexStart","divider","gutters","padding","secondaryAction"]),(0,F.Z)("MuiListItemSecondaryAction",["root","disableGutters"]);let MD=(0,Z.ZP)("div",{name:"MuiListItemSecondaryAction",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.disableGutters&&t.disableGutters]}})({position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",variants:[{props:({ownerState:e})=>e.disableGutters,style:{right:0}}]}),MA=D.forwardRef(function(e,t){let n=(0,B.i)({props:e,name:"MuiListItemSecondaryAction"}),{className:r,...i}=n,o=D.useContext(ob.Z),s={...n,disableGutters:o.disableGutters},l=(e=>{let{disableGutters:t,classes:n}=e;return(0,P.Z)({root:["root",t&&"disableGutters"]},MT,n)})(s);return(0,T.jsx)(MD,{className:(0,R.Z)(l.root,r),ownerState:s,ref:t,...i})});MA.muiName="ListItemSecondaryAction";let MR=(0,Z.ZP)("div",{name:"MuiListItem",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,"flex-start"===n.alignItems&&t.alignItemsFlexStart,n.divider&&t.divider,!n.disableGutters&&t.gutters,!n.disablePadding&&t.padding,n.hasSecondaryAction&&t.secondaryAction]}})((0,L.Z)(({theme:e})=>({display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",width:"100%",boxSizing:"border-box",textAlign:"left",variants:[{props:({ownerState:e})=>!e.disablePadding,style:{paddingTop:8,paddingBottom:8}},{props:({ownerState:e})=>!e.disablePadding&&e.dense,style:{paddingTop:4,paddingBottom:4}},{props:({ownerState:e})=>!e.disablePadding&&!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>!e.disablePadding&&!!e.secondaryAction,style:{paddingRight:48}},{props:({ownerState:e})=>!!e.secondaryAction,style:{[`& > .${ox.root}`]:{paddingRight:48}}},{props:{alignItems:"flex-start"},style:{alignItems:"flex-start"}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"}},{props:({ownerState:e})=>e.button,style:{transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}}}},{props:({ownerState:e})=>e.hasSecondaryAction,style:{paddingRight:48}}]}))),MP=(0,Z.ZP)("li",{name:"MuiListItem",slot:"Container",overridesResolver:(e,t)=>t.container})({position:"relative"}),MO=D.forwardRef(function(e,t){let n=(0,B.i)({props:e,name:"MuiListItem"}),{alignItems:r="center",children:i,className:o,component:s,components:l={},componentsProps:a={},ContainerComponent:c="li",ContainerProps:{className:u,...h}={},dense:d=!1,disableGutters:f=!1,disablePadding:p=!1,divider:m=!1,secondaryAction:g,slotProps:v={},slots:b={},...y}=n,x=D.useContext(ob.Z),w=D.useMemo(()=>({dense:d||x.dense||!1,alignItems:r,disableGutters:f}),[r,x.dense,d,f]),C=D.useRef(null),S=D.Children.toArray(i),k=S.length&&(0,Mk.Z)(S[S.length-1],["ListItemSecondaryAction"]),M={...n,alignItems:r,dense:w.dense,disableGutters:f,disablePadding:p,divider:m,hasSecondaryAction:k},A=(e=>{let{alignItems:t,classes:n,dense:r,disableGutters:i,disablePadding:o,divider:s,hasSecondaryAction:l}=e;return(0,P.Z)({root:["root",r&&"dense",!i&&"gutters",!o&&"padding",s&&"divider","flex-start"===t&&"alignItemsFlexStart",l&&"secondaryAction"],container:["container"]},MM,n)})(M),O=(0,ov.Z)(C,t),I=b.root||l.Root||MR,E=v.root||a.root||{},Z={className:(0,R.Z)(A.root,E.className,o),...y},L=s||"li";return k?(L=Z.component||s?L:"div","li"===c&&("li"===L?L="div":"li"===Z.component&&(Z.component="div")),(0,T.jsx)(ob.Z.Provider,{value:w,children:(0,T.jsxs)(MP,{as:c,className:(0,R.Z)(A.container,u),ref:O,ownerState:M,...h,children:[(0,T.jsx)(I,{...E,...!(0,MS.Z)(I)&&{as:L,ownerState:{...M,...E.ownerState}},...Z,children:S}),S.pop()]})})):(0,T.jsx)(ob.Z.Provider,{value:w,children:(0,T.jsxs)(I,{...E,as:L,ref:O,...!(0,MS.Z)(I)&&{ownerState:{...M,...E.ownerState}},...Z,children:[S,g&&(0,T.jsx)(MA,{children:g})]})})});var MI=n(52889);let ME=["items","changeImportance","isLandscape","onChange","isValid"],MZ=["getValue"];function ML(e){let{items:t,changeImportance:n="accept",onChange:r,isValid:i}=e,o=(0,ch.Z)(e,ME);if(null==t||0===t.length)return null;let s=t.map(e=>{let{getValue:t}=e,o=(0,ch.Z)(e,MZ),s=t({isValid:i});return(0,cu.Z)({},o,{label:o.label,onClick:()=>{r(s,n,o)},disabled:!i(s)})});return(0,T.jsx)(MC.Z,(0,cu.Z)({dense:!0,sx:[{maxHeight:336,maxWidth:200,overflow:"auto"},...Array.isArray(o.sx)?o.sx:[o.sx]]},o,{children:s.map(e=>(0,T.jsx)(MO,{children:(0,T.jsx)(MI.Z,(0,cu.Z)({},e))},e.id??e.label))}))}let Mj=(0,Z.ZP)("div",{name:"MuiPickersLayout",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"grid",gridAutoColumns:"max-content auto max-content",gridAutoRows:"max-content auto max-content",[`& .${My.actionBar}`]:{gridColumn:"1 / 4",gridRow:3},variants:[{props:{isLandscape:!0},style:{[`& .${My.toolbar}`]:{gridColumn:1,gridRow:"2 / 3"},[`.${My.shortcuts}`]:{gridColumn:"2 / 4",gridRow:1}}},{props:{isLandscape:!0,isRtl:!0},style:{[`& .${My.toolbar}`]:{gridColumn:3}}},{props:{isLandscape:!1},style:{[`& .${My.toolbar}`]:{gridColumn:"2 / 4",gridRow:1},[`& .${My.shortcuts}`]:{gridColumn:1,gridRow:"2 / 3"}}},{props:{isLandscape:!1,isRtl:!0},style:{[`& .${My.shortcuts}`]:{gridColumn:3}}}]}),MB=(0,Z.ZP)("div",{name:"MuiPickersLayout",slot:"ContentWrapper",overridesResolver:(e,t)=>t.contentWrapper})({gridColumn:2,gridRow:2,display:"flex",flexDirection:"column"}),MF=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiPickersLayout"}),{toolbar:r,content:i,tabs:o,actionBar:s,shortcuts:l}=(e=>{let{wrapperVariant:t,onAccept:n,onClear:r,onCancel:i,onSetToday:o,view:s,views:l,onViewChange:a,value:c,onChange:u,onSelectShortcut:h,isValid:d,isLandscape:f,disabled:p,readOnly:m,children:g,slots:v,slotProps:b}=e,y=(e=>{let{classes:t,isLandscape:n}=e;return(0,P.Z)({root:["root",n&&"landscape"],contentWrapper:["contentWrapper"],toolbar:["toolbar"],actionBar:["actionBar"],tabs:["tabs"],landscape:["landscape"],shortcuts:["shortcuts"]},Mb,t)})(e),x=v?.actionBar??Mw,w=(0,CX.Z)({elementType:x,externalSlotProps:b?.actionBar,additionalProps:{onAccept:n,onClear:r,onCancel:i,onSetToday:o,actions:"desktop"===t?[]:["cancel","accept"]},className:y.actionBar,ownerState:(0,cu.Z)({},e,{wrapperVariant:t})}),C=(0,T.jsx)(x,(0,cu.Z)({},w)),S=v?.toolbar,k=(0,CX.Z)({elementType:S,externalSlotProps:b?.toolbar,additionalProps:{isLandscape:f,onChange:u,value:c,view:s,onViewChange:a,views:l,disabled:p,readOnly:m},className:y.toolbar,ownerState:(0,cu.Z)({},e,{wrapperVariant:t})}),M=null!==k.view&&S?(0,T.jsx)(S,(0,cu.Z)({},k)):null,D=v?.tabs,A=s&&D?(0,T.jsx)(D,(0,cu.Z)({view:s,onViewChange:a,className:y.tabs},b?.tabs)):null,R=v?.shortcuts??ML,O=(0,CX.Z)({elementType:R,externalSlotProps:b?.shortcuts,additionalProps:{isValid:d,isLandscape:f,onChange:h},className:y.shortcuts,ownerState:{isValid:d,isLandscape:f,onChange:h,wrapperVariant:t}});return{toolbar:M,content:g,tabs:A,actionBar:C,shortcuts:s&&R?(0,T.jsx)(R,(0,cu.Z)({},O)):null}})(n),{sx:a,className:c,isLandscape:u,wrapperVariant:h}=n,d=(e=>{let{isLandscape:t,classes:n}=e;return(0,P.Z)({root:["root",t&&"landscape"],contentWrapper:["contentWrapper"]},Mb,n)})(n);return(0,T.jsxs)(Mj,{ref:t,sx:a,className:(0,R.Z)(d.root,c),ownerState:n,children:[u?l:r,u?r:l,(0,T.jsx)(MB,{className:d.contentWrapper,children:"desktop"===h?(0,T.jsxs)(D.Fragment,{children:[i,o]}):(0,T.jsxs)(D.Fragment,{children:[o,i]})}),s]})}),MV=["props","ref"],MN=(0,Z.ZP)(MF)(({theme:e})=>({overflow:"hidden",minWidth:320,backgroundColor:(e.vars||e).palette.background.paper})),MH=({adapter:e,value:t,timezone:n,props:r})=>{if(null===t)return null;let{minTime:i,maxTime:o,minutesStep:s,shouldDisableTime:l,disableIgnoringDatePartForTimeValidation:a=!1,disablePast:c,disableFuture:u}=r,h=e.utils.date(void 0,n),d=CN(a,e.utils);switch(!0){case!e.utils.isValid(t):return"invalidDate";case!!(i&&d(i,t)):return"minTime";case!!(o&&d(t,o)):return"maxTime";case!!(u&&e.utils.isAfter(t,h)):return"disableFuture";case!!(c&&e.utils.isBefore(t,h)):return"disablePast";case!!(l&&l(t,"hours")):return"shouldDisableTime-hours";case!!(l&&l(t,"minutes")):return"shouldDisableTime-minutes";case!!(l&&l(t,"seconds")):return"shouldDisableTime-seconds";case!!(s&&e.utils.getMinutes(t)%s!=0):return"minutesStep";default:return null}};MH.valueManager=SJ;let Mz=({adapter:e,value:t,timezone:n,props:r})=>{let i=S6({adapter:e,value:t,timezone:n,props:r});return null!==i?i:MH({adapter:e,value:t,timezone:n,props:r})};Mz.valueManager=SJ;let M$=D.forwardRef(function(e,t){let n=function(e,t){let n=w4(),r=w6(),i=(0,wQ.Z)({props:e,name:t}),o=i.ampm??n.is12HourCycleInCurrentLocale(),s=D.useMemo(()=>i.localeText?.toolbarTitle==null?i.localeText:(0,cu.Z)({},i.localeText,{dateTimePickerToolbarTitle:i.localeText.toolbarTitle}),[i.localeText]);return(0,cu.Z)({},i,(({openTo:e,defaultOpenTo:t,views:n,defaultViews:r})=>{let i,o=n??r;if(null!=e)i=e;else if(o.includes(t))i=t;else if(o.length>0)i=o[0];else throw Error("MUI X: The `views` prop must contain at least one view.");return{views:o,openTo:i}})({views:i.views,openTo:i.openTo,defaultViews:["year","day","hours","minutes"],defaultOpenTo:"day"}),{ampm:o,localeText:s,orientation:i.orientation??"portrait",disableIgnoringDatePartForTimeValidation:i.disableIgnoringDatePartForTimeValidation??!!(i.minDateTime||i.maxDateTime||i.disablePast||i.disableFuture),disableFuture:i.disableFuture??!1,disablePast:i.disablePast??!1,minDate:Ct(n,i.minDateTime??i.minDate,r.minDate),maxDate:Ct(n,i.maxDateTime??i.maxDate,r.maxDate),minTime:i.minDateTime??i.minTime,maxTime:i.maxDateTime??i.maxTime,slots:(0,cu.Z)({toolbar:CK,tabs:Cy},i.slots),slotProps:(0,cu.Z)({},i.slotProps,{toolbar:(0,cu.Z)({ampm:o},i.slotProps?.toolbar)})})}(e,"MuiStaticDateTimePicker"),r=n.displayStaticWrapperAs??"mobile",i=n.ampmInClock??"desktop"===r,o=(0,cu.Z)({day:Mf,month:Mf,year:Mf,hours:S4,minutes:S4,seconds:S4},n.viewRenderers),{renderPicker:s}=(e=>{let{props:t,ref:n}=e,r=(0,ch.Z)(e,MV),{localeText:i,slots:o,slotProps:s,className:l,sx:a,displayStaticWrapperAs:c,autoFocus:u}=t,{layoutProps:h,renderCurrentView:d}=(({props:e,valueManager:t,valueType:n,wrapperVariant:r,additionalViewProps:i,validator:o,autoFocusView:s,rendererInterceptor:l,fieldRef:a})=>{let c=(({props:e,valueManager:t,valueType:n,wrapperVariant:r,validator:i})=>{let{onAccept:o,onChange:s,value:l,defaultValue:a,closeOnSelect:c="desktop"===r,timezone:u,referenceDate:h}=e,{current:d}=D.useRef(a),{current:f}=D.useRef(void 0!==l),[p,m]=D.useState(u),g=w4(),v=w8(),{isOpen:b,setIsOpen:y}=(({open:e,onOpen:t,onClose:n})=>{let r=D.useRef("boolean"==typeof e).current,[i,o]=D.useState(!1);return D.useEffect(()=>{if(r){if("boolean"!=typeof e)throw Error("You must not mix controlling and uncontrolled mode for `open` prop");o(e)}},[r,e]),{isOpen:i,setIsOpen:D.useCallback(e=>{r||o(e),e&&t&&t(),!e&&n&&n()},[r,t,n])}})(e),{timezone:x,value:w,handleValueChange:C}=SO({timezone:u,value:l,defaultValue:d,referenceDate:h,onChange:s,valueManager:t}),[S,k]=D.useState(()=>{let e;return{draft:e=void 0!==w?w:void 0!==d?d:t.emptyValue,lastPublishedValue:e,lastCommittedValue:e,lastControlledValue:l,hasBeenModifiedSinceMount:!1}}),M=t.getTimezone(g,S.draft);p!==u&&(m(u),u&&M&&u!==M&&k(e=>(0,cu.Z)({},e,{draft:t.setTimezone(g,u,e.draft)})));let{getValidationErrorForNewValue:T}=Mp({props:e,validator:i,timezone:x,value:S.draft,onError:e.onError}),A=(0,C4.Z)(e=>{let n={action:e,dateState:S,hasChanged:n=>!t.areValuesEqual(g,e.value,n),isControlled:f,closeOnSelect:c},r=(e=>{let{action:t,hasChanged:n,dateState:r,isControlled:i}=e,o=!i&&!r.hasBeenModifiedSinceMount;return"setValueFromField"===t.name||("setValueFromAction"===t.name?!!(o&&["accept","today","clear"].includes(t.pickerAction))||n(r.lastPublishedValue):("setValueFromView"===t.name&&"shallow"!==t.selectionState||"setValueFromShortcut"===t.name)&&(!!o||n(r.lastPublishedValue)))})(n),i=(e=>{let{action:t,hasChanged:n,dateState:r,isControlled:i,closeOnSelect:o}=e,s=!i&&!r.hasBeenModifiedSinceMount;return"setValueFromAction"===t.name?!!(s&&["accept","today","clear"].includes(t.pickerAction))||n(r.lastCommittedValue):"setValueFromView"===t.name&&"finish"===t.selectionState&&o?!!s||n(r.lastCommittedValue):"setValueFromShortcut"===t.name&&"accept"===t.changeImportance&&n(r.lastCommittedValue)})(n),s=(e=>{let{action:t,closeOnSelect:n}=e;return"setValueFromAction"===t.name||("setValueFromView"===t.name?"finish"===t.selectionState&&n:"setValueFromShortcut"===t.name&&"accept"===t.changeImportance)})(n);k(t=>(0,cu.Z)({},t,{draft:e.value,lastPublishedValue:r?e.value:t.lastPublishedValue,lastCommittedValue:i?e.value:t.lastCommittedValue,hasBeenModifiedSinceMount:!0}));let l=null,a=()=>(l||(l={validationError:"setValueFromField"===e.name?e.context.validationError:T(e.value)},"setValueFromShortcut"===e.name&&(l.shortcut=e.shortcut)),l);r&&C(e.value,a()),i&&o&&o(e.value,a()),s&&y(!1)});if(S.lastControlledValue!==l){let e=t.areValuesEqual(g,S.draft,w);k(t=>(0,cu.Z)({},t,{lastControlledValue:l},e?{}:{lastCommittedValue:w,lastPublishedValue:w,draft:w,hasBeenModifiedSinceMount:!0}))}let R=(0,C4.Z)(()=>{A({value:t.emptyValue,name:"setValueFromAction",pickerAction:"clear"})}),P=(0,C4.Z)(()=>{A({value:S.lastPublishedValue,name:"setValueFromAction",pickerAction:"accept"})}),O=(0,C4.Z)(()=>{A({value:S.lastPublishedValue,name:"setValueFromAction",pickerAction:"dismiss"})}),I=(0,C4.Z)(()=>{A({value:S.lastCommittedValue,name:"setValueFromAction",pickerAction:"cancel"})}),E=(0,C4.Z)(()=>{A({value:t.getTodayValue(g,x,n),name:"setValueFromAction",pickerAction:"today"})}),Z=(0,C4.Z)(e=>{e.preventDefault(),y(!0)}),L=(0,C4.Z)(e=>{e?.preventDefault(),y(!1)}),j=(0,C4.Z)((e,t="partial")=>A({name:"setValueFromView",value:e,selectionState:t})),B=(0,C4.Z)((e,t,n)=>A({name:"setValueFromShortcut",value:e,changeImportance:t,shortcut:n})),F=(0,C4.Z)((e,t)=>A({name:"setValueFromField",value:e,context:t})),V={onClear:R,onAccept:P,onDismiss:O,onCancel:I,onSetToday:E,onOpen:Z,onClose:L},N={value:S.draft,onChange:F},H=D.useMemo(()=>t.cleanValue(g,S.draft),[g,t,S.draft]),z=(0,cu.Z)({},V,{value:H,onChange:j,onSelectShortcut:B,isValid:n=>{let r=i({adapter:v,value:n,timezone:x,props:e});return!t.hasError(r)}}),$=D.useMemo(()=>({onOpen:Z,onClose:L,open:b}),[b,L,Z]);return{open:b,fieldProps:N,viewProps:{value:H,onChange:j,onClose:L,open:b},layoutProps:z,actions:V,contextValue:$}})({props:e,valueManager:t,valueType:n,wrapperVariant:r,validator:o}),u=(({props:e,propsFromPickerValue:t,additionalViewProps:n,autoFocusView:r,rendererInterceptor:i,fieldRef:o})=>{let{onChange:s,open:l,onClose:a}=t,{view:c,views:u,openTo:h,onViewChange:d,viewRenderers:f,timezone:p}=e,m=(0,ch.Z)(e,Mm),{view:g,setView:v,defaultView:b,focusedView:y,setFocusedView:x,setValueAndGoToNextView:w}=C9({view:c,views:u,openTo:h,onChange:s,onViewChange:d,autoFocus:r}),{hasUIView:C,viewModeLookup:S}=D.useMemo(()=>u.reduce((e,t)=>{let n;return n=null!=f[t]?"UI":"field",e.viewModeLookup[t]=n,"UI"===n&&(e.hasUIView=!0),e},{hasUIView:!1,viewModeLookup:{}}),[f,u]),k=D.useMemo(()=>u.reduce((e,t)=>null!=f[t]&&CB(t)?e+1:e,0),[f,u]),M=S[g],T=(0,C4.Z)(()=>"UI"===M),[A,R]=D.useState("UI"===M?g:null);return A!==g&&"UI"===S[g]&&R(g),(0,St.Z)(()=>{"field"===M&&l&&(a(),setTimeout(()=>{o?.current?.setSelectedSections(g),o?.current?.focusField(g)}))},[g]),(0,St.Z)(()=>{if(!l)return;let e=g;"field"===M&&null!=A&&(e=A),e!==b&&"UI"===S[e]&&"UI"===S[b]&&(e=b),e!==g&&v(e),x(e,!0)},[l]),{hasUIView:C,shouldRestoreFocus:T,layoutProps:{views:u,view:A,onViewChange:v},renderCurrentView:()=>{if(null==A)return null;let e=f[A];if(null==e)return null;let r=(0,cu.Z)({},m,n,t,{views:u,timezone:p,onChange:w,view:A,onViewChange:v,focusedView:y,onFocusedViewChange:x,showViewSwitcher:k>1,timeViewsCount:k});return i?i(f,A,r):e(r)}}})({props:e,additionalViewProps:i,autoFocusView:s,fieldRef:a,propsFromPickerValue:c.viewProps,rendererInterceptor:l}),h=(({props:e,propsFromPickerValue:t,propsFromPickerViews:n,wrapperVariant:r})=>{let{orientation:i}=e,o=((e,t)=>{var n;let[r,i]=D.useState(Mv);return(0,St.Z)(()=>{let e=()=>{i(Mv())};return window.addEventListener("orientationchange",e),()=>{window.removeEventListener("orientationchange",e)}},[]),(Array.isArray(n=["hours","minutes","seconds"])?!n.every(t=>-1!==e.indexOf(t)):-1===e.indexOf(n))&&"landscape"===(t||r)})(n.views,i),s=(0,aC.V)();return{layoutProps:(0,cu.Z)({},n,t,{isLandscape:o,isRtl:s,wrapperVariant:r,disabled:e.disabled,readOnly:e.readOnly})}})({props:e,wrapperVariant:r,propsFromPickerValue:c.layoutProps,propsFromPickerViews:u.layoutProps}),d=function(e){let{props:t,pickerValueResponse:n}=e;return D.useMemo(()=>({value:n.viewProps.value,open:n.open,disabled:t.disabled??!1,readOnly:t.readOnly??!1}),[n.viewProps.value,n.open,t.disabled,t.readOnly])}({props:e,pickerValueResponse:c});return{open:c.open,actions:c.actions,fieldProps:c.fieldProps,renderCurrentView:u.renderCurrentView,hasUIView:u.hasUIView,shouldRestoreFocus:u.shouldRestoreFocus,layoutProps:h.layoutProps,contextValue:c.contextValue,ownerState:d}})((0,cu.Z)({},r,{props:t,autoFocusView:u??!1,additionalViewProps:{},wrapperVariant:c})),f=o?.layout??MN;return{renderPicker:()=>(0,T.jsx)(w1,{localeText:i,children:(0,T.jsx)(f,(0,cu.Z)({},h,s?.layout,{slots:o,slotProps:s,sx:[...Array.isArray(a)?a:[a],...Array.isArray(s?.layout?.sx)?s.layout.sx:[s?.layout?.sx]],className:(0,R.Z)(l,s?.layout?.className),ref:n,children:d()}))})}})({props:(0,cu.Z)({},n,{viewRenderers:o,displayStaticWrapperAs:r,ampmInClock:i,yearsPerRow:n.yearsPerRow??("mobile"===r?3:4),slotProps:(0,cu.Z)({},n.slotProps,{tabs:(0,cu.Z)({hidden:"desktop"===r},n.slotProps?.tabs),toolbar:(0,cu.Z)({hidden:"desktop"===r,ampmInClock:i},n.slotProps?.toolbar)})}),valueManager:SJ,valueType:"date-time",validator:Mz,ref:t});return s()});M$.propTypes={ampm:w5().bool,ampmInClock:w5().bool,autoFocus:w5().bool,className:w5().string,dayOfWeekFormatter:w5().func,defaultValue:w5().object,disabled:w5().bool,disableFuture:w5().bool,disableHighlightToday:w5().bool,disableIgnoringDatePartForTimeValidation:w5().bool,disablePast:w5().bool,displayStaticWrapperAs:w5().oneOf(["desktop","mobile"]),displayWeekNumber:w5().bool,fixedWeekNumber:w5().number,loading:w5().bool,localeText:w5().object,maxDate:w5().object,maxDateTime:w5().object,maxTime:w5().object,minDate:w5().object,minDateTime:w5().object,minTime:w5().object,minutesStep:w5().number,monthsPerRow:w5().oneOf([3,4]),onAccept:w5().func,onChange:w5().func,onClose:w5().func,onError:w5().func,onMonthChange:w5().func,onViewChange:w5().func,onYearChange:w5().func,openTo:w5().oneOf(["day","hours","minutes","month","seconds","year"]),orientation:w5().oneOf(["landscape","portrait"]),readOnly:w5().bool,reduceAnimations:w5().bool,referenceDate:w5().object,renderLoading:w5().func,shouldDisableDate:w5().func,shouldDisableMonth:w5().func,shouldDisableTime:w5().func,shouldDisableYear:w5().func,showDaysOutsideCurrentMonth:w5().bool,slotProps:w5().object,slots:w5().object,sx:w5().oneOfType([w5().arrayOf(w5().oneOfType([w5().func,w5().object,w5().bool])),w5().func,w5().object]),timezone:w5().string,value:w5().object,view:w5().oneOf(["day","hours","minutes","month","seconds","year"]),viewRenderers:w5().shape({day:w5().func,hours:w5().func,minutes:w5().func,month:w5().func,seconds:w5().func,year:w5().func}),views:w5().arrayOf(w5().oneOf(["day","hours","minutes","month","seconds","year"]).isRequired),yearsOrder:w5().oneOf(["asc","desc"]),yearsPerRow:w5().oneOf([3,4])};let MW=({utils:e,date:t,shouldRespectLeadingZeros:n,localeText:r,localizedDigits:i,now:o,token:s,startSeparator:l})=>{if(""===s)throw Error("MUI X: Should not call `commitToken` with an empty token");let a=SL(e,s),c=SG(e,a.contentType,a.type,s),u=n?c:"digit"===a.contentType,h=null!=t&&e.isValid(t),d=h?e.formatByString(t,s):"",f=null;if(u)if(c)f=""===d?e.formatByString(o,s).length:d.length;else{if(null==a.maxLength)throw Error(`MUI X: The token ${s} should have a 'maxDigitNumber' property on it's adapter`);f=a.maxLength,h&&(d=SN(Sz(SV(d,i),f),i))}return(0,cu.Z)({},a,{format:s,maxLength:f,value:d,placeholder:((e,t,n,r)=>{switch(n.type){case"year":return t.fieldYearPlaceholder({digitAmount:e.formatByString(e.date(void 0,"default"),r).length,format:r});case"month":return t.fieldMonthPlaceholder({contentType:n.contentType,format:r});case"day":return t.fieldDayPlaceholder({format:r});case"weekDay":return t.fieldWeekDayPlaceholder({contentType:n.contentType,format:r});case"hours":return t.fieldHoursPlaceholder({format:r});case"minutes":return t.fieldMinutesPlaceholder({format:r});case"seconds":return t.fieldSecondsPlaceholder({format:r});case"meridiem":return t.fieldMeridiemPlaceholder({format:r});default:return r}})(e,r,a,s),hasLeadingZerosInFormat:c,hasLeadingZerosInInput:u,startSeparator:l,endSeparator:"",modified:!1})},M_=e=>{let t=(({utils:e,format:t})=>{let n=10,r=t,i=e.expandFormat(t);for(;i!==r;)if(r=i,i=e.expandFormat(r),(n-=1)<0)throw Error("MUI X: The format expansion seems to be in an infinite loop. Please open an issue with the format passed to the picker component.");return i})(e);e.isRtl&&e.enableAccessibleFieldDOMStructure&&(t=t.split(" ").reverse().join(" "));let n=(({utils:e,expandedFormat:t})=>{let n=[],{start:r,end:i}=e.escapedCharacters,o=RegExp(`(\\${r}[^\\${i}]*\\${i})+`,"g"),s=null;for(;s=o.exec(t);)n.push({start:s.index,end:o.lastIndex-1});return n})((0,cu.Z)({},e,{expandedFormat:t})),r=(e=>{let{utils:t,expandedFormat:n,escapedParts:r}=e,i=t.date(void 0),o=[],s="",l=Object.keys(t.formatTokenMap).sort((e,t)=>t.length-e.length),a=/^([a-zA-Z]+)/,c=RegExp(`^(${l.join("|")})*$`),u=RegExp(`^(${l.join("|")})`),h=e=>r.find(t=>t.start<=e&&t.end>=e),d=0;for(;d<n.length;){let t=h(d),r=null!=t,l=a.exec(n.slice(d))?.[1];if(!r&&null!=l&&c.test(l)){let t=l;for(;t.length>0;){let n=u.exec(t)[1];t=t.slice(n.length),o.push(MW((0,cu.Z)({},e,{now:i,token:n,startSeparator:s}))),s=""}d+=l.length}else{let e=n[d];r&&t?.start===d||t?.end===d||(0===o.length?s+=e:o[o.length-1].endSeparator+=e),d+=1}}return 0===o.length&&s.length>0&&o.push({type:"empty",contentType:"letter",maxLength:null,format:"",value:"",placeholder:"",hasLeadingZerosInFormat:!1,hasLeadingZerosInInput:!1,startSeparator:s,endSeparator:"",modified:!1}),o})((0,cu.Z)({},e,{expandedFormat:t,escapedParts:n}));return(({isRtl:e,formatDensity:t,sections:n})=>n.map(n=>{let r=n=>{let r=n;return e&&null!==r&&r.includes(" ")&&(r=`\u2069${r}\u2066`),"spacious"===t&&["/",".","-"].includes(r)&&(r=` ${r} `),r};return n.startSeparator=r(n.startSeparator),n.endSeparator=r(n.endSeparator),n}))((0,cu.Z)({},e,{sections:r}))},Mq=e=>{let{internalProps:{disabled:t,readOnly:n=!1},forwardedProps:{sectionListRef:r,onBlur:i,onClick:o,onFocus:s,onInput:l,onPaste:a,focused:c,autoFocus:u=!1},fieldValueManager:h,applyCharacterEditing:d,resetCharacterQuery:f,setSelectedSections:p,parsedSelectedSections:m,state:g,clearActiveSection:v,clearValue:b,updateSectionValue:y,updateValueFromValueStr:x,sectionOrder:w,areAllSectionsEmpty:C,sectionsValueBoundaries:S}=e,k=D.useRef(null),M=(0,ki.Z)(r,k),T=Cg(),A=w4(),R=(0,CY.Z)(),[P,O]=D.useState(!1),I=D.useMemo(()=>({syncSelectionToDOM:()=>{let e;if(!k.current)return;let t=document.getSelection();if(!t)return;if(null==m){t.rangeCount>0&&k.current.getRoot().contains(t.getRangeAt(0).startContainer)&&t.removeAllRanges(),P&&k.current.getRoot().blur();return}if(!k.current.getRoot().contains(Mg(document)))return;let n=new window.Range;e="all"===m?k.current.getRoot():"empty"===g.sections[m].type?k.current.getSectionContainer(m):k.current.getSectionContent(m),n.selectNodeContents(e),e.focus(),t.removeAllRanges(),t.addRange(n)},getActiveSectionIndexFromDOM:()=>{let e=Mg(document);return e&&k.current&&k.current.getRoot().contains(e)?k.current.getSectionIndexFromDOMElement(e):null},focusField:(e=0)=>{if(!k.current||null!=I.getActiveSectionIndexFromDOM())return;let t=SX(e,g.sections);O(!0),k.current.getSectionContent(t).focus()},setSelectedSections:e=>{if(!k.current)return;let t=SX(e,g.sections);O(null!==("all"===t?0:t)),p(e)},isFieldFocused:()=>{let e=Mg(document);return!!k.current&&k.current.getRoot().contains(e)}}),[m,p,g.sections,P]),E=(0,C4.Z)(e=>{if(!k.current)return;let t=g.sections[e];k.current.getSectionContent(e).innerHTML=t.value||t.placeholder,I.syncSelectionToDOM()}),Z=(0,C4.Z)((e,...t)=>{!e.isDefaultPrevented()&&k.current&&(O(!0),o?.(e,...t),"all"===m?setTimeout(()=>{let e=document.getSelection().getRangeAt(0).startOffset;if(0===e)return void p(w.startIndex);let t=0,n=0;for(;n<e&&t<g.sections.length;){let e=g.sections[t];t+=1,n+=`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`.length}p(t-1)}):P?k.current.getRoot().contains(e.target)||p(w.startIndex):(O(!0),p(w.startIndex)))}),L=(0,C4.Z)(e=>{if(l?.(e),!k.current||"all"!==m)return;let t=e.target.textContent??"";k.current.getRoot().innerHTML=g.sections.map(e=>`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`).join(""),I.syncSelectionToDOM(),0===t.length||10===t.charCodeAt(0)?(f(),b(),p("all")):t.length>1?x(t):("all"===m&&p(0),d({keyPressed:t,sectionIndex:0}))}),j=(0,C4.Z)(e=>{if(a?.(e),n||"all"!==m)return void e.preventDefault();let t=e.clipboardData.getData("text");e.preventDefault(),f(),x(t)}),B=(0,C4.Z)((...e)=>{s?.(...e),!P&&k.current&&(O(!0),null==k.current.getSectionIndexFromDOMElement(Mg(document))&&p(w.startIndex))}),F=(0,C4.Z)((...e)=>{i?.(...e),setTimeout(()=>{if(!k.current)return;let e=Mg(document);k.current.getRoot().contains(e)||(O(!1),p(null))})}),V=(0,C4.Z)(e=>t=>{t.isDefaultPrevented()||p(e)}),N=(0,C4.Z)(e=>{e.preventDefault()}),H=(0,C4.Z)(e=>()=>{p(e)}),z=(0,C4.Z)(e=>{if(e.preventDefault(),n||t||"number"!=typeof m)return;let r=g.sections[m],i=e.clipboardData.getData("text"),o=/^[a-zA-Z]+$/.test(i),s=/^[0-9]+$/.test(i),l=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(i);"letter"===r.contentType&&o||"digit"===r.contentType&&s||"digit-with-letter"===r.contentType&&l?(f(),y({activeSection:r,newSectionValue:i,shouldGoToNextSection:!0})):o||s||(f(),x(i))}),$=(0,C4.Z)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="none"}),W=(0,C4.Z)(e=>{if(!k.current)return;let t=e.target,r=t.textContent??"",i=k.current.getSectionIndexFromDOMElement(t),o=g.sections[i];if(n||!k.current)return void E(i);if(0===r.length){if(""===o.value)return void E(i);let t=e.nativeEvent.inputType;return"insertParagraph"===t||"insertLineBreak"===t?void E(i):(f(),void v())}d({keyPressed:r,sectionIndex:i}),E(i)});(0,St.Z)(()=>{if(P&&k.current){if("all"===m)k.current.getRoot().focus();else if("number"==typeof m){let e=k.current.getSectionContent(m);e&&e.focus()}}},[m,P]);let _=D.useMemo(()=>g.sections.reduce((e,t)=>(e[t.type]=S[t.type]({currentDate:null,contentType:t.contentType,format:t.format}),e),{}),[S,g.sections]),q="all"===m,G=D.useMemo(()=>g.sections.map((e,r)=>{let i=!q&&!t&&!n;return{container:{"data-sectionindex":r,onClick:V(r)},content:{tabIndex:q||r>0?-1:0,contentEditable:!q&&!t&&!n,role:"spinbutton",id:`${R}-${e.type}`,"aria-labelledby":`${R}-${e.type}`,"aria-readonly":n,"aria-valuenow":((e,t)=>{if(e.value)switch(e.type){case"weekDay":if("letter"===e.contentType)return;return Number(e.value);case"meridiem":{let n=t.parse(`01:00 ${e.value}`,`${t.formats.hours12h}:${t.formats.minutes} ${e.format}`);if(n)return+(t.getHours(n)>=12);return}case"day":return"digit-with-letter"===e.contentType?parseInt(e.value,10):Number(e.value);case"month":{if("digit"===e.contentType)return Number(e.value);let n=t.parse(e.value,e.format);return n?t.getMonth(n)+1:void 0}default:return"letter"!==e.contentType?Number(e.value):void 0}})(e,A),"aria-valuemin":_[e.type].minimum,"aria-valuemax":_[e.type].maximum,"aria-valuetext":e.value?((e,t)=>{if(e.value)switch(e.type){case"month":{if("digit"===e.contentType)return t.format(t.setMonth(t.date(),Number(e.value)-1),"month");let n=t.parse(e.value,e.format);return n?t.format(n,"month"):void 0}case"day":return"digit"===e.contentType?t.format(t.setDate(t.startOfYear(t.date()),Number(e.value)),"dayOfMonthFull"):e.value;default:return}})(e,A):T.empty,"aria-label":T[e.type],"aria-disabled":t,spellCheck:!i&&void 0,autoCapitalize:i?"off":void 0,autoCorrect:i?"off":void 0,[parseInt(D.version,10)>=17?"enterKeyHint":"enterkeyhint"]:i?"next":void 0,children:e.value||e.placeholder,onInput:W,onPaste:z,onFocus:H(r),onDragOver:$,onMouseUp:N,inputMode:"letter"===e.contentType?"text":"numeric"},before:{children:e.startSeparator},after:{children:e.endSeparator}}}),[g.sections,H,z,$,W,V,N,t,n,q,T,A,_,R]),U=(0,C4.Z)(e=>{x(e.target.value)}),K=D.useMemo(()=>C?"":h.getV7HiddenInputValueFromSections(g.sections),[C,g.sections,h]);return D.useEffect(()=>{if(null==k.current)throw Error("MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`\nYou probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.\n\nIf you want to keep using an `<input />` HTML element for the editing, please remove the `enableAccessibleFieldDOMStructure` prop from your picker or field component:\n\n<DatePicker slots={{ textField: MyCustomTextField }} />\n\nLearn more about the field accessible DOM structure on the MUI documentation: https://mui.com/x/react-date-pickers/fields/#fields-to-edit-a-single-element");u&&k.current&&k.current.getSectionContent(w.startIndex).focus()},[]),{interactions:I,returnedValue:{autoFocus:u,readOnly:n,focused:c??P,sectionListRef:M,onBlur:F,onClick:Z,onFocus:B,onInput:L,onPaste:j,enableAccessibleFieldDOMStructure:!0,elements:G,tabIndex:0===m?-1:0,contentEditable:q,value:K,onChange:U,areAllSectionsEmpty:C}}},MG=e=>e.replace(/[\u2066\u2067\u2068\u2069]/g,""),MU=e=>{let t=(0,aC.V)(),n=D.useRef(void 0),r=D.useRef(void 0),{forwardedProps:{onFocus:i,onClick:o,onPaste:s,onBlur:l,inputRef:a,placeholder:c},internalProps:{readOnly:u=!1,disabled:h=!1},parsedSelectedSections:d,activeSectionIndex:f,state:p,fieldValueManager:m,valueManager:g,applyCharacterEditing:v,resetCharacterQuery:b,updateSectionValue:y,updateValueFromValueStr:x,clearActiveSection:w,clearValue:C,setTempAndroidValueStr:S,setSelectedSections:k,getSectionsFromValue:M,areAllSectionsEmpty:T,localizedDigits:A}=e,R=D.useRef(null),P=(0,ki.Z)(a,R),O=D.useMemo(()=>((e,t,n)=>{let r=0,i=+!!n,o=[];for(let s=0;s<e.length;s+=1){let l=e[s],a=SW(l,n?"input-rtl":"input-ltr",t),c=`${l.startSeparator}${a}${l.endSeparator}`,u=MG(c).length,h=c.length,d=MG(a),f=i+(""===d?0:a.indexOf(d[0]))+l.startSeparator.length,p=f+d.length;o.push((0,cu.Z)({},l,{start:r,end:r+u,startInInput:f,endInInput:p})),r+=u,i+=h}return o})(p.sections,A,t),[p.sections,A,t]),I=D.useMemo(()=>({syncSelectionToDOM:()=>{if(!R.current)return;if(null==d){R.current.scrollLeft&&(R.current.scrollLeft=0);return}if(R.current!==Mg(document))return;let e=R.current.scrollTop;if("all"===d)R.current.select();else{let e=O[d],t="empty"===e.type?e.startInInput-e.startSeparator.length:e.startInInput,n="empty"===e.type?e.endInInput+e.endSeparator.length:e.endInInput;(t!==R.current.selectionStart||n!==R.current.selectionEnd)&&R.current===Mg(document)&&R.current.setSelectionRange(t,n),clearTimeout(r.current),r.current=setTimeout(()=>{R.current&&R.current===Mg(document)&&R.current.selectionStart===R.current.selectionEnd&&(R.current.selectionStart!==t||R.current.selectionEnd!==n)&&I.syncSelectionToDOM()})}R.current.scrollTop=e},getActiveSectionIndexFromDOM:()=>{let e=R.current.selectionStart??0,t=R.current.selectionEnd??0;if(0===e&&0===t)return null;let n=e<=O[0].startInInput?1:O.findIndex(t=>t.startInInput-t.startSeparator.length>e);return -1===n?O.length-1:n-1},focusField:(e=0)=>{Mg(document)!==R.current&&(R.current?.focus(),k(e))},setSelectedSections:e=>k(e),isFieldFocused:()=>R.current===Mg(document)}),[R,d,O,k]),E=()=>{let e,t=R.current.selectionStart??0;k(-1===(e=t<=O[0].startInInput||t>=O[O.length-1].endInInput?1:O.findIndex(e=>e.startInInput-e.startSeparator.length>t))?O.length-1:e-1)},Z=(0,C4.Z)((...e)=>{i?.(...e);let t=R.current;clearTimeout(n.current),n.current=setTimeout(()=>{t&&t===R.current&&null==f&&(t.value.length&&Number(t.selectionEnd)-Number(t.selectionStart)===t.value.length?k("all"):E())})}),L=(0,C4.Z)((e,...t)=>{e.isDefaultPrevented()||(o?.(e,...t),E())}),j=(0,C4.Z)(e=>{if(s?.(e),e.preventDefault(),u||h)return;let t=e.clipboardData.getData("text");if("number"==typeof d){let e=p.sections[d],n=/^[a-zA-Z]+$/.test(t),r=/^[0-9]+$/.test(t),i=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(t);if("letter"===e.contentType&&n||"digit"===e.contentType&&r||"digit-with-letter"===e.contentType&&i){b(),y({activeSection:e,newSectionValue:t,shouldGoToNextSection:!0});return}if(n||r)return}b(),x(t)}),B=(0,C4.Z)((...e)=>{l?.(...e),k(null)}),F=(0,C4.Z)(e=>{let n;if(u)return;let r=e.target.value;if(""===r){b(),C();return}let i=e.nativeEvent.data,o=i&&i.length>1,s=o?i:r,l=MG(s);if("all"===d&&k(f),null==f||o)return void x(o?i:l);if("all"===d&&1===l.length)n=l;else{let e=MG(m.getV6InputValueFromSections(O,A,t)),r=-1,i=-1;for(let t=0;t<e.length;t+=1)-1===r&&e[t]!==l[t]&&(r=t),-1===i&&e[e.length-t-1]!==l[l.length-t-1]&&(i=t);let o=O[f];if(r<o.start||e.length-i-1>o.end)return;let s=l.length-e.length+o.end-MG(o.endSeparator||"").length;n=l.slice(o.start+MG(o.startSeparator||"").length,s)}if(0===n.length){navigator.userAgent.toLowerCase().includes("android")&&S(s),b(),w();return}v({keyPressed:n,sectionIndex:f})}),V=D.useMemo(()=>void 0!==c?c:m.getV6InputValueFromSections(M(g.emptyValue),A,t),[c,m,M,g.emptyValue,A,t]),N=D.useMemo(()=>p.tempValueStrAndroid??m.getV6InputValueFromSections(p.sections,A,t),[p.sections,m,p.tempValueStrAndroid,A,t]);D.useEffect(()=>(R.current&&R.current===Mg(document)&&k("all"),()=>{clearTimeout(n.current),clearTimeout(r.current)}),[]);let H=D.useMemo(()=>null==f||"letter"===p.sections[f].contentType?"text":"numeric",[f,p.sections]);return{interactions:I,returnedValue:{readOnly:u,onBlur:B,onClick:L,onFocus:Z,onPaste:j,inputRef:P,enableAccessibleFieldDOMStructure:!1,placeholder:V,inputMode:H,autoComplete:"off",value:!(R.current&&R.current===Mg(document))&&T?"":N,onChange:F}}},MK=["disablePast","disableFuture","minDate","maxDate","shouldDisableDate","shouldDisableMonth","shouldDisableYear"],MY=["disablePast","disableFuture","minTime","maxTime","shouldDisableTime","minutesStep","ampm","disableIgnoringDatePartForTimeValidation"],MX=["minDateTime","maxDateTime"];[...MK,...MY,...MX];let MQ=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"];var MJ=n(76992);let M0=["clearable","onClear","InputProps","sx","slots","slotProps"],M1=["ownerState"];var M2=n(68808),M5=n(32931);function M3(e){return(0,V.ZP)("MuiPickersTextField",e)}(0,F.Z)("MuiPickersTextField",["root","focused","disabled","error","required"]);var M8=n(36683);function M4(e){return(0,V.ZP)("MuiPickersInputBase",e)}let M6=(0,F.Z)("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function M9(e){return(0,V.ZP)("MuiPickersOutlinedInput",e)}let M7=(0,cu.Z)({},M6,(0,F.Z)("MuiPickersOutlinedInput",["root","notchedOutline","input"])),Te=["children","className","label","notched","shrink"],Tt=(0,Z.ZP)("fieldset",{name:"MuiPickersOutlinedInput",slot:"NotchedOutline",overridesResolver:(e,t)=>t.notchedOutline})(({theme:e})=>{let t="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%",borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}}),Tn=(0,Z.ZP)("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),Tr=(0,Z.ZP)("legend")(({theme:e})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:{withLabel:!1},style:{padding:0,lineHeight:"11px",transition:e.transitions.create("width",{duration:150,easing:e.transitions.easing.easeOut})}},{props:{withLabel:!0},style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:e.transitions.create("max-width",{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:{withLabel:!0,notched:!0},style:{maxWidth:"100%",transition:e.transitions.create("max-width",{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]}));function Ti(e){let{className:t,label:n}=e,r=(0,ch.Z)(e,Te),i=null!=n&&""!==n,o=(0,cu.Z)({},e,{withLabel:i});return(0,T.jsx)(Tt,(0,cu.Z)({"aria-hidden":!0,className:t},r,{ownerState:o,children:(0,T.jsx)(Tr,{ownerState:o,children:i?(0,T.jsx)(Tn,{children:n}):(0,T.jsx)(Tn,{className:"notranslate",children:"​"})})}))}var To=n(3150);function Ts(e){return(0,V.ZP)("MuiPickersSectionList",e)}let Tl=(0,F.Z)("MuiPickersSectionList",["root","section","sectionContent"]),Ta=["slots","slotProps","elements","sectionListRef"],Tc=(0,Z.ZP)("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(e,t)=>t.root})({direction:"ltr /*! @noflip */",outline:"none"}),Tu=(0,Z.ZP)("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(e,t)=>t.section})({}),Th=(0,Z.ZP)("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(e,t)=>t.sectionSeparator})({whiteSpace:"pre"}),Td=(0,Z.ZP)("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(e,t)=>t.sectionContent})({outline:"none"});function Tf(e){let{slots:t,slotProps:n,element:r,classes:i}=e,o=t?.section??Tu,s=(0,CX.Z)({elementType:o,externalSlotProps:n?.section,externalForwardedProps:r.container,className:i.section,ownerState:{}}),l=t?.sectionContent??Td,a=(0,CX.Z)({elementType:l,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:i.sectionContent,ownerState:{}}),c=t?.sectionSeparator??Th,u=(0,CX.Z)({elementType:c,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:{position:"before"}}),h=(0,CX.Z)({elementType:c,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.after,ownerState:{position:"after"}});return(0,T.jsxs)(o,(0,cu.Z)({},s,{children:[(0,T.jsx)(c,(0,cu.Z)({},u)),(0,T.jsx)(l,(0,cu.Z)({},a)),(0,T.jsx)(c,(0,cu.Z)({},h))]}))}let Tp=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiPickersSectionList"}),{slots:r,slotProps:i,elements:o,sectionListRef:s}=n,l=(0,ch.Z)(n,Ta),a=(e=>{let{classes:t}=e;return(0,P.Z)({root:["root"],section:["section"],sectionContent:["sectionContent"]},Ts,t)})(n),c=D.useRef(null),u=(0,ki.Z)(t,c),h=e=>{if(!c.current)throw Error(`MUI X: Cannot call sectionListRef.${e} before the mount of the component.`);return c.current};D.useImperativeHandle(s,()=>({getRoot:()=>h("getRoot"),getSectionContainer:e=>h("getSectionContainer").querySelector(`.${Tl.section}[data-sectionindex="${e}"]`),getSectionContent:e=>h("getSectionContent").querySelector(`.${Tl.section}[data-sectionindex="${e}"] .${Tl.sectionContent}`),getSectionIndexFromDOMElement(e){let t=h("getSectionIndexFromDOMElement");if(null==e||!t.contains(e))return null;let n=null;return(e.classList.contains(Tl.section)?n=e:e.classList.contains(Tl.sectionContent)&&(n=e.parentElement),null==n)?null:Number(n.dataset.sectionindex)}}));let d=r?.root??Tc,f=(0,CX.Z)({elementType:d,externalSlotProps:i?.root,externalForwardedProps:l,additionalProps:{ref:u,suppressContentEditableWarning:!0},className:a.root,ownerState:{}});return(0,T.jsx)(d,(0,cu.Z)({},f,{children:f.contentEditable?o.map(({content:e,before:t,after:n})=>`${t.children}${e.children}${n.children}`).join(""):(0,T.jsx)(D.Fragment,{children:o.map((e,t)=>(0,T.jsx)(Tf,{slots:r,slotProps:i,element:e,classes:a},t))})}))}),Tm=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef"],Tg=(0,Z.ZP)("div",{name:"MuiPickersInputBase",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>(0,cu.Z)({},e.typography.body1,{color:(e.vars||e).palette.text.primary,cursor:"text",padding:0,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",boxSizing:"border-box",letterSpacing:`${Math.round(.15/16*1e5)/1e5}em`,variants:[{props:{fullWidth:!0},style:{width:"100%"}}]})),Tv=(0,Z.ZP)(Tc,{name:"MuiPickersInputBase",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})(({theme:e})=>({padding:"4px 0 5px",fontFamily:e.typography.fontFamily,fontSize:"inherit",lineHeight:"1.4375em",flexGrow:1,outline:"none",display:"flex",flexWrap:"nowrap",overflow:"hidden",letterSpacing:"inherit",width:"182px",variants:[{props:{isRtl:!0},style:{textAlign:"right /*! @noflip */"}},{props:{size:"small"},style:{paddingTop:1}},{props:{adornedStart:!1,focused:!1,filled:!1},style:{color:"currentColor",opacity:0}},{props:({adornedStart:e,focused:t,filled:n,label:r})=>!e&&!t&&!n&&null==r,style:e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:"light"===e.palette.mode?.42:.5}}]})),Tb=(0,Z.ZP)(Tu,{name:"MuiPickersInputBase",slot:"Section",overridesResolver:(e,t)=>t.section})(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit",letterSpacing:"inherit",lineHeight:"1.4375em",display:"inline-block",whiteSpace:"nowrap"})),Ty=(0,Z.ZP)(Td,{name:"MuiPickersInputBase",slot:"SectionContent",overridesResolver:(e,t)=>t.content})(({theme:e})=>({fontFamily:e.typography.fontFamily,lineHeight:"1.4375em",letterSpacing:"inherit",width:"fit-content",outline:"none"})),Tx=(0,Z.ZP)(Th,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(e,t)=>t.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),Tw=(0,Z.ZP)("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(e,t)=>t.hiddenInput})((0,cu.Z)({},{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"})),TC=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiPickersInputBase"}),{elements:r,areAllSectionsEmpty:i,value:o,onChange:s,id:l,endAdornment:a,startAdornment:c,renderSuffix:u,slots:h,slotProps:d,contentEditable:f,tabIndex:p,onInput:m,onPaste:g,onKeyDown:v,name:b,readOnly:y,inputProps:x,inputRef:w,sectionListRef:C}=n,S=(0,ch.Z)(n,Tm),k=D.useRef(null),M=(0,ki.Z)(t,k),A=(0,ki.Z)(x?.ref,w),R=(0,aC.V)(),O=(0,M8.Z)();if(!O)throw Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");D.useEffect(()=>{O&&O.setAdornedStart(!!c)},[O,c]),D.useEffect(()=>{O&&(i?O.onEmpty():O.onFilled())},[O,i]);let I=(0,cu.Z)({},n,O,{isRtl:R}),E=(e=>{let{focused:t,disabled:n,error:r,classes:i,fullWidth:o,readOnly:s,color:l,size:a,endAdornment:c,startAdornment:u}=e,h={root:["root",t&&!n&&"focused",n&&"disabled",s&&"readOnly",r&&"error",o&&"fullWidth",`color${(0,To.Z)(l)}`,"small"===a&&"inputSizeSmall",!!u&&"adornedStart",!!c&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return(0,P.Z)(h,M4,i)})(I),Z=h?.root||Tg,L=(0,CX.Z)({elementType:Z,externalSlotProps:d?.root,externalForwardedProps:S,additionalProps:{"aria-invalid":O.error,ref:M},className:E.root,ownerState:I}),j=h?.input||Tv;return(0,T.jsxs)(Z,(0,cu.Z)({},L,{children:[c,(0,T.jsx)(Tp,{sectionListRef:C,elements:r,contentEditable:f,tabIndex:p,className:E.sectionsContainer,onFocus:e=>{if(O.disabled)return void e.stopPropagation();O.onFocus?.(e)},onBlur:O.onBlur,onInput:m,onPaste:g,onKeyDown:v,slots:{root:j,section:Tb,sectionContent:Ty,sectionSeparator:Tx},slotProps:{root:{ownerState:I},sectionContent:{className:M6.sectionContent},sectionSeparator:({position:e})=>({className:"before"===e?M6.sectionBefore:M6.sectionAfter})}}),a,u?u((0,cu.Z)({},O)):null,(0,T.jsx)(Tw,(0,cu.Z)({name:b,className:E.input,value:o,onChange:s,id:l,"aria-hidden":"true",tabIndex:-1,readOnly:y,required:O.required,disabled:O.disabled},x,{ref:A}))]}))}),TS=["label","autoFocus","ownerState","notched"],Tk=(0,Z.ZP)(Tg,{name:"MuiPickersOutlinedInput",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>{let t="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{padding:"0 14px",borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${M7.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${M7.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${M7.focused} .${M7.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${M7.disabled}`]:{[`& .${M7.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${M7.error} .${M7.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},variants:Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t]?.main??!1).map(t=>({props:{color:t},style:{[`&.${M7.focused}:not(.${M7.error}) .${M7.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}}))}}),TM=(0,Z.ZP)(Tv,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({padding:"16.5px 0",variants:[{props:{size:"small"},style:{padding:"8.5px 0"}}]}),TT=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiPickersOutlinedInput"}),{label:r,ownerState:i,notched:o}=n,s=(0,ch.Z)(n,TS),l=(0,M8.Z)(),a=(0,cu.Z)({},n,i,l,{color:l?.color||"primary"}),c=(e=>{let{classes:t}=e,n=(0,P.Z)({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},M9,t);return(0,cu.Z)({},t,n)})(a);return(0,T.jsx)(TC,(0,cu.Z)({slots:{root:Tk,input:TM},renderSuffix:e=>(0,T.jsx)(Ti,{shrink:!!(o||e.adornedStart||e.focused||e.filled),notched:!!(o||e.adornedStart||e.focused||e.filled),className:c.notchedOutline,label:null!=r&&""!==r&&l?.required?(0,T.jsxs)(D.Fragment,{children:[r," ","*"]}):r,ownerState:a})},s,{label:r,classes:c,ref:t}))});TT.muiName="Input";var TD=n(35315);function TA(e){return(0,V.ZP)("MuiPickersFilledInput",e)}let TR=(0,cu.Z)({},M6,(0,F.Z)("MuiPickersFilledInput",["root","underline","input"])),TP=["label","autoFocus","disableUnderline","ownerState"],TO=(0,Z.ZP)(Tg,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>(0,TD.x9)(e)&&"disableUnderline"!==e})(({theme:e})=>{let t="light"===e.palette.mode,n=t?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)";return{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:t?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)","@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n}},[`&.${TR.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n},[`&.${TR.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:t?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)"},variants:[...Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t].main).map(t=>({props:{color:t,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t]?.main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${TR.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${TR.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`:t?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)"}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${TR.disabled}, .${TR.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${TR.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:({startAdornment:e})=>!!e,style:{paddingLeft:12}},{props:({endAdornment:e})=>!!e,style:{paddingRight:12}}]}}),TI=(0,Z.ZP)(Tv,{name:"MuiPickersFilledInput",slot:"sectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,variants:[{props:{size:"small"},style:{paddingTop:21,paddingBottom:4}},{props:({startAdornment:e})=>!!e,style:{paddingLeft:0}},{props:({endAdornment:e})=>!!e,style:{paddingRight:0}},{props:{hiddenLabel:!0},style:{paddingTop:16,paddingBottom:17}},{props:{hiddenLabel:!0,size:"small"},style:{paddingTop:8,paddingBottom:9}}]}),TE=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiPickersFilledInput"}),{label:r,disableUnderline:i=!1,ownerState:o}=n,s=(0,ch.Z)(n,TP),l=(0,M8.Z)(),a=(e=>{let{classes:t,disableUnderline:n}=e,r=(0,P.Z)({root:["root",!n&&"underline"],input:["input"]},TA,t);return(0,cu.Z)({},t,r)})((0,cu.Z)({},n,o,l,{color:l?.color||"primary"}));return(0,T.jsx)(TC,(0,cu.Z)({slots:{root:TO,input:TI},slotProps:{root:{disableUnderline:i}}},s,{label:r,classes:a,ref:t}))});function TZ(e){return(0,V.ZP)("MuiPickersFilledInput",e)}TE.muiName="Input";let TL=(0,cu.Z)({},M6,(0,F.Z)("MuiPickersInput",["root","input"])),Tj=["label","autoFocus","disableUnderline","ownerState"],TB=(0,Z.ZP)(Tg,{name:"MuiPickersInput",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>{let t="light"===e.palette.mode?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(t=`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`),{"label + &":{marginTop:16},variants:[...Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t].main).map(t=>({props:{color:t},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t].main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{background:"red",left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${TL.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${TL.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${TL.disabled}, .${TL.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${TL.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),TF=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiPickersInput"}),{label:r,disableUnderline:i=!1,ownerState:o}=n,s=(0,ch.Z)(n,Tj),l=(0,M8.Z)(),a=(e=>{let{classes:t,disableUnderline:n}=e,r=(0,P.Z)({root:["root",!n&&"underline"],input:["input"]},TZ,t);return(0,cu.Z)({},t,r)})((0,cu.Z)({},n,o,l,{disableUnderline:i,color:l?.color||"primary"}));return(0,T.jsx)(TC,(0,cu.Z)({slots:{root:TB}},s,{label:r,classes:a,ref:t}))});TF.muiName="Input";let TV=["onFocus","onBlur","className","color","disabled","error","variant","required","InputProps","inputProps","inputRef","sectionListRef","elements","areAllSectionsEmpty","onClick","onKeyDown","onKeyUp","onPaste","onInput","endAdornment","startAdornment","tabIndex","contentEditable","focused","value","onChange","fullWidth","id","name","helperText","FormHelperTextProps","label","InputLabelProps"],TN={standard:TF,filled:TE,outlined:TT},TH=(0,Z.ZP)(lc.Z,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({}),Tz=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiPickersTextField"}),{onFocus:r,onBlur:i,className:o,color:s="primary",disabled:l=!1,error:a=!1,variant:c="outlined",required:u=!1,InputProps:h,inputProps:d,inputRef:f,sectionListRef:p,elements:m,areAllSectionsEmpty:g,onClick:v,onKeyDown:b,onKeyUp:y,onPaste:x,onInput:w,endAdornment:C,startAdornment:S,tabIndex:k,contentEditable:M,focused:A,value:O,onChange:I,fullWidth:E,id:Z,name:L,helperText:j,FormHelperTextProps:B,label:F,InputLabelProps:V}=n,N=(0,ch.Z)(n,TV),H=D.useRef(null),z=(0,ki.Z)(t,H),$=(0,CY.Z)(Z),W=j&&$?`${$}-helper-text`:void 0,_=F&&$?`${$}-label`:void 0,q=(0,cu.Z)({},n,{color:s,disabled:l,error:a,focused:A,required:u,variant:c}),G=(e=>{let{focused:t,disabled:n,classes:r,required:i}=e;return(0,P.Z)({root:["root",t&&!n&&"focused",n&&"disabled",i&&"required"]},M3,r)})(q),U=TN[c];return(0,T.jsxs)(TH,(0,cu.Z)({className:(0,R.Z)(G.root,o),ref:z,focused:A,onFocus:r,onBlur:i,disabled:l,variant:c,error:a,color:s,fullWidth:E,required:u,ownerState:q},N,{children:[(0,T.jsx)(M2.Z,(0,cu.Z)({htmlFor:$,id:_},V,{children:F})),(0,T.jsx)(U,(0,cu.Z)({elements:m,areAllSectionsEmpty:g,onClick:v,onKeyDown:b,onKeyUp:y,onInput:w,onPaste:x,endAdornment:C,startAdornment:S,tabIndex:k,contentEditable:M,value:O,onChange:I,id:$,fullWidth:E,inputProps:d,inputRef:f,sectionListRef:p,label:F,name:L,role:"group","aria-labelledby":_,"aria-describedby":W,"aria-live":W?"polite":void 0},h)),j&&(0,T.jsx)(M5.Z,(0,cu.Z)({id:W},B,{children:j}))]}))}),T$=["enableAccessibleFieldDOMStructure"],TW=["InputProps","readOnly"],T_=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef"],Tq=["slots","slotProps","InputProps","inputProps"],TG=D.forwardRef(function(e,t){let n=(0,wQ.Z)({props:e,name:"MuiDateTimeField"}),{slots:r,slotProps:i,InputProps:o,inputProps:s}=n,l=(0,ch.Z)(n,Tq),a=r?.textField??(e.enableAccessibleFieldDOMStructure?Tz:Y.Z),c=(0,CX.Z)({elementType:a,externalSlotProps:i?.textField,externalForwardedProps:l,ownerState:n,additionalProps:{ref:t}});c.inputProps=(0,cu.Z)({},s,c.inputProps),c.InputProps=(0,cu.Z)({},o,c.InputProps);let u=(e=>{let{enableAccessibleFieldDOMStructure:t}=e,n=(0,ch.Z)(e,T$);if(t){let{InputProps:e,readOnly:t}=n,r=(0,ch.Z)(n,TW);return(0,cu.Z)({},r,{InputProps:(0,cu.Z)({},e??{},{readOnly:t})})}let{onPaste:r,onKeyDown:i,inputMode:o,readOnly:s,InputProps:l,inputProps:a,inputRef:c}=n,u=(0,ch.Z)(n,T_);return(0,cu.Z)({},u,{InputProps:(0,cu.Z)({},l??{},{readOnly:s}),inputProps:(0,cu.Z)({},a??{},{inputMode:o,onPaste:r,onKeyDown:i,ref:c})})})((e=>{let t,n,{forwardedProps:r,internalProps:i}=(t=(e=>{let t=w4(),n=w6(),r=e.ampm??t.is12HourCycleInCurrentLocale()?t.formats.keyboardDateTime12h:t.formats.keyboardDateTime24h;return(0,cu.Z)({},e,{disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,format:e.format??r,disableIgnoringDatePartForTimeValidation:!!(e.minDateTime||e.maxDateTime),minDate:Ct(t,e.minDateTime??e.minDate,n.minDate),maxDate:Ct(t,e.maxDateTime??e.maxDate,n.maxDate),minTime:e.minDateTime??e.minTime,maxTime:e.maxDateTime??e.maxTime})})(e),n="date-time",D.useMemo(()=>{let e=(0,cu.Z)({},t),n={},r=t=>{e.hasOwnProperty(t)&&(n[t]=e[t],delete e[t])};return MQ.forEach(r),MK.forEach(r),MY.forEach(r),MX.forEach(r),{forwardedProps:e,internalProps:n}},[t,n]));return(e=>{let t=w4(),{internalProps:n,internalProps:{unstableFieldRef:r,minutesStep:i,enableAccessibleFieldDOMStructure:o=!1,disabled:s=!1,readOnly:l=!1},forwardedProps:{onKeyDown:a,error:c,clearable:u,onClear:h},fieldValueManager:d,valueManager:f,validator:p}=e,m=(0,aC.V)(),g=(e=>{let t=w4(),n=Cg(),r=w8(),i=(0,aC.V)(),{valueManager:o,fieldValueManager:s,valueType:l,validator:a,internalProps:c,internalProps:{value:u,defaultValue:h,referenceDate:d,onChange:f,format:p,formatDensity:m="dense",selectedSections:g,onSelectedSectionsChange:v,shouldRespectLeadingZeros:b=!1,timezone:y,enableAccessibleFieldDOMStructure:x=!1}}=e,{timezone:w,value:C,handleValueChange:S}=SO({timezone:y,value:u,defaultValue:h,referenceDate:d,onChange:f,valueManager:o}),k=D.useMemo(()=>(e=>{let t=e.date(void 0);return"0"===e.formatByString(e.setSeconds(t,0),"s")?SF:Array.from({length:10}).map((n,r)=>e.formatByString(e.setSeconds(t,r),"s"))})(t),[t]),M=D.useMemo(()=>((e,t,n)=>{let r=e.date(void 0,n),i=e.endOfYear(r),o=e.endOfDay(r),{maxDaysInMonth:s,longestMonth:l}=Cn(e,r).reduce((t,n)=>{let r=e.getDaysInMonth(n);return r>t.maxDaysInMonth?{maxDaysInMonth:r,longestMonth:n}:t},{maxDaysInMonth:0,longestMonth:null});return{year:({format:t})=>({minimum:0,maximum:Sq(e,t)?9999:99}),month:()=>({minimum:1,maximum:e.getMonth(i)+1}),day:({currentDate:t})=>({minimum:1,maximum:null!=t&&e.isValid(t)?e.getDaysInMonth(t):s,longestMonth:l}),weekDay:({format:t,contentType:n})=>{if("digit"===n){let n=Sj(e,t).map(Number);return{minimum:Math.min(...n),maximum:Math.max(...n)}}return{minimum:1,maximum:7}},hours:({format:n})=>{let i=e.getHours(o);return SV(e.formatByString(e.endOfDay(r),n),t)!==i.toString()?{minimum:1,maximum:Number(SV(e.formatByString(e.startOfDay(r),n),t))}:{minimum:0,maximum:i}},minutes:()=>({minimum:0,maximum:e.getMinutes(o)}),seconds:()=>({minimum:0,maximum:e.getSeconds(o)}),meridiem:()=>({minimum:0,maximum:1}),empty:()=>({minimum:0,maximum:0})}})(t,k,w),[t,k,w]),T=D.useCallback((e,r=null)=>s.getSectionsFromValue(t,e,r,e=>M_({utils:t,localeText:n,localizedDigits:k,format:p,date:e,formatDensity:m,shouldRespectLeadingZeros:b,enableAccessibleFieldDOMStructure:x,isRtl:i})),[s,p,n,k,i,b,t,m,x]),[A,R]=D.useState(()=>{let e=T(C);SU(e,l);let n={sections:e,value:C,referenceValue:o.emptyValue,tempValueStrAndroid:null},r=Math.max(...e.map(e=>SE[e.type]??1)),i=o.getInitialReferenceValue({referenceDate:d,value:C,utils:t,props:c,granularity:r,timezone:w});return(0,cu.Z)({},n,{referenceValue:i})}),[P,O]=(0,C6.Z)({controlled:g,default:null,name:"useField",state:"selectedSections"}),I=e=>{O(e),v?.(e)},E=D.useMemo(()=>SX(P,A.sections),[P,A.sections]),Z="all"===E?0:E,L=({value:e,referenceValue:n,sections:i})=>{if(R(t=>(0,cu.Z)({},t,{sections:i,value:e,referenceValue:n,tempValueStrAndroid:null})),o.areValuesEqual(t,A.value,e))return;let s={validationError:a({adapter:r,value:e,timezone:w,props:c})};S(e,s)},j=(e,t)=>{let n=[...A.sections];return n[e]=(0,cu.Z)({},n[e],{value:t,modified:!0}),n};return D.useEffect(()=>{let e=T(A.value);SU(e,l),R(t=>(0,cu.Z)({},t,{sections:e}))},[p,t.locale,i]),D.useEffect(()=>{o.areValuesEqual(t,A.value,C)&&o.getTimezone(t,A.value)===o.getTimezone(t,C)||R(e=>(0,cu.Z)({},e,{value:C,referenceValue:s.updateReferenceValue(t,C,e.referenceValue),sections:T(C)}))},[C]),{state:A,activeSectionIndex:Z,parsedSelectedSections:E,setSelectedSections:I,clearValue:()=>{L({value:o.emptyValue,referenceValue:A.referenceValue,sections:T(o.emptyValue)})},clearActiveSection:()=>{if(null==Z)return;let e=A.sections[Z],n=s.getActiveDateManager(t,A,e),r=n.getSections(A.sections).filter(e=>""!==e.value).length===+(""!==e.value),i=j(Z,""),o=r?null:t.getInvalidDate(),l=n.getNewValuesFromNewActiveDate(o);L((0,cu.Z)({},l,{sections:i}))},updateSectionValue:({activeSection:e,newSectionValue:n,shouldGoToNextSection:r})=>{let i,o;r&&Z<A.sections.length-1&&I(Z+1);let l=s.getActiveDateManager(t,A,e),a=j(Z,n),c=l.getSections(a),u=((e,t,n)=>{let r=t.some(e=>"day"===e.type),i=[],o=[];for(let e=0;e<t.length;e+=1){let s=t[e];r&&"weekDay"===s.type||(i.push(s.format),o.push(SW(s,"non-input",n)))}let s=i.join(" "),l=o.join(" ");return e.parse(l,s)})(t,c,k);if(null!=u&&t.isValid(u)){let e=SY(t,u,c,l.referenceDate,!0);i=l.getNewValuesFromNewActiveDate(e),o=!0}else i=l.getNewValuesFromNewActiveDate(u),o=(null!=u&&!t.isValid(u))!=(null!=l.date&&!t.isValid(l.date));return o?L((0,cu.Z)({},i,{sections:a})):R(e=>(0,cu.Z)({},e,i,{sections:a,tempValueStrAndroid:null}))},updateValueFromValueStr:e=>{let r=s.parseValueStr(e,A.referenceValue,(e,r)=>{let o=t.parse(e,p);if(null==o||!t.isValid(o))return null;let s=M_({utils:t,localeText:n,localizedDigits:k,format:p,date:o,formatDensity:m,shouldRespectLeadingZeros:b,enableAccessibleFieldDOMStructure:x,isRtl:i});return SY(t,o,s,r,!1)}),o=s.updateReferenceValue(t,r,A.referenceValue);L({value:r,referenceValue:o,sections:T(r,A.sections)})},setTempAndroidValueStr:e=>R(t=>(0,cu.Z)({},t,{tempValueStrAndroid:e})),getSectionsFromValue:T,sectionsValueBoundaries:M,localizedDigits:k,timezone:w}})(e),{state:v,activeSectionIndex:b,parsedSelectedSections:y,setSelectedSections:x,clearValue:w,clearActiveSection:C,updateSectionValue:S,setTempAndroidValueStr:k,sectionsValueBoundaries:M,localizedDigits:T,timezone:A}=g,R=(({sections:e,updateSectionValue:t,sectionsValueBoundaries:n,localizedDigits:r,setTempAndroidValueStr:i,timezone:o})=>{let s=w4(),[l,a]=D.useState(null),c=(0,C4.Z)(()=>a(null));D.useEffect(()=>{null!=l&&e[l.sectionIndex]?.type!==l.sectionType&&c()},[e,l,c]),D.useEffect(()=>{if(null!=l){let e=setTimeout(()=>c(),5e3);return()=>{clearTimeout(e)}}return()=>{}},[l,c]);let u=({keyPressed:t,sectionIndex:n},r,i)=>{let o=t.toLowerCase(),s=e[n];if(null!=l&&(!i||i(l.value))&&l.sectionIndex===n){let e=`${l.value}${o}`,t=r(e,s);if(null==t.saveQuery)return a({sectionIndex:n,value:e,sectionType:s.type}),t}let u=r(o,s);return null==u.saveQuery||u.saveQuery?(a({sectionIndex:n,value:o,sectionType:s.type}),null!=u.saveQuery?null:u):(c(),null)};return{applyCharacterEditing:(0,C4.Z)(l=>{let a=e[l.sectionIndex],c=SH(l.keyPressed,r)?(e=>{let t=(e,t)=>{let i=SV(e,r),o=Number(i),l=n[t.type]({currentDate:null,format:t.format,contentType:t.contentType});if(o>l.maximum)return{saveQuery:!1};if(o<l.minimum)return{saveQuery:!0};let a=10*o>l.maximum||i.length===l.maximum.toString().length;return{sectionValue:S$(s,o,l,r,t),shouldGoToNextSection:a}};return u(e,(e,n)=>{if("digit"===n.contentType||"digit-with-letter"===n.contentType)return t(e,n);if("month"===n.type){let r=SG(s,"digit","month","MM"),i=t(e,{type:n.type,format:"MM",hasLeadingZerosInFormat:r,hasLeadingZerosInInput:!0,contentType:"digit",maxLength:2});if(null!=i.saveQuery)return i;let o=S_(s,i.sectionValue,"MM",n.format);return(0,cu.Z)({},i,{sectionValue:o})}if("weekDay"===n.type){let r=t(e,n);if(null!=r.saveQuery)return r;let i=Sj(s,n.format)[Number(r.sectionValue)-1];return(0,cu.Z)({},r,{sectionValue:i})}return{saveQuery:!1}},e=>SH(e,r))})((0,cu.Z)({},l,{keyPressed:SN(l.keyPressed,r)})):(e=>{let t=(e,t,n)=>{let r=t.filter(e=>e.toLowerCase().startsWith(n));return 0===r.length?{saveQuery:!1}:{sectionValue:r[0],shouldGoToNextSection:1===r.length}},n=(e,n,r,i)=>{let l=e=>SB(s,o,n.type,e);if("letter"===n.contentType)return t(n.format,l(n.format),e);if(r&&null!=i&&"letter"===SL(s,r).contentType){let n=l(r),o=t(r,n,e);return null!=o.saveQuery?{saveQuery:!1}:(0,cu.Z)({},o,{sectionValue:i(o.sectionValue,n)})}return{saveQuery:!1}};return u(e,(e,t)=>{switch(t.type){case"month":return n(e,t,s.formats.month,e=>S_(s,e,s.formats.month,t.format));case"weekDay":return n(e,t,s.formats.weekday,(e,t)=>t.indexOf(e).toString());case"meridiem":return n(e,t);default:return{saveQuery:!1}}})})(l);if(null==c)return void i(null);t({activeSection:a,newSectionValue:c.sectionValue,shouldGoToNextSection:c.shouldGoToNextSection})}),resetCharacterQuery:c}})({sections:v.sections,updateSectionValue:S,sectionsValueBoundaries:M,localizedDigits:T,setTempAndroidValueStr:k,timezone:A}),{resetCharacterQuery:P}=R,O=f.areValuesEqual(t,v.value,f.emptyValue),I=o?Mq:MU,E=D.useMemo(()=>((e,t)=>{let n={};if(!t)return e.forEach((t,r)=>{let i=r===e.length-1?null:r+1;n[r]={leftIndex:0===r?null:r-1,rightIndex:i}}),{neighbors:n,startIndex:0,endIndex:e.length-1};let r={},i={},o=0,s=0,l=e.length-1;for(;l>=0;){-1===(s=e.findIndex((e,t)=>t>=o&&e.endSeparator?.includes(" ")&&" / "!==e.endSeparator))&&(s=e.length-1);for(let e=s;e>=o;e-=1)i[e]=l,r[l]=e,l-=1;o=s+1}return e.forEach((t,o)=>{let s=i[o],l=0===s?null:r[s-1],a=s===e.length-1?null:r[s+1];n[o]={leftIndex:l,rightIndex:a}}),{neighbors:n,startIndex:r[0],endIndex:r[e.length-1]}})(v.sections,m&&!o),[v.sections,m,o]),{returnedValue:Z,interactions:L}=I((0,cu.Z)({},e,g,R,{areAllSectionsEmpty:O,sectionOrder:E})),j=(0,C4.Z)(e=>{if(a?.(e),!s)switch(!0){case(e.ctrlKey||e.metaKey)&&"A"===String.fromCharCode(e.keyCode)&&!e.shiftKey&&!e.altKey:e.preventDefault(),x("all");break;case"ArrowRight"===e.key:if(e.preventDefault(),null==y)x(E.startIndex);else if("all"===y)x(E.endIndex);else{let e=E.neighbors[y].rightIndex;null!==e&&x(e)}break;case"ArrowLeft"===e.key:if(e.preventDefault(),null==y)x(E.endIndex);else if("all"===y)x(E.startIndex);else{let e=E.neighbors[y].leftIndex;null!==e&&x(e)}break;case"Delete"===e.key:if(e.preventDefault(),l)break;null==y||"all"===y?w():C(),P();break;case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key):{if(e.preventDefault(),l||null==b)break;"all"===y&&x(b);let n=v.sections[b],r=d.getActiveDateManager(t,v,n),o=((e,t,n,r,i,o,s,l)=>{let a=(e=>{switch(e){case"ArrowUp":return 1;case"ArrowDown":return -1;case"PageUp":return 5;case"PageDown":return -5;default:return 0}})(r),c="Home"===r,u="End"===r,h=""===n.value||c||u;if("digit"===n.contentType||"digit-with-letter"===n.contentType){let r=i[n.type]({currentDate:s,format:n.format,contentType:n.contentType}),d=t=>S$(e,t,r,o,n),f="minutes"===n.type&&l?.minutesStep?l.minutesStep:1,p=parseInt(SV(n.value,o),10)+a*f;if(h){if("year"===n.type&&!u&&!c)return e.formatByString(e.date(void 0,t),n.format);p=a>0||c?r.minimum:r.maximum}return d((p%f!=0&&((a<0||c)&&(p+=f-(f+p)%f),(a>0||u)&&(p-=p%f)),p>r.maximum)?r.minimum+(p-r.maximum-1)%(r.maximum-r.minimum+1):p<r.minimum?r.maximum-(r.minimum-p-1)%(r.maximum-r.minimum+1):p)}let d=SB(e,t,n.type,n.format);if(0===d.length)return n.value;if(h)return a>0||c?d[0]:d[d.length-1];let f=((d.indexOf(n.value)+a)%d.length+d.length)%d.length;return d[f]})(t,A,n,e.key,M,T,r.date,{minutesStep:i});S({activeSection:n,newSectionValue:o,shouldGoToNextSection:!1})}}});(0,St.Z)(()=>{L.syncSelectionToDOM()});let{hasValidationError:B}=Mp({props:n,validator:p,timezone:A,value:v.value,onError:n.onError}),F=D.useMemo(()=>void 0!==c?c:B,[B,c]);D.useEffect(()=>{F||null!=b||P()},[v.referenceValue,b,F]),D.useEffect(()=>{null!=v.tempValueStrAndroid&&null!=b&&(P(),C())},[v.sections]),D.useImperativeHandle(r,()=>({getSections:()=>v.sections,getActiveSectionIndex:L.getActiveSectionIndexFromDOM,setSelectedSections:L.setSelectedSections,focusField:L.focusField,isFieldFocused:L.isFieldFocused}));let V={onKeyDown:j,onClear:(0,C4.Z)((e,...t)=>{e.preventDefault(),h?.(e,...t),w(),L.isFieldFocused()?x(E.startIndex):L.focusField(0)}),error:F,clearable:!!(u&&!O&&!l&&!s)};return(0,cu.Z)({},e.forwardedProps,V,{disabled:s,readOnly:l},Z)})({forwardedProps:r,internalProps:i,valueManager:SJ,fieldValueManager:S0,validator:Mz,valueType:"date-time"})})(c)),h=(e=>{let t=Cg(),{clearable:n,onClear:r,InputProps:i,sx:o,slots:s,slotProps:l}=e,a=(0,ch.Z)(e,M0),c=s?.clearButton??K.Z,u=(0,CX.Z)({elementType:c,externalSlotProps:l?.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:t.fieldClearLabel}}),h=(0,ch.Z)(u,M1),d=s?.clearIcon??Cm,f=(0,CX.Z)({elementType:d,externalSlotProps:l?.clearIcon,ownerState:{}});return(0,cu.Z)({},a,{InputProps:(0,cu.Z)({},i,{endAdornment:(0,T.jsxs)(D.Fragment,{children:[n&&(0,T.jsx)(MJ.Z,{position:"end",sx:{marginRight:i?.endAdornment?-1:-1.5},children:(0,T.jsx)(c,(0,cu.Z)({},h,{onClick:r,children:(0,T.jsx)(d,(0,cu.Z)({fontSize:"small"},f))}))}),i?.endAdornment]})}),sx:[{"& .clearButton":{opacity:1},"@media (pointer: fine)":{"& .clearButton":{opacity:0},"&:hover, &:focus-within":{".clearButton":{opacity:1}}}},...Array.isArray(o)?o:[o]]})})((0,cu.Z)({},u,{slots:r,slotProps:i}));return(0,T.jsx)(a,(0,cu.Z)({},h))});var TU=n(29435),TK=n(32791),TY=n(14336),TX=n(22694),TQ=n(5154),TJ=n(39489),T0=n(6341),T1=n(13189),T2=n(35918),T5=n(89880),T3=n(58006),T8=n(16332),T4=n(71721),T6=n(61721),T9=n(28904),T7=n(7785),De=n(38364),Dt=n(18340),Dn=n(20506),Dr=n(74265),Di=n(26635),Do=n(41275),Ds=n(14107),Dl=n(50436),Da=n(97912),Dc=n(59250),Du=n(3303),Dh=n(78374),Dd=n(53743),Df=n(18070),Dp=n(83709),Dm=n(63200),Dg=n(36292),Dv=n(11136),Db=n(33518),Dy=n(44138),Dx=n(28140),Dw=n(23033),DC=n(50007),DS=n(24575),Dk=n(5149),DM=n(18874),DT=n(62511),DD=n(14257);let DA={y:{sectionType:"year",contentType:"digit",maxLength:4},yy:"year",yyy:{sectionType:"year",contentType:"digit",maxLength:4},yyyy:"year",M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMMM:{sectionType:"month",contentType:"letter"},MMM:{sectionType:"month",contentType:"letter"},L:{sectionType:"month",contentType:"digit",maxLength:2},LL:"month",LLL:{sectionType:"month",contentType:"letter"},LLLL:{sectionType:"month",contentType:"letter"},d:{sectionType:"day",contentType:"digit",maxLength:2},dd:"day",do:{sectionType:"day",contentType:"digit-with-letter"},E:{sectionType:"weekDay",contentType:"letter"},EE:{sectionType:"weekDay",contentType:"letter"},EEE:{sectionType:"weekDay",contentType:"letter"},EEEE:{sectionType:"weekDay",contentType:"letter"},EEEEE:{sectionType:"weekDay",contentType:"letter"},i:{sectionType:"weekDay",contentType:"digit",maxLength:1},ii:"weekDay",iii:{sectionType:"weekDay",contentType:"letter"},iiii:{sectionType:"weekDay",contentType:"letter"},e:{sectionType:"weekDay",contentType:"digit",maxLength:1},ee:"weekDay",eee:{sectionType:"weekDay",contentType:"letter"},eeee:{sectionType:"weekDay",contentType:"letter"},eeeee:{sectionType:"weekDay",contentType:"letter"},eeeeee:{sectionType:"weekDay",contentType:"letter"},c:{sectionType:"weekDay",contentType:"digit",maxLength:1},cc:"weekDay",ccc:{sectionType:"weekDay",contentType:"letter"},cccc:{sectionType:"weekDay",contentType:"letter"},ccccc:{sectionType:"weekDay",contentType:"letter"},cccccc:{sectionType:"weekDay",contentType:"letter"},a:"meridiem",aa:"meridiem",aaa:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},DR={year:"yyyy",month:"LLLL",monthShort:"MMM",dayOfMonth:"d",dayOfMonthFull:"do",weekday:"EEEE",weekdayShort:"EEEEEE",hours24h:"HH",hours12h:"hh",meridiem:"aa",minutes:"mm",seconds:"ss",fullDate:"PP",keyboardDate:"P",shortDate:"MMM d",normalDate:"d MMMM",normalDateWithWeekday:"EEE, MMM d",fullTime:"p",fullTime12h:"hh:mm aa",fullTime24h:"HH:mm",keyboardDateTime:"P p",keyboardDateTime12h:"P hh:mm aa",keyboardDateTime24h:"P HH:mm"};class DP{constructor(e){this.isMUIAdapter=!0,this.isTimezoneCompatible=!1,this.lib=void 0,this.locale=void 0,this.formats=void 0,this.formatTokenMap=DA,this.escapedCharacters={start:"'",end:"'"},this.longFormatters=void 0,this.date=e=>void 0===e?new Date:null===e?null:new Date(e),this.getInvalidDate=()=>new Date("Invalid Date"),this.getTimezone=()=>"default",this.setTimezone=e=>e,this.toJsDate=e=>e,this.getCurrentLocaleCode=()=>this.locale.code,this.is12HourCycleInCurrentLocale=()=>/a/.test(this.locale.formatLong.time({width:"short"})),this.expandFormat=e=>e.match(/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g).map(e=>{let t=e[0];return"p"===t||"P"===t?(0,this.longFormatters[t])(e,this.locale.formatLong):e}).join(""),this.formatNumber=e=>e,this.getDayOfWeek=e=>e.getDay()+1;let{locale:t,formats:n,longFormatters:r,lib:i}=e;this.locale=t,this.formats=(0,cu.Z)({},DR,n),this.longFormatters=r,this.lib=i||"date-fns"}}class DO extends DP{constructor({locale:e,formats:t}={}){super({locale:e??DD._,formats:t,longFormatters:T3.G}),this.parse=(e,t)=>""===e?null:(0,Df.Qc)(e,t,new Date,{locale:this.locale}),this.isValid=e=>null!=e&&(0,Dd.J)(e),this.format=(e,t)=>this.formatByString(e,this.formats[t]),this.formatByString=(e,t)=>(0,T8.WU)(e,t,{locale:this.locale}),this.isEqual=(e,t)=>null===e&&null===t||null!==e&&null!==t&&(0,Dl.X)(e,t),this.isSameYear=(e,t)=>(0,Dc.F)(e,t),this.isSameMonth=(e,t)=>(0,Du.x)(e,t),this.isSameDay=(e,t)=>(0,Da.K)(e,t),this.isSameHour=(e,t)=>(0,Dh.f)(e,t),this.isAfter=(e,t)=>(0,Do.A)(e,t),this.isAfterYear=(e,t)=>(0,Do.A)(e,(0,T5.w)(t)),this.isAfterDay=(e,t)=>(0,Do.A)(e,(0,T1.i)(t)),this.isBefore=(e,t)=>(0,Ds.R)(e,t),this.isBeforeYear=(e,t)=>(0,Ds.R)(e,this.startOfYear(t)),this.isBeforeDay=(e,t)=>(0,Ds.R)(e,this.startOfDay(t)),this.isWithinRange=(e,[t,n])=>(0,DT._)(e,{start:t,end:n}),this.startOfYear=e=>(0,DM.e)(e),this.startOfMonth=e=>(0,DC.N)(e),this.startOfWeek=e=>(0,Dk.z)(e,{locale:this.locale}),this.startOfDay=e=>(0,Dw.b)(e),this.endOfYear=e=>(0,T5.w)(e),this.endOfMonth=e=>(0,DS.V)(e),this.endOfWeek=e=>(0,T2.v)(e,{locale:this.locale}),this.endOfDay=e=>(0,T1.i)(e),this.addYears=(e,t)=>(0,T0.B)(e,t),this.addMonths=(e,t)=>(0,TJ.z)(e,t),this.addWeeks=(e,t)=>(0,TQ.j)(e,t),this.addDays=(e,t)=>(0,TU.E)(e,t),this.addHours=(e,t)=>(0,TX.T)(e,t),this.addMinutes=(e,t)=>(0,TY.m)(e,t),this.addSeconds=(e,t)=>(0,TK.v)(e,t),this.getYear=e=>(0,Di.S)(e),this.getMonth=e=>(0,De.j)(e),this.getDate=e=>(0,T4._)(e),this.getHours=e=>(0,T9.p)(e),this.getMinutes=e=>(0,T7.q)(e),this.getSeconds=e=>(0,Dt.C)(e),this.getMilliseconds=e=>(0,Dn.p)(e),this.setYear=(e,t)=>(0,Dx.M)(e,t),this.setMonth=(e,t)=>(0,Dv.q)(e,t),this.setDate=(e,t)=>(0,Dp.G)(e,t),this.setHours=(e,t)=>(0,Dm.B)(e,t),this.setMinutes=(e,t)=>(0,Dg.H)(e,t),this.setSeconds=(e,t)=>(0,Db.O)(e,t),this.setMilliseconds=(e,t)=>(0,Dy.I)(e,t),this.getDaysInMonth=e=>(0,T6.N)(e),this.getWeekArray=e=>{let t=this.startOfWeek(this.startOfMonth(e)),n=this.endOfWeek(this.endOfMonth(e)),r=0,i=t,o=[];for(;this.isBefore(i,n);){let e=Math.floor(r/7);o[e]=o[e]||[],o[e].push(i),i=this.addDays(i,1),r+=1}return o},this.getWeekNumber=e=>(0,Dr.Q)(e,{locale:this.locale}),this.getYearRange=([e,t])=>{let n=this.startOfYear(e),r=this.endOfYear(t),i=[],o=n;for(;this.isBefore(o,r);)i.push(o),o=this.addYears(o,1);return i}}}let DI="yyyy-MM-dd HH:mm:ss";function DE(e,t){return e?(0,tY.s3)(e)?e.pastDuration:function(e,t,n){let r=nt(e.start,t,n),i=nt(e.end,t,n);return`${r} - ${i}`}(e,DI,t):"Custom Time Range"}let DZ=({initialTimeRange:e,onChange:t,onCancel:n})=>{let{formatWithUserTimeZone:r}=nl(),[i,o]=(0,D.useState)(e),[s,l]=(0,D.useState)({start:r(e.start,DI),end:r(e.end,DI)}),[a,c]=(0,D.useState)(!0),u=(e,t)=>{let n="string"==typeof e,i=n?e:r(e,DI);l(e=>({...e,[t]:i})),n||o(n=>({...n,[t]:e}))},h=e=>{u(e,"start")},d=e=>{u(e,"end")},f=()=>{var e,t;let n={start:new Date(s.start),end:new Date(s.end)};if(e=n.start,t=n.end,(0,tX.isValid)(e)&&(0,tX.isValid)(t)?!!(0,tX.isBefore)(e,t)||(console.error("End Time is before Start Time"),!1):(console.error("Invalid Date"),!1))return o(n),n};return(0,T.jsx)(w1,{dateAdapter:DO,children:(0,T.jsxs)(U.Z,{spacing:2,sx:e=>({padding:e.spacing(1,0,2)}),children:[a&&(0,T.jsxs)(nh.Z,{sx:e=>({".MuiPickersLayout-contentWrapper":{backgroundColor:e.palette.background.default}}),children:[(0,T.jsx)(sv.Z,{variant:"h3",padding:1,paddingLeft:2,children:"Select Start Time"}),(0,T.jsx)(M$,{displayStaticWrapperAs:"desktop",openTo:"day",disableHighlightToday:!0,value:e.start,onChange:e=>{null!==e&&h(e)},onAccept:()=>{c(!1)}})]}),!a&&(0,T.jsxs)(nh.Z,{sx:e=>({".MuiPickersLayout-contentWrapper":{backgroundColor:e.palette.background.default}}),children:[(0,T.jsx)(sv.Z,{variant:"h3",padding:1,paddingLeft:2,children:"Select End Time"}),(0,T.jsx)(M$,{displayStaticWrapperAs:"desktop",openTo:"day",disableHighlightToday:!0,value:e.end,minDateTime:i.start,onChange:e=>{null!==e&&d(e)},onAccept:e=>{null!==e&&(c(!0),d(e))}})]}),(0,T.jsxs)(U.Z,{direction:"row",alignItems:"center",gap:1,pl:1,pr:1,children:[(0,T.jsx)(co.ErrorBoundary,{FallbackComponent:ci,children:(0,T.jsx)(TG,{label:"Start Time",value:new Date(s.start),onChange:e=>{e&&h(e)},onBlur:()=>f(),format:DI})}),(0,T.jsx)(co.ErrorBoundary,{FallbackComponent:ci,children:(0,T.jsx)(TG,{label:"End Time",value:new Date(s.end),onChange:e=>{e&&d(e)},onBlur:()=>f(),format:DI})})]}),(0,T.jsxs)(U.Z,{direction:"row",sx:{padding:e=>e.spacing(0,1)},gap:1,children:[(0,T.jsx)(q.Z,{variant:"contained",onClick:()=>(()=>{let e=f();e&&t(e)})(),fullWidth:!0,children:"Apply"}),(0,T.jsx)(q.Z,{variant:"outlined",onClick:()=>n(),fullWidth:!0,children:"Cancel"})]})]})})};function DL({value:e,timeOptions:t,onChange:n,height:r,showCustomTimeRange:i=!0}){let{timeZone:o}=nl(),s=(0,D.useRef)(),[l,a]=(0,D.useState)(!1),c=(0,D.useMemo)(()=>(0,tY.s3)(e)?(0,tY.sG)(e):e,[e]),u=(0,D.useMemo)(()=>{var t;return{value:t=(0,tY.s3)(e)?void 0:e,display:DE(t,o)}},[e,o]),[h,d]=(0,D.useState)(!1);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(eP.ZP,{anchorEl:s.current,anchorOrigin:{vertical:"bottom",horizontal:"center"},open:l,onClose:()=>a(!1),sx:e=>({padding:e.spacing(2)}),children:(0,T.jsx)(DZ,{initialTimeRange:c,onChange:e=>{n(e),a(!1),d(!1)},onCancel:()=>a(!1)})}),(0,T.jsx)(nh.Z,{ref:s,children:(0,T.jsxs)(wY.Z,{open:h,value:DE(e,o),onClick:()=>d(!h),IconComponent:wX.default,inputProps:{"aria-label":`Select time range. Currently set to ${e}`},sx:{".MuiSelect-icon":{marginTop:"1px",transform:"none"},".MuiSelect-select.MuiSelect-outlined.MuiInputBase-input":{paddingRight:"36px"},".MuiSelect-select":r?{lineHeight:r,paddingY:0}:{}},children:[t.map((e,t)=>(0,T.jsx)(ag.Z,{value:DE(e.value,o),onClick:()=>{n(e.value)},children:e.display},t)),i&&(0,T.jsx)(ag.Z,{value:DE(u.value,o),onClick:()=>a(!0),children:u.display})]})})]})}function Dj(e){let{markerColor:t,sx:n}=e;return(0,T.jsx)(nh.Z,{sx:t6({display:"inline-block",width:"11px",height:"11px",borderRadius:"2px",marginRight:1,verticalAlign:"top"},n),style:{backgroundColor:t}})}function DB(e){let{formattedY:t,markerColor:n,metricName:r,metricLabels:i}=e;return(0,T.jsxs)(U.Z,{spacing:.5,children:[(0,T.jsxs)(nh.Z,{sx:e=>({display:"flex",height:"16px",flexDirection:"row",alignItems:"center",justifyContent:"left",color:e.palette.common.white,fontSize:"11px"}),children:[(0,T.jsx)(Dj,{markerColor:n,sx:{marginTop:.25}}),(0,T.jsxs)(nh.Z,{component:"span",children:[r,(0,T.jsx)(nh.Z,{component:"span",sx:e=>({color:e.palette.common.white,fontWeight:700,paddingLeft:"2px"}),children:t})]})]}),(0,T.jsx)(ca.Z,{sx:e=>({borderColor:e.palette.grey["500"]})}),(0,T.jsx)(nh.Z,{sx:e=>({color:e.palette.common.white}),children:i.map(e=>{if(e){let[t,n]=e.split("="),r=void 0!==n?`${t}: `:t,i=void 0!==n?n.replace(/(^"|"$)/g,""):n;return(0,T.jsxs)(nh.Z,{sx:{display:"flex",gap:"4px"},children:[(0,T.jsx)(sv.Z,{sx:{fontSize:"11px"},children:r}),(0,T.jsx)(sv.Z,{sx:e=>({color:e.palette.common.white,fontWeight:700,fontSize:"11px"}),children:i})]},e)}})})]})}let DF=375,DV=650,DN=650,DH=500,Dz=.75,D$=8,DW=750,D_="nearby series showing in tooltip",Dq="emphasized series showing as bold in tooltip",DG="#2E313E",DU=new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0}),DK={coords:{plotCanvas:{x:0,y:0},zrender:{x:0,y:0},target:null},chartWidth:0},DY=[],DX=()=>{let[e,t]=(0,D.useState)(null);return(0,D.useEffect)(()=>{let e=e=>t({page:{x:e.pageX,y:e.pageY},client:{x:e.clientX,y:e.clientY},plotCanvas:{x:e.zrX??e.offsetX,y:e.zrY??e.offsetY},target:e.target});return window.addEventListener("mousemove",e),()=>{window.removeEventListener("mousemove",e)}},[]),e},DQ={wrapLabels:!0,enablePinning:!0},DJ="Click chart to pin",D0="Click chart to unpin";function D1(e){let{seriesName:t,formattedY:n,markerColor:r,totalSeries:i,emphasizeText:o=!1,wrapLabels:s=!0}=e,l=t.split("{"),a=(l[1]??t).replace(/[{}]/g,"").split(",");if(1===i&&a.length>1){let e=l[0]?`${l[0]}:`:"value:";return(0,T.jsx)(DB,{formattedY:n,metricName:e,metricLabels:a,markerColor:r})}let c=t.replace(/[,]/g,", ");return(0,T.jsxs)(nh.Z,{sx:{display:"table-row",paddingTop:.5},children:[(0,T.jsxs)(nh.Z,{sx:{display:"table-cell",maxWidth:"520px"},children:[(0,T.jsx)(Dj,{markerColor:r,sx:{marginTop:.5}}),(0,T.jsx)(nh.Z,{component:"span",sx:e=>({display:"inline-block",width:"calc(100% - 20px)",minWidth:150,maxWidth:DH,overflow:"hidden",color:e.palette.common.white,fontWeight:o?e.typography.fontWeightBold:e.typography.fontWeightRegular,textOverflow:"ellipsis",whiteSpace:s?"normal":"nowrap"}),"aria-label":o?Dq:D_,children:c})]}),(0,T.jsx)(nh.Z,{sx:e=>({display:"table-cell",paddingLeft:1.5,textAlign:"right",verticalAlign:"top",fontWeight:o?e.typography.fontWeightBold:e.typography.fontWeightRegular}),children:n})]})}var D2=n(7444),D5=n(75276);function D3(e,t,n,r,i){if(null===e||(null!==t&&(e=t),void 0===e.plotCanvas.x))return;let o=e.page.x+32,s=e.page.y+16;if(i){let e=i.getBoundingClientRect();o=o-e.left+i.scrollLeft,s=s-e.top+i.scrollTop;let t=e.top+i.scrollHeight;s+n>t&&(s=Math.max(t-n-16,D$/2))}else s+n>window.innerHeight+window.scrollY&&(s=Math.max(window.innerHeight+window.scrollY-n-16,D$/2));return o+r>window.innerWidth&&(o=e.page.x-r-32),o<32&&(o=32),s<D$/2&&(s=D$/2),`translate3d(${o}px, ${s}px, 0)`}function D8(e,t,n){return{minWidth:DF,maxWidth:DV,maxHeight:(n?n-D$:void 0)??DN,padding:0,position:"absolute",top:0,left:0,backgroundColor:e.palette.designSystem?.grey[800]??DG,borderRadius:"6px",color:"#fff",fontSize:"11px",visibility:"visible",opacity:1,transition:"all 0.1s ease-out",zIndex:null!==t?"auto":e.zIndex.tooltip,overflow:"hidden","&:hover":{overflowY:"auto"}}}let D4=5.5,D6=30,D9=5;function D7(e,t,n,r,i,o){let s=[],l=n[0]??null,a=n[1]??null;if(null===l||null===a||void 0===i.dispatchAction||!Array.isArray(e))return s;let c=[],u=[],h=[],d=[],f=[],p=e.length,m=new Map,g=t8(e[0]?.values,l);if(null===g)return DY;for(let n=0;n<p;n++){let l=t[n];if(!l)break;let v=p>0?e[n]:null;if(!v)break;let b=v.values;if(void 0===b||!Array.isArray(b))break;let y=l.name?l.name.toString():"",x=l.color??"#000";if(Array.isArray(e))for(let e=0;e<b.length;e++){let t=b[e];if(void 0===t||!Array.isArray(t))break;let l=t[0],v=t[1];if(null!=v&&g===l&&a<=v+r&&a>=v-r){let t=Ar({valueToCheck:a,baseValue:v,percentage:Math.max(p>D9?2:5,100/p)});if(t){u.push(n);let t=m.get(v)??0;m.set(v,t+1),t>0&&f.push({seriesIndex:n,dataIndex:e,seriesName:y,yValue:v}),d.push({seriesIndex:n,dataIndex:e,seriesName:y,yValue:v})}else h.push(n),i.dispatchAction({type:"downplay",seriesIndex:n});let r=(0,t_.Bw)(v,o);s.push({seriesIdx:n,datumIdx:e,seriesName:y,date:g,x:l,y:v,formattedY:r,markerColor:x.toString(),isClosestToCursor:t}),c.push(n)}}}return t5(i,c,u,h,d,f),s}function Ae(e,t,n,r,i){let o=[],s=t[0]??null,l=t[1]??null;if(null===s||null===l)return o;let a=[],c=[],u=[],h=e.timeSeries.length;if(Array.isArray(e.xAxis)&&Array.isArray(e.timeSeries))for(let t=0;t<h;t++){let d=e.timeSeries[t];if(void 0===d||o.length>=tG)break;let f=d.name?d.name.toString():"",p=d.color??"#000";if(Array.isArray(d.data))for(let m=0;m<d.data.length;m++){let g=e.xAxis[m]??0,v=d.data[m];if(null!=v&&s===m&&"-"!==v&&l<=v+n&&l>=v-n){let e=Ar({valueToCheck:l,baseValue:v,percentage:Math.max(h>D9?2:5,100/h)});e?c.push(t):(u.push(t),r?.dispatchAction!==void 0&&r.dispatchAction({type:"downplay",seriesIndex:t}));let n=g>0x174876e7ff?g:1e3*g,s=(0,t_.Bw)(v,i);o.push({seriesIdx:t,datumIdx:m,seriesName:f,date:n,x:g,y:v,formattedY:s,markerColor:p.toString(),isClosestToCursor:e}),a.push(t)}}}return r?.dispatchAction!==void 0&&(r.dispatchAction({type:"downplay",seriesIndex:u}),c.length>0?r.dispatchAction({type:"highlight",seriesIndex:c,notBlur:!1,escapeConnect:!0}):r.dispatchAction({type:"highlight",seriesIndex:a,notBlur:!0,escapeConnect:!0})),o}function At({mousePos:e,pinnedPos:t,data:n,seriesMapping:r,chart:i,format:o,showAllSeries:s=!1}){if(void 0===i||null===e)return DY;let l=!1;if(null!==e.target){let t=e.target.parentElement;if(null!==t){let e=t.parentElement;null!==e&&i.getDom()===e&&(l=!0)}}if(null!==t&&(e=t,l=!0),!1===l||null===n||void 0===i._model||void 0===e.plotCanvas.x||void 0===e.plotCanvas.y)return DY;let a=t2(e.plotCanvas.x,e.plotCanvas.y,i);if(null!==a){let e=Ai({yInterval:i._model.getComponent("yAxis").axis.scale._interval,totalSeries:n.length,showAllSeries:s});return D7(n,r,a,e,i,o)}return DY}function An({mousePos:e,pinnedPos:t,chartData:n,chart:r,format:i,showAllSeries:o=!1}){if(void 0===r||null===e)return[];let s=!1;if(null!==e.target){let t=e.target.parentElement;if(null!==t){let e=t.parentElement;null!==e&&r.getDom()===e&&(s=!0)}}if(null!==t&&(e=t,s=!0),!1===s||void 0===r._model)return[];let l=Ai({yInterval:r._model.getComponent("yAxis").axis.scale._interval,totalSeries:n.timeSeries.length,showAllSeries:o}),a=[e.plotCanvas.x??0,e.plotCanvas.y??0];if(r.containPixel("grid",a)){let e=r.convertFromPixel("grid",a);if(void 0!==e[0]&&void 0!==e[1])return Ae(n,e,l,r,i)}return[]}function Ar({valueToCheck:e,baseValue:t,percentage:n}){let r=n/100*t;return e>=t-r&&e<=t+r}function Ai({yInterval:e,totalSeries:t,showAllSeries:n=!1}){if(n)return 10*e;let r=.3*e;return t>D9?Math.max(r,e*D6/t):Math.max(r,e*D4)}var Ao=n(87895),As=n(1889),Al=n(75186);let Aa=(0,D.memo)(function({nearbySeries:e,totalSeries:t,isTooltipPinned:n,showAllSeries:r,enablePinning:i=!0,onShowAllClick:o,onUnpinClick:s}){let l=e[0]?.date??null;if(null===l)return null;let a=i&&t>5;return(0,T.jsxs)(nh.Z,{sx:e=>({width:"100%",maxWidth:DV,padding:e.spacing(1.5,2,.5,2),backgroundColor:e.palette.designSystem?.grey[800]??DG,position:"sticky",top:0,left:0}),children:[(0,T.jsxs)(nh.Z,{sx:{width:"100%",display:"flex",justifyContent:"start",alignItems:"center",paddingBottom:.5},children:[(e=>{let{formattedTime:t,formattedDate:n}=nr(e);return(0,T.jsxs)(nh.Z,{children:[(0,T.jsx)(sv.Z,{variant:"caption",sx:e=>({color:e.palette.common.white}),children:n}),(0,T.jsx)(sv.Z,{variant:"caption",children:(0,T.jsx)("strong",{children:t})})]})})(l),(0,T.jsxs)(U.Z,{direction:"row",gap:1,sx:{marginLeft:"auto"},children:[a&&(0,T.jsxs)(U.Z,{direction:"row",gap:.5,alignItems:"center",sx:{textAlign:"right"},children:[(0,T.jsx)(sv.Z,{sx:{fontSize:11},children:"Show All"}),(0,T.jsx)(Ao.Z,{checked:r,size:"small",onChange:(e,t)=>{if(void 0!==o)return o(t)},sx:e=>({"& .MuiSwitch-switchBase":{color:e.palette.common.white},"& .MuiSwitch-track":{backgroundColor:e.palette.common.white}})})]}),i&&(0,T.jsxs)(U.Z,{direction:"row",alignItems:"center",children:[(0,T.jsx)(sv.Z,{sx:{marginRight:.5,fontSize:11,verticalAlign:"middle"},children:n?D0:DJ}),n?(0,T.jsx)(As.default,{onClick:()=>{void 0!==s&&s()},sx:{fontSize:16,cursor:"pointer"}}):(0,T.jsx)(Al.default,{sx:{fontSize:16}})]})]})]}),(0,T.jsx)(ca.Z,{sx:e=>({width:"100%",borderColor:e.palette.grey["500"]})})]})});function Ac(e){let{series:t,wrapLabels:n}=e,r=(0,D.useMemo)(()=>null===t?null:t.sort((e,t)=>e.y>t.y?-1:1),[t]);return null===t||null===r?null:(0,T.jsx)(nh.Z,{sx:e=>({display:"table",padding:e.spacing(.5,2)}),children:r.map(({datumIdx:e,seriesIdx:t,seriesName:i,y:o,formattedY:s,markerColor:l,isClosestToCursor:a})=>{if(null===e||null===t)return null;let c=t.toString()+e.toString();return(0,T.jsx)(D1,{seriesName:i,y:o,formattedY:s,markerColor:l,totalSeries:r.length,wrapLabels:n,emphasizeText:a},c)})})}let Au=(0,D.memo)(function({containerId:e,chartRef:t,data:n,seriesMapping:r,enablePinning:i=!0,wrapLabels:o,format:s,onUnpinClick:l,pinnedPos:a}){let[c,u]=(0,D.useState)(!1),h=(0,D.useRef)(),d=DX(),{height:f,width:p,ref:m}=(0,D5.default)(),g=null!==a&&i;if(null===d||null===d.target||null===n||null===a&&"CANVAS"!==d.target.tagName)return null;let v=t.current,b=e?document.querySelector(e):void 0,y=b?b.getBoundingClientRect().height:void 0;h.current=D3(d,a,f??0,p??0,b);let x=At({mousePos:d,data:n,seriesMapping:r,pinnedPos:a,chart:v,format:s,showAllSeries:c});if(0===x.length)return null;let w=n.length;return(0,T.jsx)(D2.Z,{container:b,children:(0,T.jsx)(nh.Z,{ref:m,sx:e=>D8(e,a,y),style:{transform:h.current},children:(0,T.jsxs)(U.Z,{spacing:.5,children:[(0,T.jsx)(Aa,{nearbySeries:x,totalSeries:w,enablePinning:i,isTooltipPinned:g,showAllSeries:c,onShowAllClick:e=>u(e),onUnpinClick:l}),(0,T.jsx)(Ac,{series:x,wrapLabels:o})]})})})}),Ah=(0,Z.ZP)(q.Z)(({theme:e})=>({padding:e.spacing(.5),minWidth:"auto"})),Ad=(0,D.forwardRef)(function(e,t){return(0,T.jsx)(Ah,{ref:t,variant:"outlined",color:"secondary",...e})});var Af=n(15418);let Ap=Object.entries(t_.Bl).map(([e,t])=>({...t,id:e,group:t.group||"Decimal"})).filter(e=>!e.disableSelectorOption),Am=[{id:"default",label:"Default",decimalPlaces:void 0},{id:"0",label:"0",decimalPlaces:0},{id:"1",label:"1",decimalPlaces:1},{id:"2",label:"2",decimalPlaces:2},{id:"3",label:"3",decimalPlaces:3},{id:"4",label:"4",decimalPlaces:4}];function Ag({value:e,onChange:t,disabled:n=!1}){var r;let i=(0,t_.__)(e),o=(0,t_.Fp)(e),s=t_.Bl[e?.unit||"decimal"];return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(lv,{label:"Short values",control:(0,T.jsx)(Ao.Z,{checked:!!o&&(0,Af.lk)(e.shortValues),onChange:(n,r)=>{o&&t({...e,shortValues:r})},disabled:!o})}),(0,T.jsx)(lv,{label:"Unit",control:(0,T.jsx)(lC,{value:{id:e?.unit||"decimal",...s},options:Ap,groupBy:e=>e.group??"Decimal",onChange:(e,n)=>{t({unit:n?.id||"decimal"})},disableClearable:!0,disabled:n})}),(0,T.jsx)(lv,{label:"Decimals",control:(0,T.jsx)(lC,{value:(r=e.decimalPlaces,Am.find(e=>e.decimalPlaces===r)),options:Am,getOptionLabel:e=>e.label,onChange:(n,r)=>(({decimalPlaces:n})=>{i&&t({...e,decimalPlaces:n})})(r),disabled:!i,disableClearable:!0})})]})}function Av({name:e,height:t}){return(0,T.jsx)(nh.Z,{style:{maxWidth:t,top:`calc(${t}px / 2)`},sx:{display:"inline-block",position:"absolute",transform:"translateX(-50%) rotate(-90deg)",transformOrigin:"top",textAlign:"center",zIndex:1},children:(0,T.jsx)(sv.Z,{variant:"body1","aria-label":"y axis label",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e})})}var Ab=n(28730);let Ay=ni((0,Ab.Z)({}),{echartsTheme:{textStyle:{fontFamily:"Lato"},categoryAxis:{splitLine:{show:!1}},timeAxis:{splitLine:{show:!1}},bar:{barCategoryGap:2}}}),Ax={chartsTheme:Ay,enablePinning:!1,enableSyncGrouping:!0,lastTooltipPinnedCoords:null,setLastTooltipPinnedCoords:()=>null};var Aw=n(79602);let AC={defaultProps:{variant:"standard",severity:"success"},styleOverrides:{standardError:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.error.dark,color:e.palette.error.light,[`& .${Aw.Z.icon}`]:{color:e.palette.error.main}}:{...e.typography.body1,backgroundColor:e.palette.error.light,color:e.palette.error.dark,[`& .${Aw.Z.icon}`]:{color:e.palette.error.main}},standardInfo:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.info.dark,color:e.palette.info.light,[`& .${Aw.Z.icon}`]:{color:e.palette.info.main}}:{...e.typography.body1,backgroundColor:e.palette.info.light,color:e.palette.info.dark,[`& .${Aw.Z.icon}`]:{color:e.palette.info.main}},standardSuccess:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.success.dark,color:e.palette.success.light,[`& .${Aw.Z.icon}`]:{color:e.palette.success.main}}:{...e.typography.body1,backgroundColor:e.palette.success.light,color:e.palette.success.dark,[`& .${Aw.Z.icon}`]:{color:e.palette.success.main}},standardWarning:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.warning.dark,color:e.palette.warning.light,[`& .${Aw.Z.icon}`]:{color:e.palette.warning.main}}:{...e.typography.body1,backgroundColor:e.palette.warning.light,color:e.palette.warning.dark,[`& .${Aw.Z.icon}`]:{color:e.palette.warning.main}},root:{["& ."+n(757).Z.root]:{textDecoration:"underline"}}}},AS={50:"#F0F1F6",100:"#E1E3ED",150:"#D2D5E4",200:"#C3C7DB",300:"#A4ACC8",400:"#8690B6",500:"#717CA4",600:"#535D83",700:"#3E4662",800:"#2A2E42",850:"#1F2331",900:"#151721",950:"#0A0C10"},Ak={50:"#E7F1FC",100:"#D0E3FA",150:"#B8D5F7",200:"#A1C7F5",300:"#72ABF0",400:"#438FEB",500:"#1473E6",600:"#105CB8",700:"#0C458A",800:"#082E5C",850:"#062345",900:"#04172E",950:"#020C17"},AM="#FFFFFF",AT=e=>"light"===e?{main:Ak["500"],dark:Ak["600"],light:Ak["50"]}:{main:Ak["400"],dark:Ak["800"],light:Ak["200"]},AD={50:"#EAF9F1",100:"#D5F2E3",150:"#C1ECD4",200:"#ACE5C6",300:"#82D9AA",400:"#59CC8D",500:"#2FBF71",600:"#26995A",700:"#1C7344",800:"#134C2D",850:"#0E3922",900:"#092617",950:"#05130B"},AA={50:"#FFF5E8",100:"#FFECD2",150:"#FFE2BB",200:"#FFD9A4",300:"#FFC577",400:"#FFB249",500:"#FF9F1C",600:"#CC7F16",700:"#995F11",800:"#66400B",850:"#4D3008",900:"#332006",950:"#1A1003"},AR={50:"#EFE9FD",100:"#E0D2FC",150:"#D0BCFA",200:"#C1A6F8",300:"#A179F5",400:"#824DF1",500:"#6320EE",600:"#4F1ABE",700:"#3B138F",800:"#280D5F",850:"#1E0A47",900:"#140630",950:"#0A0318"},AP={50:"#FDEDED",100:"#FBDADA",150:"#F9C8C8",200:"#F7B5B5",300:"#F29191",400:"#EE6C6C",500:"#EA4747",600:"#BD3939",700:"#902B2B",800:"#621D1D",850:"#4C1616",900:"#350F0F",950:"#1F0808"},AO={fontFamily:'"Lato", sans-serif',fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:700,fontWeightBold:900,h1:{fontSize:"1.5rem",fontWeight:700,lineHeight:"32px"},h2:{fontSize:"1.25rem",fontWeight:700,lineHeight:"28px"},h3:{fontSize:"1rem",fontWeight:700,lineHeight:"24px"},h4:{fontSize:"0.875rem",fontWeight:700,lineHeight:"22px"},h5:void 0,h6:void 0,body1:{fontSize:"0.875rem",fontWeight:400,lineHeight:"20px"},body2:{fontSize:"0.75rem",fontWeight:400,lineHeight:"18px"},subtitle1:{fontSize:"1rem",fontWeight:400,lineHeight:"24px",letterSpacing:"0.02rem"},subtitle2:{fontSize:"0.875rem",fontWeight:700,lineHeight:"22px",letterSpacing:"0.03rem",textTransform:"uppercase"},button:{fontSize:"0.875rem",fontWeight:700,lineHeight:"1.25rem",textTransform:"none",letterSpacing:"0.03rem"},caption:{fontSize:"0.6875rem",fontWeight:400,lineHeight:"16px"}},AI=({theme:e})=>({..."light"===e.palette.mode?{}:{backgroundImage:"unset",backgroundColor:e.palette.designSystem.grey[800]}});function AE(e,t={}){var n;return(0,Ab.Z)({palette:{mode:n=e,primary:AT(n),secondary:"light"===n?{main:AS["600"],dark:AS["900"],light:AS["100"]}:{main:AM,dark:AM,light:AM},grey:"light"===n?{50:AS["50"],100:AS["100"],200:AS["200"],300:AS["300"],400:AS["400"],500:AS["500"],600:AS["600"],700:AS["700"],800:AS["800"],900:AS["900"],950:AS["950"]}:{50:AS["950"],100:AS["900"],200:AS["800"],300:AS["700"],400:AS["600"],500:AS["500"],600:AS["400"],700:AS["300"],800:AS["200"],900:AS["100"],950:AS["50"]},background:(e=>{let t=Ak["150"],n="rgba(21, 23, 33, 0.75)";return"light"===e?{navigation:t,overlay:n,default:AM,paper:AS["50"],code:AS["50"],tooltip:AS["100"],lighter:AS["50"],border:AS["100"]}:{navigation:t,overlay:n,default:AS["900"],paper:AS["850"],code:AS["800"],tooltip:AS["600"],lighter:AS["700"],border:AS["600"]}})(n),text:(e=>{let t=AS["800"],n=AS["300"];return"light"===e?{navigation:t,accent:n,primary:AS["800"],secondary:AS["700"],disabled:AS["300"],link:Ak["500"],linkHover:Ak["600"]}:{navigation:t,accent:n,primary:AM,secondary:AS["50"],disabled:AS["600"],link:Ak["400"],linkHover:Ak["500"]}})(n),error:"light"===n?{main:AP["500"],dark:AP["600"],light:AP["50"]}:{main:AP["400"],dark:AP["800"],light:AP["300"]},warning:"light"===n?{main:AA["500"],dark:AA["700"],light:AA["50"]}:{main:AA["400"],dark:AA["800"],light:AA["300"]},info:AT(n),success:"light"===n?{main:AD["500"],dark:AD["700"],light:AD["50"]}:{main:AD["400"],dark:AD["800"],light:AD["300"]},common:{white:AM,black:"#000000"},designSystem:{blue:Ak,green:AD,grey:AS,orange:AA,purple:AR,red:AP}},typography:AO,mixins:{},components:AZ,...t})}let AZ={MuiAlert:AC,MuiFormControl:{defaultProps:{size:"small"}},MuiPaper:{styleOverrides:{root:({theme:e})=>({backgroundColor:e.palette.background.default})}},MuiTextField:{defaultProps:{size:"small"}},MuiDrawer:{styleOverrides:{paper:AI}},MuiDialog:{styleOverrides:{paper:AI}},MuiPopover:{styleOverrides:{paper:AI}}};var AL=n(84974),Aj=n(12449),AB=n(28418),AF=n(57689),AV=n(78737);function AN({value:e,onChange:t}){return(0,T.jsxs)(U.Z,{direction:"row",children:[(0,T.jsx)(lx.Z,{freeSolo:!0,multiple:!0,id:"join-columns",sx:{width:"100%"},options:[],value:e.spec.columns??[],renderInput:e=>(0,T.jsx)(Y.Z,{...e,variant:"outlined",label:"Columns",required:!0}),onChange:(n,r)=>{t({...e,spec:{...e.spec,columns:r}})}}),(0,T.jsx)(wy.Z,{label:"Enabled",labelPlacement:"start",control:(0,T.jsx)(Ao.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function AH({value:e,onChange:t}){return(0,T.jsxs)(U.Z,{direction:"row",gap:1,alignItems:"center",children:[(0,T.jsx)(lx.Z,{freeSolo:!0,multiple:!0,id:"merge-columns-columns",sx:{width:"100%"},options:[],value:e.spec.columns??[],renderInput:e=>(0,T.jsx)(Y.Z,{...e,variant:"outlined",label:"Columns",required:!0}),onChange:(n,r)=>{t({...e,spec:{...e.spec,columns:r}})}}),(0,T.jsx)(s6,{id:"merge-columns-name",variant:"outlined",label:"Output Name",value:e.spec.name??"",sx:{width:"100%"},onChange:n=>{t({...e,spec:{...e.spec,name:n}})},required:!0}),(0,T.jsx)(wy.Z,{label:"Enabled",labelPlacement:"start",control:(0,T.jsx)(Ao.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function Az({value:e,onChange:t}){return(0,T.jsxs)(U.Z,{direction:"row",children:[(0,T.jsx)(s6,{id:"merge-indexed-columns",variant:"outlined",label:"Column",placeholder:"Example: 'value' for merging 'value #1', 'value #2' and 'value #...'",value:e.spec.column??"",sx:{width:"100%"},onChange:n=>{t({...e,spec:{...e.spec,column:n}})},required:!0}),(0,T.jsx)(wy.Z,{label:"Enabled",labelPlacement:"start",control:(0,T.jsx)(Ao.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function A$({value:e,onChange:t}){return(0,T.jsx)(U.Z,{direction:"row",children:(0,T.jsx)(wy.Z,{label:"Enabled",labelPlacement:"start",control:(0,T.jsx)(Ao.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})})}function AW({value:e,onChange:t,...n}){return(0,T.jsxs)(U.Z,{gap:2,sx:{width:"100%"},mt:1,...n,children:[(0,T.jsxs)(s6,{select:!0,label:"Kind",value:e.kind,onChange:n=>t({...e,kind:n}),children:[(0,T.jsx)(ag.Z,{value:"JoinByColumnValue",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"Join by column value"}),(0,T.jsx)(sv.Z,{variant:"caption",children:"Regroup rows with equal cell value in a column"})]})}),(0,T.jsx)(ag.Z,{value:"MergeColumns",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"Merge columns"}),(0,T.jsx)(sv.Z,{variant:"caption",children:"Multiple columns are merged to one column"})]})}),(0,T.jsx)(ag.Z,{value:"MergeIndexedColumns",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"Merge indexed columns"}),(0,T.jsx)(sv.Z,{variant:"caption",children:"Indexed columns are merged to one column"})]})}),(0,T.jsx)(ag.Z,{value:"MergeSeries",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"Merge series"}),(0,T.jsx)(sv.Z,{variant:"caption",children:"Series will be merged by their labels"})]})})]}),"JoinByColumnValue"===e.kind&&(0,T.jsx)(AN,{value:e,onChange:t}),"MergeColumns"===e.kind&&(0,T.jsx)(AH,{value:e,onChange:t}),"MergeIndexedColumns"===e.kind&&(0,T.jsx)(Az,{value:e,onChange:t}),"MergeSeries"===e.kind&&(0,T.jsx)(A$,{value:e,onChange:t})]})}function A_({index:e,value:t,isCollapsed:n,onChange:r,onCollapse:i,onDelete:o,...s}){return(0,T.jsxs)(U.Z,{...s,children:[(0,T.jsxs)(U.Z,{direction:"row",alignItems:"center",borderBottom:1,borderColor:e=>e.palette.divider,justifyContent:"space-between",gap:4,children:[(0,T.jsxs)(U.Z,{direction:"row",gap:1,children:[(0,T.jsx)(K.Z,{"data-testid":`transform-toggle#${e}`,size:"small",onClick:()=>i(!n),children:n?(0,T.jsx)(AL.default,{}):(0,T.jsx)(Aj.default,{})}),(0,T.jsx)(sv.Z,{variant:"overline",component:"h4",sx:{textTransform:"none"},children:t.kind?(0,T.jsx)("span",{children:(0,T.jsx)("strong",{children:AV.R[t.kind]})}):(0,T.jsx)("strong",{children:"Select a transformation kind"})})]}),(0,T.jsxs)(U.Z,{direction:"row",gap:1,children:[n&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ld.Z,{title:t.spec?.disabled?"Enable transformation":"Disable transformation",placement:"top",children:(0,T.jsx)(K.Z,{size:"small",sx:{marginLeft:"auto"},onClick:function(){r({...t,spec:{...t.spec,disabled:!t.spec?.disabled}})},children:t.spec?.disabled?(0,T.jsx)(AB.default,{}):(0,T.jsx)(AF.default,{})})}),(0,T.jsx)(ca.Z,{flexItem:!0,orientation:"vertical",variant:"middle"})]}),(0,T.jsx)(ld.Z,{title:"Remove transformation",placement:"top",children:(0,T.jsx)(K.Z,{size:"small",sx:{marginLeft:"auto"},onClick:o,children:(0,T.jsx)(wq.default,{})})})]})]}),!n&&(0,T.jsx)(AW,{value:t,onChange:r})]})}function Aq({value:e,onChange:t,...n}){let[r,i]=(0,D.useState)(e.map(()=>!0));return(0,T.jsxs)(U.Z,{gap:1,...n,children:[e.map((n,o)=>(0,T.jsx)(A_,{index:o,value:n,isCollapsed:r[o]??!0,onChange:n=>(function(n,r){let i=[...e];i[n]=r,t(i)})(o,n),onDelete:()=>(function(n){let r=[...e];r.splice(n,1),t(r),i(e=>(e.splice(n,1),[...e]))})(o),onCollapse:e=>{i(t=>(t[o]=e,[...t]))}},o)),(0,T.jsx)(q.Z,{variant:"contained",startIcon:(0,T.jsx)(ww.default,{}),sx:{marginTop:1},onClick:function(){let n=[...e];n.push({kind:"",spec:{}}),t(n),i(e=>(e.push(!1),[...e]))},children:"Add Transformation"})]})}function AG(e){let{value:t,onChange:n,timeOptions:r,height:i}=e,o=(0,D.useMemo)(()=>{if(t&&!r.some(e=>e.value.pastDuration===t))return(0,T.jsx)(ag.Z,{value:t,children:t})},[r,t]);return(0,T.jsx)(lc.Z,{children:(0,T.jsx)(nh.Z,{children:(0,T.jsxs)(wY.Z,{id:"refreshInterval",value:t,onChange:e=>{n(e.target.value)},inputProps:{"aria-label":`Select refresh interval. Currently set to ${t}`},sx:{".MuiSelect-select":i?{lineHeight:i,paddingY:0}:{}},children:[r.map((e,t)=>(0,T.jsx)(ag.Z,{value:e.value.pastDuration,children:e.display},t)),o]})})})}var AU=n(11104),AK=n(4560),AY=n(22179),AX=n(38971),AQ=n(93772),AJ=n(6798);let A0=(e,t,n)=>{let r=e.keys[0];if(Array.isArray(t))t.forEach((t,r)=>{n((t,n)=>{r<=e.keys.length-1&&(0===r?Object.assign(t,n):t[e.up(e.keys[r])]=n)},t)});else if(t&&"object"==typeof t){let i,o;(Object.keys(t).length>e.keys.length?e.keys:(i=e.keys,o=Object.keys(t),i.filter(e=>o.includes(e)))).forEach(i=>{if(e.keys.includes(i)){let o=t[i];void 0!==o&&n((t,n)=>{r===i?Object.assign(t,n):t[e.up(i)]=n},o)}})}else("number"==typeof t||"string"==typeof t)&&n((e,t)=>{Object.assign(e,t)},t)};function A1(e){return`--Grid-${e}Spacing`}function A2(e){return`--Grid-parent-${e}Spacing`}let A5="--Grid-columns",A3="--Grid-parent-columns",A8=({theme:e,ownerState:t})=>{let n={};return A0(e.breakpoints,t.size,(e,t)=>{let r={};"grow"===t&&(r={flexBasis:0,flexGrow:1,maxWidth:"100%"}),"auto"===t&&(r={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),"number"==typeof t&&(r={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${t} / var(${A3}) - (var(${A3}) - ${t}) * (var(${A2("column")}) / var(${A3})))`}),e(n,r)}),n},A4=({theme:e,ownerState:t})=>{let n={};return A0(e.breakpoints,t.offset,(e,t)=>{let r={};"auto"===t&&(r={marginLeft:"auto"}),"number"==typeof t&&(r={marginLeft:0===t?"0px":`calc(100% * ${t} / var(${A3}) + var(${A2("column")}) * ${t} / var(${A3}))`}),e(n,r)}),n},A6=({theme:e,ownerState:t})=>{if(!t.container)return{};let n={[A5]:12};return A0(e.breakpoints,t.columns,(e,t)=>{let r=t??12;e(n,{[A5]:r,"> *":{[A3]:r}})}),n},A9=({theme:e,ownerState:t})=>{if(!t.container)return{};let n={};return A0(e.breakpoints,t.rowSpacing,(t,r)=>{let i="string"==typeof r?r:e.spacing?.(r);t(n,{[A1("row")]:i,"> *":{[A2("row")]:i}})}),n},A7=({theme:e,ownerState:t})=>{if(!t.container)return{};let n={};return A0(e.breakpoints,t.columnSpacing,(t,r)=>{let i="string"==typeof r?r:e.spacing?.(r);t(n,{[A1("column")]:i,"> *":{[A2("column")]:i}})}),n},Re=({theme:e,ownerState:t})=>{if(!t.container)return{};let n={};return A0(e.breakpoints,t.direction,(e,t)=>{e(n,{flexDirection:t})}),n},Rt=({ownerState:e})=>({minWidth:0,boxSizing:"border-box",...e.container&&{display:"flex",flexWrap:"wrap",...e.wrap&&"wrap"!==e.wrap&&{flexWrap:e.wrap},gap:`var(${A1("row")}) var(${A1("column")})`}}),Rn=(0,AJ.Z)(),Rr=(0,AK.Z)("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,t)=>t.root});function Ri(e){return(0,AY.Z)({props:e,name:"MuiGrid",defaultTheme:Rn})}let Ro=function(e={}){let{createStyledComponent:t=Rr,useThemeProps:n=Ri,useTheme:r=AX.Z,componentName:i="MuiGrid"}=e;function o(e,t,n=()=>!0){let r={};return null===e||(Array.isArray(e)?e.forEach((e,i)=>{null!==e&&n(e)&&t.keys[i]&&(r[t.keys[i]]=e)}):"object"==typeof e?Object.keys(e).forEach(t=>{let i=e[t];null!=i&&n(i)&&(r[t]=i)}):r[t.keys[0]]=e),r}let s=t(A6,A7,A9,A8,Re,Rt,A4),l=D.forwardRef(function(e,t){let l=r(),a=n(e),c=(0,AQ.Z)(a);var u=l.breakpoints;let h=[];void 0!==c.item&&(delete c.item,h.push("item")),void 0!==c.zeroMinWidth&&(delete c.zeroMinWidth,h.push("zeroMinWidth")),u.keys.forEach(e=>{void 0!==c[e]&&(h.push(e),delete c[e])});let{className:d,children:f,columns:p=12,container:m=!1,component:g="div",direction:v="row",wrap:b="wrap",size:y={},offset:x={},spacing:w=0,rowSpacing:C=w,columnSpacing:S=w,unstable_level:k=0,...M}=c,A=o(y,l.breakpoints,e=>!1!==e),O=o(x,l.breakpoints),I=e.columns??(k?void 0:p),E=e.spacing??(k?void 0:w),Z=e.rowSpacing??e.spacing??(k?void 0:C),L=e.columnSpacing??e.spacing??(k?void 0:S),j={...c,level:k,columns:I,container:m,direction:v,wrap:b,spacing:E,rowSpacing:Z,columnSpacing:L,size:A,offset:O},B=((e,t)=>{let{container:n,direction:r,spacing:o,wrap:s,size:l}=e,a={root:["root",n&&"container","wrap"!==s&&`wrap-xs-${String(s)}`,...void 0===r?[]:"object"==typeof r?Object.entries(r).map(([e,t])=>`direction-${e}-${t}`):[`direction-xs-${String(r)}`],...(e=>{let t=[];return Object.entries(e).forEach(([e,n])=>{!1!==n&&void 0!==n&&t.push(`grid-${e}-${String(n)}`)}),t})(l),...n?((e,t="xs")=>{function n(e){return void 0!==e&&("string"==typeof e&&!Number.isNaN(Number(e))||"number"==typeof e&&e>0)}if(n(e))return[`spacing-${t}-${String(e)}`];if("object"==typeof e&&!Array.isArray(e)){let t=[];return Object.entries(e).forEach(([e,r])=>{n(r)&&t.push(`spacing-${e}-${String(r)}`)}),t}return[]})(o,t.breakpoints.keys[0]):[]]};return(0,P.Z)(a,e=>(0,V.ZP)(i,e),{})})(j,l);return(0,T.jsx)(s,{ref:t,as:g,ownerState:j,className:(0,R.Z)(B.root,d),...M,children:D.Children.map(f,e=>D.isValidElement(e)&&(0,AU.Z)(e,["Grid"])&&m&&e.props.container?D.cloneElement(e,{unstable_level:e.props?.unstable_level??k+1}):e)})});return l.muiName="Grid",l}({createStyledComponent:(0,Z.ZP)("div",{name:"MuiGrid2",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.container&&t.container]}}),componentName:"MuiGrid2",useThemeProps:e=>(0,B.i)({props:e,name:"MuiGrid2"}),useTheme:nu.Z}),Rs=({mapping:e,onChange:t,...n})=>{switch(e.kind){case"Value":return(0,T.jsx)(U.Z,{gap:1,direction:"row",...n,children:(0,T.jsx)(Y.Z,{label:"Value",placeholder:"Exact value",value:e.spec?.value??"",onChange:n=>t({...e,spec:{...e.spec,value:n.target.value}}),fullWidth:!0})});case"Range":return(0,T.jsxs)(U.Z,{gap:1,direction:"row",...n,children:[(0,T.jsx)(Y.Z,{label:"From",placeholder:"Start of range",value:e.spec?.from??"",onChange:n=>t({...e,spec:{...e.spec,from:""===n.target.value?void 0:+n.target.value}}),fullWidth:!0}),(0,T.jsx)(Y.Z,{label:"To",placeholder:"End of range (inclusive)",value:e.spec?.to??"",onChange:n=>t({...e,spec:{...e.spec,to:""===n.target.value?void 0:+n.target.value}}),fullWidth:!0})]});case"Regex":return(0,T.jsx)(U.Z,{gap:1,direction:"row",...n,children:(0,T.jsx)(Y.Z,{label:"Regular Expression",placeholder:"JavaScript regular expression",value:e.spec?.pattern??"",onChange:n=>t({...e,spec:{...e.spec,pattern:n.target.value}}),fullWidth:!0})});case"Misc":return(0,T.jsx)(U.Z,{gap:1,direction:"row",...n,children:(0,T.jsxs)(Y.Z,{select:!0,label:"Value",value:e.spec?.value??"",onChange:n=>t({...e,spec:{value:n.target.value}}),SelectProps:{renderValue:e=>{switch(e){case"empty":return"Empty";case"null":return"Null";case"NaN":return"NaN";case"true":return"True";case"false":return"False";default:return String(e)}}},fullWidth:!0,children:[(0,T.jsx)(ag.Z,{value:"empty",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"Empty"}),(0,T.jsx)(sv.Z,{variant:"caption",children:"Matches empty string"})]})}),(0,T.jsx)(ag.Z,{value:"null",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"Null"}),(0,T.jsx)(sv.Z,{variant:"caption",children:"Matches null or undefined"})]})}),(0,T.jsx)(ag.Z,{value:"NaN",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"NaN"}),(0,T.jsx)(sv.Z,{variant:"caption",children:"Matches Not a Number value"})]})}),(0,T.jsx)(ag.Z,{value:"true",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"True"}),(0,T.jsx)(sv.Z,{variant:"caption",children:"Matches true boolean"})]})}),(0,T.jsx)(ag.Z,{value:"false",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"False"}),(0,T.jsx)(sv.Z,{variant:"caption",children:"Matches false boolean"})]})})]})});default:return null}},Rl=({mapping:e,onChange:t,onDelete:n,...r})=>{let i=n=>{t({...e,spec:{...e.spec,result:{...e.spec.result,color:n}}})};return(0,T.jsxs)(Ro,{container:!0,spacing:2,...r,children:[(0,T.jsx)(Ro,{size:{xs:5},children:(0,T.jsxs)(U.Z,{direction:"row",gap:1,width:"100%",children:[(0,T.jsxs)(Y.Z,{select:!0,label:"Type",value:e.kind,onChange:n=>t({...e,kind:n.target.value}),required:!0,sx:{width:"120px"},children:[(0,T.jsx)(ag.Z,{value:"Value",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"Value"}),"Value"!==e.kind&&(0,T.jsx)(sv.Z,{variant:"caption",children:"Matches an exact text value"})]})}),(0,T.jsx)(ag.Z,{value:"Range",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"Range"}),"Range"!==e.kind&&(0,T.jsx)(sv.Z,{variant:"caption",children:"Matches against a numerical range"})]})}),(0,T.jsx)(ag.Z,{value:"Regex",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"Regex"}),"Regex"!==e.kind&&(0,T.jsx)(sv.Z,{variant:"caption",children:"Matches against a regular expression"})]})}),(0,T.jsx)(ag.Z,{value:"Misc",children:(0,T.jsxs)(U.Z,{children:[(0,T.jsx)(sv.Z,{children:"Misc"}),"Misc"!==e.kind&&(0,T.jsx)(sv.Z,{variant:"caption",children:"Matches against empty, null and NaN values"})]})})]}),(0,T.jsx)(Rs,{width:"100%",mapping:e,onChange:n=>t({...e,...n})})]})}),(0,T.jsx)(Ro,{size:{xs:4},children:(0,T.jsx)(Y.Z,{label:"Display text",value:e.spec?.result?.value??"",onChange:n=>t({...e,spec:{...e.spec,result:{...e.spec?.result,value:n.target.value}}}),fullWidth:!0})}),(0,T.jsx)(Ro,{size:{xs:1},children:(0,T.jsx)(U.Z,{direction:"row",justifyContent:"center",gap:1,children:e.spec?.result?.color?(0,T.jsx)(na,{label:"Color",color:e.spec.result.color??"#000",onColorChange:i,onClear:()=>i(void 0)}):(0,T.jsx)(K.Z,{onClick:()=>i("#000"),children:(0,T.jsx)(ww.default,{})})})}),(0,T.jsx)(Ro,{size:{xs:1},textAlign:"end",children:(0,T.jsx)(ld.Z,{title:"Remove mapping settings",placement:"top",children:(0,T.jsx)(K.Z,{size:"small",sx:{marginLeft:"auto"},onClick:n,children:(0,T.jsx)(wq.default,{})})})})]})},Ra=({mappings:e,onChange:t})=>{let[n,r]=(0,D.useState)(e);return(0,T.jsxs)(U.Z,{spacing:1,children:[(0,T.jsxs)(Ro,{container:!0,spacing:2,children:[(0,T.jsx)(Ro,{size:{xs:5},children:(0,T.jsx)(sv.Z,{variant:"subtitle1",children:"Condition"})}),(0,T.jsx)(Ro,{size:{xs:4},children:(0,T.jsx)(sv.Z,{variant:"subtitle1",children:"Display Text"})}),(0,T.jsx)(Ro,{size:{xs:1},textAlign:"center",children:(0,T.jsx)(sv.Z,{variant:"subtitle1",children:"Color"})}),(0,T.jsx)(Ro,{size:{xs:1}})]}),(0,T.jsx)(U.Z,{gap:1.5,divider:(0,T.jsx)(ca.Z,{flexItem:!0,orientation:"horizontal"}),children:n.map((e,i)=>(0,T.jsx)(Rl,{mapping:e,onChange:e=>(function(e,i){let o=[...n];o[e]=i,r(o),t(o)})(i,e),onDelete:()=>(function(e){let i=[...n];i.splice(e,1),r(i),t(i)})(i)},i))}),(0,T.jsx)(q.Z,{variant:"contained",startIcon:(0,T.jsx)(ww.default,{}),sx:{marginTop:1},onClick:function(){let e=[...n];e.push({kind:"Value",spec:{result:{value:""}}}),r(e),t(e)},children:"Add value mappings"})]})}},49966:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.bindAll=void 0;var i=n(63778);function o(e){if(void 0!==e)return"boolean"==typeof e?{capture:e}:e}t.bindAll=function(e,t,n){var s=t.map(function(t){var s=null==n?t:r(r({},t),{options:r(r({},o(n)),o(t.options))});return(0,i.bind)(e,s)});return function(){s.forEach(function(e){return e()})}}},63778:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bind=void 0,t.bind=function(e,t){var n=t.type,r=t.listener,i=t.options;return e.addEventListener(n,r,i),function(){e.removeEventListener(n,r,i)}}},70501:function(e,t,n){"use strict";t.bindAll=t.bind=void 0;var r=n(63778);Object.defineProperty(t,"bind",{enumerable:!0,get:function(){return r.bind}});var i=n(49966);Object.defineProperty(t,"bindAll",{enumerable:!0,get:function(){return i.bindAll}})},79349:function(e){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},73140:function(e,t,n){var r=n(88799),i=n(85638);e.exports=function(e,t,n){(void 0===n||i(e[t],n))&&(void 0!==n||t in e)||r(e,t,n)}},71928:function(e,t,n){var r=n(88799),i=n(85638),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var s=e[t];o.call(e,t)&&i(s,n)&&(void 0!==n||t in e)||r(e,t,n)}},88799:function(e,t,n){var r=n(42630);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},80158:function(e,t,n){var r=n(11611),i=Object.create;e.exports=function(){function e(){}return function(t){if(!r(t))return{};if(i)return i(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}()},49819:function(e,t,n){e.exports=n(18911)()},59464:function(e,t,n){var r=n(11611),i=n(56016),o=n(21586),s=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=i(e),n=[];for(var l in e)"constructor"==l&&(t||!s.call(e,l))||n.push(l);return n}},40015:function(e,t,n){var r=n(23694),i=n(73140),o=n(49819),s=n(68867),l=n(11611),a=n(53893),c=n(97494);e.exports=function e(t,n,u,h,d){t!==n&&o(n,function(o,a){if(d||(d=new r),l(o))s(t,n,a,u,e,h,d);else{var f=h?h(c(t,a),o,a+"",t,n,d):void 0;void 0===f&&(f=o),i(t,a,f)}},a)}},68867:function(e,t,n){var r=n(73140),i=n(2734),o=n(63428),s=n(37561),l=n(97635),a=n(2900),c=n(19785),u=n(36468),h=n(43854),d=n(28338),f=n(11611),p=n(40861),m=n(48519),g=n(97494),v=n(89328);e.exports=function(e,t,n,b,y,x,w){var C=g(e,n),S=g(t,n),k=w.get(S);if(k)return void r(e,n,k);var M=x?x(C,S,n+"",e,t,w):void 0,T=void 0===M;if(T){var D=c(S),A=!D&&h(S),R=!D&&!A&&m(S);M=S,D||A||R?c(C)?M=C:u(C)?M=s(C):A?(T=!1,M=i(S,!0)):R?(T=!1,M=o(S,!0)):M=[]:p(S)||a(S)?(M=C,a(C)?M=v(C):(!f(C)||d(C))&&(M=l(S))):T=!1}T&&(w.set(S,M),y(M,S,b,x,w),w.delete(S)),r(e,n,M)}},1197:function(e,t,n){var r=n(31137),i=n(11871),o=n(63132);e.exports=function(e,t){return o(i(e,t,r),e+"")}},54459:function(e,t,n){var r=n(551),i=n(42630),o=n(31137);e.exports=i?function(e,t){return i(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:o},74833:function(e,t,n){var r=n(56127),i=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(i,""):e}},95825:function(e,t,n){var r=n(59942);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},2734:function(e,t,n){e=n.nmd(e);var r=n(77400),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,s=o&&o.exports===i?r.Buffer:void 0,l=s?s.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=l?l(n):new e.constructor(n);return e.copy(r),r}},63428:function(e,t,n){var r=n(95825);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},37561:function(e){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},35159:function(e,t,n){var r=n(71928),i=n(88799);e.exports=function(e,t,n,o){var s=!n;n||(n={});for(var l=-1,a=t.length;++l<a;){var c=t[l],u=o?o(n[c],e[c],c,n,e):void 0;void 0===u&&(u=e[c]),s?i(n,c,u):r(n,c,u)}return n}},7270:function(e,t,n){var r=n(1197),i=n(57535);e.exports=function(e){return r(function(t,n){var r=-1,o=n.length,s=o>1?n[o-1]:void 0,l=o>2?n[2]:void 0;for(s=e.length>3&&"function"==typeof s?(o--,s):void 0,l&&i(n[0],n[1],l)&&(s=o<3?void 0:s,o=1),t=Object(t);++r<o;){var a=n[r];a&&e(t,a,r,s)}return t})}},18911:function(e){e.exports=function(e){return function(t,n,r){for(var i=-1,o=Object(t),s=r(t),l=s.length;l--;){var a=s[e?l:++i];if(!1===n(o[a],a,o))break}return t}}},42630:function(e,t,n){var r=n(81822);e.exports=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}()},2173:function(e,t,n){e.exports=n(58023)(Object.getPrototypeOf,Object)},97635:function(e,t,n){var r=n(80158),i=n(2173),o=n(56016);e.exports=function(e){return"function"!=typeof e.constructor||o(e)?{}:r(i(e))}},57535:function(e,t,n){var r=n(85638),i=n(80068),o=n(42383),s=n(11611);e.exports=function(e,t,n){if(!s(n))return!1;var l=typeof t;return("number"==l?!!(i(n)&&o(t,n.length)):"string"==l&&t in n)&&r(n[t],e)}},21586:function(e){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},11871:function(e,t,n){var r=n(79349),i=Math.max;e.exports=function(e,t,n){return t=i(void 0===t?e.length-1:t,0),function(){for(var o=arguments,s=-1,l=i(o.length-t,0),a=Array(l);++s<l;)a[s]=o[t+s];s=-1;for(var c=Array(t+1);++s<t;)c[s]=o[s];return c[t]=n(a),r(e,this,c)}}},97494:function(e){e.exports=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}},63132:function(e,t,n){var r=n(54459);e.exports=n(49591)(r)},49591:function(e){var t=Date.now;e.exports=function(e){var n=0,r=0;return function(){var i=t(),o=16-(i-r);if(r=i,o>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},56127:function(e){var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},551:function(e){e.exports=function(e){return function(){return e}}},66726:function(e,t,n){var r=n(11611),i=n(82846),o=n(91936),s=Math.max,l=Math.min;e.exports=function(e,t,n){var a,c,u,h,d,f,p=0,m=!1,g=!1,v=!0;if("function"!=typeof e)throw TypeError("Expected a function");function b(t){var n=a,r=c;return a=c=void 0,p=t,h=e.apply(r,n)}function y(e){var n=e-f,r=e-p;return void 0===f||n>=t||n<0||g&&r>=u}function x(){var e,n,r,o=i();if(y(o))return w(o);d=setTimeout(x,(e=o-f,n=o-p,r=t-e,g?l(r,u-n):r))}function w(e){return(d=void 0,v&&a)?b(e):(a=c=void 0,h)}function C(){var e,n=i(),r=y(n);if(a=arguments,c=this,f=n,r){if(void 0===d)return p=e=f,d=setTimeout(x,t),m?b(e):h;if(g)return clearTimeout(d),d=setTimeout(x,t),b(f)}return void 0===d&&(d=setTimeout(x,t)),h}return t=o(t)||0,r(n)&&(m=!!n.leading,u=(g="maxWait"in n)?s(o(n.maxWait)||0,t):u,v="trailing"in n?!!n.trailing:v),C.cancel=function(){void 0!==d&&clearTimeout(d),p=0,a=f=c=d=void 0},C.flush=function(){return void 0===d?h:w(i())},C}},31137:function(e){e.exports=function(e){return e}},36468:function(e,t,n){var r=n(80068),i=n(92360);e.exports=function(e){return i(e)&&r(e)}},40861:function(e,t,n){var r=n(99736),i=n(2173),o=n(92360),s=Object.prototype,l=Function.prototype.toString,a=s.hasOwnProperty,c=l.call(Object);e.exports=function(e){if(!o(e)||"[object Object]"!=r(e))return!1;var t=i(e);if(null===t)return!0;var n=a.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&l.call(n)==c}},55193:function(e,t,n){var r=n(99736),i=n(92360);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==r(e)}},53893:function(e,t,n){var r=n(98213),i=n(59464),o=n(80068);e.exports=function(e){return o(e)?r(e,!0):i(e)}},15409:function(e,t,n){var r=n(40015);e.exports=n(7270)(function(e,t,n){r(e,t,n)})},82846:function(e,t,n){var r=n(77400);e.exports=function(){return r.Date.now()}},91936:function(e,t,n){var r=n(74833),i=n(11611),o=n(55193),s=0/0,l=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return s;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=a.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):l.test(e)?s:+e}},89328:function(e,t,n){var r=n(35159),i=n(53893);e.exports=function(e){return r(e,i(e))}},59986:function(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(30265))&&r.__esModule?r:{default:r}).default)("M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H18V1M17,12H12V17H17V12Z","Calendar")},20791:function(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(30265))&&r.__esModule?r:{default:r}).default)("M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z","Circle")},80354:function(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(30265))&&r.__esModule?r:{default:r}).default)("M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z","Delete")},11682:function(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(30265))&&r.__esModule?r:{default:r}).default)("M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z","Drag")},28418:function(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(30265))&&r.__esModule?r:{default:r}).default)("M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z","EyeOffOutline")},57689:function(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(30265))&&r.__esModule?r:{default:r}).default)("M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z","EyeOutline")},1889:function(e,t,n){"use strict";var r;t.default=void 0,t.default=(0,((r=n(30265))&&r.__esModule?r:{default:r}).default)("M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12Z","Pin")},68715:function(e,t,n){(function(e,t){"use strict";var n=function(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}(t);function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var i={error:null},o=function(e){function t(){for(var t,n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state=i,t.resetErrorBoundary=function(){for(var e,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];null==t.props.onReset||(e=t.props).onReset.apply(e,r),t.reset()},t}t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r(t,e),t.getDerivedStateFromError=function(e){return{error:e}};var o=t.prototype;return o.reset=function(){this.setState(i)},o.componentDidCatch=function(e,t){var n,r;null==(n=(r=this.props).onError)||n.call(r,e,t)},o.componentDidUpdate=function(e,t){var n,r,i,o,s=this.state.error,l=this.props.resetKeys;null!==s&&null!==t.error&&(void 0===(n=e.resetKeys)&&(n=[]),void 0===(r=l)&&(r=[]),n.length!==r.length||n.some(function(e,t){return!Object.is(e,r[t])}))&&(null==(i=(o=this.props).onResetKeysChange)||i.call(o,e.resetKeys,l),this.reset())},o.render=function(){var e=this.state.error,t=this.props,r=t.fallbackRender,i=t.FallbackComponent,o=t.fallback;if(null!==e){var s={error:e,resetErrorBoundary:this.resetErrorBoundary};if(n.isValidElement(o))return o;if("function"==typeof r)return r(s);if(i)return n.createElement(i,s);else throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},t}(n.Component);e.ErrorBoundary=o,e.useErrorHandler=function(e){var t=n.useState(null),r=t[0],i=t[1];if(null!=e)throw e;if(null!=r)throw r;return i},e.withErrorBoundary=function(e,t){var r=function(r){return n.createElement(o,t,n.createElement(e,r))};return r.displayName="withErrorBoundary("+(e.displayName||e.name||"Unknown")+")",r},Object.defineProperty(e,"__esModule",{value:!0})})(t,n(54538))}}]);