(()=>{"use strict";var t={d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{ColorArrayItem:()=>g,ColortblConfiguration:()=>f});const o=("undefined"!=typeof window?window:global).MathJax._.components.global,r=(o.GLOBAL,o.isObject,o.combineConfig,o.combineDefaults,o.combineWithMathJax),a=(o.MathJax,MathJax._.input.tex.HandlerTypes),n=a.ConfigurationType,l=a.HandlerType,i=MathJax._.input.tex.base.BaseItems,s=(i.StartItem,i.StopItem,i.OpenItem,i.CloseItem,i.NullItem,i.PrimeItem,i.SubsupItem,i.OverItem,i.LeftItem,i.Middle,i.RightItem,i.BreakItem,i.BeginItem,i.EndItem,i.StyleItem,i.PositionItem,i.CellItem,i.MmlItem,i.FnItem,i.NotItem,i.NonscriptItem,i.DotsItem,i.ArrayItem),c=(i.EqnArrayItem,i.MstyleItem,i.EquationItem,MathJax._.input.tex.Configuration),m=c.Configuration,p=c.ConfigurationHandler,u=(c.ParserConfiguration,MathJax._.input.tex.TokenMap),d=(u.parseResult,u.AbstractTokenMap,u.RegExpMap,u.AbstractParseMap,u.CharacterMap,u.DelimiterMap,u.MacroMap,u.CommandMap),h=(u.EnvironmentMap,MathJax._.input.tex.TexError.default);class g extends s{constructor(){super(...arguments),this.color={cell:"",row:"",col:[]},this.hasColor=!1}EndEntry(){super.EndEntry();const t=this.row[this.row.length-1],e=this.color.cell||this.color.row||this.color.col[this.row.length-1];e&&(t.attributes.set("mathbackground",e),this.color.cell="",this.hasColor=!0)}EndRow(){super.EndRow(),this.color.row=""}createMml(){const t=super.createMml();let e=t.isKind("mrow")?t.childNodes[1]:t;if(e.isKind("mstyle")&&(e=e.childNodes[0].childNodes[0]),e.isKind("menclose")&&(e=e.childNodes[0].childNodes[0]),this.hasColor){const t=e.attributes;"none"===t.get("frame")&&void 0===t.get("data-frame-styles")&&t.set("data-frame-styles","")}return t}}function b(t,e,o){const r=t.configuration.packageData.get("color").model,a=t.GetBrackets(e,""),n=r.getColor(a,t.GetArgument(e)),l=t.stack.Top();if(!(l instanceof g))throw new h("UnsupportedTableColor","Unsupported use of %1",t.currentCS);if("col"===o){if(l.table.length&&l.color.col[l.row.length]!==n)throw new h("ColumnColorNotTop","%1 must be in the top row or preamble",e);l.color.col[l.row.length]=n,t.GetBrackets(e,"")&&t.GetBrackets(e,"")}else if(l.color[o]=n,"row"===o&&(l.Size()||l.row.length))throw new h("RowColorNotFirst","%1 must be at the beginning of a row",e)}new d("colortbl",{cellcolor:[b,"cell"],rowcolor:[b,"row"],columncolor:[b,"col"]});const f=m.create("colortbl",{[n.HANDLER]:{[l.MACRO]:["colortbl"]},[n.ITEMS]:{array:g},[n.PRIORITY]:10,[n.CONFIG]:[function(t,e){e.parseOptions.packageData.has("color")||p.get("color").config(t,e)},10]});MathJax.loader&&MathJax.loader.checkVersion("[tex]/colortbl","4.0.0","tex-extension"),r({_:{input:{tex:{colortbl:{ColortblConfiguration:e}}}}})})();