@perses-dev/bar-chart-plugin 0.6.1 → 0.7.1

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 (31) hide show
  1. package/__mf/js/{590.402be2ef.js → 590.974b67e0.js} +1 -1
  2. package/__mf/js/{BarChart.2c8c7b6f.js → BarChart.cab6ddce.js} +3 -3
  3. package/__mf/js/async/409.cb75bf15.js +1 -0
  4. package/__mf/js/async/533.531bfcd1.js +29 -0
  5. package/__mf/js/async/{802.393c9711.js → 640.968c5b1b.js} +2 -2
  6. package/__mf/js/async/65.4b20c67b.js +73 -0
  7. package/__mf/js/async/679.4c9ca4ca.js +2 -0
  8. package/__mf/js/async/922.599a817c.js +1 -0
  9. package/__mf/js/async/__federation_expose_BarChart.57f5aba0.js +1 -0
  10. package/__mf/js/main.9a1e6d55.js +1 -0
  11. package/lib/BarChartBase.d.ts +16 -0
  12. package/lib/BarChartBase.d.ts.map +1 -0
  13. package/lib/BarChartBase.js +132 -0
  14. package/lib/BarChartBase.js.map +1 -0
  15. package/lib/BarChartPanel.d.ts.map +1 -1
  16. package/lib/BarChartPanel.js +3 -2
  17. package/lib/BarChartPanel.js.map +1 -1
  18. package/lib/cjs/BarChartBase.js +140 -0
  19. package/lib/cjs/BarChartPanel.js +2 -1
  20. package/mf-manifest.json +20 -18
  21. package/mf-stats.json +20 -18
  22. package/package.json +4 -4
  23. package/__mf/js/async/162.5c4c80cc.js +0 -73
  24. package/__mf/js/async/360.49d19c17.js +0 -29
  25. package/__mf/js/async/610.4fdfae13.js +0 -1
  26. package/__mf/js/async/996.2287354b.js +0 -2
  27. package/__mf/js/async/__federation_expose_BarChart.7c81d310.js +0 -1
  28. package/__mf/js/main.7fe4eedc.js +0 -1
  29. /package/__mf/js/async/{360.49d19c17.js.LICENSE.txt → 533.531bfcd1.js.LICENSE.txt} +0 -0
  30. /package/__mf/js/async/{162.5c4c80cc.js.LICENSE.txt → 65.4b20c67b.js.LICENSE.txt} +0 -0
  31. /package/__mf/js/async/{996.2287354b.js.LICENSE.txt → 679.4c9ca4ca.js.LICENSE.txt} +0 -0
@@ -1,29 +0,0 @@
1
- /*! For license information please see 360.49d19c17.js.LICENSE.txt */
2
- (self.webpackChunkBarChart=self.webpackChunkBarChart||[]).push([["360"],{13425:function(e,t,n){"use strict";let r,i,o,s;n.r(t),n.d(t,{ErrorAlert:()=>au,JSONEditor:()=>bE,INCREASE_NEARBY_SERIES_MULTIPLIER:()=>xC,OptionsEditorGroup:()=>xG,DensitySelector:()=>o5,assembleTransform:()=>xP,clearHighlightedSeries:()=>xv,getColorsForValues:()=>Nt,ErrorBoundary:()=>ac.ErrorBoundary,SeriesMarker:()=>xi,TimeRangeSelector:()=>R7,testChartsTheme:()=>Iw,ChartsThemeContext:()=>G,TextOverlay:()=>xK,hexToHSL:()=>Nn,DEFAULT_COLUMN_HEIGHT:()=>ou,useMousePosition:()=>b6,NoDataOverlay:()=>xY,generateChartsTheme:()=>Iy,OptionsEditorGrid:()=>xq,OPTIMIZED_MODE_SERIES_LIMIT:()=>xd,TOOLTIP_ADJUST_Y_POS_MULTIPLIER:()=>bK,DiscardChangesConfirmationDialog:()=>o_,getDateRange:()=>ec,EMPHASIZED_SERIES_DESCRIPTION:()=>bJ,useChartsTheme:()=>K,persesColumnsToTanstackColumns:()=>oh,mockChartsContext:()=>IS,Legend:()=>oO,TOOLTIP_DATE_FORMAT:()=>b1,TOOLTIP_MAX_WIDTH:()=>bq,dateFormatOptionsWithTimeZone:()=>bF,legacyCheckforNearbySeries:()=>xA,ToolbarIconButton:()=>Pt,PIN_TOOLTIP_HELP_TEXT:()=>b7,checkforNearbyTimeSeries:()=>xT,getTheme:()=>I_,PieChart:()=>I3,TooltipHeader:()=>xh,TOOLTIP_BG_COLOR_FALLBACK:()=>b0,UNPIN_TOOLTIP_HELP_TEXT:()=>xe,DateTimeRangePicker:()=>R9,handleMoveUp:()=>sU,browser:()=>b3,getClosestTimestamp:()=>xw,formatWithTimeZone:()=>bZ,batchDispatchNearbySeriesActions:()=>xb,getFormattedAxis:()=>eu,useTimeZone:()=>b$,ChartsProvider:()=>q,isWithinPercentageRange:()=>xO,TOOLTIP_MIN_WIDTH:()=>bW,StatusHistoryChart:()=>I9,TOOLTIP_LABELS_MAX_WIDTH:()=>bU,getYBuffer:()=>xR,DEFAULT_PINNED_CROSSHAIR:()=>xp,LineChartTooltip:()=>xN,FormatControls:()=>Po,TooltipContent:()=>xa,hslToHex:()=>Nr,SHOW_FEWER_SERIES_LIMIT:()=>xM,TimeChartTooltip:()=>kU,getClosestTimestampInFullDataset:()=>xS,getTableCellLayout:()=>oc,pointerEventsSupported:()=>b4,EChart:()=>es,PINNED_CROSSHAIR_SERIES_NAME:()=>xf,SortSelector:()=>xJ,SnackbarProvider:()=>Im,Drawer:()=>aa,AlignSelector:()=>L,LinksEditor:()=>xV,ValueMappingsEditor:()=>NR,TimeZoneContext:()=>b_,GaugeChart:()=>ag,LineChart:()=>xj,SeriesLabelsStack:()=>xo,checkCrosshairPinnedStatus:()=>xx,StatChart:()=>x5,SeriesInfo:()=>xs,ColorPicker:()=>eq,Table:()=>oM,useSnackbar:()=>Ig,InfoTooltip:()=>oK,TimeZoneProvider:()=>bH,LoadingOverlay:()=>xX,typography:()=>IV,Dialog:()=>oz,DropIndicator:()=>o3,TransformsEditor:()=>I1,OptionsEditorControl:()=>oQ,TOOLTIP_PADDING:()=>bY,getFormattedAxisLabel:()=>bV,SortSelectorButtons:()=>x0,getTooltipStyles:()=>xI,useChartsContext:()=>U,RefreshIntervalPicker:()=>I2,enableDataZoom:()=>xm,useDragAndDropMonitor:()=>sH,trackingEventName:()=>b8,combineSx:()=>ir,OptionsEditorColumn:()=>xW,getDateAndTime:()=>bz,ThresholdsEditor:()=>wd,DEFAULT_TOOLTIP_CONFIG:()=>b9,handleMoveDown:()=>sK,DragButton:()=>sY,useId:()=>oq,ContentWithLegend:()=>oP,BarChart:()=>eh,getFormattedDate:()=>bB,NEARBY_SERIES_DESCRIPTION:()=>bQ,getColorForValue:()=>Ne,isLegendItemVisuallySelected:()=>ia,getPointInGrid:()=>xy,EMPTY_TOOLTIP_DATA:()=>b5,legacyGetNearbySeriesData:()=>xE,buildRelativeTimeOption:()=>Ib,SettingsAutocomplete:()=>o1,FontSizeSelector:()=>ad,defaultCursorData:()=>b2,DYNAMIC_NEARBY_SERIES_MULTIPLIER:()=>xk,FALLBACK_COLOR:()=>I7,getNearbySeriesData:()=>xD,TOOLTIP_MAX_HEIGHT:()=>bG,YAxisLabel:()=>Ps,TimeChart:()=>kK,FALLBACK_CHART_WIDTH:()=>bX,DragAndDropElement:()=>s$,getResponsiveValueSize:()=>av,restoreChart:()=>xg,ModeSelector:()=>xH,TextField:()=>oI,DEFAULT_COLUMN_WIDTH:()=>ol,FormActions:()=>ap,OptionsColorPicker:()=>eK});var a,l,u,c,h,d,f,p=n(24246),m=n(8218),g=n.n(m),v=n(90496),y=n(82267),b=n(16838);function x(e){return m.Children.toArray(e).filter(e=>m.isValidElement(e))}var w=n(51640),S=n(12709),C=n(82319),k=n(90433),M=n(51751),T=n(44124),A=n(6749);function D(e){return(0,A.ZP)("MuiButtonGroup",e)}let E=(0,T.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 O=n(55720),R=n(71645);let P=e=>{let{classes:t,color:n,disabled:r,disableElevation:i,fullWidth:o,orientation:s,variant:a}=e,l={root:["root",a,s,o&&"fullWidth",i&&"disableElevation",`color${(0,w.Z)(n)}`],grouped:["grouped",`grouped${(0,w.Z)(s)}`,`grouped${(0,w.Z)(a)}`,`grouped${(0,w.Z)(a)}${(0,w.Z)(s)}`,`grouped${(0,w.Z)(a)}${(0,w.Z)(n)}`,r&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return(0,y.Z)(l,D,t)},I=(0,S.ZP)("div",{name:"MuiButtonGroup",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${E.grouped}`]:t.grouped},{[`& .${E.grouped}`]:t[`grouped${(0,w.Z)(n.orientation)}`]},{[`& .${E.grouped}`]:t[`grouped${(0,w.Z)(n.variant)}`]},{[`& .${E.grouped}`]:t[`grouped${(0,w.Z)(n.variant)}${(0,w.Z)(n.orientation)}`]},{[`& .${E.grouped}`]:t[`grouped${(0,w.Z)(n.variant)}${(0,w.Z)(n.color)}`]},{[`& .${E.firstButton}`]:t.firstButton},{[`& .${E.lastButton}`]:t.lastButton},{[`& .${E.middleButton}`]:t.middleButton},t.root,t[n.variant],!0===n.disableElevation&&t.disableElevation,n.fullWidth&&t.fullWidth,"vertical"===n.orientation&&t.vertical]}})((0,C.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",[`& .${E.lastButton},& .${E.middleButton}`]:{borderTopRightRadius:0,borderTopLeftRadius:0},[`& .${E.firstButton},& .${E.middleButton}`]:{borderBottomRightRadius:0,borderBottomLeftRadius:0}}},{props:{orientation:"horizontal"},style:{[`& .${E.firstButton},& .${E.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${E.lastButton},& .${E.middleButton}`]:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}},{props:{variant:"text",orientation:"horizontal"},style:{[`& .${E.firstButton},& .${E.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)"}`,[`&.${E.disabled}`]:{borderRight:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},{props:{variant:"text",orientation:"vertical"},style:{[`& .${E.firstButton},& .${E.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)"}`,[`&.${E.disabled}`]:{borderBottom:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},...Object.entries(e.palette).filter((0,k.Z)()).flatMap(([t])=>[{props:{variant:"text",color:t},style:{[`& .${E.firstButton},& .${E.middleButton}`]:{borderColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / 0.5)`:(0,b.Fq)(e.palette[t].main,.5)}}}]),{props:{variant:"outlined",orientation:"horizontal"},style:{[`& .${E.firstButton},& .${E.middleButton}`]:{borderRightColor:"transparent","&:hover":{borderRightColor:"currentColor"}},[`& .${E.lastButton},& .${E.middleButton}`]:{marginLeft:-1}}},{props:{variant:"outlined",orientation:"vertical"},style:{[`& .${E.firstButton},& .${E.middleButton}`]:{borderBottomColor:"transparent","&:hover":{borderBottomColor:"currentColor"}},[`& .${E.lastButton},& .${E.middleButton}`]:{marginTop:-1}}},{props:{variant:"contained",orientation:"horizontal"},style:{[`& .${E.firstButton},& .${E.middleButton}`]:{borderRight:`1px solid ${(e.vars||e).palette.grey[400]}`,[`&.${E.disabled}`]:{borderRight:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},{props:{variant:"contained",orientation:"vertical"},style:{[`& .${E.firstButton},& .${E.middleButton}`]:{borderBottom:`1px solid ${(e.vars||e).palette.grey[400]}`,[`&.${E.disabled}`]:{borderBottom:`1px solid ${(e.vars||e).palette.action.disabled}`}}}},...Object.entries(e.palette).filter((0,k.Z)(["dark"])).map(([t])=>({props:{variant:"contained",color:t},style:{[`& .${E.firstButton},& .${E.middleButton}`]:{borderColor:(e.vars||e).palette[t].dark}}}))],[`& .${E.grouped}`]:{minWidth:40,boxShadow:"none",props:{variant:"contained"},style:{"&:hover":{boxShadow:"none"}}}}))),N=m.forwardRef(function(e,t){let n=(0,M.i)({props:e,name:"MuiButtonGroup"}),{children:r,className:i,color:o="primary",component:s="div",disabled:a=!1,disableElevation:l=!1,disableFocusRipple:u=!1,disableRipple:c=!1,fullWidth:h=!1,orientation:d="horizontal",size:f="medium",variant:g="outlined",...y}=n,b={...n,color:o,component:s,disabled:a,disableElevation:l,disableFocusRipple:u,disableRipple:c,fullWidth:h,orientation:d,size:f,variant:g},w=P(b),S=m.useMemo(()=>({className:w.grouped,color:o,disabled:a,disableElevation:l,disableFocusRipple:u,disableRipple:c,fullWidth:h,size:f,variant:g}),[o,a,l,u,c,h,f,g,w.grouped]),C=x(r),k=C.length,T=e=>{let t=0===e,n=e===k-1;return t&&n?"":t?w.firstButton:n?w.lastButton:w.middleButton};return(0,p.jsx)(I,{as:s,role:"group",className:(0,v.Z)(w.root,i),ref:t,ownerState:b,...y,children:(0,p.jsx)(O.Z.Provider,{value:S,children:C.map((e,t)=>(0,p.jsx)(R.Z.Provider,{value:T(t),children:e},t))})})});var j=n(48565);function L({onChange:e,value:t="left",...n}){let r=t=>{e(t)};return(0,p.jsxs)(N,{"aria-label":"Alignement",...n,children:[(0,p.jsx)(j.Z,{onClick:()=>r("left"),variant:"left"===t?"contained":"outlined",children:"Left"},"left"),(0,p.jsx)(j.Z,{onClick:()=>r("center"),variant:"center"===t?"contained":"outlined",children:"Center"},"center"),(0,p.jsx)(j.Z,{onClick:()=>r("right"),variant:"right"===t?"contained":"outlined",children:"Right"},"right")]})}var F=n(74664),Z=n(36232),B=n(508),V=n(65201),z=n(99635),_=n(23709),H=n(67745),$=n(50378),W=n(36372);function q(e){let{children:t,chartsTheme:n,enablePinning:r=!1}=e,[i,o]=(0,m.useState)(null),s=(0,m.useMemo)(()=>({chartsTheme:n,enablePinning:r,lastTooltipPinnedCoords:i,setLastTooltipPinnedCoords:o}),[n,r,i,o]);return(0,p.jsx)(G.Provider,{value:s,children:t})}let G=(0,m.createContext)(void 0);function U(){let e=(0,m.useContext)(G);if(void 0===e)throw Error("No ChartsThemeContext found. Did you forget a Provider?");return e}function K(){return U().chartsTheme}var Y=n(59161),X=n(56141),Q=n.n(X),J=n(66726),ee=n.n(J),et=n(8890),en=n(48906),er=n(27806);(0,Z.D)([z.N,en.N,er.N,et.N,V.N,_.N,H.N,$.N]);let ei=["click","dblclick","mousedown","mousemove","mouseup","mouseover","mouseout","globalout","contextmenu"],eo=["datazoom","downplay","highlight"],es=(0,m.memo)(function({option:e,theme:t,renderer:n,sx:r,onEvents:i,_instance:o,syncGroup:s,onChartInitialized:a}){let l=(0,m.useRef)(e),u=(0,m.useRef)(e),c=(0,m.useRef)(null),h=(0,m.useRef)(null);return(0,m.useLayoutEffect)(()=>{if(null!==c.current&&null===h.current&&(h.current=(0,Y.S1)(c.current,t,{renderer:n??"canvas"}),void 0!==h.current))return h.current.setOption(l.current,!0),a?.(h.current),void 0!==o&&(o.current=h.current),()=>{null!==h.current&&(h.current.dispose(),h.current=null)}},[o,a,t,n]),(0,m.useEffect)(()=>{h.current&&s&&(h.current.group=s,(0,Y.$j)([h.current]))},[s,h]),(0,m.useEffect)(()=>{!(void 0===u.current||Q()(u.current,e))&&h.current&&(h.current.setOption(e,!0),u.current=e)},[e]),(0,m.useLayoutEffect)(()=>{let e=ee()(()=>{h.current&&h.current.resize()},200);return window.addEventListener("resize",e),e(),()=>{window.removeEventListener("resize",e)}},[]),(0,m.useEffect)(()=>{let e=h.current;if(e&&void 0!==i)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,ei.includes(r))?e.on(t,t=>n(t,e)):(i=t,eo.includes(i))?e.on(t,e=>n(e)):e.on(t,()=>n(null,e)))}(n,r)}}}(e,i),()=>{if(void 0!==e&&!0!==e.isDisposed())for(let t in i)e.off(t)}},[i]),(0,m.useEffect)(()=>{ee()(()=>{h.current&&h.current.resize()},200,{leading:!0})()},[r]),(0,p.jsx)(W.Z,{ref:c,sx:r})});var ea=n(15409),el=n.n(ea);function eu(e,t){return[el()({type:"value",boundaryGap:[0,"10%"],axisLabel:{formatter:e=>(0,F.Bw)(e,t)}},e)]}function ec(e){if(0===e.length)return 36e5;let t=e[e.length-1];return void 0===e[0]||void 0===t?36e5:t-e[0]}function eh(e){let{width:t,height:n,data:r,format:i={unit:"decimal"},mode:o="value"}=e,s=K(),a=(0,m.useMemo)(()=>{if(!r||!r.length)return s.noDataOption;let e=[];return r.map(t=>{e.push([t.label,t.value])}),{title:{show:!1},dataset:[{dimensions:["label","value"],source:e}],xAxis:eu({},i),yAxis:{type:"category",splitLine:{show:!1},axisLabel:{overflow:"truncate",width:t/3}},series:{type:"bar",label:{show:!0,position:"right",formatter:e=>e.data[1]?"percentage"===o?(0,F.Bw)(e.data[1],{unit:"percent",decimalPlaces:i.decimalPlaces}):(0,F.Bw)(e.data[1],i):void 0,barMinWidth:14,barCategoryGap:6},itemStyle:{borderRadius:4,color:s.echartsTheme[0]}},tooltip:{appendToBody:!0,confine:!0,formatter:e=>e.data[1]&&`<b>${e.name}</b> &emsp; ${(0,F.Bw)(e.data[1],i)}`},grid:{left:"5%",right:"5%"}}},[r,s,t,o,i]);return(0,p.jsx)(W.Z,{style:{width:t,height:n},sx:{overflow:"auto"},children:(0,p.jsx)(es,{sx:{minHeight:n,height:r?20*r.length:"100%"},option:a,theme:s.echartsTheme})})}(0,Z.D)([B.N,V.N,z.N,_.N,H.N,$.N]);var ed=n(25283),ef=n(75094),ep=n(8695);function em(){return(em=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 eg(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 ev(e){var t=(0,m.useRef)(e),n=(0,m.useRef)(function(e){t.current&&t.current(e)});return t.current=e,n.current}var ey,eb=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e<t?t:e},ex=function(e){return"touches"in e},ew=function(e){return e&&e.ownerDocument.defaultView||self},eS=function(e,t,n){var r=e.getBoundingClientRect(),i=ex(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:eb((i.pageX-(r.left+ew(e).pageXOffset))/r.width),top:eb((i.pageY-(r.top+ew(e).pageYOffset))/r.height)}},eC=function(e){ex(e)||e.preventDefault()},ek=m.memo(function(e){var t=e.onMove,n=e.onKey,r=eg(e,["onMove","onKey"]),i=(0,m.useRef)(null),o=ev(t),s=ev(n),a=(0,m.useRef)(null),l=(0,m.useRef)(!1),u=(0,m.useMemo)(function(){var e=function(e){eC(e),(ex(e)?e.touches.length>0:e.buttons>0)&&i.current?o(eS(i.current,e,a.current)):n(!1)},t=function(){return n(!1)};function n(n){var r=l.current,o=ew(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&&(eC(t),(!l.current||ex(t))&&r)){if(ex(t)){l.current=!0;var s=t.changedTouches||[];s.length&&(a.current=s[0].identifier)}r.focus(),o(eS(r,t,a.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]),c=u[0],h=u[1],d=u[2];return(0,m.useEffect)(function(){return d},[d]),m.createElement("div",em({},r,{onTouchStart:c,onMouseDown:c,className:"react-colorful__interactive",ref:i,onKeyDown:h,tabIndex:0,role:"slider"}))}),eM=function(e){return e.filter(Boolean).join(" ")},eT=function(e){var t=e.color,n=e.left,r=e.top,i=eM(["react-colorful__pointer",e.className]);return m.createElement("div",{className:i,style:{top:100*(void 0===r?.5:r)+"%",left:100*n+"%"}},m.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},eA=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n},eD=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?eA(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?eA(parseInt(e.substring(6,8),16)/255,2):1}},eE=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:eA(e.h),s:eA(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:eA(i/2),a:eA(r,2)}},eO=function(e){var t=eE(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},eR=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),a=r*(1-(t-o)*n),l=r*(1-(1-t+o)*n),u=o%6;return{r:eA(255*[r,a,s,s,l,r][u]),g:eA(255*[l,r,r,a,s,s][u]),b:eA(255*[s,s,l,r,r,a][u]),a:eA(i,2)}},eP=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},eI=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,o=i<1?eP(eA(255*i)):"";return"#"+eP(t)+eP(n)+eP(r)+o},eN=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),a=s?o===t?(n-r)/s:o===n?2+(r-t)/s:4+(t-n)/s:0;return{h:eA(60*(a<0?a+6:a)),s:eA(o?s/o*100:0),v:eA(o/255*100),a:i}},ej=m.memo(function(e){var t=e.hue,n=e.onChange,r=eM(["react-colorful__hue",e.className]);return m.createElement("div",{className:r},m.createElement(ek,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:eb(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":eA(t),"aria-valuemax":"360","aria-valuemin":"0"},m.createElement(eT,{className:"react-colorful__hue-pointer",left:t/360,color:eO({h:t,s:100,v:100,a:1})})))}),eL=m.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:eO({h:t.h,s:100,v:100,a:1})};return m.createElement("div",{className:"react-colorful__saturation",style:r},m.createElement(ek,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:eb(t.s+100*e.left,0,100),v:eb(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+eA(t.s)+"%, Brightness "+eA(t.v)+"%"},m.createElement(eT,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:eO(t)})))}),eF=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},eZ="undefined"!=typeof window?m.useLayoutEffect:m.useEffect,eB=new Map,eV=function(e){eZ(function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!eB.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}',eB.set(t,r);var i=ey||n.nc;i&&r.setAttribute("nonce",i),t.head.appendChild(r)}},[])},ez=function(e){var t,n,r,i,o,s=e.className,a=e.colorModel,l=e.color,u=void 0===l?a.defaultColor:l,c=e.onChange,h=eg(e,["className","colorModel","color","onChange"]),d=(0,m.useRef)(null);eV(d);var f=(t=ev(c),r=(n=(0,m.useState)(function(){return a.toHsva(u)}))[0],i=n[1],o=(0,m.useRef)({color:u,hsva:r}),(0,m.useEffect)(function(){if(!a.equal(u,o.current.color)){var e=a.toHsva(u);o.current={hsva:e,color:u},i(e)}},[u,a]),(0,m.useEffect)(function(){var e;eF(r,o.current.hsva)||a.equal(e=a.fromHsva(r),o.current.color)||(o.current={hsva:r,color:e},t(e))},[r,a,t]),[r,(0,m.useCallback)(function(e){i(function(t){return Object.assign({},t,e)})},[])]),p=f[0],g=f[1],v=eM(["react-colorful",s]);return m.createElement("div",em({},h,{ref:d,className:v}),m.createElement(eL,{hsva:p,onChange:g}),m.createElement(ej,{hue:p.h,onChange:g,className:"react-colorful__last-control"}))},e_={defaultColor:"000",toHsva:function(e){return eN(eD(e))},fromHsva:function(e){return eI(eR({h:e.h,s:e.s,v:e.v,a:1}))},equal:function(e,t){return e.toLowerCase()===t.toLowerCase()||eF(eD(e),eD(t))}},eH=function(e){return m.createElement(ez,em({},e,{colorModel:e_}))},e$=n(20791),eW=n(80354);let eq=({color:e,onChange:t,onClear:n,palette:r})=>{let[i,o]=(0,m.useState)(e),s=e=>{o(e),t?.(e)};return(0,p.jsxs)(ed.Z,{spacing:1,children:[(0,p.jsx)(eH,{color:e,onChange:s,style:{width:"100%"}}),(0,p.jsx)(ed.Z,{direction:"row",flexWrap:"wrap",justifyContent:"space-evenly",width:"200px",children:r&&r.map((e,t)=>(0,p.jsx)(ef.Z,{size:"small","aria-label":`change color to ${e}`,sx:{color:e},onClick:()=>s(e),children:(0,p.jsx)(e$.default,{})},t))}),(0,p.jsxs)(ed.Z,{direction:"row",gap:1,alignItems:"center",children:[(0,p.jsx)(ep.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}`),eG(e.target.value)&&t?.(e.target.value)}}),n&&(0,p.jsx)(ef.Z,{onClick:n,children:(0,p.jsx)(eW.default,{})})]})]})},eG=(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 eU=n(6714);function eK({label:e,color:t,onColorChange:n,onClear:r}){let[i,o]=(0,m.useState)(null),s=!!i,{thresholds:{defaultColor:a,palette:l}}=K();return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eY,{size:"small","aria-label":`change ${e} color`,isSelected:s,iconColor:t,onClick:e=>{o(e.currentTarget)},children:(0,p.jsx)(e$.default,{})}),(0,p.jsx)(eU.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,p.jsx)(eq,{color:t,palette:[a,...l],onChange:n,onClear:r})})]})}let eY=(0,S.ZP)(ef.Z,{shouldForwardProp:e=>"isSelected"!==e&&"iconColor"!==e})(({iconColor:e,isSelected:t})=>({backgroundColor:t&&e?`${e}3F`:"undefined",color:e}));var eX=n(94776),eQ=n(8193),eJ=n(99010),e0=n(28830);function e1(e){e()}function e2(e,t){return n=>e(t(n))}function e5(e){return void 0!==e}function e3(){}function e4(e,t){return t(e)}function e8(...e){return e}function e6(e,t){e(0,t)}function e9(e){e(2)}function e7(e){return e(4)}function te(e,t){return e(1,e=>t(0,e))}function tt(e,t){let n=e(1,e=>{n(),t(e)});return n}function tn(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function tr(e,t){return e===t}function ti(e=tr){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function to(e){return t=>n=>{e(n)&&t(n)}}function ts(e){return t=>e2(t,e)}function ta(e){return t=>()=>{t(e)}}function tl(e,...t){let n=function(...e){return t=>e.reduceRight(e4,t)}(...t);return(t,r)=>{switch(t){case 2:e9(e);return;case 1:return e(1,n(r))}}}function tu(e,t){return n=>r=>{n(t=e(t,r))}}function tc(e){return t=>n=>{e>0?e--:t(n)}}function th(e){let t=null,n;return r=>i=>{t=i,n||(n=setTimeout(()=>{n=void 0,r(t)},e))}}function td(...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 a=n;n|=s,t[o]=e,a!==i&&n===i&&r&&(r(),r=null)})}),e=>o=>{let s=()=>{e([o].concat(t))};n===i?s():r=s}}function tf(e){let t=e,n=tm();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function tp(e,t){var n;return te(e,n=tf(t)),n}function tm(){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 tg(e){var t;return te(e,t=tm()),t}function tv(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ty(),singleton:n}}let ty=()=>Symbol();function tb(...e){let t=tm(),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:e9(t);return;case 1:return r===i&&o(n),t(1,o)}}}function tx(e,t=tr){return tl(e,ti(t))}function tw(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(e1)}}(...e.map(e=>e(1,n)))}}}var tS=((s=tS||{})[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s);let tC={0:"debug",3:"error",1:"log",2:"warn"},tk=()=>typeof globalThis>"u"?window:globalThis,tM=tv(()=>{let e=tf(3);return{log:tf((t,n,r=1)=>{var i;r>=(null!=(i=tk().VIRTUOSO_LOG_LEVEL)?i:e7(e))&&console[tC[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function tT(e,t,n){return tA(e,t,n).callbackRef}function tA(e,t,n){let r=m.useRef(null),i=e=>{};if("u">typeof ResizeObserver){let o=m.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 tD(e,t,n,r,i,o,s,a,l){return tA(m.useCallback(n=>{let l=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 a=parseInt(i.dataset.index),l=parseFloat(i.dataset.knownSize),u=t(i,n);if(0===u&&r("Zero-sized element, this should not happen",{child:i},tS.ERROR),u===l)continue;let c=o[o.length-1];0===o.length||c.size!==u||c.endIndex!==a-1?o.push({endIndex:a,size:u,startIndex:a}):o[o.length-1].endIndex++}return o}(n.children,t,a?"offsetWidth":"offsetHeight",i),u=n.parentElement;for(;!u.dataset.virtuosoScroller;)u=u.parentElement;let c="window"===u.lastElementChild.dataset.viewportType,h=s?a?s.scrollLeft:s.scrollTop:c?a?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:a?u.scrollLeft:u.scrollTop;r({scrollHeight:s?a?s.scrollWidth:s.scrollHeight:c?a?document.documentElement.scrollWidth:document.documentElement.scrollHeight:a?u.scrollWidth:u.scrollHeight,scrollTop:Math.max(h,0),viewportHeight:s?a?s.offsetWidth:s.offsetHeight:c?a?window.innerWidth:window.innerHeight:a?u.offsetWidth:u.offsetHeight}),null==o||o(a?tE("column-gap",getComputedStyle(n).columnGap,i):tE("row-gap",getComputedStyle(n).rowGap,i)),null!==l&&e(l)},[e,t,i,o,s,r]),n,l)}function tE(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n(`${e} was not resolved to pixel value correctly`,t,tS.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}function tO(e,t,n){let r=m.useRef(null),i=m.useCallback(n=>{let i,o;if(!(null!=n&&n.offsetParent))return;let s=n.getBoundingClientRect(),a=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:a},e(r.current)},[e,t]),{callbackRef:o,ref:s}=tA(i,!0,n),a=m.useCallback(()=>{i(s.current)},[i,s]);return m.useEffect(()=>{if(!t)return window.addEventListener("scroll",a),window.addEventListener("resize",a),()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a)};{t.addEventListener("scroll",a);let e=new ResizeObserver(()=>{requestAnimationFrame(a)});return e.observe(t),()=>{t.removeEventListener("scroll",a),e.unobserve(t)}}},[a,t]),o}let tR=tv(()=>{let e=tm(),t=tm(),n=tf(0),r=tm(),i=tf(0),o=tm(),s=tm(),a=tf(0),l=tf(0),u=tf(0),c=tf(0),h=tm(),d=tm(),f=tf(!1),p=tf(!1),m=tf(!1);return te(tl(e,ts(({scrollTop:e})=>e)),t),te(tl(e,ts(({scrollHeight:e})=>e)),s),te(t,i),{deviation:n,fixedFooterHeight:u,fixedHeaderHeight:l,footerHeight:c,headerHeight:a,horizontalDirection:p,scrollBy:d,scrollContainerState:e,scrollHeight:s,scrollingInProgress:f,scrollTo:h,scrollTop:t,skipAnimationFrameInResizeObserver:m,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:o}},[],{singleton:!0}),tP={lvl:0};function tI(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:a}=t(e[s]);o.push({end:n-1,start:r,value:i}),r=n,i=a}return o.push({end:1/0,start:r,value:i}),o}function tN(e){return e===tP}function tj(e,t){if(!tN(e))return t===e.k?e.v:t<e.k?tj(e.l,t):tj(e.r,t)}function tL(e,t,n="k"){if(tN(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=tL(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return tL(e.l,t,n)}function tF(e,t,n){return tN(e)?tH(t,n,1):t===e.k?tz(e,{k:t,v:n}):t<e.k?tW(t$(tz(e,{l:tF(e.l,t,n)}))):tW(t$(tz(e,{r:tF(e.r,t,n)})))}function tZ(e,t,n){if(tN(e))return[];let r=tL(e,t)[0];return tI(function e(t,n,r){if(tN(t))return[];let{k:i,l:o,r:s,v:a}=t,l=[];return i>n&&(l=l.concat(e(o,n,r))),i>=n&&i<=r&&l.push({k:i,v:a}),i<=r&&(l=l.concat(e(s,n,r))),l}(e,r,n),({k:e,v:t})=>({index:e,value:t}))}function tB(e){return tN(e)?[]:[...tB(e.l),{k:e.k,v:e.v},...tB(e.r)]}function tV(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(t_(t))return t$(tz(e,{lvl:n-1}));if(!tN(t)&&!tN(t.r))return tz(t.r,{l:tz(t,{r:t.r.l}),lvl:n,r:tz(e,{l:t.r.r,lvl:n-1})});throw Error("Unexpected empty nodes")}if(t_(e))return tW(tz(e,{lvl:n-1}));if(tN(r)||tN(r.l))throw Error("Unexpected empty nodes");{let t=r.l,i=t_(t)?r.lvl-1:r.lvl;return tz(t,{l:tz(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:tW(tz(r,{l:t.r,lvl:i}))})}}function tz(e,t){return tH(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 t_(e){return tN(e)||e.lvl>e.r.lvl}function tH(e,t,n,r=tP,i=tP){return{k:e,l:r,lvl:n,r:i,v:t}}function t$(e){let{l:t}=e;return tN(t)||t.lvl!==e.lvl?e:tz(t,{r:tz(e,{l:t.r})})}function tW(e){let{lvl:t,r:n}=e;return tN(n)||tN(n.r)||n.lvl!==t||n.r.lvl!==t?e:tz(n,{l:tz(e,{r:n.l}),lvl:t+1})}function tq(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function tG(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}let tU=tv(()=>({recalcInProgress:tf(!1)}),[],{singleton:!0});function tK(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 tY(e,t){return Math.round(e.getBoundingClientRect()[t])}function tX(e){return!tN(e.groupOffsetTree)}function tQ({index:e},t){return t===e?0:t<e?-1:1}function tJ({offset:e},t){return t===e?0:t<e?-1:1}function t0(e,t,n){if(0===t.length)return 0;let{index:r,offset:i,size:o}=t[tK(t,e,tQ)],s=e-r,a=o*s+(s-1)*n+i;return a>0?a+n:a}function t1(e,t){if(!tX(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function t2(e,t,n){if("u">typeof e.groupIndex)return t.groupIndices[e.groupIndex]+1;{let r=t1("LAST"===e.index?n:e.index,t);return Math.max(0,r,Math.min(n,r))}}function t5(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,tS.DEBUG);let o=e.sizeTree,s=o,a=0;if(n.length>0&&tN(o)&&2===t.length){let e=t[0].size,r=t[1].size;s=n.reduce((t,n)=>tF(tF(t,n,e),n+1,r),s)}else[s,a]=function(e,t){let n=tN(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:o}=r;if(n=Math.min(n,o),tN(e)){e=tF(e,0,i);continue}let s=tZ(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 a=!1,l=!1;for(let{end:n,start:r,value:o}of s)a?(t>=r||i===o)&&(e=function e(t,n){if(tN(t))return tP;let{k:r,l:i,r:o}=t;if(n!==r)return n<r?tV(tz(t,{l:e(i,n)})):tV(tz(t,{r:e(o,n)}));if(tN(i))return o;if(tN(o))return i;{let[e,n]=function e(t){return tN(t.r)?[t.k,t.v]:e(t.r)}(i);return tV(tz(t,{k:e,l:function e(t){return tN(t.r)?t.l:tV(tz(t,{r:e(t.r)}))}(i),v:n}))}}(e,r)):(l=o!==i,a=!0),n>t&&t>=r&&o!==i&&(e=tF(e,t+1,o));l&&(e=tF(e,o,i))}return[e,n]}(s,t);if(s===o)return e;let{lastIndex:l,lastOffset:u,lastSize:c,offsetTree:h}=t4(e.offsetTree,a,s,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>tF(e,t,t0(t,h,i)),tP),lastIndex:l,lastOffset:u,lastSize:c,offsetTree:h,sizeTree:s}}function t3(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-+(n!==e)}function t4(e,t,n,r){let i=e,o=0,s=0,a=0,l=0;if(0!==t){l=tK(i,t-1,tQ),a=i[l].offset;let e=tL(n,t-1);o=e[0],s=e[1],i.length&&i[l].size===tL(n,t)[1]&&(l-=1),i=i.slice(0,l+1)}else i=[];for(let{start:e,value:l}of tZ(n,t,1/0)){let t=e-o,n=t*s+a+t*r;i.push({index:e,offset:n,size:l}),o=e,a=n,s=l}return{lastIndex:o,lastOffset:a,lastSize:s,offsetTree:i}}function t8(e){return{index:e.index,value:e}}let t6={offsetHeight:"height",offsetWidth:"width"},t9=tv(([{log:e},{recalcInProgress:t}])=>{let n=tm(),r=tm(),i=tp(r,0),o=tm(),s=tm(),a=tf(0),l=tf([]),u=tf(void 0),c=tf(void 0),h=tf((e,t)=>tY(e,t6[t])),d=tf(void 0),f=tf(0),p={groupIndices:[],groupOffsetTree:tP,lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:tP},m=tp(tl(n,td(l,e,f),tu(t5,p),ti()),p),g=tp(tl(l,ti(),tu((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),ts(({prev:e})=>e)),[]);te(tl(l,to(e=>e.length>0),td(m,f),ts(([e,t,n])=>{let r=e.reduce((e,r,i)=>tF(e,r,t0(r,t.offsetTree,n)||i),tP);return{...t,groupIndices:e,groupOffsetTree:r}})),m),te(tl(r,td(m),to(([e,{lastIndex:t}])=>e<t),ts(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),te(u,c);let v=tp(tl(u,ts(e=>void 0===e)),!0);te(tl(c,to(e=>void 0!==e&&tN(e7(m).sizeTree)),ts(e=>[{endIndex:0,size:e,startIndex:0}])),n);let y=tg(tl(n,td(m),tu(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:p}),ts(e=>e.changed)));tl(a,tu((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),ts(e=>e.diff))(1,e=>{let{groupIndices:n}=e7(m);if(e>0)t(0,!0),o(0,e+t3(e,n));else if(e<0){let t=e7(g);t.length>0&&(e-=t3(-e,t)),s(0,e)}}),tl(a,td(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:a},tS.ERROR)});let b=tg(o);te(tl(o,td(m),ts(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=tj(t.sizeTree,0),o=0,s=0;for(;o<e;){let e=t.groupIndices[s],a=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+a-1,size:i,startIndex:e+1}),s++,o+=a+1}let a=tB(t.sizeTree);return o!==e&&a.shift(),a.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 tB(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=tg(tl(s,td(m,f),ts(([e,{offsetTree:t},n])=>t0(-e,t,n))));return te(tl(s,td(m,f),ts(([e,t,n])=>{if(t.groupIndices.length>0){if(tN(t.sizeTree))return t;let r=tP,i=e7(g),o=0,s=0,a=0;for(;o<-e;){a=i[s];let e=i[s+1]-a-1;s++,o+=e+1}return r=tB(t.sizeTree).reduce((t,{k:n,v:r})=>tF(t,Math.max(0,n+e),r),r),o!==-e&&(r=tF(r,0,tj(t.sizeTree,a)),r=tF(r,1,tL(t.sizeTree,-e+1)[1])),{...t,sizeTree:r,...t4(t.offsetTree,0,r,n)}}{let r=tB(t.sizeTree).reduce((t,{k:n,v:r})=>tF(t,Math.max(0,n+e),r),tP);return{...t,sizeTree:r,...t4(t.offsetTree,0,r,n)}}})),m),{beforeUnshiftWith:b,data:d,defaultItemSize:c,firstItemIndex:a,fixedItemSize:u,gap:f,groupIndices:l,itemSize:h,listRefresh:y,shiftWith:s,shiftWithOffset:x,sizeRanges:n,sizes:m,statefulTotalCount:i,totalCount:r,trackItemSizes:v,unshiftWith:o}},e8(tM,tU),{singleton:!0});function t7(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}let ne=tv(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let o=tm(),s=tm(),a=tg(tl(o,ts(t7)));return te(tl(a,ts(e=>e.totalCount)),n),te(tl(a,ts(e=>e.groupIndices)),e),te(tl(tb(i,t,r),to(([e,t])=>tX(t)),ts(([e,t,n])=>tL(t.groupOffsetTree,Math.max(e-n,0),"v")[0]),ti(),ts(e=>[e])),s),{groupCounts:o,topItemsIndexes:s}},e8(t9,tR)),nt=tv(([{log:e}])=>{let t=tf(!1),n=tg(tl(t,to(e=>e),ti()));return t(1,t=>{t&&e7(e)("props updated",{},tS.DEBUG)}),{didMount:n,propsReady:t}},e8(tM),{singleton:!0}),nn="u">typeof document&&"scrollBehavior"in document.documentElement.style;function nr(e){let t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&nn||(t.behavior="auto"),t.offset||(t.offset=0),t}let ni=tv(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:o,footerHeight:s,headerHeight:a,scrollingInProgress:l,scrollTo:u,smoothScrollTargetReached:c,viewportHeight:h},{log:d}])=>{let f=tm(),p=tm(),m=tf(0),g=null,v=null,y=null;function b(){g&&(g(),g=null),y&&(y(),y=null),v&&(clearTimeout(v),v=null),l(0,!1)}return te(tl(f,td(n,h,r,m,a,s,d),td(e,o,i),ts(([[e,n,r,i,o,s,a,u],h,d,m])=>{let x=nr(e),{align:w,behavior:S,offset:C}=x,k=i-1,M=t2(x,n,k),T=t0(M,n.offsetTree,h)+s;"end"===w?(T+=d+tL(n.sizeTree,M)[1]-r+m,M===k&&(T+=a)):"center"===w?T+=(d+tL(n.sizeTree,M)[1]-r+m)/2:T-=o,C&&(T+=C);let A=t=>{b(),t?(u("retrying to scroll to",{location:e},tS.DEBUG),f(0,e)):(p(0,!0),u("list did not change, scroll successful",{},tS.DEBUG))};if(b(),"smooth"===S){let e=!1;y=t(1,t=>{e=e||t}),g=tt(c,()=>{A(e)})}else g=tt(tl(t,e=>{let t=setTimeout(()=>{e(!1)},150);return n=>{n&&(e(!0),clearTimeout(t))}}),A);return v=setTimeout(()=>{b()},1200),l(0,!0),u("scrolling from index to",{behavior:S,index:M,top:T},tS.DEBUG),{behavior:S,top:T}})),u),{scrollTargetReached:p,scrollToIndex:f,topListHeight:m}},e8(t9,tR,tM),{singleton:!0});function no(e,t){0==e?t():requestAnimationFrame(()=>{no(e-1,t)})}function ns(e,t){return"number"==typeof e?e:"LAST"===e.index?t-1:e.index}let na=tv(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:o},{didMount:s}])=>{let a=tf(!0),l=tf(0),u=tf(!0);return te(tl(s,td(l),to(([e,t])=>!!t),ta(!1)),a),te(tl(s,td(l),to(([e,t])=>!!t),ta(!1)),u),tl(tb(t,s),td(a,n,e,u),to(([[,e],t,{sizeTree:n},r,i])=>e&&(!tN(n)||e5(r))&&!t&&!i),td(l))(1,([,e])=>{tt(i,()=>{u(0,!0)}),no(4,()=>{tt(r,()=>{a(0,!0)}),o(0,e)})}),{initialItemFinalLocationReached:u,initialTopMostItemIndex:l,scrolledToInitialItem:a}},e8(t9,tR,ni,nt),{singleton:!0});function nl(e,t){return 1.01>Math.abs(e-t)}let nu="down",nc={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},nh=tv(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:o}])=>{let s=tf(!1),a=tf(!0),l=tm(),u=tm(),c=tf(4),h=tf(0),d=tp(tl(tw(tl(tx(i),tc(1),ta(!0)),tl(tx(i),tc(1),ta(!1),tn(100))),ti()),!1),f=tp(tl(tw(tl(n,ta(!0)),tl(n,ta(!1),tn(200))),ti()),!1);te(tl(tb(tx(i),tx(h)),ts(([e,t])=>e<=t),ti()),a),te(tl(a,th(50)),u);let p=tg(tl(tb(r,tx(o),tx(t),tx(e),tx(c)),tu((e,[{scrollHeight:t,scrollTop:n},r,i,o,s])=>{let a;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}},nc),ti((e,t)=>e&&e.atBottom===t.atBottom))),m=tp(tl(r,tu((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(nl(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}),to(e=>e.changed),ts(e=>e.jump)),0);te(tl(p,ts(e=>e.atBottom)),s),te(tl(s,th(50)),l);let g=tf(nu);te(tl(r,ts(({scrollTop:e})=>e),ti(),tu((e,t)=>e7(f)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?"up":nu,prevScrollTop:t},{direction:nu,prevScrollTop:0}),ts(e=>e.direction)),g),te(tl(r,th(50),ta("none")),g);let v=tf(0);return te(tl(d,to(e=>!e),ta(0)),v),te(tl(i,th(100),td(d),to(([e,t])=>!!t),tu(([e,t],[n])=>[t,n],[0,0]),ts(([e,t])=>t-e)),v),{atBottomState:p,atBottomStateChange:l,atBottomThreshold:c,atTopStateChange:u,atTopThreshold:h,isAtBottom:s,isAtTop:a,isScrolling:d,lastJumpDueToItemResize:m,scrollDirection:g,scrollVelocity:v}},e8(tR)),nd="bottom",nf="none";function np(e,t,n){return"number"==typeof e?"up"===n&&"top"===t||n===nu&&t===nd?e:0:"up"===n?"top"===t?e.main:e.reverse:t===nd?e.main:e.reverse}function nm(e,t){var n;return"number"==typeof e?e:null!=(n=e[t])?n:0}let ng=tv(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let o=tm(),s=tf(0),a=tf(0),l=tf(0),u=tp(tl(tb(tx(r),tx(i),tx(n),tx(o,tG),tx(l),tx(s),tx(t),tx(e),tx(a)),ts(([e,t,n,[r,i],o,s,a,l,u])=>{let c=e-l,h=Math.max(n-c,0),d=nf,f=nm(u,"top"),p=nm(u,nd);return r-=l,r+=n+a,i+=n+a,r>e+(s+a)-f&&(d="up"),(i-=l)<e-h+t+p&&(d=nu),d!==nf?[Math.max(c-n-np(o,"top",d)-f,0),c-h-a+t+np(o,nd,d)+p]:null}),to(e=>null!=e),ti(tG)),[0,0]);return{increaseViewportBy:a,listBoundary:o,overscan:l,topListHeight:s,visibleRange:u}},e8(tR),{singleton:!0}),nv={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ny(e,t,n,r,i,o){let{lastIndex:s,lastOffset:a,lastSize:l}=i,u=0,c=0;if(e.length>0){u=e[0].offset;let t=e[e.length-1];c=t.offset+t.size}let h=n-s,d=u,f=a+h*l+(h-1)*r-c;return{bottom:c,firstItemIndex:o,items:nx(e,i,o),offsetBottom:f,offsetTop:u,top:d,topItems:nx(t,i,o),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function nb(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 a=e+s,l=ns(t,a);return ny(Array.from({length:a}).map((e,t)=>({data:o[t+l],index:t+l,offset:0,size:0})),[],a,i,n,r)}function nx(e,t,n){if(0===e.length)return[];if(!tX(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=tZ(t.groupOffsetTree,r,i),a,l=0;for(let r of e){let e;(!a||a.end<r.index)&&(a=s.shift(),l=t.groupIndices.indexOf(a.start)),e=r.index===a.start?{index:l,type:"group"}:{groupIndex:l,index:r.index-(l+1)+n},o.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return o}let nw=tv(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},o,{listBoundary:s,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:u,scrolledToInitialItem:c},{topListHeight:h},d,{didMount:f},{recalcInProgress:p}])=>{let m=tf([]),g=tf(0),v=tm();te(o.topItemsIndexes,m);let y=tp(tl(tb(f,p,tx(l,tG),tx(i),tx(r),tx(u),c,tx(m),tx(t),tx(n),e),to(([e,t,,n,,,,,,,r])=>{let i=r&&r.length!==n;return e&&!t&&!i}),ts(([,,[e,t],n,r,i,o,s,a,l,u])=>{var c;let{offsetTree:h,sizeTree:d}=r,f=e7(g);if(0===n)return{...nv,totalCount:n};if(0===e&&0===t)return 0===f?{...nv,totalCount:n}:nb(f,i,r,a,l,u||[]);if(tN(d))return f>0?null:ny(function(e,t,n){if(tX(t)){let r=t1(e,t);return[{index:tL(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}]}(ns(i,n),r,u),[],n,l,r,a);let p=[];if(s.length>0){let e=s[0],t=s[s.length-1],n=0;for(let r of tZ(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==u?void 0:u[e],index:e,offset:n,size:i}),n+=i}}if(!o)return ny([],p,n,l,r,a);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[tK(e,r,tQ)].offset)),tI(function(e,t,n,r){let i=tK(e,t,r),o=tK(e,n,r,i);return e.slice(i,o+1)}(e,t,n,tJ),t8)}(h,e,t,m);if(0===v.length)return null;let y=n-1;return ny(((n=>{for(let r of v){let i=r.value,o=i.offset,s=r.start,a=i.size;if(i.offset<e){let t=(s+=Math.floor((e-i.offset+l)/(a+l)))-r.start;o+=t*a+t*l}s<m&&(o+=(m-s)*a,s=m);let c=Math.min(r.end,y);for(let e=s;e<=c&&!(o>=t);e++)n.push({data:null==u?void 0:u[e],index:e,offset:o,size:a}),o+=a+l}})(c=[]),c),p,n,l,r,a)}),to(e=>null!==e),ti()),nv);te(tl(e,to(e5),ts(e=>null==e?void 0:e.length)),i),te(tl(y,ts(e=>e.topListHeight)),h),te(h,a),te(tl(y,ts(e=>[e.top,e.bottom])),s),te(tl(y,ts(e=>e.items)),v);let b=tg(tl(y,to(({items:e})=>e.length>0),td(i,e),to(([{items:e},t])=>e[e.length-1].originalIndex===t-1),ts(([,e,t])=>[e-1,t]),ti(tG),ts(([e])=>e))),x=tg(tl(y,th(200),to(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),ts(({items:e})=>e[0].index),ti())),w=tg(tl(y,to(({items:e})=>e.length>0),ts(({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}}),ti(tq)));return{endReached:b,initialItemCount:g,itemsRendered:v,listState:y,rangeChanged:w,startReached:x,topItemsIndexes:m,...d}},e8(t9,ne,ng,na,ni,nh,nt,tU),{singleton:!0}),nS=tv(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let o=tm(),s=tp(tl(tb(n,e,r,t,i),ts(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return te(tx(s),o),{totalListHeight:s,totalListHeightChanged:o}},e8(tR,nw),{singleton:!0}),nC=tv(([{viewportHeight:e},{totalListHeight:t}])=>{let n=tf(!1),r=tp(tl(tb(n,e,t),to(([e])=>e),ts(([,e,t])=>Math.max(0,e-t)),th(0),ti()),0);return{alignToBottom:n,paddingTopAddition:r}},e8(tR,nS),{singleton:!0});function nk(e){return!!e&&("smooth"===e?"smooth":"auto")}let nM=(e,t)=>"function"==typeof e?nk(e(t)):t&&nk(e),nT=tv(([{listRefresh:e,totalCount:t},{atBottomState:n,isAtBottom:r},{scrollToIndex:i},{scrolledToInitialItem:o},{didMount:s,propsReady:a},{log:l},{scrollingInProgress:u}])=>{let c=tf(!1),h=tm(),d=null;function f(e){i(0,{align:"end",behavior:e,index:"LAST"})}function p(e){setTimeout(tt(n,t=>{!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||d||(e7(l)("scrolling to bottom due to increased size",{},tS.DEBUG),f("auto"))}),100)}return tl(tb(tl(tx(t),tc(1)),s),td(tx(c),r,o,u),ts(([[e,t],n,r,i,o])=>{let s=t&&i,a="auto";return s&&(a=nM(n,r||o),s=s&&!!a),{followOutputBehavior:a,shouldFollow:s,totalCount:e}}),to(({shouldFollow:e})=>e))(1,({followOutputBehavior:t,totalCount:n})=>{d&&(d(),d=null),d=tt(e,()=>{e7(l)("following output to ",{totalCount:n},tS.DEBUG),f(t),d=null})}),tl(tb(tx(c),t,a),to(([e,,t])=>e&&t),tu(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),to(({refreshed:e})=>e),td(c,t))(1,([,e])=>{e7(o)&&p(!1!==e)}),h(1,()=>{p(!1!==e7(c))}),tb(tx(c),n)(1,([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&f("auto")}),{autoscrollToBottom:h,followOutput:c}},e8(t9,nh,ni,na,nt,tM,tR)),nA=tv(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:s},{didMount:a}])=>(te(tl(a,td(o),to(([,e])=>0!==e),td(i,r,t,n,e),ts(([[,e],t,n,r,i,o=[]])=>nb(e,t,n,r,i,o))),s),{}),e8(t9,na,nw,nt),{singleton:!0}),nD=tv(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=tf(0);return tl(e,td(r),to(([,e])=>0!==e),ts(([,e])=>({top:e})))(1,e=>{tt(tl(n,tc(1),to(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{t(0,e)})})}),{initialScrollTop:r}},e8(nt,tR,nw),{singleton:!0}),nE=({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,nO=tv(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:s,scrollTop:a,viewportHeight:l},{scrollToIndex:u}])=>{let c=tm();return te(tl(c,td(t,l,n,o,i,r,a),td(e),ts(([[e,t,n,r,i,o,a,l],u])=>{let{align:c,behavior:h,calculateViewLocation:d=nE,done:f,...p}=e,m=t2(e,t,r-1),g=t0(m,t.offsetTree,u)+i+o,v=d({itemBottom:g+tL(t.sizeTree,m)[1],itemTop:g,locationParams:{align:c,behavior:h,...p},viewportBottom:l+n-a,viewportTop:l+o});return v?f&&tt(tl(s,to(e=>!e),tc(e7(s)?1:2)),f):f&&f(),v}),to(e=>null!==e)),u),{scrollIntoView:c}},e8(t9,tR,ni,nw,tM),{singleton:!0}),nR=tv(([{scrollVelocity:e}])=>{let t=tf(!1),n=tm(),r=tf(!1);return te(tl(e,td(r,t,n),to(([e,t])=>!!t),ts(([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}),ti()),t),tl(tb(t,e,n),td(r))(1,([[e,t,n],r])=>{e&&r&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},e8(nh),{singleton:!0}),nP=tv(([{scrollContainerState:e,scrollTo:t}])=>{let n=tm(),r=tm(),i=tm(),o=tf(!1),s=tf(void 0);return te(tl(tb(n,r),ts(([{scrollHeight:e,scrollTop:t,viewportHeight:n},{offsetTop:r}])=>({scrollHeight:e,scrollTop:Math.max(0,t-r),viewportHeight:n}))),e),te(tl(t,td(r),ts(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:s,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},e8(tR)),nI=tv(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:s,windowScrollContainerState:a,windowViewportRect:l}])=>{let u=tm(),c=tf(void 0),h=tf(null),d=tf(null);return te(a,h),te(l,d),tl(u,td(t,r,s,h,d,n))(1,([e,t,n,r,i,o,s])=>{let a=tB(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:a,scrollTop:n-=s})}),te(tl(c,to(e5),ts(nN)),i),te(tl(o,td(c),to(([,e])=>void 0!==e),ti(),ts(([,e])=>e.ranges)),e),{getState:u,restoreStateFrom:c}},e8(t9,tR,na,nt,nP));function nN(e){return{align:"start",index:0,offset:e.scrollTop}}let nj=tv(([{topItemsIndexes:e}])=>{let t=tf(0);return te(tl(t,to(e=>e>=0),ts(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},e8(nw));function nL(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}let nF=nL(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),nZ=tv(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:o,lastJumpDueToItemResize:s,scrollDirection:a},{listState:l},{beforeUnshiftWith:u,gap:c,shiftWithOffset:h,sizes:d},{log:f},{recalcInProgress:p}])=>{let m=tg(tl(l,td(s),tu(([,e,t,n],[{bottom:r,items:i,offsetBottom:o,totalCount:s},a])=>{let l=r+o,u=0;return t===s&&e.length>0&&i.length>0&&(0===i[0].originalIndex&&0===e[0].originalIndex||0!=(u=l-n)&&(u+=a)),[u,i,s,l]},[0,[],0,0]),to(([e])=>0!==e),td(r,a,n,i,f,p),to(([,e,t,n,,,r])=>!r&&!n&&0!==e&&"up"===t),ts(([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},tS.DEBUG),e))));function g(n){var r,i;n>0?(t(0,{behavior:"auto",top:-n}),r=0,e(0,0)):(i=0,e(0,0),t(0,{behavior:"auto",top:-n}))}return tl(m,td(e,o))(1,([t,n,r])=>{r&&nF()?e(0,n-t):g(-t)}),tl(tb(tp(o,!1),e,p),to(([e,t,n])=>!e&&!n&&0!==t),ts(([e,t])=>t),th(1))(1,g),te(tl(h,ts(e=>({top:-e}))),t),tl(u,td(d,c),ts(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{if(0===t.length)return e*(n+i);{let o=0,s=tj(r,0),a=0,l=0;for(;a<e;){a++,o+=s;let r=t.length===l+1?1/0:t[l+1]-t[l]-1;a+r>e&&(o-=s,r=e-a+1),a+=r,o+=r*(n+i),l++}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}},e8(tR,nh,nw,t9,tM,tU)),nB=tv(([e,t,n,r,i,o,s,a,l,u])=>({...e,...t,...n,...r,...i,...o,...s,...a,...l,...u}),e8(ng,nA,nt,nR,nS,nD,nC,nP,nO,tM)),nV=tv(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,gap:i,groupIndices:o,itemSize:s,sizeRanges:a,sizes:l,statefulTotalCount:u,totalCount:c,trackItemSizes:h},{initialItemFinalLocationReached:d,initialTopMostItemIndex:f,scrolledToInitialItem:p},m,g,v,{listState:y,topItemsIndexes:b,...x},{scrollToIndex:w},S,{topItemCount:C},{groupCounts:k},M])=>(te(x.rangeChanged,M.scrollSeekRangeChanged),te(tl(M.windowViewportRect,ts(e=>e.visibleHeight)),m.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,gap:i,groupCounts:k,initialItemFinalLocationReached:d,initialTopMostItemIndex:f,scrolledToInitialItem:p,sizeRanges:a,topItemCount:C,topItemsIndexes:b,totalCount:c,...v,groupIndices:o,itemSize:s,listState:y,scrollToIndex:w,statefulTotalCount:u,trackItemSizes:h,...x,...M,...m,sizes:l,...g}),e8(t9,na,tR,nI,nT,nw,ni,nZ,nj,ne,nB)),nz="u">typeof document?m.useLayoutEffect:m.useEffect;function n_(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),s=Object.keys(t.events||{}),a=m.createContext({});function l(e,n){var o,s,a,l;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&&(a=e[t.optional[r]],a(0,n[r]))}e.propsReady&&(l=e.propsReady,l(0,!0))}function u(e){return s.reduce((n,r)=>(n[r]=function(e){let t,n;let 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(),e3);case 2:r(),n=null;return}}}(e[t.events[r]]),n),{})}return{Component:m.forwardRef((c,h)=>{var d;let{children:f,...g}=c,[v]=m.useState(()=>{var t;return l(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),g),t}),[y]=m.useState(()=>u(v));return nz(()=>{for(let e of s)e in g&&(0,y[e])(1,g[e]);return()=>{Object.values(y).map(e9)}},[g,y,v]),nz(()=>{l(v,g)}),m.useImperativeHandle(h,(d=o.reduce((e,n)=>(e[n]=e=>{var r;r=v[t.methods[n]],r(0,e)},e),{}),()=>d)),(0,p.jsx)(a.Provider,{value:v,children:n?(0,p.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],g),children:f}):f})}),useEmitter:(e,t)=>{let n=m.useContext(a)[e];nz(()=>n(1,t),[t,n])},useEmitterValue:m.version.startsWith("18")?e=>{let t=m.useContext(a)[e],n=m.useCallback(e=>t(1,e),[t]);return m.useSyncExternalStore(n,()=>e7(t),()=>e7(t))}:e=>{let t=m.useContext(a)[e],[n,r]=m.useState(()=>e7(t));return nz(()=>t(1,e=>{e!==n&&r(()=>e)}),[t,n]),n},usePublisher:e=>{var t;return m.useCallback((t=m.useContext(a)[e],e=>(function(e,t){e(0,t)})(t,e)),[e])}}}let nH=m.createContext(void 0),n$=m.createContext(void 0),nW="u">typeof document?m.useLayoutEffect:m.useEffect;function nq(e,t,n,r=e3,i,o){let s=m.useRef(null),a=m.useRef(null),l=m.useRef(null),u=m.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,u=o?i?document.documentElement.scrollWidth:r.scrollWidth:i?document.documentElement.scrollHeight:r.scrollHeight,c=o?i?window.innerWidth:r.offsetWidth:i?window.innerHeight:r.offsetHeight,h=()=>{e({scrollHeight:u,scrollTop:Math.max(s,0),viewportHeight:c})};n.suppressFlushSync?h():e0.flushSync(h),null!==a.current&&(s===a.current||s<=0||s===u-c)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);return m.useEffect(()=>{let e=i||s.current;return r(i||s.current),u({suppressFlushSync:!0,target:e}),e.addEventListener("scroll",u,{passive:!0}),()=>{r(null),e.removeEventListener("scroll",u)}},[s,u,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,u;let c=s.current;if(!c||(o?"offsetWidth"in c&&0===c.offsetWidth:"offsetHeight"in c&&0===c.offsetHeight))return;let h="smooth"===n.behavior;c===window?(i=Math.max(tY(document.documentElement,o?"width":"height"),o?document.documentElement.scrollWidth:document.documentElement.scrollHeight),r=o?window.innerWidth:window.innerHeight,u=o?document.documentElement.scrollLeft:document.documentElement.scrollTop):(i=c[o?"scrollWidth":"scrollHeight"],r=tY(c,o?"width":"height"),u=c[o?"scrollLeft":"scrollTop"]);let d=i-r;if(n.top=Math.ceil(Math.max(Math.min(d,n.top),0)),nl(r,i)||n.top===u){e({scrollHeight:i,scrollTop:u,viewportHeight:r}),h&&t(!0);return}h?(a.current=n.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,o&&(n={behavior:n.behavior,left:n.top}),c.scrollTo(n)}}}let nG="-webkit-sticky",nU="sticky",nK=nL(()=>{if(typeof document>"u")return nU;let e=document.createElement("div");return e.style.position=nG,e.style.position===nG?nG:nU});function nY(e){return e}let nX=tv(()=>{let e=tf(e=>`Item ${e}`),t=tf(null),n=tf(e=>`Group ${e}`),r=tf({}),i=tf(nY),o=tf("div"),s=tf(e3),a=(e,t=null)=>tp(tl(r,ts(t=>t[e]),ti()),t);return{components:r,computeItemKey:i,context:t,EmptyPlaceholder:a("EmptyPlaceholder"),FooterComponent:a("Footer"),GroupComponent:a("Group","div"),groupContent:n,HeaderComponent:a("Header"),HeaderFooterTag:o,ItemComponent:a("Item","div"),itemContent:e,ListComponent:a("List","div"),ScrollerComponent:a("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TopItemListComponent:a("TopItemList")}}),nQ=tv(([e,t])=>({...e,...t}),e8(nV,nX)),nJ=({height:e})=>(0,p.jsx)("div",{style:{height:e}}),n0={overflowAnchor:"none",position:nK(),zIndex:1},n1={overflowAnchor:"none"},n2={...n1,display:"inline-block",height:"100%"},n5=m.memo(function({showTopList:e=!1}){let t=ru("listState"),n=rc("sizeRanges"),r=ru("useWindowScroll"),i=ru("customScrollParent"),o=rc("windowScrollContainerState"),s=rc("scrollContainerState"),a=ru("itemContent"),l=ru("context"),u=ru("groupContent"),c=ru("trackItemSizes"),h=ru("itemSize"),d=ru("log"),f=rc("gap"),g=ru("horizontalDirection"),{callbackRef:v}=tD(n,h,c,e?e3:i||r?o:s,d,f,i,g,ru("skipAnimationFrameInResizeObserver")),[y,b]=m.useState(0);rl("deviation",e=>{y!==e&&b(e)});let x=ru("EmptyPlaceholder"),w=ru("ScrollSeekPlaceholder")||nJ,S=ru("ListComponent"),C=ru("ItemComponent"),k=ru("GroupComponent"),M=ru("computeItemKey"),T=ru("isSeeking"),A=ru("groupIndices").length>0,D=ru("alignToBottom"),E=ru("initialItemFinalLocationReached"),O=e?{}:{boxSizing:"border-box",...g?{display:"inline-block",height:"100%",marginLeft:0!==y?y:D?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:0!==y?y:D?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...E?{}:{visibility:"hidden"}};return!e&&0===t.totalCount&&x?(0,p.jsx)(x,{...n9(x,l)}):(0,p.jsx)(S,{...n9(S,l),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:v,style:O,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=M(n+t.firstItemIndex,e.data,l);return T?(0,m.createElement)(w,{...n9(w,l),height:e.size,index:e.index,key:r,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?(0,m.createElement)(k,{...n9(k,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:n0},u(e.index,l)):(0,m.createElement)(C,{...n9(C,l),...n7(C,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:g?n2:n1},A?a(e.index,e.groupIndex,e.data,l):a(e.index,e.data,l))})})}),n3={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n4={outline:"none",overflowX:"auto",position:"relative"},n8=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),n6={position:nK(),top:0,width:"100%",zIndex:1};function n9(e,t){if("string"!=typeof e)return{context:t}}function n7(e,t){return{item:"string"==typeof e?void 0:t}}let re=m.memo(function(){let e=ru("HeaderComponent"),t=rc("headerHeight"),n=ru("HeaderFooterTag"),r=tT(m.useMemo(()=>e=>{t(tY(e,"height"))},[t]),!0,ru("skipAnimationFrameInResizeObserver")),i=ru("context");return e?(0,p.jsx)(n,{ref:r,children:(0,p.jsx)(e,{...n9(e,i)})}):null}),rt=m.memo(function(){let e=ru("FooterComponent"),t=rc("footerHeight"),n=ru("HeaderFooterTag"),r=tT(m.useMemo(()=>e=>{t(tY(e,"height"))},[t]),!0,ru("skipAnimationFrameInResizeObserver")),i=ru("context");return e?(0,p.jsx)(n,{ref:r,children:(0,p.jsx)(e,{...n9(e,i)})}):null});function rn({useEmitter:e,useEmitterValue:t,usePublisher:n}){return m.memo(function({children:r,style:i,...o}){let s=n("scrollContainerState"),a=t("ScrollerComponent"),l=n("smoothScrollTargetReached"),u=t("scrollerRef"),c=t("context"),h=t("horizontalDirection")||!1,{scrollByCallback:d,scrollerRef:f,scrollToCallback:m}=nq(s,l,a,u,void 0,h);return e("scrollTo",m),e("scrollBy",d),(0,p.jsx)(a,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:f,style:{...h?n4:n3,...i},tabIndex:0,...o,...n9(a,c),children:r})})}function rr({useEmitter:e,useEmitterValue:t,usePublisher:n}){return m.memo(function({children:r,style:i,...o}){let s=n("windowScrollContainerState"),a=t("ScrollerComponent"),l=n("smoothScrollTargetReached"),u=t("totalListHeight"),c=t("deviation"),h=t("customScrollParent"),d=t("context"),{scrollByCallback:f,scrollerRef:m,scrollToCallback:g}=nq(s,l,a,e3,h);return nW(()=>(m.current=h||window,()=>{m.current=null}),[m,h]),e("windowScrollTo",g),e("scrollBy",f),(0,p.jsx)(a,{"data-virtuoso-scroller":!0,style:{position:"relative",...i,...0!==u?{height:u+c}:{}},...o,...n9(a,d),children:r})})}let ri=({children:e})=>{let t=m.useContext(nH),n=rc("viewportHeight"),r=rc("fixedItemHeight"),i=ru("alignToBottom"),o=ru("horizontalDirection"),s=tT(m.useMemo(()=>e2(n,e=>tY(e,o?"width":"height")),[n,o]),!0,ru("skipAnimationFrameInResizeObserver"));return m.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,p.jsx)("div",{"data-viewport-type":"element",ref:s,style:n8(i),children:e})},ro=({children:e})=>{let t=m.useContext(nH),n=rc("windowViewportRect"),r=rc("fixedItemHeight"),i=tO(n,ru("customScrollParent"),ru("skipAnimationFrameInResizeObserver")),o=ru("alignToBottom");return m.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,p.jsx)("div",{"data-viewport-type":"window",ref:i,style:n8(o),children:e})},rs=({children:e})=>{let t=ru("TopItemListComponent")||"div",n=ru("headerHeight"),r={...n6,marginTop:`${n}px`},i=ru("context");return(0,p.jsx)(t,{style:r,...n9(t,i),children:e})},{Component:ra,useEmitter:rl,useEmitterValue:ru,usePublisher:rc}=n_(nQ,{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:{}},m.memo(function(e){let t=ru("useWindowScroll"),n=ru("topItemsIndexes").length>0,r=ru("customScrollParent"),i=ru("context"),o=r||t?rd:rh,s=r||t?ro:ri;return(0,p.jsxs)(o,{...e,...n9(o,i),children:[n&&(0,p.jsx)(rs,{children:(0,p.jsx)(n5,{showTopList:!0})}),(0,p.jsxs)(s,{children:[(0,p.jsx)(re,{}),(0,p.jsx)(n5,{}),(0,p.jsx)(rt,{})]})]})})),rh=rn({useEmitter:rl,useEmitterValue:ru,usePublisher:rc}),rd=rr({useEmitter:rl,useEmitterValue:ru,usePublisher:rc}),rf=tv(()=>{let e=tf(e=>(0,p.jsxs)("td",{children:["Item $",e]})),t=tf(null),n=tf(null),r=tf(null),i=tf({}),o=tf(nY),s=tf(e3),a=(e,t=null)=>tp(tl(i,ts(t=>t[e]),ti()),t);return{components:i,computeItemKey:o,context:t,EmptyPlaceholder:a("EmptyPlaceholder"),FillerRow:a("FillerRow"),fixedFooterContent:r,fixedHeaderContent:n,itemContent:e,ScrollerComponent:a("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TableBodyComponent:a("TableBody","tbody"),TableComponent:a("Table","table"),TableFooterComponent:a("TableFoot","tfoot"),TableHeadComponent:a("TableHead","thead"),TableRowComponent:a("TableRow","tr")}}),rp=tv(([e,t])=>({...e,...t}),e8(nV,rf)),rm=({height:e})=>(0,p.jsx)("tr",{children:(0,p.jsx)("td",{style:{height:e}})}),rg=({height:e})=>(0,p.jsx)("tr",{children:(0,p.jsx)("td",{style:{border:0,height:e,padding:0}})}),rv={overflowAnchor:"none"},ry=m.memo(function({showTopList:e=!1}){let t=rk("listState"),n=rk("computeItemKey"),r=rk("firstItemIndex"),i=rk("isSeeking"),o=rk("ScrollSeekPlaceholder")||rm,s=rk("context"),a=rk("TableRowComponent"),l=rk("fixedHeaderHeight"),u=rk("itemContent"),c=(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:c[h-1]:0;return i?(0,m.createElement)(o,{...n9(o,s),height:t.size,index:t.index,key:d,type:t.type||"item"}):(0,m.createElement)(a,{...n9(a,s),...n7(a,t.data),"data-index":h,"data-item-index":t.index,"data-known-size":t.size,key:d,style:e?{overflowAnchor:"none",position:"sticky",top:l+f,zIndex:2}:rv},u(t.index,t.data,s))});return(0,p.jsx)(p.Fragment,{children:h})}),rb=m.memo(function(){let e=rk("listState"),t=rk("topItemsIndexes").length>0,n=rM("sizeRanges"),r=rk("useWindowScroll"),i=rk("customScrollParent"),o=rM("windowScrollContainerState"),s=rM("scrollContainerState"),a=rk("trackItemSizes"),{callbackRef:l,ref:u}=tD(n,rk("itemSize"),a,i||r?o:s,rk("log"),void 0,i,!1,rk("skipAnimationFrameInResizeObserver")),[c,h]=m.useState(0);rC("deviation",e=>{c!==e&&(u.current.style.marginTop=`${e}px`,h(e))});let d=rk("EmptyPlaceholder"),f=rk("FillerRow")||rg,g=rk("TableBodyComponent"),v=rk("paddingTopAddition"),y=rk("statefulTotalCount"),b=rk("context");if(0===y&&d)return(0,p.jsx)(d,{...n9(d,b)});let x=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),w=e.offsetTop+v+c-x,S=e.offsetBottom,C=w>0?(0,p.jsx)(f,{context:b,height:w},"padding-top"):null,k=S>0?(0,p.jsx)(f,{context:b,height:S},"padding-bottom"):null;return(0,p.jsxs)(g,{"data-testid":"virtuoso-item-list",ref:l,...n9(g,b),children:[C,t&&(0,p.jsx)(ry,{showTopList:!0}),(0,p.jsx)(ry,{}),k]})}),rx=({children:e})=>{let t=m.useContext(nH),n=rM("viewportHeight"),r=rM("fixedItemHeight"),i=tT(m.useMemo(()=>e2(n,e=>tY(e,"height")),[n]),!0,rk("skipAnimationFrameInResizeObserver"));return m.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,p.jsx)("div",{"data-viewport-type":"element",ref:i,style:n8(!1),children:e})},rw=({children:e})=>{let t=m.useContext(nH),n=rM("windowViewportRect"),r=rM("fixedItemHeight"),i=tO(n,rk("customScrollParent"),rk("skipAnimationFrameInResizeObserver"));return m.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,p.jsx)("div",{"data-viewport-type":"window",ref:i,style:n8(!1),children:e})},{Component:rS,useEmitter:rC,useEmitterValue:rk,usePublisher:rM}=n_(rp,{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:{}},m.memo(function(e){let t=rk("useWindowScroll"),n=rk("customScrollParent"),r=rM("fixedHeaderHeight"),i=rM("fixedFooterHeight"),o=rk("fixedHeaderContent"),s=rk("fixedFooterContent"),a=rk("context"),l=tT(m.useMemo(()=>e2(r,e=>tY(e,"height")),[r]),!0,rk("skipAnimationFrameInResizeObserver")),u=tT(m.useMemo(()=>e2(i,e=>tY(e,"height")),[i]),!0,rk("skipAnimationFrameInResizeObserver")),c=n||t?rA:rT,h=n||t?rw:rx,d=rk("TableComponent"),f=rk("TableHeadComponent"),g=rk("TableFooterComponent"),v=o?(0,p.jsx)(f,{ref:l,style:{position:"sticky",top:0,zIndex:2},...n9(f,a),children:o()},"TableHead"):null,y=s?(0,p.jsx)(g,{ref:u,style:{bottom:0,position:"sticky",zIndex:1},...n9(g,a),children:s()},"TableFoot"):null;return(0,p.jsx)(c,{...e,...n9(c,a),children:(0,p.jsx)(h,{children:(0,p.jsxs)(d,{style:{borderSpacing:0,overflowAnchor:"none"},...n9(d,a),children:[v,(0,p.jsx)(rb,{},"TableBody"),y]})})})})),rT=rn({useEmitter:rC,useEmitterValue:rk,usePublisher:rM}),rA=rr({useEmitter:rC,useEmitterValue:rk,usePublisher:rM}),rD={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},rE={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:rO,floor:rR,max:rP,min:rI,round:rN}=Math;function rj(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:null===n?null:n[r+e],index:r+e}))}function rL(e,t){return e&&e.width===t.width&&e.height===t.height}function rF(e,t){return e&&e.column===t.column&&e.row===t.row}let rZ=tv(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:o,scrollBy:s,scrollContainerState:a,scrollTo:l,scrollTop:u,smoothScrollTargetReached:c,viewportHeight:h},d,f,{didMount:p,propsReady:m},{customScrollParent:g,useWindowScroll:v,windowScrollContainerState:y,windowScrollTo:b,windowViewportRect:x},w])=>{let S=tf(0),C=tf(0),k=tf(rD),M=tf({height:0,width:0}),T=tf({height:0,width:0}),A=tm(),D=tm(),E=tf(0),O=tf(null),R=tf({column:0,row:0}),P=tm(),I=tm(),N=tf(!1),j=tf(0),L=tf(!0),F=tf(!1),Z=tf(!1);tl(p,td(j),to(([e,t])=>!!t))(1,()=>{L(0,!1)}),tl(tb(p,L,T,M,j,F),to(([e,t,n,r,,i])=>e&&!t&&0!==n.height&&0!==r.height&&!i))(1,([,,,,e])=>{F(0,!0),no(1,()=>{A(0,e)}),tt(tl(u),()=>{t(0,[0,0]),L(0,!0)})}),te(tl(I,to(e=>null!=e&&e.scrollTop>0),ta(0)),C),tl(p,td(I),to(([,e])=>null!=e))(1,([,e])=>{e&&(M(0,e.viewport),T(0,e.item),R(0,e.gap),e.scrollTop>0&&(N(0,!0),tt(tl(u,tc(1)),e=>{N(0,!1)}),l(0,{top:e.scrollTop})))}),te(tl(M,ts(({height:e})=>e)),h),te(tl(tb(tx(M,rL),tx(T,rL),tx(R,(e,t)=>e&&e.column===t.column&&e.row===t.row),tx(u)),ts(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),P),te(tl(tb(tx(S),r,tx(R,rF),tx(T,rL),tx(M,rL),tx(O),tx(C),tx(N),tx(L),tx(j)),to(([,,,,,,,e])=>!e),ts(([e,[t,n],r,i,o,s,a,,l,u])=>{let c,h;let{column:d,row:f}=r,{height:p,width:m}=i,{width:g}=o;if(0===a&&(0===e||0===g))return rD;if(0===m){var v;let t=ns(u,e),n=t+Math.max(a-1,0);return v=rj(t,n,s),{...rE,items:v}}let y=rB(g,m,d);l?0===t&&0===n&&a>0?(c=0,h=a-1):(c=y*rR((t+f)/(p+f)),h=rI(e-1,rP(h=y*rO((n+f)/(p+f))-1,y-1)),c=rI(h,rP(0,c))):(c=0,h=-1);let b=rj(c,h,s),{bottom:x,top:w}=rV(o,r,i,b),S=rO(e/y);return{bottom:x,itemHeight:p,items:b,itemWidth:m,offsetBottom:S*p+(S-1)*f-x,offsetTop:w,top:w}})),k),te(tl(O,to(e=>null!==e),ts(e=>e.length)),S),te(tl(tb(M,T,k,R),to(([e,t,{items:n}])=>n.length>0&&0!==t.height&&0!==e.height),ts(([e,t,{items:n},r])=>{let{bottom:i,top:o}=rV(e,r,t,n);return[o,i]}),ti(tG)),t);let B=tf(!1);te(tl(u,td(B),ts(([e,t])=>t||0!==e)),B);let V=tg(tl(tb(k,S),to(([{items:e}])=>e.length>0),td(B),to(([[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}),ts(([[,e]])=>e-1),ti())),z=tg(tl(tx(k),to(({items:e})=>e.length>0&&0===e[0].index),ta(0),ti())),_=tg(tl(tx(k),td(N),to(([{items:e},t])=>e.length>0&&!t),ts(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),ti(tq),th(0)));te(_,f.scrollSeekRangeChanged),te(tl(A,td(M,T,S,R),ts(([e,t,n,r,i])=>{let o=nr(e),{align:s,behavior:a,offset:l}=o,u=o.index;"LAST"===u&&(u=r-1);let c=rz(t,i,n,u=rP(0,u,rI(r-1,u)));return"end"===s?c=rN(c-t.height+n.height):"center"===s&&(c=rN(c-t.height/2+n.height/2)),l&&(c+=l),{behavior:a,top:c}})),l);let H=tp(tl(k,ts(e=>e.offsetBottom+e.bottom)),0);return te(tl(x,ts(e=>({height:e.visibleHeight,width:e.visibleWidth}))),M),{customScrollParent:g,data:O,deviation:E,footerHeight:i,gap:R,headerHeight:o,increaseViewportBy:e,initialItemCount:C,itemDimensions:T,overscan:n,restoreStateFrom:I,scrollBy:s,scrollContainerState:a,scrollHeight:D,scrollTo:l,scrollToIndex:A,scrollTop:u,smoothScrollTargetReached:c,totalCount:S,useWindowScroll:v,viewportDimensions:M,windowScrollContainerState:y,windowScrollTo:b,windowViewportRect:x,...f,gridState:k,horizontalDirection:Z,initialTopMostItemIndex:j,totalListHeight:H,...d,endReached:V,propsReady:m,rangeChanged:_,startReached:z,stateChanged:P,stateRestoreInProgress:N,...w}},e8(ng,tR,nh,nR,nt,nP,tM));function rB(e,t,n){return rP(1,rR((e+n)/(rR(t)+n)))}function rV(e,t,n,r){let{height:i}=n;if(void 0===i||0===r.length)return{bottom:0,top:0};let o=rz(e,t,n,r[0].index);return{bottom:rz(e,t,n,r[r.length-1].index)+i,top:o}}function rz(e,t,n,r){let i=rR(r/rB(e.width,n.width,t.column)),o=i*n.height+rP(0,i-1)*t.row;return o>0?o+t.row:o}let r_=tv(()=>{let e=tf(e=>`Item ${e}`),t=tf({}),n=tf(null),r=tf("virtuoso-grid-item"),i=tf("virtuoso-grid-list"),o=tf(nY),s=tf("div"),a=tf(e3),l=(e,n=null)=>tp(tl(t,ts(t=>t[e]),ti()),n),u=tf(!1),c=tf(!1);return te(tx(c),u),{components:t,computeItemKey:o,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:s,itemClassName:r,ItemComponent:l("Item","div"),itemContent:e,listClassName:i,ListComponent:l("List","div"),readyStateChanged:u,reportReadyState:c,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),rH=tv(([e,t])=>({...e,...t}),e8(rZ,r_)),r$=m.memo(function(){let e=rY("gridState"),t=rY("listClassName"),n=rY("itemClassName"),r=rY("itemContent"),i=rY("computeItemKey"),o=rY("isSeeking"),s=rX("scrollHeight"),a=rY("ItemComponent"),l=rY("ListComponent"),u=rY("ScrollSeekPlaceholder"),c=rY("context"),h=rX("itemDimensions"),d=rX("gap"),f=rY("log"),g=rY("stateRestoreInProgress"),v=rX("reportReadyState"),y=tT(m.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:r0("column-gap",getComputedStyle(e).columnGap,f),row:r0("row-gap",getComputedStyle(e).rowGap,f)})},[s,h,d,f]),!0,!1);return nW(()=>{e.itemHeight>0&&e.itemWidth>0&&v(!0)},[e]),g?null:(0,p.jsx)(l,{className:t,ref:y,...n9(l,c),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let s=i(t.index,t.data,c);return o?(0,p.jsx)(u,{...n9(u,c),height:e.itemHeight,index:t.index,width:e.itemWidth},s):(0,m.createElement)(a,{...n9(a,c),className:n,"data-index":t.index,key:s},r(t.index,t.data,c))})})}),rW=m.memo(function(){let e=rY("HeaderComponent"),t=rX("headerHeight"),n=rY("headerFooterTag"),r=tT(m.useMemo(()=>e=>{t(tY(e,"height"))},[t]),!0,!1),i=rY("context");return e?(0,p.jsx)(n,{ref:r,children:(0,p.jsx)(e,{...n9(e,i)})}):null}),rq=m.memo(function(){let e=rY("FooterComponent"),t=rX("footerHeight"),n=rY("headerFooterTag"),r=tT(m.useMemo(()=>e=>{t(tY(e,"height"))},[t]),!0,!1),i=rY("context");return e?(0,p.jsx)(n,{ref:r,children:(0,p.jsx)(e,{...n9(e,i)})}):null}),rG=({children:e})=>{let t=m.useContext(n$),n=rX("itemDimensions"),r=rX("viewportDimensions"),i=tT(m.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return m.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,p.jsx)("div",{ref:i,style:n8(!1),children:e})},rU=({children:e})=>{let t=m.useContext(n$),n=rX("windowViewportRect"),r=rX("itemDimensions"),i=tO(n,rY("customScrollParent"),!1);return m.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,p.jsx)("div",{ref:i,style:n8(!1),children:e})},{useEmitter:rK,useEmitterValue:rY,usePublisher:rX}=n_(rH,{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"}},m.memo(function({...e}){let t=rY("useWindowScroll"),n=rY("customScrollParent"),r=n||t?rJ:rQ,i=n||t?rU:rG,o=rY("context");return(0,p.jsx)(r,{...e,...n9(r,o),children:(0,p.jsxs)(i,{children:[(0,p.jsx)(rW,{}),(0,p.jsx)(r$,{}),(0,p.jsx)(rq,{})]})})})),rQ=rn({useEmitter:rK,useEmitterValue:rY,usePublisher:rX}),rJ=rr({useEmitter:rK,useEmitterValue:rY,usePublisher:rX});function r0(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n(`${e} was not resolved to pixel value correctly`,t,tS.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}var r1=n(73037),r2=n(14544),r5=n(16758),r3=n(51183),r4=n(78849);function r8(e){return(0,A.ZP)("MuiListItemButton",e)}let r6=(0,T.Z)("MuiListItemButton",["root","focusVisible","dense","alignItemsFlexStart","disabled","divider","gutters","selected"]),r9=e=>{let{alignItems:t,classes:n,dense:r,disabled:i,disableGutters:o,divider:s,selected:a}=e,l=(0,y.Z)({root:["root",r&&"dense",!o&&"gutters",s&&"divider",i&&"disabled","flex-start"===t&&"alignItemsFlexStart",a&&"selected"]},r8,n);return{...n,...l}},r7=(0,S.ZP)(r2.Z,{shouldForwardProp:e=>(0,r1.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,C.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"}},[`&.${r6.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,b.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity),[`&.${r6.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:(0,b.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`&.${r6.selected}:hover`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:(0,b.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,b.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${r6.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${r6.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}}]}))),ie=m.forwardRef(function(e,t){let n=(0,M.i)({props:e,name:"MuiListItemButton"}),{alignItems:r="center",autoFocus:i=!1,component:o="div",children:s,dense:a=!1,disableGutters:l=!1,divider:u=!1,focusVisibleClassName:c,selected:h=!1,className:d,...f}=n,g=m.useContext(r4.Z),y=m.useMemo(()=>({dense:a||g.dense||!1,alignItems:r,disableGutters:l}),[r,g.dense,a,l]),b=m.useRef(null);(0,r5.Z)(()=>{i&&b.current&&b.current.focus()},[i]);let x={...n,alignItems:r,dense:y.dense,disableGutters:l,divider:u,selected:h},w=r9(x),S=(0,r3.Z)(b,t);return(0,p.jsx)(r4.Z.Provider,{value:y,children:(0,p.jsx)(r7,{ref:S,href:f.href||f.to,component:(f.href||f.to)&&"div"===o?"button":o,focusVisibleClassName:(0,v.Z)(w.focusVisible,c),ownerState:x,className:(0,v.Z)(w.root,d),...f,classes:w,children:s})})});var it=n(12577);function ir(...e){return e.flatMap(e=>void 0===e?[]:Array.isArray(e)?e:[e])}let ii=(0,m.memo)(function({color:e,sx:t,...n}){return(0,p.jsx)(W.Z,{...n,sx:ir({height:4,width:16,margin:e=>e.spacing(.5)},t),style:{backgroundColor:e}})}),io=(0,m.forwardRef)(function({item:e,sx:t,truncateLabel:n,onClick:r,isVisuallySelected:i,onMouseOver:o,onMouseOut:s,index:a,...l},u){let[c,h]=(0,m.useState)(n);return(0,p.jsxs)(ie,{...l,role:"listitem",sx:ir({padding:0,cursor:"pointer"},t),dense:!0,onClick:t=>{r(t,e.id),e.onClick?.(t)},onMouseOver:t=>o?.(t,{id:e.id,index:a}),onMouseOut:t=>s?.(t,{id:e.id,index:a}),selected:i,ref:u,children:[(0,p.jsx)(W.Z,{sx:{display:"flex",alignItems:"center"},children:(0,p.jsx)(ii,{color:e.color})}),(0,p.jsx)(it.Z,{primary:e.label,primaryTypographyProps:{noWrap:c},onMouseOver:function(){n&&h(!1)},onMouseOut:function(){n&&h(!0)}})]})}),is=(0,m.memo)(io);function ia(e,t){return"ALL"!==t&&!!t[e.id]}function il({items:e,height:t,width:n,selectedItems:r,onLegendItemClick:i,onItemMouseOver:o,onItemMouseOut:s}){let a=e.length>5;return(0,p.jsx)(ra,{style:{height:t,width:n},data:e,itemContent:(e,t)=>(0,p.jsx)(is,{item:t,index:e,truncateLabel:a,isVisuallySelected:ia(t,r),onClick:i,onMouseOver:o,onMouseOut:s,sx:{width:"100%",wordBreak:"break-word",overflow:"hidden"}},t.id),role:"list"})}function iu({height:e,items:t,selectedItems:n,onLegendItemClick:r,onItemMouseOver:i,onItemMouseOut:o}){return(0,p.jsx)(W.Z,{component:"ul",sx:{width:"100%",height:e,padding:[0,1,0,0],overflowY:"scroll",margin:0},children:t.map((e,t)=>(0,p.jsx)(is,{item:e,index:t,isVisuallySelected:ia(e,n),onMouseOver:i,onMouseOut:o,onClick:r,sx:{width:"auto",float:"left",paddingRight:1.5}},e.id))})}function ic(e,t){return"function"==typeof e?e(t):e}function ih(e,t){return n=>{t.setState(t=>({...t,[e]:ic(n,t[e])}))}}function id(e){return e instanceof Function}function ip(e,t,n){let r,i=[];return o=>{let s,a;n.key&&n.debug&&(s=Date.now());let l=e(o);if(!(l.length!==i.length||l.some((e,t)=>i[t]!==e)))return r;if(i=l,n.key&&n.debug&&(a=Date.now()),r=t(...l),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()-a)*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 im(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 ig="debugHeaders";function iv(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 iy(e,t,n,r){var i,o;let s=0,a=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&&a(e.columns,t+1)},0)};a(e);let l=[],u=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join("_"),headers:[]},o=[];e.forEach(e=>{let s;let a=[...o].reverse()[0],l=e.column.depth===i.depth,u=!1;if(l&&e.column.parent?s=e.column.parent:(s=e.column,u=!0),a&&(null==a?void 0:a.column)===s)a.subHeaders.push(e);else{let i=iv(n,s,{id:[r,t,s.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:u,placeholderId:u?`${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}),l.push(i),t>0&&u(o,t-1)};u(t.map((e,t)=>iv(n,e,{depth:s,index:t})),s-1),l.reverse();let c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];return e.subHeaders&&e.subHeaders.length?(r=[],c(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 c(null!=(i=null==(o=l[0])?void 0:o.headers)?i:[]),l}let ib=(e,t,n,r,i,o,s)=>{let a={id:t,index:r,original:n,depth:i,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(a._valuesCache.hasOwnProperty(t))return a._valuesCache[t];let n=e.getColumn(t);if(null!=n&&n.accessorFn)return a._valuesCache[t]=n.accessorFn(a.original,r),a._valuesCache[t]},getUniqueValues:t=>{if(a._uniqueValuesCache.hasOwnProperty(t))return a._uniqueValuesCache[t];let n=e.getColumn(t);return null!=n&&n.accessorFn?(n.columnDef.getUniqueValues?a._uniqueValuesCache[t]=n.columnDef.getUniqueValues(a.original,r):a._uniqueValuesCache[t]=[a.getValue(t)],a._uniqueValuesCache[t]):void 0},renderValue:t=>{var n;return null!=(n=a.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})(a.subRows,e=>e.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let e=[],t=a;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:ip(()=>[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:ip(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),im(e.options,"debugCells","cell.getContext"))};return e._features.forEach(r=>{null==r.createCell||r.createCell(i,n,t,e)},{}),i})(e,a,t,t.id)),im(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:ip(()=>[a.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),im(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(a,e)}return a},ix=(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))};ix.autoRemove=e=>iO(e);let iw=(e,t,n)=>{var r;return!!(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.includes(n))};iw.autoRemove=e=>iO(e);let iS=(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())};iS.autoRemove=e=>iO(e);let iC=(e,t,n)=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)};iC.autoRemove=e=>iO(e);let ik=(e,t,n)=>!n.some(n=>{var r;return!(null!=(r=e.getValue(t))&&r.includes(n))});ik.autoRemove=e=>iO(e)||!(null!=e&&e.length);let iM=(e,t,n)=>n.some(n=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)});iM.autoRemove=e=>iO(e)||!(null!=e&&e.length);let iT=(e,t,n)=>e.getValue(t)===n;iT.autoRemove=e=>iO(e);let iA=(e,t,n)=>e.getValue(t)==n;iA.autoRemove=e=>iO(e);let iD=(e,t,n)=>{let[r,i]=n,o=e.getValue(t);return o>=r&&o<=i};iD.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]},iD.autoRemove=e=>iO(e)||iO(e[0])&&iO(e[1]);let iE={includesString:ix,includesStringSensitive:iw,equalsString:iS,arrIncludes:iC,arrIncludesAll:ik,arrIncludesSome:iM,equals:iT,weakEquals:iA,inNumberRange:iD};function iO(e){return null==e||""===e}function iR(e,t,n){return!!e&&!!e.autoRemove&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}let iP={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},iI=()=>({left:[],right:[]}),iN={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},ij=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),iL=null;function iF(e){return"touchstart"===e.type}function iZ(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}let iB=()=>({pageIndex:0,pageSize:10}),iV=()=>({top:[],bottom:[]}),iz=(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=>iz(e,t.id,n,r,i))};function i_(e,t){let n=e.getState().rowSelection,r=[],i={},o=function(e,t){return e.map(e=>{var t;let s=iH(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 iH(e,t){var n;return null!=(n=t[e.id])&&n}function i$(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()&&(iH(e,t)?o=!0:i=!1),e.subRows&&e.subRows.length)){let n=i$(e,t);"all"===n?o=!0:("some"===n&&(o=!0),i=!1)}}),i?"all":!!o&&"some"}let iW=/([0-9]+)/gm;function iq(e,t){return e===t?0:e>t?1:-1}function iG(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function iU(e,t){let n=e.split(iW).filter(Boolean),r=t.split(iW).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 iK={alphanumeric:(e,t,n)=>iU(iG(e.getValue(n)).toLowerCase(),iG(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>iU(iG(e.getValue(n)),iG(t.getValue(n))),text:(e,t,n)=>iq(iG(e.getValue(n)).toLowerCase(),iG(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>iq(iG(e.getValue(n)),iG(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)=>iq(e.getValue(n),t.getValue(n))},iY=[{createTable:e=>{e.getHeaderGroups=ip(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,s;let a=null!=(o=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?o:[],l=null!=(s=null==i?void 0:i.map(e=>n.find(t=>t.id===e)).filter(Boolean))?s:[];return iy(t,[...a,...n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=i&&i.includes(e.id))),...l],e)},im(e.options,ig,"getHeaderGroups")),e.getCenterHeaderGroups=ip(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>iy(t,n=n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=i&&i.includes(e.id))),e,"center"),im(e.options,ig,"getCenterHeaderGroups")),e.getLeftHeaderGroups=ip(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;return iy(t,null!=(i=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"left")},im(e.options,ig,"getLeftHeaderGroups")),e.getRightHeaderGroups=ip(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;return iy(t,null!=(i=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"right")},im(e.options,ig,"getRightHeaderGroups")),e.getFooterGroups=ip(()=>[e.getHeaderGroups()],e=>[...e].reverse(),im(e.options,ig,"getFooterGroups")),e.getLeftFooterGroups=ip(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),im(e.options,ig,"getLeftFooterGroups")),e.getCenterFooterGroups=ip(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),im(e.options,ig,"getCenterFooterGroups")),e.getRightFooterGroups=ip(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),im(e.options,ig,"getRightFooterGroups")),e.getFlatHeaders=ip(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),im(e.options,ig,"getFlatHeaders")),e.getLeftFlatHeaders=ip(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),im(e.options,ig,"getLeftFlatHeaders")),e.getCenterFlatHeaders=ip(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),im(e.options,ig,"getCenterFlatHeaders")),e.getRightFlatHeaders=ip(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),im(e.options,ig,"getRightFlatHeaders")),e.getCenterLeafHeaders=ip(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),im(e.options,ig,"getCenterLeafHeaders")),e.getLeftLeafHeaders=ip(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),im(e.options,ig,"getLeftLeafHeaders")),e.getRightLeafHeaders=ip(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),im(e.options,ig,"getRightLeafHeaders")),e.getLeafHeaders=ip(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>{var r,i,o,s,a,l;return[...null!=(r=null==(i=e[0])?void 0:i.headers)?r:[],...null!=(o=null==(s=t[0])?void 0:s.headers)?o:[],...null!=(a=null==(l=n[0])?void 0:l.headers)?a:[]].map(e=>e.getLeafHeaders()).flat()},im(e.options,ig,"getLeafHeaders"))}},{getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:ih("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=ip(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),im(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=ip(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],im(t.options,"debugRows","getVisibleCells"))},createTable:e=>{let t=(t,n)=>ip(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join("_")],e=>e.filter(e=>null==e.getIsVisible?void 0:e.getIsVisible()),im(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:ih("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=ip(e=>[iZ(t,e)],t=>t.findIndex(t=>t.id===e.id),im(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=n=>{var r;return(null==(r=iZ(t,n)[0])?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;let i=iZ(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=ip(()=>[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;return function(e,t,n){if(!(null!=t&&t.length)||!n)return e;let r=e.filter(e=>!t.includes(e.id));return"remove"===n?r:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...r]}(i,t,n)},im(e.options,"debugTable","_getOrderColumnsFn"))}},{getInitialState:e=>({columnPinning:iI(),...e}),getDefaultOptions:e=>({onColumnPinningChange:ih("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,a,l;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!=(a=null==e?void 0:e.left)?a:[]).filter(e=>!(null!=r&&r.includes(e))),...r],right:(null!=(l=null==e?void 0:e.right)?l:[]).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=ip(()=>[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))},im(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=ip(()=>[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"})),im(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=ip(()=>[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"})),im(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?iI():null!=(n=null==(r=e.initialState)?void 0:r.columnPinning)?n:iI())},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=ip(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),im(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=ip(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),im(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=ip(()=>[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))},im(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:ih("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?iE.includesString:"number"==typeof r?iE.inNumberRange:"boolean"==typeof r||null!==r&&"object"==typeof r?iE.equals:Array.isArray(r)?iE.arrIncludes:iE.weakEquals},e.getFilterFn=()=>{var n,r;return id(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:iE[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),a=ic(n,s?s.value:void 0);if(iR(o,a,e))return null!=(r=null==t?void 0:t.filter(t=>t.id!==e.id))?r:[];let l={id:e.id,value:a};return s?null!=(i=null==t?void 0:t.map(t=>t.id===e.id?l:t))?i:[]:null!=t&&t.length?[...t,l]:[l]})}},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=ic(t,e))?void 0:r.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&iR(t.getFilterFn(),e.value,t))})})},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:ih("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=()=>iE.includesString,e.getGlobalFilterFn=()=>{var t,n;let{globalFilterFn:r}=e.options;return id(r)?r:"auto"===r?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[r])?t:iE[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:ih("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 iK.datetime;if("string"==typeof n&&(r=!0,n.split(iW).length>1))return iK.alphanumeric}return r?iK.text:iK.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 id(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:iK[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),o=null!=n;t.setSorting(s=>{let a;let l=null==s?void 0:s.find(t=>t.id===e.id),u=null==s?void 0:s.findIndex(t=>t.id===e.id),c=[],h=o?n:"desc"===i;if("toggle"!=(a=null!=s&&s.length&&e.getCanMultiSort()&&r?l?"toggle":"add":null!=s&&s.length&&u!==s.length-1?"replace":l?"toggle":"replace")||o||i||(a="remove"),"add"===a){var d;(c=[...s,{id:e.id,desc:h}]).splice(0,c.length-(null!=(d=t.options.maxMultiSortColCount)?d:Number.MAX_SAFE_INTEGER))}else c="toggle"===a?s.map(t=>t.id===e.id?{...t,desc:h}:t):"remove"===a?s.filter(t=>t.id!==e.id):[{id:e.id,desc:h}];return c})},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:ih("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?iP.sum:"[object Date]"===Object.prototype.toString.call(r)?iP.extent:void 0},e.getAggregationFn=()=>{var n,r;if(!e)throw Error();return id(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:iP[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:ih("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}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:{...iB(),...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:ih("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}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=>ic(t,e)),e.resetPagination=t=>{var n;e.setPagination(t?iB():null!=(n=e.initialState.pagination)?n:iB())},e.setPageIndex=t=>{e.setPagination(n=>{let r=ic(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,ic(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=ic(t,null!=(r=e.options.pageCount)?r:-1);return"number"==typeof i&&(i=Math.max(-1,i)),{...n,pageCount:i}}),e.getPageOptions=ip(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},im(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:iV(),...e}),getDefaultOptions:e=>({onRowPinningChange:ih("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,a,l;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!=(a=null==e?void 0:e.top)?a:[]).filter(e=>!(null!=s&&s.has(e))),...Array.from(s)],bottom:(null!=(l=null==e?void 0:e.bottom)?l:[]).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?iV():null!=(n=null==(r=e.initialState)?void 0:r.rowPinning)?n:iV())},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=ip(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),im(e.options,"debugRows","getTopRows")),e.getBottomRows=ip(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),im(e.options,"debugRows","getBottomRows")),e.getCenterRows=ip(()=>[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))},im(e.options,"debugRows","getCenterRows"))}},{getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:ih("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=>{iz(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ip(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?i_(e,n):{rows:[],flatRows:[],rowsById:{}},im(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=ip(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?i_(e,n):{rows:[],flatRows:[],rowsById:{}},im(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=ip(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?i_(e,n):{rows:[],flatRows:[],rowsById:{}},im(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 a={...o};return iz(a,e.id,n,null==(s=null==r?void 0:r.selectChildren)||s,t),a})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return iH(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return"some"===i$(e,n)},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return"all"===i$(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:()=>iN,getInitialState:e=>({columnSizing:{},columnSizingInfo:ij(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:ih("columnSizing",e),onColumnSizingInfoChange:ih("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:iN.minSize,null!=(r=null!=o?o:e.columnDef.size)?r:iN.size),null!=(i=e.columnDef.maxSize)?i:iN.maxSize)},e.getStart=ip(e=>[e,iZ(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),im(t.options,"debugColumns","getStart")),e.getAfter=ip(e=>[e,iZ(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),im(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(),iF(o)&&o.touches&&o.touches.length>1))return;let s=e.getSize(),a=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],l=iF(o)?Math.round(o.touches[0].clientX):o.clientX,u={},c=(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,a=Math.max(s/(null!=(i=null==e?void 0:e.startSize)?i:0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;u[t]=Math.round(100*Math.max(n+n*a,0))/100}),{...e,deltaOffset:s,deltaPercentage:a}}),("onChange"===t.options.columnResizeMode||"end"===e)&&t.setColumnSizing(e=>({...e,...u})))},h=e=>c("move",e),d=e=>{c("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 iL)return iL;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 iL=e}()&&{passive:!1};iF(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:l,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,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?ij():null!=(n=e.initialState.columnSizingInfo)?n:ij())},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 iX=n(14968);let iQ=(0,m.forwardRef)(function(e,t){return(0,p.jsx)(iX.Z,{...e,ref:t,sx:{backgroundColor:e=>e.palette.background.default,"&:hover":{backgroundColor:e=>(0,b.Fq)(e.palette.primary.main,e.palette.action.hoverOpacity)}}})});var iJ=n(56174);let i0=(0,m.forwardRef)(function(e,t){return(0,p.jsx)(iJ.Z,{...e,ref:t})});var i1=n(90190);let i2=(0,S.ZP)(i1.Z)(({theme:e})=>({tableLayout:"fixed",borderCollapse:"separate",backgroundColor:e.palette.background.default})),i5={compact:"small",standard:"medium",comfortable:"medium"},i3=(0,m.forwardRef)(function({density:e,...t},n){return(0,p.jsx)(i2,{...t,tabIndex:-1,size:i5[e],ref:n,sx:{width:"100%"}})});var i4=n(31889);let i8=(0,m.forwardRef)(function(e,t){return(0,p.jsx)(i4.Z,{...e,ref:t})});var i6=n(52054),i9=n(90247);let i7=(0,i9.Z)((0,p.jsx)("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownward");function oe(e){return(0,A.ZP)("MuiTableSortLabel",e)}let ot=(0,T.Z)("MuiTableSortLabel",["root","active","icon","iconDirectionDesc","iconDirectionAsc","directionDesc","directionAsc"]);var on=n(16351);let or=e=>{let{classes:t,direction:n,active:r}=e,i={root:["root",r&&"active",`direction${(0,w.Z)(n)}`],icon:["icon",`iconDirection${(0,w.Z)(n)}`]};return(0,y.Z)(i,oe,t)},oi=(0,S.ZP)(r2.Z,{name:"MuiTableSortLabel",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.active&&t.active]}})((0,C.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,[`& .${ot.icon}`]:{opacity:.5}},[`&.${ot.active}`]:{color:(e.vars||e).palette.text.primary,[`& .${ot.icon}`]:{opacity:1,color:(e.vars||e).palette.text.secondary}}}))),oo=(0,S.ZP)("span",{name:"MuiTableSortLabel",slot:"Icon",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,t[`iconDirection${(0,w.Z)(n.direction)}`]]}})((0,C.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)"}}]}))),os=m.forwardRef(function(e,t){let n=(0,M.i)({props:e,name:"MuiTableSortLabel"}),{active:r=!1,children:i,className:o,direction:s="asc",hideSortIcon:a=!1,IconComponent:l=i7,slots:u={},slotProps:c={},...h}=n,d={...n,active:r,direction:s,hideSortIcon:a,IconComponent:l},f=or(d),m={slots:u,slotProps:c},[g,y]=(0,on.Z)("root",{elementType:oi,externalForwardedProps:m,ownerState:d,className:(0,v.Z)(f.root,o),ref:t}),[b,x]=(0,on.Z)("icon",{elementType:oo,externalForwardedProps:m,ownerState:d,className:f.icon});return(0,p.jsxs)(g,{disableRipple:!0,component:"span",...y,...h,children:[i,a&&!r?null:(0,p.jsx)(b,{as:l,...x})]})});var oa=n(96205);let ol=150,ou=40;function oc(e,t,{isHeader:n,isLastColumn:r,isFirstColumn:i,defaultColumnHeight:o}={}){var s,a;let l=e.spacing(1),u=e.spacing(1.25),c=e.spacing(2),h=i?c:u,d=r?c:u,f=e.typography.body1.lineHeight,p=e.typography.body1.fontSize;"compact"===t&&(l=e.spacing(.5),u=e.spacing(.5),c=e.spacing(1),h=i?c:u,d=r?c:u,f=e.typography.body2.lineHeight,p=e.typography.body2.fontSize),"comfortable"===t&&(l=e.spacing(2),u=e.spacing(1.5),c=e.spacing(2),h=i?c:u,d=r?c:u,f=e.typography.body1.lineHeight,p=e.typography.body1.fontSize);let m=n||!o||"auto"===o?(s=f,a=l,("string"==typeof s?parseInt(s,10):s??0)+2*("string"==typeof a?parseInt(a,10):a)):o;return{padding:`${l} ${d} ${l} ${h}`,height:m,fontSize:p,lineHeight:f}}function oh(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 od=(0,S.ZP)(oa.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 of({children:e,density:t,variant:n,width:r,defaultColumnHeight:i,focusState:o="none",onFocusTrigger:s,isFirstColumn:a,isLastColumn:l,description:u,align:c,color:h,backgroundColor:d,...f}){let g=(0,eX.Z)(),v=(0,m.useRef)(),y="head"===n;(0,m.useEffect)(()=>{"trigger-focus"===o&&v.current&&v.current.focus()},[o]);let b=e=>{s?.(e)};return(0,p.jsx)(od,{...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:b,onKeyUp:b,style:{width:r},sx:{position:"relative",borderBottom:y?`solid 1px ${g.palette.grey[100]}`:`solid 1px ${g.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??g.palette.background.default} !important`,outline:`solid 1px ${g.palette.info.main}`,outlineOffset:"-1px"}},ref:v,children:(0,p.jsx)(W.Z,{id:"original-cell",sx:{...oc(g,t,{isHeader:y,isLastColumn:l,isFirstColumn:a,defaultColumnHeight:i}),position:"relative",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flexDirection:"inherit"},style:{backgroundColor:d??"inherit",color:h??"inherit"},title:u,"aria-label":u,textAlign:c,children:e})})}function op({onSort:e,sortDirection:t,nextSortDirection:n,children:r,...i}){let o=!!e,s=(0,p.jsx)(i6.Z,{noWrap:!0,variant:"inherit",component:"div",color:"inherit",children:r}),a=!!t;return(0,p.jsx)(of,{...i,children:o?(0,p.jsx)(os,{onClick:e,direction:a?t:n,active:a,sx:{verticalAlign:"unset",maxWidth:"100%","&:focus-visible":{[`& .${ot.icon}`]:{opacity:a?1:.5}}},children:s}):s})}var om=n(59019);let og=(0,m.forwardRef)(function(e,t){return(0,p.jsx)(om.Z,{...e,tabIndex:-1,ref:t})}),ov={row:0,column:0},oy=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"];function ob({width:e,height:t,density:n,defaultColumnWidth:r,defaultColumnHeight:i,onRowClick:o,onRowMouseOver:s,onRowMouseOut:a,rows:l,columns:u,headers:c,cellConfigs:h}){let d=(0,m.useRef)(null),f=(0,m.useRef)({startIndex:0,endIndex:0}),g=function({visibleRange:e,virtualTable:t,maxRows:n,maxColumns:r}){return function({maxRows:e,maxColumns:t,onActiveCellChange:n}){let[r,i]=(0,m.useState)(ov),[o,s]=(0,m.useState)(!1);return{activeCell:r,isActive:o,onTableKeyDown:(0,m.useCallback)(r=>{let o=r.key;(oy.includes(o)||"Home"===o||"End"===o||"PageDown"===o||"PageUp"===o)&&i(i=>{let s=i.row,a=i.column;"ArrowRight"===o&&a<t-1?(r.preventDefault(),a+=1):"ArrowLeft"===o&&a>0?(r.preventDefault(),a-=1):"ArrowDown"===o&&s<e-1?(r.preventDefault(),s+=1):"ArrowUp"===o&&s>0?(r.preventDefault(),s-=1):"Home"===o?(r.preventDefault(),s=0,a=0):"End"===o&&(r.preventDefault(),s=e-1,a=t-1);let l={column:a,row:s},u=n?.(r,i,l)||l;return u.row===i.row&&u.column===i.column?i:u})},[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,a=o&&(i.column!==o.column||i.row!==o.row),l=o?.row??i.row;if("ArrowDown"===s&&a)(l-1<e.current.startIndex||l-1>e.current.endIndex)&&t.current?.scrollToIndex({index:l-1,align:"end"});else if("ArrowUp"===s&&a)(l-1<e.current.startIndex||l-1>e.current.endIndex)&&t.current?.scrollToIndex({index:l-1,align:"start"});else if(a&&("Home"===s||"End"===s))t.current?.scrollToIndex({index:Math.max(l-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:f,virtualTable:d,maxRows:l.length+1,maxColumns:u.length}),v=e=>e.row===g.activeCell.row&&e.column===g.activeCell.column?g.isActive?"trigger-focus":"focus-next":"none",y=(0,m.useMemo)(()=>({Scroller:og,Table:t=>(0,p.jsx)(i3,{...t,width:e,density:n,onKeyDown:g.onTableKeyDown}),TableHead:i8,TableRow:({item:e,...t})=>{let r=l[t["data-index"]];if(!r)return null;let i={id:r.id,index:r.index};return(0,p.jsx)(iQ,{...t,onClick:e=>o(e,r.id),density:n,onMouseOver:e=>{s?.(e,i)},onMouseOut:e=>{a?.(e,i)}})},TableBody:i0}),[n,g.onTableKeyDown,o,a,s,l,e]);return(0,p.jsx)(W.Z,{style:{width:e,height:t},children:(0,p.jsx)(rS,{ref:d,totalCount:l.length,components:y,rangeChanged:e=>{f.current=e},fixedHeaderContent:()=>(0,p.jsx)(p.Fragment,{children:c.map(e=>(0,p.jsx)(iQ,{density:n,children:e.headers.map((e,t,o)=>{var s,a,l,u,c;let h=e.column,d={row:0,column:t},f=h.getIsSorted(),y=h.getNextSortingOrder();return(0,p.jsx)(op,{onSort:h.getCanSort()?h.getToggleSortingHandler():void 0,sortDirection:"string"==typeof f?f:void 0,nextSortDirection:"string"==typeof y?y:void 0,width:h.getSize()||r,defaultColumnHeight:i,align:h.columnDef.meta?.align,variant:"head",density:n,description:h.columnDef.meta?.headerDescription,focusState:v(d),onFocusTrigger:()=>g.onCellFocus(d),isFirstColumn:0===t,isLastColumn:t===o.length-1,children:(s=h.columnDef.header,a=e.getContext(),s?"function"==typeof(u=l=s)&&(()=>{let e=Object.getPrototypeOf(u);return e.prototype&&e.prototype.isReactComponent})()||"function"==typeof l||"object"==typeof(c=l)&&"symbol"==typeof c.$$typeof&&["react.memo","react.forward_ref"].includes(c.$$typeof.description)?m.createElement(s,a):s:null)},e.id)})},e.id))}),itemContent:e=>{let t=l[e];return t?(0,p.jsx)(p.Fragment,{children:t.getVisibleCells().map((t,o,s)=>{let a;let l={row:e+1,column:o},u=t.getContext(),c=h?.[u.cell.id],d=t.column.columnDef.cell,f="function"==typeof d?d(u):null,m=t.column.columnDef.meta?.cellDescription;return"function"==typeof m?a=m(u):m&&"string"==typeof f&&(a=f),(0,p.jsx)(of,{"data-testid":t.id,title:a||c?.text||f,width:t.column.getSize()||r,defaultColumnHeight:i,align:t.column.columnDef.meta?.align,density:n,focusState:v(l),onFocusTrigger:()=>g.onCellFocus(l),isFirstColumn:0===o,isLastColumn:o===s.length-1,description:a,color:c?.textColor??void 0,backgroundColor:c?.backgroundColor??void 0,children:c?.text||f},t.id)})}):null}})})}var ox=n(82707);function ow({color:e,density:t,...n}){let r="compact"===t;return(0,p.jsx)(ox.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,b.Fq)(e,.5):void 0},"& .MuiSvgIcon-root":{fontSize:r?16:18}}})}let oS=(e,t)=>`${t}`,oC={},ok=[];function oM({data:e,columns:t,cellConfigs:n,density:r="standard",defaultColumnWidth:i=ol,defaultColumnHeight:o="auto",checkboxSelection:s,onRowSelectionChange:a,onSortingChange:l,getCheckboxColor:u,getRowId:c=oS,rowSelection:h=oC,sorting:d=ok,rowSelectionVariant:f="standard",...g}){let v=(0,eX.Z)(),y=(0,m.useCallback)((e,t,n)=>{"standard"===f||n?t.toggleSelected():t.getIsSelected()&&!e.getIsAllRowsSelected()?e.toggleAllRowsSelected():a?.({[t.id]:!0})},[a,f]),b=(0,m.useCallback)((e,t,n)=>{let r=e.nativeEvent&&(e.nativeEvent instanceof MouseEvent||e.nativeEvent instanceof KeyboardEvent)?e.nativeEvent:void 0;y(t,n,!!r?.metaKey||!!r?.shiftKey)},[y]),x=(0,m.useMemo)(()=>({id:"checkboxRowSelect",size:28,header:({table:e})=>(0,p.jsx)(ow,{checked:e.getIsAllRowsSelected(),indeterminate:e.getIsSomeRowsSelected(),onChange:e.getToggleAllRowsSelectedHandler(),color:v.palette.text.primary,density:r}),cell:({row:e,table:t})=>(0,p.jsx)(ow,{checked:e.getIsSelected(),indeterminate:e.getIsSomeSelected(),onChange:n=>{b(n,t,e)},color:u?.(e.original),density:r}),enableSorting:!1}),[v.palette.text.primary,r,u,b]),w=function(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=m.useState(()=>({current:function(e){var t,n;let r=[...iY,...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=e=>i.options.mergeOptions?i.options.mergeOptions(o,e):{...o,...e},a={...null!=(n=e.initialState)?n:{}};i._features.forEach(e=>{var t;a=null!=(t=null==e.getInitialState?void 0:e.getInitialState(a))?t:a});let l=[],u=!1,c={_features:r,options:{...o,...e},initialState:a,_queue:e=>{l.push(e),u||(u=!0,Promise.resolve().then(()=>{for(;l.length;)l.shift()();u=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{i.setState(i.initialState)},setOptions:e=>{let t=ic(e,i.options);i.options=s(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:ip(()=>[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}},im(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>i.options.columns,getAllColumns:ip(()=>[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;let a={...e._getDefaultColumnDef(),...t},l=a.accessorKey,u=null!=(i=null!=(o=a.id)?o:l?"function"==typeof String.prototype.replaceAll?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)?i:"string"==typeof a.header?a.header:void 0;if(a.accessorFn?s=a.accessorFn:l&&(s=l.includes(".")?e=>{let t=e;for(let e of l.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[a.accessorKey]),!u)throw Error();let c={id:`${String(u)}`,accessorFn:s,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:ip(()=>[!0],()=>{var e;return[c,...null==(e=c.columns)?void 0:e.flatMap(e=>e.getFlatColumns())]},im(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:ip(()=>[e._getOrderColumnsFn()],e=>{var t;return null!=(t=c.columns)&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},im(e.options,"debugColumns","column.getLeafColumns"))};for(let t of e._features)null==t.createColumn||t.createColumn(c,e);return c}(i,e,r,n);return o.columns=e.columns?t(e.columns,o,r+1):[],o})};return t(e)},im(e,"debugColumns","getAllColumns")),getAllFlatColumns:ip(()=>[i.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),im(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:ip(()=>[i.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),im(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:ip(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),im(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]=m.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,m.useMemo)(()=>{let e=oh(t);return s&&e.unshift(x),e},[x,s,t]),getRowId:c,getCoreRowModel:e=>ip(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,o){void 0===i&&(i=0);let s=[];for(let l=0;l<t.length;l++){let u=ib(e,e._getRowId(t[l],l,o),t[l],l,i,void 0,null==o?void 0:o.id);if(n.flatRows.push(u),n.rowsById[u.id]=u,s.push(u),e.options.getSubRows){var a;u.originalSubRows=e.options.getSubRows(t[l],l),null!=(a=u.originalSubRows)&&a.length&&(u.subRows=r(u.originalSubRows,i+1,u))}}return s};return n.rows=r(t),n},im(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex())),getSortedRowModel:e=>ip(()=>[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 a=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],a=s[i.id],l=a.sortUndefined,u=null!=(n=null==i?void 0:i.desc)&&n,c=0;if(l){let n=e.getValue(i.id),r=t.getValue(i.id),o=void 0===n,s=void 0===r;if(o||s){if("first"===l)return o?-1:1;if("last"===l)return o?1:-1;c=o&&s?0:o?l:-l}}if(0===c&&(c=a.sortingFn(e,t,i.id)),0!==c)return u&&(c*=-1),a.invertSorting&&(c*=-1),c}return e.index-t.index}),t.forEach(e=>{var t;i.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=a(e.subRows))}),t};return{rows:a(n.rows),flatRows:i,rowsById:n.rowsById}},im(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex())),enableRowSelection:!!s,onRowSelectionChange:e=>{let t="function"==typeof e?e(h):e;a?.(t)},onSortingChange:e=>{let t="function"==typeof e?e(d):e;l?.(t)},sortDescFirst:!0,state:{rowSelection:h,sorting:d}}),S=(0,m.useCallback)((e,t)=>{let n=w.getRow(t);y(w,n,e.metaKey||e.shiftKey)},[y,w]);return(0,p.jsx)(ob,{...g,density:r,defaultColumnWidth:i,defaultColumnHeight:o,onRowClick:S,rows:w.getRowModel().rows,columns:w.getAllFlatColumns(),headers:w.getHeaderGroups(),cellConfigs:n})}let oT=[{accessorKey:"label",header:"Name",enableSorting:!0,cell:({getValue:e})=>(0,p.jsx)("span",{title:e(),children:e()})}],oA=e=>e.id,oD=e=>e.color;function oE({items:e,selectedItems:t,onSelectedItemsChange:n,onItemMouseOver:r,onItemMouseOut:i,height:o,width:s,columns:a=[],sorting:l,onSortingChange:u}){let c=(0,m.useMemo)(()=>"string"!=typeof t?t:e.reduce((e,t,n)=>(e[oA(t,n)]=!0,e),{}),[t,e]),h=(0,m.useMemo)(()=>[...oT,...a],[a]);return(0,p.jsx)(oM,{height:o,width:s,rowSelection:c,onRowSelectionChange:n,onRowMouseOver:r,onRowMouseOut:i,sorting:l,onSortingChange:u,data:e,columns:h,density:"compact",defaultColumnWidth:"auto",getRowId:oA,getCheckboxColor:oD,checkboxSelection:!0,rowSelectionVariant:"legend"})}function oO({width:e,height:t,options:n,data:r,selectedItems:i,onSelectedItemsChange:o,onItemMouseOver:s,onItemMouseOut:a,tableProps:l}){let u;let c=(e,t)=>{let n=e.metaKey||e.shiftKey;o((0,eJ.produce)(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,eQ.bk)(n.mode),d=r.length>=500,f={height:t,items:r,selectedItems:i,onLegendItemClick:c,onItemMouseOver:s,onItemMouseOut:a};return(u="table"===h?(0,p.jsx)(oE,{...f,onSelectedItemsChange:o,width:e,...l}):"right"===n.position||d?(0,p.jsx)(il,{...f,width:e,onLegendItemClick:c}):(0,p.jsx)(iu,{...f,onLegendItemClick:c}),"right"===n.position)?(0,p.jsx)(W.Z,{style:{width:e,height:t},sx:{position:"absolute",top:0,right:0},children:u}):(0,p.jsx)(W.Z,{style:{width:e,height:t},sx:{position:"absolute",bottom:0},children:u})}let oR={medium:{bottom:6,right:250},small:{bottom:4,right:150}};function oP({children:e,legendProps:t,width:n,height:r,spacing:i=0,legendSize:o,minChildrenWidth:s=100,minChildrenHeight:a=100}){let{content:l,legend:u,margin:c}=function({width:e,height:t,legendProps:n,legendSize:r,minChildrenHeight:i,minChildrenWidth:o,spacing:s,theme:a}){let l,u;let c=n?.options,h={legend:{show:!1,width:0,height:0},content:{width:e,height:t},margin:{right:0,bottom:0}};if(!c)return h;let{position:d}=c;if("list"===(0,eQ.bk)(c.mode))l="right"===d?200:e,u=40,"right"===d?u=t:t>=300&&(u=100);else{let i=oc(a,"compact"),o=(n?.tableProps?.columns||[]).reduce((e,t)=>("number"==typeof t.width&&(e+=t.width),e),0);l="right"===d?oR[r].right+o:e;let s=Math.min(oR[r].bottom,n.data.length+1);u="bottom"===d?s*i.height:t}let f="right"===d?e-l-s:e,p="bottom"===d?t-u-s:t;return"right"===d&&f<o||"bottom"===d&&p<i?h:{legend:{width:l,height:u,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:a,minChildrenWidth:s,spacing:i,theme:(0,eX.Z)(),legendSize:(0,eQ.dT)(o)});return(0,p.jsxs)(W.Z,{style:{width:n,height:r},sx:{position:"relative",overflow:"hidden"},children:[(0,p.jsx)(W.Z,{style:{width:l.width,height:l.height},sx:{marginRight:`${c.right}px`,marginBottom:`${c.bottom}px`,overflow:"hidden"},children:"function"==typeof e?e({width:l.width,height:l.height}):e}),t&&u.show&&(0,p.jsx)(oO,{...t,height:u.height,width:u.width})]})}let oI=(0,m.forwardRef)(function({debounceMs:e=250,value:t,onChange:n,...r},i){let[o,s]=(0,m.useState)(t),a=(0,m.useCallback)(e=>{n?.(e)},[n]),l=(0,m.useMemo)(()=>ee()(a,e),[e,a]);return(0,p.jsx)(ep.Z,{ref:i,value:o,onChange:function(e){s(e.target.value),l(e.target.value)},...r})});oI.displayName="TextField";var oN=n(51602),oj=n(19978),oL=n(56873),oF=n(70616),oZ=n(10763);let oB=(0,S.ZP)("form")({overflowY:"auto",display:"flex",flexDirection:"column"}),oV=e=>({position:"absolute",top:e.spacing(.5),right:e.spacing(.5)}),oz=({children:e,...t})=>(0,p.jsx)(oL.Z,{...t,children:e});oz.Header=({children:e,onClose:t,...n})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(oN.Z,{style:{textOverflow:"ellipsis",overflow:"hidden"},...n,children:e}),t&&(0,p.jsx)(ef.Z,{"aria-label":"Close",onClick:t,sx:oV,children:(0,p.jsx)(oZ.default,{})})]}),oz.Form=oB,oz.Content=({children:e,sx:t,...n})=>(0,p.jsx)(oj.Z,{dividers:!0,...n,sx:ir({minWidth:"500px",textWrap:"balance"},t),children:e}),oz.PrimaryButton=({children:e,...t})=>(0,p.jsx)(j.Z,{variant:"contained",type:"submit",...t,children:e}),oz.SecondaryButton=({children:e,...t})=>(0,p.jsx)(j.Z,{variant:"outlined",color:"secondary",...t,children:e}),oz.Actions=oF.Z;let o_=e=>{let{description:t,isOpen:n,onCancel:r,onDiscardChanges:i}=e;return(0,p.jsxs)(oz,{open:n,"aria-labelledby":"discard-dialog",children:[(0,p.jsx)(oz.Header,{children:"Discard Changes"}),(0,p.jsx)(oz.Content,{children:t}),(0,p.jsxs)(oz.Actions,{children:[(0,p.jsx)(j.Z,{variant:"contained",onClick:i,children:"Discard Changes"}),(0,p.jsx)(j.Z,{variant:"outlined",color:"secondary",onClick:r,children:"Cancel"})]})]})};var oH=n(90192),o$=n(23626),oW=n(39398);function oq(e){void 0===globalThis.useIdValue&&(globalThis.useIdValue=0);let t=(0,m.useRef)(void 0);return void 0===t.current&&(t.current=`${e}-${globalThis.useIdValue++}`),t.current}var oG=n(32964),oU=n(87143);let oK=({id:e,title:t,description:n,placement:r,children:i,enterDelay:o,enterNextDelay:s})=>{let a=(0,p.jsx)("span",{children:i});return(0,p.jsx)(oX,{arrow:!0,id:e,placement:r??"top",title:(0,p.jsx)(oY,{title:t,description:n}),enterDelay:o??500,enterNextDelay:s??500,children:a})},oY=({title:e,description:t})=>(0,p.jsxs)(p.Fragment,{children:[e&&(0,p.jsx)(i6.Z,{variant:"body2",sx:e=>({color:e.palette.text.primary,fontWeight:e.typography.fontWeightMedium}),children:e}),(0,p.jsx)(i6.Z,{variant:"caption",sx:e=>({color:e.palette.text.primary,whiteSpace:"pre-line"}),children:t})]}),oX=(0,S.ZP)(({className:e,...t})=>(0,p.jsx)(oG.Z,{...t,classes:{popper:e}}))(({theme:e})=>({[`& .${oU.Z.tooltip}`]:{backgroundColor:e.palette.background.tooltip,color:e.palette.text.primary,maxWidth:"300px",padding:e.spacing(1),boxShadow:e.shadows[1]},[`& .${oU.Z.arrow}`]:{color:e.palette.background.tooltip}})),oQ=({label:e,control:t,description:n})=>{let r=oq("EditorSectionControl"),i=`${r}-control`;return(0,p.jsx)(oH.Z,{children:(0,p.jsxs)(ed.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[(0,p.jsxs)(ed.Z,{direction:"row",alignItems:"center",justifyContent:"center",children:[(0,p.jsx)(o$.Z,{htmlFor:i,children:e}),n&&(0,p.jsx)(oK,{description:n,enterDelay:100,children:(0,p.jsx)(ef.Z,{size:"small",sx:e=>({borderRadius:e.shape.borderRadius,padding:"4x",margin:"0 2px"}),children:(0,p.jsx)(oW.default,{"aria-describedby":"info-tooltip","aria-hidden":!1,fontSize:"inherit",sx:{color:e=>e.palette.grey[700]}})})})]}),(0,p.jsxs)(W.Z,{sx:{width:"180px",textAlign:"right"},children:[" ",g().cloneElement(t,{id:i})]})]})})};var oJ=n(11774),o0=n(57174);function o1({options:e,renderInput:t=e=>(0,p.jsx)(ep.Z,{...e}),...n}){let r=e=>e.label??e.id;return(0,p.jsx)(oJ.Z,{isOptionEqualToValue:(e,t)=>e.id===t.id,getOptionDisabled:e=>!!e.disabled,getOptionLabel:r,options:e,renderInput:t,renderOption:({key:e,...t},n)=>(0,p.jsx)("li",{...t,children:(0,p.jsxs)("div",{children:[(0,p.jsx)(i6.Z,{variant:"body1",component:"div",children:r(n)}),n.description&&(0,p.jsx)(i6.Z,{variant:"body2",component:"div",sx:{color:e=>e.palette.text.secondary},children:n.description})]})},e),filterOptions:(0,o0.D)({stringify:e=>`${r(e)} ${e.description||""}`}),...n})}let o2=[{id:"compact",label:"Compact"},{id:"standard",label:"Standard"},{id:"comfortable",label:"Comfortable"}];function o5({onChange:e,value:t="standard"}){return(0,p.jsx)(oQ,{label:"Density",control:(0,p.jsx)(o1,{value:o2.find(e=>e.id===t),options:o2,getOptionLabel:e=>e.label,onChange:(t,{id:n})=>{e(n)},disableClearable:!0})})}function o3(){return(0,p.jsxs)(ed.Z,{direction:"row",alignItems:"center",children:[(0,p.jsx)(W.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,p.jsx)(W.Z,{sx:{content:'""',height:2,background:e=>e.palette.info.main,width:"100%"}})]})}function o4(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 o8(e,t){if(e){if("string"==typeof e)return o4(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)?o4(e,t):void 0}}function o6(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,a=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||o8(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 o9=n(70501),o7="data-pdnd-honey-pot";function se(e){return e instanceof Element&&e.hasAttribute(o7)}function st(e){var t=o6(document.elementsFromPoint(e.x,e.y),2),n=t[0],r=t[1];return n?se(n)?null!=r?r:null:n:null}function sn(e){return(sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function sr(e,t,n){var r;return(r=function(e,t){if("object"!=sn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=sn(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==sn(r)?r:r+"")in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function si(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 so(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?si(Object(n),!0).forEach(function(t){sr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):si(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ss(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 sa(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 sl(e){return function(e){if(Array.isArray(e))return o4(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||o8(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 su(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 sc=su(function(){return navigator.userAgent.includes("Firefox")}),sh=su(function(){var e=navigator.userAgent;return e.includes("AppleWebKit")&&!e.includes("Chrome")}),sd={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};function sf(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}}!function(){if("undefined"!=typeof window){if(sh()){var e=t();(0,o9.bindAll)(window,[{type:"dragstart",listener:function(){e.enterCount=0,e.isOverWindow=!0}},{type:"drop",listener:n},{type:"dragend",listener:n},{type:"dragenter",listener:function(t){e.isOverWindow||0!==e.enterCount||(t[sd.isEnteringWindow]=!0),e.isOverWindow=!0,e.enterCount++}},{type:"dragleave",listener:function(t){e.enterCount--,e.isOverWindow&&0===e.enterCount&&(t[sd.isLeavingWindow]=!0,e.isOverWindow=!1)}}],{capture:!0})}}function t(){return{enterCount:0,isOverWindow:!1}}function n(){e=t()}}();var sp=(SA=function(e){return e()},SD=[],SE=null,(SO=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];SD=t,!SE&&(SE=requestAnimationFrame(function(){SE=null,SA.apply(void 0,SD)}))}).cancel=function(){SE&&(cancelAnimationFrame(SE),SE=null)},SO),sm=(SR=null,{schedule:function(e){SR={frameId:requestAnimationFrame(function(){SR=null,e()}),fn:e}},flush:function(){SR&&(cancelAnimationFrame(SR.frameId),SR.fn(),SR=null)}}),sg={isActive:!1};function sv(){return!sg.isActive}function sy(e){var t,n=e.event,r=null===(t=e.current[0])||void 0===t?void 0:t.dropEffect;null!=r&&n.dataTransfer&&(n.dataTransfer.dropEffect=r)}var sb=function(e){var t,n,r=e.event,i=e.dragType,o=e.getDropTargetsOver,s=e.dispatchEvent;if(sv()){var a=function(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=sf(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:r,dragType:i,getDropTargetsOver:o});sg.isActive=!0;var l={current:a};sy({event:r,current:a.dropTargets});var u=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}}),sm.schedule(function(){o({eventName:"onDragStart",payload:{source:t,location:s}})})},dragUpdate:function(e){var r=e.current;sm.flush(),sp.cancel(),o({eventName:"onDropTargetChange",payload:{source:t,location:{initial:n,previous:i,current:r}}})},drag:function(e){var r=e.current;sp(function(){sm.flush(),o({eventName:"onDrag",payload:{source:t,location:{initial:n,previous:i,current:r}}})})},drop:function(e){var r=e.current,s=e.updatedSourcePayload;sm.flush(),sp.cancel(),o({eventName:"onDrop",payload:{source:null!=s?s:t,location:{current:r,previous:i,initial:n}}})}}}({source:i.payload,dispatchEvent:s,initial:a}),c=(0,o9.bindAll)(window,[{type:"dragover",listener:function(e){d(e),u.drag({current:l.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&&(sh()?!!sh()&&t.hasOwnProperty(sd.isLeavingWindow):null==r||(sc()?"nodeName"in r&&r.ownerDocument!==document:r instanceof HTMLIFrameElement))})({dragLeave:e})&&(h({input:l.current.input,dropTargets:[]}),"external"===i.startedFrom&&f())}},{type:"drop",listener:function(e){if(l.current={dropTargets:l.current.dropTargets,input:sf(e)},!l.current.dropTargets.length){f();return}e.preventDefault(),sy({event:e,current:l.current.dropTargets}),u.drop({current:l.current,updatedSourcePayload:"external"===i.type?i.getDropPayload(e):null}),p()}},{type:"dragend",listener:function(e){l.current={dropTargets:l.current.dropTargets,input:sf(e)},f()}}].concat(sl([{type:"pointermove",listener:(n=0,function(){if(n<20){n++;return}t()})},{type:"pointerdown",listener:t=f}])),{capture:!0});u.start({nativeSetDragImage:r.dataTransfer?r.dataTransfer.setDragImage.bind(r.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:l.current.dropTargets,next:e.dropTargets});l.current=e,t&&u.dragUpdate({current:l.current})}function d(e){var t=sf(e),n=o({target:se(e.target)?st({x:t.clientX,y:t.clientY}):e.target,input:t,source:i.payload,current:l.current.dropTargets});n.length&&(e.preventDefault(),sy({event:e,current:n})),h({dropTargets:n,input:t})}function f(){l.current.dropTargets.length&&h({dropTargets:[],input:l.current.input}),u.drop({current:l.current,updatedSourcePayload:null}),p()}function p(){sg.isActive=!1,c()}},sx=new Map;function sw(){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 sS(e,t){var n=t.attribute,r=t.value;return e.setAttribute(n,r),function(){return e.removeAttribute(n)}}function sC(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 sk(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sC(Object(n),!0).forEach(function(t){sr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function sM(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 sT(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)?sT(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,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function sT(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 sA(e){return e.slice(0).reverse()}function sD(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 sE(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 sO=su(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),sR="text/plain",sP=new WeakMap,sI=(SP=null,{bindEvents:function(){return SP=null,(0,o9.bind)(window,{type:"pointermove",listener:function(e){SP={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,a,l,u=r.location.initial.input;i=({initial:null!==(l=SP)&&void 0!==l?l:{x:u.clientX,y:u.clientY}}).initial,(o=document.createElement("div")).setAttribute(o7,"true"),s=ss({client:i}),Object.assign(o.style,so(so({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},sa({clientRect:s})),{},{pointerEvents:"auto",zIndex:0x7fffffff})),document.body.appendChild(o),a=(0,o9.bind)(window,{type:"pointermove",listener:function(e){s=ss({client:{x:e.clientX,y:e.clientY}}),Object.assign(o.style,sa({clientRect:s}))},options:{capture:!0}}),e=function(e){var t,n,r,i=e.current;if(a(),n=(t={client:i,clientRect:s}).client,r=t.clientRect,n.x>=r.x&&n.x<=r.x+r.width&&n.y>=r.y&&n.y<=r.y+r.height){o.remove();return}function l(){u(),o.remove()}var u=(0,o9.bindAll)(window,[{type:"pointerdown",listener:l},{type:"pointermove",listener:l},{type:"focusin",listener:l},{type:"focusout",listener:l},{type:"dragstart",listener:l},{type:"dragenter",listener:l},{type:"dragover",listener:l}],{capture:!0})}}if("onDrop"===n){var c,h=r.location.current.input;null===(c=e)||void 0===c||c({current:{x:h.clientX,y:h.clientY}}),e=null,SP=null}}}}),sN=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,a=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 sD(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)?sD(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,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(e);try{for(a.s();!(s=a.n()).done;){var l=s.value;n(l)}}catch(e){a.e(e)}finally{a.f()}}if(t){for(var u=Array.from(t.active),c=0;c<u.length;c++){var h,d=u[c];t.active.has(d)&&(null===(h=d[i])||void 0===h||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?sE(Object(n),!0).forEach(function(t){sr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sE(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)}}}}(),a=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=sM(i.location.current.dropTargets);try{for(o.s();!(t=o.n()).done;){var s,a=t.value,l=r.get(a.element),u=sk(sk({},i),{},{self:a});null==l||null===(s=l[n])||void 0===s||s.call(l,u)}}catch(e){o.e(e)}finally{o.f()}}var a={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=sM(n.location.previous.dropTargets);try{for(s.s();!(t=s.n()).done;){var a,l,u=t.value;o.add(u.element);var c=r.get(u.element),h=i.has(u.element),d=sk(sk({},n),{},{self:u});null==c||null===(a=c.onDropTargetChange)||void 0===a||a.call(c,d),h||null==c||null===(l=c.onDragLeave)||void 0===l||l.call(c,d)}}catch(e){s.e(e)}finally{s.f()}var f,p=sM(n.location.current.dropTargets);try{for(p.s();!(f=p.n()).done;){var m,g,v=f.value;if(!o.has(v.element)){var y=sk(sk({},n),{},{self:v}),b=r.get(v.element);null==b||null===(m=b.onDropTargetChange)||void 0===m||m.call(b,y),null==b||null===(g=b.onDragEnter)||void 0===g||g.call(b,y)}}}catch(e){p.e(e)}finally{p.f()}}};return{dropTargetForConsumers:function(e){return sw(sS(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,a=e.current,l=function e(t){var i,s,a,l,u=t.source,c=t.target,h=t.input,d=t.result,f=void 0===d?[]:d;if(null==c)return f;if(!(c instanceof Element))return c instanceof Node?e({source:u,target:c.parentElement,input:h,result:f}):f;var p=c.closest(o);if(null==p)return f;var m=r.get(p);if(null==m)return f;var g={input:h,source:u,element:m.element};if(m.canDrop&&!m.canDrop(g))return e({source:u,target:m.element.parentElement,input:h,result:f});var v=null!==(i=null===(s=m.getData)||void 0===s?void 0:s.call(m,g))&&void 0!==i?i:{},y=null!==(a=null===(l=m.getDropEffect)||void 0===l?void 0:l.call(m,g))&&void 0!==a?a:n,b={data:v,element:m.element,dropEffect:y,isActiveDueToStickiness:!1};return e({source:u,target:m.element.parentElement,input:h,result:[].concat(sl(f),[b])})}({source:t,target:i,input:s});if(l.length>=a.length)return l;for(var u=sA(a),c=sA(l),h=[],d=0;d<u.length;d++){var f,p=u[d],m=c[d];if(null!=m){h.push(m);continue}var g=h[d-1],v=u[d-1];if((null==g?void 0:g.element)!==(null==v?void 0:v.element))break;var y=r.get(p.element);if(!y)break;var b={input:s,source:t,element:y.element};if(y.canDrop&&!y.canDrop(b)||!(null!==(f=y.getIsSticky)&&void 0!==f&&f.call(y,b)))break;h.push(sk(sk({},p),{},{isActiveDueToStickiness:!0}))}return sA(h)},dispatchEvent:function(e){a[e.eventName](e)}}}({typeKey:t,defaultDropEffect:o});function l(e){null==r||r(e),a.dispatchEvent(e),s.dispatchEvent(e),null==i||i(e)}function u(e){sb({event:e.event,dragType:e.dragType,getDropTargetsOver:a.getIsOver,dispatchEvent:l})}return{registerUsage:function(){var e,r;return r=function(e){var t=e.typeKey,n=e.mount,r=sx.get(t);if(r)return r.usageCount++,r;var i={typeKey:t,unmount:n(),usageCount:1};return sx.set(t,i),i}(e={typeKey:t,mount:function(){return n({canStart:sv,start:u})}}),function(){r.usageCount--,!(r.usageCount>0)&&(r.unmount(),sx.delete(e.typeKey))}},dropTarget:a.dropTargetForConsumers,monitor:s.monitorForConsumers}}({typeKey:"element",defaultDropEffect:"move",mount:function(e){return sw(sI.bindEvents(),(0,o9.bind)(document,{type:"dragstart",listener:function(t){if(e.canStart(t)&&!t.defaultPrevented&&t.dataTransfer){var n,r,i,o,s,a,l=t.target;if(!(l instanceof HTMLElement))return null;var u=sP.get(l);if(!u)return null;var c=sf(t),h={element:u.element,dragHandle:null!==(n=u.dragHandle)&&void 0!==n?n:null,input:c};if(u.canDrag&&!u.canDrag(h))return t.preventDefault(),null;if(u.dragHandle){var d=st({x:c.clientX,y:c.clientY});if(!u.dragHandle.contains(d))return t.preventDefault(),null}var f=null!==(r=null===(i=u.getInitialDataForExternal)||void 0===i?void 0:i.call(u,h))&&void 0!==r?r:null;if(f)for(var p=0,m=Object.entries(f);p<m.length;p++){var g=o6(m[p],2),v=g[0],y=g[1];t.dataTransfer.setData(v,null!=y?y:"")}!sO()||t.dataTransfer.types.includes(sR)||t.dataTransfer.types.includes("text/uri-list")||t.dataTransfer.setData(sR,"pdnd:android-fallback"),t.dataTransfer.setData("application/vnd.pdnd","");var b={element:u.element,dragHandle:null!==(o=u.dragHandle)&&void 0!==o?o:null,data:null!==(s=null===(a=u.getInitialData)||void 0===a?void 0:a.call(u,h))&&void 0!==s?s:{}};e.start({event:t,dragType:{type:"element",payload:b,startedFrom:"internal"}})}}}))},dispatchEventToSource:function(e){var t,n,r=e.eventName,i=e.payload;null===(t=sP.get(i.source.element))||void 0===t||null===(n=t[r])||void 0===n||n.call(t,i)},onPostDispatch:sI.getOnPostDispatch()}),sj=sN.dropTarget,sL=sN.monitor;function sF(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 sZ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sF(Object(n),!0).forEach(function(t){sr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sF(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var sB={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)}},sV=Symbol("closestEdge");function sz(e){var t;return null!==(t=e[sV])&&void 0!==t?t:null}let s_={type:"idle"};function sH({elements:e,accessKey:t,axis:n="vertical",onChange:r}){return(0,m.useEffect)(()=>sL({onDrop({location:i,source:o}){var s,a;let l=i.current.dropTargets[0];if(!l)return;let u=o.data,c=l.data,h=e.findIndex(e=>e[t]===u[t]),d=e.findIndex(e=>e[t]===c[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=o6(i.splice(n,1),1)[0];return i.splice(r,0,o),i}({list:(s={list:e,startIndex:h,indexOfTarget:d,closestEdgeOfTarget:sz(c),axis:n}).list,startIndex:a=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:a,indexOfTarget:s.indexOfTarget,axis:s.axis})}))}}),[t,n,e,r])}function s$({children:e,data:t}){let n=(0,m.useRef)(null),[r,i]=(0,m.useState)(s_);return(0,m.useEffect)(()=>{var e;let r=n.current;if(r)return sw((e={element:r,getInitialData:()=>t,onDragStart(){i({type:"is-dragging"})},onDrop(){i(s_)}},sw(sN.registerUsage(),(sP.set(e.element,e),function(){sP.delete(e.element)}),sS(e.element,{attribute:"draggable",value:"true"}))),sj({element:r,canDrop:({source:e})=>e.element!==r,getData:({input:e})=>{var n,i,o,s,a,l,u,c,h;return s=(n={element:r,input:e,allowedEdges:["top","bottom"]}).element,a=n.input,l=n.allowedEdges,u={x:a.clientX,y:a.clientY},c=s.getBoundingClientRect(),h=null!==(i=null===(o=l.map(function(e){return{edge:e,value:sB[e](c,u)}}).sort(function(e,t){return e.value-t.value})[0])||void 0===o?void 0:o.edge)&&void 0!==i?i:null,sZ(sZ({},t),{},sr({},sV,h))},getIsSticky:()=>!0,onDragEnter({self:e}){i({type:"is-dragging-over",closestEdge:sz(e.data)})},onDrag({self:e}){let t=sz(e.data);i(e=>"is-dragging-over"===e.type&&e.closestEdge===t?e:{type:"is-dragging-over",closestEdge:t})},onDragLeave(){i(s_)},onDrop(){i(s_)}}))},[t]),(0,p.jsxs)(ed.Z,{ref:n,spacing:1,style:{opacity:"is-dragging"===r.type?.5:"unset"},children:["is-dragging-over"===r.type&&"top"===r.closestEdge?(0,p.jsx)(o3,{}):null,e,"is-dragging-over"===r.type&&"bottom"===r.closestEdge?(0,p.jsx)(o3,{}):null]})}var sW=n(5549),sq=n(10517),sG=n(11682);function sU(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 sK(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 sY=(0,m.forwardRef)(function({onMoveUp:e,onMoveDown:t,onMoveLeft:n,onMoveRight:r,menuSx:i,...o},s){let[a,l]=(0,m.useState)(null),u=!!a;function c(e){l(null),e?.()}return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ef.Z,{...o,ref:s,"aria-label":"move","aria-haspopup":!0,"aria-expanded":u,size:"small",onClick:function(e){l(e.currentTarget)},children:(0,p.jsx)(sG.default,{})}),(e||t||n||r)&&(0,p.jsxs)(sW.Z,{id:"drag-button-menu",MenuListProps:{"aria-labelledby":"drag-button-menu"},anchorEl:a,open:u,onClose:()=>c(void 0),sx:i,children:[e&&(0,p.jsx)(sq.Z,{onClick:()=>c(e),children:"Move Up"}),t&&(0,p.jsx)(sq.Z,{onClick:()=>c(t),children:"Move Down"}),n&&(0,p.jsx)(sq.Z,{onClick:()=>c(n),children:"Move Left"}),r&&(0,p.jsx)(sq.Z,{onClick:()=>c(r),children:"Move Right"}),r&&(0,p.jsx)(sq.Z,{onClick:()=>c(r),children:"Move Right"})]})]})});var sX=n(76439),sQ=n(6595),sJ=n(49106),s0=n(41825),s1=n(94680),s2=n(77999),s5=n(42777),s3=n(24255);function s4(e,t,n){let r=function(e,t,n){let r;let i=t.getBoundingClientRect(),o=n&&n.getBoundingClientRect(),s=(0,s3.Z)(t);if(t.fakeTransform)r=t.fakeTransform;else{let e=s.getComputedStyle(t);r=e.getPropertyValue("-webkit-transform")||e.getPropertyValue("transform")}let a=0,l=0;if(r&&"none"!==r&&"string"==typeof r){let e=r.split("(")[1].split(")")[0].split(",");a=parseInt(e[4],10),l=parseInt(e[5],10)}return"left"===e?o?`translateX(${o.right+a-i.left}px)`:`translateX(${s.innerWidth+a-i.left}px)`:"right"===e?o?`translateX(-${i.right-o.left-a}px)`:`translateX(-${i.left+i.width-a}px)`:"up"===e?o?`translateY(${o.bottom+l-i.top}px)`:`translateY(${s.innerHeight+l-i.top}px)`:o?`translateY(-${i.top-o.top+i.height-l}px)`:`translateY(-${i.top+i.height-l}px)`}(e,t,"function"==typeof n?n():n);r&&(t.style.webkitTransform=r,t.style.transform=r)}let s8=m.forwardRef(function(e,t){let n=(0,eX.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:a,container:l,direction:u="down",easing:c=r,in:h,onEnter:d,onEntered:f,onEntering:g,onExit:v,onExited:y,onExiting:b,style:x,timeout:w=i,TransitionComponent:S=s0.ZP,...C}=e,k=m.useRef(null),M=(0,r3.Z)((0,s1.Z)(a),k,t),T=e=>t=>{e&&(void 0===t?e(k.current):e(k.current,t))},A=T((e,t)=>{s4(u,e,l),(0,s5.n)(e),d&&d(e,t)}),D=T((e,t)=>{let r=(0,s5.C)({timeout:w,style:x,easing:c},{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",g&&g(e,t)}),E=T(f),O=T(b),R=T(e=>{let t=(0,s5.C)({timeout:w,style:x,easing:c},{mode:"exit"});e.style.webkitTransition=n.transitions.create("-webkit-transform",t),e.style.transition=n.transitions.create("transform",t),s4(u,e,l),v&&v(e)}),P=T(e=>{e.style.webkitTransition="",e.style.transition="",y&&y(e)}),I=m.useCallback(()=>{k.current&&s4(u,k.current,l)},[u,l]);return m.useEffect(()=>{if(h||"down"===u||"right"===u)return;let e=(0,s2.Z)(()=>{k.current&&s4(u,k.current,l)}),t=(0,s3.Z)(k.current);return t.addEventListener("resize",e),()=>{e.clear(),t.removeEventListener("resize",e)}},[u,h,l]),m.useEffect(()=>{h||I()},[h,I]),(0,p.jsx)(S,{nodeRef:k,onEnter:A,onEntered:E,onEntering:D,onExit:R,onExited:P,onExiting:O,addEndListener:e=>{o&&o(k.current,e)},appear:s,in:h,timeout:w,...C,children:(e,{ownerState:t,...n})=>m.cloneElement(a,{ref:M,style:{visibility:"exited"!==e||h?void 0:"hidden",...x,...a.props.style},...n})})});var s6=n(28866);function s9(e){return(0,A.ZP)("MuiDrawer",e)}(0,T.Z)("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);var s7=n(27834);let ae=(e,t)=>{let{ownerState:n}=e;return[t.root,("permanent"===n.variant||"persistent"===n.variant)&&t.docked,t.modal]},at=e=>{let{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${(0,w.Z)(n)}`],docked:[("permanent"===r||"persistent"===r)&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${(0,w.Z)(n)}`,"temporary"!==r&&`paperAnchorDocked${(0,w.Z)(n)}`]};return(0,y.Z)(i,s9,t)},an=(0,S.ZP)(sJ.Z,{name:"MuiDrawer",slot:"Root",overridesResolver:ae})((0,C.Z)(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),ar=(0,S.ZP)("div",{shouldForwardProp:r1.Z,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:ae})({flex:"0 0 auto"}),ai=(0,S.ZP)(s6.Z,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`paperAnchor${(0,w.Z)(n.anchor)}`],"temporary"!==n.variant&&t[`paperAnchorDocked${(0,w.Z)(n.anchor)}`]]}})((0,C.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}`}}]}))),ao={left:"right",right:"left",top:"down",bottom:"up"},as=m.forwardRef(function(e,t){let n=(0,M.i)({props:e,name:"MuiDrawer"}),r=(0,eX.Z)(),i=(0,sQ.V)(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{anchor:s="left",BackdropProps:a,children:l,className:u,elevation:c=16,hideBackdrop:h=!1,ModalProps:{BackdropProps:d,...f}={},onClose:g,open:y=!1,PaperProps:b={},SlideProps:x,TransitionComponent:w,transitionDuration:S=o,variant:C="temporary",slots:k={},slotProps:T={},...A}=n,D=m.useRef(!1);m.useEffect(()=>{D.current=!0},[]);let E=function({direction:e},t){return"rtl"===e&&["left","right"].includes(t)?ao[t]:t}({direction:i?"rtl":"ltr"},s),O={...n,anchor:s,elevation:c,open:y,variant:C,...A},R=at(O),P={slots:{transition:w,...k},slotProps:{paper:b,transition:x,...T,backdrop:(0,s7.Z)(T.backdrop||{...a,...d},{transitionDuration:S})}},[I,N]=(0,on.Z)("root",{ref:t,elementType:an,className:(0,v.Z)(R.root,R.modal,u),shouldForwardComponentProp:!0,ownerState:O,externalForwardedProps:{...P,...A,...f},additionalProps:{open:y,onClose:g,hideBackdrop:h,slots:{backdrop:P.slots.backdrop},slotProps:{backdrop:P.slotProps.backdrop}}}),[j,L]=(0,on.Z)("paper",{elementType:ai,shouldForwardComponentProp:!0,className:(0,v.Z)(R.paper,b.className),ownerState:O,externalForwardedProps:P,additionalProps:{elevation:"temporary"===C?c:0,square:!0}}),[F,Z]=(0,on.Z)("docked",{elementType:ar,ref:t,className:(0,v.Z)(R.root,R.docked,u),ownerState:O,externalForwardedProps:P,additionalProps:A}),[B,V]=(0,on.Z)("transition",{elementType:s8,ownerState:O,externalForwardedProps:P,additionalProps:{in:y,direction:ao[E],timeout:S,appear:D.current}}),z=(0,p.jsx)(j,{...L,children:l});if("permanent"===C)return(0,p.jsx)(F,{...Z,children:z});let _=(0,p.jsx)(B,{...V,children:z});return"persistent"===C?(0,p.jsx)(F,{...Z,children:_}):(0,p.jsx)(I,{...N,children:_})}),aa=({anchor:e="right",isOpen:t,onClose:n,PaperProps:r,children:i,...o})=>{let s=(0,sX.Z)("(max-width:1080px)");return(0,p.jsx)(as,{...o,open:t,onClose:n,anchor:e,PaperProps:{...r,sx:ir({width:s?"100%":"1080px",overflow:"hidden"},r?.sx)},children:i})};var al=n(315);function au(e){let{error:t}=e;return(0,p.jsx)(al.Z,{severity:"error",children:t.message})}var ac=n(68715);let ah=[{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 ad({value:e,onChange:t}){return(0,p.jsx)(oQ,{label:"Font Size",control:(0,p.jsx)(o1,{value:ah.find(t=>t.value===e),options:ah,getOptionLabel:e=>e.label,onChange:(e,{value:n})=>{t(n)},disableClearable:!0})})}var af=n(79119);function ap({action:e,submitText:t="Save",cancelText:n="Cancel",isReadonly:r,isValid:i,onActionChange:o,onSubmit:s,onDelete:a,onCancel:l,...u}){return(0,p.jsx)(ed.Z,{direction:"row",gap:1,sx:{marginLeft:"auto"},...u,children:"read"===e?(0,p.jsxs)(p.Fragment,{children:[o&&(0,p.jsx)(j.Z,{disabled:r,variant:"contained",onClick:()=>o("update"),children:"Edit"}),a&&(0,p.jsx)(j.Z,{color:"error",disabled:r,variant:"outlined",onClick:a,children:"Delete"}),l&&(s||a)&&(0,p.jsx)(af.Z,{orientation:"vertical",flexItem:!0,sx:{borderColor:e=>e.palette.grey["500"],"&.MuiDivider-root":{marginLeft:2,marginRight:1}}}),l&&(0,p.jsx)(j.Z,{color:"secondary",variant:"outlined",onClick:l,children:n})]}):(0,p.jsxs)(p.Fragment,{children:[s&&(0,p.jsx)(j.Z,{variant:"contained",disabled:!i,onClick:s,children:t}),l&&(0,p.jsx)(j.Z,{color:"secondary",variant:"outlined",onClick:l,children:n})]})})}var am=n(78846);function ag(e){let{width:t,height:n,data:r,format:i,axisLine:o,max:s}=e,a=K(),l=function(e,t){let n=(0,m.useRef)();return(void 0===n.current||!1===Q()(t,n.current.deps))&&(n.current={value:e(),deps:t}),n.current.value}(()=>{if(void 0===r.value)return a.noDataOption;let e=av(r.value,i,t,n);return{title:{show:!1},tooltip:{show:!1},series:[{type:"gauge",center:["50%","65%"],radius:"86%",startAngle:200,endAngle:-20,min:0,max:s,silent:!0,progress:{show:!0,width:16,itemStyle:{color:"auto"}},pointer:{show:!1},axisLine:{lineStyle:{color:[[1,"rgba(127,127,127,0.35)"]],width:16}},axisTick:{show:!1,distance:0},splitLine:{show:!1},axisLabel:{show:!1,distance:-18,color:"#999",fontSize:12},anchor:{show:!1},title:{show:!1},detail:{show:!1},data:[{value:r.value}]},{type:"gauge",center:["50%","65%"],radius:"100%",startAngle:200,endAngle:-20,min:0,max:s,pointer:{show:!0,icon:t>170?"path://M12.8,0.7l12,40.1H0.7L12.8,0.7z":"none",length:10,width:5,offsetCenter:[0,"-49%"],itemStyle:{color:"auto"}},axisLine:o,axisTick:{show:!1},splitLine:{show:!1},axisLabel:{show:!1},detail:{show:!0,width:"60%",borderRadius:8,offsetCenter:[0,"-9%"],color:"inherit",fontSize:e,formatter:null===r.value?()=>"null":e=>(0,F.Bw)(e,i)},data:[{value:r.value,name:r.label,title:{show:!0,color:a.echartsTheme.textStyle?.color??"inherit",offsetCenter:[0,"55%"],overflow:"truncate",fontSize:12,width:.8*t}}]}]}},[r,t,n,a,i,o,s]);return(0,p.jsx)(es,{sx:{width:t,height:n,padding:`${a.container.padding.default}px`},option:l,theme:a.echartsTheme})}function av(e,t,n,r){let i=Math.min(n,r)/(("number"==typeof e?(0,F.Bw)(e,t):`${e}`).length??2)*.7;return`clamp(3px, ${i}px, 24px)`}(0,Z.D)([am.N,V.N,_.N,H.N,$.N]);var ay=n(70252),ab=n(97784);let ax=[],aw=[];function aS(e){return e>=127462&&e<=127487}function aC(e,t,n){if(t==e.length)return t;t&&aM(e.charCodeAt(t))&&aT(e.charCodeAt(t-1))&&t--;let r=ak(e,t);for(t+=aA(r);t<e.length;){let i=ak(e,t);if(8205==r||8205==i||n&&function(e){if(e<768)return!1;for(let t=0,n=ax.length;;){let r=t+n>>1;if(e<ax[r])n=r;else{if(!(e>=aw[r]))return!0;t=r+1}if(t==n)return!1}}(i))t+=aA(i),r=i;else if(aS(i)){let n=0,r=t-2;for(;r>=0&&aS(ak(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function ak(e,t){let n=e.charCodeAt(t);if(!aT(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return aM(r)?(n-55296<<10)+(r-56320)+65536:n}function aM(e){return e>=56320&&e<57344}function aT(e){return e>=55296&&e<56320}function aA(e){return e<65536?1:2}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,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 t=0,n=0;t<e.length;t++)(t%2?aw:ax).push(n+=e[t])})();class aD{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]=aL(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),aO.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]=aL(this,e,t);let n=[];return this.decompose(e,t,n,0),aO.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 aP(this),i=new aP(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 aP(this,e)}iterRange(e,t=this.length){return new aI(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 aN(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 aE(e):aO.from(aE.split(e,[])):aD.empty}}class aE extends aD{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 aj(r,s,n,o);r=s+1,n++}}decompose(e,t,n,r){var i;let o=e<=0&&t>=this.length?this:new aE((i=this.text,aR(i,[""],e,t)),Math.min(t,this.length)-Math.max(0,e));if(1&r){let e=n.pop(),t=aR(o.text,e.text.slice(),0,o.length);if(t.length<=32)n.push(new aE(t,e.length+o.length));else{let e=t.length>>1;n.push(new aE(t.slice(0,e)),new aE(t.slice(e)))}}else n.push(o)}replace(e,t,n){var r,i;if(!(n instanceof aE))return super.replace(e,t,n);[e,t]=aL(this,e,t);let o=aR(this.text,aR(n.text,(r=this.text,i=0,aR(r,[""],0,e))),t),s=this.length+n.length-(t-e);return o.length<=32?new aE(o,s):aO.from(aE.split(o,[]),s)}sliceString(e,t=this.length,n="\n"){[e,t]=aL(this,e,t);let r="";for(let i=0,o=0;i<=t&&o<this.text.length;o++){let s=this.text[o],a=i+s.length;i>e&&o&&(r+=n),e<a&&t>i&&(r+=s.slice(Math.max(0,e-i),t-i)),i=a+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 aE(n,r)),n=[],r=-1);return r>-1&&t.push(new aE(n,r)),t}}class aO extends aD{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,a=n+o.lines-1;if((t?a:s)>=e)return o.lineInner(e,t,n,r);r=s+1,n=a+1}}decompose(e,t,n,r){for(let i=0,o=0;o<=t&&i<this.children.length;i++){let s=this.children[i],a=o+s.length;if(e<=a&&t>=o){let i=r&(+(o<=e)|2*(a>=t));o>=e&&a<=t&&!i?n.push(s):s.decompose(e-o,t-o,n,i)}o=a+1}}replace(e,t,n){if([e,t]=aL(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 a=o.replace(e-i,t-i,n),l=this.lines-o.lines+a.lines;if(a.lines<l>>4&&a.lines>l>>6){let i=this.children.slice();return i[r]=a,new aO(i,this.length-(t-e)+n.length)}return super.replace(i,s,a)}i=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=aL(this,e,t);let r="";for(let i=0,o=0;i<this.children.length&&o<=t;i++){let s=this.children[i],a=o+s.length;o>e&&i&&(r+=n),e<a&&t>o&&(r+=s.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof aO))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 a=this.children[r],l=e.children[i];if(a!=l)return n+a.scanIdentical(l,t);n+=a.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 aE(n,t)}let r=Math.max(32,n>>5),i=r<<1,o=r>>1,s=[],a=0,l=-1,u=[];function c(){0!=a&&(s.push(1==u.length?u[0]:aO.from(u,l)),l=-1,a=u.length=0)}for(let t of e)!function e(t){let n;if(t.lines>i&&t instanceof aO)for(let n of t.children)e(n);else t.lines>o&&(a>o||!a)?(c(),s.push(t)):t instanceof aE&&a&&(n=u[u.length-1])instanceof aE&&t.lines+n.lines<=32?(a+=t.lines,l+=t.length+1,u[u.length-1]=new aE(n.text.concat(t.text),n.length+1+t.length)):(a+t.lines>r&&c(),a+=t.lines,l+=t.length+1,u.push(t))}(t);return c(),1==s.length?s[0]:new aO(s,t)}}function aR(e,t,n=0,r=1e9){for(let i=0,o=0,s=!0;o<e.length&&i<=r;o++){let a=e[o],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),s?(t[t.length-1]+=a,s=!1):t.push(a)),i=l+1}return t}aD.empty=new aE([""],0);class aP{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 aE?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 aE?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 aE){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 aE?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 aI{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new aP(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 aN{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&&(aD.prototype[Symbol.iterator]=function(){return this.iter()},aP.prototype[Symbol.iterator]=aI.prototype[Symbol.iterator]=aN.prototype[Symbol.iterator]=function(){return this});class aj{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 aL(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function aF(e,t,n=!0,r=!0){return function(e,t,n=!0,r=!0){return(n?aC:function(e,t,n){for(;t>0;){let r=aC(e,t-2,n);if(r<t)return r;t--}return 0})(e,t,r)}(e,t,n,r)}function aZ(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 aB(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(((e-=65536)>>10)+55296,(1023&e)+56320)}function aV(e){return e<65536?1:2}let az=/\r\n?|\n/;var a_=((SI=a_||(a_={}))[SI.Simple=0]="Simple",SI[SI.TrackDel=1]="TrackDel",SI[SI.TrackBefore=2]="TrackBefore",SI[SI.TrackAfter=3]="TrackAfter",SI);class aH{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){aG(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 aH(e)}composeDesc(e){return this.empty?e:e.empty?this:aK(this,e)}mapDesc(e,t=!1){return e.empty?this:aU(this,e,t)}mapPos(e,t=-1,n=a_.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],a=this.sections[o++],l=r+s;if(a<0){if(l>e)return i+(e-r);i+=s}else{if(n!=a_.Simple&&l>=e&&(n==a_.TrackDel&&r<e&&l>e||n==a_.TrackBefore&&r<e||n==a_.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==r||t<0?i:i+a;i+=a}r=l}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 aH(e)}static create(e){return new aH(e)}}class a$ extends aH{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 aG(this,(t,n,r,i,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return aU(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 a=r>>1;for(;n.length<a;)n.push(aD.empty);n.push(o?e.slice(i,i+o):aD.empty)}i+=o}return new a$(t,n)}compose(e){return this.empty?e:e.empty?this:aK(this,e,!0)}map(e,t=!1){return e.empty?this:aU(this,e,t,!0)}iterChanges(e,t=!1){aG(this,e,t)}get desc(){return aH.create(this.sections)}filter(e){let t=[],n=[],r=[],i=new aY(this);e:for(let o=0,s=0;;){let a=o==e.length?1e9:e[o++];for(;s<a||s==a&&0==i.len;){if(i.done)break e;let e=Math.min(i.len,a-s);aW(r,e,-1);let o=-1==i.ins?-1:0==i.off?i.ins:0;aW(t,e,o),o>0&&aq(n,t,i.text),i.forward(e),s+=e}let l=e[o++];for(;s<l;){if(i.done)break e;let e=Math.min(i.len,l-s);aW(t,e,-1),aW(r,e,-1==i.ins?-1:0==i.off?i.ins:0),i.forward(e),s+=e}}return{changes:new a$(t,n),filtered:aH.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 a(e=!1){if(!e&&!r.length)return;o<t&&aW(r,t-o,-1);let n=new a$(r,i);s=s?s.compose(n.map(s)):n,r=[],i=[],o=0}return!function e(l){if(Array.isArray(l))for(let t of l)e(t);else if(l instanceof a$){if(l.length!=t)throw RangeError(`Mismatched change set length (got ${l.length}, expected ${t})`);a(),s=s?s.compose(l.map(s)):l}else{let{from:e,to:s=e,insert:u}=l;if(e>s||e<0||s>t)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let c=u?"string"==typeof u?aD.of(u.split(n||az)):u:aD.empty,h=c.length;if(e==s&&0==h)return;e<o&&a(),e>o&&aW(r,e-o,-1),aW(r,s-e,h),aq(i,r,c),o=s}}(e),a(!s),s}static empty(e){return new a$(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(aD.empty);n[r]=aD.of(i.slice(1)),t.push(i[0],n[r].length)}}return new a$(t,n)}static createSet(e,t){return new a$(e,t)}}function aW(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 aq(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(aD.empty);e.push(n)}}function aG(e,t,n){let r=e.inserted;for(let i=0,o=0,s=0;s<e.sections.length;){let a=e.sections[s++],l=e.sections[s++];if(l<0)i+=a,o+=a;else{let u=i,c=o,h=aD.empty;for(;u+=a,c+=l,l&&r&&(h=h.append(r[s-2>>1])),!n&&s!=e.sections.length&&!(e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(i,u,o,c,h),i=u,o=c}}}function aU(e,t,n,r=!1){let i=[],o=r?[]:null,s=new aY(e),a=new aY(t);for(let e=-1;;){if(s.done&&a.len||a.done&&s.len)throw Error("Mismatched change set lengths");if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);aW(i,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!n))){let t=a.len;for(aW(i,a.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(aW(i,0,s.ins),o&&aq(o,i,s.text),e=s.i),s.forward(n),t-=n}a.next()}else if(s.ins>=0){let t=0,n=s.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else if(0==a.ins&&a.len<n)n-=a.len,a.next();else break;aW(i,t,e<s.i?s.ins:0),o&&e<s.i&&aq(o,i,s.text),e=s.i,s.forward(s.len-n)}else if(s.done&&a.done)return o?a$.createSet(i,o):aH.create(i);else throw Error("Mismatched change set lengths")}}function aK(e,t,n=!1){let r=[],i=n?[]:null,o=new aY(e),s=new aY(t);for(let e=!1;;){if(o.done&&s.done)return i?a$.createSet(r,i):aH.create(r);if(0==o.ins)aW(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");{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;aW(r,t,n,e),i&&n&&aq(i,r,s.text)}else -1==s.ins?(aW(r,o.off?0:o.len,t,e),i&&aq(i,r,o.textBit(t))):(aW(r,o.off?0:o.len,s.off?0:s.ins,e),i&&!s.off&&aq(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 aW(r,0,s.ins,e),i&&aq(i,r,s.text),s.next()}}class aY{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?aD.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?aD.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 aX{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 aX(n,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return aQ.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return aQ.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 aQ.range(e.anchor,e.head)}static create(e,t,n){return new aX(e,t,n)}}class aQ{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:aQ.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 aQ([this.main],0)}addRange(e,t=!0){return aQ.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,aQ.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 aQ(e.ranges.map(e=>aX.fromJSON(e)),e.main)}static single(e,t=e){return new aQ([aQ.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 aQ.normalized(e.slice(),t);n=i.to}return new aQ(e,t)}static cursor(e,t=0,n,r){return aX.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?aX.create(t,e,48|i):aX.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?aQ.range(s,o):aQ.range(o,s))}}return new aQ(e,t)}}function aJ(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError("Selection points outside of document")}let a0=0;class a1{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=a0++,this.default=e([]),this.extensions="function"==typeof i?i(this):i}get reader(){return this}static define(e={}){return new a1(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:a2),!!e.static,e.enables)}of(e){return new a5([],this,0,e)}compute(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new a5(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new a5(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function a2(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class a5{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=a0++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,i=this.id,o=e[i]>>1,s=2==this.type,a=!1,l=!1,u=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:((null!==(t=e[n.id])&&void 0!==t?t:1)&1)==0&&u.push(e[n.id]);return{create:e=>(e.values[o]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||a4(e,u)){let t=n(e);if(s?!a3(t,e.values[o],r):!r(t,e.values[o]))return e.values[o]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[i];if(null!=l){let i=ls(t,l);if(this.dependencies.every(n=>n instanceof a1?t.facet(n)===e.facet(n):!(n instanceof a6)||t.field(n,!1)==e.field(n,!1))||(s?a3(a=n(e),i,r):r(a=n(e),i)))return e.values[o]=i,0}else a=n(e);return e.values[o]=a,1}}}}function a3(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 a4(e,t){let n=!1;for(let r of t)1&lo(e,r)&&(n=!0);return n}let a8=a1.define({static:!0});class a6{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 a6(a0++,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(a8).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(a8),i=n.facet(a8),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,a8.of({field:this,create:e})]}get extension(){return this}}let a9={lowest:4,low:3,default:2,high:1,highest:0};function a7(e){return t=>new lt(t,e)}let le={highest:a7(a9.highest),high:a7(a9.high),default:a7(a9.default),low:a7(a9.low),lowest:a7(a9.lowest)};class lt{constructor(e,t){this.inner=e,this.prec=t}}class ln{of(e){return new lr(this,e)}reconfigure(e){return ln.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class lr{constructor(e,t){this.compartment=e,this.inner=t}}class li{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,a,l=[],u=Object.create(null),c=new Map;for(let n of(r=e,i=t,o=c,s=[[],[],[],[],[]],a=new Map,!function e(t,n){let r=a.get(t);if(null!=r){if(r<=n)return;let e=s[r].indexOf(t);e>-1&&s[r].splice(e,1),t instanceof lr&&o.delete(t.compartment)}if(a.set(t,n),Array.isArray(t))for(let r of t)e(r,n);else if(t instanceof lr){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 lt)e(t.inner,t.prec);else if(t instanceof a6)s[n].push(t),t.provides&&e(t.provides,n);else if(t instanceof a5)s[n].push(t),t.facet.extensions&&e(t.facet.extensions,a9.default);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,a9.default),s.reduce((e,t)=>e.concat(t))))n instanceof a6?l.push(n):(u[n.facet.id]||(u[n.facet.id]=[])).push(n);let h=Object.create(null),d=[],f=[];for(let e of l)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 u){let t=u[e],r=t[0].facet,i=p&&p[e]||[];if(t.every(e=>0==e.type)){if(h[r.id]=d.length<<1|1,a2(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 a(e){let n=[];for(let t=0;t<r.length;t++){let o=ls(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)lo(e,t);return e.values[s]=a(e),1},update(e,n){if(!a4(e,o))return 0;let r=a(e);return t.compare(r,e.values[s])?0:(e.values[s]=r,1)},reconfigure(e,i){let o=a4(e,r),l=i.config.facets[t.id],u=i.facet(t);if(l&&!o&&a2(n,l))return e.values[s]=u,0;let c=a(e);return t.compare(c,u)?(e.values[s]=u,0):(e.values[s]=c,1)}}})(e,r,t))}}return new li(e,c,f.map(e=>e(h)),h,d,u)}}function lo(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 ls(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}let la=a1.define(),ll=a1.define({combine:e=>e.some(e=>e),static:!0}),lu=a1.define({combine:e=>e.length?e[0]:void 0,static:!0}),lc=a1.define(),lh=a1.define(),ld=a1.define(),lf=a1.define({combine:e=>!!e.length&&e[0]});class lp{constructor(e,t){this.type=e,this.value=t}static define(){return new lm}}class lm{of(e){return new lp(this,e)}}class lg{constructor(e){this.map=e}of(e){return new lv(this,e)}}class lv{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 lv(this.type,t)}is(e){return this.type==e}static define(e={}){return new lg(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}}lv.reconfigure=lv.define(),lv.appendConfig=lv.define();class ly{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&&aJ(n,t.newLength),i.some(e=>e.type==ly.time)||(this.annotations=i.concat(ly.time.of(Date.now())))}static create(e,t,n,r,i,o){return new ly(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(ly.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function lb(e,t,n){var r;let i,o,s;return n?(i=t.changes,o=a$.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?void 0:r.map(i),effects:lv.mapEffects(e.effects,i).concat(lv.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function lx(e,t,n){let r=t.selection,i=lS(t.annotations);return t.userEvent&&(i=i.concat(ly.userEvent.of(t.userEvent))),{changes:t.changes instanceof a$?t.changes:a$.of(t.changes||[],n,e.facet(lu)),selection:r&&(r instanceof aQ?r:aQ.single(r.anchor,r.head)),effects:lS(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}ly.time=lp.define(),ly.userEvent=lp.define(),ly.addToHistory=lp.define(),ly.remote=lp.define();let lw=[];function lS(e){return null==e?lw:Array.isArray(e)?e:[e]}var lC=((SN=lC||(lC={}))[SN.Word=0]="Word",SN[SN.Space=1]="Space",SN[SN.Other=2]="Other",SN);let lk=/[\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 lM{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++)lo(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 lo(this,n),ls(this,n)}update(...e){return function e(t,n,r){let i=lx(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=lb(i,lx(t,n[e],o?i.changes.newLength:t.doc.length),o)}let o=ly.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,n=t.facet(ld),r=e;for(let i=n.length-1;i>=0;i--){let o=n[i](e);o&&Object.keys(o).length&&(r=lb(r,lx(t,o,e.changes.newLength),!0))}return r==e?e:ly.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(lc)){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=a$.empty(n.doc.length);else{let n=t.changes.filter(r);e=n.changes,i=n.filtered.mapDesc(n.changes).invertedDesc}t=ly.create(n,e,t.selection&&t.selection.map(i),lv.mapEffects(t.effects,i),t.annotations,t.scrollIntoView)}let i=n.facet(lh);for(let r=i.length-1;r>=0;r--){let o=i[r](t);t=o instanceof ly?o:Array.isArray(o)&&1==o.length&&o[0]instanceof ly?o[0]:e(n,lS(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(ln.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(lv.reconfigure)?(n=null,r=t.value):t.is(lv.appendConfig)&&(n=null,r=lS(r).concat(t.value));t=n?e.startState.values.slice():new lM(n=li.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(ll)?e.newSelection:e.newSelection.asSingle();new lM(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:aQ.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=lS(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),a=this.changes(s.changes),l=a.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(l);let u=r.mapDesc(a,!0);i.push(s.range.map(u)),r=r.compose(l),o=lv.mapEffects(o,l).concat(lv.mapEffects(lS(s.effects),u))}return{changes:r,selection:aQ.create(i,t.mainIndex),effects:o}}changes(e=[]){return e instanceof a$?e:a$.of(e,this.doc.length,this.facet(lM.lineSeparator))}toText(e){return aD.of(e.split(this.facet(lM.lineSeparator)||az))}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:(lo(this,t),ls(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 a6&&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 lM.create({doc:e.doc,selection:aQ.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=li.resolve(e.extensions||[],new Map),n=e.doc instanceof aD?e.doc:aD.of((e.doc||"").split(t.staticFacet(lM.lineSeparator)||az)),r=e.selection?e.selection instanceof aQ?e.selection:aQ.single(e.selection.anchor,e.selection.head):aQ.single(0);return aJ(r,n.length),t.staticFacet(ll)||(r=r.asSingle()),new lM(t,n,r,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(lM.tabSize)}get lineBreak(){return this.facet(lM.lineSeparator)||"\n"}get readOnly(){return this.facet(lf)}phrase(e,...t){for(let t of this.facet(lM.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(la))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 lC.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()||lk.test(n)))return!0}return!1}(e))return lC.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return lC.Word;return lC.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=aF(t,o,!1);if(i(t.slice(e,o))!=lC.Word)break;o=e}for(;s<r;){let e=aF(t,s);if(i(t.slice(s,e))!=lC.Word)break;s=e}return o==s?null:aQ.range(o+n,s+n)}}function lT(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}lM.allowMultipleSelections=ll,lM.tabSize=a1.define({combine:e=>e.length?e[0]:4}),lM.lineSeparator=lu,lM.readOnly=lf,lM.phrases=a1.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])}}),lM.languageData=la,lM.changeFilter=lc,lM.transactionFilter=lh,lM.transactionExtender=ld,ln.reconfigure=lv.define();class lA{eq(e){return this==e}range(e,t=e){return lD.create(e,t,this)}}lA.prototype.startSide=lA.prototype.endSide=0,lA.prototype.point=!1,lA.prototype.mapMode=a_.TrackDel;class lD{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new lD(e,t,n)}}function lE(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class lO{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,a=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==o)return a>=0?o:s;a>=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 a=0;a<this.value.length;a++){let l=this.value[a],u=this.from[a]+e,c=this.to[a]+e,h,d;if(u==c){let e=t.mapPos(u,l.startSide,l.mapMode);if(null==e||(h=d=e,l.startSide!=l.endSide&&(d=t.mapPos(u,l.endSide))<h))continue}else if((h=t.mapPos(u,l.startSide))>(d=t.mapPos(c,l.endSide))||h==d&&l.startSide>0&&l.endSide<=0)continue;0>(d-h||l.endSide-l.startSide)||(o<0&&(o=h),l.point&&(s=Math.max(s,d-h)),n.push(l),r.push(h-o),i.push(d-o))}return{mapped:n.length?new lO(r,i,n,s):null,pos:o}}}class lR{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 lR(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(lE)),this.isEmpty)return t.length?lR.of(t):this;let s=new lN(this,null,-1).goto(0),a=0,l=[],u=new lP;for(;s.value||a<t.length;)if(a<t.length&&(s.from-t[a].from||s.startSide-t[a].value.startSide)>=0){let e=t[a++];u.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(s.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(s.chunkIndex)||i<this.chunkPos[s.chunkIndex])&&u.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))&&!u.addInner(s.from,s.to,s.value)&&l.push(lD.create(s.from,s.to,s.value)),s.next());return u.finishInner(this.nextLayer.isEmpty&&!l.length?lR.empty:this.nextLayer.update({add:l,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],a=e.touchesRange(o,o+s.length);if(!1===a)r=Math.max(r,s.maxPoint),t.push(s),n.push(e.mapPos(o));else if(!0===a){let{mapped:i,pos:a}=s.map(o,e);i&&(r=Math.max(r,i.maxPoint),t.push(i),n.push(a))}}let i=this.nextLayer.map(e);return 0==t.length?i:new lR(n,t,i||lR.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 lj.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return lj.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),a=lI(o,s,n),l=new lF(o,a,i),u=new lF(s,a,i);n.iterGaps((e,t,n)=>lZ(l,e,u,t,n,r)),n.empty&&0==n.length&&lZ(l,0,u,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=lI(i,o),a=new lF(i,s,0).goto(n),l=new lF(o,s,0).goto(n);for(;;){if(a.to!=l.to||!lB(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>r)return!0;a.next(),l.next()}}static spans(e,t,n,r,i=-1){let o=new lF(e,null,i).goto(t),s=t,a=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,a);r.point(s,e,o.point,n,i,o.pointRank),a=Math.min(o.openEnd(e),n.length)}else e>s&&(r.span(s,e,o.active,a),a=o.openEnd(e));if(o.to>n)return a+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new lP;for(let r of e instanceof lD?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(lE(t,r)>0)return e.slice().sort(lE);t=r}return e}(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return lR.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=lR.empty;r=r.nextLayer)t=new lR(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}lR.empty=new lR([],[],null,-1),lR.empty.nextLayer=lR.empty;class lP{finishChunk(e){this.chunks.push(new lO(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 lP)).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(lR.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=lR.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function lI(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 lN{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}{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 lj{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 lN(o,t,n,i));return 1==r.length?r[0]:new lj(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--)lL(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--)lL(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(),lL(this.heap,0)}}}function lL(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 lF{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=lj.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){lV(this.active,e),lV(this.activeTo,e),lV(this.activeRank,e),this.minActive=l_(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++;lz(this.active,t,n),lz(this.activeTo,t,r),lz(this.activeRank,t,i),e&&lz(e,t,this.cursor.from),this.minActive=l_(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&&lV(n,r)}else if(this.cursor.value){if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{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 lZ(e,t,n,r,i,o){e.goto(t),n.goto(r);let s=r+i,a=r,l=r-t;for(;;){let t=e.to+l-n.to,r=t||e.endSide-n.endSide,i=r<0?e.to+l:n.to,u=Math.min(i,s);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&lB(e.activeForPoint(e.to),n.activeForPoint(n.to))||o.comparePoint(a,u,e.point,n.point):u>a&&!lB(e.active,n.active)&&o.compareRange(a,u,e.active,n.active),i>s)break;(t||e.openEnd!=n.openEnd)&&o.boundChange&&o.boundChange(i),a=i,r<=0&&e.next(),r>=0&&n.next()}}function lB(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 lV(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function lz(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function l_(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 lH(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=aF(e,i));return r}function l$(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=aF(e,r)}return!0===r?-1:e.length}let lW="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),lq="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),lG="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class lU{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 a=[],l=/^@(\w+)\b/.exec(t[0]),u=l&&"keyframes"==l[1];if(l&&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(!l)throw RangeError("The value of a property ("+n+") should be a primitive value.");e(r(n),s,a,u)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+s+";")}(a.length||u)&&o.push((!n||l||s?t:t.map(n)).join(", ")+" {"+a.join(" ")+"}")}(r(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=lG[lW]||1;return lG[lW]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let r=e[lq],i=n&&n.nonce;r?i&&r.setNonce(i):r=new lY(e,i),r.mount(Array.isArray(t)?t:[t],e)}}let lK=new Map;class lY{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=lK.get(n);if(t)return e[lq]=t;this.sheet=new r.CSSStyleSheet,lK.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[lq]=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 lX={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:"'"},lQ={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},lJ="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),l0="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),l1=0;l1<10;l1++)lX[48+l1]=lX[96+l1]=String(l1);for(var l1=1;l1<=24;l1++)lX[l1+111]="F"+l1;for(var l1=65;l1<=90;l1++)lX[l1]=String.fromCharCode(l1+32),lQ[l1]=String.fromCharCode(l1);for(var l2 in lX)lQ.hasOwnProperty(l2)||(lQ[l2]=lX[l2]);function l5(e){let t;return(11==e.nodeType?e.getSelection?e:e.ownerDocument:e).getSelection()}function l3(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function l4(e,t){if(!t.anchorNode)return!1;try{return l3(e,t.anchorNode)}catch(e){return!1}}function l8(e){return 3==e.nodeType?ua(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function l6(e,t,n,r){return!!n&&(ue(e,t,n,r,-1)||ue(e,t,n,r,1))}function l9(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function l7(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function ue(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ut(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=l9(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?ut(e):0}}}function ut(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function un(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function ur(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 ui{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?ut(t):0),n,Math.min(e.focusOffset,n?ut(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}let uo=null;function us(e){if(e.setActive)return e.setActive();if(uo)return e.focus(uo);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==uo?{get preventScroll(){return uo={preventScroll:!0},!0}}:void 0),!uo){uo=!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 ua(e,t,n=t){let r=i||(i=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function ul(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 uu(e){for(;e.attributes.length;)e.removeAttributeNode(e.attributes[0])}function uc(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function uh(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r>0)return{node:n,offset:r};if(1==n.nodeType&&r>0){if("false"==n.contentEditable)return null;r=ut(n=n.childNodes[r-1])}else{if(!n.parentNode||l7(n))return null;r=l9(n),n=n.parentNode}}}function ud(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r<n.nodeValue.length)return{node:n,offset:r};if(1==n.nodeType&&r<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[r],r=0}else{if(!n.parentNode||l7(n))return null;r=l9(n)+1,n=n.parentNode}}}class uf{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new uf(e.parentNode,l9(e),t)}static after(e,t){return new uf(e.parentNode,l9(e)+1,t)}}let up=[];class um{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=um.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=ug(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=ug(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==ut(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&&!um.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 a=0,l=n,u=n;a<this.children.length;a++){let n=this.children[a],c=l+n.length;if(l<e&&c>t)return n.domBoundsAround(e,t,l);if(c>=e&&-1==r&&(r=a,i=l),l>t&&n.dom.parentNode==this.dom){o=a,s=u;break}u=c,l=c+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=up){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 uv(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 ug(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}um.prototype.breakAfter=0;class uv{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 uy(e,t,n,r,i,o,s,a,l){let{children:u}=e,c=u.length?u[t]:null,h=o.length?o[o.length-1]:null,d=h?h.breakAfter:s;if(!(t==r&&c&&!s&&!d&&o.length<2&&c.merge(n,i,o.length?h:null,0==n,a,l))){if(r<u.length){let e=u[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,l)?o[o.length-1]=e:((i||e.children.length&&!e.children[0].length)&&e.merge(0,i,null,!1,0,l),o.push(e))):(null==e?void 0:e.breakAfter)&&(h?h.breakAfter=1:s=1),r++}for(c&&(c.breakAfter=s,n>0&&(!s&&o.length&&c.merge(n,c.length,o[0],!1,a,0)?c.breakAfter=o.shift().breakAfter:(n<c.length||c.children.length&&0==c.children[c.children.length-1].length)&&c.merge(n,c.length,null,!1,a,0),t++));t<r&&o.length;)if(u[r-1].become(o[o.length-1]))r--,o.pop(),l=o.length?0:a;else if(u[t].become(o[0]))t++,o.shift(),a=o.length?0:l;else break;!o.length&&t&&r<u.length&&!u[t-1].breakAfter&&u[r].merge(0,0,u[t-1],!1,a,l)&&t--,(t<r||o.length)&&e.replaceChildren(t,r,o)}}function ub(e,t,n,r,i,o){let s=e.childCursor(),{i:a,off:l}=s.findPos(n,1),{i:u,off:c}=s.findPos(t,-1),h=t-n;for(let e of r)h+=e.length;e.length+=h,uy(e,u,c,a,l,r,0,i,o)}let ux="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},uw="undefined"!=typeof document?document:{documentElement:{style:{}}},uS=/Edge\/(\d+)/.exec(ux.userAgent),uC=/MSIE \d/.test(ux.userAgent),uk=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ux.userAgent),uM=!!(uC||uk||uS),uT=!uM&&/gecko\/(\d+)/i.test(ux.userAgent),uA=!uM&&/Chrome\/(\d+)/.exec(ux.userAgent),uD="webkitFontSmoothing"in uw.documentElement.style,uE=!uM&&/Apple Computer/.test(ux.vendor),uO=uE&&(/Mobile\/\w+/.test(ux.userAgent)||ux.maxTouchPoints>2);var uR={mac:uO||/Mac/.test(ux.platform),windows:/Win/.test(ux.platform),linux:/Linux|X11/.test(ux.platform),ie:uM,ie_version:uC?uw.documentMode||6:uk?+uk[1]:uS?+uS[1]:0,gecko:uT,gecko_version:uT?+(/Firefox\/(\d+)/.exec(ux.userAgent)||[0,0])[1]:0,chrome:!!uA,chrome_version:uA?+uA[1]:0,ios:uO,android:/Android\b/.test(ux.userAgent),webkit:uD,safari:uE,webkit_version:uD?+(/\bAppleWebKit\/(\d+)/.exec(ux.userAgent)||[0,0])[1]:0,tabSize:null!=uw.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class uP extends um{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 uP&&!(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 uP(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 uf(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?!(uR.chrome||uR.gecko)&&(t?(i--,s=1):o<r&&(o++,s=-1)):n<0?i--:o<r&&o++;let a=ua(e,i,o).getClientRects();if(!a.length)return null;let l=a[(s?s<0:n>=0)?0:a.length-1];return uR.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(a,e=>e.width)||l),s?un(l,s<0):l||null}(this.dom,e,t)}}class uI extends um{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(uu(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 uI&&n.mark.eq(this.mark))&&(!e||!(i<=0))&&(!(t<this.length)||!(o<=0)))&&(ub(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 uI(this.mark,t,o)}domAtPos(e){return uL(this,e)}coordsAt(e,t){return uF(this,e,t)}}class uN extends um{static create(e,t,n){return new uN(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=uN.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 uN&&!!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 uN&&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 aD.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):aD.empty}domAtPos(e){return(this.length?0==e:this.side>0)?uf.before(this.dom):uf.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 un(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 uj extends um{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof uj&&e.side==this.side}split(){return new uj(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?uf.before(this.dom):uf.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return aD.empty}get isHidden(){return!0}}function uL(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 uf(n,0)}function uF(e,t,n){let r=null,i=-1,o=null,s=-1;!function e(t,a){for(let l=0,u=0;l<t.children.length&&u<=a;l++){let c=t.children[l],h=u+c.length;h>=a&&(c.children.length?e(c,a-u):(!o||o.isHidden&&n>0)&&(h>a||u==h&&c.getSide()>0)?(o=c,s=a-u):(u<a||u==h&&0>c.getSide()&&!c.isHidden)&&(r=c,i=a-u)),u=h}}(e,t);let a=(n<0?r:o)||r||o;return a?a.coordsAt(Math.max(0,a==r?i:s),n):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=l8(t);return n[n.length-1]||null}(e)}function uZ(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}uP.prototype.children=uN.prototype.children=uj.prototype.children=up;let uB=Object.create(null);function uV(e,t,n){if(e==t)return!0;e||(e=uB),t||(t=uB);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 uz(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 u_{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 uH=((Sj=uH||(uH={}))[Sj.Text=0]="Text",Sj[Sj.WidgetBefore=1]="WidgetBefore",Sj[Sj.WidgetAfter=2]="WidgetAfter",Sj[Sj.WidgetRange=3]="WidgetRange",Sj);class u$ extends lA{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 uW(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 uG(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}=uU(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(o?t?2e8:1:-6e8)+1}return new uG(e,n,r,t,e.widget||null,!0)}static line(e){return new uq(e)}static set(e,t=!1){return lR.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}u$.none=lR.empty;class uW extends u${constructor(e){let{start:t,end:n}=uU(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 uW&&this.tagName==e.tagName&&(this.class||(null===(t=this.attrs)||void 0===t?void 0:t.class))==(e.class||(null===(n=e.attrs)||void 0===n?void 0:n.class))&&uV(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)}}uW.prototype.point=!1;class uq extends u${constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof uq&&this.spec.class==e.spec.class&&uV(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)}}uq.prototype.mapMode=a_.TrackBefore,uq.prototype.point=!0;class uG extends u${constructor(e,t,n,r,i,o){super(t,n,i,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?a_.TrackBefore:a_.TrackAfter:a_.TrackDel}get type(){return this.startSide!=this.endSide?uH.WidgetRange:this.startSide<=0?uH.WidgetBefore:uH.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){var t,n;return e instanceof uG&&(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 uU(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 uK(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)}uG.prototype.point=!0;class uY extends um{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 uY))return!1;this.dom||n.transferDOM(this)}return r&&this.setDeco(n?n.attrs:null),ub(this,e,t,n?n.children.slice():[],i,o),!0}split(e){let t=new uY;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){uV(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 uI&&o.length&&(i=o[o.length-1])instanceof uI&&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=uZ(t,this.attrs||{})),n&&(this.attrs=uZ({class:n},this.attrs||{}))}domAtPos(e){return uL(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(uu(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&&(uz(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&&um.get(r)instanceof uI;)r=r.lastChild;if(!r||!this.length||"BR"!=r.nodeName&&(null===(n=um.get(r))||void 0===n?void 0:n.isEditable)==!1&&(!uR.ios||!this.children.some(e=>e instanceof uP))){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 uP)||/[^ -~]/.test(n.text))return null;let r=l8(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=uF(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 uY&&0==this.children.length&&0==e.children.length&&uV(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 uY)return i;if(o>t)break}r=o+i.breakAfter}return null}}class uX extends um{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 uX&&!!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?uf.before(this.dom):uf.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new uX(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return up}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):aD.empty}domBoundsAround(){return null}become(e){return e instanceof uX&&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 uQ?null:un(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 uQ extends u_{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 uJ{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 uX&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new uY),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(u0(new uj(-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 uX||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(u0(new uP(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 uG){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 uG){if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new uX(n.widget||u1.block,s,n));else{let o=uN.create(n.widget||u1.inline,s,s?0:n.startSide),a=this.atCursorPos&&!o.isEditable&&i<=r.length&&(e<t||n.startSide>0),l=!o.isEditable&&(e<t||i>r.length||n.startSide<=0),u=this.getLine();2!=this.pendingBuffer||a||o.isEditable||(this.pendingBuffer=0),this.flushBuffer(r),a&&(u.append(u0(new uj(1),r),i),i=r.length+Math.max(0,i-r.length)),u.append(u0(o,r),i),this.atCursorPos=l,this.pendingBuffer=l?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 uJ(e,t,n,i);return o.openEnd=lR.spans(r,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function u0(e,t){for(let n of t)e=new uI(n,[e],e.length);return e}class u1 extends u_{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}}u1.inline=new u1("span"),u1.block=new u1("div");var u2=((SL=u2||(u2={}))[SL.LTR=0]="LTR",SL[SL.RTL=1]="RTL",SL);let u5=u2.LTR,u3=u2.RTL;function u4(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}let u8=u4("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),u6=u4("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),u9=Object.create(null),u7=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);u9[t]=n,u9[n]=-t}function ce(e){return e<=247?u8[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?u6[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}let ct=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class cn{get dir(){return this.level%2?u3:u5}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 cr=[];function ci(e){return[new cn(0,e,0)]}let co="",cs=a1.define(),ca=a1.define(),cl=a1.define(),cu=a1.define(),cc=a1.define(),ch=a1.define(),cd=a1.define(),cf=a1.define(),cp=a1.define(),cm=a1.define({combine:e=>e.some(e=>e)}),cg=a1.define({combine:e=>e.some(e=>e)}),cv=a1.define();class cy{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 cy(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 cy(aQ.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}let cb=lv.define({map:(e,t)=>e.map(t)}),cx=lv.define();function cw(e,t,n){let r=e.facet(cu);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 cS=a1.define({combine:e=>!e.length||e[0]}),cC=0,ck=a1.define();class cM{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 cM(cC++,e,n,r,e=>{let t=[ck.of(e)];return o&&t.push(cE.of(t=>{let n=t.plugin(e);return n?o(n):u$.none})),i&&t.push(i(e)),t})}static fromClass(e,t){return cM.define(t=>new e(t),t)}}class cT{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(cw(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){cw(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){cw(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}let cA=a1.define(),cD=a1.define(),cE=a1.define(),cO=a1.define(),cR=a1.define(),cP=a1.define();function cI(e,t){let n=e.state.facet(cP);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return lR.spans(r,t.from,t.to,{point(){},span(e,n,r,o){let s=e-t.from,a=n-t.from,l=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=ce(e.charCodeAt(r));if(1==t)break;if(2==t||4==t)return u3}return u5}(t.text,s,a)),o>0&&l.length&&(i=l[l.length-1]).to==s&&i.direction==n)i.to=a,l=i.inner;else{let e={from:s,to:a,direction:n,inner:[]};l.push(e),l=e.inner}}}}),i}let cN=a1.define();function cj(e){let t=0,n=0,r=0,i=0;for(let o of e.state.facet(cN)){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 cL=a1.define();class cF{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new cF(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 a=r==e.length?null:e[r],l=o-s,u=a?a.fromB:1e9;for(;i<t.length&&t[i]<u;){let e=t[i],r=t[i+1],o=Math.max(s,e),a=Math.min(u,r);if(o<=a&&new cF(o+l,a+l,o,a).addToSet(n),r>u)break;i+=2}if(!a)return n;new cF(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),o=a.toA,s=a.toB}}}class cZ{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=a$.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 cF(e,t,n,i))),this.changedRanges=r}static create(e,t,n){return new cZ(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 cB extends um{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=u$.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 uY],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new cF(0,0,0,e.state.doc.length)],0,null)}update(e){var t,n,r,i,o,s;let a,l;let u=e.changedRanges;this.minWidth>0&&u.length&&(u.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 c=-1;!(this.view.inputState.composing>=0)||this.view.observer.editContext||((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?c=this.domChanged.newSel.head:(n=e.changes,r=this.hasComposition,a=!1,r&&n.iterChangedRanges((e,t)=>{e<r.to&&t>r.from&&(a=!0)}),a||e.selectionSet||(c=e.state.selection.main.head)));let h=c>-1?function(e,t,n){let r=cV(e,n);if(!r)return null;let{node:i,from:o,to:s}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(r.from,r.to)!=a)return null;let l=t.invertedDesc,u=new cF(l.mapPos(o),l.mapPos(s),o,s),c=[];for(let t=i.parentNode;;t=t.parentNode){let n=um.get(t);if(n instanceof uI)c.push({node:t,deco:n.mark});else{if(n instanceof uY||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:u,text:i,marks:c,line:t};if(t==e.contentDOM)return null;c.push({node:t,deco:new uW({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,c):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:n}=this.hasComposition;u=new cF(t,n,e.changes.mapPos(t,-1),e.changes.mapPos(n,1)).addToSet(u.slice())}this.hasComposition=h?{from:h.range.fromB,to:h.range.toB}:null,(uR.ie||uR.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,l=new cz,lR.compare(i,o,s,l),l.changes);return u=cF.extendWithRanges(u,d),(!!(7&this.flags)||0!=u.length)&&(this.updateInner(u,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=uR.chrome||uR.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 uX&&e.widget instanceof uQ&&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:a,toB:l}=t,u,c,h,d;if(n&&n.range.fromB<l&&n.range.toB>a){let e=uJ.build(this.view.state.doc,a,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=uJ.build(this.view.state.doc,n.range.toB,l,this.decorations,this.dynamicDecorationMap);c=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(),u=e.content.concat(r).concat(t.content)}else({content:u,breakAtStart:c,openStart:h,openEnd:d}=uJ.build(this.view.state.doc,a,l,this.decorations,this.dynamicDecorationMap));let{i:f,off:p}=i.findPos(s,1),{i:m,off:g}=i.findPos(o,-1);uy(this,m,g,f,p,u,c,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(cx)&&(this.editContextFormatting=e.value)}compositionView(e){let t=new uP(e.text.nodeValue);for(let{deco:n}of(t.flags|=8,e.marks))t=new uI(n,[t],t.length);let n=new uY;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=um.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(cS)||this.dom.tabIndex>-1)&&l4(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(i||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),u=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(uR.gecko&&a.empty&&!this.hasComposition&&1==(n=l).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(()=>l.node.insertBefore(e,l.node.childNodes[l.offset]||null)),l=u=new uf(e,0),s=!0}let c=this.view.observer.selectionRange;!s&&c.focusNode&&(l6(l.node,l.offset,c.anchorNode,c.anchorOffset)&&l6(u.node,u.offset,c.focusNode,c.focusOffset)||this.suppressWidgetCursorChange(c,a))||(this.view.observer.ignore(()=>{uR.android&&uR.chrome&&this.dom.contains(c.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}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=l5(this.view.root);if(e){if(a.empty){if(uR.gecko){var t,n;let e=(t=l.node,n=l.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?uh:ud)(l.node,l.offset);t&&(l=new uf(t.node,t.offset))}}e.collapse(l.node,l.offset),null!=a.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=a.bidiLevel)}else if(e.extend){e.collapse(l.node,l.offset);try{e.extend(u.node,u.offset)}catch(e){}}else{let t=document.createRange();a.anchor>a.head&&([l,u]=[u,l]),t.setEnd(u.node,u.offset),t.setStart(l.node,l.offset),e.removeAllRanges(),e.addRange(t)}}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(l,u)),this.impreciseAnchor=l.precise?null:new uf(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new uf(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&l6(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=l5(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=uY.find(this,t.head);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let u=this.domAtPos(t.head+t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;e.docView.posFromDOM(c.anchorNode,c.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=um.get(t.childNodes[r]);e instanceof uY&&(n=e.domAtPos(0))}for(let r=e.offset-1;!n&&r>=0;r--){let e=um.get(t.childNodes[r]);e instanceof uY&&(n=e.domAtPos(e.length))}return n?new uf(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let e=um.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 uY)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],a=i-s.breakAfter,l=a-s.length;if(a<e)break;if(l<=e&&(l<e||s.covers(-1))&&(a>e||s.covers(1))&&(!n||s instanceof uY&&!(n instanceof uY&&t>=0)))n=s,r=l;else if(n&&l==e&&a==e&&s instanceof uX&&2>Math.abs(t)){if(s.deco.startSide<0)break;o&&(n=null)}i=l}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 uY))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 uP))return null;let i=aF(r.text,n);if(i==n)return null;let o=ua(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,a=this.view.textDirection==u2.LTR;for(let e=0,l=0;l<this.children.length;l++){let u=this.children[l],c=e+u.length;if(c>r)break;if(e>=n){let n=u.dom.getBoundingClientRect();if(t.push(n.height),o){let t=u.dom.lastChild,r=t?l8(t):[];if(r.length){let t=r[r.length-1],o=a?t.right-n.left:n.right-t.left;o>s&&(s=o,this.minWidth=i,this.minWidthFrom=e,this.minWidthTo=c)}}}e=c+u.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?u2.RTL:u2.LTR}measureTextSize(){for(let e of this.children)if(e instanceof uY){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=l8(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 uv(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(u$.replace({widget:new uQ(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!i)break;n=i.to+1}return u$.set(e)}updateDeco(){let e=1,t=this.view.state.facet(cE).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,r=this.view.state.facet(cO).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(lR.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(cv))try{if(t(this.view,e.range,e))return!0}catch(e){cw(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=cj(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:a}=this.view.scrollDOM;!function(e,t,n,r,i,o,s,a){let l=e.ownerDocument,u=l.defaultView||window;for(let c=e,h=!1;c&&!h;)if(1==c.nodeType){let e,d=c==l.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}}(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(h=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let t=c.getBoundingClientRect();({scaleX:f,scaleY:p}=ur(c,t)),e={left:t.left,right:t.left+c.clientWidth*f,top:t.top,bottom:t.top+c.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==a?t.left-o:t.right-(e.right-e.left)+o)-e.left,m||g){if(d)u.scrollBy(m,g);else{let e=0,n=0;if(g){let e=c.scrollTop;c.scrollTop+=g/p,n=(c.scrollTop-e)*p}if(m){let t=c.scrollLeft;c.scrollLeft+=m/f,e=(c.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)}),c=c.assignedSlot||c.parentNode}else if(11==c.nodeType)c=c.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,a),-a),this.view.textDirection==u2.LTR)}}function cV(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=uh(n.focusNode,n.focusOffset),i=ud(n.focusNode,n.focusOffset),o=r||i;if(i&&r&&i.node!=r.node){let t=um.get(i.node);if(!t||t instanceof uP&&t.text!=i.node.nodeValue)o=i;else if(e.docView.lastCompositionAfterCursor){let e=um.get(r.node);!e||e instanceof uP&&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 cz=class{constructor(){this.changes=[]}compareRange(e,t){uK(e,t,this.changes)}comparePoint(e,t){uK(e,t,this.changes)}boundChange(e){uK(e,e,this.changes)}};function c_(e,t){return e.top<t.bottom-1&&e.bottom>t.top+1}function cH(e,t){return t<e.top?{top:t,left:e.left,right:e.right,bottom:e.bottom}:e}function c$(e,t){return t>e.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function cW(e,t,n){let r=e.nodeValue.length,i=-1,o=1e9,s=0;for(let a=0;a<r;a++){let r=ua(e,a,a+1).getClientRects();for(let l=0;l<r.length;l++){let u=r[l];if(u.top==u.bottom)continue;s||(s=t-u.left);let c=(u.top>n?u.top-n:n-u.bottom)-1;if(u.left-1<=t&&u.right+1>=t&&c<o){let n=t>=(u.left+u.right)/2,r=n;if((uR.chrome||uR.gecko)&&ua(e,a).getBoundingClientRect().left==u.right&&(r=!n),c<=0)return{node:e,offset:a+ +!!r};i=a+ +!!r,o=c}}}return{node:e,offset:i>-1?i:s>0?e.nodeValue.length:0}}function cq(e,t,n,r=-1){var i,o;let s=e.contentDOM.getBoundingClientRect(),a=s.top+e.viewState.paddingTop,l,{docHeight:u}=e.viewState,{x:c,y:h}=t,d=h-a;if(d<0)return 0;if(d>u)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,i=!1;(l=e.elementAtHeight(d)).type!=uH.Text;)for(;!((d=r>0?l.bottom+t:l.top-t)>=0)||!(d<=u);){if(i)return n?null:0;i=!0,r=-r}h=a+d;let f=l.from;if(f<e.viewport.from)return 0==e.viewport.from?0:n?null:cG(e,s,l,c,h);if(f>e.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:cG(e,s,l,c,h);let p=e.dom.ownerDocument,m=e.root.elementFromPoint?e.root:p,g=m.elementFromPoint(c,h);g&&!e.contentDOM.contains(g)&&(g=null),!g&&(c=Math.max(s.left+1,Math.min(s.right-1,c)),(g=m.elementFromPoint(c,h))&&!e.contentDOM.contains(g)&&(g=null));let v,y=-1;if(g&&(null===(i=e.docView.nearest(g))||void 0===i?void 0:i.isEditable)!=!1){if(p.caretPositionFromPoint){let e=p.caretPositionFromPoint(c,h);e&&({offsetNode:v,offset:y}=e)}else if(p.caretRangeFromPoint){let t=p.caretRangeFromPoint(c,h);t&&({startContainer:v,startOffset:y}=t,(!e.contentDOM.contains(v)||uR.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 ua(e,r-1,r).getBoundingClientRect().left>n}(v,y,c)||uR.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():ua(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect()).left>5}(v,y,c))&&(v=void 0))}v&&(y=Math.min(ut(v),y))}if(!v||!e.docView.dom.contains(v)){let t=uY.find(e.docView,f);if(!t)return d>l.top+l.height/2?l.to:l.from;({node:v,offset:y}=function e(t,n,r){let i,o,s,a,l,u,c,h,d=!1;for(let m=t.firstChild;m;m=m.nextSibling){let t=l8(m);for(let g=0;g<t.length;g++){var f,p;let v=t[g];u&&c_(u,v)&&(v=cH(c$(v,u.bottom),u.top));let y=(f=v).left>n?f.left-n:Math.max(0,n-f.right),b=(p=v).top>r?p.top-r:Math.max(0,r-p.bottom);if(0==y&&0==b)return 3==m.nodeType?cW(m,n,r):e(m,n,r);if(!l||h>b||h==b&&c>y){l=m,u=v,c=y,h=b;let e=b?r<v.top?-1:1:y?n<v.left?-1:1:0;d=!e||(e>0?g<t.length-1:g>0)}0==y?r>v.bottom&&(!s||s.bottom<v.bottom)?(i=m,s=v):r<v.top&&(!a||a.top>v.top)&&(o=m,a=v):s&&c_(s,v)?s=c$(s,v.bottom):a&&c_(a,v)&&(a=cH(a,v.top))}}if(s&&s.bottom>=r?(l=i,u=s):a&&a.top<=r&&(l=o,u=a),!l)return{node:t,offset:0};let m=Math.max(u.left,Math.min(u.right,n));if(3==l.nodeType)return cW(l,m,r);if(d&&"false"!=l.contentEditable)return e(l,m,r);let g=Array.prototype.indexOf.call(t.childNodes,l)+ +(n>=(u.left+u.right)/2);return{node:t,offset:g}}(t.dom,c,h))}let b=e.docView.nearest(v);if(!b)return null;if(!b.isWidget||(null===(o=b.dom)||void 0===o?void 0:o.nodeType)!=1)return b.localPosFromDOM(v,y)+b.posAtStart;{let e=b.dom.getBoundingClientRect();return t.y<e.top||t.y<=e.bottom&&t.x<=(e.left+e.right)/2?b.posAtStart:b.posAtEnd}}function cG(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+l$(s,o,e.state.tabSize)}function cU(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==uH.Text))return e}return n}function cK(e,t,n,r){let i=e.state.doc.lineAt(t.head),o=e.bidiSpans(i),s=e.textDirectionAt(i.from);for(let a=t,l=null;;){let t=function(e,t,n,r,i){var o;let s=r.head-e.from,a=cn.find(t,s,null!==(o=r.bidiLevel)&&void 0!==o?o:-1,r.assoc),l=t[a],u=l.side(i,n);if(s==u){let e=a+=i?1:-1;if(e<0||e>=t.length)return null;s=(l=t[a=e]).side(!i,n),u=l.side(i,n)}let c=aF(e.text,s,l.forward(i,n));(c<l.from||c>l.to)&&(c=u),co=e.text.slice(Math.min(s,c),Math.max(s,c));let h=a==(i?t.length-1:0)?null:t[a+(i?1:-1)];return h&&c==u&&h.level+ +!i<l.level?aQ.cursor(h.side(!i,n)+e.from,h.forward(i,n)?1:-1,h.level):aQ.cursor(c+e.from,l.forward(i,n)?-1:1,l.level)}(i,o,s,a,n),u=co;if(!t){if(i.number==(n?e.state.doc.lines:1))return a;u="\n",i=e.state.doc.line(i.number+(n?1:-1)),o=e.bidiSpans(i),t=e.visualLineSide(i,!n)}if(l){if(!l(u))return a}else{if(!r)return t;l=r(u)}a=t}}function cY(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 cX(e,t,n){let r=cY(e.state.facet(cR).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:aQ.cursor(r,r<n.from?1:-1)}class cQ{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(lM.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=um.get(r),s=um.get(i);(o&&s?o.breakAfter:(o?o.breakAfter:l7(r))||l7(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=um.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<ut(t))return!1;if(t==e)return!0;n=l9(t)+1,t=t.parentNode}}(e,n.node,n.offset)?0:t))}}class cJ{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class c0{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 cJ(n,r)),(i!=n||o!=r)&&t.push(new cJ(i,o))),t}(e),n=new cQ(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?aQ.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||!l3(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||!l3(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((uR.ios||uR.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,a=s.to-i;(0==o||1==o||0==t)&&(0==a||-1==a||i==e.state.doc.length)&&(n=0,r=e.state.doc.length)}this.newSel=aQ.single(r,n)}}}function c1(e,t){let n;let{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,a=i.from,l=null;(8===o||uR.android&&t.text.length<s-r)&&(a=i.to,l="end");let u=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,a=t.length;for(;s>0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;if("end"==r){let e=Math.max(0,o-Math.min(s,a));n-=s+e-o}if(s<o&&e.length<t.length){let e=n<=o&&n>=s?o-n:0;o-=e,a=o+(a-s),s=o}else if(a<o){let e=n<=o&&n>=a?o-n:0;o-=e,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}(e.state.doc.sliceString(r,s,"￿"),t.text,a-r,l);u&&(uR.chrome&&13==o&&u.toB==u.from+2&&"￿￿"==t.text.slice(u.from,u.toB)&&u.toB--,n={from:r+u.from,to:r+u.toA,insert:aD.of(t.text.slice(u.from,u.toB).split("￿"))})}else r&&(!e.hasFocus&&e.state.facet(cS)||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)}:(uR.mac||uR.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=aQ.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:aD.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))}:uR.chrome&&n&&n.from==n.to&&n.from==i.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=aQ.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:aD.of([" "])}),n)return c2(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 c2(e,t,n,r=-1){let i;if(uR.ios&&e.inputState.flushIOSKey(t))return!0;let o=e.state.selection.main;if(uR.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&&ul(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)&&ul(e.contentDOM,"Backspace",8)||t.from==o.from&&t.to==o.to+1&&0==t.insert.length&&ul(e.contentDOM,"Delete",46)))return!0;let s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>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),a=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 l=e.state.sliceDoc(t.from,t.to),u,c=n&&cV(e,n.main.head);if(c){let e=t.insert.length-(t.to-t.from);u={from:c.from,to:c.to-e}}else u=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:a||n.map(s)};let r=n.to-h,c=r-l.length;if(n.to-n.from!=d||e.state.sliceDoc(c,r)!=l||n.to>=u.from&&n.from<=u.to)return{range:n};let f=i.changes({from:c,to:r,insert:t.insert}),p=n.to-o.to;return{changes:f,range:a?aQ.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):n.map(f)}})}else r={changes:s,selection:a&&i.selection.replaceRange(a)}}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(ch).some(n=>n(e,t.from,t.to,s,a))||e.dispatch(a()),!0}class c5{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){var t;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,uR.safari&&e.contentDOM.addEventListener("input",()=>null),uR.gecko&&(t=e.contentDOM.ownerDocument,hy.has(t)||(hy.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{})))}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=um.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(c3(t.value,i))}if(e&&e.domEventObservers)for(let r in e.domEventObservers){let i=e.domEventObservers[r];i&&n(r).observers.push(c3(t.value,i))}}for(let e in he)n(e).handlers.push(he[e]);for(let e in ht)n(e).observers.push(ht[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>c6.indexOf(e.keyCode)&&(this.tabFocusMode=-1),uR.android&&uR.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))?(this.view.observer.delayAndroidKey(e.key,e.keyCode),!0):uR.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=c4.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||c8.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,ul(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!!/^key/.test(e.type)&&(this.composing>0||!!(uR.safari&&!uR.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 c3(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){cw(n.state,e)}}}let c4=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],c8="dthko",c6=[16,17,18,20,91,92,224,225];function c9(e){return .7*Math.max(0,e)+8}class c7{constructor(e,t,n,r){var i,o;let s;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&&i!=t.body&&(!n||!r);)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(cR).map(t=>t(e));let a=e.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(lM.allowMultipleSelections)&&(i=e,o=t,(s=i.state.facet(cs)).length?s[0](o):uR.mac?o.metaKey:o.ctrlKey),this.dragging=!!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=l5(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==hd(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>Math.max(Math.abs((t=this.startEvent).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,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:s}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=cj(this.view);e.clientX-l.left<=i+6?n=-c9(i-e.clientX):e.clientX+l.right>=s-6&&(n=c9(e.clientX-s)),e.clientY-l.top<=o+6?r=-c9(o-e.clientY):e.clientY+l.bottom>=a-6&&(r=c9(e.clientY-a)),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=cY(this.atoms,r.from,0);e!=r.from&&(i=aQ.cursor(e,-1))}else{let e=cY(this.atoms,r.from,-1),t=cY(this.atoms,r.to,1);(e!=r.from||t!=r.to)&&(i=aQ.range(r.from==r.anchor?e:t,r.from==r.head?e:t))}i&&(t||(t=e.ranges.slice()),t[n]=i)}return t?aQ.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 he=Object.create(null),ht=Object.create(null),hn=uR.ie&&uR.ie_version<15||uR.ios&&uR.webkit_version<604;function hr(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function hi(e,t){t=hr(e.state,cf,t);let{state:n}=e,r,i=1,o=n.toText(t),s=o.lines==n.selection.ranges.length;if(null!=hp&&n.selection.ranges.every(e=>e.empty)&&hp==o.toString()){let e=-1;r=n.changeByRange(r=>{let a=n.doc.lineAt(r.from);if(a.from==e)return{range:r};e=a.from;let l=n.toText((s?o.line(i++).text:t)+n.lineBreak);return{changes:{from:a.from,insert:l},range:aQ.cursor(r.from+l.length)}})}else r=s?n.changeByRange(e=>{let t=o.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:aQ.cursor(e.from+t.length)}}):n.replaceSelection(o);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}function ho(e,t,n,r){if(1==r)return aQ.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 aQ.cursor(t);0==o?n=1:o==i.length&&(n=-1);let s=o,a=o;n<0?s=aF(i.text,o,!1):a=aF(i.text,o);let l=r(i.text.slice(s,a));for(;s>0;){let e=aF(i.text,s,!1);if(r(i.text.slice(e,s))!=l)break;s=e}for(;a<i.length;){let e=aF(i.text,a);if(r(i.text.slice(a,e))!=l)break;a=e}return aQ.range(s+i.from,a+i.from)}(e.state,t,n);{let n=uY.find(e.docView,t),r=e.state.doc.lineAt(n?n.posAtEnd:t),i=n?n.posAtStart:r.from,o=n?n.posAtEnd:r.to;return o<e.state.doc.length&&o==r.to&&o++,aQ.range(i,o)}}ht.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},he.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),ht.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},ht.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},he.mousedown=(e,t)=>{var n,r;let i,o,s;if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let a=null;for(let n of e.state.facet(cl))if(a=n(e,t))break;if(a||0!=t.button||(i=ha(n=e,r=t),o=hd(r),s=n.state.selection,a={update(e){e.docChanged&&(i.pos=e.changes.mapPos(i.pos),s=s.map(e.changes))},get(e,t,r){let a=ha(n,e),l,u=ho(n,a.pos,a.bias,o);if(i.pos!=a.pos&&!t){let e=ho(n,i.pos,i.bias,o),t=Math.min(e.from,u.from),r=Math.max(e.to,u.to);u=t<u.from?aQ.range(t,r):aQ.range(r,t)}return t?s.replaceRange(s.main.extend(u.from,u.to)):r&&1==o&&s.ranges.length>1&&(l=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 aQ.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}(s,a.pos))?l:r?s.addRange(u):aQ.create([u])}}),a){let n=!e.hasFocus;e.inputState.startMouseSelection(new c7(e,t,a,n)),n&&e.observer.ignore(()=>{us(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 hs=(e,t,n)=>t>=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right;function ha(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:function(e,t,n,r){let i=uY.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&&hs(n,r,s))return -1;let a=i.coordsAt(o,1);return a&&hs(n,r,a)?1:s&&s.bottom>=r?-1:1}(e,n,t.clientX,t.clientY)}}let hl=uR.ie&&uR.ie_version<=11,hu=null,hc=0,hh=0;function hd(e){if(!hl)return e.detail;let t=hu,n=hh;return hu=e,hh=Date.now(),hc=!t||n>Date.now()-400&&2>Math.abs(t.clientX-e.clientX)&&2>Math.abs(t.clientY-e.clientY)?(hc+1)%3:1}function hf(e,t,n,r){let i;if(!(n=hr(e.state,cf,n)))return;let o=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,a=r&&s&&((i=e.state.facet(ca)).length?i[0](t):uR.mac?!t.altKey:!t.ctrlKey)?{from:s.from,to:s.to}:null,l={from:o,insert:n},u=e.state.changes(a?[a,l]:l);e.focus(),e.dispatch({changes:u,selection:{anchor:u.mapPos(o,-1),head:u.mapPos(o,1)},userEvent:a?"move.drop":"input.drop"}),e.inputState.draggedContent=null}he.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=aQ.range(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",hr(e.state,cp,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},he.dragend=e=>(e.inputState.draggedContent=null,!1),he.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&&hf(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 hf(e,t,n,!0),!0}return!1},he.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=hn?null:t.clipboardData;return n?(hi(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(),hi(e,n.value)},50)}(e),!1)};let hp=null;he.copy=he.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:hr(e,cp,t.join(e.lineBreak)),ranges:n,linewise:r}}(e.state);if(!n&&!i)return!1;hp=i?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let o=hn?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 hm=lp.define();function hg(e,t){let n=[];for(let r of e.facet(cd)){let i=r(e,t);i&&n.push(i)}return n?e.update({effects:n,annotations:hm.of(!0)}):null}function hv(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=hg(e.state,t);n?e.dispatch(n):e.update([])}},10)}ht.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),hv(e)},ht.blur=e=>{e.observer.clearSelectionRange(),hv(e)},ht.compositionstart=ht.compositionupdate=e=>{!e.observer.editContext&&(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},ht.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,uR.chrome&&uR.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},ht.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},he.beforeinput=(e,t)=>{var n,r;let i;if("insertReplacementText"==t.inputType&&e.observer.editContext){let r=null===(n=t.dataTransfer)||void 0===n?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 c2(e,{from:n,to:o,insert:e.state.toText(r)},null),!0}}if(uR.chrome&&uR.android&&(i=c4.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?void 0:r.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return uR.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),uR.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>ht.compositionend(e,t),20),!1};let hy=new Set,hb=["pre-wrap","normal","pre-line","break-spaces"],hx=!1;class hw{constructor(e){this.lineWrapping=e,this.doc=aD.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 hb.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=hb.indexOf(e)>-1,a=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,a){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 a}}class hS{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class hC{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?uH.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 uG?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 hC(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var hk=((SF=hk||(hk={}))[SF.ByPos=0]="ByPos",SF[SF.ByHeight=1]="ByHeight",SF[SF.ByPosNoHeight=2]="ByPosNoHeight",SF);class hM{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&&(hx=!0),this.height=e)}replace(e,t,n){return hM.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:a,toA:l,fromB:u,toB:c}=r[s],h=i.lineAt(a,hk.ByPosNoHeight,n.setDoc(t),0,0),d=h.to>=l?h:i.lineAt(l,hk.ByPosNoHeight,n,0,0);for(c+=d.to-l,l=d.to;s>0&&h.from<=r[s-1].toA;)a=r[s-1].fromA,u=r[s-1].fromB,s--,a<h.from&&(h=i.lineAt(a,hk.ByPosNoHeight,n,0,0));u+=h.from-a,a=h.from;let f=hP.build(n.setDoc(o),e,u,c);i=hT(i,i.replace(a,l,f))}return i.updateHeight(n,0)}static empty(){return new hD(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 hO(hM.of(e.slice(0,t)),o,hM.of(e.slice(n)))}}function hT(e,t){return e==t?e:(e.constructor!=t.constructor&&(hx=!0),t)}hM.prototype.size=1;class hA extends hM{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,r){return new hC(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 hD extends hA{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,r){return new hC(r,this.length,n,this.height,this.breaks)}replace(e,t,n){let r=n[0];return 1==n.length&&(r instanceof hD||r instanceof hE&&4&r.flags)&&10>Math.abs(this.length-r.length)?(r instanceof hE?r=new hD(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):hM.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 hE extends hM{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:a}=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),l=s+o.length*a,u=Math.max(n,e-l/2);return new hC(o.from,o.length,u,l,0)}{let r=Math.max(0,Math.min(o-i,Math.floor((e-n)/s))),{from:a,length:l}=t.doc.line(i+r);return new hC(a,l,n+s*r,s,0)}}lineAt(e,t,n,r,i){if(t==hk.ByHeight)return this.blockAt(e,n,r,i);if(t==hk.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new hC(t,r-t,0,0,0)}let{firstLine:o,perLine:s,perChar:a}=this.heightMetrics(n,i),l=n.doc.lineAt(e),u=s+l.length*a,c=l.number-o,h=r+s*c+a*(l.from-i-c);return new hC(l.from,l.length,Math.max(r,Math.min(h,r+this.height-u)),u,0)}forEachLine(e,t,n,r,i,o){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(n,i);for(let u=e,c=r;u<=t;){let t=n.doc.lineAt(u);if(u==e){let n=t.number-s;c+=a*n+l*(e-i-n)}let r=a+l*t.length;o(new hC(t.from,t.length,c,r,0)),c+=r,u=t.to+1}}replace(e,t,n){let r=this.length-t;if(r>0){let e=n[n.length-1];e instanceof hE?n[n.length-1]=new hE(e.length+r):n.push(null,new hE(r-1))}if(e>0){let t=n[0];t instanceof hE?n[0]=new hE(e+t.length):n.unshift(new hE(e-1),null)}return hM.of(n)}decomposeLeft(e,t){t.push(new hE(e-1),null)}decomposeRight(e,t){t.push(null,new hE(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 hE(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 a=new hD(t,i);a.outdated=!1,n.push(a),o+=t+1}o<=i&&n.push(null,new hE(i-o).updateHeight(e,o));let a=hM.of(n);return(s<0||Math.abs(a.height-this.height)>=.001||Math.abs(s-this.heightMetrics(e,t).perLine)>=.001)&&(hx=!0),hT(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class hO extends hM{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,a=t==hk.ByHeight?e<o:e<s,l=a?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,o,s);if(this.break||(a?l.to<s:l.from>s))return l;let u=t==hk.ByPosNoHeight?hk.ByPosNoHeight:hk.ByPos;return a?l.join(this.right.lineAt(s,u,n,o,s)):this.left.lineAt(s,u,n,r,i).join(l)}forEachLine(e,t,n,r,i,o){let s=r+this.left.height,a=i+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,r,i,o),t>=a&&this.right.forEachLine(e,t,n,s,a,o);else{let l=this.lineAt(a,hk.ByPos,n,r,i);e<l.from&&this.left.forEachLine(e,l.from-1,n,r,i,o),l.to>=e&&l.from<=t&&o(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,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&&hR(i,o-1),t<this.length){let e=i.length;this.decomposeRight(t,i),hR(i,e)}return hM.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?hM.of(this.break?[e,null,t]:[e,t]):(this.left=hT(this.left,e),this.right=hT(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,a=null;return(r&&r.from<=t+i.length&&r.more?a=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=s+o.length&&r.more?a=o=o.updateHeight(e,s,n,r):o.updateHeight(e,s,n),a)?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 hR(e,t){let n,r;null==e[t]&&(n=e[t-1])instanceof hE&&(r=e[t+1])instanceof hE&&e.splice(t-1,3,new hE(n.length+1+r.length))}class hP{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 hD?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new hD(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 hA(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 hD(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new hE(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 hD)return e;let t=new hD(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 hD||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new hD(0,-1));let n=e;for(let e of this.nodes)e instanceof hD&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,r){let i=new hP(n,e);return lR.spans(t,n,r,i,0),i.finish(n)}}class hI{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&uK(e,t,this.changes,5)}}class hN{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 u$.replace({widget:new hj(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class hj extends u_{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 hL{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=hV,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=u2.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(cD).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new hw(t),this.stateDeco=e.facet(cE).filter(e=>"function"!=typeof e),this.heightMap=hM.empty().applyChanges(this.stateDeco,aD.empty,this.heightOracle.setDoc(e.doc),[new cF(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=u$.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 hF(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?hV:new hz(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(h_(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(cE).filter(e=>"function"!=typeof e);let s=e.changedRanges,a=cF.extendWithRanges(s,(n=this.stateDeco,r=e?e.changes:a$.empty(this.state.doc.length),i=new hI,lR.compare(o,n,r,i,0),i.changes)),l=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);hx=!1,this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=l||hx)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let c=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<c.from||t.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,t));let h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,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(cg)&&(this.mustEnforceCursorAssoc=!0)}measure(e){var t;let n,r,i=e.contentDOM,o=window.getComputedStyle(i),s=this.heightOracle,a=o.whiteSpace;this.defaultTextDirection="rtl"==o.direction?u2.RTL:u2.LTR;let l=this.heightOracle.mustRefreshForWrapping(a),u=i.getBoundingClientRect(),c=l||this.mustMeasureContent||this.contentDOMHeight!=u.height;this.contentDOMHeight=u.height,this.mustMeasureContent=!1;let h=0,d=0;if(u.width&&u.height){let{scaleX:e,scaleY:t}=ur(i,u);(e>.005&&Math.abs(this.scaleX-e)>.005||t>.005&&Math.abs(this.scaleY-t)>.005)&&(this.scaleX=e,this.scaleY=t,h|=16,l=c=!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&&(c=!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=uc(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),a=Math.max(0,n.top),l=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),a=Math.max(a,r.top),l=Math.min(t==e.parentNode?i.innerHeight:l,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:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}})(i,this.paddingTop),v=g.top-this.pixelViewport.top,y=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(c=!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=u.width;if((this.contentDOMWidth!=x||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),c){let t=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(t)&&(l=!0),l||s.lineWrapping&&Math.abs(x-this.contentDOMWidth)>s.charWidth){let{lineHeight:n,charWidth:r,textHeight:i}=e.docView.measureTextSize();(l=n>0&&s.refresh(a,n,r,i,x/r,t))&&(e.docView.minWidth=0,h|=16)}for(let n of(v>0&&y>0?d=Math.max(v,y):v<0&&y<0&&(d=Math.min(v,y)),hx=!1,this.viewports)){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(l?hM.empty().applyChanges(this.stateDeco,aD.empty,this.heightOracle,[new cF(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,l,new hS(n.from,r))}hx&&(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(l?[]: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,a=new hF(r.lineAt(o-1e3*n,hk.ByHeight,i,0,0).from,r.lineAt(s+(1-n)*1e3,hk.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=r.lineAt(e,hk.ByPos,i,0,0),s;s="center"==t.y?(o.top+o.bottom)/2-n/2:"start"==t.y||"nearest"==t.y&&e<a.from?o.top:o.bottom-n,a=new hF(r.lineAt(s-500,hk.ByHeight,i,0,0).from,r.lineAt(s+n+500,hk.ByHeight,i,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new hF(this.heightMap.lineAt(n,hk.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,hk.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,hk.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,hk.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 hN(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!=u2.LTR&&!n)return[];let s=[],a=(r,o,l,u)=>{if(o-r<i)return;let c=this.state.selection.main,h=[c.from];for(let e of(c.empty||h.push(c.to),h))if(e>r&&e<o){a(r,e-10,l,u),a(e+10,o,l,u);return}let d=function(e,t){for(let n of e)if(t(n))return n}(e,e=>e.from>=l.from&&e.to<=l.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<l.to&&t&&n&&t.visibleRanges.some(e=>e.from<=o&&e.to>=o)){let e=t.moveToLineBoundary(aQ.cursor(o),!1,!0).head;e>r&&(o=e)}let e=this.gapSize(l,r,o,u),i=n||e<2e6?e:2e6;d=new hN(r,o,e,i)}s.push(d)},l=t=>{var i,s,l;let u,c,h,d,f;if(t.length<o||t.type!=uH.Text)return;let p=(i=t.from,s=t.to,l=this.stateDeco,h=[],d=i,f=0,lR.spans(l,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=hB(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;u=hZ(p,e),c=hZ(p,n)}else{let n,i,o=p.total*this.heightOracle.charWidth,s=r*this.heightOracle.charWidth,a=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+a<this.pixelViewport.left&&(a=n.size-n.displaySize);let l=this.pixelViewport.left+a,h=this.pixelViewport.right+a;if(null!=m){let e=hB(p,m),t=((h-l)/2+s)/o;n=e-t,i=e+t}else n=(l-s)/o,i=(h+s)/o;u=hZ(p,n),c=hZ(p,i)}u>t.from&&a(t.from,u,t,p),c<t.to&&a(c,t.to,t,p)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(l):l(e);return s}gapSize(e,t,n,r){let i=hB(r,n)-hB(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){hN.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=u$.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=[];lR.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)||h_(this.heightMap.lineAt(e,hk.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)||h_(this.heightMap.lineAt(this.scaler.fromDOM(e),hk.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 h_(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 hF{constructor(e,t){this.from=e,this.to=t}}function hZ({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 hB(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 hV={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};class hz{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,hk.ByPos,e,0,0).top,s=t.lineAt(i,hk.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 hz&&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 h_(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new hC(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>h_(e,t)):e._content)}let hH=a1.define({combine:e=>e.join(" ")}),h$=a1.define({combine:e=>e.indexOf(!0)>-1}),hW=lU.newName(),hq=lU.newName(),hG=lU.newName(),hU={"&light":"."+hq,"&dark":"."+hG};function hK(e,t,n){return new lU(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 hY=hK("."+hW,{"&":{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"}},hU),hX={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},hQ=uR.ie&&uR.ie_version<=11;class hJ{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new ui,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);(uR.ie&&uR.ie_version<=11||uR.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&&!(uR.chrome&&uR.chrome_version<126)&&(this.editContext=new h2(e),e.state.facet(cS)&&(e.contentDOM.editContext=this.editContext.editContext)),hQ&&(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?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(cS)?n.root.activeElement!=this.dom:!l4(this.dom,r))return;let i=r.anchorNode&&n.docView.nearest(r.anchorNode);if(i&&i.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(uR.ie&&uR.ie_version<=11||uR.android&&uR.chrome)&&!n.state.selection.main.empty&&r.focusNode&&l6(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=l5(e.root);if(!t)return!1;let n=uR.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 h1(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?h1(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=l4(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,ut(n));;)if(r){if(1!=n.nodeType)return!1;let e=n.childNodes[r-1];"false"==e.contentEditable?r--:r=ut(n=e)}else{if(n==e)return!0;r=l9(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,hX),hQ&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),hQ&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;this.delayedAndroidKey||(this.flushingAndroidKey=this.view.win.requestAnimationFrame(()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&ul(this.dom,e.key,e.keyCode))})),this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?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&&l4(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 c0(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=c1(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=h0(t,e.previousSibling||e.target.previousSibling,-1),r=h0(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(cS)!=e.state.facet(cS)&&(e.view.contentDOM.editContext=e.state.facet(cS)?this.editContext.editContext:null))}destroy(){var e,t,n;for(let r of(this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||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 h0(e,t,n){for(;t;){let r=um.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 h1(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 l6(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}class h2{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 a={from:o,to:s,insert:aD.of(t.text.split("\n"))};if(a.from==this.from&&r<this.from?a.from=r:a.to==this.to&&r>this.to&&(a.to=r),a.from==a.to&&!a.insert.length){let r=aQ.single(this.toEditorPos(t.selectionStart),this.toEditorPos(t.selectionEnd));r.main.eq(n)||e.dispatch({selection:r,userEvent:"select"});return}if((uR.mac||uR.android)&&a.from==i-1&&/^\. ?$/.test(t.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(a={from:o,to:s,insert:aD.of([t.text.replace("."," ")])}),this.pendingContextChange=a,!e.state.readOnly){let n=this.to-this.from+(a.to-a.from+a.insert.length);c2(e,a,aQ.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(u$.mark({attributes:{style:e}}).range(i,o))}}}e.dispatch({effects:cx.of(u$.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=l5(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,a,l)=>{if(n)return;let u=l.length-(o-i);if(r&&o>=r.to){if(r.from==i&&r.to==o&&r.insert.eq(l)){r=this.pendingContextChange=null,t+=u,this.to+=u;return}r=null,this.revertPending(e.state)}if(i+=t,(o+=t)<=this.from)this.from+=u,this.to+=u;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+l.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),l.toString()),this.to+=u}t+=u}),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 h5{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 hL(e.state||lM.create(e)),e.scrollTo&&e.scrollTo.is(cb)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ck).map(e=>new cT(e)),this.plugins))t.update(this);this.observer=new hJ(this),this.inputState=new c5(this),this.inputState.ensureHandlers(this.plugins),this.docView=new cB(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=1==e.length&&e[0]instanceof ly?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,a=null;e.some(e=>e.annotation(hm))?(this.inputState.notifiedFocused=o,s=1):o==this.inputState.notifiedFocused||(this.inputState.notifiedFocused=o,(a=hg(i,o))||(s=1));let l=this.observer.delayedAndroidKey,u=null;if(l?(this.observer.clearDelayedAndroidKey(),((u=this.observer.readChange())&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(u=null)):this.observer.clear(),i.facet(lM.phrases)!=this.state.facet(lM.phrases))return this.setState(i);r=cZ.create(this,i,e),r.flags|=s;let c=this.viewState.scrollTarget;try{for(let t of(this.updateState=2,e)){if(c&&(c=c.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;c=new cy(e.empty?e:aQ.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(cb)&&(c=e.value.clip(this.state))}this.viewState.update(r,c),this.bidiCache=h8.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(cL)!=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(hH)!=r.state.facet(hH)&&(this.viewState.mustMeasureContent=!0),(t||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let e of this.state.facet(cc))try{e(r)}catch(e){cw(this.state,e,"update listener")}(a||u)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),u&&!c1(this,u)&&l.force&&ul(this.contentDOM,l.key,l.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 hL(e),this.plugins=e.facet(ck).map(e=>new cT(e)),this.pluginMap.clear(),this.plugins))t.update(this);this.docView.destroy(),this.docView=new cB(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(ck),n=e.state.facet(ck);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new cT(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){cw(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(uc(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 a=[];4&s||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map(e=>{try{return e.read(this)}catch(e){return cw(this.state,e),h4}}),u=cZ.create(this,this.state,[]),c=!1;u.flags|=s,t?t.flags|=s:t=u,this.updateState=2,!u.empty&&(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),(c=this.docView.update(u))&&this.docViewUpdate());for(let e=0;e<a.length;e++)if(l[e]!=h4)try{let t=a[e];t.write&&t.write(l[e],this)}catch(e){cw(this.state,e)}if(c&&this.docView.updateSelection(!0),!u.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}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(e>1||e<-1){r+=e,n.scrollTop=r/this.scaleY,o=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(cc))e(t)}get themeClasses(){return hW+" "+(this.state.facet(h$)?hG:hq)+" "+this.state.facet(hH)}updateAttrs(){let e=h6(this,cA,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(cS)?"true":"false",class:"cm-content",style:`${uR.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),h6(this,cD,t);let n=this.observer.ignore(()=>{let n=uz(this.contentDOM,this.contentAttrs,t),r=uz(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(h5.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(cL);let e=this.state.facet(h5.cspNonce);lU.mount(this.root,this.styleModules.concat(hY).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 cX(this,e,cK(this,e,t,n))}moveByGroup(e,t){return cX(this,e,cK(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==lC.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 aQ.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=cU(e,t.head),o=r&&i.type==uH.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==u2.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(null!=s)return aQ.cursor(s,n?-1:1)}return aQ.cursor(n?i.to:i.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return cX(this,e,function(e,t,n,r){let i=t.head,o=n?1:-1;if(i==(n?e.state.doc.length:0))return aQ.cursor(i,t.assoc);let s=t.goalColumn,a,l=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(i,t.assoc||-1),c=e.documentTop;if(u)null==s&&(s=u.left-l.left),a=o<0?u.top:u.bottom;else{let t=e.viewState.lineBlockAt(i);null==s&&(s=Math.min(l.right-l.left,e.defaultCharacterWidth*(i-t.from))),a=(o<0?t.top:t.bottom)+c}let h=l.left+s,d=null!=r?r:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=a+(d+t)*o,r=cq(e,{x:h,y:n},!1,o);if(n<l.top||n>l.bottom||(o<0?r<i:r>i)){let t=e.docView.coordsForChar(r),i=!t||n<t.top?-1:1;return aQ.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(),cq(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 un(n,i[cn.find(i,e-r.from,-1,t)].dir==u2.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(cm)||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>h3)return ci(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=cI(this,e))))return r.order;n||(n=cI(this,e));let r=function(e,t,n){if(!e)return[new cn(0,0,+(t==u3))];if(t==u5&&!n.length&&!ct.test(e))return ci(e.length);if(n.length)for(;e.length>cr.length;)cr[cr.length]=256;let r=[],i=+(t!=u5);return function e(t,n,r,i,o,s,a){let l=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,a=o<r.length?r[o].from:n,l=o?256:i;for(let t=s,n=l,r=l;t<a;t++){let i=ce(e.charCodeAt(t));512==i?i=n:8==i&&4==r&&(i=16),cr[t]=4==i?2:i,7&i&&(r=i),n=i}for(let e=s,t=l,r=l;e<a;e++){let i=cr[e];if(128==i)e<a-1&&t==cr[e+1]&&24&t?i=cr[e]=t:cr[e]=256;else if(64==i){let i=e+1;for(;i<a&&64==cr[i];)i++;let o=e&&8==t||i<n&&8==cr[i]?1==r?1:8:256;for(let t=e;t<i;t++)cr[t]=o;e=i-1}else 8==i&&1==r&&(cr[e]=1);t=i,7&i&&(r=i)}}}(t,o,s,i,l),function(e,t,n,r,i){let o=1==i?2:1;for(let s=0,a=0,l=0;s<=r.length;s++){let u=s?r[s-1].to:t,c=s<r.length?r[s].from:n;for(let t=u,n,r,s;t<c;t++)if(r=u9[n=e.charCodeAt(t)]){if(r<0){for(let e=a-3;e>=0;e-=3)if(u7[e+1]==-r){let n=u7[e+2],r=2&n?i:4&n?1&n?o:i:0;r&&(cr[t]=cr[u7[e]]=r),a=e;break}}else if(189==u7.length)break;else u7[a++]=t,u7[a++]=n,u7[a++]=l}else if(2==(s=cr[t])||1==s){let e=s==i;l=+!e;for(let t=a-3;t>=0;t-=3){let n=u7[t+2];if(2&n)break;if(e)u7[t+2]|=2;else{if(4&n)break;u7[t+2]|=4}}}}}(t,o,s,i,l),function(e,t,n,r){for(let i=0,o=r;i<=n.length;i++){let s=i?n[i-1].to:e,a=i<n.length?n[i].from:t;for(let l=s;l<a;){let s=cr[l];if(256==s){let s=l+1;for(;;)if(s==a){if(i==n.length)break;s=n[i++].to,a=i<n.length?n[i].from:t}else if(256==cr[s])s++;else break;let u=1==o,c=u==((s<t?cr[s]:r)==1)?u?1:2:r;for(let t=s,r=i,o=r?n[r-1].to:e;t>l;)t==o&&(t=n[--r].from,o=r?n[r-1].to:e),cr[--t]=c;l=s}else o=s,l++}}}(o,s,i,l),function t(n,r,i,o,s,a,l){let u=o%2?2:1;if(o%2==s%2)for(let c=r,h=0;c<i;){let r=!0,d=!1;if(h==a.length||c<a[h].from){let e=cr[c];e!=u&&(r=!1,d=16==e)}let f=r||1!=u?null:[],p=r?o:o+1,m=c;t:for(;;)if(h<a.length&&m==a[h].from){if(d)break;let t=a[h];if(!r)for(let e=t.to,n=h+1;;){if(e==i)break t;if(n<a.length&&a[n].from==e)e=a[n++].to;else if(cr[e]==u)break t;else break}h++,f?f.push(t):(t.from>c&&l.push(new cn(c,t.from,p)),e(n,t.direction==u5!=!(p%2)?o+1:o,s,t.inner,t.from,t.to,l),c=t.to),m=t.to}else if(m==i||(r?cr[m]!=u:cr[m]==u))break;else m++;f?t(n,c,m,o+1,s,f,l):c<m&&l.push(new cn(c,m,p)),c=m}else for(let c=i,h=a.length;c>r;){let i=!0,d=!1;if(!h||c>a[h-1].to){let e=cr[c-1];e!=u&&(i=!1,d=16==e)}let f=i||1!=u?null:[],p=i?o:o+1,m=c;t:for(;;)if(h&&m==a[h-1].to){if(d)break;let t=a[--h];if(!i)for(let e=t.from,n=h;;){if(e==r)break t;if(n&&a[n-1].to==e)e=a[--n].from;else if(cr[e-1]==u)break t;else break}f?f.push(t):(t.to<c&&l.push(new cn(t.to,c,p)),e(n,t.direction==u5!=!(p%2)?o+1:o,s,t.inner,t.from,t.to,l),c=t.from),m=t.from}else if(m==r||(i?cr[m-1]!=u:cr[m-1]==u))break;else m--;f?t(n,m,c,o+1,s,f,l):m<c&&l.push(new cn(m,c,p)),c=m}}(t,o,s,n,r,i,a)}(e,i,i,n,0,e.length,r),r}(e.text,t,n);return this.bidiCache.push(new h8(e.from,e.to,t,n,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||uR.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{us(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 cb.of(new cy("number"==typeof e?aQ.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 cb.of(new cy(aQ.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 cM.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return cM.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=lU.newName(),r=[hH.of(n),cL.of(hK(`.${n}`,e))];return t&&t.dark&&r.push(h$.of(!0)),r}static baseTheme(e){return le.lowest(cL.of(hK("."+hW,e,hU)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&um.get(n)||um.get(e);return(null===(t=null==r?void 0:r.rootView)||void 0===t?void 0:t.view)||null}}h5.styleModule=cL,h5.inputHandler=ch,h5.clipboardInputFilter=cf,h5.clipboardOutputFilter=cp,h5.scrollHandler=cv,h5.focusChangeEffect=cd,h5.perLineTextDirection=cm,h5.exceptionSink=cu,h5.updateListener=cc,h5.editable=cS,h5.mouseSelectionStyle=cl,h5.dragMovesSelection=ca,h5.clickAddsSelectionRange=cs,h5.decorations=cE,h5.outerDecorations=cO,h5.atomicRanges=cR,h5.bidiIsolatedRanges=cP,h5.scrollMargins=cN,h5.darkTheme=h$,h5.cspNonce=a1.define({combine:e=>e.length?e[0]:""}),h5.contentAttributes=cD,h5.editorAttributes=cA,h5.lineWrapping=h5.contentAttributes.of({class:"cm-lineWrapping"}),h5.announce=lv.define();let h3=4096,h4={};class h8{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:u2.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 h8(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function h6(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&&uZ(o,n)}return n}let h9=uR.mac?"mac":uR.windows?"win":uR.linux?"linux":"key";function h7(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 de=le.default(h5.domEventHandlers({keydown:(e,t)=>da(dr(t.state),e,t,"editor")})),dt=a1.define({enables:de}),dn=new WeakMap;function dr(e){let t=e.facet(dt),n=dn.get(t);return n||dn.set(t,n=function(e,t=h9){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,a)=>{var l,u;let c=n[e]||(n[e]=Object.create(null)),h=r.split(/ (?!$)/).map(e=>(function(e,t){let n,r,i,o;let s=e.split(/-(?!$)/),a=s[s.length-1];"Space"==a&&(a=" ");for(let e=0;e<s.length-1;++e){let a=s[e];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))n=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))"mac"==t?o=!0:r=!0;else throw Error("Unrecognized modifier name: "+a)}return n&&(a="Alt-"+a),r&&(a="Ctrl-"+a),o&&(a="Meta-"+a),i&&(a="Shift-"+a),a})(e,t));for(let t=1;t<h.length;t++){let n=h.slice(0,t).join(" ");i(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=di={view:t,prefix:n,scope:e};return setTimeout(()=>{di==r&&(di=null)},4e3),!0}]})}let d=h.join(" ");i(d,!1);let f=c[d]||(c[d]={preventDefault:!1,stopPropagation:!1,run:(null===(u=null===(l=c._any)||void 0===l?void 0:l.run)||void 0===u?void 0:u.slice())||[]});o&&f.run.push(o),s&&(f.preventDefault=!0),a&&(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,ds))}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 di=null,ds=null;function da(e,t,n,r){var i;ds=t;let o=("Esc"==(i=!(lJ&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||l0&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?lQ:lX)[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=aV(aZ(o,0))==o.length&&" "!=o,a="",l=!1,u=!1,c=!1;di&&di.view==n&&di.scope==r&&(a=di.prefix+" ",0>c6.indexOf(t.keyCode)&&(u=!0,di=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&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),u=!0)}return!1},f=e[r],p,m;return f&&(d(f[a+h7(o,t,!s)])?l=!0:s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(uR.windows&&t.ctrlKey&&t.altKey)&&(p=lX[t.keyCode])&&p!=o?d(f[a+h7(p,t,!0)])?l=!0:t.shiftKey&&(m=lQ[t.keyCode])!=o&&m!=p&&d(f[a+h7(m,t,!1)])&&(l=!0):s&&t.shiftKey&&d(f[a+h7(o,t,!0)])&&(l=!0),!l&&d(f._any)&&(l=!0)),u&&(l=!0),l&&c&&t.stopPropagation(),ds=null,l}class dl{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==u2.LTR,s=e.contentDOM,a=s.getBoundingClientRect(),l=du(e),u=s.querySelector(".cm-line"),c=u&&window.getComputedStyle(u),h=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=cU(e,r),p=cU(e,i),m=f.type==uH.Text?f:null,g=p.type==uH.Text?p:null;if(m&&(e.lineWrapping||f.widgetLineBreaks)&&(m=dc(e,r,1,m)),g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=dc(e,i,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return y(b(n.from,n.to,m));{let t=m?b(n.from,null,m):x(f,!1),r=g?b(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==uH.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),y(t).concat(i).concat(y(r))}function v(e,n,r,i){return new dl(t,e-l.left,n-l.top,r-e,i-n)}function y({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 b(t,n,r){let i=1e9,s=-1e9,a=[];function l(t,n,l,u,c){let f=e.coordsAtPos(t,t==r.to?-2:2),p=e.coordsAtPos(l,l==r.from?2:-2);f&&p&&(i=Math.min(f.top,p.top,i),s=Math.max(f.bottom,p.bottom,s),c==u2.LTR?a.push(o&&n?h:f.left,o&&u?d:p.right):a.push(!o&&u?h:p.left,!o&&n?d:f.right))}let u=null!=t?t:r.from,c=null!=n?n:r.to;for(let r of e.visibleRanges)if(r.to>u&&r.from<c)for(let i=Math.max(r.from,u),o=Math.min(r.to,c);;){let r=e.state.doc.lineAt(i);for(let s of e.bidiSpans(r)){let e=s.from+r.from,a=s.to+r.from;if(e>=o)break;a>i&&l(Math.max(e,i),null==t&&e<=u,Math.min(a,o),null==n&&a>=c,s.dir)}if((i=r.to+1)>=o)break}return 0==a.length&&l(u,null==t,c,null==n,e.textDirection),{top:i,bottom:s,horizontal:a}}function x(e,t){let n=a.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=du(e);return[new dl(t,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}}}function du(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==u2.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function dc(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,a=e.posAtCoords({x:o.left+1,y:s}),l=e.posAtCoords({x:o.right-1,y:s});return null==a||null==l?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}class dh{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(dd)!=e.state.facet(dd)&&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(dd);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 dd=a1.define();function df(e){return[cM.define(t=>new dh(t,e)),dd.of(e)]}let dp=!(uR.ios&&uR.webkit&&uR.webkit_version<534),dm=a1.define({combine:e=>lT(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function dg(e){return e.startState.facet(dm)!=e.state.facet(dm)}let dv=df({above:!0,markers(e){let{state:t}=e,n=t.facet(dm),r=[];for(let i of t.selection.ranges){let o=i==t.selection.main;if(i.empty?!o||dp:n.drawRangeCursor){let t=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=i.empty?i:aQ.cursor(i.head,i.head>i.anchor?-1:1);for(let i of dl.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=dg(e);return n&&dy(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){dy(t.state,e)},class:"cm-cursorLayer"});function dy(e,t){t.style.animationDuration=e.facet(dm).cursorBlinkRate+"ms"}let db=df({above:!1,markers:e=>e.state.selection.ranges.map(t=>t.empty?[]:dl.forRange(e,"cm-selectionBackground",t)).reduce((e,t)=>e.concat(t)),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||dg(e),class:"cm-selectionLayer"}),dx={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};dp&&(dx[".cm-line"].caretColor=dx[".cm-content"].caretColor="transparent !important");let dw=le.highest(h5.theme(dx)),dS=lv.define({map:(e,t)=>null==e?null:t.mapPos(e)}),dC=a6.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(dS)?t.value:e,e))}),dk=cM.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(dC);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(dC)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(dC),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(dC)!=e&&this.view.dispatch({effects:dS.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 dM(e,t,n,r,i){t.lastIndex=0;for(let o=e.iterRange(n,r),s=n,a;!o.next().done;s+=o.value.length)if(!o.lineBreak)for(;a=t.exec(o.value);)i(s+a.index,a)}class dT{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 lP,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))dM(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,a=Math.max(i.from,n.from),l=Math.min(i.to,r.to);if(this.boundary){for(;o>n.from;o--)if(this.boundary.test(n.text[o-1-n.from])){a=o;break}for(;s<r.to;s++)if(this.boundary.test(r.text[s-r.from])){l=s;break}}let u=[],c,h=(e,t,n)=>u.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=a-n.from;(c=this.regexp.exec(n.text))&&c.index<l-n.from;)this.addMatch(c,e,c.index+n.from,h);else dM(e.state.doc,this.regexp,a,l,(t,n)=>this.addMatch(n,e,t,h));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>e<a||t>l,add:u})}}return t}}let dA=null!=/x/.unicode?"gu":"g",dD=RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]",dA),dE={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"},dO=null,dR=a1.define({combine(e){let t=lT(e,{render:null,specialChars:dD,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==dO&&"undefined"!=typeof document&&document.body){let t=document.body.style;dO=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)!=null}return dO||!1}())&&(t.specialChars=RegExp(" |"+t.specialChars.source,dA)),t.addSpecialChars&&(t.specialChars=RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,dA)),t}}),dP=null;class dI extends u_{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")+" "+(dE[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 dN extends u_{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 dj=u$.line({class:"cm-activeLine"}),dL=cM.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(dj.range(i.from)),t=i.from)}return u$.set(n)}},{decorations:e=>e.decorations});class dF extends u_{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?l8(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=un(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 dZ(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,a=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):lH(o.text,e.state.tabSize,i-o.from);return{line:o.number,col:a,off:s}}let dB={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},dV={style:"cursor: crosshair"},dz="-10000px";class d_{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],a=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(a=e)}if(a<0)o[n]=this.createTooltipView(r,n?o[n-1]:null),s&&(s[n]=!!r.above);else{let r=o[n]=this.tooltipViews[a];s&&(s[n]=t[a]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)0>o.indexOf(e)&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||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 dH(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}let d$=a1.define({combine:e=>{var t,n,r;return{position:uR.ios?"absolute":(null===(t=e.find(e=>e.position))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find(e=>e.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(r=e.find(e=>e.tooltipSpace))||void 0===r?void 0:r.tooltipSpace)||dH}}}),dW=new WeakMap,dq=cM.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(d$);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 d_(e,dY,(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(d$);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=dz,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)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||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(uR.gecko)n=e.offsetParent!=this.container.ownerDocument.body;else if(e.style.top==dz&&"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=cj(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(d$).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 a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],u=this.manager.tooltipViews[a],{dom:c}=u,h=e.pos[a],d=e.size[a];if(!h||!1!==l.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)){c.style.top=dz;continue}let f=l.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,p=7*!!f,m=d.right-d.left,g=null!==(t=dW.get(u))&&void 0!==t?t:d.bottom-d.top,v=u.offset||dK,y=this.view.textDirection==u2.LTR,b=d.width>r.right-r.left?y?r.left:r.right-d.width:y?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[a];!l.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[a]=!x);let w=(x?h.top-r.top:r.bottom-h.bottom)-p;if(w<g&&!1!==u.resize){if(w<this.view.defaultLineHeight){c.style.top=dz;continue}dW.set(u,g),c.style.height=(g=w)/o+"px"}else c.style.height&&(c.style.height="");let S=x?h.top-g-p-v.y:h.bottom+p+v.y,C=b+m;if(!0!==u.overlap)for(let e of s)e.left<C&&e.right>b&&e.top<S+g&&e.bottom>S&&(S=x?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(c.style.top=(S-e.parent.top)/o+"px",dG(c,(b-e.parent.left)/i)):(c.style.top=S/o+"px",dG(c,b/i)),f){let e=h.left+(y?v.x:-v.x)-(b+14-7);f.style.left=e/i+"px"}!0!==u.overlap&&s.push({left:b,top:S,right:C,bottom:S+g}),c.classList.toggle("cm-tooltip-above",x),c.classList.toggle("cm-tooltip-below",!x),u.positioned&&u.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=dz}},{eventObservers:{scroll(){this.maybeMeasure()}}});function dG(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}let dU=h5.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"}}}),dK={x:0,y:0},dY=a1.define({enables:[dq,dU]}),dX=a1.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class dQ{static create(e){return new dQ(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new d_(e,dX,(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)||void 0===e||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 dJ=dY.compute([dX],e=>{let t=e.facet(dX);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)&&void 0!==t?t:e.pos})),create:dQ.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class d0{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 uN)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==u2.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=>cw(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(dq),t=e?e.manager.tooltips.findIndex(e=>e.create==dQ.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?void 0:t.end)&&void 0!==n?n:i;(i==o?this.view.posAtCoords(this.lastMove)!=i:!function(e,t,n,r,i,o){let s=e.scrollDOM.getBoundingClientRect(),a=e.documentTop+e.documentPadding.top+e.contentHeight;if(s.left>r||s.right<r||s.top>i||Math.min(s.bottom,a)<i)return!1;let l=e.posAtCoords({x:r,y:i},!1);return l>=t&&l<=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 d1(e,t){let n=e.plugin(dq);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}let d2=lv.define(),d5=a1.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 d3(e,t){let n=e.plugin(d4),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}let d4=cM.fromClass(class{constructor(e){this.input=e.state.facet(d9),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(d5);for(let n of(this.top=new d8(e,!0,t.topContainer),this.bottom=new d8(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(d5);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new d8(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new d8(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(d9);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),a;t<0?(a=n(e.view),s.push(a)):(a=this.panels[t]).update&&a.update(e),r.push(a),(a.top?i:o).push(a)}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=>h5.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class d8{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=d6(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=d6(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 d6(e){let t=e.nextSibling;return e.remove(),t}let d9=a1.define({enables:d4});class d7 extends lA{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}d7.prototype.elementClass="",d7.prototype.toDOM=void 0,d7.prototype.mapMode=a_.TrackBefore,d7.prototype.startSide=d7.prototype.endSide=-1,d7.prototype.point=!0;let fe=a1.define(),ft=a1.define(),fn={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>lR.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},fr=a1.define();function fi(e){return[fs(),fr.of(Object.assign(Object.assign({},fn),e))]}let fo=a1.define({combine:e=>e.some(e=>e)});function fs(e){let t=[fa];return e&&!1===e.fixed&&t.push(fo.of(!0)),t}let fa=cM.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(fr).map(t=>new fh(e,t)),this.gutters))this.dom.appendChild(t.dom);this.fixed=!e.state.facet(fo),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(fo)!=!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=lR.iter(this.view.state.facet(fe),this.view.viewport.from),r=[],i=this.gutters.map(e=>new fc(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==uH.Text&&t){for(let e of(fu(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==uH.Text)for(let t of(fu(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(fr),n=e.state.facet(fr),r=e.docChanged||e.heightChanged||e.viewportChanged||!lR.eq(e.startState.facet(fe),e.state.facet(fe),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 fh(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=>h5.scrollMargins.of(t=>{let n=t.plugin(e);return n&&0!=n.gutters.length&&n.fixed?t.textDirection==u2.LTR?{left:n.dom.offsetWidth*t.scaleX}:{right:n.dom.offsetWidth*t.scaleX}:null})});function fl(e){return Array.isArray(e)?e:[e]}function fu(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class fc{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=lR.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 fd(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=[];fu(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(ft)){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 fh{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=fl(t.markers(e)),t.initialSpacer&&(this.spacer=new fd(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=fl(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!lR.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 fd{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,a=i<t.length?t[i++]:null,l=!1;if(a){let e=a.elementClass;e&&(n+=" "+e);for(let e=o;e<this.markers.length;e++)if(this.markers[e].compare(a)){s=e,l=!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(!a)break;a.toDOM&&(l?r=r.nextSibling:this.dom.insertBefore(a.toDOM(e),r)),l&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}let ff=a1.define(),fp=a1.define(),fm=a1.define({combine:e=>lT(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 fg extends d7{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function fv(e,t){return e.state.facet(fm).formatNumber(t,e.state)}let fy=fr.compute([fm],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(ff),lineMarker:(e,t,n)=>n.some(e=>e.toDOM)?null:new fg(fv(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let r of e.state.facet(fp)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(fm)!=e.state.facet(fm),initialSpacer:e=>new fg(fv(e,fb(e.state.doc.lines))),updateSpacer(e,t){let n=fv(t.view,fb(t.view.state.doc.lines));return n==e.number?e:new fg(n)},domEventHandlers:e.facet(fm).domEventHandlers}));function fb(e){let t=9;for(;t<e;)t=10*t+9;return t}let fx=new class extends d7{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},fw=fe.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(fx.range(i)))}return lR.of(t)}),fS=0;class fC{constructor(e,t){this.from=e,this.to=t}}class fk{constructor(e={}){this.id=fS++,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=fA.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}fk.closedBy=new fk({deserialize:e=>e.split(" ")}),fk.openedBy=new fk({deserialize:e=>e.split(" ")}),fk.group=new fk({deserialize:e=>e.split(" ")}),fk.isolate=new fk({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw RangeError("Invalid value for isolate: "+e);return e||"auto"}}),fk.contextHash=new fk({perNode:!0}),fk.lookAhead=new fk({perNode:!0}),fk.mounted=new fk({perNode:!0});class fM{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[fk.mounted.id]}}let fT=Object.create(null);class fA{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):fT,n=+!!e.top|2*!!e.skipped|4*!!e.error|8*(null==e.name),r=new fA(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(fk.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(fk.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}}fA.none=new fA("",Object.create(null),0,8);class fD{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 fA(n.name,r,n.id,n.flags):n)}return new fD(t)}}let fE=new WeakMap,fO=new WeakMap;(SZ=SB||(SB={}))[SZ.ExcludeBuffers=1]="ExcludeBuffers",SZ[SZ.IncludeAnonymous=2]="IncludeAnonymous",SZ[SZ.IgnoreMounts=4]="IgnoreMounts",SZ[SZ.IgnoreOverlays=8]="IgnoreOverlays";class fR{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=fM.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 f$(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new f$(fE.get(this)||this.topNode);return r.moveTo(e,t),fE.set(this,r._tree),r}get topNode(){return new fF(this,0,0,null)}resolve(e,t=0){let n=fj(fE.get(this)||this.topNode,e,t,!1);return fE.set(this,n),n}resolveInner(e,t=0){let n=fj(fO.get(this)||this.topNode,e,t,!0);return fO.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 fF?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=fM.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let s=new fF(o.tree,o.overlay[0].from+e.from,-1,e);(i||(i=[r])).push(fj(s,t,n,!1))}}return i?f_(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&SB.IncludeAnonymous)>0;for(let e=this.cursor(o|SB.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:fU(fA.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new fR(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new fR(fA.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,a=Array.isArray(n)?new fP(n,n.length):n,l=r.types,u=0,c=0;function h(e,t,n,i,o,s,a,l,u){let c=[],h=[];for(;e.length>i;)c.push(e.pop()),h.push(t.pop()+n-o);e.push(d(r.types[a],c,h,s-o,l-s,u)),t.push(o-n)}function d(e,t,n,r,i,o,s){if(o){let e=[fk.contextHash,o];s=s?[e].concat(s):[e]}if(i>25){let e=[fk.lookAhead,i];s=s?[e].concat(s):[e]}return new fR(e,t,n,r,s)}let f=[],p=[];for(;a.pos>0;)!function e(t,n,f,p,m,g){let{id:v,start:y,end:b,size:x}=a,w=c,S=u;for(;x<0;){if(a.next(),-1==x){let e=o[v];f.push(e),p.push(y-t);return}if(-3==x){u=v;return}if(-4==x){c=v;return}else throw RangeError(`Unrecognized record size: ${x}`)}let C=l[v],k,M,T=y-t;if(b-y<=i&&(M=function(e,t){let n=a.fork(),r=0,o=0,l=0,u=n.end-i,c={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){c.size=r,c.start=o,c.skip=l,l+=4,r+=4,n.next();continue}let a=n.pos-e;if(e<0||a<i||n.start<u)break;let h=4*(n.id>=s),d=n.start;for(n.next();n.pos>a;){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,l+=h}return(t<0||r==e)&&(c.size=r,c.start=o,c.skip=l),c.size>4?c:void 0}(a.pos-n,m))){let e=new Uint16Array(M.size-M.skip),n=a.pos-M.size,i=e.length;for(;a.pos>n;)i=function e(t,n,r){let{id:i,start:o,end:l,size:h}=a;if(a.next(),h>=0&&i<s){let s=r;if(h>4){let i=a.pos-(h-4);for(;a.pos>i;)r=e(t,n,r)}n[--r]=s,n[--r]=l-t,n[--r]=o-t,n[--r]=i}else -3==h?u=i:-4==h&&(c=i);return r}(M.start,e,i);k=new fI(e,b-M.start,r),T=M.start-t}else{let t=a.pos-x;a.next();let n=[],o=[],l=v>=s?v:-1,u=0,c=b;for(;a.pos>t;)l>=0&&a.id==l&&a.size>=0?(a.end<=c-i&&(h(n,o,y,u,a.end,c,l,w,S),u=n.length,c=a.end),a.next()):g>2500?function(e,t,n,o){let s=[],l=0,u=-1;for(;a.pos>t;){let{id:e,start:t,end:n,size:r}=a;if(r>4)a.next();else if(u>-1&&t<u)break;else u<0&&(u=n-i),s.push(e,t,n),l++,a.next()}if(l){let t=new Uint16Array(4*l),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 fI(t,s[2]-i,r)),o.push(i-e)}}(y,t,n,o):e(y,t,n,o,l,g+1);if(l>=0&&u>0&&u<n.length&&h(n,o,y,u,y,c,l,w,S),n.reverse(),o.reverse(),l>-1&&u>0){let e=function(e,t){return(n,r,i)=>{let o=0,s=n.length-1,a,l;if(s>=0&&(a=n[s])instanceof fR){if(!s&&a.type==e&&a.length==i)return a;(l=a.prop(fk.lookAhead))&&(o=r[s]+a.length+l)}return d(e,n,r,i,o,t)}}(C,S);k=fU(C,n,o,0,n.length,0,b-y,e,e)}else k=d(C,n,o,b-y,w-b,S)}f.push(k),p.push(T)}(e.start||0,e.bufferStart||0,f,p,-1,0);let m=null!==(t=e.length)&&void 0!==t?t:f.length?p[0]+f[0].length:0;return new fR(l[e.topID],f.reverse(),p.reverse(),m)}(e)}}fR.empty=new fR(fA.none,[],[],0);class fP{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 fP(this.buffer,this.index)}}class fI{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return fA.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 a=e;a!=t&&(!fN(i,r,o[a+1],o[a+2])||(s=a,!(n>0)));a=o[a+3]);return s}slice(e,t,n){let r=this.buffer,i=new Uint16Array(t-e),o=0;for(let s=e,a=0;s<t;){i[a++]=r[s++],i[a++]=r[s++]-n;let t=i[a++]=r[s++]-n;i[a++]=r[s++]-e,o=Math.max(o,t)}return new fI(i,o,this.set)}}function fN(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 fj(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 fF&&e.index<0?null:e.parent;if(!t)return e;e=t}let o=r?0:SB.IgnoreOverlays;if(r)for(let r=e,s=r.parent;s;s=(r=s).parent)r instanceof fF&&r.index<0&&(null===(i=s.enter(t,n,o))||void 0===i?void 0:i.from)!=r.from&&(e=s);for(;;){let r=e.enter(t,n,o);if(!r)return e;e=r}}class fL{cursor(e=0){return new f$(this,e)}getChild(e,t=null,n=null){let r=fZ(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return fZ(this,e,t,n)}resolve(e,t=0){return fj(this,e,t,!1)}resolveInner(e,t=0){return fj(this,e,t,!0)}matchContext(e){return fB(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 fF extends fL{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:a}=o._tree,l=t>0?s.length:-1;e!=l;e+=t){let l=s[e],u=a[e]+o.from;if(fN(r,n,u,u+l.length)){if(l instanceof fI){if(i&SB.ExcludeBuffers)continue;let s=l.findChild(0,l.buffer.length,t,n-u,r);if(s>-1)return new fz(new fV(o,l,e,u),null,s)}else if(i&SB.IncludeAnonymous||!l.type.isAnonymous||fW(l)){let s;if(!(i&SB.IgnoreMounts)&&(s=fM.get(l))&&!s.overlay)return new fF(s.tree,u,e,o);let a=new fF(l,u,e,o);return i&SB.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,n,r)}}}if(i&SB.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&SB.IgnoreOverlays)&&(r=fM.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 fF(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 fZ(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 fB(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 fV{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class fz extends fL{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 fz(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&SB.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 fz(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 fz(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 fz(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 fR(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function f_(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 fF&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new fH(i,n)}class fH{constructor(e,t){this.heads=e,this.node=t}get next(){return f_(this.heads)}}class f${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 fF)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 fF?(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&SB.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&SB.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&SB.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&SB.IncludeAnonymous||e instanceof fI||!e.type.isAnonymous||fW(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 fz(this.buffer,t,this.stack[e]);return this.bufferNode=new fz(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 fB(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 fB(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 fW(e){return e.children.some(e=>e instanceof fI||!e.type.isAnonymous||fW(e))}let fq=new WeakMap;function fG(e,t){if(!e.isAnonymous||t instanceof fI||t.type!=e)return 1;let n=fq.get(t);if(null==n){for(let r of(n=1,t.children)){if(r.type!=e||!(r instanceof fR)){n=1;break}n+=fG(e,r)}fq.set(t,n)}return n}function fU(e,t,n,r,i,o,s,a,l){let u=0;for(let n=r;n<i;n++)u+=fG(e,t[n]);let c=Math.ceil(1.5*u/8),h=[],d=[];return!function t(n,r,i,s,a){for(let u=i;u<s;){let i=u,f=r[u],p=fG(e,n[u]);for(u++;u<s;u++){let t=fG(e,n[u]);if(p+t>=c)break;p+=t}if(u==i+1){if(p>c){let e=n[i];t(e.children,e.positions,0,e.children.length,r[i]+a);continue}h.push(n[i])}else{let t=r[u-1]+n[u-1].length-f;h.push(fU(e,n,r,i,u,f,t,null,l))}d.push(f+a-o)}}(t,n,r,i,0),(a||l)(h,d,s)}class fK{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 fK(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,a=0,l=0;;s++){let u=s<t.length?t[s]:null,c=u?u.fromA:1e9;if(c-a>=n)for(;o&&o.from<c;){let t=o;if(a>=t.from||c<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,c)-l;t=e>=n?null:new fK(e,n,t.tree,t.offset+l,s>0,!!u)}if(t&&r.push(t),o.to>c)break;o=i<e.length?e[i++]:null}if(!u)break;a=u.toA,l=u.toA-u.toB}return r}}class fY{startParse(e,t,n){return"string"==typeof e&&(e=new fX(e)),n=n?n.length?n.map(e=>new fC(e.from,e.to)):[new fC(0,0)]:[new fC(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 fX{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 fk({perNode:!0});let fQ=0;class fJ{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=fQ++}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 fJ&&(t=e),null==t?void 0:t.base)throw Error("Can not derive from a modified tag");let n=new fJ("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 f1(e);return e=>e.modified.indexOf(t)>-1?e:f1.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let f0=0;class f1{constructor(e){this.name=e,this.instances=[],this.id=f0++}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 fJ(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(f1.get(t,e));return i}}function f2(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,a=n[s];if(!a)throw RangeError("Invalid path: "+e);let l=new f3(r,i,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return f5.add(t)}let f5=new fk;class f3{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 f4(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}}f3.empty=new f3([],2,null);class f8{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:a}=e;if(s>=n||a<=t)return;o.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(o)));let l=r,u=function(e){let t=e.type.prop(f5);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||f3.empty,c=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,u.tags);if(c&&(l&&(l+=" "),l+=c,1==u.mode&&(r+=(r?" ":"")+c)),this.startSpan(Math.max(t,s),l),u.opaque)return;let h=e.tree&&e.tree.prop(fk.mounted);if(h&&h.overlay){let o=e.node.enter(h.overlay[0].from+s,1),u=this.highlighters.filter(e=>!e.scope||e.scope(h.tree.type)),c=e.firstChild();for(let d=0,f=s;;d++){let p=d<h.overlay.length?h.overlay[d]:null,m=p?p.from+s:a,g=Math.max(t,f),v=Math.min(n,m);if(g<v&&c)for(;e.from<v&&(this.highlightRange(e,g,v,r,i),this.startSpan(Math.min(v,e.to),l),!(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),"",u),this.startSpan(Math.min(n,f),l))}c&&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),l)}while(e.nextSibling());e.parent()}}}let f6=fJ.define,f9=f6(),f7=f6(),pe=f6(f7),pt=f6(f7),pn=f6(),pr=f6(pn),pi=f6(pn),po=f6(),ps=f6(po),pa=f6(),pl=f6(),pu=f6(),pc=f6(pu),ph=f6(),pd={comment:f9,lineComment:f6(f9),blockComment:f6(f9),docComment:f6(f9),name:f7,variableName:f6(f7),typeName:pe,tagName:f6(pe),propertyName:pt,attributeName:f6(pt),className:f6(f7),labelName:f6(f7),namespace:f6(f7),macroName:f6(f7),literal:pn,string:pr,docString:f6(pr),character:f6(pr),attributeValue:f6(pr),number:pi,integer:f6(pi),float:f6(pi),bool:f6(pn),regexp:f6(pn),escape:f6(pn),color:f6(pn),url:f6(pn),keyword:pa,self:f6(pa),null:f6(pa),atom:f6(pa),unit:f6(pa),modifier:f6(pa),operatorKeyword:f6(pa),controlKeyword:f6(pa),definitionKeyword:f6(pa),moduleKeyword:f6(pa),operator:pl,derefOperator:f6(pl),arithmeticOperator:f6(pl),logicOperator:f6(pl),bitwiseOperator:f6(pl),compareOperator:f6(pl),updateOperator:f6(pl),definitionOperator:f6(pl),typeOperator:f6(pl),controlOperator:f6(pl),punctuation:pu,separator:f6(pu),bracket:pc,angleBracket:f6(pc),squareBracket:f6(pc),paren:f6(pc),brace:f6(pc),content:po,heading:ps,heading1:f6(ps),heading2:f6(ps),heading3:f6(ps),heading4:f6(ps),heading5:f6(ps),heading6:f6(ps),contentSeparator:f6(po),list:f6(po),quote:f6(po),emphasis:f6(po),strong:f6(po),link:f6(po),monospace:f6(po),strikethrough:f6(po),inserted:f6(),deleted:f6(),changed:f6(),invalid:f6(),meta:ph,documentMeta:f6(ph),annotation:f6(ph),processingInstruction:f6(ph),definition:fJ.defineModifier("definition"),constant:fJ.defineModifier("constant"),function:fJ.defineModifier("function"),standard:fJ.defineModifier("standard"),local:fJ.defineModifier("local"),special:fJ.defineModifier("special")};for(let e in pd){let t=pd[e];t instanceof fJ&&(t.name=e)}f4([{tag:pd.link,class:"tok-link"},{tag:pd.heading,class:"tok-heading"},{tag:pd.emphasis,class:"tok-emphasis"},{tag:pd.strong,class:"tok-strong"},{tag:pd.keyword,class:"tok-keyword"},{tag:pd.atom,class:"tok-atom"},{tag:pd.bool,class:"tok-bool"},{tag:pd.url,class:"tok-url"},{tag:pd.labelName,class:"tok-labelName"},{tag:pd.inserted,class:"tok-inserted"},{tag:pd.deleted,class:"tok-deleted"},{tag:pd.literal,class:"tok-literal"},{tag:pd.string,class:"tok-string"},{tag:pd.number,class:"tok-number"},{tag:[pd.regexp,pd.escape,pd.special(pd.string)],class:"tok-string2"},{tag:pd.variableName,class:"tok-variableName"},{tag:pd.local(pd.variableName),class:"tok-variableName tok-local"},{tag:pd.definition(pd.variableName),class:"tok-variableName tok-definition"},{tag:pd.special(pd.variableName),class:"tok-variableName2"},{tag:pd.definition(pd.propertyName),class:"tok-propertyName tok-definition"},{tag:pd.typeName,class:"tok-typeName"},{tag:pd.namespace,class:"tok-namespace"},{tag:pd.className,class:"tok-className"},{tag:pd.macroName,class:"tok-macroName"},{tag:pd.propertyName,class:"tok-propertyName"},{tag:pd.operator,class:"tok-operator"},{tag:pd.comment,class:"tok-comment"},{tag:pd.meta,class:"tok-meta"},{tag:pd.invalid,class:"tok-invalid"},{tag:pd.punctuation,class:"tok-punctuation"}]);let pf=new fk,pp=new fk;class pm{constructor(e,t,n=[],r=""){this.data=e,this.name=r,lM.prototype.hasOwnProperty("tree")||Object.defineProperty(lM.prototype,"tree",{get(){return py(this)}}),this.parser=t,this.extension=[pA.of(this),lM.languageData.of((e,t,n)=>{let r=pg(e,t,n),i=r.type.prop(pf);if(!i)return[];let o=e.facet(i),s=r.type.prop(pp);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 pg(e,t,n).type.prop(pf)==this.data}findRegions(e){let t=e.facet(pA);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(pf)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(fk.mounted);if(i){if(i.tree.prop(pf)==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}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 fR&&r(i,e.positions[n]+t)}};return r(py(e),0),n}get allowsNesting(){return!0}}function pg(e,t,n){let r=e.facet(pA),i=py(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,SB.ExcludeBuffers))e.type.isTop&&(i=e);return i}pm.setState=lv.define();class pv extends pm{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){var t;let n=(t=e.languageData,a1.define({combine:t?e=>e.concat(t):void 0}));return new pv(n,e.parser.configure({props:[pf.add(e=>e.isTop?n:void 0)]}),e.name)}configure(e,t){return new pv(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function py(e){let t=e.field(pm.state,!1);return t?t.tree:fR.empty}class pb{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 px=null;class pw{constructor(e,t,n=[],r,i,o,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new pw(e,t,[],fR.empty,0,n,[],null)}startParse(){return this.parser.startParse(new pb(this.state.doc),this.fragments)}work(e,t){return(null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=fR.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(fK.addTree(r,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?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(fK.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=px;px=this;try{return e()}finally{px=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=pS(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=fK.applyChanges(n,t),r=fR.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 pw(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=pS(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 fY{createParse(t,n,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let t=px;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 fR(fA.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 px}}function pS(e,t,n){return fK.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class pC{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 pC(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=pw.create(e.facet(pA).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new pC(n)}}pm.state=a6.define({create:pC.init,update(e,t){for(let e of t.effects)if(e.is(pm.setState))return e.value;return t.startState.facet(pA)!=t.state.facet(pA)?pC.init(t.state):e.apply(t)}});let pk=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(pk=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});let pM="undefined"!=typeof navigator&&(null===(SV=navigator.scheduling)||void 0===SV?void 0:SV.isInputPending)?()=>navigator.scheduling.isInputPending():null,pT=cM.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(pm.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(pm.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=pk(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(pm.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!pM?Math.max(25,e.timeRemaining()-5):1e9),s=i.context.treeLen<r&&n.doc.length>r+1e3,a=i.context.work(()=>pM&&pM()||Date.now()>o,r+1e5*!s);this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:pm.setState.of(new pC(i.context))})),this.chunkBudget>0&&!(a&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>cw(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()}}}),pA=a1.define({combine:e=>e.length?e[0]:null,enables:e=>[pm.state,pT,h5.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class pD{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}let pE=a1.define(),pO=a1.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 pR(e){let t=e.facet(pO);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function pP(e,t){let n="",r=e.tabSize,i=e.facet(pO)[0];if(" "==i){for(;t>=r;)n+=" ",t-=r;i=" "}for(let e=0;e<t;e++)n+=i;return n}function pI(e,t){for(let n of(e instanceof lM&&(e=new pN(e)),e.state.facet(pE))){let r=n(e,t);if(void 0!==r)return r}let n=py(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 pL(r,e,n)}(e,n,t):null}class pN{constructor(e,t={}){this.state=e,this.options=t,this.unit=pR(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return null!=r&&r>=n.from&&r<=n.to?i&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}: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 lH(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 pj=new fk;function pL(e,t,n){for(let r=e;r;r=r.next){let e=function(e){let t=e.type.prop(pj);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(fk.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,a=r&&o.slice(s,s+r.length)==r||i==e.pos+s,l=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 l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?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?pF:null}(r.node);if(e)return e(pZ.create(t,n,r))}return 0}function pF(){return 0}class pZ extends pN{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 pZ(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 pL(this.context.next,this.base,this.pos)}}function pB({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}let pV=a1.define(),pz=new fk;function p_(e,t,n){for(let r of e.facet(pV)){let i=r(e,t,n);if(i)return i}return function(e,t,n){let r=py(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 a=i.type.prop(pz);if(a&&(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=a(i,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(o=r)}}return o}(e,t,n)}function pH(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 p$=lv.define({map:pH}),pW=lv.define({map:pH});function pq(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 pG=a6.define({create:()=>u$.none,update(e,t){for(let n of(e=e.map(t.changes),t.effects))if(n.is(p$)&&!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(pJ),i=r?u$.replace({widget:new p5(r(t.state,n.value))}):p2;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(pW)&&(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=>h5.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(p2.range(r,i))}return u$.set(t,!0)}});function pU(e,t,n){var r;let i=null;return null===(r=e.field(pG,!1))||void 0===r||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function pK(e,t){return e.field(pG,!1)?t:t.concat(lv.appendConfig.of(p0()))}function pY(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return h5.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}let pX=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of pq(e)){let n=p_(e.state,t.from,t.to);if(n)return e.dispatch({effects:pK(e.state,[p$.of(n),pY(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(pG,!1))return!1;let t=[];for(let n of pq(e)){let r=pU(e.state,n.from,n.to);r&&t.push(pW.of(r),pY(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=p_(t,i.from,i.to);o&&n.push(p$.of(o)),r=(o?e.lineBlockAt(o.to):i).to+1}return n.length&&e.dispatch({effects:pK(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(pG,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(pW.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],pQ={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},pJ=a1.define({combine:e=>lT(e,pQ)});function p0(e){let t=[pG,p8];return e&&t.push(pJ.of(e)),t}function p1(e,t){let{state:n}=e,r=n.facet(pJ),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=pU(e.state,n.from,n.to);r&&e.dispatch({effects:pW.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 p2=u$.replace({widget:new class extends u_{toDOM(e){return p1(e,null)}}});class p5 extends u_{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return p1(e,this.value)}}let p3={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class p4 extends d7{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 p8=h5.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 p6{constructor(e,t){let n;function r(e){let t=lU.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 pm?e=>e.prop(pf)==o.data:o?e=>e==o:void 0,this.style=f4(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new lU(n):null,this.themeType=t.themeType}static define(e,t){return new p6(e,t||{})}}let p9=a1.define(),p7=a1.define({combine:e=>e.length?[e[0]]:null});function me(e){let t=e.facet(p9);return t.length?t:e.facet(p7)}function mt(e,t){let n=[mn],r;return e instanceof p6&&(e.module&&n.push(h5.styleModule.of(e.module)),r=e.themeType),(null==t?void 0:t.fallback)?n.push(p7.of(e)):r?n.push(p9.computeN([h5.darkTheme],t=>t.facet(h5.darkTheme)==("dark"==r)?[e]:[])):n.push(p9.of(e)),n}let mn=le.high(cM.fromClass(class{constructor(e){this.markCache=Object.create(null),this.tree=py(e.state),this.decorations=this.buildDeco(e,me(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=py(e.state),n=me(e.state),r=n!=me(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 u$.none;let n=new lP;for(let{from:r,to:i}of e.visibleRanges)!function(e,t,n,r=0,i=e.length){let o=new f8(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]=u$.mark({class:r})))},r,i);return n.finish()}},{decorations:e=>e.decorations})),mr=p6.define([{tag:pd.meta,color:"#404740"},{tag:pd.link,textDecoration:"underline"},{tag:pd.heading,textDecoration:"underline",fontWeight:"bold"},{tag:pd.emphasis,fontStyle:"italic"},{tag:pd.strong,fontWeight:"bold"},{tag:pd.strikethrough,textDecoration:"line-through"},{tag:pd.keyword,color:"#708"},{tag:[pd.atom,pd.bool,pd.url,pd.contentSeparator,pd.labelName],color:"#219"},{tag:[pd.literal,pd.inserted],color:"#164"},{tag:[pd.string,pd.deleted],color:"#a11"},{tag:[pd.regexp,pd.escape,pd.special(pd.string)],color:"#e40"},{tag:pd.definition(pd.variableName),color:"#00f"},{tag:pd.local(pd.variableName),color:"#30a"},{tag:[pd.typeName,pd.namespace],color:"#085"},{tag:pd.className,color:"#167"},{tag:[pd.special(pd.variableName),pd.macroName],color:"#256"},{tag:pd.definition(pd.propertyName),color:"#00c"},{tag:pd.comment,color:"#940"},{tag:pd.invalid,color:"#f00"}]),mi=h5.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),mo="()[]{}",ms=a1.define({combine:e=>lT(e,{afterCursor:!0,brackets:mo,maxScanDistance:1e4,renderMatch:mu})}),ma=u$.mark({class:"cm-matchingBracket"}),ml=u$.mark({class:"cm-nonmatchingBracket"});function mu(e){let t=[],n=e.matched?ma:ml;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 mc=[a6.define({create:()=>u$.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],r=t.state.facet(ms);for(let e of t.state.selection.ranges){if(!e.empty)continue;let i=mp(t.state,e.head,-1,r)||e.head>0&&mp(t.state,e.head-1,1,r)||r.afterCursor&&(mp(t.state,e.head,1,r)||e.head<t.state.doc.length&&mp(t.state,e.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,t.state)))}return u$.set(n,!0)},provide:e=>h5.decorations.from(e)}),mi],mh=new fk;function md(e,t,n){let r=e.prop(t<0?fk.openedBy:fk.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 mf(e){let t=e.type.prop(mh);return t?t(e.node):e}function mp(e,t,n,r={}){let i=r.maxScanDistance||1e4,o=r.brackets||mo,s=py(e),a=s.resolveInner(t,n);for(let e=a;e;e=e.parent){let r=md(e.type,n,o);if(r&&e.from<e.to){let i=mf(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 a=r.parent,l={from:i.from,to:i.to},u=0,c=null==a?void 0:a.cursor();if(c&&(n<0?c.childBefore(r.from):c.childAfter(r.to)))do if(n<0?c.to<=r.from:c.from>=r.to){if(0==u&&o.indexOf(c.type.name)>-1&&c.from<c.to){let e=mf(c);return{start:l,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(md(c.type,n,s))u++;else if(md(c.type,-n,s)){if(0==u){let e=mf(c);return{start:l,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}u--}}while(n<0?c.prevSibling():c.nextSibling());return{start:l,matched:!1}}(0,0,n,e,i,r,o)}}return function(e,t,n,r,i,o,s){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let u={from:n<0?t-1:t,to:n>0?t+1:t},c=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let e=0;!c.next().done&&e<=o;){let o=c.value;n<0&&(e+=o.length);let a=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(a+e,1).type==i){if(t%2==0==n>0)h++;else{if(1==h)return{start:u,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};h--}}}n>0&&(e+=o.length)}return c.done?{start:u,matched:!1}:null}(e,t,n,s,a.type,i,o)}let mm=Object.create(null),mg=[fA.none],mv=[],my=Object.create(null),mb=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"]])mb[e]=function(e,t){let n=[];for(let r of t.split(" ")){let t=[];for(let n of r.split(".")){let r=e[n]||pd[n];r?"function"==typeof r?t.length?t=t.map(r):mx(n,`Modifier ${n} used at start of tag`):t.length?mx(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:mx(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=my[i];if(o)return o.id;let s=my[i]=fA.define({id:mg.length,name:r,props:[f2({[r]:n})]});return mg.push(s),s.id}(mm,t);function mx(e,t){mv.indexOf(e)>-1||(mv.push(e),console.warn(t))}function mw(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}u2.RTL,u2.LTR;let mS=mw(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,a=mM(t,e).line;if(a){for(let n=e;n<=o;){let l=t.doc.lineAt(n);if(l.from>i&&(e==o||o>l.from)){i=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,n=l.text.slice(e,e+a.length)==a?e:-1;e<l.text.length&&e<s&&(s=e),r.push({line:l,comment:n,token:a,indent:e,empty:t,single:!1})}n=l.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),mC=mw(mT,0),mk=mw((e,t)=>mT(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 mM(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}function mT(e,t,n=t.selection.ranges){let r=n.map(e=>mM(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,a=e.sliceDoc(r-50,r),l=e.sliceDoc(i,i+50),u=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,h=a.length-u;if(a.slice(h-t.length,h)==t&&l.slice(c,c+n.length)==n)return{open:{pos:r-u,margin:u&&1},close:{pos:i+c,margin:c&&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 mA=lp.define(),mD=lp.define(),mE=a1.define(),mO=a1.define({combine:e=>lT(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)})}),mR=a6.define({create:()=>m$.empty,update(e,t){let n=t.state.facet(mO),r=t.annotation(mA);if(r){let i=mF.fromTransaction(t,r.selection),o=r.side,s=0==o?e.undone:e.done;return s=i?mZ(s,s.length,n.minDepth,i):mz(s,t.startState.selection),new m$(0==o?r.rest:s,0==o?s:r.rest)}let i=t.annotation(mD);if(("full"==i||"before"==i)&&(e=e.isolate()),!1===t.annotation(ly.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let o=mF.fromTransaction(t),s=t.annotation(ly.time),a=t.annotation(ly.userEvent);return o?e=e.addChanges(o,s,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,a,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 m$(e.done.map(mF.fromJSON),e.undone.map(mF.fromJSON))});function mP(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(mR,!1);if(!i)return!1;let o=i.pop(e,n,t);return!!o&&(r(o),!0)}}let mI=mP(0,!1),mN=mP(1,!1),mj=mP(0,!0),mL=mP(1,!0);class mF{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 mF(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new mF(e.changes&&a$.fromJSON(e.changes),[],e.mapped&&aH.fromJSON(e.mapped),e.startSelection&&aQ.fromJSON(e.startSelection),e.selectionsAfter.map(aQ.fromJSON))}static fromTransaction(e,t){let n=mV;for(let t of e.startState.facet(mE)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new mF(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,mV)}static selection(e){return new mF(void 0,mV,void 0,void 0,e)}}function mZ(e,t,n,r){let i=e.slice(t+1>n+20?t-n-1:0,t);return i.push(r),i}function mB(e,t){return e.length?t.length?e.concat(t):e:t}let mV=[];function mz(e,t){if(!e.length)return[mF.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),mZ(e,e.length-1,1e9,n.setSelAfter(r)))}}function m_(e,t){if(!e.length)return e;let n=e.length,r=mV;for(;n;){let i=function(e,t,n){let r=mB(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):mV,n);if(!e.changes)return mF.selection(r);let i=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new mF(i,lv.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?[mF.selection(r)]:mV}let mH=/^(input\.type|delete)($|\.)/;class m${constructor(e,t,n=0,r){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new m$(this.done,this.undone):this}addChanges(e,t,n,r,i){var o,s;let a,l,u=this.done,c=u[u.length-1];return new m$(u=c&&c.changes&&!c.changes.empty&&e.changes&&(!n||mH.test(n))&&(!c.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,(o=c.changes,s=e.changes,a=[],l=!1,o.iterChangedRanges((e,t)=>a.push(e,t)),s.iterChangedRanges((e,t,n,r)=>{for(let e=0;e<a.length;){let t=a[e++],i=a[e++];r>=t&&n<=i&&(l=!0)}}),l))||"input.type.compose"==n)?mZ(u,u.length-1,r.minDepth,new mF(e.changes.compose(c.changes),mB(lv.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,mV)):mZ(u,u.length,r.minDepth,e),mV,t,n)}addSelection(e,t,n,r){var i;let o=this.done.length?this.done[this.done.length-1].selectionsAfter:mV;return o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=o[o.length-1]).ranges.length==e.ranges.length&&0===i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length?this:new m$(mz(this.done,e),this.undone,t,n)}addMapping(e){return new m$(m_(this.done,e),m_(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:mA.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?mV:r.slice(0,r.length-1);return i.mapped&&(n=m_(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:mA.of({side:e,rest:n,selection:o}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}}}m$.empty=new m$(mV,mV);let mW=[{key:"Mod-z",run:mI,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:mN,preventDefault:!0},{linux:"Ctrl-Shift-z",run:mN,preventDefault:!0},{key:"Mod-u",run:mj,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:mL,preventDefault:!0}];function mq(e,t){return aQ.create(e.ranges.map(t),e.mainIndex)}function mG(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function mU({state:e,dispatch:t},n){let r=mq(e.selection,n);return!r.eq(e.selection,!0)&&(t(mG(e,r)),!0)}function mK(e,t){return aQ.cursor(t?e.to:e.from)}function mY(e,t){return mU(e,n=>n.empty?e.moveByChar(n,t):mK(n,t))}function mX(e){return e.textDirectionAt(e.state.selection.main.head)==u2.LTR}let mQ=e=>mY(e,!mX(e)),mJ=e=>mY(e,mX(e));function m0(e,t){return mU(e,n=>n.empty?e.moveByGroup(n,t):mK(n,t))}function m1(e,t,n){let r,i,o=py(e).resolveInner(t.head),s=n?fk.closedBy:fk.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?mp(e,o.from,1):mp(e,o.to,-1))&&r.matched?n?r.end.to:r.end.from:n?o.to:o.from,aQ.cursor(i,n?-1:1)}function m2(e,t){return mU(e,n=>{if(!n.empty)return mK(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}"undefined"!=typeof Intl&&Intl.Segmenter;let m5=e=>m2(e,!1),m3=e=>m2(e,!0);function m4(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(h5.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 m8(e,t){let n,r=m4(e),{state:i}=e,o=mq(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):mK(n,t));if(o.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),a=s.top+r.marginTop,l=s.bottom-r.marginBottom;t&&t.top>a&&t.bottom<l&&(n=h5.scrollIntoView(o.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(mG(i,o),{effects:n}),!0}let m6=e=>m8(e,!1),m9=e=>m8(e,!0);function m7(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=aQ.cursor(r.from+n))}return i}function ge(e,t){let n=mq(e.state.selection,e=>{let n=t(e);return aQ.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(e.state.selection)&&(e.dispatch(mG(e.state,n)),!0)}function gt(e,t){return ge(e,n=>e.moveByChar(n,t))}let gn=e=>gt(e,!mX(e)),gr=e=>gt(e,mX(e));function gi(e,t){return ge(e,n=>e.moveByGroup(n,t))}function go(e,t){return ge(e,n=>e.moveVertically(n,t))}let gs=e=>go(e,!1),ga=e=>go(e,!0);function gl(e,t){return ge(e,n=>e.moveVertically(n,t,m4(e).height))}let gu=e=>gl(e,!1),gc=e=>gl(e,!0),gh=({state:e,dispatch:t})=>(t(mG(e,{anchor:0})),!0),gd=({state:e,dispatch:t})=>(t(mG(e,{anchor:e.doc.length})),!0),gf=({state:e,dispatch:t})=>(t(mG(e,{anchor:e.selection.main.anchor,head:0})),!0),gp=({state:e,dispatch:t})=>(t(mG(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function gm(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=gg(e,s,!1)):s>i&&(n="delete.forward",s=gg(e,s,!0)),i=Math.min(i,s),o=Math.max(o,s)}else i=gg(e,i,!1),o=gg(e,o,!0);return i==o?{range:r}:{changes:{from:i,to:o},range:aQ.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?h5.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function gg(e,t,n){if(e instanceof h5)for(let r of e.state.facet(h5.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}let gv=(e,t,n)=>gm(e,r=>{let i=r.from,{state:o}=e,s=o.doc.lineAt(i),a,l;if(n&&!t&&i>s.from&&i<s.from+200&&!/[^ \t]/.test(a=s.text.slice(0,i-s.from))){if(" "==a[a.length-1])return i-1;let e=lH(a,o.tabSize)%pR(o)||pR(o);for(let t=0;t<e&&" "==a[a.length-1-t];t++)i--;l=i}else(l=aF(s.text,i-s.from,t,t)+s.from)==i&&s.number!=(t?o.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(l-s.from,i-s.from))&&(l=aF(s.text,l-s.from,!1,!1)+s.from);return l}),gy=e=>gv(e,!1,!0),gb=e=>gv(e,!0,!1),gx=(e,t)=>gm(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 a=aF(o.text,r-o.from,t)+o.from,l=o.text.slice(Math.min(r,a)-o.from,Math.max(r,a)-o.from),u=s(l);if(null!=e&&u!=e)break;(" "!=l||r!=n.head)&&(e=u),r=a}return r}),gw=e=>gx(e,!1);function gS(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 gC(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of gS(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(aQ.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(aQ.range(n.anchor-s,n.head-s))}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:aQ.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function gk(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of gS(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 gM=gA(!1),gT=gA(!0);function gA(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=py(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(fk.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 a=new pN(t,{simulateBreak:r,simulateDoubleBreak:!!s}),l=pI(a,r);for(null==l&&(l=lH(/^\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 u=["",pP(t,l)];return s&&u.push(pP(t,a.lineIndent(o.from,-1))),{changes:{from:r,to:i,insert:aD.of(u)},range:aQ.cursor(r+1+u[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function gD(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:aQ.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}let gE=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(gD(e,(t,n)=>{n.push({from:t.from,insert:e.facet(pO)})}),{userEvent:"input.indent"})),!0),gO=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(gD(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=lH(r,e.tabSize),o=0,s=pP(e,Math.max(0,i-pR(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),gR=[{key:"Ctrl-b",run:mQ,shift:gn,preventDefault:!0},{key:"Ctrl-f",run:mJ,shift:gr},{key:"Ctrl-p",run:m5,shift:gs},{key:"Ctrl-n",run:m3,shift:ga},{key:"Ctrl-a",run:e=>mU(e,t=>aQ.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>ge(e,t=>aQ.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>mU(e,t=>aQ.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>ge(e,t=>aQ.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:gb},{key:"Ctrl-h",run:gy},{key:"Ctrl-k",run:e=>gm(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:gw},{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:aD.of(["",""])},range:aQ.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:aF(r.text,n-r.from,!1)+r.from,o=n==r.to?n+1:aF(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:aQ.cursor(o)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:m9}],gP=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>mU(e,t=>m1(e.state,t,!mX(e))),shift:e=>ge(e,t=>m1(e.state,t,!mX(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>mU(e,t=>m1(e.state,t,mX(e))),shift:e=>ge(e,t=>m1(e.state,t,mX(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>gC(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>gk(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>gC(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>gk(e,t,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=aQ.create([n.main]):n.main.empty||(r=aQ.create([aQ.cursor(n.main.head)])),!!r&&(t(mG(e,r)),!0)}},{key:"Mod-Enter",run:gT},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=gS(e).map(({from:t,to:n})=>aQ.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:aQ.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=mq(e.selection,t=>{let n=py(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 aQ.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(mG(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:gO},{key:"Mod-]",run:gE},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new pN(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=gD(e,(t,i,o)=>{let s=pI(r,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],l=pP(e,s);(a!=l||o.from<t.from+a.length)&&(n[t.from]=s,i.push({from:t.from,to:t.from+a.length,insert:l}))});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(gS(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=mq(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=mq(e.selection,t=>{let r=mp(e,t.head,-1)||mp(e,t.head,1)||t.head>0&&mp(e,t.head-1,1)||t.head<e.doc.length&&mp(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 aQ.cursor(i)}),!!n&&(t(mG(e,r)),!0)}},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=mM(e.state,n.from);return r.line?mS(e):!!r.block&&mk(e)}},{key:"Alt-A",run:mC},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:mQ,shift:gn,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>m0(e,!mX(e)),shift:e=>gi(e,!mX(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>mU(e,t=>m7(e,t,!mX(e))),shift:e=>ge(e,t=>m7(e,t,!mX(e))),preventDefault:!0},{key:"ArrowRight",run:mJ,shift:gr,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>m0(e,mX(e)),shift:e=>gi(e,mX(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>mU(e,t=>m7(e,t,mX(e))),shift:e=>ge(e,t=>m7(e,t,mX(e))),preventDefault:!0},{key:"ArrowUp",run:m5,shift:gs,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gh,shift:gf},{mac:"Ctrl-ArrowUp",run:m6,shift:gu},{key:"ArrowDown",run:m3,shift:ga,preventDefault:!0},{mac:"Cmd-ArrowDown",run:gd,shift:gp},{mac:"Ctrl-ArrowDown",run:m9,shift:gc},{key:"PageUp",run:m6,shift:gu},{key:"PageDown",run:m9,shift:gc},{key:"Home",run:e=>mU(e,t=>m7(e,t,!1)),shift:e=>ge(e,t=>m7(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:gh,shift:gf},{key:"End",run:e=>mU(e,t=>m7(e,t,!0)),shift:e=>ge(e,t=>m7(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:gd,shift:gp},{key:"Enter",run:gM,shift:gM},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:gy,shift:gy},{key:"Delete",run:gb},{key:"Mod-Backspace",mac:"Alt-Backspace",run:gw},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>gx(e,!0)},{mac:"Mod-Backspace",run:e=>gm(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=>gm(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})}].concat(gR.map(e=>({mac:e.key,run:e.run,shift:e.shift})))),gI={key:"Tab",run:gE,shift:gO};function gN(){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 gj="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class gL{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(gj(e)):gj,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 aZ(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=aB(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=aV(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&&(gL.prototype[Symbol.iterator]=function(){return this});let gF={from:-1,to:-1,match:/.*/.exec("")},gZ="gm"+(null==/x/.unicode?"":"u");class gB{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=gF,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new g_(e,t,n,r,i);this.re=new RegExp(t,gZ+((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=gH(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=gH(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 gV=new WeakMap;class gz{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=gV.get(e);if(!r||r.from>=n||r.to<=t){let r=new gz(t,e.sliceString(t,n));return gV.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)),gV.set(e,new gz(o,i)),new gz(t,i.slice(t-o,n-o))}}class g_{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=gF,this.matchPos=gH(e,r),this.re=new RegExp(t,gZ+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=gz.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=gH(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=gz.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function gH(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 g$(e){let t=gN("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,a,l]=n,u=a?+a.slice(1):0,c=s?+s:i.number;if(s&&l){let e=c/100;o&&(e=e*("-"==o?-1:1)+i.number/r.doc.lines),c=Math.round(r.doc.lines*e)}else s&&o&&(c=c*("-"==o?-1:1)+i.number);let h=r.doc.line(Math.max(1,Math.min(r.doc.lines,c))),d=aQ.cursor(h.from+Math.max(0,Math.min(u,h.length)));e.dispatch({effects:[gW.of(!1),h5.scrollIntoView(d.from,{y:"center"})],selection:d}),e.focus()}return{dom:gN("form",{class:"cm-gotoLine",onkeydown:t=>{27==t.keyCode?(t.preventDefault(),e.dispatch({effects:gW.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),n())},onsubmit:e=>{e.preventDefault(),n()}},gN("label",e.state.phrase("Go to line"),": ",t)," ",gN("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),gN("button",{name:"close",onclick:()=>{e.dispatch({effects:gW.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["\xd7"]))}}"undefined"!=typeof Symbol&&(gB.prototype[Symbol.iterator]=g_.prototype[Symbol.iterator]=function(){return this});let gW=lv.define(),gq=a6.define({create:()=>!0,update(e,t){for(let n of t.effects)n.is(gW)&&(e=n.value);return e},provide:e=>d9.from(e,e=>e?g$:null)}),gG=h5.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"}}}),gU={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},gK=a1.define({combine:e=>lT(e,gU,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),gY=u$.mark({class:"cm-selectionMatch"}),gX=u$.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function gQ(e,t,n,r){return(0==n||e(t.sliceDoc(n-1,n))!=lC.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=lC.Word)}let gJ=cM.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(gK),{state:n}=e,r=n.selection;if(r.ranges.length>1)return u$.none;let i=r.main,o,s=null;if(i.empty){if(!t.highlightWordAroundCursor)return u$.none;let e=n.wordAt(i.head);if(!e)return u$.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 u$.none;if(t.wholeWords){var a,l,u;if(o=n.sliceDoc(i.from,i.to),!(gQ(s=n.charCategorizer(i.head),n,i.from,i.to)&&(a=s,l=i.from,u=i.to,a(n.sliceDoc(l,l+1))==lC.Word&&a(n.sliceDoc(u-1,u))==lC.Word)))return u$.none}else if(!(o=n.sliceDoc(i.from,i.to)))return u$.none}let c=[];for(let r of e.visibleRanges){let e=new gL(n.doc,o,r.from,r.to);for(;!e.next().done;){let{from:r,to:o}=e.value;if((!s||gQ(s,n,r,o))&&(i.empty&&r<=i.from&&o>=i.to?c.push(gX.range(r,o)):(r>=i.to||o<=i.from)&&c.push(gY.range(r,o)),c.length>t.maxMatches))return u$.none}}return u$.set(c)}},{decorations:e=>e.decorations}),g0=h5.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),g1=({state:e,dispatch:t})=>{let{selection:n}=e,r=aQ.create(n.ranges.map(t=>e.wordAt(t.head)||aQ.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)},g2=a1.define({combine:e=>lT(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new vw(e),scrollToMatch:e=>h5.scrollIntoView(e)})});class g5{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,gZ),!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 ve(this):new g8(this)}getCursor(e,t=0,n){let r=e.doc?e:lM.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?g6(this,r,t,n):g4(this,r,t,n)}}class g3{constructor(e){this.spec=e}}function g4(e,t,n,r){var i,o;return new gL(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(g9(n,e-r))!=lC.Word||o(g7(n,e-r))!=lC.Word)&&(o(g7(n,t-r))!=lC.Word||o(g9(n,t-r))!=lC.Word))):void 0)}class g8 extends g3{constructor(e){super(e)}nextMatch(e,t,n){let r=g4(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=g4(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=g4(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=g4(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=g4(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 g6(e,t,n,r){var i;return new gB(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(i=t.charCategorizer(t.selection.main.head),(e,t,n)=>!n[0].length||(i(g9(n.input,n.index))!=lC.Word||i(g7(n.input,n.index))!=lC.Word)&&(i(g7(n.input,n.index+n[0].length))!=lC.Word||i(g9(n.input,n.index+n[0].length))!=lC.Word)):void 0},n,r)}function g9(e,t){return e.slice(aF(e,t,!1),t)}function g7(e,t){return e.slice(t,aF(e,t))}class ve extends g3{nextMatch(e,t,n){let r=g6(this.spec,e,n,e.doc.length).next();return r.done&&(r=g6(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=g6(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=g6(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=g6(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 vt=lv.define(),vn=lv.define(),vr=a6.define({create:e=>new vi(vm(e).create(),null),update(e,t){for(let n of t.effects)n.is(vt)?e=new vi(n.value.create(),e.panel):n.is(vn)&&(e=new vi(e.query,n.value?vp:null));return e},provide:e=>d9.from(e,e=>e.panel)});class vi{constructor(e,t){this.query=e,this.panel=t}}let vo=u$.mark({class:"cm-searchMatch"}),vs=u$.mark({class:"cm-searchMatch cm-searchMatch-selected"}),va=cM.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(vr))}update(e){let t=e.state.field(vr);(t!=e.startState.field(vr)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return u$.none;let{view:n}=this,r=new lP;for(let t=0,i=n.visibleRanges,o=i.length;t<o;t++){let{from:s,to:a}=i[t];for(;t<o-1&&a>i[t+1].from-500;)a=i[++t].to;e.highlight(n.state,s,a,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?vs:vo)})}return r.finish()}},{decorations:e=>e.decorations});function vl(e){return t=>{let n=t.state.field(vr,!1);return n&&n.query.spec.valid?e(t,n):vy(t)}}let vu=vl((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=aQ.single(r.from,r.to),o=e.state.facet(g2);return e.dispatch({selection:i,effects:[vk(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),vv(e),!0}),vc=vl((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let o=aQ.single(i.from,i.to),s=e.state.facet(g2);return e.dispatch({selection:o,effects:[vk(e,i),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),vv(e),!0}),vh=vl((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!!n&&!!n.length&&(e.dispatch({selection:aQ.create(n.map(e=>aQ.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),vd=vl((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,a=[],l,u,c=[];if(s.from==r&&s.to==i&&(u=n.toText(t.getReplacement(s)),a.push({from:s.from,to:s.to,insert:u}),s=t.nextMatch(n,s.from,s.to),c.push(h5.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))),s){let t=0==a.length||a[0].from>=o.to?0:o.to-o.from-u.length;l=aQ.single(s.from-t,s.to-t),c.push(vk(e,s)),c.push(n.facet(g2).scrollToMatch(l.main,e))}return e.dispatch({changes:a,selection:l,effects:c,userEvent:"input.replace"}),!0}),vf=vl((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:h5.announce.of(r),userEvent:"input.replace.all"}),!0});function vp(e){return e.state.facet(g2).createPanel(e)}function vm(e,t){var n,r,i,o,s;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let u=e.facet(g2);return new g5({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:u.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(r=null==t?void 0:t.caseSensitive)&&void 0!==r?r:u.caseSensitive,literal:null!==(i=null==t?void 0:t.literal)&&void 0!==i?i:u.literal,regexp:null!==(o=null==t?void 0:t.regexp)&&void 0!==o?o:u.regexp,wholeWord:null!==(s=null==t?void 0:t.wholeWord)&&void 0!==s?s:u.wholeWord})}function vg(e){let t=d3(e,vp);return t&&t.dom.querySelector("[main-field]")}function vv(e){let t=vg(e);t&&t==e.root.activeElement&&t.select()}let vy=e=>{let t=e.state.field(vr,!1);if(t&&t.panel){let n=vg(e);if(n&&n!=e.root.activeElement){let r=vm(e.state,t.query.spec);r.valid&&e.dispatch({effects:vt.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[vn.of(!0),t?vt.of(vm(e.state,t.query.spec)):lv.appendConfig.of(vT)]});return!0},vb=e=>{let t=e.state.field(vr,!1);if(!t||!t.panel)return!1;let n=d3(e,vp);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:vn.of(!1)}),!0},vx=[{key:"Mod-f",run:vy,scope:"editor search-panel"},{key:"F3",run:vu,shift:vc,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:vu,shift:vc,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:vb,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 gL(e.doc,e.sliceDoc(r,i));!t.next().done;){if(o.length>1e3)return!1;t.value.from==r&&(s=o.length),o.push(aQ.range(t.value.from,t.value.to))}return t(e.update({selection:aQ.create(o,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let t=d3(e,g$);if(!t){let n=[gW.of(!0)];null==e.state.field(gq,!1)&&n.push(lv.appendConfig.of([gq,gG])),e.dispatch({effects:n}),t=d3(e,g$)}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 g1({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 gL(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new gL(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(aQ.range(i.from,i.to),!1),effects:h5.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class vw{constructor(e){this.view=e;let t=this.query=e.state.field(vr).query.spec;function n(e,t,n){return gN("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=gN("input",{value:t.search,placeholder:vS(e,"Find"),"aria-label":vS(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=gN("input",{value:t.replace,placeholder:vS(e,"Replace"),"aria-label":vS(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=gN("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=gN("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=gN("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=gN("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>vu(e),[vS(e,"next")]),n("prev",()=>vc(e),[vS(e,"previous")]),n("select",()=>vh(e),[vS(e,"all")]),gN("label",null,[this.caseField,vS(e,"match case")]),gN("label",null,[this.reField,vS(e,"regexp")]),gN("label",null,[this.wordField,vS(e,"by word")]),...e.state.readOnly?[]:[gN("br"),this.replaceField,n("replace",()=>vd(e),[vS(e,"replace")]),n("replaceAll",()=>vf(e),[vS(e,"replace all")])],gN("button",{name:"close",onclick:()=>vb(e),"aria-label":vS(e,"close"),type:"button"},["\xd7"])])}commit(){let e=new g5({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:vt.of(e)}))}keydown(e){var t,n;(t=this.view,n="search-panel",da(dr(t.state),e,t,n))?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?vc:vu)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),vd(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(vt)&&!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(g2).top}}function vS(e,t){return e.state.phrase(t)}let vC=/[\s\.,:;?!]/;function vk(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),a=e.state.sliceDoc(o,s);if(o!=r.from){for(let e=0;e<30;e++)if(!vC.test(a[e+1])&&vC.test(a[e])){a=a.slice(e);break}}if(s!=i){for(let e=a.length-1;e>a.length-30;e--)if(!vC.test(a[e-1])&&vC.test(a[e])){a=a.slice(0,e);break}}return h5.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}let vM=h5.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"}}),vT=[vr,le.low(va),vM];class vA{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=py(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(vR(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 vD(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 vE{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function vO(e){return e.selection.main.from}function vR(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)&&void 0!==n?n:e.ignoreCase?"i":""):e}let vP=lp.define(),vI=new WeakMap;function vN(e){if(!Array.isArray(e))return e;let t=vI.get(e);return t||vI.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=vD(t)+vD(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 vj=lv.define(),vL=lv.define();class vF{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=aZ(e,t),r=aV(n);this.chars.push(n);let i=e.slice(t,t+r),o=i.toUpperCase();this.folded.push(aZ(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=aZ(e,0),i=aV(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 a=t.length,l=0;if(s<0){for(let i=0,o=Math.min(e.length,200);i<o&&l<a;){let o=aZ(e,i);(o==t[l]||o==n[l])&&(r[l++]=i),i+=aV(o)}if(l<a)return null}let u=0,c=0,h=!1,d=0,f=-1,p=-1,m=/[a-z]/.test(e),g=!0;for(let r=0,l=Math.min(e.length,200),v=0;r<l&&c<a;){let l=aZ(e,r);s<0&&(u<a&&l==t[u]&&(i[u++]=r),d<a&&(l==t[d]||l==n[d]?(0==d&&(f=r),p=r+1,d++):d=0));let y,b=l<255?l>=48&&l<=57||l>=97&&l<=122?2:+(l>=65&&l<=90):(y=aB(l))!=y.toLowerCase()?1:2*(y!=y.toUpperCase());(!r||1==b&&m||0==v&&0!=b)&&(t[c]==l||n[c]==l&&(h=!0)?o[c++]=r:o.length&&(g=!1)),v=b,r+=aV(l)}return c==a&&0==o[0]&&g?this.result(-100+(h?-200:0),o,e):d==a&&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==a?this.ret(-900-e.length,[f,p]):c==a?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?aV(aZ(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 vZ{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 vB=a1.define({combine:e=>lT(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:vz,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=>vV(e(n),t(n)),optionClass:(e,t)=>n=>vV(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function vV(e,t){return e?t?e+" "+t:e:t}function vz(e,t,n,r,i,o){let s=e.textDirection==u2.RTL,a=s,l=!1,u="top",c,h,d=t.left-i.left,f=i.right-t.right,p=r.right-r.left,m=r.bottom-r.top;if(a&&d<Math.min(p,f)?a=!1:!a&&f<Math.min(p,d)&&(a=!0),p<=(a?d:f))c=Math.max(i.top,Math.min(n.top,i.bottom-m))-t.top,h=Math.min(400,a?d:f);else{l=!0,h=Math.min(400,(s?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=m||e>t.top?c=n.bottom-t.top:(u="bottom",c=t.bottom-n.top)}let g=(t.bottom-t.top)/o.offsetHeight,v=(t.right-t.left)/o.offsetWidth;return{style:`${u}: ${c/g}px; max-width: ${h/v}px`,class:"cm-completionInfo-"+(l?s?"left-narrow":"right-narrow":a?"left":"right")}}function v_(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 vH{constructor(e,t,n){let r;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 i=e.state.field(t),{options:o,selected:s}=i.open,a=e.state.facet(vB);this.optionContent=(r=a.addToOptions.slice(),a.icons&&r.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}),r.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 a=i.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(o.slice(t,n))),a.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}),r.sort((e,t)=>e.position-t.position).map(e=>e.render)),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=v_(o.length,s,a.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(vB).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:vL.of(null)})}),this.showOptions(o,i.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=v_(i.length,o,e.state.facet(vB).maxRenderedOptions),this.showOptions(i,n.id)),this.updateSel(),s!=(null===(t=r.open)||void 0===t?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=v_(t.options.length,t.selected,this.view.state.facet(vB).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=>cw(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(vB).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:a}=e[o],{section:l}=s;if(l){let e="string"==typeof l?l:l.name;e!=i&&(o>n.from||0==n.from)&&(i=e,"string"!=typeof l&&l.header?r.appendChild(l.header(l)):r.appendChild(document.createElement("completion-section")).textContent=e)}let u=r.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let c=this.optionClass(s);for(let e of(c&&(u.className=c),this.optionContent)){let t=e(s,this.view.state,this.view,a);t&&u.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 v$(e){return 100*(e.boost||0)+10*!!e.apply+5*!!e.info+ +!!e.type}class vW{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 vW(this.options,vK(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(vB);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 vE(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,a=o.filterStrict?new vZ(n):new vF(n);for(let t of r.result.options)if(s=a.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched;i(new vE(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)&&void 0!==n?n:1e9)-(null!==(r=t.rank)&&void 0!==r?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=[],a=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;a&&a.label==t.label&&a.detail==t.detail&&(null==a.type||null==t.type||a.type==t.type)&&a.apply==t.apply&&a.boost==t.boost?v$(e.completion)>v$(a)&&(s[s.length-1]=e):s.push(e),a=e.completion}return s}(e,t);if(!s.length)return r&&e.some(e=>e.isPending)?r.setDisabled():null;let a=t.facet(vB).selectOnOpen?0:-1;if(r&&r.selected!=a&&-1!=r.selected){let e=r.options[r.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){a=t;break}}return new vW(s,vK(n,a),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:v3,above:i.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new vW(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 vW(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class vq{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new vq(vY,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(vB),r=(n.override||t.languageDataAt("autocomplete",vO(t)).map(vN)).map(t=>(this.active.find(e=>e.source==t)||new vQ(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(v0));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=vW.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 vQ(e.source,0):e)),e.effects))s.is(v1)&&(i=i&&i.setSelected(s.value,this.id));return r==this.active&&i==this.open?this:new vq(r,this.id,i)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?vG:vU}}let vG={"aria-autocomplete":"list"},vU={};function vK(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}let vY=[];function vX(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(vP);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 vQ{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=vX(e,t),r=this;for(let t of((8&n||16&n&&this.touches(e))&&(r=new vQ(r.source,0)),4&n&&0==r.state&&(r=new vQ(this.source,1)),r=r.updateFor(e,n),e.effects))if(t.is(vj))r=new vQ(r.source,1,t.value);else if(t.is(vL))r=new vQ(r.source,0);else if(t.is(v0))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(vO(e.state))}}class vJ extends vQ{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=vO(e.state);if(s>o||!r||2&t&&(vO(e.startState)==this.from||s<this.limit))return new vQ(this.source,4&t?1:0);let a=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):vR(e,!0).test(i)}(r.validFor,e.state,i,o)?r.update&&(r=r.update(r,i,o,new vA(e.state,s,!1)))?new vJ(this.source,this.explicit,a,r,r.from,null!==(n=r.to)&&void 0!==n?n:vO(e.state)):new vQ(this.source,1,this.explicit):new vJ(this.source,this.explicit,a,r,i,o)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new vJ(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new vQ(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}let v0=lv.define({map:(e,t)=>e.map(e=>e.map(t))}),v1=lv.define(),v2=a6.define({create:()=>vq.start(),update:(e,t)=>e.update(t),provide:e=>[dY.from(e,e=>e.tooltip),h5.contentAttributes.from(e,e=>e.attrs)]});function v5(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(v2).active.find(e=>e.source==t.source);return r instanceof vJ&&("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(a=>{if(a!=i&&n!=r&&e.sliceDoc(a.from+o,a.from+s)!=e.sliceDoc(n,r))return{range:a};let l=e.toText(t);return{changes:{from:a.from+o,to:r==i.from?a.to:a.from+s,insert:l},range:aQ.cursor(a.from+o+l.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}(e.state,n,r.from,r.to)),{annotations:vP.of(t.completion)})):n(e,t.completion,r.from,r.to),!0)}let v3=e=>new vH(e,v2,v5);function v4(e,t="option"){return n=>{let r=n.state.field(v2,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(vB).interactionDelay)return!1;let i=1,o;"page"==t&&(o=d1(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,a=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:s-1;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),n.dispatch({effects:v1.of(a)}),!0}}let v8=e=>!!e.state.field(v2,!1)&&(e.dispatch({effects:vj.of(!0)}),!0);class v6{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}let v9=cM.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(v2).active))t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(v2),n=e.state.facet(vB);if(!e.selectionSet&&!e.docChanged&&e.startState.field(v2)==t)return;let r=e.transactions.some(e=>{let t=vX(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){cw(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(vj)))&&(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(v2);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(vB).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=vO(t),r=new vA(t,n,e.explicit,this.view),i=new v6(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:vL.of(null)}),cw(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(vB).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(vB),r=this.view.state.field(v2);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=vO(o.updates.length?o.updates[0].startState:this.view.state),i=Math.min(r,o.done.from+ +!o.active.explicit),s=new vJ(o.active.source,o.active.explicit,i,o.done,o.done.from,null!==(e=o.done.to)&&void 0!==e?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 vQ(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:v0.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(v2,!1);if(t&&t.tooltip&&this.view.state.facet(vB).closeOnBlur){let n=t.open&&d1(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:vL.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:vj.of(!1)}),20),this.composing=0}}}),v7="object"==typeof navigator&&/Win/.test(navigator.platform),ye=le.highest(h5.domEventHandlers({keydown(e,t){let n=t.state.field(v2,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(v7&&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&&v5(t,r),!1}})),yt=h5.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"}}}),yn={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},yr=lv.define({map(e,t){let n=t.mapPos(e,-1,a_.TrackAfter);return null==n?void 0:n}}),yi=new class extends lA{};yi.startSide=1,yi.endSide=-1;let yo=a6.define({create:()=>lR.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(yr)&&(e=e.update({add:[yi.range(n.value,n.value+1)]}));return e}}),ys="()[]{}<>\xab\xbb\xbb\xab[]{}";function ya(e){for(let t=0;t<ys.length;t+=2)if(ys.charCodeAt(t)==e)return ys.charAt(t+1);return aB(e<128?e:e+1)}function yl(e,t){return e.languageDataAt("closeBrackets",t)[0]||yn}let yu="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),yc=h5.inputHandler.of((e,t,n,r)=>{if((yu?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||2==r.length&&1==aV(aZ(r,0))||t!=i.from||n!=i.to)return!1;let o=function(e,t){let n=yl(e,e.selection.main.head),r=n.brackets||yn.brackets;for(let i of r){let o=ya(aZ(i,0));if(t==i)return o==i?function(e,t,n,r){let i=r.stringPrefixes||yn.stringPrefixes,o=null,s=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:yr.of(r.to+t.length),range:aQ.range(r.anchor+t.length,r.head+t.length)};let s=r.head,a=yf(e.doc,s),l;if(a==t){if(yp(e,s))return{changes:{insert:t+t,from:s},effects:yr.of(s+t.length),range:aQ.cursor(s+t.length)};if(yd(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:aQ.cursor(s+r.length)}}}else if(n&&e.sliceDoc(s-2*t.length,s)==t+t&&(l=ym(e,s-2*t.length,i))>-1&&yp(e,l))return{changes:{insert:t+t+t+t,from:s},effects:yr.of(s+t.length),range:aQ.cursor(s+t.length)};else if(e.charCategorizer(s)(a)!=lC.Word&&ym(e,s,i)>-1&&!function(e,t,n,r){let i=py(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)),a=s.indexOf(n);if(!a||a>-1&&r.indexOf(s.slice(0,a))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=i.to==t&&i.parent;if(!l)break;i=l}return!1}(e,s,t,i))return{changes:{insert:t+t,from:s},effects:yr.of(s+t.length),range:aQ.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:yr.of(o.to+t.length),range:aQ.range(o.anchor+t.length,o.head+t.length)};let s=yf(e.doc,o.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:t+n,from:o.head},effects:yr.of(o.head+t.length),range:aQ.cursor(o.head+t.length)}:{range:i=o}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}(e,i,o,n.before||yn.before);if(t==o&&yd(e,e.selection.main.from))return function(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&yf(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:aQ.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)}),yh=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=yl(e,e.selection.main.head).brackets||yn.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){var i,o;let r;let s=(i=e.doc,o=t.head,aV(aZ(r=i.sliceString(o-2,o),0))==r.length?r:r.slice(1));for(let r of n)if(r==s&&yf(e.doc,t.head)==ya(aZ(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:aQ.cursor(t.head-r.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function yd(e,t){let n=!1;return e.field(yo).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function yf(e,t){let n=e.sliceString(t,t+2);return n.slice(0,aV(aZ(n,0)))}function yp(e,t){let n=py(e).resolveInner(t+1);return n.parent&&n.from==t}function ym(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=lC.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))!=lC.Word)return n}return -1}let yg=[{key:"Ctrl-Space",run:v8},{mac:"Alt-`",run:v8},{key:"Escape",run:e=>{let t=e.state.field(v2,!1);return!!(t&&t.active.some(e=>0!=e.state))&&(e.dispatch({effects:vL.of(null)}),!0)}},{key:"ArrowDown",run:v4(!0)},{key:"ArrowUp",run:v4(!1)},{key:"PageDown",run:v4(!0,"page")},{key:"PageUp",run:v4(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(v2,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(vB).interactionDelay)&&v5(e,t.open.options[t.open.selected])}}],yv=le.highest(dt.computeN([vB],e=>e.facet(vB).defaultKeymap?[yg]:[]));class yy{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class yb{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=e,i=n.facet(yP).markerFilter;i&&(r=i(r,n));let o=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),s=new lP,a=[],l=0;for(let e=0;;){let t,r,i=e==o.length?null:o[e];if(!i&&!a.length)break;for(a.length?(t=l,r=a.reduce((e,t)=>Math.min(e,t.to),i&&i.from>t?i.from:1e8)):(t=i.from,r=i.to,a.push(i),e++);e<o.length;){let n=o[e];if(n.from==t&&(n.to>n.from||n.to==t))a.push(n),e++,r=Math.min(n.to,r);else{r=Math.min(n.from,r);break}}let u=yz(a);if(a.some(e=>e.from==e.to||e.from==e.to-1&&n.doc.lineAt(e.from).to==e.from))s.add(t,t,u$.widget({widget:new yj(u),diagnostics:a.slice()}));else{let e=a.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");s.add(t,r,u$.mark({class:"cm-lintRange cm-lintRange-"+u+e,diagnostics:a.slice(),inclusiveEnd:a.some(e=>e.to>r)}))}l=r;for(let e=0;e<a.length;e++)a[e].to<=l&&a.splice(e--,1)}let u=s.finish();return new yb(u,t,yx(u))}}function yx(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 yy(r.from,n,r.diagnostic)}else r=new yy(e,n,t||i.diagnostics[0])}}),r}function yw(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(yP).hideOn(e,n,r);if(null!=i)return i;let o=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(yC))||e.changes.touchesRange(o.from,Math.max(o.to,r)))}function yS(e,t){return e.field(yT,!1)?t:t.concat(lv.appendConfig.of(yU))}let yC=lv.define(),yk=lv.define(),yM=lv.define(),yT=a6.define({create:()=>new yb(u$.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=yx(n,e.selected.diagnostic,i)||yx(n,null,i)}!n.size&&i&&t.state.facet(yP).autoPanel&&(i=null),e=new yb(n,i,r)}for(let n of t.effects)if(n.is(yC)){let r=t.state.facet(yP).autoPanel?n.value.length?yF.open:null:e.panel;e=yb.init(n.value,r,t.state)}else n.is(yk)?e=new yb(e.diagnostics,n.value?yF.open:null,e.selected):n.is(yM)&&(e=new yb(e.diagnostics,e.panel,n.value));return e},provide:e=>[d9.from(e,e=>e.panel),h5.decorations.from(e,e=>e.diagnostics)]}),yA=u$.mark({class:"cm-lintRange cm-lintRange-active"});function yD(e,t){return gN("ul",{class:"cm-tooltip-lint"},t.map(t=>yN(e,t,!1)))}let yE=e=>{let t=e.state.field(yT,!1);return!!t&&!!t.panel&&(e.dispatch({effects:yk.of(!1)}),!0)},yO=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(yT,!1);t&&t.panel||e.dispatch({effects:yS(e.state,[yk.of(!0)])});let n=d3(e,yF.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(yT,!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)}}],yR=cM.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(yP);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(yP);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=>{if(this.view.state.doc==e.doc){var n,r;this.view.dispatch((n=this.view.state,r=t.reduce((e,t)=>e.concat(t)),{effects:yS(n,[yC.of(r)])}))}},e=>{cw(this.view.state,e)})}}update(e){let t=e.state.facet(yP);(e.docChanged||t!=e.startState.facet(yP)||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)}}),yP=a1.define({combine:e=>Object.assign({sources:e.map(e=>e.source).filter(e=>null!=e)},lT(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 yI(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 yN(e,t,n){var r;let i=n?yI(t.actions):[];return gN("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},gN("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(r=t.actions)||void 0===r?void 0:r.map((n,r)=>{let o=!1,s=r=>{if(r.preventDefault(),o)return;o=!0;let i=yx(e.state.field(yT).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:a}=n,l=i[r]?a.indexOf(i[r]):-1,u=l<0?a:[a.slice(0,l),gN("u",a.slice(l,l+1)),a.slice(l+1)];return gN("button",{type:"button",class:"cm-diagnosticAction",onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${i[r]})"`}.`},u)}),t.source&&gN("div",{class:"cm-diagnosticSource"},t.source))}class yj extends u_{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return gN("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class yL{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(0xffffffff*Math.random()).toString(16),this.dom=yN(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class yF{constructor(e){this.view=e,this.items=[],this.list=gN("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)yE(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=yI(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=yx(this.view.state.field(yT).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}t.preventDefault()},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=gN("div",{class:"cm-panel-lint"},this.list,gN("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>yE(this.view)},"\xd7")),this.update()}get selectedIndex(){let e=this.view.state.field(yT).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(yT),n=0,r=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(e,s,{spec:a})=>{for(let e of a.diagnostics){if(o.has(e))continue;o.add(e);let s=-1,a;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){s=t;break}s<0?(a=new yL(this.view,e),this.items.splice(n,0,a),r=!0):(a=this.items[s],s>n&&(this.items.splice(n,s-n),r=!0)),t&&a.diagnostic==t.diagnostic?a.dom.hasAttribute("aria-selected")||(a.dom.setAttribute("aria-selected","true"),i=a):a.dom.hasAttribute("aria-selected")&&a.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 yL(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=yx(this.view.state.field(yT).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:yM.of(t)})}static open(e){return new yF(e)}}function yZ(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 yB(e){return yZ(`<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 yV=h5.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:yB("#d11")},".cm-lintRange-warning":{backgroundImage:yB("orange")},".cm-lintRange-info":{backgroundImage:yB("#999")},".cm-lintRange-hint":{backgroundImage:yB("#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 yz(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 y_ extends d7{constructor(e){super(),this.diagnostics=e,this.severity=yz(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(yK).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:yW.of({pos:i.from,above:!1,clip:!1,create:()=>({dom:yD(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(yq)&&e.dispatch({effects:yW.of(null)})}},window.addEventListener("mousemove",r)}let{hoverTime:i}=e.state.facet(yK),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 yH=fi({class:"cm-gutter-lint",markers:e=>e.state.field(y$),widgetMarker:(e,t,n)=>{let r=[];return e.state.field(y$).between(n.from,n.to,(e,t,i)=>{e>n.from&&e<n.to&&r.push(...i.diagnostics)}),r.length?new y_(r):null}}),y$=a6.define({create:()=>lR.empty,update(e,t){e=e.map(t.changes);let n=t.state.facet(yK).markerFilter;for(let r of t.effects)if(r.is(yC)){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 y_(n[e]).range(+e));return lR.of(r,!0)}(t.state.doc,i.slice(0))}return e}}),yW=lv.define(),yq=a6.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=yw(t,e)?null:Object.assign(Object.assign({},e),{pos:t.changes.mapPos(e.pos)})),t.effects.reduce((e,t)=>t.is(yW)?t.value:e,e)),provide:e=>dY.from(e)}),yG=h5.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:yZ('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:yZ('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:yZ('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),yU=[yT,h5.decorations.compute([yT],e=>{let{selected:t,panel:n}=e.field(yT);return t&&n&&t.from!=t.to?u$.set([yA.range(t.from,t.to)]):u$.none}),function(e,t={}){let n=lv.define(),r=a6.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,a_.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(d2)&&(e=[]);return e},provide:e=>dX.from(e)});return{active:r,extension:[r,cM.define(i=>new d0(i,e,r,n,t.hoverTime||300)),dJ]}}(function(e,t,n){let{diagnostics:r}=e.state.field(yT),i,o=-1,s=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:a})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=a.diagnostics,o=e,s=r,!1});let a=e.state.facet(yP).tooltipFilter;return(i&&a&&(i=a(i,e.state)),i)?{pos:o,end:s,above:e.state.doc.lineAt(o).to<s,create:()=>({dom:yD(e,i)})}:null},{hideOn:yw}),yV],yK=a1.define({combine:e=>lT(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})});var yY=function(e){void 0===e&&(e={});var{crosshairCursor:t=!1}=e,n=[];!1!==e.closeBracketsKeymap&&(n=n.concat(yh)),!1!==e.defaultKeymap&&(n=n.concat(gP)),!1!==e.searchKeymap&&(n=n.concat(vx)),!1!==e.historyKeymap&&(n=n.concat(mW)),!1!==e.foldKeymap&&(n=n.concat(pX)),!1!==e.completionKeymap&&(n=n.concat(yg)),!1!==e.lintKeymap&&(n=n.concat(yO));var r=[];if(!1!==e.lineNumbers&&r.push(function(e={}){return[fm.of(e),fs(),fy]}()),!1!==e.highlightActiveLineGutter&&r.push(fw),!1!==e.highlightSpecialChars&&r.push(function(e={}){return[dR.of(e),dP||(dP=cM.fromClass(class{constructor(e){this.view=e,this.decorations=u$.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(dR)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new dT({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,o=aZ(t[0],0);if(9==o){let e=i.lineAt(r),t=n.state.tabSize,o=lH(e.text,t,r-e.from);return u$.replace({widget:new dN((t-o%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=u$.replace({widget:new dI(e,o)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(dR);e.startState.facet(dR)!=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&&r.push(function(e={}){return[mR,mO.of(e),h5.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?mI:"historyRedo"==e.inputType?mN:null;return!!n&&(e.preventDefault(),n(t))}})]}()),!1!==e.foldGutter&&r.push(function(e={}){let t=Object.assign(Object.assign({},p3),e),n=new p4(t,!0),r=new p4(t,!1),i=cM.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(pA)!=e.state.facet(pA)||e.startState.field(pG,!1)!=e.state.field(pG,!1)||py(e.startState)!=py(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new lP;for(let i of e.viewportLineBlocks){let o=pU(e.state,i.from,i.to)?r:p_(e.state,i.from,i.to)?n:null;o&&t.add(i.from,i.from,o)}return t.finish()}}),{domEventHandlers:o}=t;return[i,fi({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.markers)||lR.empty},initialSpacer:()=>new p4(t,!1),domEventHandlers:Object.assign(Object.assign({},o),{click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=pU(e.state,t.from,t.to);if(r)return e.dispatch({effects:pW.of(r)}),!0;let i=p_(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:p$.of(i)}),!0)}})}),p0()]}()),!1!==e.drawSelection&&r.push(function(e={}){return[dm.of(e),dv,db,dw,cg.of(!0)]}()),!1!==e.dropCursor&&r.push([dC,dk]),!1!==e.allowMultipleSelections&&r.push(lM.allowMultipleSelections.of(!0)),!1!==e.indentOnInput&&r.push(lM.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,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=pI(s,t.from);if(null==n)continue;let r=/^\s*/.exec(t.text)[0],i=pP(s,n);r!=i&&l.push({from:t.from,to:t.from+r.length,insert:i})}return l.length?[e,{changes:l,sequential:!0}]:e})),!1!==e.syntaxHighlighting&&r.push(mt(mr,{fallback:!0})),!1!==e.bracketMatching&&r.push(function(e={}){return[ms.of(e),mc]}()),!1!==e.closeBrackets&&r.push([yc,yo]),!1!==e.autocompletion&&r.push(function(e={}){return[ye,v2,vB.of(e),v9,yv,yt]}()),!1!==e.rectangularSelection){let e;r.push((e=e=>e.altKey&&0==e.button,h5.mouseSelectionStyle.of((t,n)=>{let r,i;return e(n)?(r=dZ(t,n),i=t.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(e,n,o){let s=dZ(t,e);if(!s)return i;let a=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),a=Math.max(t.off,n.off);for(let t=r;t<=i;t++){let n=e.doc.line(t);n.length<=a&&o.push(aQ.range(n.from+s,n.to+a))}}else{let s=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let t=r;t<=i;t++){let n=e.doc.line(t),r=l$(n.text,s,e.tabSize,!0);if(r<0)o.push(aQ.cursor(n.to));else{let t=l$(n.text,a,e.tabSize);o.push(aQ.range(n.from+r,n.from+t))}}}return o}(t.state,r,s);return a.length?o?aQ.create(a.concat(i.ranges)):aQ.create(a):i}}:null):null})))}if(!1!==t&&r.push(function(e={}){let[t,n]=dB[e.key||"Alt"],r=cM.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,h5.contentAttributes.of(e=>{var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.isDown)?dV:null})]}()),!1!==e.highlightActiveLine&&r.push(dL),!1!==e.highlightSelectionMatches){let e;r.push(e=[g0,gJ])}return e.tabSize&&"number"==typeof e.tabSize&&r.push(pO.of(" ".repeat(e.tabSize))),r.concat([dt.of(n.flat())]).filter(Boolean)};let yX="#e06c75",yQ="#abb2bf",yJ="#7d8799",y0="#d19a66",y1="#2c313a",y2="#282c34",y5="#353a42",y3="#528bff",y4=[h5.theme({"&":{color:yQ,backgroundColor:y2},".cm-content":{caretColor:y3},".cm-cursor, .cm-dropCursor":{borderLeftColor:y3},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:yQ},".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:y2,color:yJ,border:"none"},".cm-activeLineGutter":{backgroundColor:y1},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:y5},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:y5,borderBottomColor:y5},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:y1,color:yQ}}},{dark:!0}),mt(p6.define([{tag:pd.keyword,color:"#c678dd"},{tag:[pd.name,pd.deleted,pd.character,pd.propertyName,pd.macroName],color:yX},{tag:[pd.function(pd.variableName),pd.labelName],color:"#61afef"},{tag:[pd.color,pd.constant(pd.name),pd.standard(pd.name)],color:y0},{tag:[pd.definition(pd.name),pd.separator],color:yQ},{tag:[pd.typeName,pd.className,pd.number,pd.changed,pd.annotation,pd.modifier,pd.self,pd.namespace],color:"#e5c07b"},{tag:[pd.operator,pd.operatorKeyword,pd.url,pd.escape,pd.regexp,pd.link,pd.special(pd.string)],color:"#56b6c2"},{tag:[pd.meta,pd.comment],color:yJ},{tag:pd.strong,fontWeight:"bold"},{tag:pd.emphasis,fontStyle:"italic"},{tag:pd.strikethrough,textDecoration:"line-through"},{tag:pd.link,color:yJ,textDecoration:"underline"},{tag:pd.heading,fontWeight:"bold",color:yX},{tag:[pd.atom,pd.bool,pd.special(pd.variableName)],color:y0},{tag:[pd.processingInstruction,pd.string,pd.inserted],color:"#98c379"},{tag:pd.invalid,color:"#ffffff"}]))];var y8=h5.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),y6=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,a=[];switch(t&&a.unshift(dt.of([gI])),s&&("boolean"==typeof s?a.unshift(yY()):a.unshift(yY(s))),o&&a.unshift(cM.fromClass(class{constructor(e){this.view=e,this.placeholder=o?u$.set([u$.widget({widget:new dF(o),side:1}).range(0)]):u$.none}get decorations(){return this.view.state.doc.length?u$.none:this.placeholder}},{decorations:e=>e.decorations})),i){case"light":a.push(y8);break;case"dark":a.push(y4);break;case"none":break;default:a.push(i)}return!1===n&&a.push(h5.editable.of(!1)),r&&a.push(lM.readOnly.of(!0)),[...a]},y9=e=>({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)}),y7=lp.define(),be=[],bt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],bn=(0,m.forwardRef)((e,t)=>{var{className:n,value:r="",selection:i,extensions:o=[],onChange:s,onStatistics:a,onCreateEditor:l,onUpdate:u,autoFocus:c,theme:h="light",height:d,minHeight:f,maxHeight:g,width:v,minWidth:y,maxWidth:b,basicSetup:x,placeholder:w,indentWithTab:S,editable:C,readOnly:k,root:M,initialState:T}=e,A=(0,ab.Z)(e,bt),D=(0,m.useRef)(null),{state:E,view:O,container:R,setContainer:P}=function(e){var{value:t,selection:n,onChange:r,onStatistics:i,onCreateEditor:o,onUpdate:s,extensions:a=be,autoFocus:l,theme:u="light",height:c=null,minHeight:h=null,maxHeight:d=null,width:f=null,minWidth:p=null,maxWidth:g=null,placeholder:v="",editable:y=!0,readOnly:b=!1,indentWithTab:x=!0,basicSetup:w=!0,root:S,initialState:C}=e,[k,M]=(0,m.useState)(),[T,A]=(0,m.useState)(),[D,E]=(0,m.useState)(),O=h5.theme({"&":{height:c,minHeight:h,maxHeight:d,width:f,minWidth:p,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),R=[h5.updateListener.of(e=>{e.docChanged&&"function"==typeof r&&!e.transactions.some(e=>e.annotation(y7))&&r(e.state.doc.toString(),e),i&&i(y9(e))}),O,...y6({theme:u,editable:y,readOnly:b,placeholder:v,indentWithTab:x,basicSetup:w})];return s&&"function"==typeof s&&R.push(h5.updateListener.of(s)),R=R.concat(a),(0,m.useLayoutEffect)(()=>{if(k&&!D){var e={doc:t,selection:n,extensions:R},r=C?lM.fromJSON(C.json,e,C.fields):lM.create(e);if(E(r),!T){var i=new h5({state:r,parent:k,root:S});A(i),o&&o(i,r)}}return()=>{T&&(E(void 0),A(void 0))}},[k,D]),(0,m.useEffect)(()=>{e.container&&M(e.container)},[e.container]),(0,m.useEffect)(()=>()=>{T&&(T.destroy(),A(void 0))},[T]),(0,m.useEffect)(()=>{l&&T&&T.focus()},[l,T]),(0,m.useEffect)(()=>{T&&T.dispatch({effects:lv.reconfigure.of(R)})},[u,a,c,h,d,f,p,g,v,y,b,x,w,r,s]),(0,m.useEffect)(()=>{if(void 0!==t){var e=T?T.state.doc.toString():"";T&&t!==e&&T.dispatch({changes:{from:0,to:e.length,insert:t||""},annotations:[y7.of(!0)]})}},[t,T]),{state:D,setState:E,view:T,setView:A,container:k,setContainer:M}}({root:M,value:r,autoFocus:c,theme:h,height:d,minHeight:f,maxHeight:g,width:v,minWidth:y,maxWidth:b,basicSetup:x,placeholder:w,indentWithTab:S,editable:C,readOnly:k,selection:i,onChange:s,onStatistics:a,onCreateEditor:l,onUpdate:u,extensions:o,initialState:T});(0,m.useImperativeHandle)(t,()=>({editor:D.current,state:E,view:O}),[D,R,E,O]);var I=(0,m.useCallback)(e=>{D.current=e,P(e)},[P]);if("string"!=typeof r)throw Error("value must be typeof string but got "+typeof r);var N="string"==typeof h?"cm-theme-"+h:"cm-theme";return(0,p.jsx)("div",(0,ay.Z)({ref:I,className:""+N+(n?" "+n:"")},A))});bn.displayName="CodeMirror";class br{constructor(e,t,n,r,i,o,s,a,l,u=0,c){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=o,this.buffer=s,this.bufferBase=a,this.curContext=l,this.lookAhead=u,this.parent=c}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 br(e,[],t,n,n,0,[],0,r?new bi(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 a=this.stack.length-(n-1)*3-(262144&e?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,u=this.reducePos-l;u>=2e3&&!(null===(t=this.p.parser.nodeSet.types[r])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=u));let c=a?this.stack[a-1]:0,h=this.bufferBase+this.buffer.length-c;if(r<i.minRepeatTerm||131072&e){let e=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,l,e,h+4,!0)}if(262144&e)this.state=this.stack[a];else{let e=this.stack[a-3];this.state=i.getGoto(e,r,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(r,l)}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 br(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 bo(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 bi(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 bi{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class bo{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 bs{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 bs(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 bs(this.stack,this.pos,this.index)}}function ba(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 bl{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}let bu=new bl;class bc{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=bu,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=bu,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 bh{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;bd(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}function bd(e,t,n,r,i,o){let s=0,a=1<<r,{dialect:l}=n.p.parser;n:for(;(a&e[s])!=0;){let n=e[s+1];for(let r=s+3;r<n;r+=2)if((e[r+1]&a)>0){let n=e[r];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||function(e,t,n,r){let i=bf(n,r,t);return i<0||bf(n,r,e)<i}(n,t.token.value,i,o))){t.acceptToken(n);break}}let r=t.next,u=0,c=e[s+2];if(t.next<0&&c>u&&65535==e[n+3*c-3]){s=e[n+3*c-1];continue}for(;u<c;){let i=u+c>>1,o=n+i+(i<<1),a=e[o],l=e[o+1]||65536;if(r<a)c=i;else if(r>=l)u=i+1;else{s=e[o+2],t.advance();continue n}}break}}function bf(e,t,n){for(let r=t,i;65535!=(i=e[r]);r++)if(i==n)return r-t;return -1}bh.prototype.contextual=bh.prototype.fallback=bh.prototype.extend=!1,(class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data="string"==typeof e?ba(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(bd(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=bh.prototype.fallback=bh.prototype.extend=!1;let bp="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG),bm=null;function bg(e,t,n){let r=e.cursor(SB.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 bv{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?bg(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?bg(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 fR){if(o==e){if(o<this.safeFrom)return null;let e=o+i.length;if(e<=this.safeTo){let t=i.prop(fk.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 by{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new bl)}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,a=0;for(let r=0;r<i.length;r++){if((1<<r&o)==0)continue;let l=i[r],u=this.tokens[r];if((!n||l.fallback)&&((l.contextual||u.start!=e.pos||u.mask!=o||u.context!=s)&&(this.updateCachedToken(u,l,e),u.mask=o,u.context=s),u.lookAhead>u.end+25&&(a=Math.max(u.lookAhead,a)),0!=u.value)){let r=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!l.extend&&(n=u,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||((n=new bl).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 bl,{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 a=o.stateSlot(i,e?2:1);;a+=3){if(65535==s[a]){if(1==s[a+1])a=bC(s,a+2);else{0==r&&2==s[a+1]&&(r=this.putAction(bC(s,a+2),t,n,r));break}}s[a]==t&&(r=this.putAction(bC(s,a+1),t,n,r))}return r}}class bb{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 bc(t,r),this.tokens=new by(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[br.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>4*e.bufferLength?new bv(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 bp&&console.log("Finish with "+this.stackID(t)),this.stackToTree(t);if(this.parser.strict)throw bp&&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 bp&&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=bp?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(fk.contextHash)||0)==n))return e.useNode(s,r),bp&&console.log(o+this.stackID(e)+` (via reuse of ${i.getName(s.type.id)})`),!0;if(!(s instanceof fR)||0==s.children.length||s.positions[0]>0)break;let a=s.children[0];if(a instanceof fR&&0==s.positions[0])s=a;else break}}let s=i.stateSlot(e.state,4);if(s>0)return e.reduce(s),bp&&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 a=this.tokens.getActions(e);for(let s=0;s<a.length;){let l=a[s++],u=a[s++],c=a[s++],h=s==a.length||!n,d=h?e:e.split(),f=this.tokens.mainToken;if(d.apply(l,u,f?f.start:d.pos,c),bp&&console.log(o+this.stackID(d)+` (via ${(65536&l)==0?"shift":`reduce of ${i.getName(65535&l)}`} for ${i.getName(u)} @ ${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 bx(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=t[o<<1],l=t[(o<<1)+1],u=bp?this.stackID(s)+" -> ":"";if(s.deadEnd&&(i||(i=!0,s.restart(),bp&&console.log(u+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))))continue;let c=s.split(),h=u;for(let e=0;c.forceReduce()&&e<10&&(bp&&console.log(h+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,n));e++)bp&&(h=this.stackID(c)+" -> ");for(let e of s.recoverByInsert(a))bp&&console.log(u+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),bp&&console.log(u+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),bx(s,n)):(!r||r.score<s.score)&&(r=s)}return r}stackToTree(e){return e.close(),fR.build({buffer:bs.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=(bm||(bm=new WeakMap)).get(e);return t||bm.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function bx(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 bw{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}class bS extends fY{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=fk[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 fD(t.map((t,i)=>fA.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=ba(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(bk),this.states=ba(e.states,Uint32Array),this.data=ba(e.stateData),this.goto=ba(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>"number"==typeof e?new bh(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 bb(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=bC(n,i+2)];else if(2==n[i+1])return bC(n,i+2);else break}if(o==t||0==o)return bC(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=bC(this.data,n+2);else break}r=t(bC(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=bC(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(bS.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]=bk(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 bw(e,n,r)}static deserialize(e){return new bS(e)}}function bC(e,t){return e[t]|e[t+1]<<16}function bk(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}let bM=f2({String:pd.string,Number:pd.number,"True False":pd.bool,PropertyName:pd.propertyName,Null:pd.null,", :":pd.separator,"[ ]":pd.squareBracket,"{ }":pd.brace}),bT=bS.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:[bM],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}),bA=()=>e=>{try{JSON.parse(e.state.doc.toString())}catch(o){var t,n;let r;if(!(o instanceof SyntaxError))throw o;let i=(t=o,n=e.state.doc,(r=t.message.match(/at position (\d+)/))?Math.min(+r[1],n.length):(r=t.message.match(/at line (\d+) column (\d+)/))?Math.min(n.line(+r[1]).from+ +r[2]-1,n.length):0);return[{from:i,message:o.message,severity:"error",to:i}]}return[]},bD=pv.define({name:"json",parser:bT.configure({props:[pj.add({Object:pB({except:/^\s*\}/}),Array:pB({except:/^\s*\]/})}),pz.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 bE(e){let t=(0,eX.Z)(),n="dark"===t.palette.mode,[r,i]=(0,m.useState)(()=>JSON.stringify(e.value,null,2)),[o,s]=(0,m.useState)(r);return(0,m.useEffect)(()=>{i(JSON.stringify(e.value,null,2))},[e.value]),(0,p.jsx)(bn,{...e,style:{border:`1px solid ${t.palette.divider}`},theme:n?"dark":"light",extensions:[new pD(bD),function(e,t={}){return[yP.of({source:e,config:t}),yR,yU]}(bA()),function(e={}){return[yK.of(e),y$,yH,yG,yq]}()],value:r,onChange:e=>{i(e)},onBlur:()=>{o!==r&&void 0!==e.onChange&&(e.onChange(r),s(r))},placeholder:e.placeholder})}var bO=n(44811),bR=n(98857),bP=n(219),bI=n(17846),bN=n(55328),bj=n(4665),bL=n(20461);function bF(e,t){if(t){let n=t.toLowerCase();if("local"!==n&&"browser"!==n)return{...e,timeZone:"utc"===n?"UTC":t}}return e}function bZ(e,t,n){let r=n?.toLowerCase();return n&&"local"!==r&&"browser"!==r?(0,bj.formatInTimeZone)(e,"utc"===r?"UTC":n,t):(0,bL.format)(e,t)}function bB(e,t,n){let r=bF({hour:"numeric",minute:"numeric",hourCycle:"h23"},n);return t<=18e5?r.second="numeric":t>=864e5&&(r.month="numeric",r.day="numeric"),new Intl.DateTimeFormat(void 0,r).format(e).replace(/, /g," ")}function bV(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 bz=e=>{if(!e)return{formattedDate:"",formattedTime:""};let t=new Date(e);return{formattedDate:(0,bL.format)(t,"MMM dd, yyyy - "),formattedTime:(0,bL.format)(t,"HH:mm:ss")}},b_=(0,m.createContext)(void 0);function bH(e){let{children:t,timeZone:n}=e;return(0,p.jsx)(b_.Provider,{value:n,children:t})}function b$(){let e=(0,m.useContext)(b_);return{timeZone:e??"local",formatWithUserTimeZone:(t,n)=>bZ(t,n,e),dateFormatOptionsWithUserTimeZone:t=>bF(t,e)}}let bW=375,bq=650,bG=650,bU=500,bK=.75,bY=8,bX=750,bQ="nearby series showing in tooltip",bJ="emphasized series showing as bold in tooltip",b0="#2E313E",b1=new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0}),b2={coords:{plotCanvas:{x:0,y:0},zrender:{x:0,y:0},target:null},chartWidth:0},b5=[],b3={ie:navigator.userAgent.match(/MSIE\s([\d.]+)/)||navigator.userAgent.match(/Trident\/.+?rv:(([\d.]+))/),edge:navigator.userAgent.match(/Edge?\/([\d.]+)/)},b4="onpointerdown"in window&&(b3.edge||b3.ie&&b3.ie[1]&&+b3.ie[1]>=11),b8=b4?"pointermove":"mousemove",b6=()=>{let[e,t]=(0,m.useState)(null);return(0,m.useEffect)(()=>{let e=e=>t({page:{x:e.pageX,y:e.pageY},client:{x:e.clientX,y:e.clientY},plotCanvas:{x:e.zrX,y:e.zrY},target:e.target});return window.addEventListener(b8,e),()=>{window.removeEventListener(b8,e)}},[]),e},b9={wrapLabels:!0,enablePinning:!0},b7="Click chart to pin",xe="Click chart to unpin";var xt=n(7444),xn=n(4338),xr=n.n(xn);function xi(e){let{markerColor:t,sx:n}=e;return(0,p.jsx)(W.Z,{sx:ir({display:"inline-block",width:"11px",height:"11px",borderRadius:"2px",marginRight:1,verticalAlign:"top"},n),style:{backgroundColor:t}})}function xo(e){let{formattedY:t,markerColor:n,metricName:r,metricLabels:i}=e;return(0,p.jsxs)(ed.Z,{spacing:.5,children:[(0,p.jsxs)(W.Z,{sx:e=>({display:"flex",height:"16px",flexDirection:"row",alignItems:"center",justifyContent:"left",color:e.palette.common.white,fontSize:"11px"}),children:[(0,p.jsx)(xi,{markerColor:n,sx:{marginTop:.25}}),(0,p.jsxs)(W.Z,{component:"span",children:[r,(0,p.jsx)(W.Z,{component:"span",sx:e=>({color:e.palette.common.white,fontWeight:700,paddingLeft:"2px"}),children:t})]})]}),(0,p.jsx)(af.Z,{sx:e=>({borderColor:e.palette.grey["500"]})}),(0,p.jsx)(W.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,p.jsxs)(W.Z,{sx:{display:"flex",gap:"4px"},children:[(0,p.jsx)(i6.Z,{sx:{fontSize:"11px"},children:r}),(0,p.jsx)(i6.Z,{sx:e=>({color:e.palette.common.white,fontWeight:700,fontSize:"11px"}),children:i})]},e)}})})]})}function xs(e){let{seriesName:t,formattedY:n,markerColor:r,totalSeries:i,emphasizeText:o=!1,wrapLabels:s=!0}=e,a=t.split("{"),l=(a[1]??t).replace(/[{}]/g,"").split(",");if(1===i&&l.length>1){let e=a[0]?`${a[0]}:`:"value:";return(0,p.jsx)(xo,{formattedY:n,metricName:e,metricLabels:l,markerColor:r})}let u=t.replace(/[,]/g,", ");return(0,p.jsxs)(W.Z,{sx:{display:"table-row",paddingTop:.5},children:[(0,p.jsxs)(W.Z,{sx:{display:"table-cell",maxWidth:"520px"},children:[(0,p.jsx)(xi,{markerColor:r,sx:{marginTop:.5}}),(0,p.jsx)(W.Z,{component:"span",sx:e=>({display:"inline-block",width:"calc(100% - 20px)",minWidth:150,maxWidth:bU,overflow:"hidden",color:e.palette.common.white,fontWeight:o?e.typography.fontWeightBold:e.typography.fontWeightRegular,textOverflow:"ellipsis",whiteSpace:s?"normal":"nowrap"}),"aria-label":o?bJ:bQ,children:u})]}),(0,p.jsx)(W.Z,{sx:e=>({display:"table-cell",paddingLeft:1.5,textAlign:"right",verticalAlign:"top",fontWeight:o?e.typography.fontWeightBold:e.typography.fontWeightRegular}),children:n})]})}function xa(e){let{series:t,wrapLabels:n}=e,r=(0,m.useMemo)(()=>null===t?null:t.sort((e,t)=>e.y>t.y?-1:1),[t]);return null===t||null===r?null:(0,p.jsx)(W.Z,{sx:e=>({display:"table",padding:e.spacing(.5,2)}),children:r.map(({datumIdx:e,seriesIdx:t,seriesName:i,y:o,formattedY:s,markerColor:a,isClosestToCursor:l})=>{if(null===e||null===t)return null;let u=t.toString()+e.toString();return(0,p.jsx)(xs,{seriesName:i,y:o,formattedY:s,markerColor:a,totalSeries:r.length,wrapLabels:n,emphasizeText:l},u)})})}var xl=n(87895),xu=n(1889),xc=n(75186);let xh=(0,m.memo)(function({nearbySeries:e,totalSeries:t,isTooltipPinned:n,showAllSeries:r,enablePinning:i=!0,onShowAllClick:o,onUnpinClick:s}){let a=e[0]?.date??null;if(null===a)return null;let l=i&&t>5;return(0,p.jsxs)(W.Z,{sx:e=>({width:"100%",maxWidth:bq,padding:e.spacing(1.5,2,.5,2),backgroundColor:e.palette.designSystem?.grey[800]??b0,position:"sticky",top:0,left:0}),children:[(0,p.jsxs)(W.Z,{sx:{width:"100%",display:"flex",justifyContent:"start",alignItems:"center",paddingBottom:.5},children:[(e=>{let{formattedTime:t,formattedDate:n}=bz(e);return(0,p.jsxs)(W.Z,{children:[(0,p.jsx)(i6.Z,{variant:"caption",sx:e=>({color:e.palette.common.white}),children:n}),(0,p.jsx)(i6.Z,{variant:"caption",children:(0,p.jsx)("strong",{children:t})})]})})(a),(0,p.jsxs)(ed.Z,{direction:"row",gap:1,sx:{marginLeft:"auto"},children:[l&&(0,p.jsxs)(ed.Z,{direction:"row",gap:.5,alignItems:"center",sx:{textAlign:"right"},children:[(0,p.jsx)(i6.Z,{sx:{fontSize:11},children:"Show All"}),(0,p.jsx)(xl.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,p.jsxs)(ed.Z,{direction:"row",alignItems:"center",children:[(0,p.jsx)(i6.Z,{sx:{marginRight:.5,fontSize:11,verticalAlign:"middle"},children:n?xe:b7}),n?(0,p.jsx)(xu.default,{onClick:()=>{void 0!==s&&s()},sx:{fontSize:16,cursor:"pointer"}}):(0,p.jsx)(xc.default,{sx:{fontSize:16}})]})]})]}),(0,p.jsx)(af.Z,{sx:e=>({width:"100%",borderColor:e.palette.grey["500"]})})]})}),xd=1e3,xf="Pinned Crosshair",xp={name:xf,type:"line",markLine:{data:[],lineStyle:{type:"dashed",width:2},emphasis:{lineStyle:{width:2,opacity:1}},blur:{lineStyle:{width:2,opacity:1}}}};function xm(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 xg(e){e.dispatchAction({type:"restore"})}function xv(e){void 0!==e.dispatchAction&&(e.dispatchAction({type:"unselect"}),e.dispatchAction({type:"downplay"}))}function xy(e,t,n){if(void 0===n)return null;let r=[e,t];return n.containPixel("grid",r)?n.convertFromPixel("grid",r):null}function xb(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 xx(e){return e[e.length-1]?.name===xf}function xw(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 xS(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=xw(o.values,t)}return r}let xC=5.5,xk=30,xM=5;function xT(e,t,n,r,i,o){let s=[],a=n[0]??null,l=n[1]??null;if(null===a||null===l||void 0===i.dispatchAction||!Array.isArray(e))return s;let u=[],c=[],h=[],d=[],f=[],p=e.length,m=new Map,g=xw(e[0]?.values,a);if(null===g)return b5;for(let n=0;n<p;n++){let a=t[n];if(!a)break;let v=p>0?e[n]:null;if(!v)break;let y=v.values;if(void 0===y||!Array.isArray(y))break;let b=a.name?a.name.toString():"",x=a.color??"#000";if(Array.isArray(e))for(let e=0;e<y.length;e++){let t=y[e];if(void 0===t||!Array.isArray(t))break;let a=t[0],v=t[1];if(null!=v&&g===a&&l<=v+r&&l>=v-r){let t=xO({valueToCheck:l,baseValue:v,percentage:Math.max(p>xM?2:5,100/p)});if(t){c.push(n);let t=m.get(v)??0;m.set(v,t+1),t>0&&f.push({seriesIndex:n,dataIndex:e,seriesName:b,yValue:v}),d.push({seriesIndex:n,dataIndex:e,seriesName:b,yValue:v})}else h.push(n),i.dispatchAction({type:"downplay",seriesIndex:n});let r=(0,F.Bw)(v,o);s.push({seriesIdx:n,datumIdx:e,seriesName:b,date:g,x:a,y:v,formattedY:r,markerColor:x.toString(),isClosestToCursor:t}),u.push(n)}}}return xb(i,u,c,h,d,f),s}function xA(e,t,n,r,i){let o=[],s=t[0]??null,a=t[1]??null;if(null===s||null===a)return o;let l=[],u=[],c=[],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>=xd)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&&a<=v+n&&a>=v-n){let e=xO({valueToCheck:a,baseValue:v,percentage:Math.max(h>xM?2:5,100/h)});e?u.push(t):(c.push(t),r?.dispatchAction!==void 0&&r.dispatchAction({type:"downplay",seriesIndex:t}));let n=g>0x174876e7ff?g:1e3*g,s=(0,F.Bw)(v,i);o.push({seriesIdx:t,datumIdx:m,seriesName:f,date:n,x:g,y:v,formattedY:s,markerColor:p.toString(),isClosestToCursor:e}),l.push(t)}}}return r?.dispatchAction!==void 0&&(r.dispatchAction({type:"downplay",seriesIndex:c}),u.length>0?r.dispatchAction({type:"highlight",seriesIndex:u,notBlur:!1,escapeConnect:!0}):r.dispatchAction({type:"highlight",seriesIndex:l,notBlur:!0,escapeConnect:!0})),o}function xD({mousePos:e,pinnedPos:t,data:n,seriesMapping:r,chart:i,format:o,showAllSeries:s=!1}){if(void 0===i||null===e)return b5;let a=!1;if(null!==e.target){let t=e.target.parentElement;if(null!==t){let e=t.parentElement;null!==e&&i.getDom()===e&&(a=!0)}}if(null!==t&&(e=t,a=!0),!1===a||null===n||void 0===i._model||void 0===e.plotCanvas.x||void 0===e.plotCanvas.y)return b5;let l=xy(e.plotCanvas.x,e.plotCanvas.y,i);if(null!==l){let e=xR({yInterval:i._model.getComponent("yAxis").axis.scale._interval,totalSeries:n.length,showAllSeries:s});return xT(n,r,l,e,i,o)}return b5}function xE({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 a=xR({yInterval:r._model.getComponent("yAxis").axis.scale._interval,totalSeries:n.timeSeries.length,showAllSeries:o}),l=[e.plotCanvas.x??0,e.plotCanvas.y??0];if(r.containPixel("grid",l)){let e=r.convertFromPixel("grid",l);if(void 0!==e[0]&&void 0!==e[1])return xA(n,e,a,r,i)}return[]}function xO({valueToCheck:e,baseValue:t,percentage:n}){let r=n/100*t;return e>=t-r&&e<=t+r}function xR({yInterval:e,totalSeries:t,showAllSeries:n=!1}){if(n)return 10*e;let r=.3*e;return t>xM?Math.max(r,e*xk/t):Math.max(r,e*xC)}function xP(e,t,n,r,i,o){let s;if(null===e||(null!==n&&(e=n),void 0===e.plotCanvas.x))return;let a=e.page.x,l=e.page.y+16;return o&&(a=a-(s=o.getBoundingClientRect()).left+o.scrollLeft,l=l-s.top+o.scrollTop),e.client.y+r+16>window.innerHeight&&(l-=r*bK,s&&l<s.top&&(l=bY/2)),e.plotCanvas.x>t-.9*i&&a>bq?`translate3d(${a-32}px, ${l}px, 0) translateX(-100%)`:`translate3d(${a+32}px, ${l}px, 0)`}function xI(e,t,n){return{minWidth:bW,maxWidth:bq,maxHeight:(n?n-bY:void 0)??bG,padding:0,position:"absolute",top:0,left:0,backgroundColor:e.palette.designSystem?.grey[800]??b0,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 xN=(0,m.memo)(function({chartRef:e,chartData:t,enablePinning:n=!0,wrapLabels:r,format:i,onUnpinClick:o,pinnedPos:s,containerId:a}){let[l,u]=(0,m.useState)(!1),c=b6(),{height:h,width:d,ref:f}=xr()(),g=(0,m.useRef)(),v=null!==s&&n;if(null===c||null===c.target||null===s&&"CANVAS"!==c.target.tagName)return null;let y=e.current,b=y?.getWidth()??bX,x=xE({mousePos:c,chartData:t,pinnedPos:s,chart:y,format:i,showAllSeries:l});if(0===x.length)return null;let w=t.timeSeries.length,S=a?document.querySelector(a):void 0,C=S?S.getBoundingClientRect().height:void 0;return v||(g.current=xP(c,b,s,h??0,d??0,S)),(0,p.jsx)(xt.Z,{container:S,children:(0,p.jsx)(W.Z,{ref:f,sx:e=>({minWidth:bW,maxWidth:bq,maxHeight:C??bG,padding:0,position:"absolute",top:0,left:0,backgroundColor:e.palette.designSystem?.grey[800]??b0,borderRadius:"6px",color:"#fff",fontSize:"11px",visibility:"visible",opacity:1,transition:"all 0.1s ease-out",zIndex:null!==s?"auto":e.zIndex.tooltip,overflow:"hidden","&:hover":{overflowY:"auto"}}),style:{transform:g.current,display:g.current?"block":"none"},children:(0,p.jsxs)(ed.Z,{spacing:.5,children:[(0,p.jsx)(xh,{nearbySeries:x,totalSeries:w,enablePinning:n,isTooltipPinned:v,showAllSeries:l,onShowAllClick:e=>u(e),onUnpinClick:o}),(0,p.jsx)(xa,{series:x,wrapLabels:r})]})})})});(0,Z.D)([bO.N,V.N,en.N,bR.N,bP.N,bI.N,_.N,bN.N,H.N,er.N,$.N]);let xj=(0,m.forwardRef)(function({height:e,data:t,yAxis:n,format:r,grid:i,legend:o,tooltipConfig:s=b9,noDataVariant:a="message",syncGroup:l,onDataZoom:u,onDoubleClick:c,__experimentalEChartsOptionsOverride:h},d){let f=K(),g=(0,m.useRef)(),[v,y]=(0,m.useState)(!0),[b,x]=(0,m.useState)(null),{timeZone:w}=b$(),[S,C]=(0,m.useState)(!1),[k,M]=(0,m.useState)(0);(0,m.useImperativeHandle)(d,()=>({highlightSeries({id:e}){g.current&&g.current.dispatchAction({type:"highlight",seriesId:e})},clearHighlightedSeries:()=>{g.current&&xv(g.current)}}),[]);let T=(0,m.useMemo)(()=>({datazoom:e=>{if(void 0===u&&setTimeout(()=>{x(null)},10),void 0===u||void 0===e.batch[0])return;let n=e.batch[0].startValue??0,r=e.batch[0].endValue??t.xAxis.length-1,i=t.xAxis[n],o=t.xAxis[r];void 0!==i&&void 0!==o&&u({start:i,end:o,startIndex:n,endIndex:r})}}),[t,u,x]);void 0!==g.current&&xm(g.current);let{noDataOption:A}=f,D=(0,m.useMemo)(()=>{if(void 0===t.timeSeries)return{};if(null===t.timeSeries||0===t.timeSeries.length&&"message"===a)return A;let e=t.rangeMs??ec(t.xAxis),s={series:t.timeSeries,xAxis:{type:"category",data:t.xAxis,max:t.xAxisMax,axisLabel:{formatter:t=>bB(t,e,w)}},yAxis:eu(n,r),animation:!1,tooltip:{show:!0,trigger:"axis",showContent:!1},axisPointer:{type:"line",z:0,triggerEmphasis:!1,triggerTooltip:!1,snap:!0},toolbox:{feature:{dataZoom:{icon:null,yAxisIndex:"none"}}},grid:i,legend:o};return h?h(s):s},[t,n,r,i,o,A,w,h,a]);return(0,p.jsxs)(W.Z,{style:{height:e},onClick:e=>{s.enablePinning&&e.target instanceof HTMLCanvasElement&&x(t=>null===t?{page:{x:e.pageX,y:e.pageY},client:{x:e.clientX,y:e.clientY},plotCanvas:{x:e.nativeEvent.offsetX,y:e.nativeEvent.offsetY},target:e.target}:null)},onMouseDown:e=>{let{clientX:t}=e;C(!0),M(t)},onMouseMove:e=>{if(!(e.target instanceof HTMLCanvasElement))return;let{clientX:t}=e;S&&t-k>0&&y(!1)},onMouseUp:()=>{C(!1),M(0),y(!0)},onMouseLeave:()=>{null===b&&y(!1),void 0!==g.current&&xv(g.current)},onMouseEnter:()=>{y(!0),void 0!==g.current&&xm(g.current)},onDoubleClick:e=>{x(null),void 0===c?void 0!==g.current&&xg(g.current):c(e)},children:[!0===v&&D.tooltip?.showContent===!1&&!0!==s.hidden&&(0,p.jsx)(xN,{chartRef:g,chartData:t,wrapLabels:s.wrapLabels,enablePinning:s.enablePinning,pinnedPos:b,format:r,onUnpinClick:()=>{x(null)},containerId:f.tooltipPortalContainerId}),(0,p.jsx)(es,{sx:{width:"100%",height:"100%"},option:D,theme:f.echartsTheme,onEvents:T,_instance:g,syncGroup:l})]})});var xL=n(28797),xF=n(36679),xZ=n(33755),xB=n(86396);function xV({control:e,...t}){let{fields:n,append:r,remove:i}=(0,xF.useFieldArray)({control:e,name:"panelDefinition.spec.links"});return(0,p.jsxs)(ed.Z,{...t,gap:3,children:[n&&n.length>0?n.map((t,n)=>(0,p.jsxs)(m.Fragment,{children:[(0,p.jsxs)(ed.Z,{direction:"row",gap:1,alignItems:"center",children:[(0,p.jsx)(xz,{control:e,index:n}),(0,p.jsx)(ef.Z,{style:{width:"fit-content",height:"fit-content"},onClick:()=>i(n),children:(0,p.jsx)(xB.default,{})})]}),(0,p.jsx)(af.Z,{})]},t.id)):(0,p.jsx)(i6.Z,{variant:"subtitle1",mb:2,fontStyle:"italic",children:"No links defined"}),(0,p.jsx)(ef.Z,{style:{width:"fit-content",height:"fit-content"},onClick:()=>r({url:""}),children:(0,p.jsx)(xZ.default,{})})]})}function xz({control:e,index:t}){return(0,p.jsxs)(ed.Z,{gap:2,flexGrow:1,children:[(0,p.jsxs)(ed.Z,{direction:"row",gap:2,children:[(0,p.jsx)(xF.Controller,{control:e,name:`panelDefinition.spec.links.${t}.url`,render:({field:e,fieldState:t})=>(0,p.jsx)(ep.Z,{...e,required:!0,fullWidth:!0,label:"URL",error:!!t.error,helperText:t.error?.message,onChange:t=>{e.onChange(t)}})}),(0,p.jsx)(xF.Controller,{control:e,name:`panelDefinition.spec.links.${t}.name`,render:({field:e,fieldState:t})=>(0,p.jsx)(ep.Z,{...e,fullWidth:!0,label:"Name",defaultValue:"",error:!!t.error,helperText:t.error?.message,onChange:t=>{e.onChange(t)}})}),(0,p.jsx)(xF.Controller,{control:e,name:`panelDefinition.spec.links.${t}.tooltip`,render:({field:e,fieldState:t})=>(0,p.jsx)(ep.Z,{...e,fullWidth:!0,label:"Tooltip",defaultValue:"",error:!!t.error,helperText:t.error?.message,onChange:t=>{e.onChange(t)}})})]}),(0,p.jsxs)(ed.Z,{gap:2,direction:"row",alignItems:"center",children:[(0,p.jsx)(xF.Controller,{control:e,name:`panelDefinition.spec.links.${t}.renderVariables`,render:({field:e})=>(0,p.jsx)(xL.Z,{label:"Render Variables",control:(0,p.jsx)(ox.Z,{...e,checked:e.value,onChange:t=>e.onChange(t.target.checked)})})}),(0,p.jsx)(xF.Controller,{control:e,name:`panelDefinition.spec.links.${t}.targetBlank`,render:({field:e})=>(0,p.jsx)(xL.Z,{label:"Open in new tab",control:(0,p.jsx)(ox.Z,{...e,checked:e.value,onChange:t=>e.onChange(t.target.checked)})})})]})]})}let x_=[{id:"value",label:"Value"},{id:"percentage",label:"Percentage"}];function xH({disablePercentageMode:e,onChange:t,value:n="value"}){return(0,p.jsx)(oQ,{label:"Mode",control:(0,p.jsx)(o1,{value:x_.find(e=>e.id===n),options:x_,getOptionLabel:e=>e.label,getOptionDisabled:t=>"percentage"===t.id&&e,onChange:(e,{id:n})=>{t(n)},disableClearable:!0})})}var x$=n(38359);let xW=({children:e})=>(0,p.jsx)(x$.ZP,{item:!0,xs:4,children:(0,p.jsx)(ed.Z,{spacing:3,children:e})}),xq=({children:e})=>(0,p.jsx)(x$.ZP,{container:!0,spacing:8,children:e}),xG=({title:e,children:t,icon:n})=>(0,p.jsxs)(W.Z,{children:[(0,p.jsxs)(W.Z,{display:"flex",borderBottom:1,borderColor:"grey.300",marginBottom:e=>e.spacing(1),children:[(0,p.jsx)(i6.Z,{variant:"overline",component:"h4",children:e}),n&&(0,p.jsx)(W.Z,{sx:{marginLeft:"auto"},children:n})]}),(0,p.jsx)(ed.Z,{spacing:1,children:t})]});var xU=n(66224);function xK(e){let{message:t}=e;return(0,p.jsx)(ed.Z,{sx:{height:"100%",alignItems:"center",justifyContent:"center"},children:(0,p.jsx)(i6.Z,{children:t})})}function xY(e){let{resource:t}=e;return(0,p.jsx)(xK,{message:`No ${t}`})}function xX(e){let{variant:t="rounded"}=e;return(0,p.jsx)(ed.Z,{sx:{height:"100%",alignItems:"center",justifyContent:"center",px:1},children:(0,p.jsx)(xU.Z,{variant:t,width:"100%",height:"30%","aria-label":"Loading..."})})}let xQ=[{id:"asc",label:"Ascending"},{id:"desc",label:"Descending"}];function xJ({onChange:e,value:t="desc"}){return(0,p.jsx)(oQ,{label:"Sort",control:(0,p.jsx)(o1,{value:xQ.find(e=>e.id===t),options:xQ,getOptionLabel:e=>e.label,onChange:(t,{id:n})=>{e(n)},disableClearable:!0})})}function x0({onChange:e,value:t,...n}){let r=t=>{e(t)};return(0,p.jsxs)(N,{"aria-label":"Sort",...n,children:[(0,p.jsx)(j.Z,{onClick:()=>r(void 0),variant:void 0===t?"contained":"outlined",children:"None"}),(0,p.jsx)(j.Z,{onClick:()=>r("asc"),variant:"asc"===t?"contained":"outlined",children:"Asc"}),(0,p.jsx)(j.Z,{onClick:()=>r("desc"),variant:"desc"===t?"contained":"outlined",children:"Desc"})]})}function x1({text:e,fontWeight:t,width:n,height:r,lineHeight:i,maxSize:s,fontSizeOverride:a}){let l=function(){if(!o&&null===(o=document.createElement("canvas").getContext("2d")))throw Error("Canvas context is null.");return o}(),{echartsTheme:u}=K();if(void 0!==a)return Number(a);let c=u.textStyle,h=Number(c?.fontSize)??12,d=c?.fontFamily??"Lato",f=`${t} ${h}px ${d}`;l.font=f;let p=Math.min(r/i,n/l.measureText(e).width*h);return s?Math.min(p,s):p}let x2=(e,t)=>null===e?"null":"number"==typeof e?(0,F.Bw)(e,t):void 0===e?"":e;(0,Z.D)([bO.N,V.N,z.N,_.N,H.N,$.N]);let x5=e=>{let{width:t,height:n,data:r,sparkline:i,showSeriesName:o,format:s,valueFontSize:a}=e,l=K(),u=r.color,c=x2(r.calculatedValue,s),h=l.container.padding.default,d=x1({text:r?.seriesData?.name??"",fontWeight:400,width:t,height:.125*n,lineHeight:1.2,maxSize:30}),f=o?1.2*d+h:0,g=t-2*h,v=n-f,y=x1({text:c,fontSizeOverride:a,fontWeight:700,width:i?g:.5*g,height:i?.25*v:.9*v,lineHeight:1.2}),b=1.2*y;d=Math.min(.7*y,d);let x=(0,m.useMemo)(()=>{if(void 0===r.seriesData)return l.noDataOption;let e=r.seriesData,t=[];if(void 0!==i){let n={type:"line",name:e.name,data:e.values,zlevel:1,symbol:"none",animation:!1,silent:!0},r=el()(n,i);t.push(r)}return{title:{show:!1},grid:{show:!1,top:"35%",right:0,bottom:0,left:0,containLabel:!1},xAxis:{type:"time",show:!1,boundaryGap:!1},yAxis:{type:"value",show:!1,min:e=>e.min>=0&&e.min<=1?0:e.min},tooltip:{show:!1},series:t}},[r,l,i]),w=i?"auto":"center";return(0,p.jsxs)(W.Z,{sx:{height:"100%",width:"100%",display:"flex",flexDirection:"column",justifyContent:w,alignItems:w},children:[o&&(0,p.jsx)(x3,{padding:h,fontSize:d,children:r.seriesData?.name}),(0,p.jsx)(x4,{variant:"h3",color:u,fontSize:y,padding:h,children:c}),void 0!==i&&(0,p.jsx)(es,{sx:{width:"100%",height:n-f-b},option:x,theme:l.echartsTheme,renderer:"svg"})]})},x3=(0,S.ZP)(i6.Z,{shouldForwardProp:e=>"padding"!==e&&"fontSize"!==e})(({theme:e,padding:t,fontSize:n})=>({color:e.palette.text.secondary,padding:`${t}px`,fontSize:`${n}px`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),x4=(0,S.ZP)(i6.Z,{shouldForwardProp:e=>"color"!==e&&"padding"!==e&&"fontSize"!==e&&"sparkline"!==e})(({theme:e,color:t,padding:n,fontSize:r,sparkline:i})=>({color:t??e.palette.text.primary,fontSize:`${r}px`,padding:i?`${n}px ${n}px 0 ${n}px`:` 0 ${n}px`,whiteSpace:"nowrap",lineHeight:1.2}));function x8(e){return(0,A.ZP)("MuiToggleButtonGroup",e)}let x6=(0,T.Z)("MuiToggleButtonGroup",["root","selected","horizontal","vertical","disabled","grouped","groupedHorizontal","groupedVertical","fullWidth","firstButton","lastButton","middleButton"]),x9=m.createContext({}),x7=m.createContext(void 0);function we(e){return(0,A.ZP)("MuiToggleButton",e)}let wt=(0,T.Z)("MuiToggleButton",["root","disabled","selected","standard","primary","secondary","sizeSmall","sizeMedium","sizeLarge","fullWidth"]),wn=e=>{let{classes:t,orientation:n,fullWidth:r,disabled:i}=e,o={root:["root",n,r&&"fullWidth"],grouped:["grouped",`grouped${(0,w.Z)(n)}`,i&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return(0,y.Z)(o,x8,t)},wr=(0,S.ZP)("div",{name:"MuiToggleButtonGroup",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${x6.grouped}`]:t.grouped},{[`& .${x6.grouped}`]:t[`grouped${(0,w.Z)(n.orientation)}`]},{[`& .${x6.firstButton}`]:t.firstButton},{[`& .${x6.lastButton}`]:t.lastButton},{[`& .${x6.middleButton}`]:t.middleButton},t.root,"vertical"===n.orientation&&t.vertical,n.fullWidth&&t.fullWidth]}})((0,C.Z)(({theme:e})=>({display:"inline-flex",borderRadius:(e.vars||e).shape.borderRadius,variants:[{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${x6.grouped}`]:{[`&.${x6.selected} + .${x6.grouped}.${x6.selected}`]:{borderTop:0,marginTop:0}},[`& .${x6.firstButton},& .${x6.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${x6.lastButton},& .${x6.middleButton}`]:{marginTop:-1,borderTop:"1px solid transparent",borderTopLeftRadius:0,borderTopRightRadius:0},[`& .${x6.lastButton}.${wt.disabled},& .${x6.middleButton}.${wt.disabled}`]:{borderTop:"1px solid transparent"}}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"horizontal"},style:{[`& .${x6.grouped}`]:{[`&.${x6.selected} + .${x6.grouped}.${x6.selected}`]:{borderLeft:0,marginLeft:0}},[`& .${x6.firstButton},& .${x6.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${x6.lastButton},& .${x6.middleButton}`]:{marginLeft:-1,borderLeft:"1px solid transparent",borderTopLeftRadius:0,borderBottomLeftRadius:0},[`& .${x6.lastButton}.${wt.disabled},& .${x6.middleButton}.${wt.disabled}`]:{borderLeft:"1px solid transparent"}}}]}))),wi=m.forwardRef(function(e,t){let n=(0,M.i)({props:e,name:"MuiToggleButtonGroup"}),{children:r,className:i,color:o="standard",disabled:s=!1,exclusive:a=!1,fullWidth:l=!1,onChange:u,orientation:c="horizontal",size:h="medium",value:d,...f}=n,g={...n,disabled:s,fullWidth:l,orientation:c,size:h},y=wn(g),b=m.useCallback((e,t)=>{let n;if(!u)return;let r=d&&d.indexOf(t);d&&r>=0?(n=d.slice()).splice(r,1):n=d?d.concat(t):[t],u(e,n)},[u,d]),w=m.useCallback((e,t)=>{u&&u(e,d===t?null:t)},[u,d]),S=m.useMemo(()=>({className:y.grouped,onChange:a?w:b,value:d,size:h,fullWidth:l,color:o,disabled:s}),[y.grouped,a,w,b,d,h,l,o,s]),C=x(r),k=C.length,T=e=>{let t=0===e,n=e===k-1;return t&&n?"":t?y.firstButton:n?y.lastButton:y.middleButton};return(0,p.jsx)(wr,{role:"group",className:(0,v.Z)(y.root,i),ref:t,ownerState:g,...f,children:(0,p.jsx)(x9.Provider,{value:S,children:C.map((e,t)=>(0,p.jsx)(x7.Provider,{value:T(t),children:e},t))})})});var wo=n(16819);let ws=e=>{let{classes:t,fullWidth:n,selected:r,disabled:i,size:o,color:s}=e,a={root:["root",r&&"selected",i&&"disabled",n&&"fullWidth",`size${(0,w.Z)(o)}`,s]};return(0,y.Z)(a,we,t)},wa=(0,S.ZP)(r2.Z,{name:"MuiToggleButton",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`size${(0,w.Z)(n.size)}`]]}})((0,C.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,[`&.${wt.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,b.Fq)(e.palette.text.primary,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[{props:{color:"standard"},style:{[`&.${wt.selected}`]:{color:(e.vars||e).palette.text.primary,backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,b.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,b.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,b.Fq)(e.palette.text.primary,e.palette.action.selectedOpacity)}}}}},...Object.entries(e.palette).filter((0,k.Z)()).map(([t])=>({props:{color:t},style:{[`&.${wt.selected}`]:{color:(e.vars||e).palette[t].main,backgroundColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,b.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,b.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,b.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)}}]}))),wl=m.forwardRef(function(e,t){var n;let{value:r,...i}=m.useContext(x9),o=m.useContext(x7),s=(0,wo.Z)({...i,selected:(n=e.value,void 0!==r&&void 0!==n&&(Array.isArray(r)?r.includes(n):n===r))},e),a=(0,M.i)({props:s,name:"MuiToggleButton"}),{children:l,className:u,color:c="standard",disabled:h=!1,disableFocusRipple:d=!1,fullWidth:f=!1,onChange:g,onClick:y,selected:b,size:x="medium",value:w,...S}=a,C={...a,color:c,disabled:h,disableFocusRipple:d,fullWidth:f,size:x},k=ws(C);return(0,p.jsx)(wa,{className:(0,v.Z)(i.className,k.root,u,o||""),disabled:h,focusRipple:!d,ref:t,onClick:e=>{(!y||(y(e,w),!e.defaultPrevented))&&g&&g(e,w)},onChange:g,value:w,ownerState:C,"aria-pressed":b,...S,children:l})}),wu=(0,n(79886).Z)();var wc=n(22446);function wh({inputRef:e,label:t,color:n,value:r,mode:i,onChange:o,onColorChange:s,onBlur:a,onDelete:l}){let[u,c]=(0,m.useState)(0);return(0,p.jsxs)(ed.Z,{flex:1,direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[(0,p.jsx)(eK,{label:t,color:n,onColorChange:s}),(0,p.jsx)(o$.Z,{htmlFor:t,children:t}),(0,p.jsx)(ep.Z,{id:t,inputRef:e,type:"number",value:0===r?"":r,placeholder:"0",onChange:o,onBlur:a,onKeyDown:e=>{"Enter"===e.key&&(a(),c(u+1))},InputProps:{endAdornment:"percent"===i?(0,p.jsx)(W.Z,{paddingX:1,children:"%"}):void 0}},u),(0,p.jsx)(ef.Z,{"aria-label":`delete threshold ${t}`,size:"small",onClick:l,children:(0,p.jsx)(wc.default,{})})]})}function wd({thresholds:e,onChange:t,hideDefault:n,disablePercentMode:r}){let{thresholds:{defaultColor:i,palette:o}}=K(),s=e?.defaultColor??i,[a,l]=(0,m.useState)(e?.steps);(0,m.useEffect)(()=>{l(e?.steps)},[e?.steps]);let u=(0,m.useRef)(null),c=(0,m.useRef)(!1);(0,m.useEffect)(()=>{u.current&&c.current&&(u.current?.focus(),c.current=!1)},[a?.length]);let h=(e,t)=>{l((0,eJ.produce)(a,n=>{let r=n?.[t];r&&(r.value=Number(e.target.value))}))},d=(n,r)=>{void 0!==e&&t((0,eJ.produce)(e,e=>{if(void 0!==e.steps){let t=e.steps[r];t&&(t.color=n)}}))},f=()=>{if(void 0!==a){let n=[...a];n.sort((e,t)=>e.value-t.value),void 0!==e&&t((0,eJ.produce)(e,e=>{e.steps=n}))}},g=n=>{void 0!==e&&t((0,eJ.produce)(e,e=>{e.steps&&e.steps.splice(n,1)}))};return(0,p.jsxs)(xG,{title:"Thresholds",icon:(0,p.jsx)(oK,{description:"Add threshold",children:(0,p.jsx)(ef.Z,{size:"small","aria-label":"add threshold",onClick:()=>{c.current=!0,void 0===e?t({steps:[{value:10}]}):e&&void 0===e.steps?t((0,eJ.produce)(e,e=>{e.steps=[{value:10}]})):t((0,eJ.produce)(e,e=>{let t=e.steps;if(t?.length){let e=t[t.length-1],n=o[t.length]??wf();t.push({color:n,value:(e?.value??0)+10})}else t&&t.push({value:10})}))},children:(0,p.jsx)(xZ.default,{})})}),children:[(0,p.jsx)(oQ,{label:"Mode",description:"Percentage means thresholds relative to min & max",control:(0,p.jsxs)(wi,{exclusive:!0,disabled:r,value:e?.mode??"absolute",onChange:(n,r)=>{let i="percent"===r?"percent":void 0;void 0!==e?t((0,eJ.produce)(e,e=>{e.mode=i})):t({mode:i})},sx:{height:"36px",marginLeft:"auto"},children:[(0,p.jsx)(wl,{"aria-label":"absolute",value:"absolute",sx:{fontWeight:500},children:"Absolute"}),(0,p.jsx)(wl,{"aria-label":"percent",value:"percent",sx:{fontWeight:500},children:"Percent"})]})}),a&&a.map((t,n)=>(0,p.jsx)(wh,{inputRef:n===a.length-1?u:void 0,label:`T${n+1}`,color:t.color??o[n]??s,value:t.value,mode:e?.mode,onColorChange:e=>d(e,n),onChange:e=>{h(e,n)},onDelete:()=>{g(n)},onBlur:f},n)).reverse(),!n&&(0,p.jsxs)(wu,{flex:1,direction:"row",alignItems:"center",spacing:1,children:[(0,p.jsx)(eK,{label:"default",color:s,onColorChange:n=>{void 0!==e?t((0,eJ.produce)(e,e=>{e.defaultColor=n})):t({defaultColor:n})}}),(0,p.jsx)(i6.Z,{children:"Default"})]})]})}let wf=()=>"#"+Math.floor(0x1000000*Math.random()).toString(16).padStart(6,"0");function wp(e){return"number"==typeof e}function wm(e){return!!e&&"object"==typeof e&&"function"==typeof e.constructor&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function wg(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function wv(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function wy(e){return e&&!0===e.constructor.prototype.isUnit||!1}function wb(e){return"string"==typeof e}var wx=Array.isArray;function ww(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function wS(e){return Array.isArray(e)||ww(e)}function wC(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function wk(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function wM(e){return e&&!0===e.constructor.prototype.isRange||!1}function wT(e){return e&&!0===e.constructor.prototype.isIndex||!1}function wA(e){return"boolean"==typeof e}function wD(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function wE(e){return e&&!0===e.constructor.prototype.isHelp||!1}function wO(e){return"function"==typeof e}function wR(e){return e instanceof Date}function wP(e){return e instanceof RegExp}function wI(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!wg(e)&&!wv(e))}function wN(e){return null===e}function wj(e){return void 0===e}function wL(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function wF(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function wZ(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function wB(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function wV(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function wz(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function w_(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function wH(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function w$(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function wW(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function wq(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function wG(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function wU(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function wK(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function wY(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function wX(e){return e&&!0===e.constructor.prototype.isChain||!1}function wQ(e){var t=typeof e;return"object"===t?null===e?"null":Array.isArray(e)?"Array":e instanceof Date?"Date":e instanceof RegExp?"RegExp":wm(e)?"BigNumber":wg(e)?"Complex":wv(e)?"Fraction":ww(e)?"Matrix":wy(e)?"Unit":wT(e)?"Index":wM(e)?"Range":wD(e)?"ResultSet":wW(e)?e.type:wX(e)?"Chain":wE(e)?"Help":"Object":"function"===t?"Function":t}function wJ(e){var t=typeof e;if("number"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return wJ(e)});if(e instanceof Date)return new Date(e.valueOf());if(wm(e))return e;if(e instanceof RegExp)throw TypeError("Cannot clone "+e);return w0(e,wJ)}function w0(e,t){var n={};for(var r in e)w5(e,r)&&(n[r]=t(e[r]));return n}function w1(e,t){var n,r,i;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(r=0,i=e.length;r<i;r++)if(!w1(e[r],t[r]))return!1;return!0}if("function"==typeof e)return e===t;if(!(e instanceof Object))return e===t;if(Array.isArray(t)||!(t instanceof Object))return!1;for(n in e)if(!(n in t)||!w1(e[n],t[n]))return!1;for(n in t)if(!(n in e))return!1;return!0}function w2(e,t,n){var r,i=!0;Object.defineProperty(e,t,{get:function(){return i&&(r=n(),i=!1),r},set:function(e){r=e,i=!1},configurable:!0,enumerable:!0})}function w5(e,t){return e&&Object.hasOwnProperty.call(e,t)}function w3(e){return Object.keys(e).map(t=>e[t])}var w4=n(8317);function w8(e,t,n,r){function i(r){var i=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r],o=e[i];void 0!==o&&(n[i]=o)}return n}(r,t.map(w9));return function(e,t,n){if(!t.filter(e=>{var t;return!((t=e)&&"?"===t[0])}).every(e=>void 0!==n[e])){var r=t.filter(e=>void 0===n[e]);throw Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(r.map(e=>'"'.concat(e,'"')).join(", "),"."))}}(e,t,r),n(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),r&&(i.meta=r),i}function w6(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function w9(e){return e&&"?"===e[0]?e.slice(1):e}function w7(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function Se(e,t,n){var r="";if(n){if(n<1)throw Error("size must be in greater than 0");if(!w7(n))throw Error("size must be an integer");if(e>2**(n-1)-1||e<-(2**(n-1)))throw Error("Value must be in range [-2^".concat(n-1,", 2^").concat(n-1,"-1]"));if(!w7(e))throw Error("Value must be an integer");e<0&&(e+=2**n),r="i".concat(n)}var i="";return e<0&&(e=-e,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[t]).concat(e.toString(t)).concat(r)}function St(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var n,r,i="auto";if(t&&(t.notation&&(i=t.notation),wp(t)?n=t:wp(t.precision)&&(n=t.precision),t.wordSize&&"number"!=typeof(r=t.wordSize)))throw Error('Option "wordSize" must be a number');switch(i){case"fixed":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var n=Sn(e),r="number"==typeof t?Si(n,n.exponent+1+t):n,i=r.coefficients,o=r.exponent+1,s=o+(t||0);return i.length<s&&(i=i.concat(So(s-i.length))),o<0&&(i=So(-o+1).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),r.sign+i.join("")}(e,n);case"exponential":return Sr(e,n);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var n=Si(Sn(e),t),r=n.exponent,i=n.coefficients,o=r%3==0?r:r<0?r-3-r%3:r-r%3;if(wp(t))for(;t>i.length||r-o+1>i.length;)i.push(0);else for(var s=Math.abs(r-o)-(i.length-1),a=0;a<s;a++)i.push(0);for(var l=Math.abs(r-o),u=1;l>0;)u++,l--;var c=i.slice(u).join(""),h=wp(t)&&c.length||c.match(/[1-9]/)?"."+c:"",d=i.slice(0,u).join("")+h+"e"+(r>=0?"+":"")+o.toString();return n.sign+d}(e,n);case"bin":return Se(e,2,r);case"oct":return Se(e,8,r);case"hex":return Se(e,16,r);case"auto":return(function(e,t,n){if(isNaN(e)||!isFinite(e))return String(e);var r=n&&void 0!==n.lowerExp?n.lowerExp:-3,i=n&&void 0!==n.upperExp?n.upperExp:5,o=Sn(e),s=t?Si(o,t):o;if(s.exponent<r||s.exponent>=i)return Sr(e,t);var a=s.coefficients,l=s.exponent;a.length<t&&(a=a.concat(So(t-a.length))),a=a.concat(So(l-a.length+1+(a.length<t?t-a.length:0))),a=So(-l).concat(a);var u=l>0?l:0;return u<a.length-1&&a.splice(u+1,0,"."),s.sign+a.join("")})(e,n,t&&t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+i+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Sn(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw SyntaxError("Invalid number "+e);var n=t[1],r=t[2],i=parseFloat(t[4]||"0"),o=r.indexOf(".");i+=-1!==o?o-1:r.length-1;var s=r.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===s.length&&(s.push(0),i++),{sign:n,coefficients:s,exponent:i}}function Sr(e,t){if(isNaN(e)||!isFinite(e))return String(e);var n=Sn(e),r=t?Si(n,t):n,i=r.coefficients,o=r.exponent;i.length<t&&(i=i.concat(So(t-i.length)));var s=i.shift();return r.sign+s+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function Si(e,t){for(var n={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},r=n.coefficients;t<=0;)r.unshift(0),n.exponent++,t++;if(r.length>t&&r.splice(t,r.length-t)[0]>=5){var i=t-1;for(r[i]++;10===r[i];)r.pop(),0===i&&(r.unshift(0),n.exponent++,i++),i--,r[i]++}return n}function So(e){for(var t=[],n=0;n<e;n++)t.push(0);return t}var Ss=Number.EPSILON||2220446049250313e-31;function Sa(e,t,n){if(null==n)return e===t;if(e===t)return!0;if(isNaN(e)||isNaN(t))return!1;if(isFinite(e)&&isFinite(t)){var r=Math.abs(e-t);return r<Ss||r<=Math.max(Math.abs(e),Math.abs(t))*n}return!1}function Sl(e,t,n){var r=new e.constructor(2),i="";if(n){if(n<1)throw Error("size must be in greater than 0");if(!w7(n))throw Error("size must be an integer");if(e.greaterThan(r.pow(n-1).sub(1))||e.lessThan(r.pow(n-1).mul(-1)))throw Error("Value must be in range [-2^".concat(n-1,", 2^").concat(n-1,"-1]"));if(!e.isInteger())throw Error("Value must be an integer");e.lessThan(0)&&(e=e.add(r.pow(n))),i="i".concat(n)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw Error("Base ".concat(t," not supported "))}}function Su(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function Sc(e,t){var n=function(e,t){var n;if("number"==typeof e)return St(e,t);if(wm(e))return function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var n="auto";if(void 0!==t&&(t.notation&&(n=t.notation),"number"==typeof t?h=t:t.precision&&(h=t.precision),t.wordSize&&"number"!=typeof(d=t.wordSize)))throw Error('Option "wordSize" must be a number');switch(n){case"fixed":return r=e,i=h,r.toFixed(i);case"exponential":return Su(e,h);case"engineering":return o=e,s=h,l=(a=o.e)%3==0?a:a<0?a-3-a%3:a-a%3,-1!==(c=(u=o.mul(Math.pow(10,-l))).toPrecision(s)).indexOf("e")&&(c=u.toString()),c+"e"+(a>=0?"+":"")+l.toString();case"bin":return Sl(e,2,d);case"oct":return Sl(e,8,d);case"hex":return Sl(e,16,d);case"auto":var r,i,o,s,a,l,u,c,h,d,f,p=t&&void 0!==t.lowerExp?t.lowerExp:-3,m=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var g=e.toSignificantDigits(h),v=g.e;return(v>=p&&v<m?g.toFixed():Su(e,h)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+n+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t);return(n=e)&&"object"==typeof n&&"number"==typeof n.s&&"number"==typeof n.n&&"number"==typeof n.d?t&&"decimal"===t.fraction?e.toString():e.s*e.n+"/"+e.d:Array.isArray(e)?function e(t,n){if(!Array.isArray(t))return Sc(t,n);for(var r="[",i=t.length,o=0;o<i;o++)0!==o&&(r+=", "),r+=e(t[o],n);return r+"]"}(e,t):wb(e)?'"'+e+'"':"function"==typeof e?e.syntax?String(e.syntax):"function":e&&"object"==typeof e?"function"==typeof e.format?e.format(t):e&&e.toString(t)!==({}).toString()?e.toString(t):"{"+Object.keys(e).map(n=>'"'+n+'": '+Sc(e[n],t)).join(", ")+"}":String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&n.length>t.truncate?n.substring(0,t.truncate-3)+"...":n}function Sh(e,t,n){if(!(this instanceof Sh))throw SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=n,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=Error().stack}function Sd(e,t,n){if(!(this instanceof Sd))throw SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=n),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function Sf(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function Sp(e,t){if(0===t.length){if(Array.isArray(e))throw new Sh(e.length,0)}else!function e(t,n,r){var i,o=t.length;if(o!==n[r])throw new Sh(o,n[r]);if(r<n.length-1){var s=r+1;for(i=0;i<o;i++){if(!Array.isArray(t[i]))throw new Sh(n.length-1,n.length,"<");e(t[i],n,s)}}else for(i=0;i<o;i++)if(Array.isArray(t[i]))throw new Sh(n.length+1,n.length,">")}(e,t,0)}function Sm(e,t){if(!wp(e)||!w7(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new Sd(e,t)}function Sg(e,t,n){if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw Error("Resizing to scalar is not supported");return t.forEach(function(e){if(!wp(e)||!w7(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+Sc(t)+")")}),function e(t,n,r,i){var o,s,a=t.length,l=n[r],u=Math.min(a,l);if(t.length=l,r<n.length-1){var c=r+1;for(o=0;o<u;o++)Array.isArray(s=t[o])||(s=[s],t[o]=s),e(s,n,c,i);for(o=u;o<l;o++)s=[],t[o]=s,e(s,n,c,i)}else{for(o=0;o<u;o++)for(;Array.isArray(t[o]);)t[o]=t[o][0];for(o=u;o<l;o++)t[o]=i}}(e,t,0,void 0!==n?n:0),e}function Sv(e,t){var n=Sy(e),r=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0){if(t%n==0)r[i]=-t/n;else throw Error("Could not replace wildcard, since "+t+" is no multiple of "+-n)}return r}function Sy(e){return e.reduce((e,t)=>e*t,1)}function Sb(e,t,n,r){var i=r||Sf(e);if(n)for(var o=0;o<n;o++)e=[e],i.unshift(1);for(e=function e(t,n,r){var i,o;if(Array.isArray(t)){var s=r+1;for(i=0,o=t.length;i<o;i++)t[i]=e(t[i],n,s)}else for(var a=r;a<n;a++)t=[t];return t}(e,t,0);i.length<t;)i.push(1);return e}function Sx(e,t){for(var n,r=0,i=0;i<e.length;i++){var o=e[i],s=Array.isArray(o);if(0===i&&s&&(r=o.length),s&&o.length!==r)return;var a=s?Sx(o,t):t(o);if(void 0===n)n=a;else if(n!==a)return"mixed"}return n}function Sw(e,t){return -1!==e.indexOf(t)}function SS(e,t,n,r){if(!(this instanceof SS))throw SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=n,this.max=r,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+n+(null!=r?"-"+r:"")+" expected)",this.stack=Error().stack}Sh.prototype=RangeError(),Sh.prototype.constructor=RangeError,Sh.prototype.name="DimensionError",Sh.prototype.isDimensionError=!0,Sd.prototype=RangeError(),Sd.prototype.constructor=RangeError,Sd.prototype.name="IndexError",Sd.prototype.isIndexError=!0,SS.prototype=Error(),SS.prototype.constructor=Error,SS.prototype.name="ArgumentsError",SS.prototype.isArgumentsError=!0;var SC={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},Sk=["Matrix","Array"],SM=["number","BigNumber","Fraction"];function ST(e,t,n){var r;void 0!==e[t]&&(r=e[t],-1===n.indexOf(r))&&console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+n.map(e=>JSON.stringify(e)).join(", ")+".")}var SA,SD,SE,SO,SR,SP,SI,SN,Sj,SL,SF,SZ,SB,SV,Sz,S_,SH="0123456789abcdef",S$="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",SW="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Sq={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},SG=!0,SU="[DecimalError] ",SK=SU+"Invalid argument: ",SY=SU+"Precision limit exceeded",SX=SU+"crypto unavailable",SQ="[object Decimal]",SJ=Math.floor,S0=Math.pow,S1=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,S2=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,S5=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,S3=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,S4=S$.length-1,S8=SW.length-1,S6={toStringTag:SQ};function S9(e){var t,n,r,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;t<i;t++)(n=7-(r=e[t]+"").length)&&(o+=Cu(n)),o+=r;(n=7-(r=(s=e[t])+"").length)&&(o+=Cu(n))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}function S7(e,t,n){if(e!==~~e||e<t||e>n)throw Error(SK+e)}function Ce(e,t,n,r){var i,o,s,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=S0(10,7-t),a=e[i]%o|0,null==r?t<3?(0==t?a=a/100|0:1==t&&(a=a/10|0),s=n<4&&99999==a||n>3&&49999==a||5e4==a||0==a):s=(n<4&&a+1==o||n>3&&a+1==o/2)&&(e[i+1]/o/100|0)==S0(10,t-2)-1||(a==o/2||0==a)&&(e[i+1]/o/100|0)==0:t<4?(0==t?a=a/1e3|0:1==t?a=a/100|0:2==t&&(a=a/10|0),s=(r||n<4)&&9999==a||!r&&n>3&&4999==a):s=((r||n<4)&&a+1==o||!r&&n>3&&a+1==o/2)&&(e[i+1]/o/1e3|0)==S0(10,t-3)-1,s}function Ct(e,t,n){for(var r,i,o=[0],s=0,a=e.length;s<a;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=SH.indexOf(e.charAt(s++)),r=0;r<o.length;r++)o[r]>n-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}S6.absoluteValue=S6.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Cr(e)},S6.ceil=function(){return Cr(new this.constructor(this),this.e+1,2)},S6.clampedTo=S6.clamp=function(e,t){var n=this.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(SK+t);return 0>this.cmp(e)?e:this.cmp(t)>0?t:new n(this)},S6.comparedTo=S6.cmp=function(e){var t,n,r,i,o=this.d,s=(e=new this.constructor(e)).d,a=this.s,l=e.s;if(!o||!s)return a&&l?a!==l?a:o===s?0:!o^a<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?a:s[0]?-l:0;if(a!==l)return a;if(this.e!==e.e)return this.e>e.e^a<0?1:-1;for(t=0,n=(r=o.length)<(i=s.length)?r:i;t<n;++t)if(o[t]!==s[t])return o[t]>s[t]^a<0?1:-1;return r===i?0:r>i^a<0?1:-1},S6.cosine=S6.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r,i;if(t.isZero())return t;(r=t.d.length)<32?i=(1/Cy(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10"),e.precision+=n,t=Cv(e,1,t.times(i),new e(1));for(var o=n;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}(r,Cb(r,n)),r.precision=e,r.rounding=t,Cr(2==S_||3==S_?n.neg():n,e,t,!0)):new r(1):new r(NaN)},S6.cubeRoot=S6.cbrt=function(){var e,t,n,r,i,o,s,a,l,u,c=this.constructor;if(!this.isFinite()||this.isZero())return new c(this);for(SG=!1,(o=this.s*S0(this.s*this,1/3))&&Math.abs(o)!=1/0?r=new c(o.toString()):(n=S9(this.d),(o=((e=this.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=S0(n,1/3),e=SJ((e+1)/3)-(e%3==(e<0?-1:2)),(r=new c(n=o==1/0?"5e"+e:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+e)).s=this.s),s=(e=c.precision)+3;;)if(r=Cn((u=(l=(a=r).times(a).times(a)).plus(this)).plus(this).times(a),u.plus(l),s+2,1),S9(a.d).slice(0,s)===(n=S9(r.d)).slice(0,s)){if("9999"!=(n=n.slice(s-3,s+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(Cr(r,e+1,1),t=!r.times(r).times(r).eq(this));break}if(!i&&(Cr(a,e+1,0),a.times(a).times(a).eq(this))){r=a;break}s+=4,i=1}return SG=!0,Cr(r,e,c.rounding,t)},S6.decimalPlaces=S6.dp=function(){var e,t=this.d,n=NaN;if(t){if(n=((e=t.length-1)-SJ(this.e/7))*7,e=t[e])for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},S6.dividedBy=S6.div=function(e){return Cn(this,new this.constructor(e))},S6.dividedToIntegerBy=S6.divToInt=function(e){var t=this.constructor;return Cr(Cn(this,new t(e),0,1,1),t.precision,t.rounding)},S6.equals=S6.eq=function(e){return 0===this.cmp(e)},S6.floor=function(){return Cr(new this.constructor(this),this.e+1,3)},S6.greaterThan=S6.gt=function(e){return this.cmp(e)>0},S6.greaterThanOrEqualTo=S6.gte=function(e){var t=this.cmp(e);return 1==t||0===t},S6.hyperbolicCosine=S6.cosh=function(){var e,t,n,r,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?t=(1/Cy(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=Cv(s,1,o.times(t),new s(1),!0);for(var l,u=e,c=new s(8);u--;)l=o.times(o),o=a.minus(l.times(c.minus(l.times(c))));return Cr(o,s.precision=n,s.rounding=r,!0)},S6.hyperbolicSine=S6.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=Cv(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(r))>16?16:0|e,i=Cv(o,2,i=i.times(1/Cy(5,e)),i,!0);for(var s,a=new o(5),l=new o(16),u=new o(20);e--;)s=i.times(i),i=i.times(a.plus(s.times(l.times(s).plus(u))))}return o.precision=t,o.rounding=n,Cr(i,t,n,!0)},S6.hyperbolicTangent=S6.tanh=function(){var e,t,n=this.constructor;return this.isFinite()?this.isZero()?new n(this):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Cn(this.sinh(),this.cosh(),n.precision=e,n.rounding=t)):new n(this.s)},S6.inverseCosine=S6.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return -1!==n?0===n?e.isNeg()?Ca(t,r,i):new t(0):new t(NaN):e.isZero()?Ca(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2))},S6.inverseHyperbolicCosine=S6.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,SG=!1,n=n.times(n).minus(1).sqrt().plus(n),SG=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},S6.inverseHyperbolicSine=S6.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,SG=!1,n=n.times(n).plus(1).sqrt().plus(n),SG=!0,r.precision=e,r.rounding=t,n.ln())},S6.inverseHyperbolicTangent=S6.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,Math.max(r=i.sd(),e)<-(2*i.e)-1)?Cr(new o(i),e,t,!0):(o.precision=n=r-i.e,i=Cn(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5)):new o(NaN)},S6.inverseSine=S6.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==t)?0===t?((e=Ca(o,n+4,r).times(.5)).s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2))},S6.inverseTangent=S6.atan=function(){var e,t,n,r,i,o,s,a,l,u=this,c=u.constructor,h=c.precision,d=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&h+4<=S8)return(s=Ca(c,h+4,d).times(.25)).s=u.s,s}else{if(!u.s)return new c(NaN);if(h+4<=S8)return(s=Ca(c,h+4,d).times(.5)).s=u.s,s}for(c.precision=a=h+10,c.rounding=1,e=n=Math.min(28,a/7+2|0);e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(SG=!1,t=Math.ceil(a/7),r=1,l=u.times(u),s=new c(u),i=u;-1!==e;)if(i=i.times(l),o=s.minus(i.div(r+=2)),i=i.times(l),void 0!==(s=o.plus(i.div(r+=2))).d[t])for(e=t;s.d[e]===o.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),SG=!0,Cr(s,c.precision=h,c.rounding=d,!0)},S6.isFinite=function(){return!!this.d},S6.isInteger=S6.isInt=function(){return!!this.d&&SJ(this.e/7)>this.d.length-2},S6.isNaN=function(){return!this.s},S6.isNegative=S6.isNeg=function(){return this.s<0},S6.isPositive=S6.isPos=function(){return this.s>0},S6.isZero=function(){return!!this.d&&0===this.d[0]},S6.lessThan=S6.lt=function(e){return 0>this.cmp(e)},S6.lessThanOrEqualTo=S6.lte=function(e){return 1>this.cmp(e)},S6.logarithm=S6.log=function(e){var t,n,r,i,o,s,a,l,u=this.constructor,c=u.precision,h=u.rounding;if(null==e)e=new u(10),t=!0;else{if(n=(e=new u(e)).d,e.s<0||!n||!n[0]||e.eq(1))return new u(NaN);t=e.eq(10)}if(n=this.d,this.s<0||!n||!n[0]||this.eq(1))return new u(n&&!n[0]?-1/0:1!=this.s?NaN:n?0:1/0);if(t){if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}}if(SG=!1,Ce((l=Cn(s=Cp(this,a=c+5),t?Cs(u,a+10):Cp(e,a),a,1)).d,i=c,h))do if(a+=10,l=Cn(s=Cp(this,a),t?Cs(u,a+10):Cp(e,a),a,1),!o){+S9(l.d).slice(i+1,i+15)+1==1e14&&(l=Cr(l,c+1,0));break}while(Ce(l.d,i+=10,h));return SG=!0,Cr(l,c,h)},S6.minus=S6.sub=function(e){var t,n,r,i,o,s,a,l,u,c,h,d,f=this.constructor;if(e=new f(e),!this.d||!e.d)return this.s&&e.s?this.d?e.s=-e.s:e=new f(e.d||this.s!==e.s?this:NaN):e=new f(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.plus(e);if(u=this.d,d=e.d,a=f.precision,l=f.rounding,!u[0]||!d[0]){if(d[0])e.s=-e.s;else{if(!u[0])return new f(3===l?-0:0);e=new f(this)}return SG?Cr(e,a,l):e}if(n=SJ(e.e/7),c=SJ(this.e/7),u=u.slice(),o=c-n){for((h=o<0)?(t=u,o=-o,s=d.length):(t=d,n=c,s=u.length),o>(r=Math.max(Math.ceil(a/7),s)+2)&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for((h=(r=u.length)<(s=d.length))&&(s=r),r=0;r<s;r++)if(u[r]!=d[r]){h=u[r]<d[r];break}o=0}for(h&&(t=u,u=d,d=t,e.s=-e.s),s=u.length,r=d.length-s;r>0;--r)u[s++]=0;for(r=d.length;r>o;){if(u[--r]<d[r]){for(i=r;i&&0===u[--i];)u[i]=1e7-1;--u[i],u[r]+=1e7}u[r]-=d[r]}for(;0===u[--s];)u.pop();for(;0===u[0];u.shift())--n;return u[0]?(e.d=u,e.e=Co(u,n),SG?Cr(e,a,l):e):new f(3===l?-0:0)},S6.modulo=S6.mod=function(e){var t,n=this.constructor;return(e=new n(e),this.d&&e.s&&(!e.d||e.d[0]))?e.d&&(!this.d||this.d[0])?(SG=!1,9==n.modulo?(t=Cn(this,e.abs(),0,3,1),t.s*=e.s):t=Cn(this,e,0,n.modulo,1),t=t.times(e),SG=!0,this.minus(t)):Cr(new n(this),n.precision,n.rounding):new n(NaN)},S6.naturalExponential=S6.exp=function(){return Cf(this)},S6.naturalLogarithm=S6.ln=function(){return Cp(this)},S6.negated=S6.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Cr(e)},S6.plus=S6.add=function(e){var t,n,r,i,o,s,a,l,u,c,h=this.constructor;if(e=new h(e),!this.d||!e.d)return this.s&&e.s?this.d||(e=new h(e.d||this.s===e.s?this:NaN)):e=new h(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.minus(e);if(u=this.d,c=e.d,a=h.precision,l=h.rounding,!u[0]||!c[0])return c[0]||(e=new h(this)),SG?Cr(e,a,l):e;if(o=SJ(this.e/7),r=SJ(e.e/7),u=u.slice(),i=o-r){for(i<0?(n=u,i=-i,s=c.length):(n=c,r=o,s=u.length),i>(s=(o=Math.ceil(a/7))>s?o+1:s+1)&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((s=u.length)-(i=c.length)<0&&(i=s,n=c,c=u,u=n),t=0;i;)t=(u[--i]=u[i]+c[i]+t)/1e7|0,u[i]%=1e7;for(t&&(u.unshift(t),++r),s=u.length;0==u[--s];)u.pop();return e.d=u,e.e=Co(u,r),SG?Cr(e,a,l):e},S6.precision=S6.sd=function(e){var t;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(SK+e);return this.d?(t=Cl(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},S6.round=function(){var e=this.constructor;return Cr(new e(this),this.e+1,e.rounding)},S6.sine=S6.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:Cv(e,2,t,t);n=(n=1.4*Math.sqrt(r))>16?16:0|n,t=Cv(e,2,t=t.times(1/Cy(5,n)),t);for(var i,o=new e(5),s=new e(16),a=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(a))));return t}(r,Cb(r,n)),r.precision=e,r.rounding=t,Cr(S_>2?n.neg():n,e,t,!0)):new r(NaN)},S6.squareRoot=S6.sqrt=function(){var e,t,n,r,i,o,s=this.d,a=this.e,l=this.s,u=this.constructor;if(1!==l||!s||!s[0])return new u(!l||l<0&&(!s||s[0])?NaN:s?this:1/0);for(SG=!1,0==(l=Math.sqrt(+this))||l==1/0?(((t=S9(s)).length+a)%2==0&&(t+="0"),l=Math.sqrt(t),a=SJ((a+1)/2)-(a<0||a%2),r=new u(t=l==1/0?"5e"+a:(t=l.toExponential()).slice(0,t.indexOf("e")+1)+a)):r=new u(l.toString()),n=(a=u.precision)+3;;)if(r=(o=r).plus(Cn(this,o,n+2,1)).times(.5),S9(o.d).slice(0,n)===(t=S9(r.d)).slice(0,n)){if("9999"!=(t=t.slice(n-3,n+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Cr(r,a+1,1),e=!r.times(r).eq(this));break}if(!i&&(Cr(o,a+1,0),o.times(o).eq(this))){r=o;break}n+=4,i=1}return SG=!0,Cr(r,a,u.rounding,e)},S6.tangent=S6.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,(n=n.sin()).s=1,n=Cn(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,Cr(2==S_||4==S_?n.neg():n,e,t,!0)):new r(NaN)},S6.times=S6.mul=function(e){var t,n,r,i,o,s,a,l,u,c=this.constructor,h=this.d,d=(e=new c(e)).d;if(e.s*=this.s,!h||!h[0]||!d||!d[0])return new c(e.s&&(!h||h[0]||d)&&(!d||d[0]||h)?h&&d?0*e.s:e.s/0:NaN);for(n=SJ(this.e/7)+SJ(e.e/7),(l=h.length)<(u=d.length)&&(o=h,h=d,d=o,s=l,l=u,u=s),o=[],r=s=l+u;r--;)o.push(0);for(r=u;--r>=0;){for(t=0,i=l+r;i>r;)a=o[i]+d[r]*h[i-r-1]+t,o[i--]=a%1e7|0,t=a/1e7|0;o[i]=(o[i]+t)%1e7|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=Co(o,n),SG?Cr(e,c.precision,c.rounding):e},S6.toBinary=function(e,t){return Cx(this,2,e,t)},S6.toDecimalPlaces=S6.toDP=function(e,t){var n=this,r=n.constructor;return(n=new r(n),void 0===e)?n:(S7(e,0,1e9),void 0===t?t=r.rounding:S7(t,0,8),Cr(n,e+n.e+1,t))},S6.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=Ci(r,!0):(S7(e,0,1e9),void 0===t?t=i.rounding:S7(t,0,8),n=Ci(r=Cr(new i(r),e+1,t),!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},S6.toFixed=function(e,t){var n,r,i=this.constructor;return void 0===e?n=Ci(this):(S7(e,0,1e9),void 0===t?t=i.rounding:S7(t,0,8),n=Ci(r=Cr(new i(this),e+this.e+1,t),!1,e+r.e+1)),this.isNeg()&&!this.isZero()?"-"+n:n},S6.toFraction=function(e){var t,n,r,i,o,s,a,l,u,c,h,d,f=this.d,p=this.constructor;if(!f)return new p(this);if(u=n=new p(1),r=l=new p(0),s=(o=(t=new p(r)).e=Cl(f)-this.e-1)%7,t.d[0]=S0(10,s<0?7+s:s),null==e)e=o>0?t:u;else{if(!(a=new p(e)).isInt()||a.lt(u))throw Error(SK+a);e=a.gt(t)?o>0?t:u:a}for(SG=!1,a=new p(S9(f)),c=p.precision,p.precision=o=14*f.length;h=Cn(a,t,0,1,1),1!=(i=n.plus(h.times(r))).cmp(e);)n=r,r=i,i=u,u=l.plus(h.times(i)),l=i,i=t,t=a.minus(h.times(i)),a=i;return i=Cn(e.minus(n),r,0,1,1),l=l.plus(i.times(u)),n=n.plus(i.times(r)),l.s=u.s=this.s,d=1>Cn(u,r,o,1).minus(this).abs().cmp(Cn(l,n,o,1).minus(this).abs())?[u,r]:[l,n],p.precision=c,SG=!0,d},S6.toHexadecimal=S6.toHex=function(e,t){return Cx(this,16,e,t)},S6.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),null==e){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),void 0===t?t=r.rounding:S7(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(SG=!1,n=Cn(n,e,0,t,1).times(e),SG=!0,Cr(n)):(e.s=n.s,n=e),n},S6.toNumber=function(){return+this},S6.toOctal=function(e,t){return Cx(this,8,e,t)},S6.toPower=S6.pow=function(e){var t,n,r,i,o,s,a=this,l=a.constructor,u=+(e=new l(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new l(S0(+a,u));if((a=new l(a)).eq(1))return a;if(r=l.precision,o=l.rounding,e.eq(1))return Cr(a,r,o);if((t=SJ(e.e/7))>=e.d.length-1&&(n=u<0?-u:u)<=0x1fffffffffffff)return i=Cc(l,a,n,r),e.s<0?new l(1).div(i):Cr(i,r,o);if((s=a.s)<0){if(t<e.d.length-1)return new l(NaN);if((1&e.d[t])==0&&(s=1),0==a.e&&1==a.d[0]&&1==a.d.length)return a.s=s,a}return(t=0!=(n=S0(+a,u))&&isFinite(n)?new l(n+"").e:SJ(u*(Math.log("0."+S9(a.d))/Math.LN10+a.e+1)))>l.maxE+1||t<l.minE-1?new l(t>0?s/0:0):(SG=!1,l.rounding=a.s=1,n=Math.min(12,(t+"").length),(i=Cf(e.times(Cp(a,r+n)),r)).d&&Ce((i=Cr(i,r+5,1)).d,r,o)&&(t=r+10,+S9((i=Cr(Cf(e.times(Cp(a,t+n)),t),t+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=Cr(i,r+1,0))),i.s=s,SG=!0,l.rounding=o,Cr(i,r,o))},S6.toPrecision=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=Ci(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(S7(e,1,1e9),void 0===t?t=i.rounding:S7(t,0,8),n=Ci(r=Cr(new i(r),e,t),e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n},S6.toSignificantDigits=S6.toSD=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(S7(e,1,1e9),void 0===t?t=n.rounding:S7(t,0,8)),Cr(new n(this),e,t)},S6.toString=function(){var e=this.constructor,t=Ci(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+t:t},S6.truncated=S6.trunc=function(){return Cr(new this.constructor(this),this.e+1,1)},S6.valueOf=S6.toJSON=function(){var e=this.constructor,t=Ci(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+t:t};var Cn=function(){function e(e,t,n){var r,i=0,o=e.length;for(e=e.slice();o--;)r=e[o]*t+i,e[o]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,s,a,l){var u,c,h,d,f,p,m,g,v,y,b,x,w,S,C,k,M,T,A,D,E=r.constructor,O=r.s==i.s?1:-1,R=r.d,P=i.d;if(!R||!R[0]||!P||!P[0])return new E(r.s&&i.s&&(R?!P||R[0]!=P[0]:P)?R&&0==R[0]||!P?0*O:O/0:NaN);for(l?(f=1,c=r.e-i.e):(l=1e7,f=7,c=SJ(r.e/f)-SJ(i.e/f)),A=P.length,M=R.length,y=(v=new E(O)).d=[],h=0;P[h]==(R[h]||0);h++);if(P[h]>(R[h]||0)&&c--,null==o?(S=o=E.precision,s=E.rounding):S=a?o+(r.e-i.e)+1:o,S<0)y.push(1),p=!0;else{if(S=S/f+2|0,h=0,1==A){for(d=0,P=P[0],S++;(h<M||d)&&S--;h++)C=d*l+(R[h]||0),y[h]=C/P|0,d=C%P|0;p=d||h<M}else{for((d=l/(P[0]+1)|0)>1&&(P=e(P,d,l),R=e(R,d,l),A=P.length,M=R.length),k=A,x=(b=R.slice(0,A)).length;x<A;)b[x++]=0;(D=P.slice()).unshift(0),T=P[0],P[1]>=l/2&&++T;do d=0,(u=t(P,b,A,x))<0?(w=b[0],A!=x&&(w=w*l+(b[1]||0)),(d=w/T|0)>1?(d>=l&&(d=l-1),g=(m=e(P,d,l)).length,x=b.length,1==(u=t(m,b,g,x))&&(d--,n(m,A<g?D:P,g,l))):(0==d&&(u=d=1),m=P.slice()),(g=m.length)<x&&m.unshift(0),n(b,m,x,l),-1==u&&(x=b.length,(u=t(P,b,A,x))<1&&(d++,n(b,A<x?D:P,x,l))),x=b.length):0===u&&(d++,b=[0]),y[h++]=d,u&&b[0]?b[x++]=R[k]||0:(b=[R[k]],x=1);while((k++<M||void 0!==b[0])&&S--);p=void 0!==b[0]}y[0]||y.shift()}if(1==f)v.e=c,Sz=p;else{for(h=1,d=y[0];d>=10;d/=10)h++;v.e=h+c*f-1,Cr(v,a?o+v.e+1:o,s,p)}return v}}();function Cr(e,t,n,r){var i,o,s,a,l,u,c,h,d,f=e.constructor;o:if(null!=t){if(!(h=e.d))return e;for(i=1,a=h[0];a>=10;a/=10)i++;if((o=t-i)<0)o+=7,s=t,l=(c=h[d=0])/S0(10,i-s-1)%10|0;else if((d=Math.ceil((o+1)/7))>=(a=h.length)){if(r){for(;a++<=d;)h.push(0);c=l=0,i=1,o%=7,s=o-7+1}else break o}else{for(i=1,c=a=h[d];a>=10;a/=10)i++;o%=7,l=(s=o-7+i)<0?0:c/S0(10,i-s-1)%10|0}if(r=r||t<0||void 0!==h[d+1]||(s<0?c:c%S0(10,i-s-1)),u=n<4?(l||r)&&(0==n||n==(e.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(o>0?s>0?c/S0(10,i-s):0:h[d-1])%10&1||n==(e.s<0?8:7)),t<1||!h[0])return h.length=0,u?(t-=e.e+1,h[0]=S0(10,(7-t%7)%7),e.e=-t||0):h[0]=e.e=0,e;if(0==o?(h.length=d,a=1,d--):(h.length=d+1,a=S0(10,7-o),h[d]=s>0?(c/S0(10,i-s)%S0(10,s)|0)*a:0),u)for(;;){if(0==d){for(o=1,s=h[0];s>=10;s/=10)o++;for(s=h[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(e.e++,1e7==h[0]&&(h[0]=1));break}if(h[d]+=a,1e7!=h[d])break;h[d--]=0,a=1}for(o=h.length;0===h[--o];)h.pop()}return SG&&(e.e>f.maxE?(e.d=null,e.e=NaN):e.e<f.minE&&(e.e=0,e.d=[0])),e}function Ci(e,t,n){if(!e.isFinite())return Cm(e);var r,i=e.e,o=S9(e.d),s=o.length;return t?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+Cu(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Cu(-i-1)+o,n&&(r=n-s)>0&&(o+=Cu(r))):i>=s?(o+=Cu(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+Cu(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=Cu(r))),o}function Co(e,t){var n=e[0];for(t*=7;n>=10;n/=10)t++;return t}function Cs(e,t,n){if(t>S4)throw SG=!0,n&&(e.precision=n),Error(SY);return Cr(new e(S$),t,1,!0)}function Ca(e,t,n){if(t>S8)throw Error(SY);return Cr(new e(SW),t,n,!0)}function Cl(e){var t=e.length-1,n=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function Cu(e){for(var t="";e--;)t+="0";return t}function Cc(e,t,n,r){var i,o=new e(1),s=Math.ceil(r/7+4);for(SG=!1;;){if(n%2&&Cw((o=o.times(t)).d,s)&&(i=!0),0===(n=SJ(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}Cw((t=t.times(t)).d,s)}return SG=!0,o}function Ch(e){return 1&e.d[e.d.length-1]}function Cd(e,t,n){for(var r,i,o=new e(t[0]),s=0;++s<t.length;){if(!(i=new e(t[s])).s){o=i;break}((r=o.cmp(i))===n||0===r&&o.s===n)&&(o=i)}return o}function Cf(e,t){var n,r,i,o,s,a,l,u=0,c=0,h=0,d=e.constructor,f=d.rounding,p=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(null==t?(SG=!1,l=p):l=t,a=new d(.03125);e.e>-2;)e=e.times(a),h+=5;for(l+=r=Math.log(S0(2,h))/Math.LN10*2+5|0,n=o=s=new d(1),d.precision=l;;){if(o=Cr(o.times(e),l,1),n=n.times(++c),S9((a=s.plus(Cn(o,n,l,1))).d).slice(0,l)===S9(s.d).slice(0,l)){for(i=h;i--;)s=Cr(s.times(s),l,1);if(null!=t)return d.precision=p,s;if(!(u<3&&Ce(s.d,l-r,f,u)))return Cr(s,d.precision=p,f,SG=!0);d.precision=l+=10,n=o=a=new d(1),c=0,u++}s=a}}function Cp(e,t){var n,r,i,o,s,a,l,u,c,h,d,f=1,p=e,m=p.d,g=p.constructor,v=g.rounding,y=g.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new g(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==t?(SG=!1,c=y):c=t,g.precision=c+=10,r=(n=S9(m)).charAt(0),!(15e14>Math.abs(o=p.e)))return u=Cs(g,c+2,y).times(o+""),p=Cp(new g(r+"."+n.slice(1)),c-10).plus(u),g.precision=y,null==t?Cr(p,y,v,SG=!0):p;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=S9((p=p.times(e)).d)).charAt(0),f++;for(o=p.e,r>1?(p=new g("0."+n),o++):p=new g(r+"."+n.slice(1)),h=p,l=s=p=Cn(p.minus(1),p.plus(1),c,1),d=Cr(p.times(p),c,1),i=3;;){if(s=Cr(s.times(d),c,1),S9((u=l.plus(Cn(s,new g(i),c,1))).d).slice(0,c)===S9(l.d).slice(0,c)){if(l=l.times(2),0!==o&&(l=l.plus(Cs(g,c+2,y).times(o+""))),l=Cn(l,new g(f),c,1),null!=t)return g.precision=y,l;if(!Ce(l.d,c-10,v,a))return Cr(l,g.precision=y,v,SG=!0);g.precision=c+=10,u=s=p=Cn(h.minus(1),h.plus(1),c,1),d=Cr(p.times(p),c,1),i=a=1}l=u,i+=2}}function Cm(e){return String(e.s*e.s/0)}function Cg(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);r++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(r,i)){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%7,n<0&&(r+=7),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=7;r<i;)e.d.push(+t.slice(r,r+=7));r=7-(t=t.slice(r)).length}else r-=i;for(;r--;)t+="0";e.d.push(+t),SG&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function Cv(e,t,n,r,i){var o,s,a,l,u=e.precision,c=Math.ceil(u/7);for(SG=!1,l=n.times(n),a=new e(r);;){if(s=Cn(a.times(l),new e(t++*t++),u,1),a=i?r.plus(s):r.minus(s),r=Cn(s.times(l),new e(t++*t++),u,1),void 0!==(s=a.plus(r)).d[c]){for(o=c;s.d[o]===a.d[o]&&o--;);if(-1==o)break}o=a,a=r,r=s,s=o}return SG=!0,s.d.length=c+1,s}function Cy(e,t){for(var n=e;--t;)n*=e;return n}function Cb(e,t){var n,r=t.s<0,i=Ca(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return S_=r?4:1,t;if((n=t.divToInt(i)).isZero())S_=r?3:2;else{if((t=t.minus(n.times(i))).lte(o))return S_=Ch(n)?r?2:3:r?4:1,t;S_=Ch(n)?r?1:4:r?3:2}return t.minus(i).abs()}function Cx(e,t,n,r){var i,o,s,a,l,u,c,h,d,f=e.constructor,p=void 0!==n;if(p?(S7(n,1,1e9),void 0===r?r=f.rounding:S7(r,0,8)):(n=f.precision,r=f.rounding),e.isFinite()){for(s=(c=Ci(e)).indexOf("."),p?(i=2,16==t?n=4*n-3:8==t&&(n=3*n-2)):i=t,s>=0&&(c=c.replace(".",""),(d=new f(1)).e=c.length-s,d.d=Ct(Ci(d),10,i),d.e=d.d.length),o=l=(h=Ct(c,10,i)).length;0==h[--l];)h.pop();if(h[0]){if(s<0?o--:((e=new f(e)).d=h,e.e=o,h=(e=Cn(e,d,n,r,0,i)).d,o=e.e,u=Sz),s=h[n],a=i/2,u=u||void 0!==h[n+1],u=r<4?(void 0!==s||u)&&(0===r||r===(e.s<0?3:2)):s>a||s===a&&(4===r||u||6===r&&1&h[n-1]||r===(e.s<0?8:7)),h.length=n,u)for(;++h[--n]>i-1;)h[n]=0,n||(++o,h.unshift(1));for(l=h.length;!h[l-1];--l);for(s=0,c="";s<l;s++)c+=SH.charAt(h[s]);if(p){if(l>1){if(16==t||8==t){for(s=16==t?4:3,--l;l%s;l++)c+="0";for(l=(h=Ct(c,i,t)).length;!h[l-1];--l);for(s=1,c="1.";s<l;s++)c+=SH.charAt(h[s])}else c=c.charAt(0)+"."+c.slice(1)}c=c+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)c="0"+c;c="0."+c}else if(++o>l)for(o-=l;o--;)c+="0";else o<l&&(c=c.slice(0,o)+"."+c.slice(o))}else c=p?"0p+0":"0";c=(16==t?"0x":2==t?"0b":8==t?"0o":"")+c}else c=Cm(e);return e.s<0?"-"+c:c}function Cw(e,t){if(e.length>t)return e.length=t,!0}function CS(e){return new this(e).abs()}function CC(e){return new this(e).acos()}function Ck(e){return new this(e).acosh()}function CM(e,t){return new this(e).plus(t)}function CT(e){return new this(e).asin()}function CA(e){return new this(e).asinh()}function CD(e){return new this(e).atan()}function CE(e){return new this(e).atanh()}function CO(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?Ca(this,r,i):new this(0)).s=e.s:!e.d||t.isZero()?(n=Ca(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,n=this.atan(Cn(e,t,o,1)),t=Ca(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(Cn(e,t,o,1)):(n=Ca(this,o,1).times(t.s>0?.25:.75)).s=e.s:n=new this(NaN),n}function CR(e){return new this(e).cbrt()}function CP(e){return Cr(e=new this(e),e.e+1,2)}function CI(e,t,n){return new this(e).clamp(t,n)}function CN(e){if(!e||"object"!=typeof e)throw Error(SU+"Object expected");var t,n,r,i=!0===e.defaults,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(n=o[t],i&&(this[n]=Sq[n]),void 0!==(r=e[n])){if(SJ(r)===r&&r>=o[t+1]&&r<=o[t+2])this[n]=r;else throw Error(SK+n+": "+r)}if(n="crypto",i&&(this[n]=Sq[n]),void 0!==(r=e[n])){if(!0===r||!1===r||0===r||1===r){if(r){if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(SX)}else this[n]=!1}else throw Error(SK+n+": "+r)}return this}function Cj(e){return new this(e).cos()}function CL(e){return new this(e).cosh()}function CF(e,t){return new this(e).div(t)}function CZ(e){return new this(e).exp()}function CB(e){return Cr(e=new this(e),e.e+1,3)}function CV(){var e,t,n=new this(0);for(e=0,SG=!1;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return SG=!0,new this(1/0);n=t}return SG=!0,n.sqrt()}function Cz(e){return e instanceof C9||e&&e.toStringTag===SQ||!1}function C_(e){return new this(e).ln()}function CH(e,t){return new this(e).log(t)}function C$(e){return new this(e).log(2)}function CW(e){return new this(e).log(10)}function Cq(){return Cd(this,arguments,-1)}function CG(){return Cd(this,arguments,1)}function CU(e,t){return new this(e).mod(t)}function CK(e,t){return new this(e).mul(t)}function CY(e,t){return new this(e).pow(t)}function CX(e){var t,n,r,i,o=0,s=new this(1),a=[];if(void 0===e?e=this.precision:S7(e,1,1e9),r=Math.ceil(e/7),this.crypto){if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));o<r;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(r*=4);o<r;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(a.push(i%1e7),o+=4);o=r/4}else throw Error(SX)}else for(;o<r;)a[o++]=1e7*Math.random()|0;for(r=a[--o],e%=7,r&&e&&(i=S0(10,7-e),a[o]=(r/i|0)*i);0===a[o];o--)a.pop();if(o<0)n=0,a=[0];else{for(n=-1;0===a[0];n-=7)a.shift();for(r=1,i=a[0];i>=10;i/=10)r++;r<7&&(n-=7-r)}return s.e=n,s.d=a,s}function CQ(e){return Cr(e=new this(e),e.e+1,this.rounding)}function CJ(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function C0(e){return new this(e).sin()}function C1(e){return new this(e).sinh()}function C2(e){return new this(e).sqrt()}function C5(e,t){return new this(e).sub(t)}function C3(){var e=0,t=arguments,n=new this(t[0]);for(SG=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return SG=!0,Cr(n,this.precision,this.rounding)}function C4(e){return new this(e).tan()}function C8(e){return new this(e).tanh()}function C6(e){return Cr(e=new this(e),e.e+1,1)}S6[Symbol.for("nodejs.util.inspect.custom")]=S6.toString,S6[Symbol.toStringTag]="Decimal";var C9=S6.constructor=function e(t){var n,r,i;function o(e){var t,n,r;if(!(this instanceof o))return new o(e);if(this.constructor=o,Cz(e)){this.s=e.s,SG?!e.d||e.e>o.maxE?(this.e=NaN,this.d=null):e.e<o.minE?(this.e=0,this.d=[0]):(this.e=e.e,this.d=e.d.slice()):(this.e=e.e,this.d=e.d?e.d.slice():e.d);return}if("number"==(r=typeof e)){if(0===e){this.s=1/e<0?-1:1,this.e=0,this.d=[0];return}if(e<0?(e=-e,this.s=-1):this.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;SG?t>o.maxE?(this.e=NaN,this.d=null):t<o.minE?(this.e=0,this.d=[0]):(this.e=t,this.d=[e]):(this.e=t,this.d=[e]);return}if(0*e!=0){e||(this.s=NaN),this.e=NaN,this.d=null;return}return Cg(this,e.toString())}if("string"===r)return 45===(n=e.charCodeAt(0))?(e=e.slice(1),this.s=-1):(43===n&&(e=e.slice(1)),this.s=1),S3.test(e)?Cg(this,e):function(e,t){var n,r,i,o,s,a,l,u,c;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),S3.test(t))return Cg(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(S2.test(t))n=16,t=t.toLowerCase();else if(S1.test(t))n=2;else if(S5.test(t))n=8;else throw Error(SK+t);for((o=t.search(/p/i))>0?(l=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),s=(o=t.indexOf("."))>=0,r=e.constructor,s&&(o=(a=(t=t.replace(".","")).length)-o,i=Cc(r,new r(n),o,2*o)),o=c=(u=Ct(t,n,1e7)).length-1;0===u[o];--o)u.pop();return o<0?new r(0*e.s):(e.e=Co(u,c),e.d=u,SG=!1,s&&(e=Cn(e,i,4*a)),l&&(e=e.times(54>Math.abs(l)?S0(2,l):C9.pow(2,l))),SG=!0,e)}(this,e);if("bigint"===r)return e<0?(e=-e,this.s=-1):this.s=1,Cg(this,e.toString());throw Error(SK+e)}if(o.prototype=S6,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=CN,o.clone=e,o.isDecimal=Cz,o.abs=CS,o.acos=CC,o.acosh=Ck,o.add=CM,o.asin=CT,o.asinh=CA,o.atan=CD,o.atanh=CE,o.atan2=CO,o.cbrt=CR,o.ceil=CP,o.clamp=CI,o.cos=Cj,o.cosh=CL,o.div=CF,o.exp=CZ,o.floor=CB,o.hypot=CV,o.ln=C_,o.log=CH,o.log10=CW,o.log2=C$,o.max=Cq,o.min=CG,o.mod=CU,o.mul=CK,o.pow=CY,o.random=CX,o.round=CQ,o.sign=CJ,o.sin=C0,o.sinh=C1,o.sqrt=C2,o.sub=C5,o.sum=C3,o.tan=C4,o.tanh=C8,o.trunc=C6,void 0===t&&(t={}),t&&!0!==t.defaults)for(n=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return o.config(t),o}(Sq);S$=new C9(S$),SW=new C9(SW);var C7={createBigNumberClass:w8("BigNumber",["?on","config"],e=>{var{on:t,config:n}=e,r=C9.clone({precision:n.precision,modulo:C9.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(e){return new r(e.value)},t&&t("config",function(e,t){e.precision!==t.precision&&r.config({precision:e.precision})}),r},{isClass:!0})},ke={createMatrixClass:w8("Matrix",[],()=>{function e(){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,n){throw Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,n){throw Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0})},kt={MatrixDependencies:ke,createDenseMatrixClass:w8("DenseMatrix",["Matrix"],e=>{var{Matrix:t}=e;function n(e,t){if(!(this instanceof n))throw SyntaxError("Constructor must be called with the new operator");if(t&&!wb(t))throw Error("Invalid datatype: "+t);if(ww(e))"DenseMatrix"===e.type?(this._data=wJ(e._data),this._size=wJ(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&wx(e.data)&&wx(e.size))this._data=e.data,this._size=e.size,Sp(this._data,this._size),this._datatype=t||e.datatype;else if(wx(e))this._data=function e(t){for(var n=0,r=t.length;n<r;n++){var i=t[n];wx(i)?t[n]=e(i):i&&!0===i.isMatrix&&(t[n]=e(i.valueOf()))}return t}(e),this._size=Sf(this._data),Sp(this._data,this._size),this._datatype=t;else if(e)throw TypeError("Unsupported type of data ("+wQ(e)+")");else this._data=[],this._size=[0],this._datatype=t}function r(e,t,n){if(0===t.length){for(var r=e._data;wx(r);)r=r[0];return r}return e._size=t.slice(0),e._data=Sg(e._data,e._size,n),e}function i(e,t,n){for(var i=e._size.slice(0),o=!1;i.length<t.length;)i.push(0),o=!0;for(var s=0,a=t.length;s<a;s++)t[s]>i[s]&&(i[s]=t[s],o=!0);o&&r(e,i,n)}return n.prototype=new t,n.prototype.createDenseMatrix=function(e,t){return new n(e,t)},n.prototype.type="DenseMatrix",n.prototype.isDenseMatrix=!0,n.prototype.getDataType=function(){return Sx(this._data,wQ)},n.prototype.storage=function(){return"dense"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(e,t){return new n(e,t)},n.prototype.subset=function(e,t,r){switch(arguments.length){case 1:return function(e,t){if(!wT(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var r=t.size();if(r.length!==e._size.length)throw new Sh(r.length,e._size.length);for(var i=t.min(),o=t.max(),s=0,a=e._size.length;s<a;s++)Sm(i[s],e._size[s]),Sm(o[s],e._size[s]);return new n(function e(t,n,r,i){var o=i===r-1,s=n.dimension(i);return o?s.map(function(e){return Sm(e,t.length),t[e]}).valueOf():s.map(function(o){return Sm(o,t.length),e(t[o],n,r,i+1)}).valueOf()}(e._data,t,r.length,0),e._datatype)}(this,e);case 2:case 3:return function(e,t,n,r){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var o,s=t.size(),a=t.isScalar();if(ww(n)?(o=n.size(),n=n.valueOf()):o=Sf(n),a){if(0!==o.length)throw TypeError("Scalar expected");e.set(t.min(),n,r)}else{if(s.length<e._size.length)throw new Sh(s.length,e._size.length,"<");if(o.length<s.length){for(var l=0,u=0;1===s[l]&&1===o[l];)l++;for(;1===s[l];)u++,l++;n=Sb(n,s.length,u,o)}if(!w1(s,o))throw new Sh(s,o,">");i(e,t.max().map(function(e){return e+1}),r);var c=s.length;(function e(t,n,r,i,o){var s=o===i-1,a=n.dimension(o);s?a.forEach(function(e,n){Sm(e),t[e]=r[n[0]]}):a.forEach(function(s,a){Sm(s),e(t[s],n,r[a[0]],i,o+1)})})(e._data,t,n,c,0)}return e}(this,e,t,r);default:throw SyntaxError("Wrong number of arguments")}},n.prototype.get=function(e){if(!wx(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new Sh(e.length,this._size.length);for(var t=0;t<e.length;t++)Sm(e[t],this._size[t]);for(var n=this._data,r=0,i=e.length;r<i;r++){var o=e[r];Sm(o,n.length),n=n[o]}return n},n.prototype.set=function(e,t,n){if(!wx(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new Sh(e.length,this._size.length,"<");i(this,e.map(function(e){return e+1}),n);var r,o,s,a=this._data;for(r=0,o=e.length-1;r<o;r++)Sm(s=e[r],a.length),a=a[s];return Sm(s=e[e.length-1],a.length),a[s]=t,this},n.prototype.resize=function(e,t,n){if(!wS(e))throw TypeError("Array or Matrix expected");var i=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);return r(n?this.clone():this,i,t)},n.prototype.reshape=function(e,t){var n=t?this.clone():this;n._data=function(e,t){var n=function(e){if(!Array.isArray(e))return e;var t=[];return e.forEach(function e(n){Array.isArray(n)?n.forEach(e):t.push(n)}),t}(e),r=n.length;if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw new Sh(0,r,"!=");var i=Sy(t=Sv(t,r));if(r!==i)throw new Sh(i,r,"!=");try{return function(e,t){for(var n,r=e,i=t.length-1;i>0;i--){var o=t[i];n=[];for(var s=r.length/o,a=0;a<s;a++)n.push(r.slice(a*o,(a+1)*o));r=n}return r}(n,t)}catch(e){if(e instanceof Sh)throw new Sh(i,r,"!=");throw e}}(n._data,e);var r=n._size.reduce((e,t)=>e*t);return n._size=Sv(e,r),n},n.prototype.clone=function(){return new n({data:wJ(this._data),size:wJ(this._size),datatype:this._datatype})},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(e){var t=this,r=function n(r,i){return wx(r)?r.map(function(e,t){return n(e,i.concat(t))}):e(r,i,t)}(this._data,[]),i=void 0!==this._datatype?Sx(r,wQ):void 0;return new n(r,i)},n.prototype.forEach=function(e){var t=this;!function n(r,i){wx(r)?r.forEach(function(e,t){n(e,i.concat(t))}):e(r,i,t)}(this._data,[])},n.prototype[Symbol.iterator]=function*(){var e=function* e(t,n){if(wx(t))for(var r=0;r<t.length;r++)yield*e(t[r],n.concat(r));else yield{value:t,index:n}};yield*e(this._data,[])},n.prototype.rows=function(){var e=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var t of this._data)e.push(new n([t],this._datatype));return e},n.prototype.columns=function(){var e=this,t=[],r=this.size();if(2!==r.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,o=function(r){var o=i.map(e=>[e[r]]);t.push(new n(o,e._datatype))},s=0;s<r[1];s++)o(s);return t},n.prototype.toArray=function(){return wJ(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(e){return Sc(this._data,e)},n.prototype.toString=function(){return Sc(this._data)},n.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(e){if(e){if(wm(e)&&(e=e.toNumber()),!wp(e)||!w7(e))throw TypeError("The parameter k must be an integer number")}else e=0;for(var t=e>0?e:0,r=e<0?-e:0,i=Math.min(this._size[0]-r,this._size[1]-t),o=[],s=0;s<i;s++)o[s]=this._data[s+r][s+t];return new n({data:o,size:[i],datatype:this._datatype})},n.diagonal=function(e,t,r,i){if(!wx(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(wm(e)&&(e=e.toNumber()),!wp(e)||!w7(e)||e<1)throw Error("Size values must be positive integers");return e}),r){if(wm(r)&&(r=r.toNumber()),!wp(r)||!w7(r))throw TypeError("The parameter k must be an integer number")}else r=0;var o,s=r>0?r:0,a=r<0?-r:0,l=e[0],u=e[1],c=Math.min(l-a,u-s);if(wx(t)){if(t.length!==c)throw Error("Invalid value array length");o=function(e){return t[e]}}else if(ww(t)){var h=t.size();if(1!==h.length||h[0]!==c)throw Error("Invalid matrix length");o=function(e){return t.get([e])}}else o=function(){return t};i||(i=wm(o(0))?o(0).mul(0):0);var d=[];if(e.length>0){d=Sg(d,e,i);for(var f=0;f<c;f++)d[f+a][f+s]=o(f)}return new n({data:d,size:[l,u]})},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(e,t){if(!wp(e)||!w7(e)||!wp(t)||!w7(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return Sm(e,this._size[0]),Sm(t,this._size[0]),n._swapRows(e,t,this._data),this},n._swapRows=function(e,t,n){var r=n[e];n[e]=n[t],n[t]=r},n},{isClass:!0})};let kn=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},kr=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},ki=function(e){let t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;let n=e*e;return n*(n*(n*(n*(n*(n*(n*(n/20922789888e3-1/0x144c3b2800)+1/0x1c8cfc00)-1/3628800)+1/40320)-1/720)+1/24)-.5)},ko=function(e,t){return((e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8)?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},ks=function(){throw SyntaxError("Invalid Param")};function ka(e,t){let n=Math.abs(e),r=Math.abs(t);return 0===e?Math.log(r):0===t?Math.log(n):n<3e3&&r<3e3?.5*Math.log(e*e+t*t):.5*Math.log((e*=.5)*e+(t*=.5)*t)+Math.LN2}let kl={re:0,im:0},ku=function(e,t){if(null==e)kl.re=kl.im=0;else if(void 0!==t)kl.re=e,kl.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)kl.re=e.re,kl.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return kc.INFINITY;kl.re=e.abs*Math.cos(e.arg),kl.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return kc.INFINITY;kl.re=e.r*Math.cos(e.phi),kl.im=e.r*Math.sin(e.phi)}else 2===e.length?(kl.re=e[0],kl.im=e[1]):ks();break;case"string":kl.im=kl.re=0;let n=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),r=1,i=0;null===n&&ks();for(let e=0;e<n.length;e++){let t=n[e];" "===t||" "===t||"\n"===t||("+"===t?r++:"-"===t?i++:("i"===t||"I"===t?(r+i===0&&ks()," "===n[e+1]||isNaN(n[e+1])?kl.im+=parseFloat((i%2?"-":"")+"1"):(kl.im+=parseFloat((i%2?"-":"")+n[e+1]),e++)):((r+i===0||isNaN(t))&&ks(),"i"===n[e+1]||"I"===n[e+1]?(kl.im+=parseFloat((i%2?"-":"")+t),e++):kl.re+=parseFloat((i%2?"-":"")+t)),r=i=0))}r+i>0&&ks();break;case"number":kl.im=0,kl.re=e;break;default:ks()}return isNaN(kl.re)||isNaN(kl.im),kl};function kc(e,t){if(!(this instanceof kc))return new kc(e,t);let n=ku(e,t);this.re=n.re,this.im=n.im}kc.prototype={re:0,im:0,sign:function(){let e=ko(this.re,this.im);return new kc(this.re/e,this.im/e)},add:function(e,t){let n=ku(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?kc.NAN:kc.INFINITY:new kc(this.re+n.re,this.im+n.im)},sub:function(e,t){let n=ku(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?kc.NAN:kc.INFINITY:new kc(this.re-n.re,this.im-n.im)},mul:function(e,t){let n=ku(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),o=0===this.re&&0===this.im,s=0===n.re&&0===n.im;return r&&s||i&&o?kc.NAN:r||i?kc.INFINITY:0===n.im&&0===this.im?new kc(this.re*n.re,0):new kc(this.re*n.re-this.im*n.im,this.re*n.im+this.im*n.re)},div:function(e,t){let n=ku(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),o=0===this.re&&0===this.im,s=0===n.re&&0===n.im;if(o&&s||r&&i)return kc.NAN;if(s||r)return kc.INFINITY;if(o||i)return kc.ZERO;if(0===n.im)return new kc(this.re/n.re,this.im/n.re);if(Math.abs(n.re)<Math.abs(n.im)){let e=n.re/n.im,t=n.re*e+n.im;return new kc((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{let e=n.im/n.re,t=n.im*e+n.re;return new kc((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let n=ku(e,t),r=0===this.re&&0===this.im;if(0===n.re&&0===n.im)return kc.ONE;if(0===n.im){if(0===this.im&&this.re>0)return new kc(Math.pow(this.re,n.re),0);if(0===this.re)switch((n.re%4+4)%4){case 0:return new kc(Math.pow(this.im,n.re),0);case 1:return new kc(0,Math.pow(this.im,n.re));case 2:return new kc(-Math.pow(this.im,n.re),0);case 3:return new kc(0,-Math.pow(this.im,n.re))}}if(r&&n.re>0)return kc.ZERO;let i=Math.atan2(this.im,this.re),o=ka(this.re,this.im),s=Math.exp(n.re*o-n.im*i),a=n.im*o+n.re*i;return new kc(s*Math.cos(a),s*Math.sin(a))},sqrt:function(){let e=this.re,t=this.im;if(0===t)return e>=0?new kc(Math.sqrt(e),0):new kc(0,Math.sqrt(-e));let n=Math.sqrt(.5*(ko(e,t)+Math.abs(e))),r=Math.abs(t)/(2*n);return e>=0?new kc(n,t<0?-r:r):new kc(r,t<0?-n:n)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new kc(e,0):new kc(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e=this.re,t=this.im;return new kc(Math.expm1(e)*Math.cos(t)+ki(t),Math.exp(e)*Math.sin(t))},log:function(){let e=this.re,t=this.im;return 0===t&&e>0?new kc(Math.log(e),0):new kc(ka(e,t),Math.atan2(t,e))},abs:function(){return ko(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new kc(Math.sin(e)*kn(t),Math.cos(e)*kr(t))},cos:function(){let e=this.re,t=this.im;return new kc(Math.cos(e)*kn(t),-Math.sin(e)*kr(t))},tan:function(){let e=2*this.re,t=2*this.im,n=Math.cos(e)+kn(t);return new kc(Math.sin(e)/n,kr(t)/n)},cot:function(){let e=2*this.re,t=2*this.im,n=Math.cos(e)-kn(t);return new kc(-Math.sin(e)/n,kr(t)/n)},sec:function(){let e=this.re,t=this.im,n=.5*kn(2*t)+.5*Math.cos(2*e);return new kc(Math.cos(e)*kn(t)/n,Math.sin(e)*kr(t)/n)},csc:function(){let e=this.re,t=this.im,n=.5*kn(2*t)-.5*Math.cos(2*e);return new kc(Math.sin(e)*kn(t)/n,-Math.cos(e)*kr(t)/n)},asin:function(){let e=this.re,t=this.im,n=new kc(t*t-e*e+1,-2*e*t).sqrt(),r=new kc(n.re-t,n.im+e).log();return new kc(r.im,-r.re)},acos:function(){let e=this.re,t=this.im,n=new kc(t*t-e*e+1,-2*e*t).sqrt(),r=new kc(n.re-t,n.im+e).log();return new kc(Math.PI/2-r.im,r.re)},atan:function(){let e=this.re,t=this.im;if(0===e){if(1===t)return new kc(0,1/0);if(-1===t)return new kc(0,-1/0)}let n=e*e+(1-t)*(1-t),r=new kc((1-t*t-e*e)/n,-2*e/n).log();return new kc(-.5*r.im,.5*r.re)},acot:function(){let e=this.re,t=this.im;if(0===t)return new kc(Math.atan2(1,e),0);let n=e*e+t*t;return 0!==n?new kc(e/n,-t/n).atan():new kc(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new kc(0,1/0);let n=e*e+t*t;return 0!==n?new kc(e/n,-t/n).acos():new kc(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new kc(Math.PI/2,1/0);let n=e*e+t*t;return 0!==n?new kc(e/n,-t/n).asin():new kc(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new kc(kr(e)*Math.cos(t),kn(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new kc(kn(e)*Math.cos(t),kr(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,n=kn(e)+Math.cos(t);return new kc(kr(e)/n,Math.sin(t)/n)},coth:function(){let e=2*this.re,t=2*this.im,n=kn(e)-Math.cos(t);return new kc(kr(e)/n,-Math.sin(t)/n)},csch:function(){let e=this.re,t=this.im,n=Math.cos(2*t)-kn(2*e);return new kc(-2*kr(e)*Math.cos(t)/n,2*kn(e)*Math.sin(t)/n)},sech:function(){let e=this.re,t=this.im,n=Math.cos(2*t)+kn(2*e);return new kc(2*kn(e)*Math.cos(t)/n,-2*kr(e)*Math.sin(t)/n)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;let t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){let e=this.acos();if(e.im<=0){let t=e.re;e.re=-e.im,e.im=t}else{let t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){let e=this.re,t=this.im,n=1-e,r=1+e,i=n*n+t*t,o=0!==i?new kc((r*n-t*t)/i,(t*n+r*t)/i):new kc(-1!==e?e/0:0,0!==t?t/0:0),s=o.re;return o.re=ka(o.re,o.im)/2,o.im=Math.atan2(o.im,s)/2,e>1&&0===t&&(o.im=-o.im),o},acoth:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new kc(0,Math.PI/2);let n=e*e+t*t;return 0!==n?new kc(e/n,-t/n).atanh():new kc(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){let e=this.re,t=this.im;if(0===t)return new kc(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);let n=e*e+t*t;return 0!==n?new kc(e/n,-t/n).asinh():new kc(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return kc.INFINITY;let n=e*e+t*t;return 0!==n?new kc(e/n,-t/n).acosh():new kc(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return kc.INFINITY;if(this.isInfinite())return kc.ZERO;let e=this.re,t=this.im,n=e*e+t*t;return new kc(e/n,-t/n)},conjugate:function(){return new kc(this.re,-this.im)},neg:function(){return new kc(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new kc(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new kc(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new kc(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let n=ku(e,t);return Math.abs(n.re-this.re)<=kc.EPSILON&&Math.abs(n.im-this.im)<=kc.EPSILON},clone:function(){return new kc(this.re,this.im)},toString:function(){let e=this.re,t=this.im,n="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<kc.EPSILON&&(e=0),Math.abs(t)<kc.EPSILON&&(t=0),0===t)?n+e:(0!==e?(n+=e,n+=" ",t<0?(t=-t,n+="-"):n+="+",n+=" "):t<0&&(t=-t,n+="-"),1!==t&&(n+=t),n+"i")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},kc.ZERO=new kc(0,0),kc.ONE=new kc(1,0),kc.I=new kc(0,1),kc.PI=new kc(Math.PI,0),kc.E=new kc(Math.E,0),kc.INFINITY=new kc(1/0,1/0),kc.NAN=new kc(NaN,NaN),kc.EPSILON=1e-15;var kh=w8("Complex",[],()=>(kc.prototype.type="Complex",kc.prototype.isComplex=!0,kc.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},kc.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},kc.prototype.format=function(e){var t="",n=this.im,r=this.re,i=St(this.re,e),o=St(this.im,e),s=wp(e)?e:e?e.precision:null;if(null!==s){var a=Math.pow(10,-s);Math.abs(r/n)<a&&(r=0),Math.abs(n/r)<a&&(n=0)}return 0===n?i:0===r?1===n?"i":-1===n?"-i":o+"i":n<0?-1===n?i+" - i":i+" - "+o.substring(1)+"i":1===n?i+" + i":i+" + "+o+"i"},kc.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if("object"==typeof t)return kc(t);throw TypeError("Input has to be an object with r and phi keys.");case 2:var n=arguments[0],r=arguments[1];if(wp(n)){if(wy(r)&&r.hasBase("ANGLE")&&(r=r.toNumber("rad")),wp(r))return new kc({r:n,phi:r});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},kc.prototype.valueOf=kc.prototype.toString,kc.fromJSON=function(e){return new kc(e)},kc.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},kc),{isClass:!0}),kd={s:1,n:0,d:1};function kf(e,t){if(isNaN(e=parseInt(e,10)))throw kx();return e*t}function kp(e,t){if(0===t)throw kb();var n=Object.create(ky.prototype);n.s=e<0?-1:1;var r=kv(e=e<0?-e:e,t);return n.n=e/r,n.d=t/r,n}function km(e){for(var t={},n=e,r=2,i=4;i<=n;){for(;n%r==0;)n/=r,t[r]=(t[r]||0)+1;i+=1+2*r++}return n!==e?n>1&&(t[n]=(t[n]||0)+1):t[e]=(t[e]||0)+1,t}var kg=function(e,t){var n,r=0,i=1,o=1,s=0,a=0,l=0,u=1,c=1,h=0,d=1,f=1,p=1;if(null==e);else if(void 0!==t){if(o=(r=e)*(i=t),r%1!=0||i%1!=0)throw kw()}else switch(typeof e){case"object":if("d"in e&&"n"in e)r=e.n,i=e.d,"s"in e&&(r*=e.s);else if(0 in e)r=e[0],1 in e&&(i=e[1]);else throw kx();o=r*i;break;case"number":if(e<0&&(o=e,e=-e),e%1==0)r=e;else if(e>0){for(e>=1&&(c=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=c);d<=1e7&&p<=1e7;){if(e===(n=(h+f)/(d+p))){d+p<=1e7?(r=h+f,i=d+p):p>d?(r=f,i=p):(r=h,i=d);break}e>n?(h+=f,d+=p):(f+=h,p+=d),d>1e7?(r=f,i=p):(r=h,i=d)}r*=c}else(isNaN(e)||isNaN(t))&&(i=r=NaN);break;case"string":if(null===(d=e.match(/\d+|./g)))throw kx();if("-"===d[h]?(o=-1,h++):"+"===d[h]&&h++,d.length===h+1?a=kf(d[h++],o):"."===d[h+1]||"."===d[h]?("."!==d[h]&&(s=kf(d[h++],o)),(++h+1===d.length||"("===d[h+1]&&")"===d[h+3]||"'"===d[h+1]&&"'"===d[h+3])&&(a=kf(d[h],o),u=Math.pow(10,d[h].length),h++),("("===d[h]&&")"===d[h+2]||"'"===d[h]&&"'"===d[h+2])&&(l=kf(d[h+1],o),c=Math.pow(10,d[h+1].length)-1,h+=3)):"/"===d[h+1]||":"===d[h+1]?(a=kf(d[h],o),u=kf(d[h+2],1),h+=3):"/"===d[h+3]&&" "===d[h+1]&&(s=kf(d[h],o),a=kf(d[h+2],o),u=kf(d[h+4],1),h+=5),d.length<=h){o=r=l+(i=u*c)*s+c*a;break}default:throw kx()}if(0===i)throw kb();kd.s=o<0?-1:1,kd.n=Math.abs(r),kd.d=Math.abs(i)};function kv(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function ky(e,t){if(kg(e,t),!(this instanceof ky))return kp(kd.s*kd.n,kd.d);e=kv(kd.d,kd.n),this.s=kd.s,this.n=kd.n/e,this.d=kd.d/e}var kb=function(){return Error("Division by Zero")},kx=function(){return Error("Invalid argument")},kw=function(){return Error("Parameters must be integer")};ky.prototype={s:1,n:0,d:1,abs:function(){return kp(this.n,this.d)},neg:function(){return kp(-this.s*this.n,this.d)},add:function(e,t){return kg(e,t),kp(this.s*this.n*kd.d+kd.s*this.d*kd.n,this.d*kd.d)},sub:function(e,t){return kg(e,t),kp(this.s*this.n*kd.d-kd.s*this.d*kd.n,this.d*kd.d)},mul:function(e,t){return kg(e,t),kp(this.s*kd.s*this.n*kd.n,this.d*kd.d)},div:function(e,t){return kg(e,t),kp(this.s*kd.s*this.n*kd.d,this.d*kd.n)},clone:function(){return kp(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new ky(NaN);if(void 0===e)return kp(this.s*this.n%this.d,1);if(kg(e,t),0===kd.n&&0===this.d)throw kb();return kp(this.s*(kd.d*this.n)%(kd.n*this.d),kd.d*this.d)},gcd:function(e,t){return kg(e,t),kp(kv(kd.n,this.n)*kv(kd.d,this.d),kd.d*this.d)},lcm:function(e,t){return(kg(e,t),0===kd.n&&0===this.n)?kp(0,1):kp(kd.n*this.n,kv(kd.n,this.n)*kv(kd.d,this.d))},ceil:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new ky(NaN):kp(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new ky(NaN):kp(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new ky(NaN):kp(Math.round(e*this.s*this.n/this.d),e)},roundTo:function(e,t){return kg(e,t),kp(this.s*Math.round(this.n*kd.d/(this.d*kd.n))*kd.n,kd.d)},inverse:function(){return kp(this.s*this.d,this.n)},pow:function(e,t){if(kg(e,t),1===kd.d)return kd.s<0?kp(Math.pow(this.s*this.d,kd.n),Math.pow(this.n,kd.n)):kp(Math.pow(this.s*this.n,kd.n),Math.pow(this.d,kd.n));if(this.s<0)return null;var n=km(this.n),r=km(this.d),i=1,o=1;for(var s in n)if("1"!==s){if("0"===s){i=0;break}if(n[s]*=kd.n,n[s]%kd.d!=0)return null;n[s]/=kd.d,i*=Math.pow(s,n[s])}for(var s in r)if("1"!==s){if(r[s]*=kd.n,r[s]%kd.d!=0)return null;r[s]/=kd.d,o*=Math.pow(s,r[s])}return kd.s<0?kp(o,i):kp(i,o)},equals:function(e,t){return kg(e,t),this.s*this.n*kd.d==kd.s*kd.n*this.d},compare:function(e,t){kg(e,t);var n=this.s*this.n*kd.d-kd.s*kd.n*this.d;return(0<n)-(n<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var t=this.abs(),n=t.toContinued(),r=1;r<n.length;r++){for(var i=kp(n[r-1],1),o=r-2;o>=0;o--)i=i.inverse().add(n[o]);if(Math.abs(i.sub(t).valueOf())<e)return i.mul(this.s)}return this},divisible:function(e,t){return kg(e,t),!(!(kd.n*this.d)||this.n*kd.d%(kd.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,n="",r=this.n,i=this.d;return this.s<0&&(n+="-"),1===i?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,n+=" ",r%=i),n+=r,n+="/",n+=i),n},toLatex:function(e){var t,n="",r=this.n,i=this.d;return this.s<0&&(n+="-"),1===i?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,r%=i),n+="\\frac{",n+=r,n+="}{",n+=i,n+="}"),n},toContinued:function(){var e,t=this.n,n=this.d,r=[];if(isNaN(t)||isNaN(n))return r;do r.push(Math.floor(t/n)),e=t%n,t=n,n=e;while(1!==t);return r},toString:function(e){var t=this.n,n=this.d;if(isNaN(t)||isNaN(n))return"NaN";e=e||15;var r=function(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(1===t)return 0;for(var n=10%t,r=1;1!==n;r++)if(n=10*n%t,r>2e3)return 0;return r}(0,n),i=function(e,t,n){for(var r=1,i=function(e,t,n){for(var r=1;t>0;e=e*e%n,t>>=1)1&t&&(r=r*e%n);return r}(10,n,t),o=0;o<300;o++){if(r===i)return o;r=10*r%t,i=10*i%t}return 0}(0,n,r),o=this.s<0?"-":"";if(o+=t/n|0,t%=n,(t*=10)&&(o+="."),r){for(var s=i;s--;)o+=t/n|0,t%=n,t*=10;o+="(";for(var s=r;s--;)o+=t/n|0,t%=n,t*=10;o+=")"}else for(var s=e;t&&s--;)o+=t/n|0,t%=n,t*=10;return o}};var kS=w8("Fraction",[],()=>(ky.prototype.type="Fraction",ky.prototype.isFraction=!0,ky.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},ky.fromJSON=function(e){return new ky(e)},ky),{isClass:!0}),kC=n(27554);function kk(e,t){return!!e&&"object"==typeof e&&(!!w5(kT,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function kM(e){return"object"==typeof e&&e&&e.constructor===Object}var kT={length:!0,name:!0},kA={toString:!0,valueOf:!0,toLocaleString:!0};class kD{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){return function(e,t){var n,r;if(kM(e)&&kk(e,t))return e[t];if("function"==typeof e[t]&&(n=e,r=t,!(null==n||"function"!=typeof n[r]||w5(n,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(n))&&(w5(kA,r)||!(r in Object.prototype)&&!(r in Function.prototype))))throw Error('Cannot access method "'+t+'" as a property');throw Error('No access to property "'+t+'"')}(this.wrappedObject,e)}set(e,t){return!function(e,t,n){if(kM(e)&&kk(e,t))return e[t]=n;throw Error('No access to property "'+t+'"')}(this.wrappedObject,e,t),this}has(e){return e in this.wrappedObject}}function kE(e){return!!e&&(e instanceof Map||e instanceof kD||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var kO=function(){return kO=kC.create,kC};function kR(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function kP(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function kI(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var kN={BigNumberDependencies:C7,ComplexDependencies:{createComplexClass:kh},DenseMatrixDependencies:kt,FractionDependencies:{createFractionClass:kS},createTyped:w8("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:n,DenseMatrix:r,Fraction:i}=e,o=kO();return o.types=[{name:"number",test:wp},{name:"Complex",test:wg},{name:"BigNumber",test:wm},{name:"Fraction",test:wv},{name:"Unit",test:wy},{name:"string",test:wb},{name:"Chain",test:wX},{name:"Array",test:wx},{name:"Matrix",test:ww},{name:"DenseMatrix",test:wC},{name:"SparseMatrix",test:wk},{name:"Range",test:wM},{name:"Index",test:wT},{name:"boolean",test:wA},{name:"ResultSet",test:wD},{name:"Help",test:wE},{name:"function",test:wO},{name:"Date",test:wR},{name:"RegExp",test:wP},{name:"null",test:wN},{name:"undefined",test:wj},{name:"AccessorNode",test:wL},{name:"ArrayNode",test:wF},{name:"AssignmentNode",test:wZ},{name:"BlockNode",test:wB},{name:"ConditionalNode",test:wV},{name:"ConstantNode",test:wz},{name:"FunctionNode",test:wH},{name:"FunctionAssignmentNode",test:w_},{name:"IndexNode",test:w$},{name:"Node",test:wW},{name:"ObjectNode",test:wq},{name:"OperatorNode",test:wG},{name:"ParenthesisNode",test:wU},{name:"RangeNode",test:wK},{name:"SymbolNode",test:wY},{name:"Map",test:kE},{name:"Object",test:wI}],o.conversions=[{from:"number",to:"BigNumber",convert:function(e){if(t||kR(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return n||kP(e),new n(e,0)}},{from:"number",to:"string",convert:function(e){return e+""}},{from:"BigNumber",to:"Complex",convert:function(e){return n||kP(e),new n(e.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return n||kP(e),new n(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||kI(e);var t=new i(e);if(t.valueOf()!==e)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){var t=Number(e);if(isNaN(t))throw Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||kR(e);try{return new t(e)}catch(t){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||kI(e);try{return new i(e)}catch(t){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){n||kP(e);try{return new n(e)}catch(t){throw Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||kR(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||kI(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return r||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new r(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}],o})},kj="equalScalar",kL=w8(kj,["typed","config"],e=>{var{typed:t,config:n}=e;return t(kj,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return Sa(e,t,n.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||function(e,t,n){if(null==n)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var r=e.minus(t).abs();if(r.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return r.lte(i.times(n))}return!1}(e,t,n.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){var r;return r=n.epsilon,Sa(e.re,t.re,r)&&Sa(e.im,t.im,r)},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw Error("Cannot compare units with different base");return this(e.value,t.value)}})});w8(kj,["typed","config"],e=>{var{typed:t,config:n}=e;return t(kj,{"number, number":function(e,t){return Sa(e,t,n.epsilon)}})});var kF={typedDependencies:kN,createEqualScalar:kL},kZ=w8("SparseMatrix",["typed","equalScalar","Matrix"],e=>{var{typed:t,equalScalar:n,Matrix:r}=e;function i(e,t){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");if(t&&!wb(t))throw Error("Invalid datatype: "+t);if(ww(e)){var n,r,s;n=this,r=e,s=t,"SparseMatrix"===r.type?(n._values=r._values?wJ(r._values):void 0,n._index=wJ(r._index),n._ptr=wJ(r._ptr),n._size=wJ(r._size),n._datatype=s||r._datatype):o(n,r.valueOf(),s||r._datatype)}else if(e&&wx(e.index)&&wx(e.ptr)&&wx(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(wx(e))o(this,e,t);else if(e)throw TypeError("Unsupported type of data ("+wQ(e)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}function o(e,r,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var o=r.length,s=0,a=n,l=0;if(wb(i)&&(a=t.find(n,[i,i])||n,l=t.convert(0,i)),o>0){var u=0;do{e._ptr.push(e._index.length);for(var c=0;c<o;c++){var h=r[c];if(wx(h)){if(0===u&&s<h.length&&(s=h.length),u<h.length){var d=h[u];a(d,l)||(e._values.push(d),e._index.push(c))}}else 0===u&&s<1&&(s=1),a(h,l)||(e._values.push(h),e._index.push(c))}u++}while(u<s)}e._ptr.push(e._index.length),e._size=[o,s]}function s(e,t,n,r){if(n-t==0)return n;for(var i=t;i<n;i++)if(r[i]===e)return i;return t}function a(e,t,n,r,i,o,s){i.splice(e,0,r),o.splice(e,0,t);for(var a=n+1;a<s.length;a++)s[a]++}function l(e,r,i,o){var s,a,l,u=o||0,c=n,h=0;wb(e._datatype)&&(c=t.find(n,[e._datatype,e._datatype])||n,h=t.convert(0,e._datatype),u=t.convert(u,e._datatype));var d=!c(u,h),f=e._size[0],p=e._size[1];if(i>p){for(a=p;a<i;a++)if(e._ptr[a]=e._values.length,d)for(s=0;s<f;s++)e._values.push(u),e._index.push(s);e._ptr[i]=e._values.length}else i<p&&(e._ptr.splice(i+1,p-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(p=i,r>f){if(d){var m=0;for(a=0;a<p;a++){e._ptr[a]=e._ptr[a]+m,l=e._ptr[a+1]+m;var g=0;for(s=f;s<r;s++,g++)e._values.splice(l+g,0,u),e._index.splice(l+g,0,s),m++}e._ptr[p]=e._values.length}}else if(r<f){var v=0;for(a=0;a<p;a++){e._ptr[a]=e._ptr[a]-v;var y=e._ptr[a],b=e._ptr[a+1]-v;for(l=y;l<b;l++)(s=e._index[l])>r-1&&(e._values.splice(l,1),e._index.splice(l,1),v++)}e._ptr[a]=e._values.length}return e._size[0]=r,e._size[1]=i,e}function u(e,t,n,r,i){var o,s,a=r[0],l=r[1],u=[];for(o=0;o<a;o++)for(s=0,u[o]=[];s<l;s++)u[o][s]=0;for(s=0;s<l;s++)for(var c=n[s],h=n[s+1],d=c;d<h;d++)u[o=t[d]][s]=e?i?wJ(e[d]):e[d]:1;return u}return i.prototype=new r,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Sx(this._values,wQ)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,n){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!wT(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var n,r,o,s,a=t.size();if(a.length!==e._size.length)throw new Sh(a.length,e._size.length);var l=t.min(),u=t.max();for(n=0,r=e._size.length;n<r;n++)Sm(l[n],e._size[n]),Sm(u[n],e._size[n]);var c=e._values,h=e._index,d=e._ptr,f=t.dimension(0),p=t.dimension(1),m=[],g=[];f.forEach(function(e,t){g[e]=t[0],m[e]=!0});var v=c?[]:void 0,y=[],b=[];return p.forEach(function(e){for(b.push(y.length),o=d[e],s=d[e+1];o<s;o++)!0===m[n=h[o]]&&(y.push(g[n]),v&&v.push(c[o]))}),b.push(y.length),new i({values:v,index:y,ptr:b,size:a,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,n,r){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var i,o=t.size(),s=t.isScalar();if(ww(n)?(i=n.size(),n=n.toArray()):i=Sf(n),s){if(0!==i.length)throw TypeError("Scalar expected");e.set(t.min(),n,r)}else{if(1!==o.length&&2!==o.length)throw new Sh(o.length,e._size.length,"<");if(i.length<o.length){for(var a=0,l=0;1===o[a]&&1===i[a];)a++;for(;1===o[a];)l++,a++;n=Sb(n,o.length,l,i)}if(!w1(o,i))throw new Sh(o,i,">");if(1===o.length)t.dimension(0).forEach(function(t,i){Sm(t),e.set([t,0],n[i[0]],r)});else{var u=t.dimension(0),c=t.dimension(1);u.forEach(function(t,i){Sm(t),c.forEach(function(o,s){Sm(o),e.set([t,o],n[i[0]][s[0]],r)})})}}return e}(this,e,t,n);default:throw SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!wx(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new Sh(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var t=e[0],n=e[1];Sm(t,this._size[0]),Sm(n,this._size[1]);var r=s(t,this._ptr[n],this._ptr[n+1],this._index);return r<this._ptr[n+1]&&this._index[r]===t?this._values[r]:0},i.prototype.set=function(e,r,i){if(!wx(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new Sh(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var o=e[0],u=e[1],c=this._size[0],h=this._size[1],d=n,f=0;wb(this._datatype)&&(d=t.find(n,[this._datatype,this._datatype])||n,f=t.convert(0,this._datatype)),(o>c-1||u>h-1)&&(l(this,Math.max(o+1,c),Math.max(u+1,h),i),c=this._size[0],h=this._size[1]),Sm(o,c),Sm(u,h);var p=s(o,this._ptr[u],this._ptr[u+1],this._index);return p<this._ptr[u+1]&&this._index[p]===o?d(r,f)?function(e,t,n,r,i){n.splice(e,1),r.splice(e,1);for(var o=t+1;o<i.length;o++)i[o]--}(p,u,this._values,this._index,this._ptr):this._values[p]=r:a(p,o,u,r,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,n){if(!wS(e))throw TypeError("Array or Matrix expected");var r=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);if(2!==r.length)throw Error("Only two dimensions matrix are supported");return r.forEach(function(e){if(!wp(e)||!w7(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+Sc(r)+")")}),l(n?this.clone():this,r[0],r[1],t)},i.prototype.reshape=function(e,t){if(!wx(e))throw TypeError("Array expected");if(2!==e.length)throw Error("Sparse matrices can only be reshaped in two dimensions");e.forEach(function(t){if(!wp(t)||!w7(t)||t<=-2||0===t)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+Sc(e)+")")});var n=this._size[0]*this._size[1],r=(e=Sv(e,n))[0]*e[1];if(n!==r)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var i=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return i;for(var o=[],l=0;l<i._ptr.length;l++)for(var u=0;u<i._ptr[l+1]-i._ptr[l];u++)o.push(l);for(var c=i._values.slice(),h=i._index.slice(),d=0;d<i._index.length;d++){var f=h[d],p=o[d],m=f*i._size[1]+p;o[d]=m%e[1],h[d]=Math.floor(m/e[1])}i._values.length=0,i._index.length=0,i._ptr.length=e[1]+1,i._size=e.slice();for(var g=0;g<i._ptr.length;g++)i._ptr[g]=0;for(var v=0;v<c.length;v++){var y=h[v],b=o[v],x=c[v];a(s(y,i._ptr[b],i._ptr[b+1],i._index),y,b,x,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?wJ(this._values):void 0,index:wJ(this._index),ptr:wJ(this._ptr),size:wJ(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,r){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var o=this;return function(e,r,o,s,a,l,u){var c=[],h=[],d=[],f=n,p=0;wb(e._datatype)&&(f=t.find(n,[e._datatype,e._datatype])||n,p=t.convert(0,e._datatype));for(var m=function(e,t,n){e=l(e,t,n),f(e,p)||(c.push(e),h.push(t))},g=0;g<=a;g++){d.push(c.length);var v=e._ptr[g],y=e._ptr[g+1];if(u)for(var b=v;b<y;b++){var x=e._index[b];x>=0&&x<=o&&m(e._values[b],x-r,g-s)}else{for(var w={},S=v;S<y;S++)w[e._index[S]]=e._values[S];for(var C=r;C<=o;C++)m(C in w?w[C]:0,C-r,g-s)}}return d.push(c.length),new i({values:c,index:h,ptr:d,size:[o-r+1,a-s+1]})}(this,0,this._size[0]-1,0,this._size[1]-1,function(t,n,r){return e(t,[n,r],o)},r)},i.prototype.forEach=function(e,t){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var n=this._size[0],r=this._size[1],i=0;i<r;i++){var o=this._ptr[i],s=this._ptr[i+1];if(t)for(var a=o;a<s;a++){var l=this._index[a];e(this._values[a],[l,i],this)}else{for(var u={},c=o;c<s;c++)u[this._index[c]]=this._values[c];for(var h=0;h<n;h++)e(h in u?u[h]:0,[h,i],this)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],t=0;t<e;t++)for(var n=this._ptr[t],r=this._ptr[t+1],i=n;i<r;i++){var o=this._index[i];yield{value:this._values[i],index:[o,t]}}},i.prototype.toArray=function(){return u(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return u(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var t=this._size[0],n=this._size[1],r=this.density(),i="Sparse Matrix ["+Sc(t,e)+" x "+Sc(n,e)+"] density: "+Sc(r,e)+"\n",o=0;o<n;o++)for(var s=this._ptr[o],a=this._ptr[o+1],l=s;l<a;l++)i+="\n ("+Sc(this._index[l],e)+", "+Sc(o,e)+") ==> "+(this._values?Sc(this._values[l],e):"X");return i},i.prototype.toString=function(){return Sc(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(wm(e)&&(e=e.toNumber()),!wp(e)||!w7(e))throw TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,n=e<0?-e:0,r=this._size[0],o=this._size[1],s=Math.min(r-n,o-t),a=[],l=[],u=[];u[0]=0;for(var c=t;c<o&&a.length<s;c++)for(var h=this._ptr[c],d=this._ptr[c+1],f=h;f<d;f++){var p=this._index[f];if(p===c-t+n){a.push(this._values[f]),l[a.length-1]=p-n;break}}return u.push(a.length),new i({values:a,index:l,ptr:u,size:[s,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,r,o,s,a){if(!wx(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(wm(e)&&(e=e.toNumber()),!wp(e)||!w7(e)||e<1)throw Error("Size values must be positive integers");return e}),o){if(wm(o)&&(o=o.toNumber()),!wp(o)||!w7(o))throw TypeError("The parameter k must be an integer number")}else o=0;var l,u=n,c=0;wb(a)&&(u=t.find(n,[a,a])||n,c=t.convert(0,a));var h=o>0?o:0,d=o<0?-o:0,f=e[0],p=e[1],m=Math.min(f-d,p-h);if(wx(r)){if(r.length!==m)throw Error("Invalid value array length");l=function(e){return r[e]}}else if(ww(r)){var g=r.size();if(1!==g.length||g[0]!==m)throw Error("Invalid matrix length");l=function(e){return r.get([e])}}else l=function(){return r};for(var v=[],y=[],b=[],x=0;x<p;x++){b.push(v.length);var w=x-h;if(w>=0&&w<m){var S=l(w);u(S,c)||(y.push(w+d),v.push(S))}}return b.push(v.length),new i({values:v,index:y,ptr:b,size:[f,p]})},i.prototype.swapRows=function(e,t){if(!wp(e)||!w7(e)||!wp(t)||!w7(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return Sm(e,this._size[0]),Sm(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,n,r,i){for(var o=r[e],s=r[e+1],a=o;a<s;a++)i(n[a],t[a])},i._swapRows=function(e,t,n,r,i,o){for(var a=0;a<n;a++){var l=o[a],u=o[a+1],c=s(e,l,u,i),h=s(t,l,u,i);if(c<u&&h<u&&i[c]===e&&i[h]===t){if(r){var d=r[c];r[c]=r[h],r[h]=d}continue}if(c<u&&i[c]===e&&(h>=u||i[h]!==t)){var f=r?r[c]:void 0;i.splice(h,0,t),r&&r.splice(h,0,f),i.splice(h<=c?c+1:c,1),r&&r.splice(h<=c?c+1:c,1);continue}if(h<u&&i[h]===t&&(c>=u||i[c]!==e)){var p=r?r[h]:void 0;i.splice(c,0,e),r&&r.splice(c,0,p),i.splice(c<=h?h+1:h,1),r&&r.splice(c<=h?h+1:h,1)}}},i},{isClass:!0}),kB="matrix",kV=w8(kB,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(kB,{"":function(){return o([])},string:function(e){return o([],e)},"string, string":function(e,t){return o([],e,t)},Array:function(e){return o(e)},Matrix:function(e){return o(e,e.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(e,t,n){if("dense"===t||"default"===t||void 0===t)return new r(e,n);if("sparse"===t)return new i(e,n);throw TypeError("Unknown matrix type "+JSON.stringify(t)+".")}}),kz=w8("algorithm01",["typed"],e=>{var{typed:t}=e;return function(e,n,r,i){var o,s,a=e._data,l=e._size,u=e._datatype,c=n._values,h=n._index,d=n._ptr,f=n._size,p=n._datatype;if(l.length!==f.length)throw new Sh(l.length,f.length);if(l[0]!==f[0]||l[1]!==f[1])throw RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+f+")");if(!c)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=l[0],g=l[1],v="string"==typeof u&&u===p?u:void 0,y=v?t.find(r,[v,v]):r,b=[];for(o=0;o<m;o++)b[o]=[];var x=[],w=[];for(s=0;s<g;s++){for(var S=s+1,C=d[s],k=d[s+1],M=C;M<k;M++)x[o=h[M]]=i?y(c[M],a[o][s]):y(a[o][s],c[M]),w[o]=S;for(o=0;o<m;o++)w[o]===S?b[o][s]=x[o]:b[o][s]=a[o][s]}return e.createDenseMatrix({data:b,size:[m,g],datatype:v})}}),k_=w8("algorithm04",["typed","equalScalar"],e=>{var{typed:t,equalScalar:n}=e;return function(e,r,i){var o,s,a,l,u,c,h=e._values,d=e._index,f=e._ptr,p=e._size,m=e._datatype,g=r._values,v=r._index,y=r._ptr,b=r._size,x=r._datatype;if(p.length!==b.length)throw new Sh(p.length,b.length);if(p[0]!==b[0]||p[1]!==b[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+b+")");var w=p[0],S=p[1],C=n,k=0,M=i;"string"==typeof m&&m===x&&(o=m,C=t.find(n,[o,o]),k=t.convert(0,o),M=t.find(i,[o,o]));var T=h&&g?[]:void 0,A=[],D=[],E=h&&g?[]:void 0,O=h&&g?[]:void 0,R=[],P=[];for(a=0;a<S;a++){D[a]=A.length;var I=a+1;for(u=f[a],c=f[a+1],l=u;l<c;l++)s=d[l],A.push(s),R[s]=I,E&&(E[s]=h[l]);for(u=y[a],c=y[a+1],l=u;l<c;l++)if(R[s=v[l]]===I){if(E){var N=M(E[s],g[l]);C(N,k)?R[s]=null:E[s]=N}}else A.push(s),P[s]=I,O&&(O[s]=g[l]);if(E&&O)for(l=D[a];l<A.length;)R[s=A[l]]===I?(T[l]=E[s],l++):P[s]===I?(T[l]=O[s],l++):A.splice(l,1)}return D[S]=A.length,e.createSparseMatrix({values:T,index:A,ptr:D,size:[w,S],datatype:o})}}),kH=w8("algorithm10",["typed","DenseMatrix"],e=>{var{typed:t,DenseMatrix:n}=e;return function(e,r,i,o){var s,a=e._values,l=e._index,u=e._ptr,c=e._size,h=e._datatype;if(!a)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=c[0],f=c[1],p=i;"string"==typeof h&&(s=h,r=t.convert(r,s),p=t.find(i,[s,s]));for(var m=[],g=[],v=[],y=0;y<f;y++){for(var b=y+1,x=u[y],w=u[y+1],S=x;S<w;S++){var C=l[S];g[C]=a[S],v[C]=b}for(var k=0;k<d;k++)0===y&&(m[k]=[]),v[k]===b?m[k][y]=o?p(r,g[k]):p(g[k],r):m[k][y]=r}return new n({data:m,size:[d,f],datatype:s})}}),k$=w8("algorithm13",["typed"],e=>{var{typed:t}=e;return function(e,n,r){var i,o=e._data,s=e._size,a=e._datatype,l=n._data,u=n._size,c=n._datatype,h=[];if(s.length!==u.length)throw new Sh(s.length,u.length);for(var d=0;d<s.length;d++){if(s[d]!==u[d])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+u+")");h[d]=s[d]}var f=r;"string"==typeof a&&a===c&&(i=a,f=t.find(r,[i,i]));var p=h.length>0?function e(t,n,r,i,o,s){var a=[];if(n===r.length-1)for(var l=0;l<i;l++)a[l]=t(o[l],s[l]);else for(var u=0;u<i;u++)a[u]=e(t,n+1,r,r[n+1],o[u],s[u]);return a}(f,0,h,h[0],o,l):[];return e.createDenseMatrix({data:p,size:h,datatype:i})}}),kW=w8("algorithm14",["typed"],e=>{var{typed:t}=e;return function(e,n,r,i){var o,s=e._data,a=e._size,l=e._datatype,u=r;"string"==typeof l&&(o=l,n=t.convert(n,o),u=t.find(r,[o,o]));var c=a.length>0?function e(t,n,r,i,o,s,a){var l=[];if(n===r.length-1)for(var u=0;u<i;u++)l[u]=a?t(s,o[u]):t(o[u],s);else for(var c=0;c<i;c++)l[c]=e(t,n+1,r,r[n+1],o[c],s,a);return l}(u,0,a,a[0],s,n,i):[];return e.createDenseMatrix({data:c,size:wJ(a),datatype:o})}});function kq(e,t){var n;if(!w7(e)||!w7(t))throw Error("Parameters in function gcd must be integer numbers");for(;0!==t;)n=e%t,e=t,t=n;return e<0?-e:e}kq.signature="number, number";let{gcd:kG}=function e(t,n){var r,i,o,s=(0,ay.Z)({},SC,n);if("function"!=typeof Object.create)throw Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var a=(r={isNumber:wp,isComplex:wg,isBigNumber:wm,isFraction:wv,isUnit:wy,isString:wb,isArray:wx,isMatrix:ww,isCollection:wS,isDenseMatrix:wC,isSparseMatrix:wk,isRange:wM,isIndex:wT,isBoolean:wA,isResultSet:wD,isHelp:wE,isFunction:wO,isDate:wR,isRegExp:wP,isObject:wI,isNull:wN,isUndefined:wj,isAccessorNode:wL,isArrayNode:wF,isAssignmentNode:wZ,isBlockNode:wB,isConditionalNode:wV,isConstantNode:wz,isFunctionAssignmentNode:w_,isFunctionNode:wH,isIndexNode:w$,isNode:wW,isObjectNode:wq,isOperatorNode:wG,isParenthesisNode:wU,isRangeNode:wK,isSymbolNode:wY,isChain:wX},i=new w4,r.on=i.on.bind(i),r.off=i.off.bind(i),r.once=i.once.bind(i),r.emit=i.emit.bind(i),r);a.config=function(e,t){function n(n){if(!n)return w0(e,wJ);var r=w0(e,wJ);ST(n,"matrix",Sk),ST(n,"number",SM),function e(t,n){if(Array.isArray(n))throw TypeError("Arrays are not supported by deepExtend");for(var r in n)if(w5(n,r)&&!(r in Object.prototype)&&!(r in Function.prototype)){if(n[r]&&n[r].constructor===Object)void 0===t[r]&&(t[r]={}),t[r]&&t[r].constructor===Object?e(t[r],n[r]):t[r]=n[r];else if(Array.isArray(n[r]))throw TypeError("Arrays are not supported by deepExtend");else t[r]=n[r]}return t}(e,n);var i=w0(e,wJ);return t("config",i,r,w0(n,wJ)),i}return n.MATRIX_OPTIONS=Sk,n.NUMBER_OPTIONS=SM,Object.keys(SC).forEach(t=>{Object.defineProperty(n,t,{get:()=>e[t],enumerable:!0,configurable:!0})}),n}(s,a.emit),a.expression={transform:{},mathWithTransform:{config:a.config}};var l={},u=function(e,t,n,r){function i(e,t){t&&"function"==typeof t.transform?(n.expression.transform[e]=t.transform,w5(a,e)||(n.expression.mathWithTransform[e]=t.transform)):(delete n.expression.transform[e],w5(a,e)||(n.expression.mathWithTransform[e]=t))}function o(e){return"function"==typeof e&&"object"==typeof e.signatures}function s(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction}var a={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(t,l){var u=arguments.length;if(1!==u&&2!==u)throw new SS("import",u,1,2);l||(l={});var c={};for(var h in!function e(t,n,r){if(Array.isArray(n))n.forEach(n=>e(t,n));else if("object"==typeof n)for(var i in n)w5(n,i)&&e(t,n[i],i);else if(w6(n)||void 0!==r){var o=w6(n)?s(n)?n.fn+".transform":n.fn:r;if(w5(t,o)&&t[o]!==n&&!l.silent)throw Error('Cannot import "'+o+'" twice');t[o]=n}else if(!l.silent)throw TypeError("Factory, Object, or Array expected")}(c,t),c)if(w5(c,h)){var d,f=c[h];if(w6(f))!function(t,i){var l,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.fn;if(Sw(u,"."))throw Error("Factory name should not contain a nested path. Name: "+JSON.stringify(u));var c=s(t)?n.expression.transform:n,h=u in n.expression.transform,d=w5(c,u)?c[u]:void 0,f=function(){var r={};t.dependencies.map(w9).forEach(e=>{if(Sw(e,"."))throw Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?r.math=n:"mathWithTransform"===e?r.mathWithTransform=n.expression.mathWithTransform:"classes"===e?r.classes=n:r[e]=n[e]});var s=t(r);if(s&&"function"==typeof s.transform)throw Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===d||i.override)return s;if(o(d)&&o(s))return e(d,s);if(i.silent)return d;throw Error('Cannot import "'+u+'": already exists')};t.meta&&!1===t.meta.lazy?c[u]=f():w2(c,u,f),d&&h?function(e){delete n.expression.transform[e],w5(a,e)?delete n.expression.mathWithTransform[e]:n.expression.mathWithTransform[e]=n[e]}(u):!s(t)&&(-1!==(l=t).fn.indexOf(".")||w5(a,l.fn)||l.meta&&l.meta.isClass)||w2(n.expression.mathWithTransform,u,()=>c[u]),r[u]=t,n.emit("import",u,f)}(f,l);else{if("function"==typeof(d=f)||"number"==typeof d||"string"==typeof d||"boolean"==typeof d||null===d||wy(d)||wg(d)||wm(d)||wv(d)||ww(d)||Array.isArray(d))!function(t,s,a){var l;if(a.wrap&&"function"==typeof s&&(s=function(e){var t=function(){for(var t=[],r=0,i=arguments.length;r<i;r++){var o=arguments[r];t[r]=o&&o.valueOf()}return e.apply(n,t)};return e.transform&&(t.transform=e.transform),t}(s)),"function"==typeof(l=s)&&"string"==typeof l.signature&&(s=e(t,{[s.signature]:s})),o(n[t])&&o(s)){s=a.override?e(t,s.signatures):e(n[t],s),n[t]=s,delete r[t],i(t,s),n.emit("import",t,function(){return s});return}if(void 0===n[t]||a.override){n[t]=s,delete r[t],i(t,s),n.emit("import",t,function(){return s});return}if(!a.silent)throw Error('Cannot import "'+t+'": already exists')}(h,f,l);else if(!l.silent)throw TypeError("Factory, Object, or Array expected")}}}}(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return a.typed.apply(a.typed,t)},0,a,l);return a.import=u,a.on("config",()=>{w3(l).forEach(e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&u(e,{override:!0})})}),a.create=e.bind(null,t),a.factory=w8,a.import(w3((function e(t,n){for(var r in t)if(w5(t,r)){var i=t[r];"object"==typeof i&&null!==i?e(i,n):n[r]=i}}(t,o={}),o))),a.ArgumentsError=SS,a.DimensionError=Sh,a.IndexError=Sd,a}({gcdDependencies:{BigNumberDependencies:C7,DenseMatrixDependencies:kt,equalScalarDependencies:kF,matrixDependencies:{DenseMatrixDependencies:kt,MatrixDependencies:ke,SparseMatrixDependencies:{MatrixDependencies:ke,equalScalarDependencies:kF,typedDependencies:kN,createSparseMatrixClass:kZ},typedDependencies:kN,createMatrix:kV},typedDependencies:kN,createGcd:w8("gcd",["typed","matrix","equalScalar","BigNumber","DenseMatrix"],e=>{var{typed:t,matrix:n,equalScalar:r,BigNumber:i,DenseMatrix:o}=e,s=kz({typed:t}),a=k_({typed:t,equalScalar:r}),l=kH({typed:t,DenseMatrix:o}),u=k$({typed:t}),c=kW({typed:t});return t("gcd",{"number, number":kq,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw Error("Parameters in function gcd must be integer numbers");for(var n=new i(0);!t.isZero();){var r=e.mod(t);e=t,t=r}return e.lt(n)?e.neg():e},"Fraction, Fraction":function(e,t){return e.gcd(t)},"SparseMatrix, SparseMatrix":function(e,t){return a(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return s(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return s(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,this)},"Array, Array":function(e,t){return this(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return this(n(e),t)},"Matrix, Array":function(e,t){return this(e,n(t))},"SparseMatrix, number | BigNumber":function(e,t){return l(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return c(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return l(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return c(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return c(n(e),t,this,!1).valueOf()},"number | BigNumber, Array":function(e,t){return c(n(t),e,this,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(e,t,n){for(var r=this(e,t),i=0;i<n.length;i++)r=this(r,n[i]);return r}})})}}),kU=(0,m.memo)(function({containerId:e,chartRef:t,data:n,seriesMapping:r,enablePinning:i=!0,wrapLabels:o,format:s,onUnpinClick:a,pinnedPos:l}){let[u,c]=(0,m.useState)(!1),h=(0,m.useRef)(),d=b6(),{height:f,width:g,ref:v}=xr()(),y=null!==l&&i;if(null===d||null===d.target||null===n||null===l&&"CANVAS"!==d.target.tagName)return null;let b=t.current,x=b?.getWidth()??bX,w=e?document.querySelector(e):void 0,S=w?w.getBoundingClientRect().height:void 0;y||(h.current=xP(d,x,l,f??0,g??0,w));let C=xD({mousePos:d,data:n,seriesMapping:r,pinnedPos:l,chart:b,format:s,showAllSeries:u});if(0===C.length)return null;let k=n.length;return(0,p.jsx)(xt.Z,{container:w,children:(0,p.jsx)(W.Z,{ref:v,sx:e=>xI(e,l,S),style:{transform:h.current},children:(0,p.jsxs)(ed.Z,{spacing:.5,children:[(0,p.jsx)(xh,{nearbySeries:C,totalSeries:k,enablePinning:i,isTooltipPinned:y,showAllSeries:u,onShowAllClick:e=>c(e),onUnpinClick:a}),(0,p.jsx)(xa,{series:C,wrapLabels:o})]})})})});(0,Z.D)([bO.N,B.N,V.N,z.N,en.N,bR.N,bP.N,bI.N,_.N,bN.N,H.N,$.N]);let kK=(0,m.forwardRef)(function({height:e,data:t,seriesMapping:n,timeScale:r,yAxis:i,format:o,grid:s,isStackedBar:a=!1,tooltipConfig:l=b9,noDataVariant:u="message",syncGroup:c,onDataZoom:h,onDoubleClick:d,__experimentalEChartsOptionsOverride:f},g){let v;let{chartsTheme:y,enablePinning:b,lastTooltipPinnedCoords:x,setLastTooltipPinnedCoords:w}=U(),S=l.enablePinning&&b,C=(0,m.useRef)(),[k,M]=(0,m.useState)(!0),[T,A]=(0,m.useState)(null),[D,E]=(0,m.useState)(null),[O,R]=(0,m.useState)(!1),[P,I]=(0,m.useState)(0),{timeZone:N}=b$();if(void 0===r){let e=function(e){let t,n;let r=[];for(let t of e)if(t&&"timeRange"in t){if(void 0===t||void 0===t.timeRange||void 0===t.stepMs)continue;if(r.push(t.stepMs),void 0===n){n=t.timeRange;continue}t.timeRange.start<n.start&&(n.start=t.timeRange.start),t.timeRange.end>n.end&&(n.end=t.timeRange.end)}else if(t&&"values"in t){for(let e=0;e<t.values.length;e++){let r=t.values[e];if(void 0===r)continue;let[i]=r,o=new Date(i),s=new Date(i);if(void 0===n){n={start:o,end:s};continue}o<n.start&&(n.start=o),s>n.end&&(n.end=s)}if(void 0===n)return;let e=n.start.valueOf(),r=n.end.valueOf(),i=r-e;return{startMs:e,endMs:r,rangeMs:i,stepMs:10}}if(void 0===n)return;if(1===r.length)t=r[0];else{let e=kG(...r);t=e<10?10:e}let i=n.start.valueOf(),o=n.end.valueOf();return{startMs:i,endMs:o,stepMs:t,rangeMs:o-i}}(t);if(void 0===e){let e=new Date,t=new Date(e);t.setFullYear(e.getFullYear()-5);let n=e.getTime(),r=t.getTime();v={startMs:r,endMs:n,stepMs:1,rangeMs:n-r}}else v=e}else v=r;(0,m.useImperativeHandle)(g,()=>({highlightSeries({name:e}){C.current&&C.current.dispatchAction({type:"highlight",seriesId:e})},clearHighlightedSeries:()=>{C.current&&xv(C.current)}}),[]);let j=(0,m.useMemo)(()=>({datazoom:e=>{if(void 0===h&&setTimeout(()=>{A(null)},10),void 0===h||void 0===e.batch[0])return;let t=e.batch[0].startValue,n=e.batch[0].endValue;void 0!==t&&void 0!==n&&h({start:t,end:n})},finished:()=>{void 0!==C.current&&xm(C.current)}}),[h,A]),{noDataOption:L}=y,F=(0,m.useMemo)(()=>{if(null===t||0===t.length&&"message"===u)return L;let e=[],r="local"===N;t.map((t,n)=>{let i=t.values.map(([e,t])=>[r?e:(0,bj.toZonedTime)(e,N),null===t?"-":t]);e.push({id:n,source:[...i],dimensions:["time","value"]})});let l={dataset:e,series:b&&null!==D?[...n,D]:n,xAxis:{type:"time",min:r?v.startMs:(0,bj.toZonedTime)(v.startMs,N),max:r?v.endMs:(0,bj.toZonedTime)(v.endMs,N),axisLabel:{hideOverlap:!0,formatter:bV(v.rangeMs??0)},axisPointer:{snap:!1}},yAxis:eu(i,o),animation:!1,tooltip:{show:!0,showContent:a,trigger:a?"item":"axis",appendToBody:a},axisPointer:{type:"line",z:0,triggerEmphasis:!1,triggerTooltip:!1,snap:!1},toolbox:{feature:{dataZoom:{icon:null,yAxisIndex:"none"}}},grid:s};return f?f(l):l},[t,n,v,i,o,s,L,f,u,N,a,b,D]);return(0,m.useEffect)(()=>{null===T||null===x||Q()(x,T)||(A(null),null!==T&&null!==D&&E(null))},[x,n]),(0,p.jsxs)(W.Z,{style:{height:e},onClick:e=>{let n=e.ctrlKey||e.metaKey;n&&e.preventDefault();let r=xy(e.nativeEvent.offsetX,e.nativeEvent.offsetY,C.current);if(null!==r&&S&&e.target instanceof HTMLCanvasElement){let i={page:{x:e.pageX,y:e.pageY},client:{x:e.clientX,y:e.clientY},plotCanvas:{x:e.nativeEvent.offsetX,y:e.nativeEvent.offsetY},target:e.target};A(e=>null===e?i:(E(null),null)),E(e=>{if(null!==e)return null;{let e=r[0],n=xw(t[0]?.values,e);return el()({},xp,{markLine:{data:[{xAxis:n}]}})}}),n||w(i)}},onMouseDown:e=>{let{clientX:t}=e;R(!0),I(t)},onMouseMove:e=>{if(!(e.target instanceof HTMLCanvasElement))return;let{clientX:t}=e;O&&t-P>0&&M(!1)},onMouseUp:()=>{R(!1),I(0),M(!0)},onMouseLeave:()=>{null===T&&M(!1),void 0!==C.current&&xv(C.current)},onMouseEnter:()=>{M(!0),void 0!==C.current&&xm(C.current)},onDoubleClick:e=>{A(null),void 0===d?void 0!==C.current&&xg(C.current):d(e)},children:[!0===k&&F.tooltip?.showContent===!1&&!0!==l.hidden&&(0,p.jsx)(kU,{containerId:y.tooltipPortalContainerId,chartRef:C,data:t,seriesMapping:n,wrapLabels:l.wrapLabels,enablePinning:S,pinnedPos:T,format:o,onUnpinClick:()=>{A(null),E(null)}}),(0,p.jsx)(es,{sx:{width:"100%",height:"100%"},option:F,theme:y.echartsTheme,onEvents:j,_instance:C,syncGroup:c})]})});var kY=n(63767),kX=n(59986),kQ=n(29085),kJ=n(22179),k0=n(53126),k1=n(92994);function k2({props:e,name:t}){return(0,kJ.Z)({props:e,name:t,defaultTheme:k0.Z,themeId:k1.Z})}let k5=["localeText"],k3=m.createContext(null),k4=function(e){let{localeText:t}=e,n=(0,ab.Z)(e,k5),{utils:r,localeText:i}=m.useContext(k3)??{utils:void 0,localeText:void 0},{children:o,dateAdapter:s,dateFormats:a,dateLibInstance:l,adapterLocale:u,localeText:c}=k2({props:n,name:"MuiLocalizationProvider"}),h=m.useMemo(()=>(0,ay.Z)({},c,i,t),[c,i,t]),d=m.useMemo(()=>{if(!s)return r||null;let e=new s({locale:u,formats:a,instance:l});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,u,a,l,r]),f=m.useMemo(()=>d?{minDate:d.date("1900-01-01T00:00:00.000"),maxDate:d.date("2099-12-31T00:00:00.000")}:null,[d]),g=m.useMemo(()=>({utils:d,defaultDates:f,localeText:h}),[f,d,h]);return(0,p.jsx)(k3.Provider,{value:g,children:o})};var k8=n(23615),k6=n.n(k8);let k9={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)?`Selected time is ${r??n.format(t,"fullTime")}`:"No time selected"}`,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,ay.Z)({},k9);let k7=()=>{let e=m.useContext(k3);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=m.useMemo(()=>(0,ay.Z)({},k9,e.localeText),[e.localeText]);return m.useMemo(()=>(0,ay.Z)({},e,{localeText:t}),[e,t])},Me=()=>k7().utils,Mt=()=>k7().defaultDates,Mn=e=>{let t=Me(),n=m.useRef(void 0);return void 0===n.current&&(n.current=t.date(void 0,e)),n.current},Mr=(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))},Mi=({date:e,disableFuture:t,disablePast:n,maxDate:r,minDate:i,isDateDisabled:o,utils:s,timezone:a})=>{let l=Mr(s,s.date(void 0,a),e);n&&s.isBefore(i,l)&&(i=l),t&&s.isAfter(r,l)&&(r=l);let u=e,c=e;for(s.isBefore(e,i)&&(u=i,c=null),s.isAfter(e,r)&&(c&&(c=r),u=null);u||c;){if(u&&s.isAfter(u,r)&&(u=null),c&&s.isBefore(c,i)&&(c=null),u){if(!o(u))return u;u=s.addDays(u,1)}if(c){if(!o(c))return c;c=s.addDays(c,-1)}}return null},Mo=(e,t,n)=>null!=t&&e.isValid(t)?t:n,Ms=(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},Ma=(e,t,n)=>"date"===n?e.startOfDay(e.date(void 0,t)):e.date(void 0,t),Ml=(e,t)=>{let n=e.setHours(e.date(),"am"===t?2:14);return e.format(n,"meridiem")},Mu=["year","month","day"],Mc=e=>Mu.includes(e),Mh=(e,t)=>{let n=e.startOfWeek(t);return[0,1,2,3,4,5,6].map(t=>e.addDays(n,t))};var Md=n(49408),Mf=n(87716),Mp=n(16052);let Mm=(0,i9.Z)((0,p.jsx)("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown"),Mg=(0,i9.Z)((0,p.jsx)("path",{d:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"ArrowLeft"),Mv=(0,i9.Z)((0,p.jsx)("path",{d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"}),"ArrowRight");(0,i9.Z)((0,p.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,i9.Z)((0,p.jsxs)(m.Fragment,{children:[(0,p.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,p.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Clock");let My=(0,i9.Z)((0,p.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"),Mb=(0,i9.Z)((0,p.jsxs)(m.Fragment,{children:[(0,p.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,p.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Time"),Mx=(0,i9.Z)((0,p.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"),Mw=()=>k7().localeText;function MS(e){return(0,A.ZP)("MuiDateTimePickerTabs",e)}(0,T.Z)("MuiDateTimePickerTabs",["root"]);let MC=e=>Mc(e)?"date":"time",Mk=e=>"date"===e?"day":"hours",MM=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"]},MS,t)},MT=(0,S.ZP)(Mf.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}`,[`& .${Mp.Z.indicator}`]:{bottom:"auto",top:0}}})),MA=function(e){let t=k2({props:e,name:"MuiDateTimePickerTabs"}),{dateIcon:n=(0,p.jsx)(My,{}),onViewChange:r,timeIcon:i=(0,p.jsx)(Mb,{}),view:o,hidden:s="undefined"==typeof window||window.innerHeight<667,className:a,sx:l}=t,u=Mw(),c=MM(t);return s?null:(0,p.jsxs)(MT,{ownerState:t,variant:"fullWidth",value:MC(o),onChange:(e,t)=>{r(Mk(t))},className:(0,v.Z)(a,c.root),sx:l,children:[(0,p.jsx)(Md.Z,{value:"date","aria-label":u.dateTableLabel,icon:(0,p.jsx)(m.Fragment,{children:n})}),(0,p.jsx)(Md.Z,{value:"time","aria-label":u.timeTableLabel,icon:(0,p.jsx)(m.Fragment,{children:i})})]})};function MD(e){return(0,A.ZP)("MuiPickersToolbarText",e)}let ME=(0,T.Z)("MuiPickersToolbarText",["root","selected"]),MO=["className","selected","value"],MR=e=>{let{classes:t,selected:n}=e;return(0,y.Z)({root:["root",n&&"selected"]},MD,t)},MP=(0,S.ZP)(i6.Z,{name:"MuiPickersToolbarText",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`&.${ME.selected}`]:t.selected}]})(({theme:e})=>({transition:e.transitions.create("color"),color:(e.vars||e).palette.text.secondary,[`&.${ME.selected}`]:{color:(e.vars||e).palette.text.primary}})),MI=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiPickersToolbarText"}),{className:r,value:i}=n,o=(0,ab.Z)(n,MO),s=MR(n);return(0,p.jsx)(MP,(0,ay.Z)({ref:t,className:(0,v.Z)(s.root,r),component:"span"},o,{children:i}))});function MN(e){return(0,A.ZP)("MuiPickersToolbar",e)}let Mj=(0,T.Z)("MuiPickersToolbar",["root","content"]),ML=["children","className","toolbarTitle","hidden","titleId","isLandscape","classes","landscapeDirection"],MF=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"],content:["content"]},MN,t)},MZ=(0,S.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"}}]})),MB=(0,S.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"}}]}),MV=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiPickersToolbar"}),{children:r,className:i,toolbarTitle:o,hidden:s,titleId:a}=n,l=(0,ab.Z)(n,ML),u=MF(n);return s?null:(0,p.jsxs)(MZ,(0,ay.Z)({ref:t,className:(0,v.Z)(u.root,i),ownerState:n},l,{children:[(0,p.jsx)(i6.Z,{color:"text.secondary",variant:"overline",id:a,children:o}),(0,p.jsx)(MB,{className:u.content,ownerState:n,children:r})]}))}),Mz=["align","className","selected","typographyClassName","value","variant","width"],M_=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"]},MN,t)},MH=(0,S.ZP)(j.Z,{name:"MuiPickersToolbarButton",slot:"Root",overridesResolver:(e,t)=>t.root})({padding:0,minWidth:16,textTransform:"none"}),M$=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiPickersToolbarButton"}),{align:r,className:i,selected:o,typographyClassName:s,value:a,variant:l,width:u}=n,c=(0,ab.Z)(n,Mz),h=M_(n);return(0,p.jsx)(MH,(0,ay.Z)({variant:"text",ref:t,className:(0,v.Z)(h.root,i)},u?{sx:{width:u}}:{},c,{children:(0,p.jsx)(MI,{align:r,className:s,variant:l,value:a,selected:o})}))});function MW(e){return(0,A.ZP)("MuiDateTimePickerToolbar",e)}let Mq=(0,T.Z)("MuiDateTimePickerToolbar",["root","dateContainer","timeContainer","timeDigitsContainer","separator","timeLabelReverse","ampmSelection","ampmLandscape","ampmLabel"]),MG=["hours","minutes","seconds"],MU=e=>MG.includes(e),MK=(e,t)=>e?t.getHours(e)>=12?"pm":"am":null,MY=(e,t,n)=>n&&(e>=12?"pm":"am")!==t?"am"===t?e-12:e+12:e,MX=(e,t,n,r)=>{let i=MY(r.getHours(e),t,n);return r.setHours(e,i)},MQ=(e,t)=>3600*t.getHours(e)+60*t.getMinutes(e)+t.getSeconds(e),MJ=(e,t)=>(n,r)=>e?t.isAfter(n,r):MQ(n,t)>MQ(r,t);function M0(e,t,n,r){let i=Me();return{meridiemMode:MK(e,i),handleMeridiemChange:m.useCallback(o=>{n(null==e?null:MX(e,o,!!t,i),r??"partial")},[t,e,n,r,i])}}let M1=["ampm","ampmInClock","value","onChange","view","isLandscape","onViewChange","toolbarFormat","toolbarPlaceholder","views","disabled","readOnly","toolbarVariant","toolbarTitle","className"],M2=e=>{let{classes:t,isLandscape:n,isRtl:r}=e;return(0,y.Z)({root:["root"],dateContainer:["dateContainer"],timeContainer:["timeContainer",r&&"timeLabelReverse"],timeDigitsContainer:["timeDigitsContainer",r&&"timeLabelReverse"],separator:["separator"],ampmSelection:["ampmSelection",n&&"ampmLandscape"],ampmLabel:["ampmLabel"]},MW,t)},M5=(0,S.ZP)(MV,{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}`,[`& .${Mj.content} .${ME.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}}]})),M3=(0,S.ZP)("div",{name:"MuiDateTimePickerToolbar",slot:"DateContainer",overridesResolver:(e,t)=>t.dateContainer})({display:"flex",flexDirection:"column",alignItems:"flex-start"}),M4=(0,S.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"}}]}),M8=(0,S.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}}]}),M6=(0,S.ZP)(MI,{name:"MuiDateTimePickerToolbar",slot:"Separator",overridesResolver:(e,t)=>t.separator})({margin:"0 4px 0 2px",cursor:"default",variants:[{props:{toolbarVariant:"desktop"},style:{margin:0}}]}),M9=(0,S.ZP)("div",{name:"MuiDateTimePickerToolbar",slot:"AmPmSelection",overridesResolver:(e,t)=>[{[`.${Mq.ampmLabel}`]:t.ampmLabel},{[`&.${Mq.ampmLandscape}`]:t.ampmLandscape},t.ampmSelection]})({display:"flex",flexDirection:"column",marginRight:"auto",marginLeft:12,[`& .${Mq.ampmLabel}`]:{fontSize:17},variants:[{props:{isLandscape:!0},style:{margin:"4px 0 auto",flexDirection:"row",justifyContent:"space-around",width:"100%"}}]});function M7(e){let t=k2({props:e,name:"MuiDateTimePickerToolbar"}),{ampm:n,ampmInClock:r,value:i,onChange:o,view:s,isLandscape:a,onViewChange:l,toolbarFormat:u,toolbarPlaceholder:c="––",views:h,disabled:d,readOnly:f,toolbarVariant:g="mobile",toolbarTitle:y,className:b}=t,x=(0,ab.Z)(t,M1),w=(0,sQ.V)(),S=(0,ay.Z)({},t,{isRtl:w}),C=Me(),{meridiemMode:k,handleMeridiemChange:M}=M0(i,n,o),T=!!(n&&!r),A="desktop"===g,D=Mw(),E=M2(S),O=y??D.dateTimePickerToolbarTitle,R=m.useMemo(()=>i?u?C.formatByString(i,u):C.format(i,"shortDate"):c,[i,u,c,C]);return(0,p.jsxs)(M5,(0,ay.Z)({isLandscape:a,className:(0,v.Z)(E.root,b),toolbarTitle:O},x,{ownerState:S,children:[(0,p.jsxs)(M3,{className:E.dateContainer,ownerState:S,children:[h.includes("year")&&(0,p.jsx)(M$,{tabIndex:-1,variant:"subtitle1",onClick:()=>l("year"),selected:"year"===s,value:i?C.format(i,"year"):"–"}),h.includes("day")&&(0,p.jsx)(M$,{tabIndex:-1,variant:A?"h5":"h4",onClick:()=>l("day"),selected:"day"===s,value:R})]}),(0,p.jsxs)(M4,{className:E.timeContainer,ownerState:S,children:[(0,p.jsxs)(M8,{className:E.timeDigitsContainer,ownerState:S,children:[h.includes("hours")&&(0,p.jsxs)(m.Fragment,{children:[(0,p.jsx)(M$,{variant:A?"h5":"h3",width:A&&!a?48:void 0,onClick:()=>l("hours"),selected:"hours"===s,value:i?n?C.format(i,"hours12h"):C.format(i,"hours24h"):"--"}),(0,p.jsx)(M6,{variant:A?"h5":"h3",value:":",className:E.separator,ownerState:S}),(0,p.jsx)(M$,{variant:A?"h5":"h3",width:A&&!a?48:void 0,onClick:()=>l("minutes"),selected:"minutes"===s||!h.includes("minutes")&&"hours"===s,value:i?C.format(i,"minutes"):"--",disabled:!h.includes("minutes")})]}),h.includes("seconds")&&(0,p.jsxs)(m.Fragment,{children:[(0,p.jsx)(M6,{variant:A?"h5":"h3",value:":",className:E.separator,ownerState:S}),(0,p.jsx)(M$,{variant:A?"h5":"h3",width:A&&!a?48:void 0,onClick:()=>l("seconds"),selected:"seconds"===s,value:i?C.format(i,"seconds"):"--"})]})]}),T&&!A&&(0,p.jsxs)(M9,{className:E.ampmSelection,ownerState:S,children:[(0,p.jsx)(M$,{variant:"subtitle2",selected:"am"===k,typographyClassName:E.ampmLabel,value:Ml(C,"am"),onClick:f?void 0:()=>M("am"),disabled:d}),(0,p.jsx)(M$,{variant:"subtitle2",selected:"pm"===k,typographyClassName:E.ampmLabel,value:Ml(C,"pm"),onClick:f?void 0:()=>M("pm"),disabled:d})]}),n&&A&&(0,p.jsx)(M$,{variant:"h5",onClick:()=>l("meridiem"),selected:"meridiem"===s,value:i&&k?Ml(C,k):"--",width:48})]})]}))}let Te=({openTo:e,defaultOpenTo:t,views:n,defaultViews:r})=>{let i;let 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}};var Tt=n(5056),Tn=n(25399);function Tr(e){return(0,A.ZP)("MuiPickersArrowSwitcher",e)}(0,T.Z)("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);let Ti=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],To=["ownerState"],Ts=["ownerState"],Ta=(0,S.ZP)("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),Tl=(0,S.ZP)("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),Tu=(0,S.ZP)(ef.Z,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),Tc=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},Tr,t)},Th=m.forwardRef(function(e,t){let n=(0,sQ.V)(),r=k2({props:e,name:"MuiPickersArrowSwitcher"}),{children:i,className:o,slots:s,slotProps:a,isNextDisabled:l,isNextHidden:u,onGoToNext:c,nextLabel:h,isPreviousDisabled:d,isPreviousHidden:f,onGoToPrevious:m,previousLabel:g,labelId:y}=r,b=(0,ab.Z)(r,Ti),x=Tc(r),w=s?.previousIconButton??Tu,S=(0,Tn.Z)({elementType:w,externalSlotProps:a?.previousIconButton,additionalProps:{size:"medium",title:g,"aria-label":g,disabled:d,edge:"end",onClick:m},ownerState:(0,ay.Z)({},r,{hidden:f}),className:(0,v.Z)(x.button,x.previousIconButton)}),C=s?.nextIconButton??Tu,k=(0,Tn.Z)({elementType:C,externalSlotProps:a?.nextIconButton,additionalProps:{size:"medium",title:h,"aria-label":h,disabled:l,edge:"start",onClick:c},ownerState:(0,ay.Z)({},r,{hidden:u}),className:(0,v.Z)(x.button,x.nextIconButton)}),M=s?.leftArrowIcon??Mg,T=(0,Tn.Z)({elementType:M,externalSlotProps:a?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:r,className:x.leftArrowIcon}),A=(0,ab.Z)(T,To),D=s?.rightArrowIcon??Mv,E=(0,Tn.Z)({elementType:D,externalSlotProps:a?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:r,className:x.rightArrowIcon}),O=(0,ab.Z)(E,Ts);return(0,p.jsxs)(Ta,(0,ay.Z)({ref:t,className:(0,v.Z)(x.root,o),ownerState:r},b,{children:[(0,p.jsx)(w,(0,ay.Z)({},S,{children:n?(0,p.jsx)(D,(0,ay.Z)({},O)):(0,p.jsx)(M,(0,ay.Z)({},A))})),i?(0,p.jsx)(i6.Z,{variant:"subtitle1",component:"span",id:y,children:i}):(0,p.jsx)(Tl,{className:x.spacer,ownerState:r}),(0,p.jsx)(C,(0,ay.Z)({},k,{children:n?(0,p.jsx)(M,(0,ay.Z)({},A)):(0,p.jsx)(D,(0,ay.Z)({},O))}))]}))});var Td=n(81925),Tf=n(9831);function Tp({onChange:e,onViewChange:t,openTo:n,view:r,views:i,autoFocus:o,focusedView:s,onFocusedViewChange:a}){let l=m.useRef(n),u=m.useRef(i),c=m.useRef(i.includes(n)?n:i[0]),[h,d]=(0,Tf.Z)({name:"useViews",state:"view",controlled:r,default:c.current}),f=m.useRef(o?h:null),[p,g]=(0,Tf.Z)({name:"useViews",state:"focusedView",controlled:s,default:f.current});m.useEffect(()=>{(l.current&&l.current!==n||u.current&&u.current.some(e=>!i.includes(e)))&&(d(i.includes(n)?n:i[0]),u.current=i,l.current=n)},[n,d,h,i]);let v=i.indexOf(h),y=i[v-1]??null,b=i[v+1]??null,x=(0,Td.Z)((e,t)=>{t?g(e):g(t=>e===t?null:t),a?.(e,t)}),w=(0,Td.Z)(e=>{x(e,!0),e!==h&&(d(e),t&&t(e))}),S=(0,Td.Z)(()=>{b&&w(b)}),C=(0,Td.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&&w(e)}else o&&S()});return{view:h,setView:w,focusedView:p,setFocusedView:x,nextView:b,previousView:y,defaultView:i.includes(n)?n:i[0],goToNextView:S,setValueAndGoToNextView:C}}let Tm=(0,S.ZP)("div")({overflow:"hidden",width:320,maxHeight:336,display:"flex",flexDirection:"column",margin:"0 auto"});function Tg(e){return(0,A.ZP)("MuiTimeClock",e)}(0,T.Z)("MuiTimeClock",["root","arrowSwitcher"]);var Tv=n(96858);let Ty=110,Tb=110,Tx=Ty,Tw=0,TS=Tx-Ty,TC=Tw-Tb,Tk=e=>180/Math.PI*e,TM=(e,t,n)=>{let r=t-Ty,i=n-Tb,o=Tk(Math.atan2(TS,TC)-Math.atan2(r,i));return{value:Math.floor((o=Math.round(o/e)*e%360)/e)||0,distance:Math.sqrt(r**2+i**2)}},TT=(e,t,n=1)=>{let{value:r}=TM(6*n,e,t);return r*n%60},TA=(e,t,n)=>{let{value:r,distance:i}=TM(30,e,t),o=r||12;return n?o%=12:i<74&&(o+=12,o%=24),o};function TD(e){return(0,A.ZP)("MuiClockPointer",e)}(0,T.Z)("MuiClockPointer",["root","thumb"]);let TE=["className","hasSelected","isInner","type","viewValue"],TO=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"],thumb:["thumb"]},TD,t)},TR=(0,S.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"])}}]})),TP=(0,S.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 TI(e){let t;let n=k2({props:e,name:"MuiClockPointer"}),{className:r,isInner:i,type:o,viewValue:s}=n,a=(0,ab.Z)(n,TE),l=m.useRef(o);m.useEffect(()=>{l.current=o},[o]);let u=(0,ay.Z)({},n,{shouldAnimate:l.current!==o}),c=TO(u);return(0,p.jsx)(TR,(0,ay.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,v.Z)(c.root,r),ownerState:u},a,{children:(0,p.jsx)(TP,{ownerState:u,className:c.thumb})}))}function TN(e){return(0,A.ZP)("MuiClock",e)}(0,T.Z)("MuiClock",["root","clock","wrapper","squareMask","pin","amButton","pmButton","meridiemText","selected"]);let Tj=e=>{let{classes:t,meridiemMode:n}=e;return(0,y.Z)({root:["root"],clock:["clock"],wrapper:["wrapper"],squareMask:["squareMask"],pin:["pin"],amButton:["amButton","am"===n&&"selected"],pmButton:["pmButton","pm"===n&&"selected"],meridiemText:["meridiemText"]},TN,t)},TL=(0,S.ZP)("div",{name:"MuiClock",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",margin:e.spacing(2)})),TF=(0,S.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"}),TZ=(0,S.ZP)("div",{name:"MuiClock",slot:"Wrapper",overridesResolver:(e,t)=>t.wrapper})({"&:focus":{outline:"none"}}),TB=(0,S.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"}}}]}),TV=(0,S.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%)"})),Tz=(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}}}]}),T_=(0,S.ZP)(ef.Z,{name:"MuiClock",slot:"AmButton",overridesResolver:(e,t)=>t.amButton})(({theme:e})=>(0,ay.Z)({},Tz(e,"am"),{position:"absolute",left:8})),TH=(0,S.ZP)(ef.Z,{name:"MuiClock",slot:"PmButton",overridesResolver:(e,t)=>t.pmButton})(({theme:e})=>(0,ay.Z)({},Tz(e,"pm"),{position:"absolute",right:8})),T$=(0,S.ZP)(i6.Z,{name:"MuiClock",slot:"meridiemText",overridesResolver:(e,t)=>t.meridiemText})({overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"});function TW(e){let t=k2({props:e,name:"MuiClock"}),{ampm:n,ampmInClock:r,autoFocus:i,children:o,value:s,handleMeridiemChange:a,isTimeDisabled:l,meridiemMode:u,minutesStep:c=1,onChange:h,selectedId:d,type:f,viewValue:g,viewRange:[y,b],disabled:x=!1,readOnly:w,className:S}=t,C=Me(),k=Mw(),M=m.useRef(!1),T=Tj(t),A=l(g,f),D=!n&&"hours"===f&&(g<1||g>12),E=(e,t)=>{!(x||w||l(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}E("seconds"===f||"minutes"===f?TT(r,i,c):TA(r,i,!!n),t)},R=e=>{M.current=!0,O(e,"shallow")},P=m.useMemo(()=>"hours"===f||g%5==0,[f,g]),I="minutes"===f?c:1,N=m.useRef(null);(0,Tv.Z)(()=>{i&&N.current.focus()},[i]);let j=e=>Math.max(y,Math.min(b,e)),L=e=>(e+(b+1))%(b+1);return(0,p.jsxs)(TL,{className:(0,v.Z)(T.root,S),children:[(0,p.jsxs)(TF,{className:T.clock,children:[(0,p.jsx)(TB,{onTouchMove:R,onTouchStart:R,onTouchEnd:e=>{M.current&&(O(e,"finish"),M.current=!1),e.preventDefault()},onMouseUp:e=>{M.current&&(M.current=!1),O(e.nativeEvent,"finish")},onMouseMove:e=>{e.buttons>0&&O(e.nativeEvent,"shallow")},ownerState:{disabled:x},className:T.squareMask}),!A&&(0,p.jsxs)(m.Fragment,{children:[(0,p.jsx)(TV,{className:T.pin}),null!=s&&(0,p.jsx)(TI,{type:f,viewValue:g,isInner:D,hasSelected:P})]}),(0,p.jsx)(TZ,{"aria-activedescendant":d,"aria-label":k.clockLabelText(f,s,C,null==s?null:C.format(s,"fullTime")),ref:N,role:"listbox",onKeyDown:e=>{if(!M.current)switch(e.key){case"Home":E(y,"partial"),e.preventDefault();break;case"End":E(b,"partial"),e.preventDefault();break;case"ArrowUp":E(L(g+I),"partial"),e.preventDefault();break;case"ArrowDown":E(L(g-I),"partial"),e.preventDefault();break;case"PageUp":E(j(g+5),"partial"),e.preventDefault();break;case"PageDown":E(j(g-5),"partial"),e.preventDefault();break;case"Enter":case" ":E(g,"finish"),e.preventDefault()}},tabIndex:0,className:T.wrapper,children:o})]}),n&&r&&(0,p.jsxs)(m.Fragment,{children:[(0,p.jsx)(T_,{onClick:w?void 0:()=>a("am"),disabled:x||null===u,ownerState:t,className:T.amButton,title:Ml(C,"am"),children:(0,p.jsx)(T$,{variant:"caption",className:T.meridiemText,children:Ml(C,"am")})}),(0,p.jsx)(TH,{disabled:x||null===u,onClick:w?void 0:()=>a("pm"),ownerState:t,className:T.pmButton,title:Ml(C,"pm"),children:(0,p.jsx)(T$,{variant:"caption",className:T.meridiemText,children:Ml(C,"pm")})})]})]})}function Tq(e){return(0,A.ZP)("MuiClockNumber",e)}let TG=(0,T.Z)("MuiClockNumber",["root","selected","disabled"]),TU=["className","disabled","index","inner","label","selected"],TK=e=>{let{classes:t,selected:n,disabled:r}=e;return(0,y.Z)({root:["root",n&&"selected",r&&"disabled"]},Tq,t)},TY=(0,S.ZP)("span",{name:"MuiClockNumber",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`&.${TG.disabled}`]:t.disabled},{[`&.${TG.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},[`&.${TG.selected}`]:{color:(e.vars||e).palette.primary.contrastText},[`&.${TG.disabled}`]:{pointerEvents:"none",color:(e.vars||e).palette.text.disabled},variants:[{props:{inner:!0},style:(0,ay.Z)({},e.typography.body2,{color:(e.vars||e).palette.text.secondary})}]}));function TX(e){let t=k2({props:e,name:"MuiClockNumber"}),{className:n,disabled:r,index:i,inner:o,label:s,selected:a}=t,l=(0,ab.Z)(t,TU),u=TK(t),c=i%12/12*Math.PI*2-Math.PI/2,h=91*(o?.65:1),d=Math.round(Math.cos(c)*h),f=Math.round(Math.sin(c)*h);return(0,p.jsx)(TY,(0,ay.Z)({className:(0,v.Z)(u.root,n),"aria-disabled":!!r||void 0,"aria-selected":!!a||void 0,role:"option",style:{transform:`translate(${d}px, ${f+92}px`},ownerState:t},l,{children:s}))}let TQ=({ampm:e,value:t,getClockNumberText:n,isDisabled:r,selectedId:i,utils:o})=>{let s=t?o.getHours(t):null,a=[],l=+!!e,u=e?12:23,c=t=>null!==s&&(e?12===t?12===s||0===s:s===t||s-12===t:s===t);for(let t=l;t<=u;t+=1){let s=t.toString();0===t&&(s="00");let l=!e&&(0===t||t>12);s=o.formatNumber(s);let u=c(t);a.push((0,p.jsx)(TX,{id:u?i:void 0,index:t,inner:l,selected:u,disabled:r(t),label:s,"aria-label":n(s)},t))}return a},TJ=({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 a=e===t;return(0,p.jsx)(TX,{label:o,id:a?i:void 0,index:s+1,inner:!1,disabled:n(e),selected:a,"aria-label":r(o)},e)})},T0=({timezone:e,value:t,defaultValue:n,referenceDate:r,onChange:i,valueManager:o})=>{let s;let a=Me(),l=m.useRef(n),u=t??l.current??o.emptyValue,c=m.useMemo(()=>o.getTimezone(a,u),[a,o,u]),h=(0,Td.Z)(e=>null==c?e:o.setTimezone(a,c,e));return s=e||c||(r?a.getTimezone(r):"default"),{value:m.useMemo(()=>o.setTimezone(a,s,u),[o,a,s,u]),handleValueChange:(0,Td.Z)((e,...t)=>{let n=h(e);i?.(n,...t)}),timezone:s}},T1=({name:e,timezone:t,value:n,defaultValue:r,referenceDate:i,onChange:o,valueManager:s})=>{let[a,l]=(0,Tf.Z)({name:e,state:"value",controlled:n,default:r??s.emptyValue});return T0({timezone:t,value:a,defaultValue:void 0,referenceDate:i,onChange:(0,Td.Z)((e,...t)=>{l(e),o?.(e,...t)}),valueManager:s})},T2={year:1,month:2,day:3,hours:4,minutes:5,seconds:6,milliseconds:7},T5=e=>Math.max(...e.map(e=>T2[e.type]??1)),T3=(e,t,n)=>{if(t===T2.year)return e.startOfYear(n);if(t===T2.month)return e.startOfMonth(n);if(t===T2.day)return e.startOfDay(n);let r=n;return t<T2.minutes&&(r=e.setMinutes(r,0)),t<T2.seconds&&(r=e.setSeconds(r,0)),t<T2.milliseconds&&(r=e.setMilliseconds(r,0)),r},T4=({props:e,utils:t,granularity:n,timezone:r,getTodayDate:i})=>{let o=i?i():T3(t,n,Ma(t,r));null!=e.minDate&&t.isAfterDay(e.minDate,o)&&(o=T3(t,n,e.minDate)),null!=e.maxDate&&t.isBeforeDay(e.maxDate,o)&&(o=T3(t,n,e.maxDate));let s=MJ(e.disableIgnoringDatePartForTimeValidation??!1,t);return null!=e.minTime&&s(e.minTime,o)&&(o=T3(t,n,e.disableIgnoringDatePartForTimeValidation?e.minTime:Mr(t,o,e.minTime))),null!=e.maxTime&&s(o,e.maxTime)&&(o=T3(t,n,e.disableIgnoringDatePartForTimeValidation?e.maxTime:Mr(t,o,e.maxTime))),o},T8=(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}},T6=e=>{switch(e){case"ArrowUp":return 1;case"ArrowDown":return -1;case"PageUp":return 5;case"PageDown":return -5;default:return 0}},T9=(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))},T7=(e,t,n,r)=>{switch(n){case"month":return Ms(e,e.date(void 0,t)).map(t=>e.formatByString(t,r));case"weekDay":return T9(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[]}},Ae=["0","1","2","3","4","5","6","7","8","9"],At=e=>{let t=e.date(void 0);return"0"===e.formatByString(e.setSeconds(t,0),"s")?Ae:Array.from({length:10}).map((n,r)=>e.formatByString(e.setSeconds(t,r),"s"))},An=(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("")},Ar=(e,t)=>"0"===t[0]?e:e.split("").map(e=>t[Number(e)]).join(""),Ai=(e,t)=>{let n=An(e,t);return" "!==n&&!Number.isNaN(Number(n))},Ao=(e,t)=>{let n=e;for(n=Number(n).toString();n.length<t;)n=`0${n}`;return n},As=(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=Ao(o,i.maxLength)),Ar(o,r)},Aa=(e,t,n,r,i,o,s,a)=>{let l=T6(r),u="Home"===r,c="End"===r,h=""===n.value||u||c;return"digit"===n.contentType||"digit-with-letter"===n.contentType?(()=>{let r=i[n.type]({currentDate:s,format:n.format,contentType:n.contentType}),d=t=>As(e,t,r,o,n),f="minutes"===n.type&&a?.minutesStep?a.minutesStep:1,p=parseInt(An(n.value,o),10)+l*f;if(h){if("year"===n.type&&!c&&!u)return e.formatByString(e.date(void 0,t),n.format);p=l>0||u?r.minimum:r.maximum}return d((p%f!=0&&((l<0||u)&&(p+=f-(f+p)%f),(l>0||c)&&(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 r=T7(e,t,n.type,n.format);if(0===r.length)return n.value;if(h)return l>0||u?r[0]:r[r.length-1];let i=((r.indexOf(n.value)+l)%r.length+r.length)%r.length;return r[i]})()},Al=(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(An(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},Au=(e,t,n,r)=>e.formatByString(e.parse(t,n),r),Ac=(e,t)=>4===e.formatByString(e.date(void 0,"system"),t).length,Ah=(e,t,n,r)=>{if("digit"!==t)return!1;let i=e.date(void 0,"default");switch(n){case"year":if(Ac(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")}},Ad=(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(Al(s,"non-input",n)))}let s=i.join(" "),a=o.join(" ");return e.parse(a,s)},Af=(e,t,n)=>{let r=e.date(void 0,n),i=e.endOfYear(r),o=e.endOfDay(r),{maxDaysInMonth:s,longestMonth:a}=Ms(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:Ac(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:a}),weekDay:({format:t,contentType:n})=>{if("digit"===n){let n=T9(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 An(e.formatByString(e.endOfDay(r),n),t)!==i.toString()?{minimum:1,maximum:Number(An(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})}},Ap=(e,t)=>{},Am=(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=T9(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}},Ag={year:1,month:2,day:3,weekDay:4,hours:5,minutes:6,seconds:7,meridiem:8,empty:9},Av=(e,t,n,r,i)=>[...n].sort((e,t)=>Ag[e.type]-Ag[t.type]).reduce((n,r)=>!i||r.modified?Am(e,r,t,n):n,r),Ay=()=>navigator.userAgent.toLowerCase().includes("android"),Ab=(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,a=e.length-1;for(;a>=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]=a,r[a]=e,a-=1;o=s+1}return e.forEach((t,o)=>{let s=i[o],a=0===s?null:r[s-1],l=s===e.length-1?null:r[s+1];n[o]={leftIndex:a,rightIndex:l}}),{neighbors:n,startIndex:r[0],endIndex:r[e.length-1]}},Ax=(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},Aw=(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}},AS=(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}},AC=["value","referenceDate"],Ak={emptyValue:null,getTodayValue:Ma,getInitialReferenceValue:e=>{let{value:t,referenceDate:n}=e,r=(0,ab.Z)(e,AC);return null!=t&&r.utils.isValid(t)?t:null!=n?n:T4(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)},AM={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=Al(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)},AT=({value:e,referenceDate:t,utils:n,props:r,timezone:i})=>{let o=m.useMemo(()=>Ak.getInitialReferenceValue({value:e,utils:n,props:r,referenceDate:t,granularity:T2.day,timezone:i,getTodayDate:()=>Ma(n,i,"date")}),[]);return e??o},AA=["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"],AD=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"],arrowSwitcher:["arrowSwitcher"]},Tg,t)},AE=(0,S.ZP)(Tm,{name:"MuiTimeClock",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",position:"relative"}),AO=(0,S.ZP)(Th,{name:"MuiTimeClock",slot:"ArrowSwitcher",overridesResolver:(e,t)=>t.arrowSwitcher})({position:"absolute",right:12,top:15}),AR=["hours","minutes"],AP=m.forwardRef(function(e,t){let n=Me(),r=k2({props:e,name:"MuiTimeClock"}),{ampm:i=n.is12HourCycleInCurrentLocale(),ampmInClock:o=!1,autoFocus:s,slots:a,slotProps:l,value:u,defaultValue:c,referenceDate:h,disableIgnoringDatePartForTimeValidation:d=!1,maxTime:f,minTime:g,disableFuture:y,disablePast:b,minutesStep:x=1,shouldDisableTime:w,showViewSwitcher:S,onChange:C,view:k,views:M=AR,openTo:T,onViewChange:A,focusedView:D,onFocusedViewChange:E,className:O,disabled:R,readOnly:P,timezone:I}=r,N=(0,ab.Z)(r,AA),{value:j,handleValueChange:L,timezone:F}=T1({name:"TimeClock",timezone:I,value:u,defaultValue:c,referenceDate:h,onChange:C,valueManager:Ak}),Z=AT({value:j,referenceDate:h,utils:n,props:r,timezone:F}),B=Mw(),V=Mn(F),{view:z,setView:_,previousView:H,nextView:$,setValueAndGoToNextView:W}=Tp({view:k,views:M,openTo:T,onViewChange:A,onChange:L,focusedView:D,onFocusedViewChange:E}),{meridiemMode:q,handleMeridiemChange:G}=M0(Z,i,W),U=m.useCallback((e,t)=>{let r=MJ(d,n),o="hours"===t||"minutes"===t&&M.includes("seconds"),s=({start:e,end:t})=>!(g&&r(g,t)||f&&r(e,f)||y&&r(e,V)||b&&r(V,o?t:e)),a=(e,r=1)=>{if(e%r!=0)return!1;if(w)switch(t){case"hours":return!w(n.setHours(Z,e),"hours");case"minutes":return!w(n.setMinutes(Z,e),"minutes");case"seconds":return!w(n.setSeconds(Z,e),"seconds");default:return!1}return!0};switch(t){case"hours":{let t=MY(e,q,i),r=n.setHours(Z,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)})||!a(t)}case"minutes":{let t=n.setMinutes(Z,e);return!s({start:n.setSeconds(t,0),end:n.setSeconds(t,59)})||!a(e,x)}case"seconds":{let t=n.setSeconds(Z,e);return!s({start:t,end:t})||!a(e)}default:throw Error("not supported")}},[i,Z,d,f,q,g,x,w,n,y,b,V,M]),K=(0,Tt.Z)(),Y=m.useMemo(()=>{switch(z){case"hours":{let e;let t=(e,t)=>{let r=MY(e,q,i);W(n.setHours(Z,r),t,"hours")},r=n.getHours(Z);return e=i?r>12?[12,23]:[0,11]:[0,23],{onChange:t,viewValue:r,children:TQ({value:j,utils:n,ampm:i,onChange:t,getClockNumberText:B.hoursClockNumberText,isDisabled:e=>R||U(e,"hours"),selectedId:K}),viewRange:e}}case"minutes":{let e=n.getMinutes(Z),t=(e,t)=>{W(n.setMinutes(Z,e),t,"minutes")};return{viewValue:e,onChange:t,children:TJ({utils:n,value:e,onChange:t,getClockNumberText:B.minutesClockNumberText,isDisabled:e=>R||U(e,"minutes"),selectedId:K}),viewRange:[0,59]}}case"seconds":{let e=n.getSeconds(Z),t=(e,t)=>{W(n.setSeconds(Z,e),t,"seconds")};return{viewValue:e,onChange:t,children:TJ({utils:n,value:e,onChange:t,getClockNumberText:B.secondsClockNumberText,isDisabled:e=>R||U(e,"seconds"),selectedId:K}),viewRange:[0,59]}}default:throw Error("You must provide the type for ClockView")}},[z,n,j,i,B.hoursClockNumberText,B.minutesClockNumberText,B.secondsClockNumberText,q,W,Z,U,K,R]),X=AD(r);return(0,p.jsxs)(AE,(0,ay.Z)({ref:t,className:(0,v.Z)(X.root,O),ownerState:r},N,{children:[(0,p.jsx)(TW,(0,ay.Z)({autoFocus:s??!!D,ampmInClock:o&&M.includes("hours"),value:j,type:z,ampm:i,minutesStep:x,isTimeDisabled:U,meridiemMode:q,handleMeridiemChange:G,selectedId:K,disabled:R,readOnly:P},Y)),S&&(0,p.jsx)(AO,{className:X.arrowSwitcher,slots:a,slotProps:l,onGoToPrevious:()=>_(H),isPreviousDisabled:!H,previousLabel:B.openPreviousView,onGoToNext:()=>_($),isNextDisabled:!$,nextLabel:B.openNextView,ownerState:r})]}))}),AI=({view:e,onViewChange:t,focusedView:n,onFocusedViewChange:r,views:i,value:o,defaultValue:s,referenceDate:a,onChange:l,className:u,classes:c,disableFuture:h,disablePast:d,minTime:f,maxTime:m,shouldDisableTime:g,minutesStep:v,ampm:y,ampmInClock:b,slots:x,slotProps:w,readOnly:S,disabled:C,sx:k,autoFocus:M,showViewSwitcher:T,disableIgnoringDatePartForTimeValidation:A,timezone:D})=>(0,p.jsx)(AP,{view:e,onViewChange:t,focusedView:n&&MU(n)?n:null,onFocusedViewChange:r,views:i.filter(MU),value:o,defaultValue:s,referenceDate:a,onChange:l,className:u,classes:c,disableFuture:h,disablePast:d,minTime:f,maxTime:m,shouldDisableTime:g,minutesStep:v,ampm:y,ampmInClock:b,slots:x,slotProps:w,readOnly:S,disabled:C,sx:k,autoFocus:M,showViewSwitcher:T,disableIgnoringDatePartForTimeValidation:A,timezone:D}),AN=({props:e,value:t,timezone:n,adapter:r})=>{if(null===t)return null;let{shouldDisableDate:i,shouldDisableMonth:o,shouldDisableYear:s,disablePast:a,disableFuture:l}=e,u=r.utils.date(void 0,n),c=Mo(r.utils,e.minDate,r.defaultDates.minDate),h=Mo(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!!(l&&r.utils.isAfterDay(t,u)):return"disableFuture";case!!(a&&r.utils.isBeforeDay(t,u)):return"disablePast";case!!(c&&r.utils.isBeforeDay(t,c)):return"minDate";case!!(h&&r.utils.isAfterDay(t,h)):return"maxDate";default:return null}};AN.valueManager=Ak;let Aj=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:i,disableFuture:o,disablePast:s,timezone:a})=>{let l=k7();return m.useCallback(u=>null!==AN({adapter:l,value:u,timezone:a,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:i,disableFuture:o,disablePast:s}}),[l,e,t,n,r,i,o,s,a])},AL=(e,t,n)=>(r,i)=>{switch(i.type){case"changeMonth":return(0,ay.Z)({},r,{slideDirection:i.direction,currentMonth:i.newMonth,isMonthSwitchingAnimating:!e});case"changeMonthTimezone":{let e=i.newTimezone;if(n.getTimezone(r.currentMonth)===e)return r;let t=n.setTimezone(r.currentMonth,e);return n.getMonth(t)!==n.getMonth(r.currentMonth)&&(t=n.setMonth(t,n.getMonth(r.currentMonth))),(0,ay.Z)({},r,{currentMonth:t})}case"finishMonthSwitchingAnimation":return(0,ay.Z)({},r,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(null!=r.focusedDay&&null!=i.focusedDay&&n.isSameDay(i.focusedDay,r.focusedDay))return r;let o=null!=i.focusedDay&&!t&&!n.isSameMonth(r.currentMonth,i.focusedDay);return(0,ay.Z)({},r,{focusedDay:i.focusedDay,isMonthSwitchingAnimating:o&&!e&&!i.withoutMonthSwitchingAnimation,currentMonth:o?n.startOfMonth(i.focusedDay):r.currentMonth,slideDirection:null!=i.focusedDay&&n.isAfterDay(i.focusedDay,r.currentMonth)?"left":"right"})}default:throw Error("missing support")}},AF=e=>{let{value:t,referenceDate:n,disableFuture:r,disablePast:i,disableSwitchToMonthOnDayFocus:o=!1,maxDate:s,minDate:a,onMonthChange:l,reduceAnimations:u,shouldDisableDate:c,timezone:h}=e,d=Me(),f=m.useRef(AL(!!u,o,d)).current,p=m.useMemo(()=>Ak.getInitialReferenceValue({value:t,utils:d,timezone:h,props:e,referenceDate:n,granularity:T2.day}),[n,h]),[g,v]=m.useReducer(f,{isMonthSwitchingAnimating:!1,focusedDay:p,currentMonth:d.startOfMonth(p),slideDirection:"left"});m.useEffect(()=>{v({type:"changeMonthTimezone",newTimezone:d.getTimezone(p)})},[p,d]);let y=m.useCallback(e=>{v((0,ay.Z)({type:"changeMonth"},e)),l&&l(e.newMonth)},[l]),b=m.useCallback(e=>{!d.isSameMonth(e,g.currentMonth)&&y({newMonth:d.startOfMonth(e),direction:d.isAfterDay(e,g.currentMonth)?"left":"right"})},[g.currentMonth,y,d]),x=Aj({shouldDisableDate:c,minDate:a,maxDate:s,disableFuture:r,disablePast:i,timezone:h}),w=m.useCallback(()=>{v({type:"finishMonthSwitchingAnimation"})},[]);return{referenceDate:p,calendarState:g,changeMonth:b,changeFocusedDay:(0,Td.Z)((e,t)=>{x(e)||v({type:"changeFocusedDay",focusedDay:e,withoutMonthSwitchingAnimation:t})}),isDateDisabled:x,onMonthSwitchingAnimationEnd:w,handleChangeMonth:y}};var AZ=n(16317),AB=n(69761);let AV=e=>(0,A.ZP)("MuiPickersFadeTransitionGroup",e);(0,T.Z)("MuiPickersFadeTransitionGroup",["root"]);let Az=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"]},AV,t)},A_=(0,S.ZP)(AZ.Z,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function AH(e){let t=k2({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:i,transKey:o}=t,s=Az(t),a=(0,eX.Z)();return i?n:(0,p.jsx)(A_,{className:(0,v.Z)(s.root,r),children:(0,p.jsx)(AB.Z,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:a.transitions.duration.enteringScreen,enter:a.transitions.duration.enteringScreen,exit:0},children:n},o)})}var A$=n(97048);function AW(e){return(0,A.ZP)("MuiPickersDay",e)}let Aq=(0,T.Z)("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),AG=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],AU=e=>{let{selected:t,disableMargin:n,disableHighlightToday:r,today:i,disabled:o,outsideCurrentMonth:s,showDaysOutsideCurrentMonth:a,classes:l}=e,u=s&&!a;return(0,y.Z)({root:["root",t&&!u&&"selected",o&&"disabled",!n&&"dayWithMargin",!r&&i&&"today",s&&a&&"dayOutsideMonth",u&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},AW,l)},AK=({theme:e})=>(0,ay.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,b.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,b.Fq)(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${Aq.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${Aq.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}},[`&.${Aq.disabled}:not(.${Aq.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${Aq.disabled}&.${Aq.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(.${Aq.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),AY=(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]},AX=(0,S.ZP)(r2.Z,{name:"MuiPickersDay",slot:"Root",overridesResolver:AY})(AK),AQ=(0,S.ZP)("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:AY})(({theme:e})=>(0,ay.Z)({},AK({theme:e}),{opacity:0,pointerEvents:"none"})),AJ=()=>{},A0=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiPickersDay"}),{autoFocus:r=!1,className:i,day:o,disabled:s=!1,disableHighlightToday:a=!1,disableMargin:l=!1,isAnimating:u,onClick:c,onDaySelect:h,onFocus:d=AJ,onBlur:f=AJ,onKeyDown:g=AJ,onMouseDown:y=AJ,onMouseEnter:b=AJ,outsideCurrentMonth:x,selected:w=!1,showDaysOutsideCurrentMonth:S=!1,children:C,today:k=!1}=n,M=(0,ab.Z)(n,AG),T=(0,ay.Z)({},n,{autoFocus:r,disabled:s,disableHighlightToday:a,disableMargin:l,selected:w,showDaysOutsideCurrentMonth:S,today:k}),A=AU(T),D=Me(),E=m.useRef(null),O=(0,A$.Z)(E,t);return((0,Tv.Z)(()=>{!r||s||u||x||E.current.focus()},[r,s,u,x]),x&&!S)?(0,p.jsx)(AQ,{className:(0,v.Z)(A.root,A.hiddenDaySpacingFiller,i),ownerState:T,role:M.role}):(0,p.jsx)(AX,(0,ay.Z)({className:(0,v.Z)(A.root,i),ref:O,centerRipple:!0,disabled:s,tabIndex:w?0:-1,onKeyDown:e=>g(e,o),onFocus:e=>d(e,o),onBlur:e=>f(e,o),onMouseEnter:e=>b(e,o),onClick:e=>{s||h(o),x&&e.currentTarget.focus(),c&&c(e)},onMouseDown:e=>{y(e),x&&e.preventDefault()}},M,{ownerState:T,children:C||D.format(o,"dayOfMonth")}))}),A1=m.memo(A0);var A2=n(54652);function A5(e,t){return e.replace(RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var A3=n(98683),A4=function(e,t){return e&&t&&t.split(" ").forEach(function(t){e.classList?e.classList.remove(t):"string"==typeof e.className?e.className=A5(e.className,t):e.setAttribute("class",A5(e.className&&e.className.baseVal||"",t))})},A8=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"],a=r?o+"-done":n[e+"Done"];return{baseClassName:o,activeClassName:s,doneClassName:a}},t}(0,A2.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,A3.Q)(e),i&&(this.appliedClasses[t][n]=i,r=i,e&&r&&r.split(" ").forEach(function(t){return function(e,t){if(e.classList)e.classList.add(t);else(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))}(e,t)}))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,i=n.active,o=n.done;this.appliedClasses[t]={},r&&A4(e,r),i&&A4(e,i),o&&A4(e,o)},n.render=function(){var e=this.props,t=(e.classNames,(0,ab.Z)(e,["classNames"]));return g().createElement(s0.ZP,(0,ay.Z)({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(g().Component);A8.defaultProps={classNames:""},A8.propTypes={};let A6=e=>(0,A.ZP)("MuiPickersSlideTransition",e),A9=(0,T.Z)("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),A7=["children","className","reduceAnimations","slideDirection","transKey","classes"],De=e=>{let{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return(0,y.Z)(r,A6,t)},Dt=(0,S.ZP)(AZ.Z,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${A9["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${A9["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${A9.slideEnterActive}`]:t.slideEnterActive},{[`.${A9.slideExit}`]:t.slideExit},{[`.${A9["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${A9["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},[`& .${A9["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${A9["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${A9.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${A9.slideExit}`]:{transform:"translate(0%)"},[`& .${A9["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${A9["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}}),Dn=e=>(0,A.ZP)("MuiDayCalendar",e);(0,T.Z)("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);let Dr=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],Di=["ownerState"],Do=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},Dn,t)},Ds=(0,S.ZP)("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),Da=(0,S.ZP)("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),Dl=(0,S.ZP)(i6.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})),Du=(0,S.ZP)(i6.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})),Dc=(0,S.ZP)(i6.Z,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>(0,ay.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"})),Dh=(0,S.ZP)("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:240}),Dd=(0,S.ZP)(function(e){let t=k2({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:i,transKey:o}=t,s=(0,ab.Z)(t,A7),a=De(t),l=(0,eX.Z)();if(i)return(0,p.jsx)("div",{className:(0,v.Z)(a.root,r),children:n});let u={exit:a.exit,enterActive:a.enterActive,enter:a.enter,exitActive:a.exitActive};return(0,p.jsx)(Dt,{className:(0,v.Z)(a.root,r),childFactory:e=>m.cloneElement(e,{classNames:u}),role:"presentation",children:(0,p.jsx)(A8,(0,ay.Z)({mountOnEnter:!0,unmountOnExit:!0,timeout:l.transitions.duration.complex,classNames:u},s,{children:n}),o)})},{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:240}),Df=(0,S.ZP)("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),Dp=(0,S.ZP)("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:"2px 0",display:"flex",justifyContent:"center"});function Dm(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:i,isDateDisabled:o,currentMonthNumber:s,isViewFocused:a}=e,l=(0,ab.Z)(e,Dr),{disabled:u,disableHighlightToday:c,isMonthSwitchingAnimating:h,showDaysOutsideCurrentMonth:d,slots:f,slotProps:g,timezone:v}=t,y=Me(),b=Mn(v),x=null!==r&&y.isSameDay(n,r),w=i.some(e=>y.isSameDay(e,n)),S=y.isSameDay(n,b),C=f?.day??A1,k=(0,Tn.Z)({elementType:C,externalSlotProps:g?.day,additionalProps:(0,ay.Z)({disableHighlightToday:c,showDaysOutsideCurrentMonth:d,role:"gridcell",isAnimating:h,"data-timestamp":y.toJsDate(n).valueOf()},l),ownerState:(0,ay.Z)({},t,{day:n,selected:w})}),M=(0,ab.Z)(k,Di),T=m.useMemo(()=>u||o(n),[u,o,n]),A=m.useMemo(()=>y.getMonth(n)!==s,[y,n,s]),D=m.useMemo(()=>{let e=y.startOfMonth(y.setMonth(n,s));return d?y.isSameDay(n,y.startOfWeek(e)):y.isSameDay(n,e)},[s,n,d,y]),E=m.useMemo(()=>{let e=y.endOfMonth(y.setMonth(n,s));return d?y.isSameDay(n,y.endOfWeek(e)):y.isSameDay(n,e)},[s,n,d,y]);return(0,p.jsx)(C,(0,ay.Z)({},M,{day:n,disabled:T,autoFocus:a&&x,today:S,outsideCurrentMonth:A,isFirstVisibleCell:D,isLastVisibleCell:E,selected:w,tabIndex:x?0:-1,"aria-selected":w,"aria-current":S?"date":void 0}))}function Dg(e){let t=k2({props:e,name:"MuiDayCalendar"}),n=Me(),{onFocusedDayChange:r,className:i,currentMonth:o,selectedDays:s,focusedDay:a,loading:l,onSelectedDaysChange:u,onMonthSwitchingAnimationEnd:c,readOnly:h,reduceAnimations:d,renderLoading:f=()=>(0,p.jsx)("span",{children:"..."}),slideDirection:g,TransitionProps:y,disablePast:b,disableFuture:x,minDate:w,maxDate:S,shouldDisableDate:C,shouldDisableMonth:k,shouldDisableYear:M,dayOfWeekFormatter:T=e=>n.format(e,"weekdayShort").charAt(0).toUpperCase(),hasFocus:A,onFocusedViewChange:D,gridLabelId:E,displayWeekNumber:O,fixedWeekNumber:R,autoFocus:P,timezone:I}=t,N=Mn(I),j=Do(t),L=(0,sQ.V)(),F=Aj({shouldDisableDate:C,shouldDisableMonth:k,shouldDisableYear:M,minDate:w,maxDate:S,disablePast:b,disableFuture:x,timezone:I}),Z=Mw(),[B,V]=(0,Tf.Z)({name:"DayCalendar",state:"hasFocus",controlled:A,default:P??!1}),[z,_]=m.useState(()=>a||N),H=(0,Td.Z)(e=>{!h&&u(e)}),$=e=>{F(e)||(r(e),_(e),D?.(!0),V(!0))},W=(0,Td.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,L?1:-1),i=n.addMonths(t,L?1:-1);$(Mi({utils:n,date:r,minDate:L?r:n.startOfMonth(i),maxDate:L?n.endOfMonth(i):r,isDateDisabled:F,timezone:I})||r),e.preventDefault();break}case"ArrowRight":{let r=n.addDays(t,L?-1:1),i=n.addMonths(t,L?-1:1);$(Mi({utils:n,date:r,minDate:L?n.startOfMonth(i):r,maxDate:L?r:n.endOfMonth(i),isDateDisabled:F,timezone:I})||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()}}),q=(0,Td.Z)((e,t)=>$(t)),G=(0,Td.Z)((e,t)=>{B&&n.isSameDay(z,t)&&D?.(!1)}),U=n.getMonth(o),K=n.getYear(o),Y=m.useMemo(()=>s.filter(e=>!!e).map(e=>n.startOfDay(e)),[n,s]),X=`${K}-${U}`,Q=m.useMemo(()=>m.createRef(),[X]),J=m.useMemo(()=>{let e=n.startOfMonth(o),t=n.endOfMonth(o);return F(z)||n.isAfterDay(z,t)||n.isBeforeDay(z,e)?Mi({utils:n,date:z,minDate:e,maxDate:t,disablePast:b,disableFuture:x,isDateDisabled:F,timezone:I}):z},[o,x,b,z,F,n,I]),ee=m.useMemo(()=>{let e=n.getWeekArray(o),t=n.addMonths(o,1);for(;R&&e.length<R;){let r=n.getWeekArray(t),i=n.isSameDay(e[e.length-1][0],r[0][0]);r.slice(+!!i).forEach(t=>{e.length<R&&e.push(t)}),t=n.addMonths(t,1)}return e},[o,R,n]);return(0,p.jsxs)(Ds,{role:"grid","aria-labelledby":E,className:j.root,children:[(0,p.jsxs)(Da,{role:"row",className:j.header,children:[O&&(0,p.jsx)(Du,{variant:"caption",role:"columnheader","aria-label":Z.calendarWeekNumberHeaderLabel,className:j.weekNumberLabel,children:Z.calendarWeekNumberHeaderText}),Mh(n,N).map((e,t)=>(0,p.jsx)(Dl,{variant:"caption",role:"columnheader","aria-label":n.format(e,"weekday"),className:j.weekDayLabel,children:T(e)},t.toString()))]}),l?(0,p.jsx)(Dh,{className:j.loadingContainer,children:f()}):(0,p.jsx)(Dd,(0,ay.Z)({transKey:X,onExited:c,reduceAnimations:d,slideDirection:g,className:(0,v.Z)(i,j.slideTransition)},y,{nodeRef:Q,children:(0,p.jsx)(Df,{ref:Q,role:"rowgroup",className:j.monthContainer,children:ee.map((e,r)=>(0,p.jsxs)(Dp,{role:"row",className:j.weekContainer,"aria-rowindex":r+1,children:[O&&(0,p.jsx)(Dc,{className:j.weekNumber,role:"rowheader","aria-label":Z.calendarWeekNumberAriaLabelText(n.getWeekNumber(e[0])),children:Z.calendarWeekNumberText(n.getWeekNumber(e[0]))}),e.map((e,n)=>(0,p.jsx)(Dm,{parentProps:t,day:e,selectedDays:Y,focusableDay:J,onKeyDown:W,onFocus:q,onBlur:G,onDaySelect:H,isDateDisabled:F,currentMonthNumber:U,isViewFocused:B,"aria-colindex":n+1},e.toString()))]},`week-${e[0]}`))})}))]})}function Dv(e){return(0,A.ZP)("MuiPickersMonth",e)}let Dy=(0,T.Z)("MuiPickersMonth",["root","monthButton","disabled","selected"]),Db=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],Dx=e=>{let{disabled:t,selected:n,classes:r}=e;return(0,y.Z)({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},Dv,r)},Dw=(0,S.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%"}}]}),DS=(0,S.ZP)("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${Dy.disabled}`]:t.disabled},{[`&.${Dy.selected}`]:t.selected}]})(({theme:e})=>(0,ay.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,b.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,b.Fq)(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Dy.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Dy.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),DC=m.memo(function(e){let t=k2({props:e,name:"MuiPickersMonth"}),{autoFocus:n,className:r,children:i,disabled:o,selected:s,value:a,tabIndex:l,onClick:u,onKeyDown:c,onFocus:h,onBlur:d,"aria-current":f,"aria-label":g,slots:y,slotProps:b}=t,x=(0,ab.Z)(t,Db),w=m.useRef(null),S=Dx(t);(0,Tv.Z)(()=>{n&&w.current?.focus()},[n]);let C=y?.monthButton??DS,k=(0,Tn.Z)({elementType:C,externalSlotProps:b?.monthButton,additionalProps:{children:i,disabled:o,tabIndex:l,ref:w,type:"button",role:"radio","aria-current":f,"aria-checked":s,"aria-label":g,onClick:e=>u(e,a),onKeyDown:e=>c(e,a),onFocus:e=>h(e,a),onBlur:e=>d(e,a)},ownerState:t,className:S.monthButton});return(0,p.jsx)(Dw,(0,ay.Z)({className:(0,v.Z)(S.root,r),ownerState:t},x,{children:(0,p.jsx)(C,(0,ay.Z)({},k))}))});function Dk(e){return(0,A.ZP)("MuiMonthCalendar",e)}(0,T.Z)("MuiMonthCalendar",["root"]);let DM=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],DT=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"]},Dk,t)},DA=(0,S.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"}),DD=m.forwardRef(function(e,t){let n=function(e,t){let n=Me(),r=Mt(),i=k2({props:e,name:t});return(0,ay.Z)({disableFuture:!1,disablePast:!1},i,{minDate:Mo(n,i.minDate,r.minDate),maxDate:Mo(n,i.maxDate,r.maxDate)})}(e,"MuiMonthCalendar"),{className:r,value:i,defaultValue:o,referenceDate:s,disabled:a,disableFuture:l,disablePast:u,maxDate:c,minDate:h,onChange:d,shouldDisableMonth:f,readOnly:g,autoFocus:y=!1,onMonthFocus:b,hasFocus:x,onFocusedViewChange:w,monthsPerRow:S=3,timezone:C,gridLabelId:k,slots:M,slotProps:T}=n,A=(0,ab.Z)(n,DM),{value:D,handleValueChange:E,timezone:O}=T1({name:"MonthCalendar",timezone:C,value:i,defaultValue:o,referenceDate:s,onChange:d,valueManager:Ak}),R=Mn(O),P=(0,sQ.V)(),I=Me(),N=m.useMemo(()=>Ak.getInitialReferenceValue({value:D,utils:I,props:n,timezone:O,referenceDate:s,granularity:T2.month}),[]),j=DT(n),L=m.useMemo(()=>I.getMonth(R),[I,R]),F=m.useMemo(()=>null!=D?I.getMonth(D):null,[D,I]),[Z,B]=m.useState(()=>F||I.getMonth(N)),[V,z]=(0,Tf.Z)({name:"MonthCalendar",state:"hasFocus",controlled:x,default:y??!1}),_=(0,Td.Z)(e=>{z(e),w&&w(e)}),H=m.useCallback(e=>{let t=I.startOfMonth(u&&I.isAfter(R,h)?R:h),n=I.startOfMonth(l&&I.isBefore(R,c)?R:c),r=I.startOfMonth(e);return!!(I.isBefore(r,t)||I.isAfter(r,n))||!!f&&f(r)},[l,u,c,h,R,f,I]),$=(0,Td.Z)((e,t)=>{!g&&E(I.setMonth(D??N,t))}),W=(0,Td.Z)(e=>{!H(I.setMonth(D??N,e))&&(B(e),_(!0),b&&b(e))});m.useEffect(()=>{B(e=>null!==F&&e!==F?F:e)},[F]);let q=(0,Td.Z)((e,t)=>{switch(e.key){case"ArrowUp":W((12+t-3)%12),e.preventDefault();break;case"ArrowDown":W((12+t+3)%12),e.preventDefault();break;case"ArrowLeft":W((12+t+(P?1:-1))%12),e.preventDefault();break;case"ArrowRight":W((12+t+(P?-1:1))%12),e.preventDefault()}}),G=(0,Td.Z)((e,t)=>{W(t)}),U=(0,Td.Z)((e,t)=>{Z===t&&_(!1)});return(0,p.jsx)(DA,(0,ay.Z)({ref:t,className:(0,v.Z)(j.root,r),ownerState:n,role:"radiogroup","aria-labelledby":k},A,{children:Ms(I,D??N).map(e=>{let t=I.getMonth(e),n=I.format(e,"monthShort"),r=I.format(e,"month"),i=a||H(e);return(0,p.jsx)(DC,{selected:t===F,value:t,onClick:$,onKeyDown:q,autoFocus:V&&t===Z,disabled:i,tabIndex:t!==Z||i?-1:0,onFocus:G,onBlur:U,"aria-current":L===t?"date":void 0,"aria-label":r,monthsPerRow:S,slots:M,slotProps:T,children:n},n)})}))});function DE(e){return(0,A.ZP)("MuiPickersYear",e)}let DO=(0,T.Z)("MuiPickersYear",["root","yearButton","selected","disabled"]),DR=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],DP=e=>{let{disabled:t,selected:n,classes:r}=e;return(0,y.Z)({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},DE,r)},DI=(0,S.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%"}}]}),DN=(0,S.ZP)("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${DO.disabled}`]:t.disabled},{[`&.${DO.selected}`]:t.selected}]})(({theme:e})=>(0,ay.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,b.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,b.Fq)(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${DO.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${DO.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),Dj=m.memo(function(e){let t=k2({props:e,name:"MuiPickersYear"}),{autoFocus:n,className:r,children:i,disabled:o,selected:s,value:a,tabIndex:l,onClick:u,onKeyDown:c,onFocus:h,onBlur:d,"aria-current":f,slots:g,slotProps:y}=t,b=(0,ab.Z)(t,DR),x=m.useRef(null),w=DP(t);(0,Tv.Z)(()=>{n&&x.current?.focus()},[n]);let S=g?.yearButton??DN,C=(0,Tn.Z)({elementType:S,externalSlotProps:y?.yearButton,additionalProps:{children:i,disabled:o,tabIndex:l,ref:x,type:"button",role:"radio","aria-current":f,"aria-checked":s,onClick:e=>u(e,a),onKeyDown:e=>c(e,a),onFocus:e=>h(e,a),onBlur:e=>d(e,a)},ownerState:t,className:w.yearButton});return(0,p.jsx)(DI,(0,ay.Z)({className:(0,v.Z)(w.root,r),ownerState:t},b,{children:(0,p.jsx)(S,(0,ay.Z)({},C))}))});function DL(e){return(0,A.ZP)("MuiYearCalendar",e)}(0,T.Z)("MuiYearCalendar",["root"]);let DF=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],DZ=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"]},DL,t)},DB=(0,S.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"}),DV=m.forwardRef(function(e,t){let n=function(e,t){let n=Me(),r=Mt(),i=k2({props:e,name:t});return(0,ay.Z)({disablePast:!1,disableFuture:!1},i,{yearsPerRow:i.yearsPerRow??3,minDate:Mo(n,i.minDate,r.minDate),maxDate:Mo(n,i.maxDate,r.maxDate)})}(e,"MuiYearCalendar"),{autoFocus:r,className:i,value:o,defaultValue:s,referenceDate:a,disabled:l,disableFuture:u,disablePast:c,maxDate:h,minDate:d,onChange:f,readOnly:g,shouldDisableYear:y,onYearFocus:b,hasFocus:x,onFocusedViewChange:w,yearsOrder:S="asc",yearsPerRow:C,timezone:k,gridLabelId:M,slots:T,slotProps:A}=n,D=(0,ab.Z)(n,DF),{value:E,handleValueChange:O,timezone:R}=T1({name:"YearCalendar",timezone:k,value:o,defaultValue:s,referenceDate:a,onChange:f,valueManager:Ak}),P=Mn(R),I=(0,sQ.V)(),N=Me(),j=m.useMemo(()=>Ak.getInitialReferenceValue({value:E,utils:N,props:n,timezone:R,referenceDate:a,granularity:T2.year}),[]),L=DZ(n),F=m.useMemo(()=>N.getYear(P),[N,P]),Z=m.useMemo(()=>null!=E?N.getYear(E):null,[E,N]),[B,V]=m.useState(()=>Z||N.getYear(j)),[z,_]=(0,Tf.Z)({name:"YearCalendar",state:"hasFocus",controlled:x,default:r??!1}),H=(0,Td.Z)(e=>{_(e),w&&w(e)}),$=m.useCallback(e=>!!(c&&N.isBeforeYear(e,P)||u&&N.isAfterYear(e,P)||d&&N.isBeforeYear(e,d)||h&&N.isAfterYear(e,h))||!!y&&y(N.startOfYear(e)),[u,c,h,d,P,y,N]),W=(0,Td.Z)((e,t)=>{!g&&O(N.setYear(E??j,t))}),q=(0,Td.Z)(e=>{$(N.setYear(E??j,e))||(V(e),H(!0),b?.(e))});m.useEffect(()=>{V(e=>null!==Z&&e!==Z?Z:e)},[Z]);let G="desc"!==S?+C:-1*C,U=I&&"asc"===S||!I&&"desc"===S?-1:1,K=(0,Td.Z)((e,t)=>{switch(e.key){case"ArrowUp":q(t-G),e.preventDefault();break;case"ArrowDown":q(t+G),e.preventDefault();break;case"ArrowLeft":q(t-U),e.preventDefault();break;case"ArrowRight":q(t+U),e.preventDefault()}}),Y=(0,Td.Z)((e,t)=>{q(t)}),X=(0,Td.Z)((e,t)=>{B===t&&H(!1)}),Q=m.useRef(null),J=(0,A$.Z)(t,Q);m.useEffect(()=>{if(r||null===Q.current)return;let e=Q.current.querySelector('[tabindex="0"]');if(!e)return;let t=e.offsetHeight,n=e.offsetTop,i=Q.current.clientHeight,o=Q.current.scrollTop;!(t>i)&&!(n<o)&&(Q.current.scrollTop=n+t-i/2-t/2)},[r]);let ee=N.getYearRange([d,h]);return"desc"===S&&ee.reverse(),(0,p.jsx)(DB,(0,ay.Z)({ref:J,className:(0,v.Z)(L.root,i),ownerState:n,role:"radiogroup","aria-labelledby":M},D,{children:ee.map(e=>{let t=N.getYear(e),n=l||$(e);return(0,p.jsx)(Dj,{selected:t===Z,value:t,onClick:W,onKeyDown:K,autoFocus:z&&t===B,disabled:n,tabIndex:t!==B||n?-1:0,onFocus:Y,onBlur:X,"aria-current":F===t?"date":void 0,yearsPerRow:C,slots:T,slotProps:A,children:N.format(e,"year")},N.format(e,"year"))})}))}),Dz=e=>(0,A.ZP)("MuiPickersCalendarHeader",e),D_=(0,T.Z)("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]),DH=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],D$=["ownerState"],DW=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},Dz,t)},Dq=(0,S.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}),DG=(0,S.ZP)("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>(0,ay.Z)({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),DU=(0,S.ZP)("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),DK=(0,S.ZP)(ef.Z,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${D_.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),DY=(0,S.ZP)(Mm,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),DX=m.forwardRef(function(e,t){let n=Mw(),r=Me(),i=k2({props:e,name:"MuiPickersCalendarHeader"}),{slots:o,slotProps:s,currentMonth:a,disabled:l,disableFuture:u,disablePast:c,maxDate:h,minDate:d,onMonthChange:f,onViewChange:g,view:y,reduceAnimations:b,views:x,labelId:w,className:S,timezone:C,format:k=`${r.formats.month} ${r.formats.year}`}=i,M=(0,ab.Z)(i,DH),T=DW(i),A=o?.switchViewButton??DK,D=(0,Tn.Z)({elementType:A,externalSlotProps:s?.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(y)},ownerState:i,className:T.switchViewButton}),E=o?.switchViewIcon??DY,O=(0,Tn.Z)({elementType:E,externalSlotProps:s?.switchViewIcon,ownerState:i,className:T.switchViewIcon}),R=(0,ab.Z)(O,D$),P=function(e,{disableFuture:t,maxDate:n,timezone:r}){let i=Me();return m.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])}(a,{disableFuture:u,maxDate:h,timezone:C}),I=function(e,{disablePast:t,minDate:n,timezone:r}){let i=Me();return m.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])}(a,{disablePast:c,minDate:d,timezone:C});if(1===x.length&&"year"===x[0])return null;let N=r.formatByString(a,k);return(0,p.jsxs)(Dq,(0,ay.Z)({},M,{ownerState:i,className:(0,v.Z)(T.root,S),ref:t,children:[(0,p.jsxs)(DG,{role:"presentation",onClick:()=>{if(1!==x.length&&g&&!l){if(2===x.length)g(x.find(e=>e!==y)||x[0]);else{let e=+(0===x.indexOf(y));g(x[e])}}},ownerState:i,"aria-live":"polite",className:T.labelContainer,children:[(0,p.jsx)(AH,{reduceAnimations:b,transKey:N,children:(0,p.jsx)(DU,{id:w,ownerState:i,className:T.label,children:N})}),x.length>1&&!l&&(0,p.jsx)(A,(0,ay.Z)({},D,{children:(0,p.jsx)(E,(0,ay.Z)({},R))}))]}),(0,p.jsx)(AB.Z,{in:"day"===y,appear:!b,enter:!b,children:(0,p.jsx)(Th,{slots:o,slotProps:s,onGoToPrevious:()=>f(r.addMonths(a,-1),"right"),isPreviousDisabled:I,previousLabel:n.previousMonth,onGoToNext:()=>f(r.addMonths(a,1),"left"),isNextDisabled:P,nextLabel:n.nextMonth})})]}))}),DQ="undefined"!=typeof navigator&&navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i),DJ=DQ&&DQ[1]?parseInt(DQ[1],10):null,D0=DQ&&DQ[2]?parseInt(DQ[2],10):null,D1=DJ&&DJ<10||D0&&D0<13||!1,D2=()=>(0,sX.Z)("@media (prefers-reduced-motion: reduce)",{defaultMatches:!1})||D1,D5=e=>(0,A.ZP)("MuiDateCalendar",e);(0,T.Z)("MuiDateCalendar",["root","viewTransitionContainer"]);let D3=["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"],D4=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},D5,t)},D8=(0,S.ZP)(Tm,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:336}),D6=(0,S.ZP)(AH,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),D9=m.forwardRef(function(e,t){let n=Me(),r=(0,Tt.Z)(),i=function(e,t){let n=Me(),r=Mt(),i=D2(),o=k2({props:e,name:t});return(0,ay.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,p.jsx)("span",{children:"..."})),minDate:Mo(n,o.minDate,r.minDate),maxDate:Mo(n,o.maxDate,r.maxDate)})}(e,"MuiDateCalendar"),{autoFocus:o,onViewChange:s,value:a,defaultValue:l,referenceDate:u,disableFuture:c,disablePast:h,onChange:d,onYearChange:f,onMonthChange:g,reduceAnimations:y,shouldDisableDate:b,shouldDisableMonth:x,shouldDisableYear:w,view:S,views:C,openTo:k,className:M,disabled:T,readOnly:A,minDate:D,maxDate:E,disableHighlightToday:O,focusedView:R,onFocusedViewChange:P,showDaysOutsideCurrentMonth:I,fixedWeekNumber:N,dayOfWeekFormatter:j,slots:L,slotProps:F,loading:Z,renderLoading:B,displayWeekNumber:V,yearsOrder:z,yearsPerRow:_,monthsPerRow:H,timezone:$}=i,W=(0,ab.Z)(i,D3),{value:q,handleValueChange:G,timezone:U}=T1({name:"DateCalendar",timezone:$,value:a,defaultValue:l,referenceDate:u,onChange:d,valueManager:Ak}),{view:K,setView:Y,focusedView:X,setFocusedView:Q,goToNextView:J,setValueAndGoToNextView:ee}=Tp({view:S,views:C,openTo:k,onChange:G,onViewChange:s,autoFocus:o,focusedView:R,onFocusedViewChange:P}),{referenceDate:et,calendarState:en,changeFocusedDay:er,changeMonth:ei,handleChangeMonth:eo,isDateDisabled:es,onMonthSwitchingAnimationEnd:ea}=AF({value:q,referenceDate:u,reduceAnimations:y,onMonthChange:g,minDate:D,maxDate:E,shouldDisableDate:b,disablePast:h,disableFuture:c,timezone:U}),el=T&&q||D,eu=T&&q||E,ec=`${r}-grid-label`,eh=null!==X,ed=L?.calendarHeader??DX,ef=(0,Tn.Z)({elementType:ed,externalSlotProps:F?.calendarHeader,additionalProps:{views:C,view:K,currentMonth:en.currentMonth,onViewChange:Y,onMonthChange:(e,t)=>eo({newMonth:e,direction:t}),minDate:el,maxDate:eu,disabled:T,disablePast:h,disableFuture:c,reduceAnimations:y,timezone:U,labelId:ec},ownerState:i}),ep=(0,Td.Z)(e=>{let t=n.startOfMonth(e),r=n.endOfMonth(e),i=es(e)?Mi({utils:n,date:e,minDate:n.isBefore(D,t)?t:D,maxDate:n.isAfter(E,r)?r:E,disablePast:h,disableFuture:c,isDateDisabled:es,timezone:U}):e;i?(ee(i,"finish"),g?.(t)):(J(),ei(t)),er(i,!0)}),em=(0,Td.Z)(e=>{let t=n.startOfYear(e),r=n.endOfYear(e),i=es(e)?Mi({utils:n,date:e,minDate:n.isBefore(D,t)?t:D,maxDate:n.isAfter(E,r)?r:E,disablePast:h,disableFuture:c,isDateDisabled:es,timezone:U}):e;i?(ee(i,"finish"),f?.(i)):(J(),ei(t)),er(i,!0)}),eg=(0,Td.Z)(e=>e?G(Mr(n,e,q??et),"finish",K):G(e,"finish",K));m.useEffect(()=>{null!=q&&n.isValid(q)&&ei(q)},[q]);let ev=D4(i),ey={disablePast:h,disableFuture:c,maxDate:E,minDate:D},eb={disableHighlightToday:O,readOnly:A,disabled:T,timezone:U,gridLabelId:ec,slots:L,slotProps:F},ex=m.useRef(K);m.useEffect(()=>{ex.current!==K&&(X===ex.current&&Q(K,!0),ex.current=K)},[X,Q,K]);let ew=m.useMemo(()=>[q],[q]);return(0,p.jsxs)(D8,(0,ay.Z)({ref:t,className:(0,v.Z)(ev.root,M),ownerState:i},W,{children:[(0,p.jsx)(ed,(0,ay.Z)({},ef,{slots:L,slotProps:F})),(0,p.jsx)(D6,{reduceAnimations:y,className:ev.viewTransitionContainer,transKey:K,ownerState:i,children:(0,p.jsxs)("div",{children:["year"===K&&(0,p.jsx)(DV,(0,ay.Z)({},ey,eb,{value:q,onChange:em,shouldDisableYear:w,hasFocus:eh,onFocusedViewChange:e=>Q("year",e),yearsOrder:z,yearsPerRow:_,referenceDate:et})),"month"===K&&(0,p.jsx)(DD,(0,ay.Z)({},ey,eb,{hasFocus:eh,className:M,value:q,onChange:ep,shouldDisableMonth:x,onFocusedViewChange:e=>Q("month",e),monthsPerRow:H,referenceDate:et})),"day"===K&&(0,p.jsx)(Dg,(0,ay.Z)({},en,ey,eb,{onMonthSwitchingAnimationEnd:ea,onFocusedDayChange:er,reduceAnimations:y,selectedDays:ew,onSelectedDaysChange:eg,shouldDisableDate:b,shouldDisableMonth:x,shouldDisableYear:w,hasFocus:eh,onFocusedViewChange:e=>Q("day",e),showDaysOutsideCurrentMonth:I,fixedWeekNumber:N,dayOfWeekFormatter:j,displayWeekNumber:V,loading:Z,renderLoading:B}))]})})]}))}),D7=({view:e,onViewChange:t,views:n,focusedView:r,onFocusedViewChange:i,value:o,defaultValue:s,referenceDate:a,onChange:l,className:u,classes:c,disableFuture:h,disablePast:d,minDate:f,maxDate:m,shouldDisableDate:g,shouldDisableMonth:v,shouldDisableYear:y,reduceAnimations:b,onMonthChange:x,monthsPerRow:w,onYearChange:S,yearsOrder:C,yearsPerRow:k,slots:M,slotProps:T,loading:A,renderLoading:D,disableHighlightToday:E,readOnly:O,disabled:R,showDaysOutsideCurrentMonth:P,dayOfWeekFormatter:I,sx:N,autoFocus:j,fixedWeekNumber:L,displayWeekNumber:F,timezone:Z})=>(0,p.jsx)(D9,{view:e,onViewChange:t,views:n.filter(Mc),focusedView:r&&Mc(r)?r:null,onFocusedViewChange:i,value:o,defaultValue:s,referenceDate:a,onChange:l,className:u,classes:c,disableFuture:h,disablePast:d,minDate:f,maxDate:m,shouldDisableDate:g,shouldDisableMonth:v,shouldDisableYear:y,reduceAnimations:b,onMonthChange:x,monthsPerRow:w,onYearChange:S,yearsOrder:C,yearsPerRow:k,slots:M,slotProps:T,loading:A,renderLoading:D,disableHighlightToday:E,readOnly:O,disabled:R,showDaysOutsideCurrentMonth:P,dayOfWeekFormatter:I,sx:N,autoFocus:j,fixedWeekNumber:L,displayWeekNumber:F,timezone:Z}),Ee=({open:e,onOpen:t,onClose:n})=>{let r=m.useRef("boolean"==typeof e).current,[i,o]=m.useState(!1);return m.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:m.useCallback(e=>{r||o(e),e&&t&&t(),!e&&n&&n()},[r,t,n])}};function Et(e){let{props:t,validator:n,value:r,timezone:i,onError:o}=e,s=k7(),a=m.useRef(n.valueManager.defaultErrorState),l=n({adapter:s,value:r,timezone:i,props:t}),u=n.valueManager.hasError(l);return m.useEffect(()=>{o&&!n.valueManager.isSameError(l,a.current)&&o(l,r),a.current=l},[n,o,l,r]),{validationError:l,hasValidationError:u,getValidationErrorForNewValue:(0,Td.Z)(e=>n({adapter:s,value:e,timezone:i,props:t}))}}let En=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)))},Er=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)},Ei=e=>{let{action:t,closeOnSelect:n}=e;return"setValueFromAction"===t.name||("setValueFromView"===t.name?"finish"===t.selectionState&&n:"setValueFromShortcut"===t.name&&"accept"===t.changeImportance)},Eo=({props:e,valueManager:t,valueType:n,wrapperVariant:r,validator:i})=>{let{onAccept:o,onChange:s,value:a,defaultValue:l,closeOnSelect:u="desktop"===r,timezone:c,referenceDate:h}=e,{current:d}=m.useRef(l),{current:f}=m.useRef(void 0!==a),[p,g]=m.useState(c),v=Me(),y=k7(),{isOpen:b,setIsOpen:x}=Ee(e),{timezone:w,value:S,handleValueChange:C}=T0({timezone:c,value:a,defaultValue:d,referenceDate:h,onChange:s,valueManager:t}),[k,M]=m.useState(()=>{let e;return{draft:e=void 0!==S?S:void 0!==d?d:t.emptyValue,lastPublishedValue:e,lastCommittedValue:e,lastControlledValue:a,hasBeenModifiedSinceMount:!1}}),T=t.getTimezone(v,k.draft);p!==c&&(g(c),c&&T&&c!==T&&M(e=>(0,ay.Z)({},e,{draft:t.setTimezone(v,c,e.draft)})));let{getValidationErrorForNewValue:A}=Et({props:e,validator:i,timezone:w,value:k.draft,onError:e.onError}),D=(0,Td.Z)(e=>{let n={action:e,dateState:k,hasChanged:n=>!t.areValuesEqual(v,e.value,n),isControlled:f,closeOnSelect:u},r=En(n),i=Er(n),s=Ei(n);M(t=>(0,ay.Z)({},t,{draft:e.value,lastPublishedValue:r?e.value:t.lastPublishedValue,lastCommittedValue:i?e.value:t.lastCommittedValue,hasBeenModifiedSinceMount:!0}));let a=null,l=()=>(a||(a={validationError:"setValueFromField"===e.name?e.context.validationError:A(e.value)},"setValueFromShortcut"!==e.name||(a.shortcut=e.shortcut)),a);r&&C(e.value,l()),i&&o&&o(e.value,l()),s&&x(!1)});if(k.lastControlledValue!==a){let e=t.areValuesEqual(v,k.draft,S);M(t=>(0,ay.Z)({},t,{lastControlledValue:a},e?{}:{lastCommittedValue:S,lastPublishedValue:S,draft:S,hasBeenModifiedSinceMount:!0}))}let E=(0,Td.Z)(()=>{D({value:t.emptyValue,name:"setValueFromAction",pickerAction:"clear"})}),O=(0,Td.Z)(()=>{D({value:k.lastPublishedValue,name:"setValueFromAction",pickerAction:"accept"})}),R=(0,Td.Z)(()=>{D({value:k.lastPublishedValue,name:"setValueFromAction",pickerAction:"dismiss"})}),P=(0,Td.Z)(()=>{D({value:k.lastCommittedValue,name:"setValueFromAction",pickerAction:"cancel"})}),I=(0,Td.Z)(()=>{D({value:t.getTodayValue(v,w,n),name:"setValueFromAction",pickerAction:"today"})}),N=(0,Td.Z)(e=>{e.preventDefault(),x(!0)}),j=(0,Td.Z)(e=>{e?.preventDefault(),x(!1)}),L=(0,Td.Z)((e,t="partial")=>D({name:"setValueFromView",value:e,selectionState:t})),F=(0,Td.Z)((e,t,n)=>D({name:"setValueFromShortcut",value:e,changeImportance:t,shortcut:n})),Z=(0,Td.Z)((e,t)=>D({name:"setValueFromField",value:e,context:t})),B={onClear:E,onAccept:O,onDismiss:R,onCancel:P,onSetToday:I,onOpen:N,onClose:j},V={value:k.draft,onChange:Z},z=m.useMemo(()=>t.cleanValue(v,k.draft),[v,t,k.draft]),_=(0,ay.Z)({},B,{value:z,onChange:L,onSelectShortcut:F,isValid:n=>{let r=i({adapter:y,value:n,timezone:w,props:e});return!t.hasError(r)}}),H=m.useMemo(()=>({onOpen:N,onClose:j,open:b}),[b,j,N]);return{open:b,fieldProps:V,viewProps:{value:z,onChange:L,onClose:j,open:b},layoutProps:_,actions:B,contextValue:H}},Es=["className","sx"],Ea=({props:e,propsFromPickerValue:t,additionalViewProps:n,autoFocusView:r,rendererInterceptor:i,fieldRef:o})=>{let{onChange:s,open:a,onClose:l}=t,{view:u,views:c,openTo:h,onViewChange:d,viewRenderers:f,timezone:p}=e,g=(0,ab.Z)(e,Es),{view:v,setView:y,defaultView:b,focusedView:x,setFocusedView:w,setValueAndGoToNextView:S}=Tp({view:u,views:c,openTo:h,onChange:s,onViewChange:d,autoFocus:r}),{hasUIView:C,viewModeLookup:k}=m.useMemo(()=>c.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,c]),M=m.useMemo(()=>c.reduce((e,t)=>null!=f[t]&&MU(t)?e+1:e,0),[f,c]),T=k[v],A=(0,Td.Z)(()=>"UI"===T),[D,E]=m.useState("UI"===T?v:null);return D!==v&&"UI"===k[v]&&E(v),(0,Tv.Z)(()=>{"field"===T&&a&&(l(),setTimeout(()=>{o?.current?.setSelectedSections(v),o?.current?.focusField(v)}))},[v]),(0,Tv.Z)(()=>{if(!a)return;let e=v;"field"===T&&null!=D&&(e=D),e!==b&&"UI"===k[e]&&"UI"===k[b]&&(e=b),e!==v&&y(e),w(e,!0)},[a]),{hasUIView:C,shouldRestoreFocus:A,layoutProps:{views:c,view:D,onViewChange:y},renderCurrentView:()=>{if(null==D)return null;let e=f[D];if(null==e)return null;let r=(0,ay.Z)({},g,n,t,{views:c,timezone:p,onChange:S,view:D,onViewChange:y,focusedView:x,onFocusedViewChange:w,showViewSwitcher:M>1,timeViewsCount:M});return i?i(f,D,r):e(r)}}},El=(e=document)=>{let t=e.activeElement;return t?t.shadowRoot?El(t.shadowRoot):t:null};function Eu(){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"}let Ec=(e,t)=>{var n;let[r,i]=m.useState(Eu);return(0,Tv.Z)(()=>{let e=()=>{i(Eu())};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)},Eh=({props:e,propsFromPickerValue:t,propsFromPickerViews:n,wrapperVariant:r})=>{let{orientation:i}=e,o=Ec(n.views,i),s=(0,sQ.V)();return{layoutProps:(0,ay.Z)({},n,t,{isLandscape:o,isRtl:s,wrapperVariant:r,disabled:e.disabled,readOnly:e.readOnly})}},Ed=({props:e,valueManager:t,valueType:n,wrapperVariant:r,additionalViewProps:i,validator:o,autoFocusView:s,rendererInterceptor:a,fieldRef:l})=>{let u=Eo({props:e,valueManager:t,valueType:n,wrapperVariant:r,validator:o}),c=Ea({props:e,additionalViewProps:i,autoFocusView:s,fieldRef:l,propsFromPickerValue:u.viewProps,rendererInterceptor:a}),h=Eh({props:e,wrapperVariant:r,propsFromPickerValue:u.layoutProps,propsFromPickerViews:c.layoutProps}),d=function(e){let{props:t,pickerValueResponse:n}=e;return m.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:u});return{open:u.open,actions:u.actions,fieldProps:u.fieldProps,renderCurrentView:c.renderCurrentView,hasUIView:c.hasUIView,shouldRestoreFocus:c.shouldRestoreFocus,layoutProps:h.layoutProps,contextValue:u.contextValue,ownerState:d}};function Ef(e){return(0,A.ZP)("MuiPickersLayout",e)}let Ep=(0,T.Z)("MuiPickersLayout",["root","landscape","contentWrapper","toolbar","actionBar","tabs","shortcuts"]),Em=["onAccept","onClear","onCancel","onSetToday","actions"];function Eg(e){let{onAccept:t,onClear:n,onCancel:r,onSetToday:i,actions:o}=e,s=(0,ab.Z)(e,Em),a=Mw();if(null==o||0===o.length)return null;let l=o?.map(e=>{switch(e){case"clear":return p.jsx(j.Z,{onClick:n,children:a.clearButtonLabel},e);case"cancel":return p.jsx(j.Z,{onClick:r,children:a.cancelButtonLabel},e);case"accept":return p.jsx(j.Z,{onClick:t,children:a.okButtonLabel},e);case"today":return p.jsx(j.Z,{onClick:i,children:a.todayButtonLabel},e);default:return null}});return(0,p.jsx)(oF.Z,(0,ay.Z)({},s,{children:l}))}var Ev=n(71852),Ey=n(88653),Eb=n(70777);function Ex(e){return(0,A.ZP)("MuiListItem",e)}function Ew(e){return(0,A.ZP)("MuiListItemSecondaryAction",e)}(0,T.Z)("MuiListItem",["root","container","dense","alignItemsFlexStart","divider","gutters","padding","secondaryAction"]),(0,T.Z)("MuiListItemSecondaryAction",["root","disableGutters"]);let ES=e=>{let{disableGutters:t,classes:n}=e;return(0,y.Z)({root:["root",t&&"disableGutters"]},Ew,n)},EC=(0,S.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}}]}),Ek=m.forwardRef(function(e,t){let n=(0,M.i)({props:e,name:"MuiListItemSecondaryAction"}),{className:r,...i}=n,o=m.useContext(r4.Z),s={...n,disableGutters:o.disableGutters},a=ES(s);return(0,p.jsx)(EC,{className:(0,v.Z)(a.root,r),ownerState:s,ref:t,...i})});Ek.muiName="ListItemSecondaryAction";let EM=e=>{let{alignItems:t,classes:n,dense:r,disableGutters:i,disablePadding:o,divider:s,hasSecondaryAction:a}=e;return(0,y.Z)({root:["root",r&&"dense",!i&&"gutters",!o&&"padding",s&&"divider","flex-start"===t&&"alignItemsFlexStart",a&&"secondaryAction"],container:["container"]},Ex,n)},ET=(0,S.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,C.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:{[`& > .${r6.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}}]}))),EA=(0,S.ZP)("li",{name:"MuiListItem",slot:"Container",overridesResolver:(e,t)=>t.container})({position:"relative"}),ED=m.forwardRef(function(e,t){let n=(0,M.i)({props:e,name:"MuiListItem"}),{alignItems:r="center",children:i,className:o,component:s,components:a={},componentsProps:l={},ContainerComponent:u="li",ContainerProps:{className:c,...h}={},dense:d=!1,disableGutters:f=!1,disablePadding:g=!1,divider:y=!1,secondaryAction:b,slotProps:x={},slots:w={},...S}=n,C=m.useContext(r4.Z),k=m.useMemo(()=>({dense:d||C.dense||!1,alignItems:r,disableGutters:f}),[r,C.dense,d,f]),T=m.useRef(null),A=m.Children.toArray(i),D=A.length&&(0,Eb.Z)(A[A.length-1],["ListItemSecondaryAction"]),E={...n,alignItems:r,dense:k.dense,disableGutters:f,disablePadding:g,divider:y,hasSecondaryAction:D},O=EM(E),R=(0,r3.Z)(T,t),P=w.root||a.Root||ET,I=x.root||l.root||{},N={className:(0,v.Z)(O.root,I.className,o),...S},j=s||"li";return D?(j=N.component||s?j:"div","li"===u&&("li"===j?j="div":"li"===N.component&&(N.component="div")),(0,p.jsx)(r4.Z.Provider,{value:k,children:(0,p.jsxs)(EA,{as:u,className:(0,v.Z)(O.container,c),ref:R,ownerState:E,...h,children:[(0,p.jsx)(P,{...I,...!(0,Ey.Z)(P)&&{as:j,ownerState:{...E,...I.ownerState}},...N,children:A}),A.pop()]})})):(0,p.jsx)(r4.Z.Provider,{value:k,children:(0,p.jsxs)(P,{...I,as:j,ref:R,...!(0,Ey.Z)(P)&&{ownerState:{...E,...I.ownerState}},...N,children:[A,b&&(0,p.jsx)(Ek,{children:b})]})})});var EE=n(52889);let EO=["items","changeImportance","isLandscape","onChange","isValid"],ER=["getValue"];function EP(e){let{items:t,changeImportance:n="accept",onChange:r,isValid:i}=e,o=(0,ab.Z)(e,EO);if(null==t||0===t.length)return null;let s=t.map(e=>{let{getValue:t}=e,o=(0,ab.Z)(e,ER),s=t({isValid:i});return(0,ay.Z)({},o,{label:o.label,onClick:()=>{r(s,n,o)},disabled:!i(s)})});return(0,p.jsx)(Ev.Z,(0,ay.Z)({dense:!0,sx:[{maxHeight:336,maxWidth:200,overflow:"auto"},...Array.isArray(o.sx)?o.sx:[o.sx]]},o,{children:s.map(e=>(0,p.jsx)(ED,{children:(0,p.jsx)(EE.Z,(0,ay.Z)({},e))},e.id??e.label))}))}let EI=e=>{let{classes:t,isLandscape:n}=e;return(0,y.Z)({root:["root",n&&"landscape"],contentWrapper:["contentWrapper"],toolbar:["toolbar"],actionBar:["actionBar"],tabs:["tabs"],landscape:["landscape"],shortcuts:["shortcuts"]},Ef,t)},EN=e=>{let{wrapperVariant:t,onAccept:n,onClear:r,onCancel:i,onSetToday:o,view:s,views:a,onViewChange:l,value:u,onChange:c,onSelectShortcut:h,isValid:d,isLandscape:f,disabled:m,readOnly:g,children:v,slots:y,slotProps:b}=e,x=EI(e),w=y?.actionBar??Eg,S=(0,Tn.Z)({elementType:w,externalSlotProps:b?.actionBar,additionalProps:{onAccept:n,onClear:r,onCancel:i,onSetToday:o,actions:"desktop"===t?[]:["cancel","accept"]},className:x.actionBar,ownerState:(0,ay.Z)({},e,{wrapperVariant:t})}),C=(0,p.jsx)(w,(0,ay.Z)({},S)),k=y?.toolbar,M=(0,Tn.Z)({elementType:k,externalSlotProps:b?.toolbar,additionalProps:{isLandscape:f,onChange:c,value:u,view:s,onViewChange:l,views:a,disabled:m,readOnly:g},className:x.toolbar,ownerState:(0,ay.Z)({},e,{wrapperVariant:t})}),T=null!==M.view&&k?(0,p.jsx)(k,(0,ay.Z)({},M)):null,A=y?.tabs,D=s&&A?(0,p.jsx)(A,(0,ay.Z)({view:s,onViewChange:l,className:x.tabs},b?.tabs)):null,E=y?.shortcuts??EP,O=(0,Tn.Z)({elementType:E,externalSlotProps:b?.shortcuts,additionalProps:{isValid:d,isLandscape:f,onChange:h},className:x.shortcuts,ownerState:{isValid:d,isLandscape:f,onChange:h,wrapperVariant:t}});return{toolbar:T,content:v,tabs:D,actionBar:C,shortcuts:s&&E?(0,p.jsx)(E,(0,ay.Z)({},O)):null}},Ej=e=>{let{isLandscape:t,classes:n}=e;return(0,y.Z)({root:["root",t&&"landscape"],contentWrapper:["contentWrapper"]},Ef,n)},EL=(0,S.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",[`& .${Ep.actionBar}`]:{gridColumn:"1 / 4",gridRow:3},variants:[{props:{isLandscape:!0},style:{[`& .${Ep.toolbar}`]:{gridColumn:1,gridRow:"2 / 3"},[`.${Ep.shortcuts}`]:{gridColumn:"2 / 4",gridRow:1}}},{props:{isLandscape:!0,isRtl:!0},style:{[`& .${Ep.toolbar}`]:{gridColumn:3}}},{props:{isLandscape:!1},style:{[`& .${Ep.toolbar}`]:{gridColumn:"2 / 4",gridRow:1},[`& .${Ep.shortcuts}`]:{gridColumn:1,gridRow:"2 / 3"}}},{props:{isLandscape:!1,isRtl:!0},style:{[`& .${Ep.shortcuts}`]:{gridColumn:3}}}]}),EF=(0,S.ZP)("div",{name:"MuiPickersLayout",slot:"ContentWrapper",overridesResolver:(e,t)=>t.contentWrapper})({gridColumn:2,gridRow:2,display:"flex",flexDirection:"column"}),EZ=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiPickersLayout"}),{toolbar:r,content:i,tabs:o,actionBar:s,shortcuts:a}=EN(n),{sx:l,className:u,isLandscape:c,wrapperVariant:h}=n,d=Ej(n);return(0,p.jsxs)(EL,{ref:t,sx:l,className:(0,v.Z)(d.root,u),ownerState:n,children:[c?a:r,c?r:a,(0,p.jsx)(EF,{className:d.contentWrapper,children:"desktop"===h?(0,p.jsxs)(m.Fragment,{children:[i,o]}):(0,p.jsxs)(m.Fragment,{children:[o,i]})}),s]})}),EB=["props","ref"],EV=(0,S.ZP)(EZ)(({theme:e})=>({overflow:"hidden",minWidth:320,backgroundColor:(e.vars||e).palette.background.paper})),Ez=e=>{let{props:t,ref:n}=e,r=(0,ab.Z)(e,EB),{localeText:i,slots:o,slotProps:s,className:a,sx:l,displayStaticWrapperAs:u,autoFocus:c}=t,{layoutProps:h,renderCurrentView:d}=Ed((0,ay.Z)({},r,{props:t,autoFocusView:c??!1,additionalViewProps:{},wrapperVariant:u})),f=o?.layout??EV;return{renderPicker:()=>(0,p.jsx)(k4,{localeText:i,children:(0,p.jsx)(f,(0,ay.Z)({},h,s?.layout,{slots:o,slotProps:s,sx:[...Array.isArray(l)?l:[l],...Array.isArray(s?.layout?.sx)?s.layout.sx:[s?.layout?.sx]],className:(0,v.Z)(a,s?.layout?.className),ref:n,children:d()}))})}},E_=({adapter:e,value:t,timezone:n,props:r})=>{if(null===t)return null;let{minTime:i,maxTime:o,minutesStep:s,shouldDisableTime:a,disableIgnoringDatePartForTimeValidation:l=!1,disablePast:u,disableFuture:c}=r,h=e.utils.date(void 0,n),d=MJ(l,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!!(c&&e.utils.isAfter(t,h)):return"disableFuture";case!!(u&&e.utils.isBefore(t,h)):return"disablePast";case!!(a&&a(t,"hours")):return"shouldDisableTime-hours";case!!(a&&a(t,"minutes")):return"shouldDisableTime-minutes";case!!(a&&a(t,"seconds")):return"shouldDisableTime-seconds";case!!(s&&e.utils.getMinutes(t)%s!=0):return"minutesStep";default:return null}};E_.valueManager=Ak;let EH=({adapter:e,value:t,timezone:n,props:r})=>{let i=AN({adapter:e,value:t,timezone:n,props:r});return null!==i?i:E_({adapter:e,value:t,timezone:n,props:r})};EH.valueManager=Ak;let E$=m.forwardRef(function(e,t){let n=function(e,t){let n=Me(),r=Mt(),i=k2({props:e,name:t}),o=i.ampm??n.is12HourCycleInCurrentLocale(),s=m.useMemo(()=>i.localeText?.toolbarTitle==null?i.localeText:(0,ay.Z)({},i.localeText,{dateTimePickerToolbarTitle:i.localeText.toolbarTitle}),[i.localeText]);return(0,ay.Z)({},i,Te({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:Mo(n,i.minDateTime??i.minDate,r.minDate),maxDate:Mo(n,i.maxDateTime??i.maxDate,r.maxDate),minTime:i.minDateTime??i.minTime,maxTime:i.maxDateTime??i.maxTime,slots:(0,ay.Z)({toolbar:M7,tabs:MA},i.slots),slotProps:(0,ay.Z)({},i.slotProps,{toolbar:(0,ay.Z)({ampm:o},i.slotProps?.toolbar)})})}(e,"MuiStaticDateTimePicker"),r=n.displayStaticWrapperAs??"mobile",i=n.ampmInClock??"desktop"===r,o=(0,ay.Z)({day:D7,month:D7,year:D7,hours:AI,minutes:AI,seconds:AI},n.viewRenderers),{renderPicker:s}=Ez({props:(0,ay.Z)({},n,{viewRenderers:o,displayStaticWrapperAs:r,ampmInClock:i,yearsPerRow:n.yearsPerRow??("mobile"===r?3:4),slotProps:(0,ay.Z)({},n.slotProps,{tabs:(0,ay.Z)({hidden:"desktop"===r},n.slotProps?.tabs),toolbar:(0,ay.Z)({hidden:"desktop"===r,ampmInClock:i},n.slotProps?.toolbar)})}),valueManager:Ak,valueType:"date-time",validator:EH,ref:t});return s()});E$.propTypes={ampm:k6().bool,ampmInClock:k6().bool,autoFocus:k6().bool,className:k6().string,dayOfWeekFormatter:k6().func,defaultValue:k6().object,disabled:k6().bool,disableFuture:k6().bool,disableHighlightToday:k6().bool,disableIgnoringDatePartForTimeValidation:k6().bool,disablePast:k6().bool,displayStaticWrapperAs:k6().oneOf(["desktop","mobile"]),displayWeekNumber:k6().bool,fixedWeekNumber:k6().number,loading:k6().bool,localeText:k6().object,maxDate:k6().object,maxDateTime:k6().object,maxTime:k6().object,minDate:k6().object,minDateTime:k6().object,minTime:k6().object,minutesStep:k6().number,monthsPerRow:k6().oneOf([3,4]),onAccept:k6().func,onChange:k6().func,onClose:k6().func,onError:k6().func,onMonthChange:k6().func,onViewChange:k6().func,onYearChange:k6().func,openTo:k6().oneOf(["day","hours","minutes","month","seconds","year"]),orientation:k6().oneOf(["landscape","portrait"]),readOnly:k6().bool,reduceAnimations:k6().bool,referenceDate:k6().object,renderLoading:k6().func,shouldDisableDate:k6().func,shouldDisableMonth:k6().func,shouldDisableTime:k6().func,shouldDisableYear:k6().func,showDaysOutsideCurrentMonth:k6().bool,slotProps:k6().object,slots:k6().object,sx:k6().oneOfType([k6().arrayOf(k6().oneOfType([k6().func,k6().object,k6().bool])),k6().func,k6().object]),timezone:k6().string,value:k6().object,view:k6().oneOf(["day","hours","minutes","month","seconds","year"]),viewRenderers:k6().shape({day:k6().func,hours:k6().func,minutes:k6().func,month:k6().func,seconds:k6().func,year:k6().func}),views:k6().arrayOf(k6().oneOf(["day","hours","minutes","month","seconds","year"]).isRequired),yearsOrder:k6().oneOf(["asc","desc"]),yearsPerRow:k6().oneOf([3,4])};let EW=({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},Eq=({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},EG=(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}},EU=({utils:e,date:t,shouldRespectLeadingZeros:n,localeText:r,localizedDigits:i,now:o,token:s,startSeparator:a})=>{if(""===s)throw Error("MUI X: Should not call `commitToken` with an empty token");let l=T8(e,s),u=Ah(e,l.contentType,l.type,s),c=n?u:"digit"===l.contentType,h=null!=t&&e.isValid(t),d=h?e.formatByString(t,s):"",f=null;if(c){if(u)f=""===d?e.formatByString(o,s).length:d.length;else{if(null==l.maxLength)throw Error(`MUI X: The token ${s} should have a 'maxDigitNumber' property on it's adapter`);f=l.maxLength,h&&(d=Ar(Ao(An(d,i),f),i))}}return(0,ay.Z)({},l,{format:s,maxLength:f,value:d,placeholder:EG(e,r,l,s),hasLeadingZerosInFormat:u,hasLeadingZerosInInput:c,startSeparator:a,endSeparator:"",modified:!1})},EK=e=>{let{utils:t,expandedFormat:n,escapedParts:r}=e,i=t.date(void 0),o=[],s="",a=Object.keys(t.formatTokenMap).sort((e,t)=>t.length-e.length),l=/^([a-zA-Z]+)/,u=RegExp(`^(${a.join("|")})*$`),c=RegExp(`^(${a.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,a=l.exec(n.slice(d))?.[1];if(!r&&null!=a&&u.test(a)){let t=a;for(;t.length>0;){let n=c.exec(t)[1];t=t.slice(n.length),o.push(EU((0,ay.Z)({},e,{now:i,token:n,startSeparator:s}))),s=""}d+=a.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},EY=({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}),EX=e=>{let t=EW(e);e.isRtl&&e.enableAccessibleFieldDOMStructure&&(t=t.split(" ").reverse().join(" "));let n=Eq((0,ay.Z)({},e,{expandedFormat:t})),r=EK((0,ay.Z)({},e,{expandedFormat:t,escapedParts:n}));return EY((0,ay.Z)({},e,{sections:r}))},EQ=e=>{let t=Me(),n=Mw(),r=k7(),i=(0,sQ.V)(),{valueManager:o,fieldValueManager:s,valueType:a,validator:l,internalProps:u,internalProps:{value:c,defaultValue:h,referenceDate:d,onChange:f,format:p,formatDensity:g="dense",selectedSections:v,onSelectedSectionsChange:y,shouldRespectLeadingZeros:b=!1,timezone:x,enableAccessibleFieldDOMStructure:w=!1}}=e,{timezone:S,value:C,handleValueChange:k}=T0({timezone:x,value:c,defaultValue:h,referenceDate:d,onChange:f,valueManager:o}),M=m.useMemo(()=>At(t),[t]),T=m.useMemo(()=>Af(t,M,S),[t,M,S]),A=m.useCallback((e,r=null)=>s.getSectionsFromValue(t,e,r,e=>EX({utils:t,localeText:n,localizedDigits:M,format:p,date:e,formatDensity:g,shouldRespectLeadingZeros:b,enableAccessibleFieldDOMStructure:w,isRtl:i})),[s,p,n,M,i,b,t,g,w]),[D,E]=m.useState(()=>{let e=A(C);Ap(e,a);let n={sections:e,value:C,referenceValue:o.emptyValue,tempValueStrAndroid:null},r=T5(e),i=o.getInitialReferenceValue({referenceDate:d,value:C,utils:t,props:u,granularity:r,timezone:S});return(0,ay.Z)({},n,{referenceValue:i})}),[O,R]=(0,Tf.Z)({controlled:v,default:null,name:"useField",state:"selectedSections"}),P=e=>{R(e),y?.(e)},I=m.useMemo(()=>Ax(O,D.sections),[O,D.sections]),N="all"===I?0:I,j=({value:e,referenceValue:n,sections:i})=>{if(E(t=>(0,ay.Z)({},t,{sections:i,value:e,referenceValue:n,tempValueStrAndroid:null})),o.areValuesEqual(t,D.value,e))return;let s={validationError:l({adapter:r,value:e,timezone:S,props:u})};k(e,s)},L=(e,t)=>{let n=[...D.sections];return n[e]=(0,ay.Z)({},n[e],{value:t,modified:!0}),n};return m.useEffect(()=>{let e=A(D.value);Ap(e,a),E(t=>(0,ay.Z)({},t,{sections:e}))},[p,t.locale,i]),m.useEffect(()=>{let e;o.areValuesEqual(t,D.value,C)&&o.getTimezone(t,D.value)===o.getTimezone(t,C)||E(e=>(0,ay.Z)({},e,{value:C,referenceValue:s.updateReferenceValue(t,C,e.referenceValue),sections:A(C)}))},[C]),{state:D,activeSectionIndex:N,parsedSelectedSections:I,setSelectedSections:P,clearValue:()=>{j({value:o.emptyValue,referenceValue:D.referenceValue,sections:A(o.emptyValue)})},clearActiveSection:()=>{if(null==N)return;let e=D.sections[N],n=s.getActiveDateManager(t,D,e),r=n.getSections(D.sections).filter(e=>""!==e.value).length===+(""!==e.value),i=L(N,""),o=r?null:t.getInvalidDate(),a=n.getNewValuesFromNewActiveDate(o);j((0,ay.Z)({},a,{sections:i}))},updateSectionValue:({activeSection:e,newSectionValue:n,shouldGoToNextSection:r})=>{let i,o;r&&N<D.sections.length-1&&P(N+1);let a=s.getActiveDateManager(t,D,e),l=L(N,n),u=a.getSections(l),c=Ad(t,u,M);if(null!=c&&t.isValid(c)){let e=Av(t,c,u,a.referenceDate,!0);i=a.getNewValuesFromNewActiveDate(e),o=!0}else i=a.getNewValuesFromNewActiveDate(c),o=(null!=c&&!t.isValid(c))!=(null!=a.date&&!t.isValid(a.date));return o?j((0,ay.Z)({},i,{sections:l})):E(e=>(0,ay.Z)({},e,i,{sections:l,tempValueStrAndroid:null}))},updateValueFromValueStr:e=>{let r=s.parseValueStr(e,D.referenceValue,(e,r)=>{let o=t.parse(e,p);if(null==o||!t.isValid(o))return null;let s=EX({utils:t,localeText:n,localizedDigits:M,format:p,date:o,formatDensity:g,shouldRespectLeadingZeros:b,enableAccessibleFieldDOMStructure:w,isRtl:i});return Av(t,o,s,r,!1)}),o=s.updateReferenceValue(t,r,D.referenceValue);j({value:r,referenceValue:o,sections:A(r,D.sections)})},setTempAndroidValueStr:e=>E(t=>(0,ay.Z)({},t,{tempValueStrAndroid:e})),getSectionsFromValue:A,sectionsValueBoundaries:T,localizedDigits:M,timezone:S}},EJ=e=>null!=e.saveQuery,E0=({sections:e,updateSectionValue:t,sectionsValueBoundaries:n,localizedDigits:r,setTempAndroidValueStr:i,timezone:o})=>{let s=Me(),[a,l]=m.useState(null),u=(0,Td.Z)(()=>l(null));m.useEffect(()=>{null!=a&&e[a.sectionIndex]?.type!==a.sectionType&&u()},[e,a,u]),m.useEffect(()=>{if(null!=a){let e=setTimeout(()=>u(),5e3);return()=>{clearTimeout(e)}}return()=>{}},[a,u]);let c=({keyPressed:t,sectionIndex:n},r,i)=>{let o=t.toLowerCase(),s=e[n];if(null!=a&&(!i||i(a.value))&&a.sectionIndex===n){let e=`${a.value}${o}`,t=r(e,s);if(!EJ(t))return l({sectionIndex:n,value:e,sectionType:s.type}),t}let c=r(o,s);return EJ(c)&&!c.saveQuery?(u(),null):(l({sectionIndex:n,value:o,sectionType:s.type}),EJ(c))?null:c},h=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 a=e=>T7(s,o,n.type,e);if("letter"===n.contentType)return t(n.format,a(n.format),e);if(r&&null!=i&&"letter"===T8(s,r).contentType){let n=a(r),o=t(r,n,e);return EJ(o)?{saveQuery:!1}:(0,ay.Z)({},o,{sectionValue:i(o.sectionValue,n)})}return{saveQuery:!1}};return c(e,(e,t)=>{switch(t.type){case"month":return n(e,t,s.formats.month,e=>Au(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}}})},d=e=>{let t=(e,t)=>{let i=An(e,r),o=Number(i),a=n[t.type]({currentDate:null,format:t.format,contentType:t.contentType});if(o>a.maximum)return{saveQuery:!1};if(o<a.minimum)return{saveQuery:!0};let l=10*o>a.maximum||i.length===a.maximum.toString().length;return{sectionValue:As(s,o,a,r,t),shouldGoToNextSection:l}};return c(e,(e,n)=>{if("digit"===n.contentType||"digit-with-letter"===n.contentType)return t(e,n);if("month"===n.type){let r=Ah(s,"digit","month","MM"),i=t(e,{type:n.type,format:"MM",hasLeadingZerosInFormat:r,hasLeadingZerosInInput:!0,contentType:"digit",maxLength:2});if(EJ(i))return i;let o=Au(s,i.sectionValue,"MM",n.format);return(0,ay.Z)({},i,{sectionValue:o})}if("weekDay"===n.type){let r=t(e,n);if(EJ(r))return r;let i=T9(s,n.format)[Number(r.sectionValue)-1];return(0,ay.Z)({},r,{sectionValue:i})}return{saveQuery:!1}},e=>Ai(e,r))};return{applyCharacterEditing:(0,Td.Z)(n=>{let o=e[n.sectionIndex],s=Ai(n.keyPressed,r)?d((0,ay.Z)({},n,{keyPressed:Ar(n.keyPressed,r)})):h(n);if(null==s){i(null);return}t({activeSection:o,newSectionValue:s.sectionValue,shouldGoToNextSection:s.shouldGoToNextSection})}),resetCharacterQuery:u}},E1=e=>{let{internalProps:{disabled:t,readOnly:n=!1},forwardedProps:{sectionListRef:r,onBlur:i,onClick:o,onFocus:s,onInput:a,onPaste:l,focused:u,autoFocus:c=!1},fieldValueManager:h,applyCharacterEditing:d,resetCharacterQuery:f,setSelectedSections:p,parsedSelectedSections:g,state:v,clearActiveSection:y,clearValue:b,updateSectionValue:x,updateValueFromValueStr:w,sectionOrder:S,areAllSectionsEmpty:C,sectionsValueBoundaries:k}=e,M=m.useRef(null),T=(0,A$.Z)(r,M),A=Mw(),D=Me(),E=(0,Tt.Z)(),[O,R]=m.useState(!1),P=m.useMemo(()=>({syncSelectionToDOM:()=>{let e;if(!M.current)return;let t=document.getSelection();if(!t)return;if(null==g){t.rangeCount>0&&M.current.getRoot().contains(t.getRangeAt(0).startContainer)&&t.removeAllRanges(),O&&M.current.getRoot().blur();return}if(!M.current.getRoot().contains(El(document)))return;let n=new window.Range;e="all"===g?M.current.getRoot():"empty"===v.sections[g].type?M.current.getSectionContainer(g):M.current.getSectionContent(g),n.selectNodeContents(e),e.focus(),t.removeAllRanges(),t.addRange(n)},getActiveSectionIndexFromDOM:()=>{let e=El(document);return e&&M.current&&M.current.getRoot().contains(e)?M.current.getSectionIndexFromDOMElement(e):null},focusField:(e=0)=>{if(!M.current||null!=P.getActiveSectionIndexFromDOM())return;let t=Ax(e,v.sections);R(!0),M.current.getSectionContent(t).focus()},setSelectedSections:e=>{if(!M.current)return;let t=Ax(e,v.sections);R(null!==("all"===t?0:t)),p(e)},isFieldFocused:()=>{let e=El(document);return!!M.current&&M.current.getRoot().contains(e)}}),[g,p,v.sections,O]),I=(0,Td.Z)(e=>{if(!M.current)return;let t=v.sections[e];M.current.getSectionContent(e).innerHTML=t.value||t.placeholder,P.syncSelectionToDOM()}),N=(0,Td.Z)((e,...t)=>{!e.isDefaultPrevented()&&M.current&&(R(!0),o?.(e,...t),"all"===g?setTimeout(()=>{let e=document.getSelection().getRangeAt(0).startOffset;if(0===e){p(S.startIndex);return}let t=0,n=0;for(;n<e&&t<v.sections.length;){let e=v.sections[t];t+=1,n+=`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`.length}p(t-1)}):O?M.current.getRoot().contains(e.target)||p(S.startIndex):(R(!0),p(S.startIndex)))}),j=(0,Td.Z)(e=>{if(a?.(e),!M.current||"all"!==g)return;let t=e.target.textContent??"";M.current.getRoot().innerHTML=v.sections.map(e=>`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`).join(""),P.syncSelectionToDOM(),0===t.length||10===t.charCodeAt(0)?(f(),b(),p("all")):t.length>1?w(t):("all"===g&&p(0),d({keyPressed:t,sectionIndex:0}))}),L=(0,Td.Z)(e=>{if(l?.(e),n||"all"!==g){e.preventDefault();return}let t=e.clipboardData.getData("text");e.preventDefault(),f(),w(t)}),F=(0,Td.Z)((...e)=>{s?.(...e),!O&&M.current&&(R(!0),null==M.current.getSectionIndexFromDOMElement(El(document))&&p(S.startIndex))}),Z=(0,Td.Z)((...e)=>{i?.(...e),setTimeout(()=>{if(!M.current)return;let e=El(document);M.current.getRoot().contains(e)||(R(!1),p(null))})}),B=(0,Td.Z)(e=>t=>{!t.isDefaultPrevented()&&p(e)}),V=(0,Td.Z)(e=>{e.preventDefault()}),z=(0,Td.Z)(e=>()=>{p(e)}),_=(0,Td.Z)(e=>{if(e.preventDefault(),n||t||"number"!=typeof g)return;let r=v.sections[g],i=e.clipboardData.getData("text"),o=/^[a-zA-Z]+$/.test(i),s=/^[0-9]+$/.test(i),a=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(i);"letter"===r.contentType&&o||"digit"===r.contentType&&s||"digit-with-letter"===r.contentType&&a?(f(),x({activeSection:r,newSectionValue:i,shouldGoToNextSection:!0})):o||s||(f(),w(i))}),H=(0,Td.Z)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="none"}),$=(0,Td.Z)(e=>{if(!M.current)return;let t=e.target,r=t.textContent??"",i=M.current.getSectionIndexFromDOMElement(t),o=v.sections[i];if(n||!M.current){I(i);return}if(0===r.length){if(""===o.value){I(i);return}let t=e.nativeEvent.inputType;if("insertParagraph"===t||"insertLineBreak"===t){I(i);return}f(),y();return}d({keyPressed:r,sectionIndex:i}),I(i)});(0,Tv.Z)(()=>{if(O&&M.current){if("all"===g)M.current.getRoot().focus();else if("number"==typeof g){let e=M.current.getSectionContent(g);e&&e.focus()}}},[g,O]);let W=m.useMemo(()=>v.sections.reduce((e,t)=>(e[t.type]=k[t.type]({currentDate:null,contentType:t.contentType,format:t.format}),e),{}),[k,v.sections]),q="all"===g,G=m.useMemo(()=>v.sections.map((e,r)=>{let i=!q&&!t&&!n;return{container:{"data-sectionindex":r,onClick:B(r)},content:{tabIndex:q||r>0?-1:0,contentEditable:!q&&!t&&!n,role:"spinbutton",id:`${E}-${e.type}`,"aria-labelledby":`${E}-${e.type}`,"aria-readonly":n,"aria-valuenow":AS(e,D),"aria-valuemin":W[e.type].minimum,"aria-valuemax":W[e.type].maximum,"aria-valuetext":e.value?Aw(e,D):A.empty,"aria-label":A[e.type],"aria-disabled":t,spellCheck:!i&&void 0,autoCapitalize:i?"off":void 0,autoCorrect:i?"off":void 0,[parseInt(m.version,10)>=17?"enterKeyHint":"enterkeyhint"]:i?"next":void 0,children:e.value||e.placeholder,onInput:$,onPaste:_,onFocus:z(r),onDragOver:H,onMouseUp:V,inputMode:"letter"===e.contentType?"text":"numeric"},before:{children:e.startSeparator},after:{children:e.endSeparator}}}),[v.sections,z,_,H,$,B,V,t,n,q,A,D,W,E]),U=(0,Td.Z)(e=>{w(e.target.value)}),K=m.useMemo(()=>C?"":h.getV7HiddenInputValueFromSections(v.sections),[C,v.sections,h]);return m.useEffect(()=>{if(null==M.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");c&&M.current&&M.current.getSectionContent(S.startIndex).focus()},[]),{interactions:P,returnedValue:{autoFocus:c,readOnly:n,focused:u??O,sectionListRef:T,onBlur:Z,onClick:N,onFocus:F,onInput:j,onPaste:L,enableAccessibleFieldDOMStructure:!0,elements:G,tabIndex:0===g?-1:0,contentEditable:q,value:K,onChange:U,areAllSectionsEmpty:C}}},E2=e=>e.replace(/[\u2066\u2067\u2068\u2069]/g,""),E5=(e,t,n)=>{let r=0,i=+!!n,o=[];for(let s=0;s<e.length;s+=1){let a=e[s],l=Al(a,n?"input-rtl":"input-ltr",t),u=`${a.startSeparator}${l}${a.endSeparator}`,c=E2(u).length,h=u.length,d=E2(l),f=i+(""===d?0:l.indexOf(d[0]))+a.startSeparator.length,p=f+d.length;o.push((0,ay.Z)({},a,{start:r,end:r+c,startInInput:f,endInInput:p})),r+=c,i+=h}return o},E3=e=>{let t=(0,sQ.V)(),n=m.useRef(void 0),r=m.useRef(void 0),{forwardedProps:{onFocus:i,onClick:o,onPaste:s,onBlur:a,inputRef:l,placeholder:u},internalProps:{readOnly:c=!1,disabled:h=!1},parsedSelectedSections:d,activeSectionIndex:f,state:p,fieldValueManager:g,valueManager:v,applyCharacterEditing:y,resetCharacterQuery:b,updateSectionValue:x,updateValueFromValueStr:w,clearActiveSection:S,clearValue:C,setTempAndroidValueStr:k,setSelectedSections:M,getSectionsFromValue:T,areAllSectionsEmpty:A,localizedDigits:D}=e,E=m.useRef(null),O=(0,A$.Z)(l,E),R=m.useMemo(()=>E5(p.sections,D,t),[p.sections,D,t]),P=m.useMemo(()=>({syncSelectionToDOM:()=>{if(!E.current)return;if(null==d){E.current.scrollLeft&&(E.current.scrollLeft=0);return}if(E.current!==El(document))return;let e=E.current.scrollTop;if("all"===d)E.current.select();else{let e=R[d],t="empty"===e.type?e.startInInput-e.startSeparator.length:e.startInInput,n="empty"===e.type?e.endInInput+e.endSeparator.length:e.endInInput;(t!==E.current.selectionStart||n!==E.current.selectionEnd)&&E.current===El(document)&&E.current.setSelectionRange(t,n),clearTimeout(r.current),r.current=setTimeout(()=>{E.current&&E.current===El(document)&&E.current.selectionStart===E.current.selectionEnd&&(E.current.selectionStart!==t||E.current.selectionEnd!==n)&&P.syncSelectionToDOM()})}E.current.scrollTop=e},getActiveSectionIndexFromDOM:()=>{let e=E.current.selectionStart??0,t=E.current.selectionEnd??0;if(0===e&&0===t)return null;let n=e<=R[0].startInInput?1:R.findIndex(t=>t.startInInput-t.startSeparator.length>e);return -1===n?R.length-1:n-1},focusField:(e=0)=>{El(document)!==E.current&&(E.current?.focus(),M(e))},setSelectedSections:e=>M(e),isFieldFocused:()=>E.current===El(document)}),[E,d,R,M]),I=()=>{let e;let t=E.current.selectionStart??0;M(-1===(e=t<=R[0].startInInput?1:t>=R[R.length-1].endInInput?1:R.findIndex(e=>e.startInInput-e.startSeparator.length>t))?R.length-1:e-1)},N=(0,Td.Z)((...e)=>{i?.(...e);let t=E.current;clearTimeout(n.current),n.current=setTimeout(()=>{t&&t===E.current&&null==f&&(t.value.length&&Number(t.selectionEnd)-Number(t.selectionStart)===t.value.length?M("all"):I())})}),j=(0,Td.Z)((e,...t)=>{!e.isDefaultPrevented()&&(o?.(e,...t),I())}),L=(0,Td.Z)(e=>{if(s?.(e),e.preventDefault(),c||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(),x({activeSection:e,newSectionValue:t,shouldGoToNextSection:!0});return}if(n||r)return}b(),w(t)}),F=(0,Td.Z)((...e)=>{a?.(...e),M(null)}),Z=(0,Td.Z)(e=>{let n;if(c)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,a=E2(s);if("all"===d&&M(f),null==f||o){w(o?i:a);return}if("all"===d&&1===a.length)n=a;else{let e=E2(g.getV6InputValueFromSections(R,D,t)),r=-1,i=-1;for(let t=0;t<e.length;t+=1)-1===r&&e[t]!==a[t]&&(r=t),-1===i&&e[e.length-t-1]!==a[a.length-t-1]&&(i=t);let o=R[f];if(r<o.start||e.length-i-1>o.end)return;let s=a.length-e.length+o.end-E2(o.endSeparator||"").length;n=a.slice(o.start+E2(o.startSeparator||"").length,s)}if(0===n.length){Ay()&&k(s),b(),S();return}y({keyPressed:n,sectionIndex:f})}),B=m.useMemo(()=>void 0!==u?u:g.getV6InputValueFromSections(T(v.emptyValue),D,t),[u,g,T,v.emptyValue,D,t]),V=m.useMemo(()=>p.tempValueStrAndroid??g.getV6InputValueFromSections(p.sections,D,t),[p.sections,g,p.tempValueStrAndroid,D,t]);m.useEffect(()=>(E.current&&E.current===El(document)&&M("all"),()=>{clearTimeout(n.current),clearTimeout(r.current)}),[]);let z=m.useMemo(()=>null==f||"letter"===p.sections[f].contentType?"text":"numeric",[f,p.sections]);return{interactions:P,returnedValue:{readOnly:c,onBlur:F,onClick:j,onFocus:N,onPaste:L,inputRef:O,enableAccessibleFieldDOMStructure:!1,placeholder:B,inputMode:z,autoComplete:"off",value:!(E.current&&E.current===El(document))&&A?"":V,onChange:Z}}},E4=e=>{let t=Me(),{internalProps:n,internalProps:{unstableFieldRef:r,minutesStep:i,enableAccessibleFieldDOMStructure:o=!1,disabled:s=!1,readOnly:a=!1},forwardedProps:{onKeyDown:l,error:u,clearable:c,onClear:h},fieldValueManager:d,valueManager:f,validator:p}=e,g=(0,sQ.V)(),v=EQ(e),{state:y,activeSectionIndex:b,parsedSelectedSections:x,setSelectedSections:w,clearValue:S,clearActiveSection:C,updateSectionValue:k,setTempAndroidValueStr:M,sectionsValueBoundaries:T,localizedDigits:A,timezone:D}=v,E=E0({sections:y.sections,updateSectionValue:k,sectionsValueBoundaries:T,localizedDigits:A,setTempAndroidValueStr:M,timezone:D}),{resetCharacterQuery:O}=E,R=f.areValuesEqual(t,y.value,f.emptyValue),P=o?E1:E3,I=m.useMemo(()=>Ab(y.sections,g&&!o),[y.sections,g,o]),{returnedValue:N,interactions:j}=P((0,ay.Z)({},e,v,E,{areAllSectionsEmpty:R,sectionOrder:I})),L=(0,Td.Z)(e=>{if(l?.(e),!s)switch(!0){case(e.ctrlKey||e.metaKey)&&"A"===String.fromCharCode(e.keyCode)&&!e.shiftKey&&!e.altKey:e.preventDefault(),w("all");break;case"ArrowRight"===e.key:if(e.preventDefault(),null==x)w(I.startIndex);else if("all"===x)w(I.endIndex);else{let e=I.neighbors[x].rightIndex;null!==e&&w(e)}break;case"ArrowLeft"===e.key:if(e.preventDefault(),null==x)w(I.endIndex);else if("all"===x)w(I.startIndex);else{let e=I.neighbors[x].leftIndex;null!==e&&w(e)}break;case"Delete"===e.key:if(e.preventDefault(),a)break;null==x||"all"===x?S():C(),O();break;case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key):{if(e.preventDefault(),a||null==b)break;"all"===x&&w(b);let n=y.sections[b],r=d.getActiveDateManager(t,y,n),o=Aa(t,D,n,e.key,T,A,r.date,{minutesStep:i});k({activeSection:n,newSectionValue:o,shouldGoToNextSection:!1})}}});(0,Tv.Z)(()=>{j.syncSelectionToDOM()});let{hasValidationError:F}=Et({props:n,validator:p,timezone:D,value:y.value,onError:n.onError}),Z=m.useMemo(()=>void 0!==u?u:F,[F,u]);m.useEffect(()=>{Z||null!=b||O()},[y.referenceValue,b,Z]),m.useEffect(()=>{null!=y.tempValueStrAndroid&&null!=b&&(O(),C())},[y.sections]),m.useImperativeHandle(r,()=>({getSections:()=>y.sections,getActiveSectionIndex:j.getActiveSectionIndexFromDOM,setSelectedSections:j.setSelectedSections,focusField:j.focusField,isFieldFocused:j.isFieldFocused}));let B={onKeyDown:L,onClear:(0,Td.Z)((e,...t)=>{e.preventDefault(),h?.(e,...t),S(),j.isFieldFocused()?w(I.startIndex):j.focusField(0)}),error:Z,clearable:!!(c&&!R&&!a&&!s)};return(0,ay.Z)({},e.forwardedProps,B,{disabled:s,readOnly:a},N)},E8=["disablePast","disableFuture","minDate","maxDate","shouldDisableDate","shouldDisableMonth","shouldDisableYear"],E6=["disablePast","disableFuture","minTime","maxTime","shouldDisableTime","minutesStep","ampm","disableIgnoringDatePartForTimeValidation"],E9=["minDateTime","maxDateTime"];[...E8,...E6,...E9];let E7=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"],Oe=(e,t)=>m.useMemo(()=>{let n=(0,ay.Z)({},e),r={},i=e=>{n.hasOwnProperty(e)&&(r[e]=n[e],delete n[e])};return E7.forEach(i),"date"===t?E8.forEach(i):"time"===t?E6.forEach(i):"date-time"===t&&(E8.forEach(i),E6.forEach(i),E9.forEach(i)),{forwardedProps:n,internalProps:r}},[e,t]),Ot=e=>{let t=Me(),n=Mt(),r=e.ampm??t.is12HourCycleInCurrentLocale()?t.formats.keyboardDateTime12h:t.formats.keyboardDateTime24h;return(0,ay.Z)({},e,{disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,format:e.format??r,disableIgnoringDatePartForTimeValidation:!!(e.minDateTime||e.maxDateTime),minDate:Mo(t,e.minDateTime??e.minDate,n.minDate),maxDate:Mo(t,e.maxDateTime??e.maxDate,n.maxDate),minTime:e.minDateTime??e.minTime,maxTime:e.maxDateTime??e.maxTime})},On=e=>{let{forwardedProps:t,internalProps:n}=Oe(Ot(e),"date-time");return E4({forwardedProps:t,internalProps:n,valueManager:Ak,fieldValueManager:AM,validator:EH,valueType:"date-time"})};var Or=n(29992),Oi=n(36683);function Oo(e){return(0,A.ZP)("MuiInputAdornment",e)}let Os=(0,T.Z)("MuiInputAdornment",["root","filled","standard","outlined","positionStart","positionEnd","disablePointerEvents","hiddenLabel","sizeSmall"]),Oa=e=>{let{classes:t,disablePointerEvents:n,hiddenLabel:r,position:i,size:o,variant:s}=e,a={root:["root",n&&"disablePointerEvents",i&&`position${(0,w.Z)(i)}`,s,r&&"hiddenLabel",o&&`size${(0,w.Z)(o)}`]};return(0,y.Z)(a,Oo,t)},Ol=(0,S.ZP)("div",{name:"MuiInputAdornment",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${(0,w.Z)(n.position)}`],!0===n.disablePointerEvents&&t.disablePointerEvents,t[n.variant]]}})((0,C.Z)(({theme:e})=>({display:"flex",maxHeight:"2em",alignItems:"center",whiteSpace:"nowrap",color:(e.vars||e).palette.action.active,variants:[{props:{variant:"filled"},style:{[`&.${Os.positionStart}&:not(.${Os.hiddenLabel})`]:{marginTop:16}}},{props:{position:"start"},style:{marginRight:8}},{props:{position:"end"},style:{marginLeft:8}},{props:{disablePointerEvents:!0},style:{pointerEvents:"none"}}]}))),Ou=m.forwardRef(function(e,t){let n=(0,M.i)({props:e,name:"MuiInputAdornment"}),{children:r,className:i,component:o="div",disablePointerEvents:s=!1,disableTypography:l=!1,position:u,variant:c,...h}=n,d=(0,Oi.Z)()||{},f=c;c&&d.variant,d&&!f&&(f=d.variant);let g={...n,hiddenLabel:d.hiddenLabel,size:d.size,disablePointerEvents:s,position:u,variant:f},y=Oa(g);return(0,p.jsx)(Or.Z.Provider,{value:null,children:(0,p.jsx)(Ol,{as:o,ownerState:g,className:(0,v.Z)(y.root,i),ref:t,...h,children:"string"!=typeof r||l?(0,p.jsxs)(m.Fragment,{children:["start"===u?a||(a=(0,p.jsx)("span",{className:"notranslate","aria-hidden":!0,children:"​"})):null,r]}):(0,p.jsx)(i6.Z,{color:"textSecondary",children:r})})})}),Oc=["clearable","onClear","InputProps","sx","slots","slotProps"],Oh=["ownerState"],Od=e=>{let t=Mw(),{clearable:n,onClear:r,InputProps:i,sx:o,slots:s,slotProps:a}=e,l=(0,ab.Z)(e,Oc),u=s?.clearButton??ef.Z,c=(0,Tn.Z)({elementType:u,externalSlotProps:a?.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:t.fieldClearLabel}}),h=(0,ab.Z)(c,Oh),d=s?.clearIcon??Mx,f=(0,Tn.Z)({elementType:d,externalSlotProps:a?.clearIcon,ownerState:{}});return(0,ay.Z)({},l,{InputProps:(0,ay.Z)({},i,{endAdornment:(0,p.jsxs)(m.Fragment,{children:[n&&(0,p.jsx)(Ou,{position:"end",sx:{marginRight:i?.endAdornment?-1:-1.5},children:(0,p.jsx)(u,(0,ay.Z)({},h,{onClick:r,children:(0,p.jsx)(d,(0,ay.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]]})};var Of=n(68808),Op=n(32931);function Om(e){return(0,A.ZP)("MuiPickersTextField",e)}function Og(e){return(0,A.ZP)("MuiPickersInputBase",e)}(0,T.Z)("MuiPickersTextField",["root","focused","disabled","error","required"]);let Ov=(0,T.Z)("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function Oy(e){return(0,A.ZP)("MuiPickersOutlinedInput",e)}let Ob=(0,ay.Z)({},Ov,(0,T.Z)("MuiPickersOutlinedInput",["root","notchedOutline","input"])),Ox=["children","className","label","notched","shrink"],Ow=(0,S.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}}),OS=(0,S.ZP)("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),OC=(0,S.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 Ok(e){let{className:t,label:n}=e,r=(0,ab.Z)(e,Ox),i=null!=n&&""!==n,o=(0,ay.Z)({},e,{withLabel:i});return(0,p.jsx)(Ow,(0,ay.Z)({"aria-hidden":!0,className:t},r,{ownerState:o,children:(0,p.jsx)(OC,{ownerState:o,children:i?(0,p.jsx)(OS,{children:n}):(0,p.jsx)(OS,{className:"notranslate",children:"​"})})}))}var OM=n(3150);function OT(e){return(0,A.ZP)("MuiPickersSectionList",e)}let OA=(0,T.Z)("MuiPickersSectionList",["root","section","sectionContent"]),OD=["slots","slotProps","elements","sectionListRef"],OE=(0,S.ZP)("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(e,t)=>t.root})({direction:"ltr /*! @noflip */",outline:"none"}),OO=(0,S.ZP)("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(e,t)=>t.section})({}),OR=(0,S.ZP)("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(e,t)=>t.sectionSeparator})({whiteSpace:"pre"}),OP=(0,S.ZP)("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(e,t)=>t.sectionContent})({outline:"none"}),OI=e=>{let{classes:t}=e;return(0,y.Z)({root:["root"],section:["section"],sectionContent:["sectionContent"]},OT,t)};function ON(e){let{slots:t,slotProps:n,element:r,classes:i}=e,o=t?.section??OO,s=(0,Tn.Z)({elementType:o,externalSlotProps:n?.section,externalForwardedProps:r.container,className:i.section,ownerState:{}}),a=t?.sectionContent??OP,l=(0,Tn.Z)({elementType:a,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:i.sectionContent,ownerState:{}}),u=t?.sectionSeparator??OR,c=(0,Tn.Z)({elementType:u,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:{position:"before"}}),h=(0,Tn.Z)({elementType:u,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.after,ownerState:{position:"after"}});return(0,p.jsxs)(o,(0,ay.Z)({},s,{children:[(0,p.jsx)(u,(0,ay.Z)({},c)),(0,p.jsx)(a,(0,ay.Z)({},l)),(0,p.jsx)(u,(0,ay.Z)({},h))]}))}let Oj=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiPickersSectionList"}),{slots:r,slotProps:i,elements:o,sectionListRef:s}=n,a=(0,ab.Z)(n,OD),l=OI(n),u=m.useRef(null),c=(0,A$.Z)(t,u),h=e=>{if(!u.current)throw Error(`MUI X: Cannot call sectionListRef.${e} before the mount of the component.`);return u.current};m.useImperativeHandle(s,()=>({getRoot:()=>h("getRoot"),getSectionContainer:e=>h("getSectionContainer").querySelector(`.${OA.section}[data-sectionindex="${e}"]`),getSectionContent:e=>h("getSectionContent").querySelector(`.${OA.section}[data-sectionindex="${e}"] .${OA.sectionContent}`),getSectionIndexFromDOMElement(e){let t=h("getSectionIndexFromDOMElement");if(null==e||!t.contains(e))return null;let n=null;return(e.classList.contains(OA.section)?n=e:e.classList.contains(OA.sectionContent)&&(n=e.parentElement),null==n)?null:Number(n.dataset.sectionindex)}}));let d=r?.root??OE,f=(0,Tn.Z)({elementType:d,externalSlotProps:i?.root,externalForwardedProps:a,additionalProps:{ref:c,suppressContentEditableWarning:!0},className:l.root,ownerState:{}});return(0,p.jsx)(d,(0,ay.Z)({},f,{children:f.contentEditable?o.map(({content:e,before:t,after:n})=>`${t.children}${e.children}${n.children}`).join(""):(0,p.jsx)(m.Fragment,{children:o.map((e,t)=>(0,p.jsx)(ON,{slots:r,slotProps:i,element:e,classes:l},t))})}))}),OL=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef"],OF=e=>Math.round(1e5*e)/1e5,OZ=(0,S.ZP)("div",{name:"MuiPickersInputBase",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>(0,ay.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:`${OF(.15/16)}em`,variants:[{props:{fullWidth:!0},style:{width:"100%"}}]})),OB=(0,S.ZP)(OE,{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}}]})),OV=(0,S.ZP)(OO,{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"})),Oz=(0,S.ZP)(OP,{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"})),O_=(0,S.ZP)(OR,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(e,t)=>t.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),OH=(0,S.ZP)("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(e,t)=>t.hiddenInput})((0,ay.Z)({},{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"})),O$=e=>{let{focused:t,disabled:n,error:r,classes:i,fullWidth:o,readOnly:s,color:a,size:l,endAdornment:u,startAdornment:c}=e,h={root:["root",t&&!n&&"focused",n&&"disabled",s&&"readOnly",r&&"error",o&&"fullWidth",`color${(0,OM.Z)(a)}`,"small"===l&&"inputSizeSmall",!!c&&"adornedStart",!!u&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return(0,y.Z)(h,Og,i)},OW=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiPickersInputBase"}),{elements:r,areAllSectionsEmpty:i,value:o,onChange:s,id:a,endAdornment:l,startAdornment:u,renderSuffix:c,slots:h,slotProps:d,contentEditable:f,tabIndex:g,onInput:v,onPaste:y,onKeyDown:b,name:x,readOnly:w,inputProps:S,inputRef:C,sectionListRef:k}=n,M=(0,ab.Z)(n,OL),T=m.useRef(null),A=(0,A$.Z)(t,T),D=(0,A$.Z)(S?.ref,C),E=(0,sQ.V)(),O=(0,Oi.Z)();if(!O)throw Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");m.useEffect(()=>{O&&O.setAdornedStart(!!u)},[O,u]),m.useEffect(()=>{O&&(i?O.onEmpty():O.onFilled())},[O,i]);let R=(0,ay.Z)({},n,O,{isRtl:E}),P=O$(R),I=h?.root||OZ,N=(0,Tn.Z)({elementType:I,externalSlotProps:d?.root,externalForwardedProps:M,additionalProps:{"aria-invalid":O.error,ref:A},className:P.root,ownerState:R}),j=h?.input||OB;return(0,p.jsxs)(I,(0,ay.Z)({},N,{children:[u,(0,p.jsx)(Oj,{sectionListRef:k,elements:r,contentEditable:f,tabIndex:g,className:P.sectionsContainer,onFocus:e=>{if(O.disabled){e.stopPropagation();return}O.onFocus?.(e)},onBlur:O.onBlur,onInput:v,onPaste:y,onKeyDown:b,slots:{root:j,section:OV,sectionContent:Oz,sectionSeparator:O_},slotProps:{root:{ownerState:R},sectionContent:{className:Ov.sectionContent},sectionSeparator:({position:e})=>({className:"before"===e?Ov.sectionBefore:Ov.sectionAfter})}}),l,c?c((0,ay.Z)({},O)):null,(0,p.jsx)(OH,(0,ay.Z)({name:x,className:P.input,value:o,onChange:s,id:a,"aria-hidden":"true",tabIndex:-1,readOnly:w,required:O.required,disabled:O.disabled},S,{ref:D}))]}))}),Oq=["label","autoFocus","ownerState","notched"],OG=(0,S.ZP)(OZ,{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 .${Ob.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${Ob.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${Ob.focused} .${Ob.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${Ob.disabled}`]:{[`& .${Ob.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${Ob.error} .${Ob.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:{[`&.${Ob.focused}:not(.${Ob.error}) .${Ob.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}}))}}),OU=(0,S.ZP)(OB,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({padding:"16.5px 0",variants:[{props:{size:"small"},style:{padding:"8.5px 0"}}]}),OK=e=>{let{classes:t}=e,n=(0,y.Z)({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},Oy,t);return(0,ay.Z)({},t,n)},OY=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiPickersOutlinedInput"}),{label:r,ownerState:i,notched:o}=n,s=(0,ab.Z)(n,Oq),a=(0,Oi.Z)(),l=(0,ay.Z)({},n,i,a,{color:a?.color||"primary"}),u=OK(l);return(0,p.jsx)(OW,(0,ay.Z)({slots:{root:OG,input:OU},renderSuffix:e=>(0,p.jsx)(Ok,{shrink:!!(o||e.adornedStart||e.focused||e.filled),notched:!!(o||e.adornedStart||e.focused||e.filled),className:u.notchedOutline,label:null!=r&&""!==r&&a?.required?(0,p.jsxs)(m.Fragment,{children:[r," ","*"]}):r,ownerState:l})},s,{label:r,classes:u,ref:t}))});OY.muiName="Input";var OX=n(35315);function OQ(e){return(0,A.ZP)("MuiPickersFilledInput",e)}let OJ=(0,ay.Z)({},Ov,(0,T.Z)("MuiPickersFilledInput",["root","underline","input"])),O0=["label","autoFocus","disableUnderline","ownerState"],O1=(0,S.ZP)(OZ,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>(0,OX.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}},[`&.${OJ.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n},[`&.${OJ.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"},[`&.${OJ.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${OJ.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(.${OJ.disabled}, .${OJ.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${OJ.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:({startAdornment:e})=>!!e,style:{paddingLeft:12}},{props:({endAdornment:e})=>!!e,style:{paddingRight:12}}]}}),O2=(0,S.ZP)(OB,{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}}]}),O5=e=>{let{classes:t,disableUnderline:n}=e,r=(0,y.Z)({root:["root",!n&&"underline"],input:["input"]},OQ,t);return(0,ay.Z)({},t,r)},O3=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiPickersFilledInput"}),{label:r,disableUnderline:i=!1,ownerState:o}=n,s=(0,ab.Z)(n,O0),a=(0,Oi.Z)(),l=O5((0,ay.Z)({},n,o,a,{color:a?.color||"primary"}));return(0,p.jsx)(OW,(0,ay.Z)({slots:{root:O1,input:O2},slotProps:{root:{disableUnderline:i}}},s,{label:r,classes:l,ref:t}))});function O4(e){return(0,A.ZP)("MuiPickersFilledInput",e)}O3.muiName="Input";let O8=(0,ay.Z)({},Ov,(0,T.Z)("MuiPickersInput",["root","input"])),O6=["label","autoFocus","disableUnderline","ownerState"],O9=(0,S.ZP)(OZ,{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"},[`&.${O8.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${O8.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(.${O8.disabled}, .${O8.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${O8.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),O7=e=>{let{classes:t,disableUnderline:n}=e,r=(0,y.Z)({root:["root",!n&&"underline"],input:["input"]},O4,t);return(0,ay.Z)({},t,r)},Re=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiPickersInput"}),{label:r,disableUnderline:i=!1,ownerState:o}=n,s=(0,ab.Z)(n,O6),a=(0,Oi.Z)(),l=O7((0,ay.Z)({},n,o,a,{disableUnderline:i,color:a?.color||"primary"}));return(0,p.jsx)(OW,(0,ay.Z)({slots:{root:O9}},s,{label:r,classes:l,ref:t}))});Re.muiName="Input";let Rt=["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"],Rn={standard:Re,filled:O3,outlined:OY},Rr=(0,S.ZP)(oH.Z,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({}),Ri=e=>{let{focused:t,disabled:n,classes:r,required:i}=e;return(0,y.Z)({root:["root",t&&!n&&"focused",n&&"disabled",i&&"required"]},Om,r)},Ro=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiPickersTextField"}),{onFocus:r,onBlur:i,className:o,color:s="primary",disabled:a=!1,error:l=!1,variant:u="outlined",required:c=!1,InputProps:h,inputProps:d,inputRef:f,sectionListRef:g,elements:y,areAllSectionsEmpty:b,onClick:x,onKeyDown:w,onKeyUp:S,onPaste:C,onInput:k,endAdornment:M,startAdornment:T,tabIndex:A,contentEditable:D,focused:E,value:O,onChange:R,fullWidth:P,id:I,name:N,helperText:j,FormHelperTextProps:L,label:F,InputLabelProps:Z}=n,B=(0,ab.Z)(n,Rt),V=m.useRef(null),z=(0,A$.Z)(t,V),_=(0,Tt.Z)(I),H=j&&_?`${_}-helper-text`:void 0,$=F&&_?`${_}-label`:void 0,W=(0,ay.Z)({},n,{color:s,disabled:a,error:l,focused:E,required:c,variant:u}),q=Ri(W),G=Rn[u];return(0,p.jsxs)(Rr,(0,ay.Z)({className:(0,v.Z)(q.root,o),ref:z,focused:E,onFocus:r,onBlur:i,disabled:a,variant:u,error:l,color:s,fullWidth:P,required:c,ownerState:W},B,{children:[(0,p.jsx)(Of.Z,(0,ay.Z)({htmlFor:_,id:$},Z,{children:F})),(0,p.jsx)(G,(0,ay.Z)({elements:y,areAllSectionsEmpty:b,onClick:x,onKeyDown:w,onKeyUp:S,onInput:k,onPaste:C,endAdornment:M,startAdornment:T,tabIndex:A,contentEditable:D,value:O,onChange:R,id:_,fullWidth:P,inputProps:d,inputRef:f,sectionListRef:g,label:F,name:N,role:"group","aria-labelledby":$,"aria-describedby":H,"aria-live":H?"polite":void 0},h)),j&&(0,p.jsx)(Op.Z,(0,ay.Z)({id:H},L,{children:j}))]}))}),Rs=["enableAccessibleFieldDOMStructure"],Ra=["InputProps","readOnly"],Rl=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef"],Ru=e=>{let{enableAccessibleFieldDOMStructure:t}=e,n=(0,ab.Z)(e,Rs);if(t){let{InputProps:e,readOnly:t}=n,r=(0,ab.Z)(n,Ra);return(0,ay.Z)({},r,{InputProps:(0,ay.Z)({},e??{},{readOnly:t})})}let{onPaste:r,onKeyDown:i,inputMode:o,readOnly:s,InputProps:a,inputProps:l,inputRef:u}=n,c=(0,ab.Z)(n,Rl);return(0,ay.Z)({},c,{InputProps:(0,ay.Z)({},a??{},{readOnly:s}),inputProps:(0,ay.Z)({},l??{},{inputMode:o,onPaste:r,onKeyDown:i,ref:u})})},Rc=["slots","slotProps","InputProps","inputProps"],Rh=m.forwardRef(function(e,t){let n=k2({props:e,name:"MuiDateTimeField"}),{slots:r,slotProps:i,InputProps:o,inputProps:s}=n,a=(0,ab.Z)(n,Rc),l=r?.textField??(e.enableAccessibleFieldDOMStructure?Ro:ep.Z),u=(0,Tn.Z)({elementType:l,externalSlotProps:i?.textField,externalForwardedProps:a,ownerState:n,additionalProps:{ref:t}});u.inputProps=(0,ay.Z)({},s,u.inputProps),u.InputProps=(0,ay.Z)({},o,u.InputProps);let c=Ru(On(u)),h=Od((0,ay.Z)({},c,{slots:r,slotProps:i}));return(0,p.jsx)(l,(0,ay.Z)({},h))});var Rd=n(29435),Rf=n(32791),Rp=n(14336),Rm=n(22694),Rg=n(5154),Rv=n(39489),Ry=n(6341),Rb=n(13189),Rx=n(35918),Rw=n(89880),RS=n(58006),RC=n(16332),Rk=n(71721),RM=n(61721),RT=n(28904),RA=n(7785),RD=n(38364),RE=n(18340),RO=n(20506),RR=n(74265),RP=n(26635),RI=n(41275),RN=n(14107),Rj=n(50436),RL=n(97912),RF=n(59250),RZ=n(3303),RB=n(78374),RV=n(53743),Rz=n(18070),R_=n(83709),RH=n(63200),R$=n(36292),RW=n(11136),Rq=n(33518),RG=n(44138),RU=n(28140),RK=n(23033),RY=n(50007),RX=n(24575),RQ=n(5149),RJ=n(18874),R0=n(62511),R1=n(14257);let R2={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"},R5={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 R3{constructor(e){this.isMUIAdapter=!0,this.isTimezoneCompatible=!1,this.lib=void 0,this.locale=void 0,this.formats=void 0,this.formatTokenMap=R2,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,ay.Z)({},R5,n),this.longFormatters=r,this.lib=i||"date-fns"}}class R4 extends R3{constructor({locale:e,formats:t}={}){super({locale:e??R1._,formats:t,longFormatters:RS.G}),this.parse=(e,t)=>""===e?null:(0,Rz.Qc)(e,t,new Date,{locale:this.locale}),this.isValid=e=>null!=e&&(0,RV.J)(e),this.format=(e,t)=>this.formatByString(e,this.formats[t]),this.formatByString=(e,t)=>(0,RC.WU)(e,t,{locale:this.locale}),this.isEqual=(e,t)=>null===e&&null===t||null!==e&&null!==t&&(0,Rj.X)(e,t),this.isSameYear=(e,t)=>(0,RF.F)(e,t),this.isSameMonth=(e,t)=>(0,RZ.x)(e,t),this.isSameDay=(e,t)=>(0,RL.K)(e,t),this.isSameHour=(e,t)=>(0,RB.f)(e,t),this.isAfter=(e,t)=>(0,RI.A)(e,t),this.isAfterYear=(e,t)=>(0,RI.A)(e,(0,Rw.w)(t)),this.isAfterDay=(e,t)=>(0,RI.A)(e,(0,Rb.i)(t)),this.isBefore=(e,t)=>(0,RN.R)(e,t),this.isBeforeYear=(e,t)=>(0,RN.R)(e,this.startOfYear(t)),this.isBeforeDay=(e,t)=>(0,RN.R)(e,this.startOfDay(t)),this.isWithinRange=(e,[t,n])=>(0,R0._)(e,{start:t,end:n}),this.startOfYear=e=>(0,RJ.e)(e),this.startOfMonth=e=>(0,RY.N)(e),this.startOfWeek=e=>(0,RQ.z)(e,{locale:this.locale}),this.startOfDay=e=>(0,RK.b)(e),this.endOfYear=e=>(0,Rw.w)(e),this.endOfMonth=e=>(0,RX.V)(e),this.endOfWeek=e=>(0,Rx.v)(e,{locale:this.locale}),this.endOfDay=e=>(0,Rb.i)(e),this.addYears=(e,t)=>(0,Ry.B)(e,t),this.addMonths=(e,t)=>(0,Rv.z)(e,t),this.addWeeks=(e,t)=>(0,Rg.j)(e,t),this.addDays=(e,t)=>(0,Rd.E)(e,t),this.addHours=(e,t)=>(0,Rm.T)(e,t),this.addMinutes=(e,t)=>(0,Rp.m)(e,t),this.addSeconds=(e,t)=>(0,Rf.v)(e,t),this.getYear=e=>(0,RP.S)(e),this.getMonth=e=>(0,RD.j)(e),this.getDate=e=>(0,Rk._)(e),this.getHours=e=>(0,RT.p)(e),this.getMinutes=e=>(0,RA.q)(e),this.getSeconds=e=>(0,RE.C)(e),this.getMilliseconds=e=>(0,RO.p)(e),this.setYear=(e,t)=>(0,RU.M)(e,t),this.setMonth=(e,t)=>(0,RW.q)(e,t),this.setDate=(e,t)=>(0,R_.G)(e,t),this.setHours=(e,t)=>(0,RH.B)(e,t),this.setMinutes=(e,t)=>(0,R$.H)(e,t),this.setSeconds=(e,t)=>(0,Rq.O)(e,t),this.setMilliseconds=(e,t)=>(0,RG.I)(e,t),this.getDaysInMonth=e=>(0,RM.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,RR.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 R8="yyyy-MM-dd HH:mm:ss";function R6(e,t){return e?(0,kQ.s3)(e)?e.pastDuration:function(e,t,n){let r=bZ(e.start,t,n),i=bZ(e.end,t,n);return`${r} - ${i}`}(e,R8,t):"Custom Time Range"}let R9=({initialTimeRange:e,onChange:t,onCancel:n})=>{let{formatWithUserTimeZone:r}=b$(),[i,o]=(0,m.useState)(e),[s,a]=(0,m.useState)({start:r(e.start,R8),end:r(e.end,R8)}),[l,u]=(0,m.useState)(!0),c=(e,t)=>{let n="string"==typeof e,i=n?e:r(e,R8);a(e=>({...e,[t]:i})),n||o(n=>({...n,[t]:e}))},h=e=>{c(e,"start")},d=e=>{c(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,bL.isValid)(e)&&(0,bL.isValid)(t)?!!(0,bL.isBefore)(e,t)||(console.error("End Time is before Start Time"),!1):(console.error("Invalid Date"),!1))return o(n),n},g=()=>{let e=f();e&&t(e)};return(0,p.jsx)(k4,{dateAdapter:R4,children:(0,p.jsxs)(ed.Z,{spacing:2,sx:e=>({padding:e.spacing(1,0,2)}),children:[l&&(0,p.jsxs)(W.Z,{sx:e=>({".MuiPickersLayout-contentWrapper":{backgroundColor:e.palette.background.default}}),children:[(0,p.jsx)(i6.Z,{variant:"h3",padding:1,paddingLeft:2,children:"Select Start Time"}),(0,p.jsx)(E$,{displayStaticWrapperAs:"desktop",openTo:"day",disableHighlightToday:!0,value:e.start,onChange:e=>{null!==e&&h(e)},onAccept:()=>{u(!1)}})]}),!l&&(0,p.jsxs)(W.Z,{sx:e=>({".MuiPickersLayout-contentWrapper":{backgroundColor:e.palette.background.default}}),children:[(0,p.jsx)(i6.Z,{variant:"h3",padding:1,paddingLeft:2,children:"Select End Time"}),(0,p.jsx)(E$,{displayStaticWrapperAs:"desktop",openTo:"day",disableHighlightToday:!0,value:e.end,minDateTime:i.start,onChange:e=>{null!==e&&d(e)},onAccept:e=>{null!==e&&(u(!0),d(e))}})]}),(0,p.jsxs)(ed.Z,{direction:"row",alignItems:"center",gap:1,pl:1,pr:1,children:[(0,p.jsx)(ac.ErrorBoundary,{FallbackComponent:au,children:(0,p.jsx)(Rh,{label:"Start Time",value:new Date(s.start),onChange:e=>{e&&h(e)},onBlur:()=>f(),format:R8})}),(0,p.jsx)(ac.ErrorBoundary,{FallbackComponent:au,children:(0,p.jsx)(Rh,{label:"End Time",value:new Date(s.end),onChange:e=>{e&&d(e)},onBlur:()=>f(),format:R8})})]}),(0,p.jsxs)(ed.Z,{direction:"row",sx:{padding:e=>e.spacing(0,1)},gap:1,children:[(0,p.jsx)(j.Z,{variant:"contained",onClick:()=>g(),fullWidth:!0,children:"Apply"}),(0,p.jsx)(j.Z,{variant:"outlined",onClick:()=>n(),fullWidth:!0,children:"Cancel"})]})]})})};function R7({value:e,timeOptions:t,onChange:n,height:r,showCustomTimeRange:i=!0}){let{timeZone:o}=b$(),s=(0,m.useRef)(),[a,l]=(0,m.useState)(!1),u=(0,m.useMemo)(()=>(0,kQ.s3)(e)?(0,kQ.sG)(e):e,[e]),c=(0,m.useMemo)(()=>{var t;return{value:t=(0,kQ.s3)(e)?void 0:e,display:R6(t,o)}},[e,o]),[h,d]=(0,m.useState)(!1);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(eU.ZP,{anchorEl:s.current,anchorOrigin:{vertical:"bottom",horizontal:"center"},open:a,onClose:()=>l(!1),sx:e=>({padding:e.spacing(2)}),children:(0,p.jsx)(R9,{initialTimeRange:u,onChange:e=>{n(e),l(!1),d(!1)},onCancel:()=>l(!1)})}),(0,p.jsx)(W.Z,{ref:s,children:(0,p.jsxs)(kY.Z,{open:h,value:R6(e,o),onClick:()=>d(!h),IconComponent:kX.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,p.jsx)(sq.Z,{value:R6(e.value,o),onClick:()=>{n(e.value)},children:e.display},t)),i&&(0,p.jsx)(sq.Z,{value:R6(c.value,o),onClick:()=>l(!0),children:c.display})]})})]})}let Pe=(0,S.ZP)(j.Z)(({theme:e})=>({padding:e.spacing(.5),minWidth:"auto"})),Pt=(0,m.forwardRef)(function(e,t){return(0,p.jsx)(Pe,{ref:t,variant:"outlined",color:"secondary",...e})});var Pn=n(15418);let Pr=Object.entries(F.Bl).map(([e,t])=>({id:e,...t})).filter(e=>!e.disableSelectorOption),Pi=[{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 Po({value:e,onChange:t,disabled:n=!1}){var r;let i=(0,F.__)(e),o=(0,F.Fp)(e),s=({decimalPlaces:n})=>{i&&t({...e,decimalPlaces:n})},a=F.Bl[e.unit];return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(oQ,{label:"Short values",control:(0,p.jsx)(xl.Z,{checked:!!o&&(0,Pn.lk)(e.shortValues),onChange:(n,r)=>{o&&t({...e,shortValues:r})},disabled:!o})}),(0,p.jsx)(oQ,{label:"Unit",control:(0,p.jsx)(o1,{value:{id:e.unit,...a},options:Pr,groupBy:e=>e.group,onChange:(e,n)=>{t({unit:n.id})},disableClearable:!0,disabled:n})}),(0,p.jsx)(oQ,{label:"Decimals",control:(0,p.jsx)(o1,{value:(r=e.decimalPlaces,Pi.find(e=>e.decimalPlaces===r)),options:Pi,getOptionLabel:e=>e.label,onChange:(e,t)=>s(t),disabled:!i,disableClearable:!0})})]})}function Ps({name:e,height:t}){return(0,p.jsx)(W.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,p.jsx)(i6.Z,{variant:"body1","aria-label":"y axis label",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e})})}let Pa=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},Pl={data:""},Pu=e=>"object"==typeof window?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||Pl,Pc=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Ph=/\/\*[^]*?\*\/| +/g,Pd=/\n+/g,Pf=(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]?Pf(s,o):o+"{"+Pf(s,"k"==o[1]?"":t)+"}":"object"==typeof s?r+=Pf(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+=Pf.p?Pf.p(o,s):o+":"+s+";")}return n+(t&&i?t+"{"+i+"}":i)+r},Pp={},Pm=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+Pm(e[n]);return t}return e},Pg=(e,t,n,r,i)=>{var o;let s=Pm(e),a=Pp[s]||(Pp[s]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(s));if(!Pp[a]){let t=s!==e?e:(e=>{let t,n,r=[{}];for(;t=Pc.exec(e.replace(Ph,""));)t[4]?r.shift():t[3]?(n=t[3].replace(Pd," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(Pd," ").trim();return r[0]})(e);Pp[a]=Pf(i?{["@keyframes "+a]:t}:t,n?"":"."+a)}let l=n&&Pp.g?Pp.g:null;return n&&(Pp.g=Pp[a]),o=Pp[a],l?t.data=t.data.replace(l,o):-1===t.data.indexOf(o)&&(t.data=r?o+t.data:t.data+o),a},Pv=(e,t,n)=>e.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?"":Pf(e,""):!1===e?"":e}return e+r+(null==o?"":o)},"");function Py(e){let t=this||{},n=e.call?e(t.p):e;return Pg(n.unshift?n.raw?Pv(n,[].slice.call(arguments,1),t.p):n.reduce((e,n)=>Object.assign(e,n&&n.call?n(t.p):n),{}):n,Pu(t.target),t.g,t.o,t.k)}function Pb(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 Px(e,t,n){return t&&Pb(e.prototype,t),n&&Pb(e,n),e}function Pw(){return(Pw=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 PS(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function PC(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 Pk(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}Py.bind({g:1}),Py.bind({k:1});var PM=function(){return""},PT=g().createContext({enqueueSnackbar:PM,closeSnackbar:PM}),PA="@media (max-width:599.95px)",PD="@media (min-width:600px)",PE=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},PO=function(e){return""+PE(e.vertical)+PE(e.horizontal)},PR=function(e){return!!e||0===e},PP="unmounted",PI="exited",PN="entering",Pj="entered",PL="exiting",PF=function(e){function t(t){n=e.call(this,t)||this;var n,r,i=t.appear;return n.appearStatus=null,t.in?i?(r=PI,n.appearStatus=PN):r=Pj:r=t.unmountOnExit||t.mountOnEnter?PP:PI,n.state={status:r},n.nextCallback=null,n}PS(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===PP?{status:PI}: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!==PN&&n!==Pj&&(t=PN):(n===PN||n===Pj)&&(t=PL)}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===PN?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&this.state.status===PI&&this.setState({status:PP})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.getTimeouts();if(!e&&!n){this.safeSetState({status:Pj},function(){t.props.onEntered&&t.props.onEntered(t.node,e)});return}this.props.onEnter&&this.props.onEnter(this.node,e),this.safeSetState({status:PN},function(){t.props.onEntering&&t.props.onEntering(t.node,e),t.onTransitionEnd(r.enter,function(){t.safeSetState({status:Pj},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){this.safeSetState({status:PI},function(){e.props.onExited&&e.props.onExited(e.node)});return}this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:PL},function(){e.props.onExiting&&e.props.onExiting(e.node),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:PI},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){setTimeout(this.nextCallback,0);return}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===PP)return null;var t=this.props;return(0,t.children)(e,PC(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},Px(t,[{key:"node",get:function(){var e,t=null===(e=this.props.nodeRef)||void 0===e?void 0:e.current;if(!t)throw Error("notistack - Custom snackbar is not refForwarding");return t}}]),t}(g().Component);function PZ(){}function PB(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function PV(e,t){return(0,m.useMemo)(function(){return null==e&&null==t?null:function(n){PB(e,n),PB(t,n)}},[e,t])}function Pz(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}}PF.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:PZ,onEntering:PZ,onEntered:PZ,onExit:PZ,onExiting:PZ,onExited:PZ};var P_={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},PH=function(e){e.scrollTop=e.scrollTop},P$=function(e){return Math.round(e)+"ms"};function PW(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?P_.easeInOut:o,a=n.delay,l=void 0===a?0:a;return(Array.isArray(e)?e:[e]).map(function(e){return e+" "+("string"==typeof i?i:P$(i))+" "+s+" "+("string"==typeof l?l:P$(l))}).join(",")}function Pq(e){return(e&&e.ownerDocument||document).defaultView||window}function PG(e,t){if(t){var n=function(e,t){var n,r=t.getBoundingClientRect(),i=Pq(t);if(t.fakeTransform)n=t.fakeTransform;else{var o=i.getComputedStyle(t);n=o.getPropertyValue("-webkit-transform")||o.getPropertyValue("transform")}var s=0,a=0;if(n&&"none"!==n&&"string"==typeof n){var l=n.split("(")[1].split(")")[0].split(",");s=parseInt(l[4],10),a=parseInt(l[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+a-r.top)+"px)";default:return"translateY(-"+(r.top+r.height-a)+"px)"}}(e,t);n&&(t.style.webkitTransform=n,t.style.transform=n)}}var PU=(0,m.forwardRef)(function(e,t){var n=e.children,r=e.direction,i=void 0===r?"down":r,o=e.in,s=e.style,a=e.timeout,l=void 0===a?0:a,u=e.onEnter,c=e.onEntered,h=e.onExit,d=e.onExited,f=PC(e,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),p=(0,m.useRef)(null),g=PV(n.ref,p),v=PV(g,t),y=(0,m.useCallback)(function(){p.current&&PG(i,p.current)},[i]);return(0,m.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&&PG(i,p.current)}),t=Pq(p.current);return t.addEventListener("resize",e),function(){e.clear(),t.removeEventListener("resize",e)}}},[i,o]),(0,m.useEffect)(function(){o||y()},[o,y]),(0,m.createElement)(PF,Object.assign({appear:!0,nodeRef:p,onEnter:function(e,t){PG(i,e),PH(e),u&&u(e,t)},onEntered:c,onEntering:function(e){var t=(null==s?void 0:s.transitionTimingFunction)||P_.easeOut,n=Pz({timeout:l,mode:"enter",style:Pw({},s,{transitionTimingFunction:t})});e.style.webkitTransition=PW("-webkit-transform",n),e.style.transition=PW("transform",n),e.style.webkitTransform="none",e.style.transform="none"},onExit:function(e){var t=(null==s?void 0:s.transitionTimingFunction)||P_.sharp,n=Pz({timeout:l,mode:"exit",style:Pw({},s,{transitionTimingFunction:t})});e.style.webkitTransition=PW("-webkit-transform",n),e.style.transition=PW("transform",n),PG(i,e),h&&h(e)},onExited:function(e){e.style.webkitTransition="",e.style.transition="",d&&d(e)},in:o,timeout:l},f),function(e,t){return(0,m.cloneElement)(n,Pw({ref:v,style:Pw({visibility:"exited"!==e||o?void 0:"hidden"},s,{},n.props.style)},t))})});PU.displayName="Slide";var PK=function(e){return g().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))},PY={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:g().createElement(function(){return g().createElement(PK,null,g().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:g().createElement(function(){return g().createElement(PK,null,g().createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},null),error:g().createElement(function(){return g().createElement(PK,null,g().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:g().createElement(function(){return g().createElement(PK,null,g().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:PU,transitionDuration:{enter:225,exit:195}},PX=function(e,t){var n=function(e){return"number"==typeof e||null===e};return n(e)?e:n(t)?t:PY.autoHideDuration},PQ=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"])?Pw({},PY.transitionDuration,{},n(t,["object"])&&t,{},e):n(t,["string","number"])?t:n(t,["object"])?Pw({},PY.transitionDuration,{},t):PY.transitionDuration};function PJ(e){return Object.entries(e).reduce(function(e,t){var n,r=t[0],i=t[1];return Pw({},e,((n={})[r]=Py(i),n))},{})}var P0="notistack-CollapseWrapper",P1=PJ({root:{height:0},entered:{height:"auto"}}),P2=(0,m.forwardRef)(function(e,t){var n=e.children,r=e.in,i=e.onExited,o=(0,m.useRef)(null),s=(0,m.useRef)(null),a=PV(t,s),l=function(){return o.current?o.current.clientHeight:0};return(0,m.createElement)(PF,{in:r,unmountOnExit:!0,onEnter:function(e){e.style.height="0px"},onEntered:function(e){e.style.height="auto"},onEntering:function(e){var t=l(),n=Pz({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=l()+"px"},onExited:i,onExiting:function(e){PH(e);var t=Pz({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,m.createElement)("div",Object.assign({ref:a,className:Pa(P1.root,"entered"===e&&P1.entered),style:Pw({pointerEvents:"all",overflow:"hidden",minHeight:"0px",transition:PW("height")},"entered"===e&&{overflow:"visible"},{},"exited"===e&&!r&&{visibility:"hidden"})},t),(0,m.createElement)("div",{ref:o,className:P0,style:{display:"flex",width:"100%"}},n))})});P2.displayName="Collapse";var P5={right:"left",left:"right",bottom:"up",top:"down"},P3=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 Pw({},t,((r={})[n]=e[n],r))},{})},P4=function(){};function P8(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)}},P4)}var P6="undefined"!=typeof window?m.useLayoutEffect:m.useEffect;function P9(e){var t=(0,m.useRef)(e);return P6(function(){t.current=e}),(0,m.useCallback)(function(){return t.current.apply(void 0,arguments)},[])}var P7=(0,m.forwardRef)(function(e,t){var n=e.children,r=e.className,i=e.autoHideDuration,o=e.disableWindowBlurListener,s=void 0!==o&&o,a=e.onClose,l=e.id,u=e.open,c=e.SnackbarProps,h=void 0===c?{}:c,d=(0,m.useRef)(),f=P9(function(){a&&a.apply(void 0,arguments)}),p=P9(function(e){a&&null!=e&&(d.current&&clearTimeout(d.current),d.current=setTimeout(function(){f(null,"timeout",l)},e))});(0,m.useEffect)(function(){return u&&p(i),function(){d.current&&clearTimeout(d.current)}},[u,i,p]);var g=function(){d.current&&clearTimeout(d.current)},v=(0,m.useCallback)(function(){null!=i&&p(.5*i)},[i,p]);return(0,m.useEffect)(function(){if(!s&&u)return window.addEventListener("focus",v),window.addEventListener("blur",g),function(){window.removeEventListener("focus",v),window.removeEventListener("blur",g)}},[s,v,u]),(0,m.createElement)("div",Object.assign({ref:t},h,{className:Pa("notistack-Snackbar",r),onMouseEnter:function(e){h.onMouseEnter&&h.onMouseEnter(e),g()},onMouseLeave:function(e){h.onMouseLeave&&h.onMouseLeave(e),v()}}),n)});P7.displayName="Snackbar";var Ie=PJ({root:((l={display:"flex",flexWrap:"wrap",flexGrow:1})[PD]={flexGrow:"initial",minWidth:"288px"},l)}),It=(0,m.forwardRef)(function(e,t){var n=e.className,r=PC(e,["className"]);return g().createElement("div",Object.assign({ref:t,className:Pa(Ie.root,n)},r))});It.displayName="SnackbarContent";var In=PJ({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"}}),Ir="notistack-snackbar",Ii=(0,m.forwardRef)(function(e,t){var n=e.id,r=e.message,i=e.action,o=e.iconVariant,s=e.variant,a=e.hideIconVariant,l=e.style,u=e.className,c=o[s],h=i;return"function"==typeof h&&(h=h(n)),g().createElement(It,{ref:t,role:"alert","aria-describedby":Ir,style:l,className:Pa("notistack-MuiContent","notistack-MuiContent-"+s,In.root,In[s],u,!a&&c&&In.lessPadding)},g().createElement("div",{id:Ir,className:In.message},a?null:c,r),h&&g().createElement("div",{className:In.action},h))});Ii.displayName="MaterialDesignContent";var Io=(0,m.memo)(Ii),Is=PJ({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),Ia=function(e){var t,n=(0,m.useRef)(),r=(0,m.useState)(!0),i=r[0],o=r[1],s=P8([e.snack.onClose,e.onClose]),a=(0,m.useCallback)(function(){n.current=setTimeout(function(){o(function(e){return!e})},125)},[]);(0,m.useEffect)(function(){return function(){n.current&&clearTimeout(n.current)}},[]);var l=e.snack,u=e.classes,c=e.Component,h=(0,m.useMemo)(function(){return P3(u)},[u]),d=l.open,f=l.SnackbarProps,p=l.TransitionComponent,v=l.TransitionProps,y=l.transitionDuration,b=l.disableWindowBlurListener,x=l.content,w=PC(l,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),S=Pw({direction:"center"!==(t=w.anchorOrigin).horizontal?P5[t.horizontal]:P5[t.vertical],timeout:y},v),C=x;"function"==typeof C&&(C=C(w.id,w.message));var k=["onEnter","onEntered","onExit","onExited"].reduce(function(t,n){var r;return Pw({},t,((r={})[n]=P8([e.snack[n],e[n]],w.id),r))},{});return g().createElement(P2,{in:i,onExited:k.onExited},g().createElement(P7,{open:d,id:w.id,disableWindowBlurListener:b,autoHideDuration:w.autoHideDuration,className:Pa(Is.wrappedRoot,h.root,h["anchorOrigin"+PO(w.anchorOrigin)]),SnackbarProps:f,onClose:s},g().createElement(p,Object.assign({},S,{appear:!0,in:d,onExit:k.onExit,onExited:a,onEnter:k.onEnter,onEntered:P8([k.onEntered,function(){e.snack.requestClose&&s(null,"instructed",e.snack.id)}],w.id)}),C||g().createElement(void 0===c?Io:c,Object.assign({},w)))))},Il=20,Iu=6,Ic=2,Ih="."+P0,Id=PJ({root:((u={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:PW(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"})[Ih]={padding:Iu+"px 0px",transition:"padding 300ms ease 0ms"},u.maxWidth="calc(100% - "+2*Il+"px)",u[PA]={width:"100%",maxWidth:"calc(100% - 32px)"},u),rootDense:((c={})[Ih]={padding:Ic+"px 0px"},c),top:{top:Il-Iu+"px",flexDirection:"column"},bottom:{bottom:Il-Iu+"px",flexDirection:"column-reverse"},left:((h={left:Il+"px"})[PD]={alignItems:"flex-start"},h[PA]={left:"16px"},h),right:((d={right:Il+"px"})[PD]={alignItems:"flex-end"},d[PA]={right:"16px"},d),center:((f={left:"50%",transform:"translateX(-50%)"})[PD]={alignItems:"center"},f)}),If=(0,m.memo)(function(e){var t=e.classes,n=void 0===t?{}:t,r=e.anchorOrigin,i=e.dense,o=e.children,s=Pa("notistack-SnackbarContainer",Id[r.vertical],Id[r.horizontal],Id.root,n.containerRoot,n["containerAnchorOrigin"+PO(r)],i&&Id.rootDense);return g().createElement("div",{className:s},o)}),Ip=function(e){return!("string"==typeof e||(0,m.isValidElement)(e))},Im=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=Ip(e)?e:t,o=Ip(e)?e.message:e,s=i.key,a=i.preventDuplicate,l=PC(i,["key","preventDuplicate"]),u=PR(s),c=u?s:new Date().getTime()+Math.random(),h=(r=n.props,function(e,t){return(void 0===t&&(t=!1),t)?Pw({},PY[e],{},r[e],{},l[e]):"autoHideDuration"===e?PX(l.autoHideDuration,r.autoHideDuration):"transitionDuration"===e?PQ(l.transitionDuration,r.transitionDuration):l[e]||r[e]||PY[e]}),d=Pw({id:c},l,{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:Pa(n.props.className,l.className)});return d.persist&&(d.autoHideDuration=void 0),n.setState(function(e){if(void 0===a&&n.props.preventDuplicate||a){var t=function(e){return u?e.id===c:e.message===o},r=e.queue.findIndex(t)>-1,i=e.snacks.findIndex(t)>-1;if(r||i)return e}return n.handleDisplaySnack(Pw({},e,{queue:[].concat(e.queue,[d])}))}),c},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?Pw({},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?Pw({},e):(t=!0,e.entered)?(e.onClose&&e.onClose(null,"maxsnack",e.id),n.props.onClose&&n.props.onClose(null,"maxsnack",e.id),Pw({},e,{open:!1})):Pw({},e,{requestClose:!0})});return Pw({},e,{snacks:i})},n.handleEnteredSnack=function(e,t,r){if(!PR(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?Pw({},e,{entered:!0}):Pw({},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?Pw({},e,{open:!1}):Pw({},e,{requestClose:!0}):Pw({},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});PR(e)&&t&&t.onClose&&t.onClose(null,"instructed",e),n.handleCloseSnack(null,"instructed",e)},n.handleExitedSnack=function(e,t){if(!PR(t))throw Error("handleExitedSnack Cannot be called with undefined key");n.setState(function(e){var r=n.processQueue(Pw({},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(Pk(n)),closeSnackbar:n.closeSnackbar.bind(Pk(n))}},n}return PS(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,a=n.Components,l=void 0===a?{}:a,u=n.classes,c=this.state.snacks.reduce(function(e,t){var n,r=PO(t.anchorOrigin),i=e[r]||[];return Pw({},e,((n={})[r]=[].concat(i,[t]),n))},{}),h=Object.keys(c).map(function(t){var n=c[t],r=n[0];return g().createElement(If,{key:t,dense:s,anchorOrigin:r.anchorOrigin,classes:u},n.map(function(t){return g().createElement(Ia,{key:t.id,snack:t,classes:u,Component:l[t.variant],onClose:e.handleCloseSnack,onEnter:e.props.onEnter,onExit:e.props.onExit,onExited:P8([e.handleExitedSnack,e.props.onExited],t.id),onEntered:P8([e.handleEnteredSnack,e.props.onEntered],t.id)})}))});return g().createElement(PT.Provider,{value:t},i,r?(0,e0.createPortal)(h,r):h)},Px(t,[{key:"maxSnack",get:function(){return this.props.maxSnack||PY.maxSnack}}]),t}(m.Component);function Ig(){let{enqueueSnackbar:e,closeSnackbar:t}=(0,m.useContext)(PT),n=Iv(e,"error"),r=Iv(e,"info"),i=Iv(e,"warning"),o=Iv(e,"success"),s=(0,m.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 Iv(e,t){return(0,m.useCallback)((n,r)=>e(n,{...r,variant:t}),[e,t])}function Iy(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 el()({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)}function Ib(e){return{value:{pastDuration:e},display:`Last ${(0,bL.formatDuration)((0,kQ.Ib)(e),{delimiter:", "})}`}}var Ix=n(28730);let Iw=Iy((0,Ix.Z)({}),{echartsTheme:{textStyle:{fontFamily:"Lato"},categoryAxis:{splitLine:{show:!1}},timeAxis:{splitLine:{show:!1}},bar:{barCategoryGap:2}}}),IS={chartsTheme:Iw,enablePinning:!1,lastTooltipPinnedCoords:null,setLastTooltipPinnedCoords:()=>null};var IC=n(79602);let Ik={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,[`& .${IC.Z.icon}`]:{color:e.palette.error.main}}:{...e.typography.body1,backgroundColor:e.palette.error.light,color:e.palette.error.dark,[`& .${IC.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,[`& .${IC.Z.icon}`]:{color:e.palette.info.main}}:{...e.typography.body1,backgroundColor:e.palette.info.light,color:e.palette.info.dark,[`& .${IC.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,[`& .${IC.Z.icon}`]:{color:e.palette.success.main}}:{...e.typography.body1,backgroundColor:e.palette.success.light,color:e.palette.success.dark,[`& .${IC.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,[`& .${IC.Z.icon}`]:{color:e.palette.warning.main}}:{...e.typography.body1,backgroundColor:e.palette.warning.light,color:e.palette.warning.dark,[`& .${IC.Z.icon}`]:{color:e.palette.warning.main}},root:{["& ."+n(757).Z.root]:{textDecoration:"underline"}}}},IM={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"},IT={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"},IA="#FFFFFF",ID=e=>{let t=IM["800"],n=IM["300"];return"light"===e?{navigation:t,accent:n,primary:IM["800"],secondary:IM["700"],disabled:IM["300"],link:IT["500"],linkHover:IT["600"]}:{navigation:t,accent:n,primary:IA,secondary:IM["50"],disabled:IM["600"],link:IT["400"],linkHover:IT["500"]}},IE=e=>{let t=IT["150"],n="rgba(21, 23, 33, 0.75)";return"light"===e?{navigation:t,overlay:n,default:IA,paper:IM["50"],code:IM["50"],tooltip:IM["100"],lighter:IM["50"],border:IM["100"]}:{navigation:t,overlay:n,default:IM["900"],paper:IM["850"],code:IM["800"],tooltip:IM["600"],lighter:IM["700"],border:IM["600"]}},IO=e=>"light"===e?{50:IM["50"],100:IM["100"],200:IM["200"],300:IM["300"],400:IM["400"],500:IM["500"],600:IM["600"],700:IM["700"],800:IM["800"],900:IM["900"],950:IM["950"]}:{50:IM["950"],100:IM["900"],200:IM["800"],300:IM["700"],400:IM["600"],500:IM["500"],600:IM["400"],700:IM["300"],800:IM["200"],900:IM["100"],950:IM["50"]},IR=e=>"light"===e?{main:IT["500"],dark:IT["600"],light:IT["50"]}:{main:IT["400"],dark:IT["800"],light:IT["200"]},IP=e=>"light"===e?{main:IM["600"],dark:IM["900"],light:IM["100"]}:{main:IA,dark:IA,light:IA},II={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"},IN={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"},Ij={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"},IL={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"},IF=e=>"light"===e?{main:IL["500"],dark:IL["600"],light:IL["50"]}:{main:IL["400"],dark:IL["800"],light:IL["300"]},IZ=e=>"light"===e?{main:II["500"],dark:II["700"],light:II["50"]}:{main:II["400"],dark:II["800"],light:II["300"]},IB=e=>"light"===e?{main:IN["500"],dark:IN["700"],light:IN["50"]}:{main:IN["400"],dark:IN["800"],light:IN["300"]},IV={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"}},Iz=({theme:e})=>({..."light"===e.palette.mode?{}:{backgroundImage:"unset",backgroundColor:e.palette.designSystem.grey[800]}});function I_(e,t={}){return(0,Ix.Z)({palette:{mode:e,primary:IR(e),secondary:IP(e),grey:IO(e),background:IE(e),text:ID(e),error:IF(e),warning:IB(e),info:IR(e),success:IZ(e),common:{white:IA,black:"#000000"},designSystem:{blue:IT,green:II,grey:IM,orange:IN,purple:Ij,red:IL}},typography:IV,mixins:{},components:IH,...t})}let IH={MuiAlert:Ik,MuiFormControl:{defaultProps:{size:"small"}},MuiPaper:{styleOverrides:{root:({theme:e})=>({backgroundColor:e.palette.background.default})}},MuiTextField:{defaultProps:{size:"small"}},MuiDrawer:{styleOverrides:{paper:Iz}},MuiDialog:{styleOverrides:{paper:Iz}},MuiPopover:{styleOverrides:{paper:Iz}}};var I$=n(84974),IW=n(12449),Iq=n(28418),IG=n(57689);let IU={JoinByColumnValue:"Join by column value",MergeColumns:"Merge columns",MergeIndexedColumns:"Merge indexed columns",MergeSeries:"Merge series"};function IK({value:e,onChange:t}){return(0,p.jsxs)(ed.Z,{direction:"row",children:[(0,p.jsx)(oJ.Z,{freeSolo:!0,multiple:!0,id:"join-columns",sx:{width:"100%"},options:[],value:e.spec.columns??[],renderInput:e=>(0,p.jsx)(ep.Z,{...e,variant:"outlined",label:"Columns",required:!0}),onChange:(n,r)=>{t({...e,spec:{...e.spec,columns:r}})}}),(0,p.jsx)(xL.Z,{label:"Enabled",labelPlacement:"start",control:(0,p.jsx)(xl.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function IY({value:e,onChange:t}){return(0,p.jsxs)(ed.Z,{direction:"row",gap:1,alignItems:"center",children:[(0,p.jsx)(oJ.Z,{freeSolo:!0,multiple:!0,id:"merge-columns-columns",sx:{width:"100%"},options:[],value:e.spec.columns??[],renderInput:e=>(0,p.jsx)(ep.Z,{...e,variant:"outlined",label:"Columns",required:!0}),onChange:(n,r)=>{t({...e,spec:{...e.spec,columns:r}})}}),(0,p.jsx)(oI,{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,p.jsx)(xL.Z,{label:"Enabled",labelPlacement:"start",control:(0,p.jsx)(xl.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function IX({value:e,onChange:t}){return(0,p.jsxs)(ed.Z,{direction:"row",children:[(0,p.jsx)(oI,{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,p.jsx)(xL.Z,{label:"Enabled",labelPlacement:"start",control:(0,p.jsx)(xl.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function IQ({value:e,onChange:t}){return(0,p.jsx)(ed.Z,{direction:"row",children:(0,p.jsx)(xL.Z,{label:"Enabled",labelPlacement:"start",control:(0,p.jsx)(xl.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})})}function IJ({value:e,onChange:t,...n}){return(0,p.jsxs)(ed.Z,{gap:2,sx:{width:"100%"},mt:1,...n,children:[(0,p.jsxs)(oI,{select:!0,label:"Kind",value:e.kind,onChange:n=>t({...e,kind:n}),children:[(0,p.jsx)(sq.Z,{value:"JoinByColumnValue",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"Join by column value"}),(0,p.jsx)(i6.Z,{variant:"caption",children:"Regroup rows with equal cell value in a column"})]})}),(0,p.jsx)(sq.Z,{value:"MergeColumns",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"Merge columns"}),(0,p.jsx)(i6.Z,{variant:"caption",children:"Multiple columns are merged to one column"})]})}),(0,p.jsx)(sq.Z,{value:"MergeIndexedColumns",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"Merge indexed columns"}),(0,p.jsx)(i6.Z,{variant:"caption",children:"Indexed columns are merged to one column"})]})}),(0,p.jsx)(sq.Z,{value:"MergeSeries",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"Merge series"}),(0,p.jsx)(i6.Z,{variant:"caption",children:"Series will be merged by their labels"})]})})]}),"JoinByColumnValue"===e.kind&&(0,p.jsx)(IK,{value:e,onChange:t}),"MergeColumns"===e.kind&&(0,p.jsx)(IY,{value:e,onChange:t}),"MergeIndexedColumns"===e.kind&&(0,p.jsx)(IX,{value:e,onChange:t}),"MergeSeries"===e.kind&&(0,p.jsx)(IQ,{value:e,onChange:t})]})}function I0({index:e,value:t,isCollapsed:n,onChange:r,onCollapse:i,onDelete:o,...s}){return(0,p.jsxs)(ed.Z,{...s,children:[(0,p.jsxs)(ed.Z,{direction:"row",alignItems:"center",borderBottom:1,borderColor:e=>e.palette.divider,justifyContent:"space-between",gap:4,children:[(0,p.jsxs)(ed.Z,{direction:"row",gap:1,children:[(0,p.jsx)(ef.Z,{"data-testid":`transform-toggle#${e}`,size:"small",onClick:()=>i(!n),children:n?(0,p.jsx)(I$.default,{}):(0,p.jsx)(IW.default,{})}),(0,p.jsx)(i6.Z,{variant:"overline",component:"h4",sx:{textTransform:"none"},children:t.kind?(0,p.jsx)("span",{children:(0,p.jsx)("strong",{children:IU[t.kind]})}):(0,p.jsx)("strong",{children:"Select a transformation kind"})})]}),(0,p.jsxs)(ed.Z,{direction:"row",gap:1,children:[n&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(oG.Z,{title:t.spec?.disabled?"Enable transformation":"Disable transformation",placement:"top",children:(0,p.jsx)(ef.Z,{size:"small",sx:{marginLeft:"auto"},onClick:function(){r({...t,spec:{...t.spec,disabled:!t.spec?.disabled}})},children:t.spec?.disabled?(0,p.jsx)(Iq.default,{}):(0,p.jsx)(IG.default,{})})}),(0,p.jsx)(af.Z,{flexItem:!0,orientation:"vertical",variant:"middle"})]}),(0,p.jsx)(oG.Z,{title:"Remove transformation",placement:"top",children:(0,p.jsx)(ef.Z,{size:"small",sx:{marginLeft:"auto"},onClick:o,children:(0,p.jsx)(wc.default,{})})})]})]}),!n&&(0,p.jsx)(IJ,{value:t,onChange:r})]})}function I1({value:e,onChange:t,...n}){let[r,i]=(0,m.useState)(e.map(()=>!0));return(0,p.jsxs)(ed.Z,{gap:1,...n,children:[e.map((n,o)=>(0,p.jsx)(I0,{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,p.jsx)(j.Z,{variant:"contained",startIcon:(0,p.jsx)(xZ.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 I2(e){let{value:t,onChange:n,timeOptions:r,height:i}=e,o=(0,m.useMemo)(()=>{if(t&&!r.some(e=>e.value.pastDuration===t))return(0,p.jsx)(sq.Z,{value:t,children:t})},[r,t]);return(0,p.jsx)(oH.Z,{children:(0,p.jsx)(W.Z,{children:(0,p.jsxs)(kY.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,p.jsx)(sq.Z,{value:e.value.pastDuration,children:e.display},t)),o]})})})}var I5=n(85731);function I3(e){let{width:t,height:n,data:r}=e,i=K(),o={title:{text:"Referer of a Website",subtext:"Fake Data",left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},axisLabel:{overflow:"truncate",width:t/3},series:[{name:"Access From",type:"pie",radius:"55%",label:!1,center:["40%","50%"],data:r,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}],itemStyle:{borderRadius:2,color:i.echartsTheme[0]}};return(0,p.jsx)(W.Z,{style:{width:t,height:n},sx:{overflow:"auto"},children:(0,p.jsx)(es,{sx:{minHeight:n,height:r?16*r.length:"100%"},option:o,theme:i.echartsTheme})})}(0,Z.D)([I5.N,V.N,z.N,_.N,H.N,$.N]);var I4=n(27835),I8=n(943),I6=n(72116);(0,Z.D)([I4.N,I8.N,V.N,z.N,_.N,H.N,$.N]);let I9=e=>{var t;let{height:n,data:r,xAxisCategories:i,yAxisCategories:o,timeScale:s,colors:a}=e,{timeZone:l}=b$(),u=K(),c=(0,eX.Z)(),h={tooltip:{appendToBody:!0,formatter:e=>(function({data:e,label:t,marker:n,xAxisCategories:r,yAxisCategories:i,theme:o}){let[s,a]=e,{formattedDate:l,formattedTime:u}=bz(r[s]),c=(0,I6.css)`
8
- border-bottom: 1px solid ${o.palette.grey[500]};
9
- padding-bottom: 8px;
10
- `,h=(0,I6.css)`
11
- display: flex;
12
- justify-content: space-between;
13
- padding-top: 8px;
14
- `,d=(0,I6.css)`
15
- margin-right: 16px;
16
- `;return`
17
- <div>
18
- <div style="${c.styles}">${l} ${u}</div>
19
- <div style="${h.styles}">
20
- <div style="${d.styles}">
21
- ${n}
22
- <strong>${i[a]}</strong>
23
- </div>
24
- <div>
25
- ${t}
26
- </div>
27
- </div>
28
- </div>
29
- `})({data:e.data.value,label:e.data.label,marker:e.marker,xAxisCategories:i,yAxisCategories:o,theme:c})},grid:{top:"5%",bottom:"5%"},xAxis:{type:"category",data:i,axisLine:{show:!1},splitArea:{show:!1},axisLabel:{hideOverlap:!0,formatter:(t=s?.rangeMs??0,function(e){let n=new Date(Number(e));return t>15768e7?bZ(n,"yyy",l):t>63072e6?bZ(n,"MMM yyy",l):t>864e6&&t<1577664e4?bZ(n,"dd.MM",l):t>1728e5&&t<=864e6?bZ(n,"dd.MM HH:mm",l):bZ(n,"HH:mm",l)})}},yAxis:{type:"category",data:o,axisLine:{show:!1},splitArea:{show:!1,interval:0},splitLine:{show:!1},axisLabel:{interval:0}},visualMap:{show:!1,type:"piecewise",pieces:a},series:[{name:"Status history",type:"heatmap",coordinateSystem:"cartesian2d",data:r,label:{show:!1},itemStyle:{borderWidth:1,borderType:"solid",borderColor:"#ffffff"},emphasis:{itemStyle:{opacity:.5}}}]};return(0,p.jsx)(W.Z,{style:{height:n},sx:{overflow:"auto"},children:(0,p.jsx)(es,{sx:{width:"100%",height:n},option:h,theme:u.echartsTheme})})},I7="#1f77b4";function Ne(e,t){t.match(/^#[0-9A-Fa-f]{6}$/)||(t=I7);try{let[n,r,i]=Nn(t);if(isNaN(n)||isNaN(r)||isNaN(i))throw Error("Invalid HSL values");let o=String(e).split("").reduce((e,t)=>e+t.charCodeAt(0),0),s=Math.min(r+10,90),a=Nr(Math.abs((n+o%6*60)%360),Math.min(Math.max(s,50),90),Math.min(Math.max(i+(o%2?15:-15),30),70));if(!a.match(/^#[0-9A-Fa-f]{6}$/))throw Error("Invalid generated color");return a}catch(e){return I7}}function Nt(e,t){return t.length>=e.length?t.slice(0,e.length):e.map((e,n)=>n<t.length?t[n]||I7:Ne(e,t[0]||I7))}function Nn(e){let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),o=Math.min(t,n,r),s=0,a=0,l=(i+o)/2;if(i!==o){let e=i-o;switch(a=l>.5?e/(2-i-o):e/(i+o),i){case t:s=(n-r)/e+6*(n<r);break;case n:s=(r-t)/e+2;break;case r:s=(t-n)/e+4}s/=6}return[360*s,100*a,100*l]}function Nr(e,t,n){let r=t*Math.min(n/=100,1-n)/100,i=t=>{let i=(t+e/30)%12;return Math.round(255*(n-r*Math.max(Math.min(i-3,9-i,1),-1))).toString(16).padStart(2,"0")};return`#${i(0)}${i(8)}${i(4)}`}var Ni=n(11104),No=n(4560),Ns=n(38971),Na=n(93772),Nl=n(6798);let Nu=(e,t)=>e.filter(e=>t.includes(e)),Nc=(e,t,n)=>{let r=e.keys[0];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)}):t&&"object"==typeof t?(Object.keys(t).length>e.keys.length?e.keys:Nu(e.keys,Object.keys(t))).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)}}):("number"==typeof t||"string"==typeof t)&&n((e,t)=>{Object.assign(e,t)},t)};function Nh(e){return`--Grid-${e}Spacing`}function Nd(e){return`--Grid-parent-${e}Spacing`}let Nf="--Grid-columns",Np="--Grid-parent-columns",Nm=({theme:e,ownerState:t})=>{let n={};return Nc(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(${Np}) - (var(${Np}) - ${t}) * (var(${Nd("column")}) / var(${Np})))`}),e(n,r)}),n},Ng=({theme:e,ownerState:t})=>{let n={};return Nc(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(${Np}) + var(${Nd("column")}) * ${t} / var(${Np}))`}),e(n,r)}),n},Nv=({theme:e,ownerState:t})=>{if(!t.container)return{};let n={[Nf]:12};return Nc(e.breakpoints,t.columns,(e,t)=>{let r=t??12;e(n,{[Nf]:r,"> *":{[Np]:r}})}),n},Ny=({theme:e,ownerState:t})=>{if(!t.container)return{};let n={};return Nc(e.breakpoints,t.rowSpacing,(t,r)=>{let i="string"==typeof r?r:e.spacing?.(r);t(n,{[Nh("row")]:i,"> *":{[Nd("row")]:i}})}),n},Nb=({theme:e,ownerState:t})=>{if(!t.container)return{};let n={};return Nc(e.breakpoints,t.columnSpacing,(t,r)=>{let i="string"==typeof r?r:e.spacing?.(r);t(n,{[Nh("column")]:i,"> *":{[Nd("column")]:i}})}),n},Nx=({theme:e,ownerState:t})=>{if(!t.container)return{};let n={};return Nc(e.breakpoints,t.direction,(e,t)=>{e(n,{flexDirection:t})}),n},Nw=({ownerState:e})=>({minWidth:0,boxSizing:"border-box",...e.container&&{display:"flex",flexWrap:"wrap",...e.wrap&&"wrap"!==e.wrap&&{flexWrap:e.wrap},gap:`var(${Nh("row")}) var(${Nh("column")})`}}),NS=e=>{let t=[];return Object.entries(e).forEach(([e,n])=>{!1!==n&&void 0!==n&&t.push(`grid-${e}-${String(n)}`)}),t},NC=(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[]},Nk=e=>void 0===e?[]:"object"==typeof e?Object.entries(e).map(([e,t])=>`direction-${e}-${t}`):[`direction-xs-${String(e)}`],NM=(0,Nl.Z)(),NT=(0,No.Z)("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,t)=>t.root});function NA(e){return(0,kJ.Z)({props:e,name:"MuiGrid",defaultTheme:NM})}let ND=function(e={}){let{createStyledComponent:t=NT,useThemeProps:n=NA,useTheme:r=Ns.Z,componentName:i="MuiGrid"}=e,o=(e,t)=>{let{container:n,direction:r,spacing:o,wrap:s,size:a}=e,l={root:["root",n&&"container","wrap"!==s&&`wrap-xs-${String(s)}`,...Nk(r),...NS(a),...n?NC(o,t.breakpoints.keys[0]):[]]};return(0,y.Z)(l,e=>(0,A.ZP)(i,e),{})};function s(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 a=t(Nv,Nb,Ny,Nm,Nx,Nw,Ng),l=m.forwardRef(function(e,t){let i=r(),l=n(e),u=(0,Na.Z)(l);!function(e,t){let n=[];void 0!==e.item&&(delete e.item,n.push("item")),void 0!==e.zeroMinWidth&&(delete e.zeroMinWidth,n.push("zeroMinWidth")),t.keys.forEach(t=>{void 0!==e[t]&&(n.push(t),delete e[t])})}(u,i.breakpoints);let{className:c,children:h,columns:d=12,container:f=!1,component:g="div",direction:y="row",wrap:b="wrap",size:x={},offset:w={},spacing:S=0,rowSpacing:C=S,columnSpacing:k=S,unstable_level:M=0,...T}=u,A=s(x,i.breakpoints,e=>!1!==e),D=s(w,i.breakpoints),E=e.columns??(M?void 0:d),O=e.spacing??(M?void 0:S),R=e.rowSpacing??e.spacing??(M?void 0:C),P=e.columnSpacing??e.spacing??(M?void 0:k),I={...u,level:M,columns:E,container:f,direction:y,wrap:b,spacing:O,rowSpacing:R,columnSpacing:P,size:A,offset:D},N=o(I,i);return(0,p.jsx)(a,{ref:t,as:g,ownerState:I,className:(0,v.Z)(N.root,c),...T,children:m.Children.map(h,e=>m.isValidElement(e)&&(0,Ni.Z)(e,["Grid"])&&f&&e.props.container?m.cloneElement(e,{unstable_level:e.props?.unstable_level??M+1}):e)})});return l.muiName="Grid",l}({createStyledComponent:(0,S.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,M.i)({props:e,name:"MuiGrid2"}),useTheme:eX.Z}),NE=({mapping:e,onChange:t,...n})=>{switch(e.kind){case"Value":return(0,p.jsx)(ed.Z,{gap:1,direction:"row",...n,children:(0,p.jsx)(ep.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,p.jsxs)(ed.Z,{gap:1,direction:"row",...n,children:[(0,p.jsx)(ep.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,p.jsx)(ep.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,p.jsx)(ed.Z,{gap:1,direction:"row",...n,children:(0,p.jsx)(ep.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,p.jsx)(ed.Z,{gap:1,direction:"row",...n,children:(0,p.jsxs)(ep.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,p.jsx)(sq.Z,{value:"empty",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"Empty"}),(0,p.jsx)(i6.Z,{variant:"caption",children:"Matches empty string"})]})}),(0,p.jsx)(sq.Z,{value:"null",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"Null"}),(0,p.jsx)(i6.Z,{variant:"caption",children:"Matches null or undefined"})]})}),(0,p.jsx)(sq.Z,{value:"NaN",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"NaN"}),(0,p.jsx)(i6.Z,{variant:"caption",children:"Matches Not a Number value"})]})}),(0,p.jsx)(sq.Z,{value:"true",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"True"}),(0,p.jsx)(i6.Z,{variant:"caption",children:"Matches true boolean"})]})}),(0,p.jsx)(sq.Z,{value:"false",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"False"}),(0,p.jsx)(i6.Z,{variant:"caption",children:"Matches false boolean"})]})})]})});default:return null}},NO=({mapping:e,onChange:t,onDelete:n,...r})=>{let i=n=>{t({...e,spec:{...e.spec,result:{...e.spec.result,color:n}}})};return(0,p.jsxs)(ND,{container:!0,spacing:2,...r,children:[(0,p.jsx)(ND,{size:{xs:5},children:(0,p.jsxs)(ed.Z,{direction:"row",gap:1,width:"100%",children:[(0,p.jsxs)(ep.Z,{select:!0,label:"Type",value:e.kind,onChange:n=>t({...e,kind:n.target.value}),required:!0,sx:{width:"120px"},children:[(0,p.jsx)(sq.Z,{value:"Value",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"Value"}),"Value"!==e.kind&&(0,p.jsx)(i6.Z,{variant:"caption",children:"Matches an exact text value"})]})}),(0,p.jsx)(sq.Z,{value:"Range",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"Range"}),"Range"!==e.kind&&(0,p.jsx)(i6.Z,{variant:"caption",children:"Matches against a numerical range"})]})}),(0,p.jsx)(sq.Z,{value:"Regex",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"Regex"}),"Regex"!==e.kind&&(0,p.jsx)(i6.Z,{variant:"caption",children:"Matches against a regular expression"})]})}),(0,p.jsx)(sq.Z,{value:"Misc",children:(0,p.jsxs)(ed.Z,{children:[(0,p.jsx)(i6.Z,{children:"Misc"}),"Misc"!==e.kind&&(0,p.jsx)(i6.Z,{variant:"caption",children:"Matches against empty, null and NaN values"})]})})]}),(0,p.jsx)(NE,{width:"100%",mapping:e,onChange:n=>t({...e,...n})})]})}),(0,p.jsx)(ND,{size:{xs:4},children:(0,p.jsx)(ep.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,p.jsx)(ND,{size:{xs:1},children:(0,p.jsx)(ed.Z,{direction:"row",justifyContent:"center",gap:1,children:e.spec?.result?.color?(0,p.jsx)(eK,{label:"Color",color:e.spec.result.color??"#000",onColorChange:i,onClear:()=>i(void 0)}):(0,p.jsx)(ef.Z,{onClick:()=>i("#000"),children:(0,p.jsx)(xZ.default,{})})})}),(0,p.jsx)(ND,{size:{xs:1},textAlign:"end",children:(0,p.jsx)(oG.Z,{title:"Remove mapping settings",placement:"top",children:(0,p.jsx)(ef.Z,{size:"small",sx:{marginLeft:"auto"},onClick:n,children:(0,p.jsx)(wc.default,{})})})})]})},NR=({mappings:e,onChange:t})=>{let[n,r]=(0,m.useState)(e);return(0,p.jsxs)(ed.Z,{spacing:1,children:[(0,p.jsxs)(ND,{container:!0,spacing:2,children:[(0,p.jsx)(ND,{size:{xs:5},children:(0,p.jsx)(i6.Z,{variant:"subtitle1",children:"Condition"})}),(0,p.jsx)(ND,{size:{xs:4},children:(0,p.jsx)(i6.Z,{variant:"subtitle1",children:"Display Text"})}),(0,p.jsx)(ND,{size:{xs:1},textAlign:"center",children:(0,p.jsx)(i6.Z,{variant:"subtitle1",children:"Color"})}),(0,p.jsx)(ND,{size:{xs:1}})]}),(0,p.jsx)(ed.Z,{gap:1.5,divider:(0,p.jsx)(af.Z,{flexItem:!0,orientation:"horizontal"}),children:n.map((e,i)=>(0,p.jsx)(NO,{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,p.jsx)(j.Z,{variant:"contained",startIcon:(0,p.jsx)(xZ.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){return void 0===e?void 0:"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}})},82545:function(e,t,n){var r=n(81822)(n(77400),"DataView");e.exports=r},64825:function(e,t,n){var r=n(81822)(n(77400),"Promise");e.exports=r},46151:function(e,t,n){var r=n(81822)(n(77400),"Set");e.exports=r},52485:function(e,t,n){var r=n(74554),i=n(38639),o=n(88379);function s(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}s.prototype.add=s.prototype.push=i,s.prototype.has=o,e.exports=s},66902:function(e,t,n){var r=n(81822)(n(77400),"WeakMap");e.exports=r},10263:function(e){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}},97141:function(e){e.exports=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}},90756:function(e){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},11324:function(e,t,n){var r=n(97141),i=n(19785);e.exports=function(e,t,n){var o=t(e);return i(e)?o:r(o,n(e))}},32866:function(e,t,n){var r=n(12772),i=n(92360);e.exports=function e(t,n,o,s,a){return t===n||(null!=t&&null!=n&&(i(t)||i(n))?r(t,n,o,s,e,a):t!=t&&n!=n)}},12772:function(e,t,n){var r=n(23694),i=n(27042),o=n(370),s=n(39584),a=n(3533),l=n(19785),u=n(43854),c=n(48519),h="[object Arguments]",d="[object Array]",f="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,m,g,v){var y=l(e),b=l(t),x=y?d:a(e),w=b?d:a(t);x=x==h?f:x,w=w==h?f:w;var S=x==f,C=w==f,k=x==w;if(k&&u(e)){if(!u(t))return!1;y=!0,S=!1}if(k&&!S)return v||(v=new r),y||c(e)?i(e,t,n,m,g,v):o(e,t,x,n,m,g,v);if(!(1&n)){var M=S&&p.call(e,"__wrapped__"),T=C&&p.call(t,"__wrapped__");if(M||T){var A=M?e.value():e,D=T?t.value():t;return v||(v=new r),g(A,D,n,m,v)}}return!!k&&(v||(v=new r),s(e,t,n,m,g,v))}},20186:function(e,t,n){var r=n(56016),i=n(50962),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=[];for(var n in Object(e))o.call(e,n)&&"constructor"!=n&&t.push(n);return t}},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}},65581:function(e){e.exports=function(e,t){return e.has(t)}},27042:function(e,t,n){var r=n(52485),i=n(90756),o=n(65581);e.exports=function(e,t,n,s,a,l){var u=1&n,c=e.length,h=t.length;if(c!=h&&!(u&&h>c))return!1;var d=l.get(e),f=l.get(t);if(d&&f)return d==t&&f==e;var p=-1,m=!0,g=2&n?new r:void 0;for(l.set(e,t),l.set(t,e);++p<c;){var v=e[p],y=t[p];if(s)var b=u?s(y,v,p,t,e,l):s(v,y,p,e,t,l);if(void 0!==b){if(b)continue;m=!1;break}if(g){if(!i(t,function(e,t){if(!o(g,t)&&(v===e||a(v,e,n,s,l)))return g.push(t)})){m=!1;break}}else if(!(v===y||a(v,y,n,s,l))){m=!1;break}}return l.delete(e),l.delete(t),m}},370:function(e,t,n){var r=n(96539),i=n(59942),o=n(85638),s=n(27042),a=n(19383),l=n(43735),u=r?r.prototype:void 0,c=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,h,d){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":if(e.byteLength!=t.byteLength||!h(new i(e),new i(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var f=a;case"[object Set]":var p=1&r;if(f||(f=l),e.size!=t.size&&!p)break;var m=d.get(e);if(m)return m==t;r|=2,d.set(e,t);var g=s(f(e),f(t),r,u,h,d);return d.delete(e),g;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}},39584:function(e,t,n){var r=n(51385),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,o,s,a){var l=1&n,u=r(e),c=u.length;if(c!=r(t).length&&!l)return!1;for(var h=c;h--;){var d=u[h];if(!(l?d in t:i.call(t,d)))return!1}var f=a.get(e),p=a.get(t);if(f&&p)return f==t&&p==e;var m=!0;a.set(e,t),a.set(t,e);for(var g=l;++h<c;){var v=e[d=u[h]],y=t[d];if(o)var b=l?o(y,v,d,t,e,a):o(v,y,d,e,t,a);if(!(void 0===b?v===y||s(v,y,n,o,a):b)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var x=e.constructor,w=t.constructor;x!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof x&&x instanceof x&&"function"==typeof w&&w instanceof w)&&(m=!1)}return a.delete(e),a.delete(t),m}},51385:function(e,t,n){var r=n(11324),i=n(83080),o=n(50098);e.exports=function(e){return r(e,o,i)}},83080:function(e,t,n){var r=n(10263),i=n(15937),o=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(e){return null==e?[]:r(s(e=Object(e)),function(t){return o.call(e,t)})}:i;e.exports=a},3533:function(e,t,n){var r=n(82545),i=n(44538),o=n(64825),s=n(46151),a=n(66902),l=n(99736),u=n(76532),c="[object Map]",h="[object Promise]",d="[object Set]",f="[object WeakMap]",p="[object DataView]",m=u(r),g=u(i),v=u(o),y=u(s),b=u(a),x=l;(r&&x(new r(new ArrayBuffer(1)))!=p||i&&x(new i)!=c||o&&x(o.resolve())!=h||s&&x(new s)!=d||a&&x(new a)!=f)&&(x=function(e){var t=l(e),n="[object Object]"==t?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case m:return p;case g:return c;case v:return h;case y:return d;case b:return f}return t}),e.exports=x},19383:function(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}},50962:function(e,t,n){var r=n(58023)(Object.keys,Object);e.exports=r},38639:function(e){e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},88379:function(e){e.exports=function(e){return this.__data__.has(e)}},43735:function(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}},56127:function(e){var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},66726:function(e,t,n){var r=n(11611),i=n(82846),o=n(91936),s=Math.max,a=Math.min;e.exports=function(e,t,n){var l,u,c,h,d,f,p=0,m=!1,g=!1,v=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var n=l,r=u;return l=u=void 0,p=t,h=e.apply(r,n)}function b(e){var n=e-f,r=e-p;return void 0===f||n>=t||n<0||g&&r>=c}function x(){var e,n,r,o=i();if(b(o))return w(o);d=setTimeout(x,(e=o-f,n=o-p,r=t-e,g?a(r,c-n):r))}function w(e){return(d=void 0,v&&l)?y(e):(l=u=void 0,h)}function S(){var e,n=i(),r=b(n);if(l=arguments,u=this,f=n,r){if(void 0===d)return p=e=f,d=setTimeout(x,t),m?y(e):h;if(g)return clearTimeout(d),d=setTimeout(x,t),y(f)}return void 0===d&&(d=setTimeout(x,t)),h}return t=o(t)||0,r(n)&&(m=!!n.leading,c=(g="maxWait"in n)?s(o(n.maxWait)||0,t):c,v="trailing"in n?!!n.trailing:v),S.cancel=function(){void 0!==d&&clearTimeout(d),p=0,l=f=u=d=void 0},S.flush=function(){return void 0===d?h:w(i())},S}},56141:function(e,t,n){var r=n(32866);e.exports=function(e,t){return r(e,t)}},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)}},50098:function(e,t,n){var r=n(98213),i=n(20186),o=n(80068);e.exports=function(e){return o(e)?r(e):i(e)}},82846:function(e,t,n){var r=n(77400);e.exports=function(){return r.Date.now()}},15937:function(e){e.exports=function(){return[]}},91936:function(e,t,n){var r=n(74833),i=n(11611),o=n(55193),s=0/0,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=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=l.test(e);return n||u.test(e)?c(e.slice(2),n?2:8):a.test(e)?s:+e}},59986:function(e,t,n){"use strict";t.default=void 0;var r,i=(r=n(30265))&&r.__esModule?r:{default:r};t.default=(0,i.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";t.default=void 0;var r,i=(r=n(30265))&&r.__esModule?r:{default:r};t.default=(0,i.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";t.default=void 0;var r,i=(r=n(30265))&&r.__esModule?r:{default:r};t.default=(0,i.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";t.default=void 0;var r,i=(r=n(30265))&&r.__esModule?r:{default:r};t.default=(0,i.default)("M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z","Drag")},28418:function(e,t,n){"use strict";t.default=void 0;var r,i=(r=n(30265))&&r.__esModule?r:{default:r};t.default=(0,i.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";t.default=void 0;var r,i=(r=n(30265))&&r.__esModule?r:{default:r};t.default=(0,i.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";t.default=void 0;var r,i=(r=n(30265))&&r.__esModule?r:{default:r};t.default=(0,i.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,a=this.props.resetKeys;null!==s&&null!==t.error&&(void 0===(n=e.resetKeys)&&(n=[]),void 0===(r=a)&&(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,a),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))},i=e.displayName||e.name||"Unknown";return r.displayName="withErrorBoundary("+i+")",r},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(8218))},8317:function(e){function t(){}t.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function i(){r.off(e,i),t.apply(n,arguments)}return i._=t,this.on(e,i,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,i=n.length;r<i;r++)n[r].fn.apply(n[r].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),r=n[e],i=[];if(r&&t)for(var o=0,s=r.length;o<s;o++)r[o].fn!==t&&r[o].fn._!==t&&i.push(r[o]);return i.length?n[e]=i:delete n[e],this}},e.exports=t,e.exports.TinyEmitter=t},27554:function(e){"use strict";var t;t=function(){function e(){return!0}function t(){return!1}function n(){}return function r(){var i=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:function(e){return"object"==typeof e&&null!==e&&e.constructor===Object}},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],o={name:"any",test:e},s=[],a=[],l={types:i,conversions:a,ignore:s};function u(e){var t=L(l.types,function(t){return t.name===e});if(t)return t;if("any"===e)return o;var n=L(l.types,function(t){return t.name.toLowerCase()===e.toLowerCase()});throw TypeError('Unknown type "'+e+'"'+(n?'. Did you mean "'+n.name+'"?':""))}function c(e){return e===o?999:l.types.indexOf(e)}function h(e){var t=L(l.types,function(t){return t.test(e)});if(t)return t.name;throw TypeError("Value has unknown type. Value: "+e)}function d(e){return e.map(function(e){var t=e.types.map(y);return(e.restParam?"...":"")+t.join("|")}).join(",")}function f(e){var t=N(e);return!!t&&t.restParam}function p(e){return e.types.some(function(e){return null!=e.conversion})}function m(t){if(!t||0===t.types.length)return e;if(1===t.types.length)return u(t.types[0].name).test;if(2===t.types.length){var n=u(t.types[0].name).test,r=u(t.types[1].name).test;return function(e){return n(e)||r(e)}}var i=t.types.map(function(e){return u(e.name).test});return function(e){for(var t=0;t<i.length;t++)if(i[t](e))return!0;return!1}}function g(e,t){return t<e.params.length?e.params[t]:f(e.params)?N(e.params):null}function v(e,t,n){var r=g(e,t);return(r?n?r.types.filter(b):r.types:[]).map(y)}function y(e){return e.name}function b(e){return null===e.conversion||void 0===e.conversion}function x(e,t){var n=function(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;return Object.keys(t)}(F(e,function(e){return v(e,t,!1)}));return -1!==n.indexOf("any")?["any"]:n}function w(e,t,n){var r,i,o,s=e||"unnamed",a=n;for(o=0;o<t.length;o++){var l=a.filter(function(e){var n=m(g(e,o));return(o<e.params.length||f(e.params))&&n(t[o])});if(0===l.length){if((i=x(a,o)).length>0){var u=h(t[o]);return(r=TypeError("Unexpected type of argument in function "+s+" (expected: "+i.join(" or ")+", actual: "+u+", index: "+o+")")).data={category:"wrongType",fn:s,index:o,actual:u,expected:i},r}}else a=l}var c=a.map(function(e){return f(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,c))return(r=TypeError("Too few arguments in function "+s+" (expected: "+(i=x(a,o)).join(" or ")+", index: "+t.length+")")).data={category:"tooFewArgs",fn:s,index:t.length,expected:i},r;var d=Math.max.apply(null,c);return t.length>d?(r=TypeError("Too many arguments in function "+s+" (expected: "+d+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:s,index:t.length,expectedLength:d}:(r=TypeError('Arguments of type "'+t.join(", ")+'" do not match any of the defined signatures of function '+s+".")).data={category:"mismatch",actual:t.map(h)},r}function S(e){for(var t=999,n=0;n<e.types.length;n++)b(e.types[n])&&(t=Math.min(t,e.types[n].typeIndex));return t}function C(e){for(var t=999,n=0;n<e.types.length;n++)b(e.types[n])||(t=Math.min(t,e.types[n].conversionIndex));return t}function k(e,t){var n,r,i=Math.min(e.params.length,t.params.length);if(0!=(r=e.params.some(p)-t.params.some(p)))return r;for(n=0;n<i;n++)if(0!=(r=p(e.params[n])-p(t.params[n])))return r;for(n=0;n<i;n++)if(0!==(r=function(e,t){var n;return 0!=(n=e.restParam-t.restParam)||0!=(n=p(e)-p(t))||0!=(n=S(e)-S(t))?n:C(e)-C(t)}(e.params[n],t.params[n])))return r;return e.params.length-t.params.length}function M(e){var t,n,r,i,o=[],s=[];switch(e.types.forEach(function(e){e.conversion&&(o.push(u(e.conversion.from).test),s.push(e.conversion.convert))}),s.length){case 0:return function(e){return e};case 1:return t=o[0],r=s[0],function(e){return t(e)?r(e):e};case 2:return t=o[0],n=o[1],r=s[0],i=s[1],function(e){return t(e)?r(e):n(e)?i(e):e};default:return function(e){for(var t=0;t<s.length;t++)if(o[t](e))return s[t](e);return e}}}function T(e,t){return function e(n,r,i){if(!(r<n.length))return[i.map(function(e,t){return{types:e,restParam:t===n.length-1&&f(n)}})];var o,s=n[r],a=t?s.types.filter(b):s.types;if(s.restParam){var l=a.filter(b);o=l.length<a.length?[l,a]:[a]}else o=a.map(function(e){return[e]});return F(o,function(t){return e(n,r+1,i.concat([t]))})}(e,0,[])}function A(e,r){if(0===Object.keys(r).length)throw SyntaxError("No signatures provided");var i,o=[];Object.keys(r).map(function(e){var t,n,i;return t=r[e],n=l.conversions,i=[],(""!==e.trim()&&(i=e.split(",").map(O).map(function(e,t,r){var i,o,s,a,l,h,d,f,p=(i=n,o=l=((a=0===e.indexOf("..."))?e.length>3?e.slice(3):"any":e).split("|").map(O).filter(R).filter(E),s={},i.forEach(function(e){-1!==o.indexOf(e.from)||-1===o.indexOf(e.to)||s[e.from]||(s[e.from]=e)}),h=Object.keys(s).map(function(e){return s[e]}),d=l.map(function(e){var t=u(e);return{name:e,typeIndex:c(t),test:t.test,conversion:null,conversionIndex:-1}}),f=h.map(function(e){var t=u(e.from);return{name:e.from,typeIndex:c(t),test:t.test,conversion:e,conversionIndex:n.indexOf(e)}}),{types:d.concat(f),restParam:a});if(p.restParam&&t!==r.length-1)throw SyntaxError('Unexpected rest parameter "'+e+'": only allowed for the last parameter');return p})),i.some(I))?null:{params:i,fn:t}}).filter(P).forEach(function(e){var t=L(o,function(t){return function(e,t){for(var n=Math.max(e.params.length,t.params.length),r=0;r<n;r++)if(!function(e,t){for(var n,r=0;r<e.length;r++)if(n=e[r],-1!==t.indexOf(n))return!0;return!1}(v(e,r,!0),v(t,r,!0)))return!1;var i=e.params.length,o=t.params.length,s=f(e.params),a=f(t.params);return s?a?i===o:o>=i:a?i>=o:i===o}(t,e)});if(t)throw TypeError('Conflicting signatures "'+d(t.params)+'" and "'+d(e.params)+'".');o.push(e)});var s=F(o,function(e){return(e?T(e.params,!1):[]).map(function(t){return{params:t,fn:e.fn}})}).filter(P);s.sort(k);var a=s[0]&&s[0].params.length<=2&&!f(s[0].params),h=s[1]&&s[1].params.length<=2&&!f(s[1].params),g=s[2]&&s[2].params.length<=2&&!f(s[2].params),y=s[3]&&s[3].params.length<=2&&!f(s[3].params),b=s[4]&&s[4].params.length<=2&&!f(s[4].params),x=s[5]&&s[5].params.length<=2&&!f(s[5].params),w=s.map(function(e){return function(e){var t,n,r;if(f(e)){var i,o=(t=(i=e).slice(0,i.length-1).map(m)).length,s=m(N(e)),a=function(e){for(var t=o;t<e.length;t++)if(!s(e[t]))return!1;return!0};return function(e){for(var n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return a(e)&&e.length>=o+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(n=m(e[0]),function(e){return n(e[0])&&1===e.length}):2===e.length?(n=m(e[0]),r=m(e[1]),function(e){return n(e[0])&&r(e[1])&&2===e.length}):(t=e.map(m),function(e){for(var n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return e.length===t.length})}(e.params)}),S=a?m(s[0].params[0]):t,C=h?m(s[1].params[0]):t,A=g?m(s[2].params[0]):t,D=y?m(s[3].params[0]):t,Z=b?m(s[4].params[0]):t,B=x?m(s[5].params[0]):t,V=a?m(s[0].params[1]):t,z=h?m(s[1].params[1]):t,_=g?m(s[2].params[1]):t,H=y?m(s[3].params[1]):t,$=b?m(s[4].params[1]):t,W=x?m(s[5].params[1]):t,q=s.map(function(e){return function(e,t){var n=t;if(e.some(p)){var r=f(e),i=e.map(M);n=function(){for(var e=[],n=r?arguments.length-1:arguments.length,o=0;o<n;o++)e[o]=i[o](arguments[o]);return r&&(e[n]=arguments[n].map(i[n])),t.apply(this,e)}}var o=n;if(f(e)){var s=e.length-1;o=function(){return n.apply(this,j(arguments,0,s).concat([j(arguments,s)]))}}return o}(e.params,e.fn)}),G=a?q[0]:n,U=h?q[1]:n,K=g?q[2]:n,Y=y?q[3]:n,X=b?q[4]:n,Q=x?q[5]:n,J=a?s[0].params.length:-1,ee=h?s[1].params.length:-1,et=g?s[2].params.length:-1,en=y?s[3].params.length:-1,er=b?s[4].params.length:-1,ei=x?s[5].params.length:-1,eo=6*!!(a&&h&&g&&y&&b&&x),es=s.length,ea=function(){for(var t=eo;t<es;t++)if(w[t](arguments))return q[t].apply(this,arguments);return l.onMismatch(e,arguments,s)},el=function e(t,n){return arguments.length===J&&S(t)&&V(n)?G.apply(e,arguments):arguments.length===ee&&C(t)&&z(n)?U.apply(e,arguments):arguments.length===et&&A(t)&&_(n)?K.apply(e,arguments):arguments.length===en&&D(t)&&H(n)?Y.apply(e,arguments):arguments.length===er&&Z(t)&&$(n)?X.apply(e,arguments):arguments.length===ei&&B(t)&&W(n)?Q.apply(e,arguments):ea.apply(e,arguments)};try{Object.defineProperty(el,"name",{value:e})}catch(e){}return el.signatures=(i={},s.forEach(function(e){e.params.some(p)||T(e.params,!0).forEach(function(t){i[d(t)]=e.fn})}),i),el}function D(e,t,n){throw w(e,t,n)}function E(e){return -1===l.ignore.indexOf(e)}function O(e){return e.trim()}function R(e){return!!e}function P(e){return null!==e}function I(e){return 0===e.types.length}function N(e){return e[e.length-1]}function j(e,t,n){return Array.prototype.slice.call(e,t,n)}function L(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function F(e,t){return Array.prototype.concat.apply([],e.map(t))}function Z(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(("object"==typeof r.signatures||"string"==typeof r.signature)&&""!==r.name){if(""===t)t=r.name;else if(t!==r.name){var i=Error("Function names do not match (expected: "+t+", actual: "+r.name+")");throw i.data={actual:r.name,expected:t},i}}}return t}function B(e){var t,n={};function r(e,r){if(n.hasOwnProperty(e)&&r!==n[e])throw(t=Error('Signature "'+e+'" is defined twice')).data={signature:e},t}for(var i=0;i<e.length;i++){var o=e[i];if("object"==typeof o.signatures)for(var s in o.signatures)o.signatures.hasOwnProperty(s)&&(r(s,o.signatures[s]),n[s]=o.signatures[s]);else if("string"==typeof o.signature)r(o.signature,o),n[o.signature]=o;else throw(t=TypeError("Function is no typed-function (index: "+i+")")).data={index:i},t}return n}return(l=A("typed",{"string, Object":A,Object:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return A(Z(t),e)},"...Function":function(e){return A(Z(e),B(e))},"string, ...Function":function(e,t){return A(e,B(t))}})).create=r,l.types=i,l.conversions=a,l.ignore=s,l.onMismatch=D,l.throwMismatchError=D,l.createError=w,l.convert=function(e,t){var n=h(e);if(t===n)return e;for(var r=0;r<l.conversions.length;r++){var i=l.conversions[r];if(i.from===n&&i.to===t)return i.convert(e)}throw Error("Cannot convert from "+n+" to "+t)},l.find=function(e,t){if(!e.signatures)throw TypeError("Function is no typed-function");if("string"==typeof t){n=t.split(",");for(var n,r=0;r<n.length;r++)n[r]=n[r].trim()}else if(Array.isArray(t))n=t;else throw TypeError("String array or a comma separated string expected");var i=n.join(","),o=e.signatures[i];if(o)return o;throw TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+n.join(", ")+"))")},l.addType=function(e,t){if(!e||"string"!=typeof e.name||"function"!=typeof e.test)throw TypeError("Object with properties {name: string, test: function} expected");if(!1!==t){for(var n=0;n<l.types.length;n++)if("Object"===l.types[n].name){l.types.splice(n,0,e);return}}l.types.push(e)},l.addConversion=function(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");l.conversions.push(e)},l}()},"function"==typeof define&&define.amd?define([],t):e.exports=t()}}]);